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.
Map/Map.h@6:39bda45efeed, 2019-04-08 (annotated)
- Committer:
- kocemax
- Date:
- Mon Apr 08 09:14:33 2019 +0000
- Revision:
- 6:39bda45efeed
- Parent:
- 5:12c179da4788
- Child:
- 7:cd3cafda3dd4
Finally had more time during the holiday, reedited lots of the code to make it simpler, more readable, more robust, and better structured.Also added collision detection with the bricks, but no deflection yet.(Took the algorithm from an online forum).
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kocemax | 5:12c179da4788 | 1 | #ifndef MAP_H |
| kocemax | 5:12c179da4788 | 2 | #define MAP_H |
| kocemax | 5:12c179da4788 | 3 | |
| kocemax | 5:12c179da4788 | 4 | #include "mbed.h" |
| kocemax | 5:12c179da4788 | 5 | #include "N5110.h" |
| kocemax | 5:12c179da4788 | 6 | #include "Gamepad.h" |
| kocemax | 5:12c179da4788 | 7 | #include "PlayerControl.h" |
| kocemax | 5:12c179da4788 | 8 | #include "Ball.h" |
| kocemax | 6:39bda45efeed | 9 | #include <vector> |
| kocemax | 5:12c179da4788 | 10 | |
| kocemax | 5:12c179da4788 | 11 | /** Map Class |
| kocemax | 5:12c179da4788 | 12 | @author Kostadin Chakarov, University of Leeds |
| kocemax | 5:12c179da4788 | 13 | @brief Creates the map in the Breakout++ game |
| kocemax | 5:12c179da4788 | 14 | @date March 2019 |
| kocemax | 5:12c179da4788 | 15 | */ |
| kocemax | 5:12c179da4788 | 16 | |
| kocemax | 6:39bda45efeed | 17 | struct Brick { |
| kocemax | 6:39bda45efeed | 18 | int x, y, w, h; |
| kocemax | 5:12c179da4788 | 19 | }; |
| kocemax | 5:12c179da4788 | 20 | |
| kocemax | 5:12c179da4788 | 21 | class Map |
| kocemax | 5:12c179da4788 | 22 | { |
| kocemax | 6:39bda45efeed | 23 | private: |
| kocemax | 6:39bda45efeed | 24 | std::vector<Brick> bricks; |
| kocemax | 5:12c179da4788 | 25 | |
| kocemax | 5:12c179da4788 | 26 | public: |
| kocemax | 5:12c179da4788 | 27 | Map(); |
| kocemax | 5:12c179da4788 | 28 | ~Map(); |
| kocemax | 6:39bda45efeed | 29 | void initBricks(); |
| kocemax | 5:12c179da4788 | 30 | void drawMap(N5110 &lcd); |
| kocemax | 6:39bda45efeed | 31 | void checkCollision(GameObject &obj); |
| kocemax | 6:39bda45efeed | 32 | void destroyMap(N5110 &lcd, Gamepad &pad, Ball &ball); |
| kocemax | 5:12c179da4788 | 33 | |
| kocemax | 5:12c179da4788 | 34 | private: |
| kocemax | 5:12c179da4788 | 35 | |
| kocemax | 5:12c179da4788 | 36 | |
| kocemax | 5:12c179da4788 | 37 | }; |
| kocemax | 5:12c179da4788 | 38 | #endif |