Class used to run the maze game loop.

MazeEngine.h

Committer:
el15mh
Date:
2017-04-19
Revision:
2:cbce5d35e7d6
Parent:
1:5a44ce88c5e2
Child:
3:4b82cb2e0618

File content as of revision 2:cbce5d35e7d6:

/*
 
 @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);
    
    void getMazeArray(N5110 &lcd);
    
private:
    
    Maze _maze;
    Ball _ball;
    
    int _mazeIndex;
    int _x;
    int _y;
    int _radius;
    
    Vector2D position;
    
    bool _control;
    bool _colour;
    
    float _mazeArray[84][48];
};

#endif