Class ExtendViewport

java.lang.Object
arc.util.viewport.Viewport
arc.util.viewport.ExtendViewport

public class ExtendViewport extends Viewport
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 Details

    • ExtendViewport

      public ExtendViewport(float minWorldWidth, float minWorldHeight)
      Creates a new viewport using a new Camera with no maximum world size.
    • ExtendViewport

      public ExtendViewport(float minWorldWidth, float minWorldHeight, Camera camera)
      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 new Camera and a maximum world size.
      See Also:
    • 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 calls Viewport.apply(boolean). Typically called from ApplicationListener.resize(int, int)

      The default implementation only calls Viewport.apply(boolean).

      Overrides:
      update in class Viewport
    • 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)