Entry point for Malena applications with a manifest. More...
#include <Application.h>
Public Types | |
| enum | Architecture { MVC , EDA , ECS } |
| Architectural style hint passed at construction. More... | |
| using | Resources = ml::ManifestResources<Manifest> |
| Unified resource accessor — Resources::get(Images::Icon). | |
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. | |
| template<typename EnumType> | |
| static auto | get (EnumType key) -> std::enable_if_t< !is_asset_enum< Manifest, EnumType >::value, decltype(ConfigManager< Manifest >::get(key))> |
Retrieve a config value by enum key → ConfigManager. | |
| template<typename EnumType> | |
| static auto | get (EnumType key) -> std::enable_if_t< is_asset_enum< Manifest, EnumType >::value, const_ref_t< decltype(AssetsManager< Manifest >::get(key))> > |
Retrieve an asset by enum key → AssetsManager. | |
| static void | reset () |
| Full application reset — clears events, messages, and components. | |
| template<typename EnumType> | |
| static std::enable_if_t< is_sounds_enum< Manifest, EnumType >::value > | unload (EnumType key) |
| template<typename EnumType> | |
| static std::enable_if_t< is_fonts_enum< Manifest, EnumType >::value > | unload (EnumType key) |
| template<typename EnumType> | |
| static std::enable_if_t< is_images_enum< Manifest, EnumType >::value > | unload (EnumType key) |
Entry point for Malena applications with a manifest.
Extends Application with manifest support — injects Resources::get() and all manifest enum aliases into scope automatically. Use when your application has global resources (icon, main font, app-wide config).
Definition at line 180 of file Application.h.
| using ml::ApplicationWith< Manifest >::Resources = ml::ManifestResources<Manifest> |
Unified resource accessor — Resources::get(Images::Icon).
Definition at line 185 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.
|
inlinestaticinherited |
Retrieve a config value by enum key → ConfigManager.
Return type is inferred from ConfigManager::get() — Text gives const std::string&, Ints gives int, etc.
Definition at line 122 of file ManifestResources.h.
|
inlinestaticinherited |
Retrieve an asset by enum key → AssetsManager.
Return type is explicitly const T& — taking & gives const T* with no ambiguity, suitable for SFML functions that take const sf::Texture* etc.
Definition at line 107 of file ManifestResources.h.
|
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.
|
inlinestaticinherited |
Definition at line 148 of file ManifestResources.h.
|
inlinestaticinherited |
Definition at line 141 of file ManifestResources.h.
|
inlinestaticinherited |
Definition at line 134 of file ManifestResources.h.