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/Paddle.h@111:4848c399fae0, 2019-05-08 (annotated)
- Committer:
- jamesheavey
- Date:
- Wed May 08 02:50:07 2019 +0000
- Revision:
- 111:4848c399fae0
- Parent:
- 91:c01a736fb0d9
- Child:
- 114:280903dd7e06
:0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jamesheavey | 0:7d4d2023ed9c | 1 | #ifndef PADDLE_H |
jamesheavey | 0:7d4d2023ed9c | 2 | #define PADDLE_H |
jamesheavey | 0:7d4d2023ed9c | 3 | |
jamesheavey | 0:7d4d2023ed9c | 4 | #include "mbed.h" |
jamesheavey | 0:7d4d2023ed9c | 5 | #include "N5110.h" |
jamesheavey | 0:7d4d2023ed9c | 6 | #include "Gamepad.h" |
jamesheavey | 0:7d4d2023ed9c | 7 | |
jamesheavey | 86:01f33d94e496 | 8 | #define PADDLE_WIDTH 15 |
jamesheavey | 86:01f33d94e496 | 9 | #define PADDLE_HEIGHT 2 |
jamesheavey | 86:01f33d94e496 | 10 | |
jamesheavey | 86:01f33d94e496 | 11 | /* Ball Class |
jamesheavey | 86:01f33d94e496 | 12 | @author James Heavey, University of Leeds |
jamesheavey | 91:c01a736fb0d9 | 13 | @brief Controls the paddle in the Breakout game |
jamesheavey | 86:01f33d94e496 | 14 | @date May 2019 |
jamesheavey | 91:c01a736fb0d9 | 15 | */ |
jamesheavey | 86:01f33d94e496 | 16 | |
jamesheavey | 0:7d4d2023ed9c | 17 | class Paddle |
jamesheavey | 0:7d4d2023ed9c | 18 | { |
jamesheavey | 0:7d4d2023ed9c | 19 | public: |
jamesheavey | 0:7d4d2023ed9c | 20 | |
jamesheavey | 0:7d4d2023ed9c | 21 | Paddle(); |
jamesheavey | 0:7d4d2023ed9c | 22 | ~Paddle(); |
jamesheavey | 0:7d4d2023ed9c | 23 | void init(int x,int height,int width); |
jamesheavey | 0:7d4d2023ed9c | 24 | void draw(N5110 &lcd); |
jamesheavey | 0:7d4d2023ed9c | 25 | void update(Direction d,float mag); |
jamesheavey | 9:f6f0f39538c7 | 26 | void lose_life(); |
jamesheavey | 0:7d4d2023ed9c | 27 | Vector2D get_pos(); |
jamesheavey | 9:f6f0f39538c7 | 28 | int get_lives(); |
jamesheavey | 111:4848c399fae0 | 29 | void reset_lives(); |
jamesheavey | 16:1761dfe801af | 30 | void set_tilt(); |
jamesheavey | 16:1761dfe801af | 31 | void set_joy(); |
jamesheavey | 69:db1354676fde | 32 | void recentre(); |
jamesheavey | 72:7254d2a8a1cd | 33 | void set_sens(float sens); |
jamesheavey | 0:7d4d2023ed9c | 34 | |
jamesheavey | 0:7d4d2023ed9c | 35 | private: |
jamesheavey | 0:7d4d2023ed9c | 36 | |
jamesheavey | 0:7d4d2023ed9c | 37 | int _height; |
jamesheavey | 0:7d4d2023ed9c | 38 | int _width; |
jamesheavey | 0:7d4d2023ed9c | 39 | int _x; |
jamesheavey | 0:7d4d2023ed9c | 40 | int _y; |
jamesheavey | 0:7d4d2023ed9c | 41 | int _speed; |
jamesheavey | 0:7d4d2023ed9c | 42 | int _score; |
jamesheavey | 9:f6f0f39538c7 | 43 | int _lives; |
jamesheavey | 72:7254d2a8a1cd | 44 | float _sens; |
jamesheavey | 16:1761dfe801af | 45 | bool _tilt; |
jamesheavey | 0:7d4d2023ed9c | 46 | |
jamesheavey | 91:c01a736fb0d9 | 47 | |
jamesheavey | 0:7d4d2023ed9c | 48 | }; |
jamesheavey | 0:7d4d2023ed9c | 49 | #endif |