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@13:681192091568, 2019-05-06 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Mon May 06 10:00:57 2019 +0000
- Revision:
- 13:681192091568
- Parent:
- 12:7f7fadb5c106
- Child:
- 14:08ac9aaa34c3
Highscores now fully implemented. Scores written to file at end of game. Highscores section in menu now reads, sorts and displays scores stored in SD card file.
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 | 13:681192091568 | 6 | #include "SDFileSystem.h" |
| ellisbhastroud | 5:0b31909caf7f | 7 | #include "Gamepad.h" |
| ellisbhastroud | 5:0b31909caf7f | 8 | #include "Ball.h" |
| ellisbhastroud | 5:0b31909caf7f | 9 | |
| ellisbhastroud | 8:d410856c6d04 | 10 | |
| ellisbhastroud | 5:0b31909caf7f | 11 | /** Golf Engine Class |
| ellisbhastroud | 5:0b31909caf7f | 12 | * @brief Library to run golf game |
| ellisbhastroud | 5:0b31909caf7f | 13 | * @author Ellis Blackford Stroud |
| ellisbhastroud | 5:0b31909caf7f | 14 | * @date May, 2018 |
| ellisbhastroud | 5:0b31909caf7f | 15 | */ |
| ellisbhastroud | 5:0b31909caf7f | 16 | |
| ellisbhastroud | 5:0b31909caf7f | 17 | class GolfEngine |
| ellisbhastroud | 5:0b31909caf7f | 18 | { |
| ellisbhastroud | 5:0b31909caf7f | 19 | |
| ellisbhastroud | 5:0b31909caf7f | 20 | public: |
| ellisbhastroud | 5:0b31909caf7f | 21 | |
| ellisbhastroud | 5:0b31909caf7f | 22 | /** Constructor */ |
| ellisbhastroud | 5:0b31909caf7f | 23 | GolfEngine(); |
| ellisbhastroud | 5:0b31909caf7f | 24 | |
| ellisbhastroud | 5:0b31909caf7f | 25 | /** Destructor */ |
| ellisbhastroud | 5:0b31909caf7f | 26 | ~GolfEngine(); |
| ellisbhastroud | 5:0b31909caf7f | 27 | |
| ellisbhastroud | 10:9f54a6366e94 | 28 | void init(int frame_rate); |
| ellisbhastroud | 5:0b31909caf7f | 29 | |
| ellisbhastroud | 13:681192091568 | 30 | void new_level(N5110 &lcd, SDFileSystem &sd); |
| ellisbhastroud | 9:bc34f2243e43 | 31 | |
| ellisbhastroud | 8:d410856c6d04 | 32 | void drawGame(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 8:d410856c6d04 | 33 | |
| ellisbhastroud | 8:d410856c6d04 | 34 | void read_input(Gamepad &pad); |
| ellisbhastroud | 5:0b31909caf7f | 35 | |
| ellisbhastroud | 10:9f54a6366e94 | 36 | void update_ball(Gamepad &pad); |
| ellisbhastroud | 13:681192091568 | 37 | |
| ellisbhastroud | 8:d410856c6d04 | 38 | void set_level(int level); |
| ellisbhastroud | 8:d410856c6d04 | 39 | |
| ellisbhastroud | 8:d410856c6d04 | 40 | int get_level(); |
| ellisbhastroud | 9:bc34f2243e43 | 41 | |
| ellisbhastroud | 13:681192091568 | 42 | void printLevel(N5110 &lcd); |
| ellisbhastroud | 13:681192091568 | 43 | |
| ellisbhastroud | 12:7f7fadb5c106 | 44 | void reset_hole_flag(); |
| ellisbhastroud | 12:7f7fadb5c106 | 45 | |
| ellisbhastroud | 9:bc34f2243e43 | 46 | bool get_hole_flag(); |
| ellisbhastroud | 9:bc34f2243e43 | 47 | |
| ellisbhastroud | 5:0b31909caf7f | 48 | private: |
| ellisbhastroud | 5:0b31909caf7f | 49 | |
| ellisbhastroud | 12:7f7fadb5c106 | 50 | void drawCourseWalls(N5110 &lcd, WallMap map[], int size); |
| ellisbhastroud | 12:7f7fadb5c106 | 51 | |
| ellisbhastroud | 12:7f7fadb5c106 | 52 | void drawHole(N5110 &lcd, Coord hole); |
| ellisbhastroud | 13:681192091568 | 53 | |
| ellisbhastroud | 13:681192091568 | 54 | void file_append(int value, SDFileSystem &sd); |
| ellisbhastroud | 13:681192091568 | 55 | |
| ellisbhastroud | 8:d410856c6d04 | 56 | int _level; |
| ellisbhastroud | 12:7f7fadb5c106 | 57 | |
| ellisbhastroud | 9:bc34f2243e43 | 58 | bool _hole_flag; |
| ellisbhastroud | 8:d410856c6d04 | 59 | |
| ellisbhastroud | 8:d410856c6d04 | 60 | float _mag; |
| ellisbhastroud | 12:7f7fadb5c106 | 61 | |
| ellisbhastroud | 8:d410856c6d04 | 62 | Vector2D _joy_coord; |
| ellisbhastroud | 12:7f7fadb5c106 | 63 | |
| ellisbhastroud | 8:d410856c6d04 | 64 | float _angle; |
| ellisbhastroud | 5:0b31909caf7f | 65 | |
| ellisbhastroud | 5:0b31909caf7f | 66 | Ball _ball; |
| ellisbhastroud | 12:7f7fadb5c106 | 67 | |
| ellisbhastroud | 5:0b31909caf7f | 68 | }; |
| ellisbhastroud | 5:0b31909caf7f | 69 | |
| ellisbhastroud | 5:0b31909caf7f | 70 | #endif |