ELEC2645 (2017/18) / Mbed OS el16ajm
Revision:
14:a57a40ff9430
Parent:
13:81573be8fac6
Child:
15:130900e5c268
--- a/Engine/Engine.h	Mon May 07 19:41:09 2018 +0000
+++ b/Engine/Engine.h	Tue May 08 13:15:41 2018 +0000
@@ -4,26 +4,64 @@
 #include "Snek.h"
 #include "Food.h"
 
+/** The Game Engine class
+* @brief Handles all failure states and game drawing
+* @author Andrew J. Moore
+* @date May, 2018
+*/
+
 class Engine
 {
 
 public:
+
+    /** Constructor */
     Engine();
+
+    /** Destructor */
     ~Engine();
 
+    /** Initialization function   */
     void init();
+
+    /** Reads and stores the current inputs from the gamepad
+    * @param the current state of the gamepad (Gamepad)
+    */
     void read_input(Gamepad &pad);
+
+    /** Updates the current game state
+    * @param the gamepad's functions as it is needed to use the speaker (Gamepad)
+    */
     void update(Gamepad &pad);
+
+    /** Draws the current state of the game
+    * @param the LCD so that it can be drawn to (N5110)
+    */
     void draw(N5110 &lcd);
+
+    /** Applies a splash screen to signify a game over state has been reached
+    * @param the LCD so that it can be drawn to (N5110)
+    */
     void gameOverScreen(N5110 &lcd);
-    string convertString(int a);
-    void gameOver(N5110 &lcd);
+
+    /** Gets the current score
+    * @return the current score
+    */
     float getScore();
-    bool getGameOver();    
+
+    /** Gets the current game state
+    * @return the value of _gameOver
+    */
+    bool getGameOver();
+
+    /** Sets the current level
+    * @param the level to be set to (int)
+    */
     void setLvl(int _levelToSet);
 
 private:
 
+    //Private Variables
     int _score;
     Direction _d;
     int _grid[22][22];
@@ -31,12 +69,14 @@
     Food _noodles; //Common foodstuffs in MGS, once again to reduce confusion
     bool _gameOver;
     int _lvl;
-    
+
     //Private Methods
+    string convertString(int a);
     void loadLvl();
     void lvlOne();
     void lvlTwo();
-    void lvlThree(); 
+    void lvlThree();
     bool checkFood();
     void growSnake(Gamepad &pad);
+    void checkGameOverAndSetGrid();
 };
\ No newline at end of file