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.
Paddle Class Reference
#include <Paddle.h>
Public Member Functions | |
| Paddle () | |
| Constructor declaration. | |
| ~Paddle () | |
| Destructor declaration. | |
| void | init (int y, int height, int width) |
| Initialise Paddle attributes. | |
| void | draw (N5110 &lcd) |
| Draws the Paddle at at its current coordinates on the LCD. | |
| void | update (Direction d, float mag) |
| Update the Paddle's velocity according to the Gamepad input, then update coordinates accordingly. | |
| void | lose_life () |
| Decrement the variable _lives. | |
| void | inc_life () |
| Increment the variable _lives. | |
| void | reset_lives () |
| Set the variable _lives to 6. | |
| int | get_lives () |
| Retrieves the Paddle's lives remaining. | |
| void | set_tilt () |
| Sets the varible _tilt to true. | |
| void | set_joy () |
| Set the variable _tilt to false. | |
| void | set_sens (float sens) |
| Set the variable _sens. | |
| void | recentre () |
| Set the _x coordinate to the middle of the screen. | |
| Vector2D | get_pos () |
| Retrieves the Paddle's x and y velocities. | |
Detailed Description
Paddle Class.
- Date:
- May 2019
Definition at line 17 of file Paddle.h.
Constructor & Destructor Documentation
| Paddle | ( | ) |
Constructor declaration.
Definition at line 5 of file Paddle.cpp.
| ~Paddle | ( | ) |
Destructor declaration.
Definition at line 10 of file Paddle.cpp.
Member Function Documentation
| void draw | ( | N5110 & | lcd ) |
Draws the Paddle at at its current coordinates on the LCD.
- Parameters:
-
lcd a N5110 pointer
Definition at line 29 of file Paddle.cpp.
| int get_lives | ( | ) |
Retrieves the Paddle's lives remaining.
- Returns:
- the variable _lives
Definition at line 73 of file Paddle.cpp.
| Vector2D get_pos | ( | ) |
Retrieves the Paddle's x and y velocities.
- Returns:
- a vector of the x and y velocities
Definition at line 97 of file Paddle.cpp.
| void inc_life | ( | ) |
Increment the variable _lives.
Definition at line 85 of file Paddle.cpp.
| void init | ( | int | y, |
| int | height, | ||
| int | width | ||
| ) |
Initialise Paddle attributes.
- Parameters:
-
y initialises the _y value at the correct value on screen height sets the height of the paddle width sets the width of the paddle
Definition at line 15 of file Paddle.cpp.
| void lose_life | ( | ) |
Decrement the variable _lives.
Definition at line 79 of file Paddle.cpp.
| void recentre | ( | ) |
Set the _x coordinate to the middle of the screen.
Definition at line 116 of file Paddle.cpp.
| void reset_lives | ( | ) |
Set the variable _lives to 6.
Definition at line 91 of file Paddle.cpp.
| void set_joy | ( | ) |
Set the variable _tilt to false.
Definition at line 110 of file Paddle.cpp.
| void set_sens | ( | float | sens ) |
Set the variable _sens.
- Parameters:
-
sens sets _sens to local variable sens
Definition at line 122 of file Paddle.cpp.
| void set_tilt | ( | ) |
Sets the varible _tilt to true.
Definition at line 104 of file Paddle.cpp.
| void update | ( | Direction | d, |
| float | mag | ||
| ) |
Update the Paddle's velocity according to the Gamepad input, then update coordinates accordingly.
- Parameters:
-
pad a Gamepad pointer
Definition at line 35 of file Paddle.cpp.
Generated on Wed Jul 13 2022 09:05:52 by
1.7.2