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: mbed N5110 ShiftReg PinDetect
Diff: StateManager.h
- Revision:
- 5:100d960fc6d5
- Parent:
- 4:d6661b976359
- Child:
- 7:678873947b29
--- a/StateManager.h Fri May 01 00:38:59 2015 +0000 +++ b/StateManager.h Fri May 01 09:10:23 2015 +0000 @@ -2,6 +2,7 @@ #define STATE_MANAGER_H #include "State.h" +#include "MainMenu.h" #include <map> // Main Finite State Machine - controls the flow between the main states @@ -10,11 +11,11 @@ public: StateManager(N5110 *lcd, InputManager* input) : lcd(lcd), input(input){currentState = 0;} + ~StateManager() {if (currentState != 0) delete currentState;} void update(time_t dt); void render(); - template <typename T> void changeState(MainState newState); // Deletes the current main state and creates a new one private: @@ -23,16 +24,4 @@ State* currentState; // Current state object }; -template <typename T> -void StateManager::changeState(MainState newState) -{ - if (currentState != 0) // if a state exist - delete currentState; // clear allocated memory - - // Create new state - currentState = new T(*this, lcd, input); - - // TODO: Work on this -} - -#endif STATE_MANAGER_H +#endif \ No newline at end of file