Andreas Garmannslund / Mbed 2 deprecated SimplePlatformGame

Dependencies:   N5110 PinDetect PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MainMenu.h Source File

MainMenu.h

Go to the documentation of this file.
00001 #ifndef MAIN_MENU_H
00002 #define MAIN_MENU_H
00003 
00004 /** @file MainMenu.h
00005 *   @author Andreas Garmannslund
00006 *   @date April 2015
00007 */
00008 
00009 #include "State.h "
00010 #include "Global.h"
00011 #include <string>
00012 #include <sstream>
00013 
00014 /// State: Main Menu
00015 class MainMenu : public State
00016 {
00017     public:
00018         /// Creates a new MainMenu object
00019         MainMenu(StateManager* fsm, N5110 *lcd, InputManager* input, Sound *sound)
00020                 : State(fsm, lcd, input, sound) {init();}
00021                 
00022         /// Update logic
00023         virtual void update(float dt);
00024         
00025         /// Draw MainMenu to screen
00026         virtual void render();
00027     
00028     private:
00029         void init();
00030         static void btnAPress(); // Interrupt callback function when button A is pressed
00031         static void btnBPress(); // Interrupt callback function when button B is pressed
00032         static void btnCPress(); // Interrupt callback function when button C is pressed
00033         
00034     // Variables
00035     private:
00036         /// States for the main menu's internal finite state machine
00037         enum MenuState {SELECT_PLAY, SELECT_HIGHSCORES, SELECT_CONTROLS, LOAD_GAME, HIGHSCORES, CONTROLS};
00038         
00039         /// Current state of the internal finite state machine
00040         static int currentState;
00041         
00042         /** Transition table for internal fsm
00043         * Each row corresponds to a state
00044         * Each column corresponds to the button pressed
00045         */
00046         static const int MENU_FSM[6][3];
00047 };
00048 
00049 #endif