ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Interface.h Source File

Interface.h

00001 #ifndef INTERFACE_H
00002 #define INTERFACE_H
00003 
00004 #include "mbed.h"
00005 #include "Gamepad.h"
00006 #include "N5110.h"
00007 #include "Sound.h"
00008 
00009 /**struct of fsm for menu option*/
00010 struct State{
00011     int option;
00012     int next_state[2];
00013 };
00014 
00015 /** Interface class
00016 *@brief welcome,meun,pause interface
00017 *@author Zeyu Feng
00018 *@10 MAY 2020
00019 */
00020 class Interface {
00021     
00022 public:
00023     
00024     /**Constructor*/
00025     Interface();
00026     
00027     /**Destructor*/
00028     ~Interface();
00029     
00030     /** initalises the flag varibales*/   
00031     void init();
00032         
00033     /** set a welcome interface for my game*/
00034     void Welcome(N5110 &lcd,Gamepad &pad);
00035         
00036     /** set an option menu*/
00037     void menu(N5110 &lcd,Gamepad &pad);
00038     
00039     /** set an user-defined menu*/
00040     void undefined_rate(N5110 &lcd,Gamepad &pad);
00041     
00042     /** set an user-defined menu*/
00043     void undefined_max(N5110 &lcd,Gamepad &pad);
00044         
00045     /** if health of people is zero, game over~*/
00046     void game_over(N5110 &lcd,Gamepad &pad);
00047         
00048     /** check pause for start botton*/
00049     int check_pause(N5110 &lcd,Gamepad &pad,int paused_flag,float increment,int max);
00050         
00051     /** count down and draw in lcd*/
00052     void count_down(N5110 &lcd);
00053     
00054     /** update record*/
00055     void update_record(float increment,int max);
00056     
00057     /** Record interface*/
00058     void record(N5110 &lcd,Gamepad &pad);
00059         
00060     /** Victory interface*/
00061     void victory(N5110 &lcd,Gamepad &pad);
00062     
00063     /** simple game interface*/
00064     void simple_game(N5110 &lcd,Gamepad &pad);
00065     
00066     /**accessors  set the count_down flag
00067     *@param count_down(int)
00068     */
00069     void set_count_down(int count_down);
00070     
00071     //mutators---------------------------
00072     
00073     int get_menu_flag();
00074     
00075     int get_rate_flag();
00076     
00077     int get_max_flag();
00078     
00079     int get_sim_flag();
00080     
00081     int get_gameover_flag();
00082     
00083     int get_victory_flag();
00084 
00085 private:
00086     
00087     Sound _sound;
00088     Timer _timer;
00089     Direction _d;
00090     int _menu_flag;
00091     int _defined_rate_flag;
00092     int _defined_max_flag;
00093     int _sim_flag;
00094     int _gameover_flag;
00095     int _count_down;
00096     int _victory_flag;
00097     char _buffer1[14];
00098     char _buffer2[14];
00099     Vector2D _record;
00100     
00101 };
00102 #endif