Engine
WolfEngine is the core singleton class. It owns the major subsystems, runs the game loop, and exposes global accessor helpers so gameplay code can reach systems without passing references around.
Startup Flow
#include "WolfEngine/WolfEngine.hpp"
extern "C" void app_main() {
Engine().StartEngine();
// Register UI after StartEngine(), before StartGame().
UI().setElements(uiElements); // UIElementRef[] (no nullptr entries)
GameObject::Create<Player>();
Engine().StartGame(); // blocks until RequestQuit()
}
StartEngine() currently performs:
- I2C initialization
- Input manager initialization
- Renderer initialization
- Camera initialization
- UI manager initialization
- Sound manager initialization
- Module system initialization
- Default UI state reset via
UI().clearElements()
StartGame():
- Marks the engine as running
- Calls
Start()once on already-created objects - Enters the main loop until
RequestQuit()is called
Tick Order
Inside the running loop, gameLoop() runs continuously. Each iteration performs:
SoundManager::update()ModuleSystem::FreeUpdate()- A full
gameTick()only when elapsed time reachesSettings.render.targetFrameTimeUs
gameTick() phase order:
- Early phase
- Input tick
EarlyUpdate()for active objectsearlyComponentTick()for active objectsModuleSystem::EarlyUpdate()
- Main phase
Update()for active objectscomponentTick()for active objectsModuleSystem::Update()
- Late phase
LateUpdate()for active objectslateComponentTick()for active objectsModuleSystem::LateUpdate()- Camera follow tick
- Collision handling runs inside
ModuleSystem::LateUpdate()whenWE_MODULE_COLLISIONis enabled
- End phase
preRenderComponentTick()for active objectsModuleSystem::PreRender()- Renderer render/flush (clear -> world pass -> UI pass -> full-screen flush)
WETime::incrementFrameCount()
Renderer step detail (current):
- World pass: sort + execute currently buffered world commands
- UI pass: UI().render() submits UI commands, then sort + execute
- Flush: full-screen flush each frame
Frame pacing is currently done by elapsed-time gating, not by explicit sleep.
Because render runs at the end phase, movement/camera logic is completed before final flush.
Subsystems
| Member | Type | Access |
|---|---|---|
m_renderer |
Renderer |
RenderSys() |
m_Camera |
Camera |
MainCamera() |
m_InputManager |
InputManager |
Input() |
m_UIManager |
UIManager |
UI() |
m_SoundManager |
SoundManager |
Sound() |
Global Accessors
Engine();
MainCamera();
Input();
UI();
Sound();
RenderSys();