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 57 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 72 of file engine.hpp.
◆ ViewportSize
2D vector representing viewport width and height in pixels.
Definition at line 65 of file engine.hpp.
◆ addMesh()
| virtual size_t utility::Engine::addMesh |
( |
const utility::graphic::Mesh & |
mesh, |
|
|
const std::string & |
materialName |
|
) |
| |
|
pure virtual |
Add a mesh to the engine.
- Parameters
-
| mesh | The mesh to add to the engine. |
| materialName | The name of the material to use for rendering the mesh. |
- Returns
- A unique identifier for the added mesh.
◆ addModel()
Add a model to the engine for rendering.
- Parameters
-
| model | A shared pointer to the model to add. |
- Returns
- A unique identifier for the added model.
◆ addScene()
| virtual void utility::Engine::addScene |
( |
size_t |
sceneIndex | ) |
|
|
pure virtual |
Add a scene to the engine.
- Parameters
-
| sceneIndex | The index of the scene to add. |
◆ addText()
Add a text element to the engine at a specified pose.
- Parameters
-
- Returns
- A unique identifier for the added text.
◆ getEventCallback()
| Handler & utility::Engine::getEventCallback |
( |
void |
| ) |
|
|
protected |
Get the current event callback function.
- Returns
- Reference to the event callback function.
◆ 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()
| virtual bool utility::Engine::removeObject |
( |
size_t |
objectID | ) |
|
|
pure virtual |
Remove a previously added render object.
- Parameters
-
| objectID | The identifier returned by addMesh/addText. |
- 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. |
◆ 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 scene.
The documentation for this class was generated from the following file: