Hugo Hu / Mbed 2 deprecated BRAVEHEART

Dependencies:   mbed N5110 ShiftReg PinDetect

Revision:
7:678873947b29
Parent:
5:100d960fc6d5
Child:
8:9ac6a428fa26
--- a/StateManager.h	Fri May 01 09:44:38 2015 +0000
+++ b/StateManager.h	Fri May 01 18:10:59 2015 +0000
@@ -3,25 +3,32 @@
 
 #include "State.h"
 #include "MainMenu.h"
-#include <map>
+#include "Game.h"
 
 // Main Finite State Machine - controls the flow between the main states
 class StateManager
 {
     public:
-        StateManager(N5110 *lcd, InputManager* input)
-                    : lcd(lcd),  input(input){currentState = 0;}
+        StateManager(N5110 *lcd, InputManager* input, MainState firstState)
+                    : lcd(lcd),  input(input){currentState = 0; nextState = NO_STATE; changeState(firstState);}
         ~StateManager() {if (currentState != 0) delete currentState;}
         
-        void update(time_t dt);
+        void update(float dt);
         void render();
         
+        void requestStateChange(MainState newState);
+        
+        void processRequest(); // See if any request to change the state have been made
+        
+    private:
         void changeState(MainState newState); // Deletes the current main state and creates a new one
-                
+    
+    // Variables    
     private:
         N5110 *lcd;
         InputManager *input;
         State* currentState; // Current state object
+        MainState nextState;
 };
 
 #endif
\ No newline at end of file