MAGE  v0.171.0
Matthias Advanced Game Engine
mage::Engine Class Reference

#include <engine.hpp>

Public Member Functions

 Engine (const EngineSetup &setup, rendering::DisplayConfiguration display_config)
 
 Engine (const Engine &engine)=delete
 
 Engine (Engine &&engine) noexcept
 
 ~Engine ()
 
Engineoperator= (const Engine &engine)=delete
 
Engineoperator= (Engine &&engine)=delete
 
int Run (UniquePtr< Scene > &&scene, int nCmdShow=SW_NORMAL)
 
const input::ManagerGetInputManager () const noexcept
 
const rendering::ManagerGetRenderingManager () const noexcept
 
SceneGetScene () const noexcept
 
void RequestScene (UniquePtr< Scene > &&scene) noexcept
 
const GameTimeGetTime () const noexcept
 

Private Member Functions

void InitializeSystems (const EngineSetup &setup, rendering::DisplayConfiguration display_config)
 
void UninitializeSystems () noexcept
 
void ApplyRequestedScene ()
 
bool UpdateInput ()
 
bool UpdateRendering ()
 
bool UpdateScripting ()
 

Private Attributes

UniquePtr< Windowm_window
 
EngineMessageHandler m_message_handler
 
UniquePtr< input::Managerm_input_manager
 
UniquePtr< rendering::Managerm_rendering_manager
 
UniquePtr< Scenem_scene
 
UniquePtr< Scenem_requested_scene
 
GameTimer m_timer
 
GameTime m_time
 
TimeIntervalSeconds m_fixed_delta_time
 
TimeIntervalSeconds m_fixed_time_budget
 
bool m_deactive
 
bool m_mode_switch
 
bool m_has_requested_scene
 

Detailed Description

A class of engines.

Constructor & Destructor Documentation

◆ Engine() [1/3]

mage::Engine::Engine ( const EngineSetup setup,
rendering::DisplayConfiguration  display_config 
)
explicit

Constructs an engine from the given engine setup.

Parameters
[in]setupA reference to an engine setup.
[in]display_configThe display configuration.
Exceptions
ExceptionFailed to initialize the engine.

◆ Engine() [2/3]

mage::Engine::Engine ( const Engine engine)
delete

Constructs an engine from the given engine.

Parameters
[in]engineA reference to the engine to copy.

◆ Engine() [3/3]

mage::Engine::Engine ( Engine &&  engine)
defaultnoexcept

Constructs an engine by moving the given engine.

Parameters
[in]engineA reference to the engine to move.

◆ ~Engine()

mage::Engine::~Engine ( )

Destructs this engine.

Member Function Documentation

◆ ApplyRequestedScene()

void mage::Engine::ApplyRequestedScene ( )
private

◆ GetInputManager()

const input::Manager& mage::Engine::GetInputManager ( ) const
noexcept

Returns the input manager of this engine.

Returns
A reference to the input manager of this engine.

◆ GetRenderingManager()

const rendering::Manager& mage::Engine::GetRenderingManager ( ) const
noexcept

Returns the rendering manager of this engine.

Returns
A reference to the rendering manager of this engine.

◆ GetScene()

Scene* mage::Engine::GetScene ( ) const
noexcept

Returns the current scene of this engine.

Returns
A reference to the current scene of this engine.

◆ GetTime()

const GameTime& mage::Engine::GetTime ( ) const
noexcept

Returns the game time of this game engine.

Returns
A reference to the game time of this game engine.

◆ InitializeSystems()

void mage::Engine::InitializeSystems ( const EngineSetup setup,
rendering::DisplayConfiguration  display_config 
)
private

Initializes the different systems of this engine.

Parameters
[in]setupA reference to an engine setup.
[in]display_configThe display configuration.
Exceptions
ExceptionFailed to initialize at least one of the different systems of this engine.

◆ operator=() [1/2]

Engine& mage::Engine::operator= ( const Engine engine)
delete

Copies the given engine to this engine.

Parameters
[in]engineA reference to the engine to copy.
Returns
A reference to the copy of the given engine (i.e. this engine).

◆ operator=() [2/2]

Engine& mage::Engine::operator= ( Engine &&  engine)
delete

Copies the given engine to this engine.

Parameters
[in]engineA reference to the engine to move.
Returns
A reference to the moved engine (i.e. this engine).

◆ RequestScene()

void mage::Engine::RequestScene ( UniquePtr< Scene > &&  scene)
noexcept

Sets the scene of this engine to the given scene.

Parameters
[in]sceneA reference to the start scene.

◆ Run()

int mage::Engine::Run ( UniquePtr< Scene > &&  scene,
int  nCmdShow = SW_NORMAL 
)

Runs this engine.

Parameters
[in]sceneA reference to the start scene.
[in]nCmdShowControls how the engine window is to be shown.
Returns
0, if the function terminates before entering the message loop.
The wParam parameter contained in the WM_QUIT message.

◆ UninitializeSystems()

void mage::Engine::UninitializeSystems ( )
privatenoexcept

Uninitializes the different systems of this engine.

◆ UpdateInput()

bool mage::Engine::UpdateInput ( )
private

◆ UpdateRendering()

bool mage::Engine::UpdateRendering ( )
private

◆ UpdateScripting()

bool mage::Engine::UpdateScripting ( )
private

Member Data Documentation

◆ m_deactive

bool mage::Engine::m_deactive
private

Flag indicating whether the application is active or not.

◆ m_fixed_delta_time

TimeIntervalSeconds mage::Engine::m_fixed_delta_time
private

The fixed delta time (in seconds) of this engine.

If the fixed delta time is equal to zero, fixed delta time updates will be treated as non-fixed delta time updates by this engine.

◆ m_fixed_time_budget

TimeIntervalSeconds mage::Engine::m_fixed_time_budget
private

The fixed time budget (in seconds) of this engine.

◆ m_has_requested_scene

bool mage::Engine::m_has_requested_scene
private

A flag indicating whether this engine has a requested scene.

A separate flag is needed, because the requested scene maybe nullptr.

◆ m_input_manager

UniquePtr< input::Manager > mage::Engine::m_input_manager
private

A pointer to the input manager of this engine.

◆ m_message_handler

EngineMessageHandler mage::Engine::m_message_handler
private

The window message handler of this engine.

◆ m_mode_switch

bool mage::Engine::m_mode_switch
private

Flag indicating whether the application should switch between full screen and windowed mode.

◆ m_rendering_manager

UniquePtr< rendering::Manager > mage::Engine::m_rendering_manager
private

A pointer to the rendering manager of this engine.

◆ m_requested_scene

UniquePtr< Scene > mage::Engine::m_requested_scene
private

A pointer to the requested scene of this engine.

◆ m_scene

UniquePtr< Scene > mage::Engine::m_scene
private

A pointer to the current scene of this engine.

◆ m_time

GameTime mage::Engine::m_time
private

The current time of this engine.

◆ m_timer

GameTimer mage::Engine::m_timer
private

The timer of this engine.

◆ m_window

UniquePtr< Window > mage::Engine::m_window
private

A pointer to the window of this engine.