-
Notifications
You must be signed in to change notification settings - Fork 0
Viewport Managers
zenith391 edited this page Jan 3, 2019
·
7 revisions
Viewport managers are used to stretch/center/etc., with them, calling win.setViewport is not necessary again in each update(), plus, ViewportManagers are more optimized (resizing viewport only if window resized), they can of course be created by extending ViewportManagerclass. With thems, only one method is needed for the viewport to automatically resize 👍
Here are the (planned) ViewportManagers:
-
SizedViewport: Center the viewport (size given in arguments) -
EditableViewport: Allow the viewport to be edited (either via functions or args) -
RatioViewport: Calculate the size depending on window size and the given ratio (like 16:9 or 4:3) - (Planned)
StretchViewport: Will stretch the viewport to fill the window (with some restrictions) - ... more coming soon ...
Here is how to put a viewport manager: First you need to know it is inside SimpleGame init method Then, just do
win.setViewportManager(new SizedViewport(620, 480));And you now have a centering viewport !