Class used to run the maze game loop.

Committer:
el15mh
Date:
Mon Apr 17 08:47:00 2017 +0000
Revision:
1:5a44ce88c5e2
Parent:
0:afee1085c5ef
Child:
2:cbce5d35e7d6
project with wall collision function (not working);

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 0:afee1085c5ef 43 private:
el15mh 0:afee1085c5ef 44
el15mh 0:afee1085c5ef 45 Maze _maze;
el15mh 0:afee1085c5ef 46 Ball _ball;
el15mh 0:afee1085c5ef 47
el15mh 0:afee1085c5ef 48 int _mazeIndex;
el15mh 0:afee1085c5ef 49 int _x;
el15mh 0:afee1085c5ef 50 int _y;
el15mh 0:afee1085c5ef 51 int _radius;
el15mh 0:afee1085c5ef 52
el15mh 1:5a44ce88c5e2 53 Vector2D position;
el15mh 0:afee1085c5ef 54
el15mh 1:5a44ce88c5e2 55 bool _control;
el15mh 1:5a44ce88c5e2 56 bool _colour;
el15mh 0:afee1085c5ef 57 };
el15mh 0:afee1085c5ef 58
el15mh 0:afee1085c5ef 59 #endif