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: Map/Map.h
- Revision:
- 37:de1f584bce71
- Parent:
- 29:42651f87522b
- Child:
- 38:a85bc227b907
--- a/Map/Map.h Mon May 06 00:05:52 2019 +0000 +++ b/Map/Map.h Mon May 06 21:44:49 2019 +0000 @@ -10,19 +10,60 @@ class Map { public: - //constructor + /** + * @brief Create a Map object + */ Map(); - //destructor + /** + * @brief Delete a Map object to free up memory + */ ~Map(); - //initialiser + /** + * @brief Set the initial section of the map to be displayed + */ void init(); + /** + * @brief Read the accelerometer input and convert it to a rate to move across the map + * @param accelerometer - FXOS8700CQ object to read the player's input motion + * @param ball - Ball object to get the sensitivity to input motion + */ void read_input(FXOS8700CQ &accelerometer, Ball &ball); + /** + * @brief Update the map region to be displayed + */ void update(); + /** + * @brief Draw the map features on the LCD screen + * @param lcd - N5110 object to interact with LCD + */ void draw(N5110 &lcd); + /** + * @brief Get the coordinates of the upper-left most pixel currently being displayed + * @returns 2D vector of the x and y coordinates + */ Vector2D get_map_display(); + /** + * @brief Set the coordinates for the upper-left most pixel to be displayed on the screen + * @param a 2D vector of the desired coordinates + */ void set_map_display(Vector2D coord); + /** + * @brief Check if the ball has overlapped with a coordinate assigned '1' in the game map + * @param gamepad - Gamepad object to access Vector2D struct + * @param ball - Ball object to find the range of coordinates covered by the ball + * @returns + * true - wall collision has occurred + * false - wall collision has not occurred + */ bool check_wall_collision(Gamepad &gamepad, Ball &ball); - bool get_coordinate(); //returns whether a coordinate in the gamemap is a 1 or 0. + /** + * @brief Get whether a coordinate in the game map is assigned a '1' or a '0' + * @param coord - 2D vector of the x and y coordinates of the desired point + * @returns + * true - coordinate contains a '1' + * false - coordinate contains a '0' + */ + bool get_coordinate(Vector2D coord); private: