ELEC2645 (2018/19) / Mbed 2 deprecated el17lw

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EngineController.h Source File

EngineController.h

00001 #ifndef ENGINECONTROLLER_H
00002 #define ENGINECONTROLLER_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Engine.h"
00008 
00009 /** EngineController Class
00010 * @brief Class to interface with the game engine
00011 * @author Lewis Wooltorton
00012 * @date March 2019
00013 
00014 @code
00015 
00016 #include "mbed.h"
00017 #include "N5110.h"
00018 #include "Gamepad.h"
00019 #include "EngineController.h"
00020 
00021 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
00022 Gamepad gamepad;
00023 EngineController controller;
00024 
00025 int main() {
00026   controller.init();
00027   while(1) {
00028     
00029     // Run the game.
00030     controller.run_game_engine(lcd, gamepad);  
00031   }     
00032 }  
00033 
00034 @endcode
00035 */
00036 
00037 class EngineController {
00038  public:
00039   // Constructor and destructor.
00040   /**
00041   * @brief Constructor @details Non user specified.
00042   */
00043   EngineController();
00044   /**
00045   * @brief Destructor @details Non user specified.
00046   */
00047   ~EngineController();
00048   
00049   // Mutators
00050   /**
00051   * @brief Initialises the Game Engine Controller object.
00052   */ 
00053   void init();
00054   /**
00055   * @brief Runs the game via controlling the game engine.
00056   * @param &lcd @details The lcd object from the N5110 class
00057   * @param &gamepad @details The gamepad object from Gamepad class
00058   */
00059   void run_game_engine(N5110 &lcd, Gamepad &gamepad);
00060   
00061  private:
00062   void check_for_start(N5110 &lcd, Gamepad &gamepad);
00063   void print_intro_text(N5110 &lcd);
00064   void update_game(N5110 &lcd, Gamepad &gamepad);
00065   
00066   Engine _game_engine;
00067   int _game_counter;
00068   bool _start_platform_flag;
00069   int _speed_divider;
00070   int _player_score;
00071   bool _change_speed_flag;
00072    
00073 };
00074 #endif
00075 
00076 
00077 
00078