Class ScreenViewport


  • public class ScreenViewport
    extends Viewport
    A viewport where the world size is based on the size of the screen. By default 1 world unit == 1 screen pixel, but this ratio can be changed.
    • Constructor Detail

      • ScreenViewport

        public ScreenViewport()
        Creates a new viewport using a new OrthographicCamera.
      • ScreenViewport

        public ScreenViewport​(Camera camera)
    • Method Detail

      • getUnitsPerPixel

        public float getUnitsPerPixel()
      • setUnitsPerPixel

        public void setUnitsPerPixel​(float unitsPerPixel)
        Sets the number of pixels for each world unit. Eg, a scale of 2.5 means there are 2.5 world units for every 1 screen pixel. Default is 1.