3#include "NonCopyable.hpp"
13#include "entt/entt.hpp"
20#include "Networking/AsyncNetwork.hpp"
21#include "bsThreadPool/BS_thread_pool.hpp"
31using Dispatcher = entt::dispatcher;
33#define REGISTRY Engine::Get().registry
34#define DISPATCHER Engine::Get().dispatcher
37#define RENDERER Engine::Get().renderer
38#define RESOURCE_MANAGER Engine::Get().resourceManager
39#define SCENE_MANAGER Engine::Get().sceneManager
40#define SYSTEM_MANAGER Engine::Get().systemManager
41#define LUA_MANAGER Engine::Get().luaManager
44#define NETWORK Engine::Get().network
45#define THREAD_POOL Engine::Get().threadPool
49#define INPUT_SYSTEM SYSTEM_MANAGER.GetSystem<InputSystem>()
50#define AUDIO_SYSTEM SYSTEM_MANAGER.GetSystem<AudioSystem>()
66 u32 virtualWidth = 1920;
67 u32 virtualHeight = 1080;
69 bool fullscreen =
false;
70 bool borderlessFullscreen =
false;
71 bool resizable =
false;
72 bool undecorated =
false;
74 bool alwaysRun =
false;
75 bool transparent =
false;
117 template <
typename T,
typename... Args>
120 m_sceneManager.AddScene<T>(std::forward<Args>(args)...);
121 m_sceneManager.ChangeScene<T>();
139 void Run(
const u32 targetFps,
const u32 updateFrequency,
const u8 maxUpdatesPerFrame = 5);
182#ifndef __EMSCRIPTEN__
192 static void SetFlags(
const WindowInfo& windowInfo);
194 void RaylibResourceManager();
201 Dispatcher m_dispatcher;
210#ifndef __EMSCRIPTEN__
211 AsyncNetwork m_network;
215 double m_updateTime = 0;
216 double m_drawTime = 0;
219 RenderTexture2D m_canvas;
220 u32 m_virtualWidth = 0;
221 u32 m_virtualHeight = 0;
223 bool m_running =
true;
225 static inline Engine* s_engine =
nullptr;
Sound effect and music playback management.
Lua sandboxing and scripts.
Engine entt::registry wrapper.
Engine resource caches and manager.
Engine lifelong systems and their managing.
Core engine.
Definition Engine.hpp:90
LuaManager & luaManager
Lua scripting manager.
Definition Engine.hpp:180
double GetDrawTime() const
Returns how long the average draw loop took in milliseconds.
Definition Engine.cpp:161
void SetFirstScene(Args &&... args)
Sets the initial scene and immediately transitions to it.
Definition Engine.hpp:118
AsyncNetwork & network
Asynchronous networking (unavailable on Emscripten).
Definition Engine.hpp:184
BS::thread_pool< BS::tp::none > threadPool
Thread pool for background tasks (unavailable on Emscripten).
Definition Engine.hpp:187
ResourceManager & resourceManager
Resource cache manager.
Definition Engine.hpp:171
Registry & registry
Entity-component registry.
Definition Engine.hpp:162
static Engine & Get()
Returns the active engine instance.
Definition Engine.cpp:166
void Run(const u32 targetFps, const u32 updateFrequency, const u8 maxUpdatesPerFrame=5)
Runs the engine loop.
Definition Engine.cpp:60
Renderer & renderer
Sprite renderer.
Definition Engine.hpp:168
SystemManager & systemManager
System execution manager.
Definition Engine.hpp:177
SceneManager & sceneManager
Scene lifecycle manager.
Definition Engine.hpp:174
double GetUpdateTime() const
Returns how long the average update loop took in milliseconds.
Definition Engine.cpp:156
Dispatcher & dispatcher
Event dispatcher.
Definition Engine.hpp:165
Engine(const WindowInfo &windowInfo)
Creates the engine and all its subsystems.
Definition Engine.cpp:8
Manages sandboxed Lua scripts and their integration with the event dispatcher.
Definition LuaManager.hpp:46
Wraps entt::registry with a safer, callback-aware API.
Definition Registry.hpp:29
Draws all entities with Sprite and Transform components.
Definition Renderer.hpp:24
Owns a collection of typed resource caches.
Definition ResourceManager.hpp:179
Manages scenes and the execution of the current active scene.
Definition SceneManager.hpp:71
Manages execution order and lifetime of systems.
Definition SystemManager.hpp:59
Event signalling that the game should close.
Definition Events.hpp:24
Initial window info.
Definition Engine.hpp:61