ELEC2645 (2017/18) / Mbed OS el16ajm

Engine/Engine.h

Committer:
Andrew_M
Date:
2018-05-07
Revision:
13:81573be8fac6
Parent:
12:d3eef5ea3f43
Child:
14:a57a40ff9430

File content as of revision 13:81573be8fac6:

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Snek.h"
#include "Food.h"

class Engine
{

public:
    Engine();
    ~Engine();

    void init();
    void read_input(Gamepad &pad);
    void update(Gamepad &pad);
    void draw(N5110 &lcd);
    void gameOverScreen(N5110 &lcd);
    string convertString(int a);
    void gameOver(N5110 &lcd);
    float getScore();
    bool getGameOver();    
    void setLvl(int _levelToSet);

private:

    int _score;
    Direction _d;
    int _grid[22][22];
    Snek _solid; //Named after Metal Gear Solid character Solid Snake to reduce confusion when debugging
    Food _noodles; //Common foodstuffs in MGS, once again to reduce confusion
    bool _gameOver;
    int _lvl;
    
    //Private Methods
    void loadLvl();
    void lvlOne();
    void lvlTwo();
    void lvlThree(); 
    bool checkFood();
    void growSnake(Gamepad &pad);
};