Struct Engine::CameraComponent¶
ClassList > Engine > CameraComponent
2D camera that decides which part of the world is shown on screen. More...
#include <CameraComponent.hpp>
Public Attributes¶
| Type | Name |
|---|---|
| Rectangle | bounds World-space rectangle the view is kept inside when clampToBounds is set. |
| bool | clampToBounds When true, the view never shows anything outside bounds . |
| float | followSpeed How fast the camera catches up with followTarget , per second. 0 snaps instantly to the target. |
| std::optional< Entity > | followTarget Entity whosePosition the camera follows. No follow when empty. |
| bool | primary When true, this camera is a candidate for rendering. |
| float | shakeDecay Trauma lost per second. |
| float | shakeMagnitude Maximum shake offset in world units, reached when trauma is 1. |
| float | shakeOffsetX = 0.0fShake offset of the current frame, written by CameraSystem . |
| float | shakeOffsetY = 0.0fShake offset of the current frame, written by CameraSystem . |
| float | shakeTrauma Current shake intensity in [0, 1]. Set it to 1 to trigger a full shake. |
| float | zoom Zoom factor (1 = no zoom, 2 = everything twice as big). |
Public Functions¶
| Type | Name |
|---|---|
| CameraComponent (float zoom=1.0f, bool primary=true) Constructs a camera with explicit settings and defaults. |
Detailed Description¶
The camera reuses the transform of its entity: * Position is the world point drawn at the center of the viewport. * Rotation is the rotation of the view, in degrees.
Only one camera is used for rendering: the primary camera with the lowest entity id. Entities tagged with ScreenSpace ignore the camera (HUD, menus...).
Public Attributes Documentation¶
variable bounds¶
World-space rectangle the view is kept inside when clampToBounds is set.
variable clampToBounds¶
When true, the view never shows anything outside bounds .
variable followSpeed¶
How fast the camera catches up with followTarget , per second. 0 snaps instantly to the target.
variable followTarget¶
Entity whosePosition the camera follows. No follow when empty.
variable primary¶
When true, this camera is a candidate for rendering.
variable shakeDecay¶
Trauma lost per second.
variable shakeMagnitude¶
Maximum shake offset in world units, reached when trauma is 1.
variable shakeOffsetX¶
Shake offset of the current frame, written by CameraSystem .
variable shakeOffsetY¶
Shake offset of the current frame, written by CameraSystem .
variable shakeTrauma¶
Current shake intensity in [0, 1]. Set it to 1 to trigger a full shake.
variable zoom¶
Zoom factor (1 = no zoom, 2 = everything twice as big).
Public Functions Documentation¶
function CameraComponent¶
Constructs a camera with explicit settings and defaults.
Parameters:
zoomZoom factor.primaryWhether this camera can be used for rendering.
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/CameraComponent.hpp