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 FATFileSystem
GolfEngine/GolfEngine.h@12:7f7fadb5c106, 2019-05-03 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Fri May 03 09:39:24 2019 +0000
- Revision:
- 12:7f7fadb5c106
- Parent:
- 10:9f54a6366e94
- Child:
- 13:681192091568
Added more detailed in line comments. Added Doxygen comments for classes. Reorganised some class methods. Removed unnecessary methods. Split large methods into multiple smaller.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ellisbhastroud | 5:0b31909caf7f | 1 | #ifndef GOLFENGINE_H |
| ellisbhastroud | 5:0b31909caf7f | 2 | #define GOLFENGINE_H |
| ellisbhastroud | 5:0b31909caf7f | 3 | |
| ellisbhastroud | 5:0b31909caf7f | 4 | #include "mbed.h" |
| ellisbhastroud | 5:0b31909caf7f | 5 | #include "N5110.h" |
| ellisbhastroud | 5:0b31909caf7f | 6 | #include "Gamepad.h" |
| ellisbhastroud | 5:0b31909caf7f | 7 | #include "Ball.h" |
| ellisbhastroud | 5:0b31909caf7f | 8 | |
| ellisbhastroud | 8:d410856c6d04 | 9 | |
| ellisbhastroud | 5:0b31909caf7f | 10 | /** Golf Engine Class |
| ellisbhastroud | 5:0b31909caf7f | 11 | * @brief Library to run golf game |
| ellisbhastroud | 5:0b31909caf7f | 12 | * @author Ellis Blackford Stroud |
| ellisbhastroud | 5:0b31909caf7f | 13 | * @date May, 2018 |
| ellisbhastroud | 5:0b31909caf7f | 14 | */ |
| ellisbhastroud | 5:0b31909caf7f | 15 | |
| ellisbhastroud | 5:0b31909caf7f | 16 | class GolfEngine |
| ellisbhastroud | 5:0b31909caf7f | 17 | { |
| ellisbhastroud | 5:0b31909caf7f | 18 | |
| ellisbhastroud | 5:0b31909caf7f | 19 | public: |
| ellisbhastroud | 5:0b31909caf7f | 20 | |
| ellisbhastroud | 5:0b31909caf7f | 21 | /** Constructor */ |
| ellisbhastroud | 5:0b31909caf7f | 22 | GolfEngine(); |
| ellisbhastroud | 5:0b31909caf7f | 23 | |
| ellisbhastroud | 5:0b31909caf7f | 24 | /** Destructor */ |
| ellisbhastroud | 5:0b31909caf7f | 25 | ~GolfEngine(); |
| ellisbhastroud | 5:0b31909caf7f | 26 | |
| ellisbhastroud | 10:9f54a6366e94 | 27 | void init(int frame_rate); |
| ellisbhastroud | 5:0b31909caf7f | 28 | |
| ellisbhastroud | 9:bc34f2243e43 | 29 | void new_level(); |
| ellisbhastroud | 9:bc34f2243e43 | 30 | |
| ellisbhastroud | 8:d410856c6d04 | 31 | void drawGame(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 8:d410856c6d04 | 32 | |
| ellisbhastroud | 8:d410856c6d04 | 33 | void read_input(Gamepad &pad); |
| ellisbhastroud | 5:0b31909caf7f | 34 | |
| ellisbhastroud | 10:9f54a6366e94 | 35 | void update_ball(Gamepad &pad); |
| ellisbhastroud | 5:0b31909caf7f | 36 | |
| ellisbhastroud | 9:bc34f2243e43 | 37 | void printLevel(N5110 &lcd); |
| ellisbhastroud | 12:7f7fadb5c106 | 38 | |
| ellisbhastroud | 8:d410856c6d04 | 39 | void set_level(int level); |
| ellisbhastroud | 8:d410856c6d04 | 40 | |
| ellisbhastroud | 8:d410856c6d04 | 41 | int get_level(); |
| ellisbhastroud | 9:bc34f2243e43 | 42 | |
| ellisbhastroud | 12:7f7fadb5c106 | 43 | void reset_hole_flag(); |
| ellisbhastroud | 12:7f7fadb5c106 | 44 | |
| ellisbhastroud | 9:bc34f2243e43 | 45 | bool get_hole_flag(); |
| ellisbhastroud | 9:bc34f2243e43 | 46 | |
| ellisbhastroud | 5:0b31909caf7f | 47 | private: |
| ellisbhastroud | 5:0b31909caf7f | 48 | |
| ellisbhastroud | 12:7f7fadb5c106 | 49 | void drawCourseWalls(N5110 &lcd, WallMap map[], int size); |
| ellisbhastroud | 12:7f7fadb5c106 | 50 | |
| ellisbhastroud | 12:7f7fadb5c106 | 51 | void drawHole(N5110 &lcd, Coord hole); |
| ellisbhastroud | 12:7f7fadb5c106 | 52 | |
| ellisbhastroud | 8:d410856c6d04 | 53 | int _level; |
| ellisbhastroud | 12:7f7fadb5c106 | 54 | |
| ellisbhastroud | 9:bc34f2243e43 | 55 | bool _hole_flag; |
| ellisbhastroud | 8:d410856c6d04 | 56 | |
| ellisbhastroud | 8:d410856c6d04 | 57 | float _mag; |
| ellisbhastroud | 12:7f7fadb5c106 | 58 | |
| ellisbhastroud | 8:d410856c6d04 | 59 | Vector2D _joy_coord; |
| ellisbhastroud | 12:7f7fadb5c106 | 60 | |
| ellisbhastroud | 8:d410856c6d04 | 61 | float _angle; |
| ellisbhastroud | 5:0b31909caf7f | 62 | |
| ellisbhastroud | 5:0b31909caf7f | 63 | Ball _ball; |
| ellisbhastroud | 12:7f7fadb5c106 | 64 | |
| ellisbhastroud | 5:0b31909caf7f | 65 | }; |
| ellisbhastroud | 5:0b31909caf7f | 66 | |
| ellisbhastroud | 5:0b31909caf7f | 67 | #endif |