Abstract interface for application initialization and event registration. More...
#include <Controller.h>
Public Member Functions | |
| virtual | ~Controller ()=default |
| virtual void | initialization ()=0 |
| Create and register all components and resources. | |
| virtual void | registerEvents ()=0 |
| Attach event callbacks to components and framework objects. | |
Abstract interface for application initialization and event registration.
Controller defines the two-phase lifecycle contract that every Malena application entry point must fulfill:
initialization() — called once at startup to create and register components, load resources, and set up initial state.registerEvents() — called immediately after initialization() to attach event callbacks (onClick, onHover, onMessage, etc.) to the components created in the first phase.Separating these two phases ensures that all objects exist before any callback tries to reference them, avoiding order-of-initialization issues.
UIController extends Controller with a CoreAdapter proxy and an onUpdate convenience method. Application inherits from both AppManager and UIController, collapsing the full lifecycle into a single subclass.
Definition at line 35 of file Controller.h.
|
virtualdefault |
|
pure 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.
Implemented in ml::Application, ml::ApplicationWith< Manifest >, and ml::UIController.
|
pure 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.
Implemented in ml::Application, ml::ApplicationWith< Manifest >, and ml::UIController.