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.
Dependencies: mbed
Ball2/Ball2.h@12:2af7b4868033, 2020-05-27 (annotated)
- Committer:
- Mousky
- Date:
- Wed May 27 07:00:37 2020 +0000
- Revision:
- 12:2af7b4868033
Final Version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mousky | 12:2af7b4868033 | 1 | #ifndef BALL2_H |
Mousky | 12:2af7b4868033 | 2 | #define BALL2_H |
Mousky | 12:2af7b4868033 | 3 | |
Mousky | 12:2af7b4868033 | 4 | #include "mbed.h" |
Mousky | 12:2af7b4868033 | 5 | #include "N5110.h" |
Mousky | 12:2af7b4868033 | 6 | #include "Gamepad.h" |
Mousky | 12:2af7b4868033 | 7 | #include "Paddle.h" |
Mousky | 12:2af7b4868033 | 8 | |
Mousky | 12:2af7b4868033 | 9 | /** Ball Class |
Mousky | 12:2af7b4868033 | 10 | @author Dr Craig A. Evans, University of Leeds |
Mousky | 12:2af7b4868033 | 11 | @brief Controls the ball in the Pong game |
Mousky | 12:2af7b4868033 | 12 | @date Febraury 2017 |
Mousky | 12:2af7b4868033 | 13 | */ |
Mousky | 12:2af7b4868033 | 14 | class Ball2 |
Mousky | 12:2af7b4868033 | 15 | { |
Mousky | 12:2af7b4868033 | 16 | public: |
Mousky | 12:2af7b4868033 | 17 | Ball2(); |
Mousky | 12:2af7b4868033 | 18 | ~Ball2(); |
Mousky | 12:2af7b4868033 | 19 | void init(int size,int speed); |
Mousky | 12:2af7b4868033 | 20 | void draw(N5110 &lcd); |
Mousky | 12:2af7b4868033 | 21 | void update(); |
Mousky | 12:2af7b4868033 | 22 | /// accessors and mutators |
Mousky | 12:2af7b4868033 | 23 | void set_velocity(Vector2D v); |
Mousky | 12:2af7b4868033 | 24 | Vector2D get_velocity(); |
Mousky | 12:2af7b4868033 | 25 | Vector2D get_pos(); |
Mousky | 12:2af7b4868033 | 26 | void set_pos(Vector2D p); |
Mousky | 12:2af7b4868033 | 27 | |
Mousky | 12:2af7b4868033 | 28 | private: |
Mousky | 12:2af7b4868033 | 29 | Vector2D _velocity; |
Mousky | 12:2af7b4868033 | 30 | int _size; |
Mousky | 12:2af7b4868033 | 31 | int _x; |
Mousky | 12:2af7b4868033 | 32 | int _y; |
Mousky | 12:2af7b4868033 | 33 | }; |
Mousky | 12:2af7b4868033 | 34 | #endif |