Class ExtendViewport


  • public class ExtendViewport
    extends Viewport
    A viewport that keeps the world aspect ratio by both scaling and extending the world. By default, the world is first scaled to fit within the viewport using Scaling.fit, then the shorter dimension is lengthened to fill the viewport. Other scaling, such as Scaling.contain, may lengthen the world in both directions. 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 Detail

      • ExtendViewport

        public ExtendViewport​(float minWorldWidth,
                              float minWorldHeight)
        Creates a new viewport using a new OrthographicCamera 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,
                              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 Detail

      • 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)
      • setScaling

        public void setScaling​(Scaling scaling)