Class OrthographicCameraController#
Defined in File OrthographicCameraController.h
Class Documentation#
-
class OrthographicCameraController#
Remark
Headless mode: This class is not available in headless mode.
Public Functions
-
explicit constexpr OrthographicCameraController(f32 aspectRatio, bool rotation) noexcept#
Constructor. Initializes the Orthographic/2D camera and its controls.
- Parameters:
aspectRatio – Aspect ratio for the camera.
rotation – Enabled or disable rotation controls.
useController – Use the mouse and keyboard to control the camera or a controller.
controller – Which controller slot to use when useController is set to true.
-
explicit constexpr OrthographicCameraController(f32 aspectRatio, bool rotation, Input::Controller controller) noexcept#
Constructor. Initializes the Orthographic/2D camera and its controls.
- Parameters:
aspectRatio – Aspect ratio for the camera.
rotation – Enabled or disable rotation controls.
controller – Which controller slot to use when useController is set to true.
-
constexpr ~OrthographicCameraController() = default#
Destructor.
-
constexpr OrthographicCameraController(const OrthographicCameraController&) noexcept = default#
Copy constructor.
-
constexpr OrthographicCameraController &operator=(const OrthographicCameraController&) = default#
Copy assignment operator.
-
constexpr OrthographicCameraController(OrthographicCameraController&&) noexcept = default#
Move constructor.
-
constexpr OrthographicCameraController &operator=(OrthographicCameraController&&) = default#
Move assignment operator.
-
void OnUpdate(const Utils::TimeStep &deltaTime)#
Update the camera.
Update controller or mouse/keyboard state depending on useController variable.
Update camera position and optionally rotation.
- Parameters:
deltaTime – Time since last frame.
-
void OnEvent(Events::Event &e)#
Receive and handle mouse scroll and framebuffer resize events.
- Parameters:
e – Event to handle.
-
constexpr void OnResize(f32 width, f32 height)#
Resize the camera.
Recalculates the aspect ratio, the camera bounds and the projection matrix.
- Parameters:
width – New width of the camera.
height – New height of the camera.
-
constexpr OrthographicCamera &GetCamera() noexcept#
Retrieve the Orthographic/2D camera.
- Returns:
Orthographic/2D camera.
-
constexpr const OrthographicCamera &GetCamera() const noexcept#
Retrieve the Orthographic/2D camera.
- Returns:
Orthographic/2D camera.
-
constexpr f32 GetTranslationSpeed() const noexcept#
Retrieve the currently used translation/movement speed.
- Returns:
Translation/movement speed.
-
constexpr void SetTranslationSpeed(f32 translationSpeed) noexcept#
Set the translation/movement speed.
- Parameters:
translationSpeed – New translation/movement speed.
-
constexpr f32 GetRotationSpeed() const noexcept#
Retrieve the currently used rotation speed.
- Returns:
Rotation speed.
-
constexpr void SetRotationSpeed(f32 rotationSpeed) noexcept#
Set the rotation speed.
- Parameters:
rotationSpeed – New rotation speed.
-
constexpr void SetZoomLevel(f32 zoomLevel)#
Set the zoom level.
- Parameters:
zoomLevel – New zoom level.
-
constexpr const OrthographicCameraBounds &GetBounds() const noexcept#
Retrieve the current camera bounds.
- Returns:
Camera bounds.
-
explicit constexpr OrthographicCameraController(f32 aspectRatio, bool rotation) noexcept#