ELEC2645 (2018/19) / Mbed 2 deprecated el17ebs

Dependencies:   mbed FATFileSystem

Committer:
ellisbhastroud
Date:
Tue Apr 23 12:03:38 2019 +0000
Revision:
10:9f54a6366e94
Parent:
9:bc34f2243e43
Child:
12:7f7fadb5c106
Added corner bounces to bounce check algorithm. More levels now added with complex courses.

Who changed what in which revision?

UserRevisionLine numberNew 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 10:9f54a6366e94 28 void init(int frame_rate);
ellisbhastroud 5:0b31909caf7f 29
ellisbhastroud 9:bc34f2243e43 30 void new_level();
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 5:0b31909caf7f 37
ellisbhastroud 9:bc34f2243e43 38 void drawCourseWalls(N5110 &lcd, WallMap map[], int size);
ellisbhastroud 5:0b31909caf7f 39
ellisbhastroud 9:bc34f2243e43 40 void drawHole(N5110 &lcd, Coord hole);
ellisbhastroud 9:bc34f2243e43 41
ellisbhastroud 9:bc34f2243e43 42 void printLevel(N5110 &lcd);
ellisbhastroud 8:d410856c6d04 43
ellisbhastroud 8:d410856c6d04 44 void set_level(int level);
ellisbhastroud 8:d410856c6d04 45
ellisbhastroud 8:d410856c6d04 46 int get_level();
ellisbhastroud 9:bc34f2243e43 47
ellisbhastroud 9:bc34f2243e43 48 bool get_hole_flag();
ellisbhastroud 9:bc34f2243e43 49
ellisbhastroud 9:bc34f2243e43 50 void reset_hole_flag();
ellisbhastroud 5:0b31909caf7f 51
ellisbhastroud 5:0b31909caf7f 52 private:
ellisbhastroud 5:0b31909caf7f 53
ellisbhastroud 5:0b31909caf7f 54 int _x_pos;
ellisbhastroud 5:0b31909caf7f 55 int _y_pos;
ellisbhastroud 8:d410856c6d04 56 int _level;
ellisbhastroud 9:bc34f2243e43 57 bool _hole_flag;
ellisbhastroud 8:d410856c6d04 58
ellisbhastroud 8:d410856c6d04 59 float _mag;
ellisbhastroud 8:d410856c6d04 60 Vector2D _joy_coord;
ellisbhastroud 8:d410856c6d04 61 float _angle;
ellisbhastroud 5:0b31909caf7f 62
ellisbhastroud 5:0b31909caf7f 63 Ball _ball;
ellisbhastroud 5:0b31909caf7f 64
ellisbhastroud 5:0b31909caf7f 65 };
ellisbhastroud 5:0b31909caf7f 66
ellisbhastroud 5:0b31909caf7f 67 #endif