|
Engine
Raylib based game framework
|
Core engine. More...
#include <Engine.hpp>


Public Member Functions | |
| Engine (const WindowInfo &windowInfo) | |
| Creates the engine and all its subsystems. | |
| template<typename T, typename... Args> | |
| void | SetFirstScene (Args &&... args) |
| Sets the initial scene and immediately transitions to it. | |
| void | Run (const u32 targetFps, const u32 updateFrequency, const u8 maxUpdatesPerFrame=5) |
| Runs the engine loop. | |
| double | GetUpdateTime () const |
| Returns how long the average update loop took in milliseconds. | |
| double | GetDrawTime () const |
| Returns how long the average draw loop took in milliseconds. | |
Static Public Member Functions | |
| static Engine & | Get () |
| Returns the active engine instance. | |
Public Attributes | |
| Registry & | registry = m_registry |
| Entity-component registry. | |
| Dispatcher & | dispatcher = m_dispatcher |
| Event dispatcher. | |
| Renderer & | renderer = m_renderer |
| Sprite renderer. | |
| ResourceManager & | resourceManager = m_resourceManager |
| Resource cache manager. | |
| SceneManager & | sceneManager = m_sceneManager |
| Scene lifecycle manager. | |
| SystemManager & | systemManager = m_systemManager |
| System execution manager. | |
| LuaManager & | luaManager = m_luaManager |
| Lua scripting manager. | |
| AsyncNetwork & | network = m_network |
| Asynchronous networking (unavailable on Emscripten). | |
| BS::thread_pool< BS::tp::none > | threadPool |
| Thread pool for background tasks (unavailable on Emscripten). | |
Core engine.
Owns and coordinates all major subsystems.
Only a single Engine instance may exist at a time. Use Engine::Get() to access the instance, or prefer the convenience macros (REGISTRY, DISPATCHER, RENDERER, etc.) which call through to it.
| Engine::Engine | ( | const WindowInfo & | windowInfo | ) |
Creates the engine and all its subsystems.
Opens a raylib window, initialises the audio device, registers default resource caches (Texture2D, Image, Sound, Music, Wave, raw text and binary files), and adds the built-in systems (AnimationSystem, InputSystem, AudioSystem, ParticleSystem).
| windowInfo | Initial window configuration |
|
static |
| void Engine::Run | ( | const u32 | targetFps, |
| const u32 | updateFrequency, | ||
| const u8 | maxUpdatesPerFrame = 5 ) |
Runs the engine loop.
This is blocking until the window is closed or a CloseGame event is dispatched.
Each frame the loop:
| targetFps | Target frames per second |
| updateFrequency | Fixed update steps per second (must be ≤ targetFps) |
| maxUpdatesPerFrame | Maximum catch-up steps per frame before the accumulator is reset |
|
inline |
Sets the initial scene and immediately transitions to it.
The scene is constructed with the given arguments, added to the SceneManager, and made active before Run is called.
| args | Scene constructor arguments |