Zeyu Feng 201377605

Dependencies:   mbed

On Minerva

Interface/Interface.h

Committer:
el19zf
Date:
2020-05-18
Revision:
17:ba4d9cd1e347
Parent:
16:cf2bfada3adf
Child:
19:5083339b55e8

File content as of revision 17:ba4d9cd1e347:

#ifndef INTERFACE_H
#define INTERFACE_H

#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Sound.h"

/** Interface class
*@brief welcome,meun,pause interface
*@author Zeyu Feng
*@10 MAY 2020
*/
/**struct of fsm for menu option*/
struct State{
    int option;
    int next_state[2];
};

class Interface {
    
public:
    
    /**Constructor*/
    Interface();
    
    /**Destructor*/
    ~Interface();
        
    void init();
        
    /** set a welcome interface for my game*/
    void Welcome(N5110 &lcd,Gamepad &pad);
        
    /** set an option menu*/
    int menu(N5110 &lcd,Gamepad &pad,int option_flag);
    
    /** set an user-defined menu*/
    int undefined_rate(N5110 &lcd,Gamepad &pad,int option_flag);
    
    /** set an user-defined menu*/
    int undefined_max(N5110 &lcd,Gamepad &pad,int option_flag);
        
    /** if health of people is zero, game over~*/
    void game_over(N5110 &lcd,Gamepad &pad);
        
    /** check pause for start botton*/
    int check_pause(N5110 &lcd,Gamepad &pad,int paused_flag,float increment,int max);
        
    /** count down and draw in lcd*/
    int count_down(N5110 &lcd,int count_flag);
    
    /** Exit interface*/
    void exit(N5110 &lcd,Gamepad &pad);
        
    /** Victory interface*/
    void victory(N5110 &lcd,Gamepad &pad);
    
    /** make the game simple*/
    void simple_game(N5110 &lcd,Gamepad &pad);
    
    int get_sim_flag();
    
    int get_gameover_flag();
    
    int get_victory_flag();
        
private:
    
    Sound _sound;
    Timer _timer;
    Direction _d;
    int _sim_flag;
    int _gameover_flag;
    int _victory_flag;
    char _buffer1[14];
    char _buffer2[14];
        
};
#endif