Engine
Raylib based game framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Engine Class Reference

Core engine. More...

#include <Engine.h>

Collaboration diagram for Engine:
Collaboration graph
[legend]

Public Member Functions

 Engine (const WindowInfo &windowInfo)
 
template<typename T , typename... Args>
void SetFirstScene (Args &&... args)
 Sets the initial scene.
 
void Run (const u32 targetFps, const u32 updateFrequency, const u8 maxUpdatesPerFrame=5)
 Runs the engine loop.
 
Vector2 GetVirtualMousePos () const
 Returns the mouse position adjusted to the virtual canvas.
 
double GetUpdateTime () const
 Returns how long the average update loop took in ms.
 
double GetDrawTime () const
 Returns how long the average draw loop took in ms.
 

Static Public Member Functions

static EngineGet ()
 Returns the engine instance.
 

Public Attributes

Registry & registry = m_registry
 
Dispatcher & dispatcher = m_dispatcher
 
Rendererrenderer = m_renderer
 
ResourceManagerresourceManager = m_resourceManager
 
SceneManagersceneManager = m_sceneManager
 
SystemManagersystemManager = m_systemManager
 
LuaManagerluaManager = m_luaManager
 
NetworkManagernetworkManager = m_networkManager
 
BS::thread_pool< BS::tp::none > threadPool
 

Detailed Description

Core engine.

Owns and coordinates all major subsystems.

Only a single Engine instance may exist at a time.

Constructor & Destructor Documentation

◆ Engine()

Engine::Engine ( const WindowInfo windowInfo)

@ brief Creates the engine and all its systems

Parameters
windowInfoInitial window info struct

Member Function Documentation

◆ Get()

Engine & Engine::Get ( )
static

Returns the engine instance.

This is mainly to be used to access the public systems. If an engine hasn't been instanced the internal assert will fail.

◆ Run()

void Engine::Run ( const u32  targetFps,
const u32  updateFrequency,
const u8  maxUpdatesPerFrame = 5 
)

Runs the engine loop.

This is blocking until the widow is closed or a CloseGame event is called.

Updates are called in the systems, lua, scene order. Draws are called in the renderer, systems, scene order. All drawing is done to a virtual canvas.

Parameters
targetFpsThe target fps for the engine to run at
updateFrequencyHow many update loops should be run per second
maxUpdatesPerFrameMaximum updated per frame when the engine is trying to catch up

◆ SetFirstScene()

template<typename T , typename... Args>
void Engine::SetFirstScene ( Args &&...  args)
inline

Sets the initial scene.

Template Parameters
TScene type
ArgsT Constructor argument types
Parameters
argsScene constructor arguments

The documentation for this class was generated from the following files: