Yingjian Guo / GameEngine
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GameEngine.h Source File

GameEngine.h

00001 #ifndef GameEngine_H
00002 #define GameEngine_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Jet.h"
00008 #include "Ammo.h"
00009 #include "Monster.h"
00010 #include "Bitmap.h"
00011 
00012 class GameEngine
00013 {
00014 public:
00015 
00016     /** Constructor
00017     *
00018     */
00019     GameEngine();
00020     
00021     /** Destructor
00022     *
00023     */
00024     ~GameEngine();
00025     
00026     /** Initialise the game parameters
00027     *
00028     *   This function initialises the game parameter
00029     */
00030     void init();
00031     
00032     /** Read the inputs
00033     *
00034     *   This function reads the inputs from the pad
00035     */
00036     void read_input(Gamepad &pad);
00037     
00038     /** Update the game parameters
00039     *
00040     *   This function updates the game parameters
00041     */
00042     void update(Gamepad &pad);
00043     
00044     /** Draw the elements in the buffer
00045     *
00046     *   This function draws all elements in the buffer
00047     */
00048     void draw(N5110 &lcd);
00049     
00050     /** Get the value of life */
00051     int get_life(); 
00052     
00053     /** Get the value of the remained monsters */
00054     int get_monster_number();
00055     
00056 private:
00057 
00058     /** Check the fire button
00059     *
00060     *   This function checks if the fire button is pressed
00061     */
00062     void check_fire(Gamepad &pad);
00063     
00064     /** Check the collision between the jet and the monster
00065     *
00066     *   This function checks if the jet and the monster collide
00067     */
00068     void check_Jet_collision(Gamepad &pad);
00069     
00070     /** Check the collision between the bullet and the monster
00071     *
00072     *   This function checks if the bullet hits the monster
00073     */
00074     void check_hit_monster(Gamepad &pad);
00075     
00076     /** Check if the monster hits the wall
00077     *
00078     *   This function checks if the monster hits the wall
00079     */
00080     void check_hit_wall(Gamepad &pad);
00081     
00082     
00083     Jet _Jet;                   // Jet class
00084     Ammo _Ammo;                 // Ammo class
00085     Monster _Monster;           // Monster class
00086     
00087     char life_buffer[14];       // buffer for life
00088     char number_buffer[14];     // buffer for monster number
00089     
00090     int life;                   // chance to live
00091     int monster_number;         // number of the monster remained
00092 
00093     Direction _d;               // move direction of the joystick
00094     float _mag;                 // move magnitude of the joystick
00095     int _A;                     // button A check
00096 
00097 };
00098 
00099 #endif