|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.utils.viewport.Viewport com.badlogic.gdx.utils.viewport.ScreenViewport
public class 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 | |
---|---|
ScreenViewport()
Creates a new viewport using a new OrthographicCamera . |
|
ScreenViewport(Camera camera)
|
Method Summary | |
---|---|
float |
getUnitsPerPixel()
|
void |
setUnitsPerPixel(float unitsPerPixel)
Sets the number of pixels for each world unit. |
void |
update(int screenWidth,
int screenHeight,
boolean centerCamera)
Updates the viewport's camera. |
Methods inherited from class com.badlogic.gdx.utils.viewport.Viewport |
---|
calculateScissors, getBottomGutterHeight, getCamera, getLeftGutterWidth, getPickRay, getRightGutterWidth, getRightGutterX, getTopGutterHeight, getTopGutterY, getViewportHeight, getViewportWidth, getViewportX, getViewportY, getWorldHeight, getWorldWidth, project, project, setCamera, setWorldHeight, setWorldSize, setWorldWidth, toScreenCoordinates, unproject, unproject, update, update |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScreenViewport()
OrthographicCamera
.
public ScreenViewport(Camera camera)
Method Detail |
---|
public void update(int screenWidth, int screenHeight, boolean centerCamera)
Viewport
ApplicationListener#resize(int, int)
or
Screen#resize(int, int)
.
The default implementation calls GL20.glViewport(int, int, int, int)
and configures the camera viewport size.
update
in class Viewport
centerCamera
- If true, the camera position is set to the center of the world.public float getUnitsPerPixel()
public void setUnitsPerPixel(float unitsPerPixel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |