Concrete Controller base with a per-frame update hook.
More...
#include <UIController.h>
Public Member Functions | |
| ~UIController () override=default | |
| 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. | |
Concrete Controller base with a per-frame update hook.
UIController extends Controller with two additions:
CoreAdapter proxy that gives this controller a lightweight framework identity (position, flags, event subscriptions) without being a full drawable component. This proxy is what AppManager uses to fire the "update" event at the controller level.onUpdate() — a convenience method for registering a per-frame callback directly on the controller, useful for logic that doesn't belong to any single component.UIController can be passed to the Application constructor that accepts a controller reference, keeping the application runner and the UI logic in separate objects:
For simpler programs, inherit from ml::Application directly — it already inherits UIController and AppManager together.
Definition at line 66 of file UIController.h.
|
overridedefault |
|
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::Controller.
Implemented in ml::Application, and ml::ApplicationWith< Manifest >.
| void ml::UIController::onUpdate | ( | std::function< void()> | f | ) |
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::Controller.
Implemented in ml::Application, and ml::ApplicationWith< Manifest >.