Class ScreenViewport

java.lang.Object
arc.util.viewport.Viewport
arc.util.viewport.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 Details

    • ScreenViewport

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

      public ScreenViewport(Camera camera)
  • 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
    • 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.