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.
lib/PongEngine.h@2:482d74ef09c8, 2021-03-10 (annotated)
- Committer:
- eencae
- Date:
- Wed Mar 10 16:37:52 2021 +0000
- Revision:
- 2:482d74ef09c8
- Parent:
- 1:d63a63f0d397
- Child:
- 3:5746c6833d73
Added re-bound off back wall and paddle collisions.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| eencae | 1:d63a63f0d397 | 1 | #ifndef PONGENGINE_H |
| eencae | 1:d63a63f0d397 | 2 | #define PONGENGINE_H |
| eencae | 1:d63a63f0d397 | 3 | |
| eencae | 1:d63a63f0d397 | 4 | #include "mbed.h" |
| eencae | 1:d63a63f0d397 | 5 | #include "N5110.h" |
| eencae | 1:d63a63f0d397 | 6 | #include "Ball.h" |
| eencae | 1:d63a63f0d397 | 7 | #include "Utils.h" |
| eencae | 1:d63a63f0d397 | 8 | #include "Paddle.h" |
| eencae | 1:d63a63f0d397 | 9 | |
| eencae | 1:d63a63f0d397 | 10 | class PongEngine { |
| eencae | 1:d63a63f0d397 | 11 | public: |
| eencae | 1:d63a63f0d397 | 12 | PongEngine(); // pass in the lcd object from the main file |
| eencae | 1:d63a63f0d397 | 13 | void init(int paddle_position,int paddle_height,int paddle_width,int ball_size,int speed); |
| eencae | 1:d63a63f0d397 | 14 | void update(UserInput input); |
| eencae | 1:d63a63f0d397 | 15 | void draw(N5110 &lcd); |
| eencae | 1:d63a63f0d397 | 16 | private: |
| eencae | 1:d63a63f0d397 | 17 | void check_wall_collision(); |
| eencae | 2:482d74ef09c8 | 18 | void check_paddle_collision(); |
| eencae | 1:d63a63f0d397 | 19 | Ball _ball; |
| eencae | 1:d63a63f0d397 | 20 | Paddle _paddle; |
| eencae | 1:d63a63f0d397 | 21 | }; |
| eencae | 1:d63a63f0d397 | 22 | |
| eencae | 1:d63a63f0d397 | 23 | #endif |