James Heavey
/
EL17JH
FINAL VERSION
Ball/Ball.h@86:01f33d94e496, 2019-05-06 (annotated)
- Committer:
- jamesheavey
- Date:
- Mon May 06 19:04:42 2019 +0000
- Revision:
- 86:01f33d94e496
- Parent:
- 76:52410264a72d
- Child:
- 91:c01a736fb0d9
comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jamesheavey | 0:7d4d2023ed9c | 1 | #ifndef BALL_H |
jamesheavey | 0:7d4d2023ed9c | 2 | #define BALL_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 | #include "Paddle.h" |
jamesheavey | 0:7d4d2023ed9c | 8 | |
jamesheavey | 86:01f33d94e496 | 9 | #define BALL_SIZE 2 |
jamesheavey | 86:01f33d94e496 | 10 | #define BALL_SPEED 2 |
jamesheavey | 86:01f33d94e496 | 11 | |
jamesheavey | 86:01f33d94e496 | 12 | /* Ball Class |
jamesheavey | 86:01f33d94e496 | 13 | @author James Heavey, University of Leeds |
jamesheavey | 86:01f33d94e496 | 14 | @brief Controls the ball in the Breakout game |
jamesheavey | 86:01f33d94e496 | 15 | @date May 2019 |
jamesheavey | 0:7d4d2023ed9c | 16 | */ |
jamesheavey | 86:01f33d94e496 | 17 | |
jamesheavey | 0:7d4d2023ed9c | 18 | class Ball |
jamesheavey | 0:7d4d2023ed9c | 19 | { |
jamesheavey | 0:7d4d2023ed9c | 20 | |
jamesheavey | 0:7d4d2023ed9c | 21 | public: |
jamesheavey | 0:7d4d2023ed9c | 22 | Ball(); |
jamesheavey | 0:7d4d2023ed9c | 23 | ~Ball(); |
jamesheavey | 76:52410264a72d | 24 | void init(int size,int speed,int x); |
jamesheavey | 0:7d4d2023ed9c | 25 | void draw(N5110 &lcd); |
jamesheavey | 0:7d4d2023ed9c | 26 | void update(); |
jamesheavey | 86:01f33d94e496 | 27 | |
jamesheavey | 0:7d4d2023ed9c | 28 | /// accessors and mutators |
jamesheavey | 0:7d4d2023ed9c | 29 | void set_velocity(Vector2D v); |
jamesheavey | 0:7d4d2023ed9c | 30 | Vector2D get_velocity(); |
jamesheavey | 0:7d4d2023ed9c | 31 | Vector2D get_pos(); |
jamesheavey | 0:7d4d2023ed9c | 32 | void set_pos(Vector2D p); |
jamesheavey | 0:7d4d2023ed9c | 33 | |
jamesheavey | 0:7d4d2023ed9c | 34 | private: |
jamesheavey | 0:7d4d2023ed9c | 35 | |
jamesheavey | 0:7d4d2023ed9c | 36 | Vector2D _velocity; |
jamesheavey | 0:7d4d2023ed9c | 37 | int _size; |
jamesheavey | 0:7d4d2023ed9c | 38 | int _x; |
jamesheavey | 0:7d4d2023ed9c | 39 | int _y; |
jamesheavey | 0:7d4d2023ed9c | 40 | }; |
jamesheavey | 0:7d4d2023ed9c | 41 | #endif |