![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
N5110
Ball/Ball.h@0:90b7f20b3a8d, 2020-04-28 (annotated)
- Committer:
- aileen
- Date:
- Tue Apr 28 01:39:30 2020 +0000
- Revision:
- 0:90b7f20b3a8d
N5110
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aileen | 0:90b7f20b3a8d | 1 | #ifndef BALL_H |
aileen | 0:90b7f20b3a8d | 2 | #define BALL_H |
aileen | 0:90b7f20b3a8d | 3 | |
aileen | 0:90b7f20b3a8d | 4 | #include "mbed.h" |
aileen | 0:90b7f20b3a8d | 5 | #include "N5110.h" |
aileen | 0:90b7f20b3a8d | 6 | #include "Gamepad.h" |
aileen | 0:90b7f20b3a8d | 7 | #include "Paddle.h" |
aileen | 0:90b7f20b3a8d | 8 | |
aileen | 0:90b7f20b3a8d | 9 | /** Ball Class |
aileen | 0:90b7f20b3a8d | 10 | @author Dr Craig A. Evans, University of Leeds |
aileen | 0:90b7f20b3a8d | 11 | @brief Controls the ball in the Pong game |
aileen | 0:90b7f20b3a8d | 12 | @date Febraury 2017 |
aileen | 0:90b7f20b3a8d | 13 | */ |
aileen | 0:90b7f20b3a8d | 14 | class Ball |
aileen | 0:90b7f20b3a8d | 15 | { |
aileen | 0:90b7f20b3a8d | 16 | |
aileen | 0:90b7f20b3a8d | 17 | public: |
aileen | 0:90b7f20b3a8d | 18 | Ball(); |
aileen | 0:90b7f20b3a8d | 19 | ~Ball(); |
aileen | 0:90b7f20b3a8d | 20 | void init(int size,int speed); |
aileen | 0:90b7f20b3a8d | 21 | void draw(N5110 &lcd); |
aileen | 0:90b7f20b3a8d | 22 | void update(); |
aileen | 0:90b7f20b3a8d | 23 | /// accessors and mutators |
aileen | 0:90b7f20b3a8d | 24 | void set_velocity(Vector2D v); |
aileen | 0:90b7f20b3a8d | 25 | Vector2D get_velocity(); |
aileen | 0:90b7f20b3a8d | 26 | Vector2D get_pos(); |
aileen | 0:90b7f20b3a8d | 27 | void set_pos(Vector2D p); |
aileen | 0:90b7f20b3a8d | 28 | |
aileen | 0:90b7f20b3a8d | 29 | private: |
aileen | 0:90b7f20b3a8d | 30 | |
aileen | 0:90b7f20b3a8d | 31 | Vector2D _velocity; |
aileen | 0:90b7f20b3a8d | 32 | int _size; |
aileen | 0:90b7f20b3a8d | 33 | int _x; |
aileen | 0:90b7f20b3a8d | 34 | int _y; |
aileen | 0:90b7f20b3a8d | 35 | }; |
aileen | 0:90b7f20b3a8d | 36 | #endif |