Application class
#include <include/engine/core/application.h>
Represents the client application that runs on top of the engine.
The client is expected to subclass Application and override the lifecycle methods.
Constructors, destructors, conversion operators
- ~Application() defaulted virtual
- Virtual destructor is crucial for proper inheritance cleanup.
Public functions
- void Run()
- Drives the main game loop.
- void OnInit() pure virtual
- Called once when the application starts.
- void OnShutdown() pure virtual
- Called once when the application is about to close.
- void OnUpdate(double delta_time_seconds) pure virtual
- Called every frame.
Protected functions
- auto window() -> Window&
- Provides access to the main application window.
- auto input_manager() -> InputManager&
- Provides access to the input manager for handling keyboard and mouse events.
-
auto main_camera() -> engine::
graphics:: Camera& - Provides access to the primary camera used for rendering the scene.
Function documentation
void engine:: Application:: Run()
Drives the main game loop.
This method will continuously call OnUpdate until the application is terminated.
void engine:: Application:: OnInit() pure virtual
Called once when the application starts.
This is the ideal place for one-time initialization code, such as loading assets.
void engine:: Application:: OnShutdown() pure virtual
Called once when the application is about to close.
Use this for cleanup code.
void engine:: Application:: OnUpdate(double delta_time_seconds) pure virtual
Called every frame.
| Parameters | |
|---|---|
| delta_time_seconds | The time elapsed since the last frame, in seconds. This value should be used for frame-rate independent physics and animations. |
Game logic and rendering should be handled here.
InputManager& engine:: Application:: input_manager() protected
Provides access to the input manager for handling keyboard and mouse events.
| Returns | Reference to the InputManager. |
|---|
engine:: graphics:: Camera& engine:: Application:: main_camera() protected
Provides access to the primary camera used for rendering the scene.
| Returns | Reference to the Camera. |
|---|