Class CameraComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.CameraComponent

public class CameraComponent extends Component
Component that manages camera positioning and rendering for an entity.
  • Constructor Details

    • CameraComponent

      public CameraComponent()
      Creates a camera component with a default orthographic camera.
    • CameraComponent

      public CameraComponent(com.badlogic.gdx.graphics.Camera camera)
      Creates a camera component with the specified camera.
      Parameters:
      camera - the camera to use
  • Method Details

    • update

      public void update()
      Description copied from class: Component
      Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
      Overrides:
      update in class Component
    • getProjectionMatrix

      public com.badlogic.gdx.math.Matrix4 getProjectionMatrix()
      Gets the projection matrix of the camera.
      Returns:
      the combined projection matrix
    • getCamera

      public com.badlogic.gdx.graphics.Camera getCamera()
      Gets the camera instance.
      Returns:
      the camera
    • resize

      public void resize(int screenWidth, int screenHeight, float gameWidth)
      Resizes the camera viewport based on screen dimensions.
      Parameters:
      screenWidth - the screen width
      screenHeight - the screen height
      gameWidth - the desired game width