Class used to run the maze game loop.

Committer:
el15mh
Date:
Fri Apr 21 12:47:52 2017 +0000
Revision:
3:4b82cb2e0618
Parent:
2:cbce5d35e7d6
Child:
4:93fd2f3bd0de
goal check implemented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el15mh 1:5a44ce88c5e2 1 /*
el15mh 1:5a44ce88c5e2 2
el15mh 1:5a44ce88c5e2 3 @file mazeEngine.h
el15mh 1:5a44ce88c5e2 4
el15mh 1:5a44ce88c5e2 5 (c) Max Houghton 19.03.2017
el15mh 1:5a44ce88c5e2 6 Roller Maze Project, ELEC2645, Univeristy of Leeds
el15mh 1:5a44ce88c5e2 7
el15mh 1:5a44ce88c5e2 8 */
el15mh 0:afee1085c5ef 9
el15mh 0:afee1085c5ef 10 #ifndef MAZEENGINE_H
el15mh 0:afee1085c5ef 11 #define MAZEENGINE_H
el15mh 0:afee1085c5ef 12
el15mh 0:afee1085c5ef 13 #include "mbed.h"
el15mh 1:5a44ce88c5e2 14 #include "math.h"
el15mh 0:afee1085c5ef 15 #include "N5110.h"
el15mh 0:afee1085c5ef 16 #include "Gamepad.h"
el15mh 0:afee1085c5ef 17 #include "FXOS8700CQ.h"
el15mh 0:afee1085c5ef 18 #include "Ball.h"
el15mh 0:afee1085c5ef 19 #include "Maze.h"
el15mh 0:afee1085c5ef 20
el15mh 0:afee1085c5ef 21 class MazeEngine
el15mh 0:afee1085c5ef 22 {
el15mh 0:afee1085c5ef 23
el15mh 0:afee1085c5ef 24 public:
el15mh 0:afee1085c5ef 25
el15mh 0:afee1085c5ef 26 MazeEngine();
el15mh 0:afee1085c5ef 27 ~MazeEngine();
el15mh 0:afee1085c5ef 28
el15mh 1:5a44ce88c5e2 29 void init(int mazeIndex, // sets the difficulty of the maze
el15mh 1:5a44ce88c5e2 30 int x, // x coordinate of ball centre
el15mh 1:5a44ce88c5e2 31 int y, // y coordinate of ball centre
el15mh 1:5a44ce88c5e2 32 int radius, // radius of the ball
el15mh 1:5a44ce88c5e2 33 bool control, // option for controlling ball
el15mh 1:5a44ce88c5e2 34 bool colour); // option for style of ball
el15mh 1:5a44ce88c5e2 35
el15mh 0:afee1085c5ef 36 void readInput(Gamepad &pad, FXOS8700CQ &device);
el15mh 1:5a44ce88c5e2 37 void readJoystickInput(Gamepad &pad);
el15mh 1:5a44ce88c5e2 38 void readAccelerometer(FXOS8700CQ &device);
el15mh 1:5a44ce88c5e2 39 void update(N5110 &lcd);
el15mh 0:afee1085c5ef 40 void draw(N5110 &lcd);
el15mh 3:4b82cb2e0618 41
el15mh 1:5a44ce88c5e2 42 void checkWallCollision(N5110 &lcd);
el15mh 3:4b82cb2e0618 43 bool checkGoal(N5110 &lcd);
el15mh 0:afee1085c5ef 44
el15mh 2:cbce5d35e7d6 45 void getMazeArray(N5110 &lcd);
el15mh 2:cbce5d35e7d6 46
el15mh 3:4b82cb2e0618 47 bool _goal;
el15mh 3:4b82cb2e0618 48
el15mh 0:afee1085c5ef 49 private:
el15mh 0:afee1085c5ef 50
el15mh 0:afee1085c5ef 51 Maze _maze;
el15mh 0:afee1085c5ef 52 Ball _ball;
el15mh 0:afee1085c5ef 53
el15mh 0:afee1085c5ef 54 int _mazeIndex;
el15mh 0:afee1085c5ef 55 int _x;
el15mh 0:afee1085c5ef 56 int _y;
el15mh 0:afee1085c5ef 57 int _radius;
el15mh 0:afee1085c5ef 58
el15mh 1:5a44ce88c5e2 59 Vector2D position;
el15mh 0:afee1085c5ef 60
el15mh 1:5a44ce88c5e2 61 bool _control;
el15mh 1:5a44ce88c5e2 62 bool _colour;
el15mh 2:cbce5d35e7d6 63
el15mh 2:cbce5d35e7d6 64 float _mazeArray[84][48];
el15mh 0:afee1085c5ef 65 };
el15mh 0:afee1085c5ef 66
el15mh 0:afee1085c5ef 67 #endif