Module fsmMgr
source code
Meat Engine Hierarchical Finite State Machine (hFSM) Manager
This could be refactored so that a fsmMgr is an instatiatable class,
but for now it uses the "lazy singleton" pattern - the state
stack is a module global, and methods are just module functions. This is
adequate for my needs so far.
Use: create State objects, push them on the stack. Periodically call
the update and draw functions, and pass the handleKey and
handleMouseButton events in as appropriate. The top state will get
delegated to, which may choose to delegate further. For example, a dialog
box may choose to call the next state's draw code first, before drawing
itself.