Package arc.util.viewport
Class ScalingViewport
java.lang.Object
arc.util.viewport.Viewport
arc.util.viewport.ScalingViewport
- Direct Known Subclasses:
FillViewport
,FitViewport
,StretchViewport
A viewport that scales the world using
Scaling
.
Scaling.fit
keeps the aspect ratio by scaling the world up to fit the screen, adding black bars (letterboxing) for the
remaining space.
Scaling.fill
keeps the aspect ratio by scaling the world up to take the whole screen (some of the world may be off
screen).
Scaling.stretch
does not keep the aspect ratio, the world is scaled to take the whole screen.
Scaling.none
keeps the aspect ratio by using a fixed size world (the world may not fill the screen or some of the world
may be off screen).
-
Constructor Summary
ConstructorDescriptionScalingViewport
(Scaling scaling, float worldWidth, float worldHeight) Creates a new viewport using a newCamera
.ScalingViewport
(Scaling scaling, float worldWidth, float worldHeight, Camera camera) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setScaling
(Scaling scaling) 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
-
ScalingViewport
Creates a new viewport using a newCamera
. -
ScalingViewport
-
-
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)
. -
getScaling
-
setScaling
-