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: Paddle/Paddle.h
- Revision:
- 129:b47c28c7eaaf
- Parent:
- 114:280903dd7e06
- Child:
- 130:46f3fac2bdf9
--- a/Paddle/Paddle.h Wed May 08 21:32:23 2019 +0000
+++ b/Paddle/Paddle.h Wed May 08 23:09:59 2019 +0000
@@ -8,7 +8,7 @@
#define PADDLE_WIDTH 15
#define PADDLE_HEIGHT 2
-/* Ball Class
+/** Paddle Class
@author James Heavey, University of Leeds
@brief Controls the paddle in the Breakout game
@date May 2019
@@ -17,21 +17,62 @@
class Paddle
{
public:
-
+
+ /** Constructor declaration */
Paddle();
+
+ /** Destructor declaration */
~Paddle();
- void init(int x,int height,int width);
+
+ /** Initialise Paddle attributes
+ * @param y @details initialises the _y value at the correct value on screen
+ * @param height @details sets the height of the paddle
+ * @param width @details sets the width of the paddle
+ */
+ void init(int y,int height,int width);
+
+ /** Draws the Paddle at at its current coordinates on the LCD
+ * @param &lcd @details a N5110 pointer
+ */
void draw(N5110 &lcd);
+
+ /** Update the Paddle's velocity according to the Gamepad input, then update coordinates accordingly
+ * @param &pad @details a Gamepad pointer
+ */
void update(Direction d,float mag);
+
+ /** Decrement the member variable _lives */
void lose_life();
+
+ /** Increment the member variable _lives */
void inc_life();
- Vector2D get_pos();
+
+ /** Set the member variable _lives to 6 */
+ void reset_lives();
+
+ /** Retrieves the Paddle's lives remaining
+ * @returns the member variable _lives
+ */
int get_lives();
- void reset_lives();
+
+ /** Sets the member varible _tilt to true */
void set_tilt();
+
+ /** Set the member variable _tilt to false */
void set_joy();
+
+ /** Set the member variable _sens
+ * @param sens @details sets _sens to local variable sens
+ */
+ void set_sens(float sens);
+
+ /** Set the _x coordinate to the middle of the screen */
void recentre();
- void set_sens(float sens);
+
+ /** Retrieves the Paddle's x and y velocities
+ * @returns a vector of the x and y velocities
+ */
+ Vector2D get_pos();
private: