#include <Runtime/Core/Public/GameManager.h>
template<typename Derived>
GameManager class
CRTP base for user game projects; provides default lifecycle hooks and window config.
| Template parameters | |
|---|---|
| Derived | Concrete game class. Override hooks by name-hiding — no virtual dispatch. |
Usage: subclass, override what you need, then place TNX_IMPLEMENT_GAME in one .cpp:
class MyGame : public GameManager<MyGame> { public: const char* GetWindowTitle() const { return "My Game"; } bool PostInitialize(TrinyxEngine& engine) { ... return true; } }; TNX_IMPLEMENT_GAME(MyGame)
Without the macro, drive initialization manually via TrinyxEngine:: / PostInitialize / Run.
Public functions
- void PreInitialize(int argc, char* argv[])
- Called after ParseCommandLine but before engine Initialize().
- auto PostInitialize(TrinyxEngine& engine) -> bool
- Called once all engine threads, renderer, and registry are ready.
- void PostStart(TrinyxEngine& engine)
- Called from Run() after Logic, Render, and the job system are fully started.
- auto GetExitCode() const -> int
- Returns the process exit code after Run() completes.
- auto GetWindowTitle() const -> const char*
- Override to set window title.
- auto GetWindowWidth() const -> int
- Override to set initial window width.
- auto GetWindowHeight() const -> int
- Override to set initial window height.
Protected functions
Function documentation
template<typename Derived>
void GameManager<Derived>:: PreInitialize(int argc,
char* argv[])
Called after ParseCommandLine but before engine Initialize().
template<typename Derived>
bool GameManager<Derived>:: PostInitialize(TrinyxEngine& engine)
Called once all engine threads, renderer, and registry are ready.
| Returns | false to abort before entering the main loop. |
|---|
template<typename Derived>
void GameManager<Derived>:: PostStart(TrinyxEngine& engine)
Called from Run() after Logic, Render, and the job system are fully started.
template<typename Derived>
int GameManager<Derived>:: GetExitCode() const
Returns the process exit code after Run() completes.