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@8:d410856c6d04, 2019-04-18 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Thu Apr 18 10:42:42 2019 +0000
- Revision:
- 8:d410856c6d04
- Parent:
- 5:0b31909caf7f
- Child:
- 9:bc34f2243e43
Course map draw and bounce algorithms complete
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 | |
| 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 | 5:0b31909caf7f | 28 | void init(); |
| ellisbhastroud | 5:0b31909caf7f | 29 | |
| ellisbhastroud | 8:d410856c6d04 | 30 | void drawGame(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 8:d410856c6d04 | 31 | |
| ellisbhastroud | 8:d410856c6d04 | 32 | void read_input(Gamepad &pad); |
| ellisbhastroud | 5:0b31909caf7f | 33 | |
| ellisbhastroud | 5:0b31909caf7f | 34 | void update_ball(Gamepad &pad, int frame_rate); |
| ellisbhastroud | 5:0b31909caf7f | 35 | |
| ellisbhastroud | 8:d410856c6d04 | 36 | void drawCourseWalls(N5110 &lcd, Course map[], int size); |
| ellisbhastroud | 5:0b31909caf7f | 37 | |
| ellisbhastroud | 5:0b31909caf7f | 38 | void check_wall_bounce(); |
| ellisbhastroud | 8:d410856c6d04 | 39 | |
| ellisbhastroud | 8:d410856c6d04 | 40 | void set_level(int level); |
| ellisbhastroud | 8:d410856c6d04 | 41 | |
| ellisbhastroud | 8:d410856c6d04 | 42 | int get_level(); |
| ellisbhastroud | 5:0b31909caf7f | 43 | |
| ellisbhastroud | 5:0b31909caf7f | 44 | private: |
| ellisbhastroud | 5:0b31909caf7f | 45 | |
| ellisbhastroud | 5:0b31909caf7f | 46 | int _x_pos; |
| ellisbhastroud | 5:0b31909caf7f | 47 | int _y_pos; |
| ellisbhastroud | 8:d410856c6d04 | 48 | int _level; |
| ellisbhastroud | 8:d410856c6d04 | 49 | |
| ellisbhastroud | 8:d410856c6d04 | 50 | float _mag; |
| ellisbhastroud | 8:d410856c6d04 | 51 | Vector2D _joy_coord; |
| ellisbhastroud | 8:d410856c6d04 | 52 | float _angle; |
| ellisbhastroud | 5:0b31909caf7f | 53 | |
| ellisbhastroud | 5:0b31909caf7f | 54 | Ball _ball; |
| ellisbhastroud | 5:0b31909caf7f | 55 | |
| ellisbhastroud | 5:0b31909caf7f | 56 | }; |
| ellisbhastroud | 5:0b31909caf7f | 57 | |
| ellisbhastroud | 5:0b31909caf7f | 58 | #endif |