java.lang.Object
dev.aurumbyte.sypherengine.components.camera.Camera2D

public class Camera2D extends Object
Camera class for 2D camera transforms, currently still experimental
Since:
v0.3.2
Author:
AurumByte
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) javafx.scene.ParallelCamera
    The base camera class of JavaFX, that we're wrapping around to create the camera
    (package private) Vector2
    The position of the camera
    (package private) Entity
    The parent entity that the camera might be attached to
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creating a new camera, not attched to any entity
    Camera2D(Entity parent)
    Creating a new camera attached to an entity
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    A method to attach the camera to an entity
    javafx.scene.ParallelCamera
    Getting the base camera to attach to the scene.
    void
    setCameraPos(float xPos, float yPos)
    A method to move the camera to a specific location.
    void
    setCameraPos(Vector2 cameraPos)
    A method to move the camera to a specific location.
    void
    Updating the camera's position.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cameraPosition

      Vector2 cameraPosition
      The position of the camera
    • parent

      Entity parent
      The parent entity that the camera might be attached to
    • camera

      javafx.scene.ParallelCamera camera
      The base camera class of JavaFX, that we're wrapping around to create the camera
  • Constructor Details

    • Camera2D

      public Camera2D(Entity parent)

      Creating a new camera attached to an entity

      Parameters:
      parent - The entity to which the camera will be attached to
      Since:
      0.3.2
    • Camera2D

      public Camera2D()

      Creating a new camera, not attched to any entity

      Since:
      0.3.2
  • Method Details

    • attachToEntity

      public void attachToEntity(Entity entity)

      A method to attach the camera to an entity

      Parameters:
      entity - the Entity to which the camera will be attched to
      Since:
      0.3.2
    • setCameraPos

      public void setCameraPos(float xPos, float yPos)

      A method to move the camera to a specific location.

      Parameters:
      xPos - the new x position of the camera
      yPos - the new y position of the camera
      Since:
      0.3.2
    • setCameraPos

      public void setCameraPos(Vector2 cameraPos)

      A method to move the camera to a specific location.

      Parameters:
      cameraPos - the new x and y position of the camera, using the Vector2 class
      Since:
      0.3.2
    • getParallelCamera

      public javafx.scene.ParallelCamera getParallelCamera()

      Getting the base camera to attach to the scene.

      Since:
      0.3.2
    • update

      public void update()

      Updating the camera's position.

      Since:
      0.3.2