Package com.badlogic.gdx.utils.viewport
Class ScreenViewport
- java.lang.Object
-
- com.badlogic.gdx.utils.viewport.Viewport
-
- com.badlogic.gdx.utils.viewport.ScreenViewport
-
-
Constructor Summary
Constructors Constructor Description ScreenViewport()Creates a new viewport using a newOrthographicCamera.ScreenViewport(Camera camera)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetUnitsPerPixel()voidsetUnitsPerPixel(float unitsPerPixel)Sets the number of pixels for each world unit.voidupdate(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 com.badlogic.gdx.utils.viewport.Viewport
apply, apply, calculateScissors, getBottomGutterHeight, getCamera, getLeftGutterWidth, getPickRay, getRightGutterWidth, getRightGutterX, getScreenHeight, getScreenWidth, getScreenX, getScreenY, getTopGutterHeight, getTopGutterY, getWorldHeight, getWorldWidth, project, project, setCamera, setScreenBounds, setScreenHeight, setScreenPosition, setScreenSize, setScreenWidth, setScreenX, setScreenY, setWorldHeight, setWorldSize, setWorldWidth, toScreenCoordinates, unproject, unproject, update
-
-
-
-
Constructor Detail
-
ScreenViewport
public ScreenViewport()
Creates a new viewport using a newOrthographicCamera.
-
ScreenViewport
public ScreenViewport(Camera camera)
-
-
Method Detail
-
update
public void update(int screenWidth, int screenHeight, boolean centerCamera)Description copied from class:ViewportConfigures this viewport's screen bounds using the specified screen size and callsViewport.apply(boolean). Typically called fromApplicationListener.resize(int, int)orScreen.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.
-
-