Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: BrickBreaker_Engine/BrickBreakerEngine.h
- Revision:
- 37:de1f584bce71
- Parent:
- 35:138ad0faa42b
- Child:
- 38:a85bc227b907
--- a/BrickBreaker_Engine/BrickBreakerEngine.h Mon May 06 00:05:52 2019 +0000
+++ b/BrickBreaker_Engine/BrickBreakerEngine.h Mon May 06 21:44:49 2019 +0000
@@ -14,17 +14,58 @@
class BrickBreakerEngine {
public:
- //constructor method
+ /**
+ * @brief Create an engine object for the BrickBreaker game mode
+ */
BrickBreakerEngine();
- //destructor method
+ /**
+ * @brief Delete a brickbreaker engine object to free up memory
+ */
~BrickBreakerEngine();
- //functionality methods
- void init(int radius, Ball &ball); //done
- void brickbreaker_draw(N5110 &lcd, Ball &ball); //done
+ /**
+ * @brief Initialise the engine object
+ * Initialises the ball object used and sets the position of the first square
+ * to hit with a random number. Gets the ball radius from ball object
+ * @param radius - integer for the ball's radius
+ * @param ball - object of Ball.h class
+ */
+ void init(int radius, Ball &ball);
+ /**
+ * @brief draw the features of the brickbreaker game mode on the LCD screen
+ * @param lcd - N5110 object to interact with the LCD screen
+ * @param ball - Ball object to access ball drawing function
+ */
+ void brickbreaker_draw(N5110 &lcd, Ball &ball);
+ /**
+ * @brief set the stored score for the brickbreaker mode to a specific value
+ * @param score - integer with desired score value
+ */
void set_score(int score);
+ /**
+ * @brief check whether the ball has collided with the square and, if so,
+ * randomly generate a new square based on random noise on a disconnected mbed port
+ * @param randnoise - AnalogIn reading from a disconnected port
+ * @param ball - Ball object to get the ball's position
+ */
void check_square_collision(AnalogIn &randnoise, Ball &ball);
+ /**
+ * @brief Check how long left in the game mode, and display LED sequence to
+ * show how long's left
+ * @param gamepad - Gamepad object to turn on and off LEDs
+ * @param frame - integer number of frames that have passed
+ * @param fps - integer number of frames per second the game runs at
+ */
void time_warning(Gamepad &gamepad, int frame, int fps);
+ /**
+ * @brief read the current high scores, check if the current score is higher
+ * than any and update the list accordingly
+ */
void write_high_scores();
+ /**
+ * @brief display the end of game screen with the player's final score
+ * @param gamepad - Gamepad object for use of buttons
+ * @param lcd - N5110 object to display end message on screen
+ */
void end(Gamepad &gamepad, N5110 &lcd);
private: