Package arc.util.viewport
Class ScreenViewport
java.lang.Object
arc.util.viewport.Viewport
arc.util.viewport.ScreenViewport
A viewport where the world size is based on the size of the screen. By default 1 world unit == 1 screen pixel, but this ratio
can be
changed
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
void
setUnitsPerPixel
(float unitsPerPixel) Sets the number of pixels for each world unit.void
update
(int screenWidth, int screenHeight, boolean centerCamera) Configures this viewport's screen bounds using the specified screen size and callsViewport.apply(boolean)
.Methods inherited from class arc.util.viewport.Viewport
apply, apply, calculateScissors, getBottomGutterHeight, getCamera, getLeftGutterWidth, getRightGutterWidth, getRightGutterX, getScreenHeight, getScreenWidth, getScreenX, getScreenY, getTopGutterHeight, getTopGutterY, getWorldHeight, getWorldWidth, project, setCamera, setScreenBounds, setScreenHeight, setScreenPosition, setScreenSize, setScreenWidth, setScreenX, setScreenY, setWorldHeight, setWorldSize, setWorldWidth, toScreenCoordinates, unproject, update
-
Constructor Details
-
ScreenViewport
public ScreenViewport()Creates a new viewport using a newCamera
. -
ScreenViewport
-
-
Method Details
-
update
public void update(int screenWidth, int screenHeight, boolean centerCamera) Description copied from class:Viewport
Configures this viewport's screen bounds using the specified screen size and callsViewport.apply(boolean)
. Typically called fromApplicationListener.resize(int, int)
The default implementation only calls
Viewport.apply(boolean)
. -
getUnitsPerPixel
public float getUnitsPerPixel() -
setUnitsPerPixel
public void setUnitsPerPixel(float unitsPerPixel) Sets the number of pixels for each world unit. Eg, a scale of 2.5 means there are 2.5 world units for every 1 screen pixel. Default is 1.
-