Primary entry point for Malena applications without a manifest. More...
#include <Application.h>
Public Types | |
| enum | Architecture { MVC , EDA , ECS } |
| Architectural style hint passed at construction. More... | |
Public Member Functions | |
| void | addComponent (Core &component) |
Register a Core object with the application's component manager. | |
| ApplicationBase (const sf::VideoMode &videoMode, const std::string &title) | |
Construct from an SFML video mode, using *this as the controller. | |
| ApplicationBase (const sf::VideoMode &videoMode, const std::string &title, UIController &appLogic, sf::RenderWindow &window=WindowManager::getWindow()) | |
Construct with a separate UIController and explicit video mode. | |
| ApplicationBase (unsigned int screenWidth, unsigned int screenHeight, unsigned int bitDepth, const std::string &title) | |
| Construct from pixel dimensions and bit depth. | |
| void | initialization () override=0 |
| Create and register all components and resources. | |
| void | onUpdate (std::function< void()> f) |
| Register a callback invoked every frame during the update tick. | |
| void | registerEvents () override=0 |
| Attach event callbacks to components and framework objects. | |
| void | run () override |
| Enter the main loop and run until the window is closed. | |
Static Public Member Functions | |
| static void | clearEvents () |
| Clear all event subscriptions across the entire application. | |
| static void | reset () |
| Full application reset — clears events, messages, and components. | |
Primary entry point for Malena applications without a manifest.
Combines AppManager and UIController into a single class. Override initialization() and registerEvents() to build your scene.
Definition at line 115 of file Application.h.
|
inherited |
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.
|
inherited |
Register a Core object with the application's component manager.
| ml::ApplicationBase::ApplicationBase | ( | const sf::VideoMode & | videoMode, |
| const std::string & | title ) |
Construct from an SFML video mode, using *this as the controller.
| ml::ApplicationBase::ApplicationBase | ( | const sf::VideoMode & | videoMode, |
| const std::string & | title, | ||
| UIController & | appLogic, | ||
| sf::RenderWindow & | window = WindowManager::getWindow() ) |
Construct with a separate UIController and explicit video mode.
| ml::ApplicationBase::ApplicationBase | ( | unsigned int | screenWidth, |
| unsigned int | screenHeight, | ||
| unsigned int | bitDepth, | ||
| const std::string & | title ) |
Construct from pixel dimensions and bit depth.
|
staticinherited |
Clear all event subscriptions across the entire application.
|
overridepure virtual |
Create and register all components and resources.
Implement this method to construct the objects your application needs and register them with the appropriate managers (e.g., via addComponent). This method runs before registerEvents(), so every object you plan to subscribe to will already exist by the time callbacks are attached.
Implements ml::UIController.
|
inherited |
Register a callback invoked every frame during the update tick.
Equivalent to calling onUpdate on a component, but scoped to the controller itself. Use this for frame-level logic that is not tied to a specific component — for example, polling game state, advancing a timer, or orchestrating scene transitions.
| f | Callback with no arguments, invoked once per frame. |
|
overridepure virtual |
Attach event callbacks to components and framework objects.
Implement this method to wire up onClick, onHover, onUpdate, onMessage, and any other subscriptions. Called immediately after initialization() by AppManager before the main loop begins.
Implements ml::UIController.
|
staticinherited |
Full application reset — clears events, messages, and components.
Tears down all framework state in the correct order:
After reset(), call initialization() and registerEvents() to rebuild the scene.
|
overridevirtualinherited |
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.