Package arc.util.viewport
Class ExtendViewport
java.lang.Object
arc.util.viewport.Viewport
arc.util.viewport.ExtendViewport
A viewport that keeps the world aspect ratio by extending the world in one direction. The world is first scaled to fit within
the viewport, then the shorter dimension is lengthened to fill the viewport. A maximum size can be specified to limit how much
the world is extended and black bars (letterboxing) are used for any remaining space.
-
Constructor Summary
ConstructorDescriptionExtendViewport
(float minWorldWidth, float minWorldHeight) Creates a new viewport using a newCamera
with no maximum world size.ExtendViewport
(float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight) Creates a new viewport using a newCamera
and a maximum world size.ExtendViewport
(float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight, Camera camera) Creates a new viewport with a maximum world size.ExtendViewport
(float minWorldWidth, float minWorldHeight, Camera camera) Creates a new viewport with no maximum world size. -
Method Summary
Modifier and TypeMethodDescriptionfloat
float
float
float
void
setMaxWorldHeight
(float maxWorldHeight) void
setMaxWorldWidth
(float maxWorldWidth) void
setMinWorldHeight
(float minWorldHeight) void
setMinWorldWidth
(float minWorldWidth) 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
-
ExtendViewport
public ExtendViewport(float minWorldWidth, float minWorldHeight) Creates a new viewport using a newCamera
with no maximum world size. -
ExtendViewport
Creates a new viewport with no maximum world size. -
ExtendViewport
public ExtendViewport(float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight) Creates a new viewport using a newCamera
and a maximum world size. -
ExtendViewport
public ExtendViewport(float minWorldWidth, float minWorldHeight, float maxWorldWidth, float maxWorldHeight, Camera camera) Creates a new viewport with a maximum world size.- Parameters:
maxWorldWidth
- User 0 for no maximum width.maxWorldHeight
- User 0 for no maximum height.
-
-
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)
. -
getMinWorldWidth
public float getMinWorldWidth() -
setMinWorldWidth
public void setMinWorldWidth(float minWorldWidth) -
getMinWorldHeight
public float getMinWorldHeight() -
setMinWorldHeight
public void setMinWorldHeight(float minWorldHeight) -
getMaxWorldWidth
public float getMaxWorldWidth() -
setMaxWorldWidth
public void setMaxWorldWidth(float maxWorldWidth) -
getMaxWorldHeight
public float getMaxWorldHeight() -
setMaxWorldHeight
public void setMaxWorldHeight(float maxWorldHeight)
-