public abstract class Viewport
extends java.lang.Object
| Constructor and Description |
|---|
Viewport() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(Graphics g)
Configures the
Graphics context for the viewport. |
int |
getHeight() |
float |
getInvScaleX() |
float |
getInvScaleY() |
float |
getScaleX() |
float |
getScaleY() |
int |
getWidth() |
int |
getX() |
int |
getY() |
protected abstract void |
onResize(int windowWidth,
int windowHeight) |
protected void |
setBounds(int x,
int y,
int width,
int height,
float scaleX,
float scaleY) |
void |
toScreenCoordinates(org.mini2Dx.gdx.math.Vector2 worldCoordinates)
Converts a game world coordinate to a pixel coordinate on screen
|
void |
toScreenCoordinates(org.mini2Dx.gdx.math.Vector2 result,
float worldX,
float worldY)
Converts the game world's coordinate to a pixel coordinate on screen
|
void |
toWorldCoordinates(org.mini2Dx.gdx.math.Vector2 screenCoordinates)
Converts a pixel coordinate to a game world coordinate
|
void |
toWorldCoordinates(org.mini2Dx.gdx.math.Vector2 result,
float screenX,
float screenY)
Converts a pixel coordinate to a game world coordinate
|
void |
unapply(Graphics g)
Restores the
Graphics to its state before apply(Graphics) was invoked. |
protected abstract void onResize(int windowWidth,
int windowHeight)
public void apply(Graphics g)
Graphics context for the viewport. Note: This will manipulate the scale, clip and translation of the Graphics context.g - The Graphics instance to configurepublic void unapply(Graphics g)
Graphics to its state before apply(Graphics) was invoked.g - The Graphics instancepublic void toScreenCoordinates(org.mini2Dx.gdx.math.Vector2 result,
float worldX,
float worldY)
result - The Vector2 to store the result inworldX - The world x coordinateworldY - The world y coordinatepublic void toWorldCoordinates(org.mini2Dx.gdx.math.Vector2 result,
float screenX,
float screenY)
result - The Vector2 to store the result inscreenX - The pixel x coodinatescreenY - The pixel y coordinatepublic void toScreenCoordinates(org.mini2Dx.gdx.math.Vector2 worldCoordinates)
worldCoordinates - The Vector2 to convert. The result is stored in this Vector2.public void toWorldCoordinates(org.mini2Dx.gdx.math.Vector2 screenCoordinates)
screenCoordinates - The Vector2 to convert. The result is stored in this Vector2.protected void setBounds(int x,
int y,
int width,
int height,
float scaleX,
float scaleY)
public int getX()
public int getY()
public int getWidth()
public int getHeight()
public float getScaleX()
public float getInvScaleX()
public float getScaleY()
public float getInvScaleY()