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
Diff: GolfEngine/GolfEngine.h
- Revision:
- 5:0b31909caf7f
- Child:
- 8:d410856c6d04
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GolfEngine/GolfEngine.h Wed Apr 17 10:27:09 2019 +0000
@@ -0,0 +1,64 @@
+#ifndef GOLFENGINE_H
+#define GOLFENGINE_H
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+#include "Ball.h"
+
+/** Golf Engine Class
+* @brief Library to run golf game
+* @author Ellis Blackford Stroud
+* @date May, 2018
+*/
+
+/** Enum for wall types */
+enum Wall {
+
+ LEFT, /**< left wall */
+ RIGHT, /**< right wall */
+ TOP, /**< top wall */
+ BOTTOM, /**< bottom wall */
+};
+
+/** Course Information struct */
+struct Course {
+ Wall wall; /**< wall type */
+ Vector2D start; /**< coordinate of line start */
+ Vector2D end; /**< coordinate of line end */
+};
+
+class GolfEngine
+{
+
+public:
+
+ /** Constructor */
+ GolfEngine();
+
+ /** Destructor */
+ ~GolfEngine();
+
+ void init();
+
+ void drawGame(N5110 &lcd);
+
+ void update_ball(Gamepad &pad, int frame_rate);
+
+ void drawCourseWalls(N5110 &lcd);
+
+ void check_wall_bounce();
+
+private:
+
+ int _x_pos;
+ int _y_pos;
+
+ Ball _ball;
+
+ //Srtuct array to store coords of lines to plot for first level, this data also used in bounce algorithm
+
+ Course _level_1[6];
+};
+
+#endif
\ No newline at end of file