Loading...
Searching...
No Matches
ml::Manager Class Referenceabstract

Abstract base class for all Malena managers. More...

#include <Manager.h>

Inheritance diagram for ml::Manager:

Public Member Functions

virtual ~Manager ()=default
virtual void draw ()=0
 Render the subsystem's visual output to the window.
virtual void fireInputEvents (const std::optional< sf::Event > &event)=0
 Distribute an SFML input event to this subsystem.
virtual void fireUpdateEvents ()=0
 Fire the per-frame update event across all subscribers.
virtual void run ()=0
 Execute subsystem-specific per-frame work.

Detailed Description

Abstract base class for all Malena managers.

A Manager is responsible for driving one subsystem through the application main loop. Every concrete manager must implement the four lifecycle steps that AppManager calls each frame:

  1. fireInputEvents — distribute the current SFML event to the subsystem
  2. fireUpdateEvents — perform per-frame logic updates
  3. run — execute any subsystem-specific per-frame work
  4. draw — render the subsystem's output to the window

Managers are typically statically allocated singletons (e.g., EventsManager, ComponentsManager) rather than instances passed around by pointer, but the interface is expressed as a virtual class so that AppManager can hold a heterogeneous list of registered managers.

See also
AppManager, EventsManager, CoreManager

Definition at line 32 of file Manager.h.

Constructor & Destructor Documentation

◆ ~Manager()

virtual ml::Manager::~Manager ( )
virtualdefault

Member Function Documentation

◆ draw()

virtual void ml::Manager::draw ( )
pure virtual

Render the subsystem's visual output to the window.

Called once per frame after run(). Implementations should call window.draw() on any objects this manager is responsible for drawing.

◆ fireInputEvents()

virtual void ml::Manager::fireInputEvents ( const std::optional< sf::Event > & event)
pure virtual

Distribute an SFML input event to this subsystem.

Called once per frame for each event returned by sf::Window::pollEvent. Managers that respond to keyboard, mouse, or window events process them here.

Parameters
eventThe SFML event, wrapped in std::optional. An empty optional indicates the end of the event queue (i.e., the update-only tick).

◆ fireUpdateEvents()

virtual void ml::Manager::fireUpdateEvents ( )
pure virtual

Fire the per-frame update event across all subscribers.

Called once per frame after all input events have been processed. Use this to drive animation, polling, or any time-based logic.

◆ run()

virtual void ml::Manager::run ( )
pure virtual

Execute subsystem-specific per-frame work.

Provides an additional hook beyond fireUpdateEvents for managers that need to perform internal bookkeeping separate from event distribution.

Implemented in ml::AppManager.


The documentation for this class was generated from the following file: