Class CameraData

java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.camera.CameraData
All Implemented Interfaces:
Lifecycle, Printable, ComponentFinder, EntityFinder

public class CameraData extends Component
  • Field Details

    • zoomFactor

      public float zoomFactor
    • width

      public float width
    • height

      public float height
    • backgroundColor

      public Color backgroundColor
  • Constructor Details

    • CameraData

      public CameraData()
    • CameraData

      public CameraData(Color backgroundColor)
  • Method Details

    • setSize

      public void setSize(int width, int height)
    • setBackgroundColor

      public void setBackgroundColor(Color color)
    • multiplyZoom

      public void multiplyZoom(float factor)
      Zooms the camera by a factor.
      Parameters:
      factor - Zoom factor
    • zoomIn

      public void zoomIn(float zoom)
      Zooms the camera in or out based on a zoom value. Use a positive value to zoom in and a negative value to zoom out.
      Parameters:
      zoom - Zoom value
    • getScale

      public float getScale()
      Returns the scale of the camera's viewport.
      Returns:
      Scale
    • getZoom

      public float getZoom()
      Returns the zoom value multiplied by the scale of the viewport.
      Returns:
      Zoom value
    • getCenterX

      public float getCenterX()
      Returns the horizontal center of this camera.
      Returns:
      X value
    • getCenterY

      public float getCenterY()
      Returns the vertical center of this camera.
      Returns:
      Y value
    • applyTransform

      public Vector2f applyTransform(float x, float y)
      Applies the camera's transformation to a given x and y value.
      Returns:
      Array of x and y values
    • applyTransform

      public Vector2f applyTransform(Vector2f position)
      Applies the camera's transformation to a given position.
      Returns:
      Array of x and y values
    • screenToWorldPosition

      public Vector2f screenToWorldPosition(Vector2i screenPosition)
    • screenToWorldPosition

      public Vector2f screenToWorldPosition(int screenX, int screenY)