/** Configures this viewport's screen bounds using the specified screen size and calls {@link #apply(boolean)}. Typically called * from {@link ApplicationListener#resize(int, int)} or {@link Screen#resize(int, int)}. * <p> * The default implementation only calls {@link #apply(boolean)}. */ public void update (int screenWidth, int screenHeight, boolean centerCamera) { apply(centerCamera); }
public ScalingViewport (Scaling scaling, float worldWidth, float worldHeight, Camera camera) { this.scaling = scaling; setWorldSize(worldWidth, worldHeight); setCamera(camera); }
/** Transforms the coordinates to screen coordinates. The coordinates can be anywhere in the stage since the transform matrix * describes how to convert them. The transform matrix is typically obtained from {@link Batch#getTransformMatrix()} during * {@link Actor#draw(Batch, float)}. * @see Actor#localToStageCoordinates(Vector2) */ public Vector2 toScreenCoordinates (Vector2 coords, Matrix4 transformMatrix) { return viewport.toScreenCoordinates(coords, transformMatrix); }
@Override public void resize (int width, int height) { viewport.update(width, height, CENTER_CAM); }
@Override public void update (int screenWidth, int screenHeight, boolean centerCamera) { setScreenBounds(0, 0, screenWidth, screenHeight); setWorldSize(screenWidth * unitsPerPixel, screenHeight * unitsPerPixel); apply(centerCamera); }
/** Transforms the stage coordinates to screen coordinates. * @param stageCoords Input stage coordinates and output for resulting screen coordinates. */ public Vector2 stageToScreenCoordinates (Vector2 stageCoords) { viewport.project(stageCoords); stageCoords.y = viewport.getScreenHeight() - stageCoords.y; return stageCoords; }
/** The viewport's world width. */ public float getWidth () { return viewport.getWorldWidth(); }
/** The viewport's world height. */ public float getHeight () { return viewport.getWorldHeight(); }
/** Transforms the screen coordinates to stage coordinates. * @param screenCoords Input screen coordinates and output for resulting stage coordinates. */ public Vector2 screenToStageCoordinates (Vector2 screenCoords) { viewport.unproject(screenCoords); return screenCoords; }
/** Creates a new viewport with a maximum world size. * @param maxWorldWidth User 0 for no maximum width. * @param maxWorldHeight User 0 for no maximum height. */ public ExtendViewport (float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight, Camera camera) { this.minWorldWidth = minWorldWidth; this.minWorldHeight = minWorldHeight; this.maxWorldWidth = maxWorldWidth; this.maxWorldHeight = maxWorldHeight; setCamera(camera); }
/** Calls {@link #update(int, int, boolean)} with false. */ public final void update (int screenWidth, int screenHeight) { update(screenWidth, screenHeight, false); }
/** Configures this viewport's screen bounds using the specified screen size and calls {@link #apply(boolean)}. Typically called * from {@link ApplicationListener#resize(int, int)} or {@link Screen#resize(int, int)}. * <p> * The default implementation only calls {@link #apply(boolean)}. */ public void update (int screenWidth, int screenHeight, boolean centerCamera) { apply(centerCamera); }
@Override public void update (int screenWidth, int screenHeight, boolean centerCamera) { setScreenBounds(0, 0, screenWidth, screenHeight); setWorldSize(screenWidth * unitsPerPixel, screenHeight * unitsPerPixel); apply(centerCamera); }
/** Transforms the stage coordinates to screen coordinates. * @param stageCoords Input stage coordinates and output for resulting screen coordinates. */ public Vector2 stageToScreenCoordinates (Vector2 stageCoords) { viewport.project(stageCoords); stageCoords.y = viewport.getScreenHeight() - stageCoords.y; return stageCoords; }
/** The viewport's world width. */ public float getWidth () { return viewport.getWorldWidth(); }
/** Transforms the screen coordinates to stage coordinates. * @param screenCoords Input screen coordinates and output for resulting stage coordinates. */ public Vector2 screenToStageCoordinates (Vector2 screenCoords) { viewport.unproject(screenCoords); return screenCoords; }
public ScalingViewport (Scaling scaling, float worldWidth, float worldHeight, Camera camera) { this.scaling = scaling; setWorldSize(worldWidth, worldHeight); setCamera(camera); }
/** Transforms the coordinates to screen coordinates. The coordinates can be anywhere in the stage since the transform matrix * describes how to convert them. The transform matrix is typically obtained from {@link Batch#getTransformMatrix()} during * {@link Actor#draw(Batch, float)}. * @see Actor#localToStageCoordinates(Vector2) */ public Vector2 toScreenCoordinates (Vector2 coords, Matrix4 transformMatrix) { return viewport.toScreenCoordinates(coords, transformMatrix); }
/** Creates a new viewport with a maximum world size. * @param maxWorldWidth User 0 for no maximum width. * @param maxWorldHeight User 0 for no maximum height. */ public ExtendViewport (float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight, Camera camera) { this.minWorldWidth = minWorldWidth; this.minWorldHeight = minWorldHeight; this.maxWorldWidth = maxWorldWidth; this.maxWorldHeight = maxWorldHeight; setCamera(camera); }
/** Calls {@link #apply(boolean)} with false. */ public void apply () { apply(false); }