Class CameraController

java.lang.Object
com.prineside.tdi2.CameraController

public final class CameraController extends Object
  • Field Details

    • DEFAULT_MIN_ZOOM_TILE_SIZE

      public static final float DEFAULT_MIN_ZOOM_TILE_SIZE
      See Also:
    • DEFAULT_MAX_ZOOM_MAP_SCALE

      public static final float DEFAULT_MAX_ZOOM_MAP_SCALE
      See Also:
    • camera

      public OrthographicCamera camera
    • zoom

      public double zoom
    • hardZoomLimits

      public boolean hardZoomLimits
    • hardMinZoom

      public double hardMinZoom
    • hardMaxZoom

      public double hardMaxZoom
    • scrollZoomRequiresAlt

      public boolean scrollZoomRequiresAlt
    • outmapCheckEnabled

      public boolean outmapCheckEnabled
    • dragButtonIndices

      public IntArray dragButtonIndices
    • currentScenario

      public CameraTools.Scenario currentScenario
    • scenarioTime

      public float scenarioTime
    • scenarioLooped

      public boolean scenarioLooped
  • Constructor Details

    • CameraController

      public CameraController(OrthographicCamera camera, int mapWidth, int mapHeight)
  • Method Details

    • getRevZoomPercent

      public double getRevZoomPercent()
    • setRevZoomPercent

      public void setRevZoomPercent(double newZoom)
    • getMinZoom

      public double getMinZoom()
    • getMaxZoom

      public double getMaxZoom()
    • setMap

      public void setMap(Map map)
    • getMapWidth

      public int getMapWidth()
    • getMapHeight

      public int getMapHeight()
    • getInputProcessor

      public InputProcessor getInputProcessor()
    • playScenario

      public void playScenario(CameraTools.Scenario scenario, float time, boolean looped)
    • stopScenario

      public void stopScenario()
    • animate

      public void animate(CameraController.CameraControllerAnimation animation)
    • stopAnimations

      public void stopAnimations()
    • setScreenSize

      public void setScreenSize(int width, int height)
    • setMapSize

      public void setMapSize(int width, int height)
    • isRectVisible

      public boolean isRectVisible(Rectangle rectangle)
    • isIntRectVisible

      public boolean isIntRectVisible(IntRectangle rectangle)
    • isPointVisible

      public boolean isPointVisible(Vector2 pos, float size)
    • isPointVisible

      public boolean isPointVisible(float x, float y, float size)
    • isRectVisibleMarginSmall

      public boolean isRectVisibleMarginSmall(Rectangle rectangle)
    • addListener

      public void addListener(CameraController.CameraControllerListener listener)
    • removeListener

      public void removeListener(CameraController.CameraControllerListener listener)
    • updateMinMaxZoom

      public void updateMinMaxZoom()
    • setZoomBoundaries

      public void setZoomBoundaries(float minTileSizeCm, float maxZoomToMapScale)
    • setZoom

      public void setZoom(double newZoom)
    • lookAt

      public void lookAt(float x, float y)
    • getLookPos

      public Vector3 getLookPos()
    • lookAtAlignToViewport

      public void lookAtAlignToViewport(float x, float y, float viewportCoeffX, float viewportCoeffY)
      Make x, y appear at the specified vcX, vcY point of the viewport. Viewport coordinates are values in range 0..1
      Parameters:
      x - X axis of the point on map (px)
      y - Y axis of the point on map (px)
      viewportCoeffX - viewport coefficient, value between 0 (left) and 1 (right)
      viewportCoeffY - viewport coefficient, value between 0 (bottom) and 1 (top)
    • screenToViewport

      public void screenToViewport(Vector2 pos)
    • viewportToScreen

      public void viewportToScreen(Vector2 pos)
    • stageToScreen

      public void stageToScreen(Vector2 pos)
      Turn a stage coordinates (for example, an Actor's position) into a screen position (depends on the resolution)
    • screenToStage

      public void screenToStage(Vector2 pos)
    • screenToMap

      public void screenToMap(Vector2 pos)
    • stageToMap

      public void stageToMap(Vector2 pos)
    • mapToViewport

      public void mapToViewport(Vector2 pos)
    • mapToScreen

      public void mapToScreen(Vector2 pos)
    • mapToStage

      public void mapToStage(Vector2 pos)
    • fitMapToScreen

      public void fitMapToScreen(float padding)
      Centers the camera and sets the zoom level to make the whole map visible
      Parameters:
      padding - a minimal distance from a tile to the edge of the screen
    • realUpdate

      public void realUpdate(float deltaTime)
    • updateCamera

      public void updateCamera()