Class used to run the maze game loop.

Committer:
el15mh
Date:
Wed Apr 19 20:16:56 2017 +0000
Revision:
2:cbce5d35e7d6
Parent:
1:5a44ce88c5e2
Child:
3:4b82cb2e0618
maze game with working wall barriers;

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 1:5a44ce88c5e2 41 void checkWallCollision(N5110 &lcd);
el15mh 0:afee1085c5ef 42
el15mh 2:cbce5d35e7d6 43 void getMazeArray(N5110 &lcd);
el15mh 2:cbce5d35e7d6 44
el15mh 0:afee1085c5ef 45 private:
el15mh 0:afee1085c5ef 46
el15mh 0:afee1085c5ef 47 Maze _maze;
el15mh 0:afee1085c5ef 48 Ball _ball;
el15mh 0:afee1085c5ef 49
el15mh 0:afee1085c5ef 50 int _mazeIndex;
el15mh 0:afee1085c5ef 51 int _x;
el15mh 0:afee1085c5ef 52 int _y;
el15mh 0:afee1085c5ef 53 int _radius;
el15mh 0:afee1085c5ef 54
el15mh 1:5a44ce88c5e2 55 Vector2D position;
el15mh 0:afee1085c5ef 56
el15mh 1:5a44ce88c5e2 57 bool _control;
el15mh 1:5a44ce88c5e2 58 bool _colour;
el15mh 2:cbce5d35e7d6 59
el15mh 2:cbce5d35e7d6 60 float _mazeArray[84][48];
el15mh 0:afee1085c5ef 61 };
el15mh 0:afee1085c5ef 62
el15mh 0:afee1085c5ef 63 #endif