Drives the application main loop and coordinates all framework managers. More...
#include <AppManager.h>
Public Types | |
| enum | Architecture { MVC , EDA , ECS } |
| Architectural style hint passed at construction. More... | |
Public Member Functions | |
| AppManager (const sf::VideoMode &videoMode, const std::string &title, UIController &appLogic, sf::RenderWindow &window=WindowManager::getWindow(), Architecture architecture=MVC) | |
Construct an AppManager with an explicit controller and window. | |
| virtual | ~AppManager ()=default |
| void | run () override |
| Enter the main loop and run until the window is closed. | |
Drives the application main loop and coordinates all framework managers.
AppManager owns the SFML render window and runs the core application lifecycle:
UIController::initialization() and UIController::registerEvents() before entering the loop.fireInputEvents().fireUpdateEvents().draw(), and presents the frame.AppManager implements the Manager interface, so it participates in the same event-distribution protocol as other framework managers.
The Architecture enum lets the framework know which structural style the application uses.
| Value | Meaning |
|---|---|
MVC | Model-View-Controller — default for most UI applications |
EDA | Event-Driven Architecture — pure message/event flow |
ECS | Entity-Component-System — activates the ECS subsystem |
Most applications do not instantiate AppManager directly. Instead, inherit from ml::Application, which combines AppManager and UIController into a single convenient base class.
For projects that separate the runner from the UI logic:
Definition at line 58 of file AppManager.h.
Architectural style hint passed at construction.
Informs the framework which structural pattern the application follows. Defaults to MVC.
| Enumerator | |
|---|---|
| MVC | Model-View-Controller. |
| EDA | Event-Driven Architecture. |
| ECS | Entity-Component-System. |
Definition at line 76 of file AppManager.h.
| ml::AppManager::AppManager | ( | const sf::VideoMode & | videoMode, |
| const std::string & | title, | ||
| UIController & | appLogic, | ||
| sf::RenderWindow & | window = WindowManager::getWindow(), | ||
| Architecture | architecture = MVC ) |
Construct an AppManager with an explicit controller and window.
Calls controller.initialization() then controller.registerEvents() before returning. The window parameter defaults to WindowManager::getWindow() so that the framework's centralized window is used unless you explicitly provide your own.
| videoMode | SFML video mode (resolution + bit depth). |
| title | Window title string. |
| appLogic | Controller that provides initialization() and registerEvents() implementations. |
| window | Render window to use. Defaults to the framework window. |
| architecture | Structural pattern hint. Defaults to MVC. |
|
virtualdefault |
|
overridevirtual |
Enter the main loop and run until the window is closed.
Each iteration of the loop:
fireInputEvents().fireUpdateEvents() for the per-frame update tick.draw() on all registered components, and displays the frame.Returns when the SFML window is closed or window.close() is called.
Implements ml::Manager.