← API Reference Class

template<typename TGame> asge::Application

Owns TGame and drives the main loop: pump SDL events, update, render, present.

#include <Application.hpp>

TGame is constructed in-place (not passed in) from the IRenderer the owned VideoSystem creates plus whatever extra constructor arguments the caller supplies — TGame must derive from some game::Game<TStateId> (enforced via game::is_game_v) since that's what supplies the matching constructor. m_Game stays empty if VideoSystem::Initialize fails, and Run() refuses to start rather than looping over a game that was never constructed.

Private Attributes

#video::VideoSystem m_VideoSysprivate
#input::InputSystem m_InputSysprivate
#audio::AudioDevice m_AudioDevprivate
#bool m_Running {false}private
#ApplicationConfig const & m_Configprivate
#std::optional< TGame > m_Gameprivate

Private Member Functions

#void processEvent(SDL_Event const *inSdlEventPtr) noexceptprivate

Feeds one SDL event into input tracking and the game, or stops the loop on a quit event.

Public Member Functions

#template<typename ... Args> explicit Application(ApplicationConfig const &inConfig, Args &&... inGameArgs)

Initializes the video system from inConfig, then constructs TGame from its renderer plus inGameArgs.

Logs and leaves m_Game empty if video init fails, rather than throwing.

#void Run()

Runs the main loop (poll events, update, render, present) until an OS quit event arrives or a state requests one via TransitionKind::Quit.