public class FitViewport extends ScalingViewport
Viewport
with a fixed virtual screen size. The virtual size will be scaled to fit in the game window.
However, black bars may appear around the viewport depending on the window size. The aspect ratio will always be maintained.Constructor and Description |
---|
FitViewport(boolean powerOfTwo,
float worldWidth,
float worldHeight)
Constructor
|
FitViewport(float worldWidth,
float worldHeight)
Constructor
|
isPowerOfTwo, onResize, setPowerOfTwo
apply, getHeight, getInvScaleX, getInvScaleY, getScaleX, getScaleY, getWidth, getX, getY, setBounds, toScreenCoordinates, toScreenCoordinates, toWorldCoordinates, toWorldCoordinates, unapply
public FitViewport(float worldWidth, float worldHeight)
worldWidth
- The virtual screen widthworldHeight
- The virtual screen heightpublic FitViewport(boolean powerOfTwo, float worldWidth, float worldHeight)
powerOfTwo
- True if scaling should only be applied in powers of twoworldWidth
- The virtual screen widthworldHeight
- The virtual screen height