Engine interface combining rendering and event handling.
More...
#include <headers/utility/engine.hpp>
Engine interface combining rendering and event handling.
This class provides an abstract interface for the core engine loop. Implementations should provide platform-specific rendering and event polling capabilities.
class MyEngine :
public Engine { ... };
Engine interface combining rendering and event handling.
Definition at line 59 of file engine.hpp.
◆ Handler
Type alias for an event handler callback function.
Takes a shared pointer to an Event and performs an action.
Definition at line 74 of file engine.hpp.
◆ ViewportSize
2D vector representing viewport width and height in pixels.
Definition at line 67 of file engine.hpp.
◆ createObject()
Create a new render object.
- Parameters
-
| object | A shared pointer to the renderable object to create. |
- Returns
- A unique identifier for the created object.
◆ getDeltaTime()
| virtual float utility::Engine::getDeltaTime |
( |
void |
| ) |
const |
|
virtual |
Get the time elapsed since the previous frame.
Implementations backed by a real clock should override this so that time-based systems (animations, transitions) advance with the platform frame rate. The default returns 0, in which case callers fall back to their own monotonic clock.
- Returns
- Delta time in seconds.
◆ getEventCallback()
| Handler & utility::Engine::getEventCallback |
( |
void |
| ) |
|
|
protected |
Get the current event callback function.
- Returns
- Reference to the event callback function.
◆ getScissor()
Get the active scissor (clip) rectangle.
- Returns
- The active rectangle, or std::nullopt when none is set.
◆ getView()
Get the full view model.
- Returns
- The view instance.
◆ measureText()
Measures the pixel dimensions of a given text string when rendered with a specific font.
- Parameters
-
- Returns
- A 2D vector containing the width and height of the rendered text in pixels in the form of utility::math::Vector2F.
◆ pollEvents()
| virtual void utility::Engine::pollEvents |
( |
void |
| ) |
|
|
pure virtual |
Poll for events and dispatch them.
This method should check for pending events from the underlying platform, convert them to Event objects, and call the registered callback for each event.
◆ removeObject()
Remove a previously added render object.
- Parameters
-
| object | The renderable object to remove. |
| objectID | The identifier returned by createObject. |
- Returns
- True when the object was removed.
◆ setEventCallback()
| void utility::Engine::setEventCallback |
( |
const Handler & |
callback | ) |
|
Set the event callback function.
The callback will be invoked for each event when pollEvents() is called.
- Parameters
-
| callback | Function to call when an event is received. |
◆ setScissor()
Set the active scissor (clip) rectangle.
The rectangle is expressed in framebuffer pixels. Implementations backed by a renderer should clip subsequent draws to it; the base implementation only stores the rectangle so it can be queried with getScissor().
- Parameters
-
| rect | The scissor rectangle to apply. |
◆ setShouldCaptureViewportInput()
| void utility::Engine::setShouldCaptureViewportInput |
( |
bool |
capture | ) |
|
Set the viewport input capture state.
- Parameters
-
| capture | True to enable viewport input capture, false to disable. When disabled, input is routed to UI instead of camera controls. |
◆ shouldCaptureViewportInput()
| bool utility::Engine::shouldCaptureViewportInput |
( |
void |
| ) |
const |
Check if viewport input capture is enabled.
- Returns
- True when viewport input is captured for camera movement.
◆ update()
| virtual void utility::Engine::update |
( |
void |
| ) |
|
|
pure virtual |
Update the engine state.
This method should handle logic updates, input processing, and other non-rendering related tasks. It is typically called once per frame, allowing the engine to respond to user input and update the state of objects in the renderer.
◆ updateObject()
Update a previously added render object.
- Parameters
-
| object | The updated renderable object. |
| objectID | The identifier returned by createObject. |
- Returns
- True when the object was updated.
The documentation for this class was generated from the following file: