Class used to run the maze game loop.

MazeEngine.h

Committer:
el15mh
Date:
2017-05-03
Revision:
4:93fd2f3bd0de
Parent:
3:4b82cb2e0618
Child:
5:3635319c64b8

File content as of revision 4:93fd2f3bd0de:

/*
 
 @file mazeEngine.h
 
 (c) Max Houghton 19.03.2017
 Roller Maze Project, ELEC2645, Univeristy of Leeds
 
 */

#ifndef MAZEENGINE_H
#define MAZEENGINE_H

#include "mbed.h"
#include "math.h"
#include "N5110.h"
#include "Gamepad.h"
#include "FXOS8700CQ.h"
#include "Ball.h"
#include "Maze.h"

class MazeEngine
{
    
public:
    
    MazeEngine();
    ~MazeEngine();
    
    void init(int mazeIndex,    // sets the difficulty of the maze
              int x,            // x coordinate of ball centre
              int y,            // y coordinate of ball centre
              int radius,       // radius of the ball
              bool control,      // option for controlling ball
              bool colour);     // option for style of ball
    
    void readInput(Gamepad &pad, FXOS8700CQ &device);
    void readJoystickInput(Gamepad &pad);
    void readAccelerometer(FXOS8700CQ &device);
    void update(N5110 &lcd);
    void draw(N5110 &lcd);
    
    void checkWallCollision(N5110 &lcd);
    bool checkGoal();
    
    void getMazeArray(N5110 &lcd);
    
    bool _goal;
    
private:
    
    Maze _maze;
    Ball _ball;
    
    int _mazeIndex;
    int _x;
    int _y;
    int _radius;
    
    Vector2D position;
    
    bool _control;
    bool _colour;
    
    float _mazeArray[84][48];
};

#endif