Class Engine::CameraSystem¶
ClassList > Engine > CameraSystem
Moves cameras (follow, shake) and converts them into raylib cameras for rendering.
#include <CameraSystem.hpp>
Inherits the following classes: Engine::System
Public Attributes inherited from Engine::System¶
See Engine::System
| Type | Name |
|---|---|
| std::set< Entity > | m_Entities |
Public Functions¶
| Type | Name |
|---|---|
| virtual void | Update (Registry & registry, float dt) override Moves every camera towards its follow target and decays its shake. |
Public Functions inherited from Engine::System¶
See Engine::System
| Type | Name |
|---|---|
| virtual void | OnSceneUnloaded (Registry & registry) Called right before the current scene's entities are destroyed. |
| virtual void | Render (Registry & registry) World pass: drawn inside the active camera. |
| virtual void | RenderScreen (Registry & registry) Screen pass: drawn after the world, in window pixels. |
| virtual void | Update (Registry & registry, float dt) |
| virtual | ~System () = default |
Public Static Functions¶
| Type | Name |
|---|---|
| Camera2D | GetActiveCamera (Registry & registry, float viewportWidth, float viewportHeight) Builds the raylib camera of the active camera for a given viewport. |
| Vector2 | ScreenToWorld (Registry & registry, Vector2 screen) Converts a canvas position into a world position. |
| Vector2 | WorldToScreen (Registry & registry, Vector2 world) Converts a world position into a canvas position. |
Public Functions Documentation¶
function Update¶
Moves every camera towards its follow target and decays its shake.
Parameters:
registryThe ECS registry containing the cameras.dtDelta time in seconds.
Implements Engine::System::Update
Public Static Functions Documentation¶
function GetActiveCamera¶
Builds the raylib camera of the active camera for a given viewport.
static Camera2D Engine::CameraSystem::GetActiveCamera (
Registry & registry,
float viewportWidth,
float viewportHeight
)
Returns an identity camera (world == screen) when there is no primary camera, so games without a camera render exactly as before.
Parameters:
registryThe ECS registry.viewportWidthWidth in pixels of the surface being drawn to.viewportHeightHeight in pixels of the surface being drawn to.
function ScreenToWorld¶
Converts a canvas position into a world position.
Parameters:
registryThe ECS registry.screenPosition in virtual-canvas pixels.
function WorldToScreen¶
Converts a world position into a canvas position.
Parameters:
registryThe ECS registry.worldPosition in world units.
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Systems/CameraSystem.hpp