Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 PinDetect PowerControl mbed
StateManager Class Reference
Finite State Machine for program flow. More...
#include <StateManager.h>
Public Member Functions | |
StateManager (N5110 *lcd, InputManager *input, Sound *sound, MainState firstState) | |
Creates a new finite state machine. | |
~StateManager () | |
Frees allocated memory. | |
void | update (float dt) |
Update logic of the current state. | |
void | render () |
Draw the current state to the lcd. | |
void | requestStateChange (MainState newState) |
Can be used to request the fsm to switch state. | |
void | processRequest () |
Sees if any requests to change the state have been made. |
Detailed Description
Finite State Machine for program flow.
Definition at line 17 of file StateManager.h.
Constructor & Destructor Documentation
StateManager | ( | N5110 * | lcd, |
InputManager * | input, | ||
Sound * | sound, | ||
MainState | firstState | ||
) |
Creates a new finite state machine.
The states are defined in State.h
- Parameters:
-
lcd Pointer to the lcd input Pointer to the InputManager which is controlling user input. firstState The initial state of the finite state machine.
Definition at line 25 of file StateManager.h.
~StateManager | ( | ) |
Frees allocated memory.
Definition at line 29 of file StateManager.h.
Member Function Documentation
void processRequest | ( | ) |
Sees if any requests to change the state have been made.
Definition at line 56 of file StateManger.cpp.
void render | ( | ) |
Draw the current state to the lcd.
Definition at line 51 of file StateManger.cpp.
void requestStateChange | ( | MainState | newState ) |
Can be used to request the fsm to switch state.
- Parameters:
-
newState The requested state
Definition at line 38 of file StateManger.cpp.
void update | ( | float | dt ) |
Update logic of the current state.
Definition at line 46 of file StateManger.cpp.
Generated on Tue Jul 12 2022 21:59:48 by
