FINAL VERSION

Dependencies:   mbed

Revision:
126:1ac594b5f91a
Parent:
123:39740c246fc2
Child:
129:b47c28c7eaaf
--- a/BreakoutEngine/BreakoutEngine.h	Wed May 08 19:24:47 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.h	Wed May 08 21:02:49 2019 +0000
@@ -18,7 +18,7 @@
 #define GAP_TOP 10
 #define GAP 2
 
-/* BreajoutEngine Class
+/** BreajoutEngine Class
 @author James Heavey, University of Leeds
 @brief Controls the Breakout game
 @date May 2019
@@ -28,34 +28,111 @@
 {
 
 public:
+
+    /** Constructor declaration */
     BreakoutEngine();
+    
+    /** Destructor declaration */
     ~BreakoutEngine();
-
+    
+    /** Initialises game variables
+    * @param paddle_width @details integer width of paddle
+    * @param paddle_height @details integer height of paddle
+    * @param ball_size @details integer diameter of ball in pixels
+    * @param speed @details integer initial speed of ball
+    */
     void init(int paddle_width,int paddle_height,int ball_size,int speed);
+    
+    /** Reads inputs from the Gamepad
+    * @param &pad @details a Gamepad pointer
+    */
     void read_input(Gamepad &pad);
+    
+    /** Updates the Game attributes
+    * @param &pad @details a Gamepad pointer
+    */
     void update(Gamepad &pad);
+    
+    /** Draws the objects' at their respective coordinates on the LCD
+    * @param &lcd @details a N5110 pointer
+    */
     void draw(N5110 &lcd);
+    
+    /** Updates the Gamepad LEDs with lives remaining
+    * @param &pad @details a Gamepad pointer
+    */
     void lives_leds(Gamepad &pad);
-    int get_lives();
+    
+    /** Returns the number of Bricks remaining on screen
+    * @return returns _number_left
+    */
     int get_num_left();
+    
+    /** Returns the score achieved on victory in the previous iteration of the game
+    * @return returns _prev_score
+    */
     int get_prev_score();
+    
+    /** Sets the member variable _prev_score to current score
+    * @param prev_score @details the new previous score which is the score achieved at victory
+    */
     void set_prev_score(int prev_score);
+    
+    /** Checks if the ball goes past the screen y boundary
+    * @param &pad @details a Gamepad pointer
+    */
     bool check_loss(Gamepad &pad);
+    
+    /** Increments the laser index */
     void inc_index();
+    
+    /** Resets the laser index to 0 */
     void reset_index();
+    
+    /** Returns the game (and all relevant objects) to initialised state  */
     void reset_game();
+    
+    /** Sets the member variable _number_left to 18 */
     void reset_num_left();
+    
+    /** Returns the current score to print to LCD in the game
+    * @return returns _score
+    */
     int get_score();
+    
+    /** Increment the multiplier if continue is selected upon victory */
     void inc_mult();
+    
+    /** Resets the multiplier to 0
+    * @return returns _prev_score
+    */
     void set_mult_zero();
+    
+    /** Returns the current multiplier value
+    * @return returns _multiplier
+    */
     int get_mult();
+    
+    /** Sets the paddle motion options for use in game
+    * @param tilt @details a bool that sets tilt if true and joystick if false
+    * @param sens @details a float that is derived from the pot, it multiplies the velocity of the paddle
+    */
     void set_paddle_motion(bool tilt, float sens);
+    
+    /** Sets the powerup to a random x position on screen if conditions are met */
     void check_life_powerup();
+    
+    /** Returns the number of lives remaining 
+    * @return returns the paddle member variable _lives
+    */
+    int get_lives();
+    
+    /** Resets the paddle lives to 6, used to reset the game  */
     void reset_paddle_lives();
 
 private:
 
-    void check_wall_collisions(Gamepad &pad);
+    void check_wall_collisions(Gamepad &pad);  
     void check_paddle_collisions(Gamepad &pad);
     void check_brick_collisions(Gamepad &pad);
     void check_laser_collisions(Gamepad &pad);
@@ -69,25 +146,24 @@
     int _speed;
     int _index;
     int _multiplier;
-    double _cool_time;
-
     int _paddley;
     int _number_left;
     int _prev_score;
     int _score;
-
+    double _cool_time;
+    
     Direction _d;
     float _mag;
 
-    Paddle _paddle;
-
-    Ball _ball;
-
     std::list<Laser> listofLasers;
     std::list<Laser>::iterator it_L;
 
     std::list<Brick> listofBricks;
     std::list<Brick>::iterator it_R;
+    
+    Paddle _paddle;
+
+    Ball _ball;
 
     Brick _brick11;
     Brick _brick12;