Hugo Hu / Mbed 2 deprecated BRAVEHEART

Dependencies:   mbed N5110 ShiftReg PinDetect

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Achievement.h Source File

Achievement.h

Go to the documentation of this file.
00001 #ifndef ACHIEVEMENT_H
00002 #define ACHIEVEMENT_H
00003 
00004 #include "State.h "
00005 #include "Global.h"
00006 #include <cstdlib>
00007 #include <string>
00008 #include <sstream>
00009 
00010 /// @file Achievement.h
00011 
00012 /// State: Submit Highscore
00013 /// Displays a screen where the user is promted to input his or her initials
00014 class Achievement : public State
00015 {
00016     public:
00017         Achievement(StateManager* fsm, N5110 *lcd, InputManager* input, Sound* sound, ShiftReg* shiftreg)
00018                 : State(fsm, lcd, input, sound, shiftreg) {init();}
00019         
00020         void init();
00021         /// Update logic
00022         virtual void update(float dt);
00023         /// Draw to screen
00024         virtual void render();
00025     
00026     private:
00027         static void btnAPress(); /// Interrupt callback function when button A is pressed
00028         static void btnBPress(); /// Interrupt callback function when button B is pressed
00029         static void btnCPress(); /// Interrupt callback function when button C is pressed
00030         static void btnDPress(); /// Interrupt callback function when button D is pressed
00031         
00032     private:
00033         enum SubmitHighscoreState{LETTER1, LETTER2, LETTER3, SEL_SUBMIT, WRITE_TO_FILE, LOAD_GAME_OVER};
00034         
00035         static int currentState;
00036         /** Changes the current selected letter.
00037           * @param index The index of the letter to be changed (0, 1 or 2)
00038           * @param next Goes to the next letter in the alphabet if true. Goes to the previous letter if false.
00039         */
00040         static void changeLetter(int index, bool next);
00041         
00042         static int letters[3];
00043 };
00044 
00045 #endif