ELEC2645 (2017/18) / Mbed OS el16ajm
Committer:
Andrew_M
Date:
Mon Apr 30 15:07:08 2018 +0000
Revision:
6:ed553fd191c2
Parent:
5:a3a9e0417e04
Child:
11:b25874e7efe4
Added a score counter on screen so the player knows how many points/ how long the snake is;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Andrew_M 1:a14415de3ad5 1 #include "mbed.h"
Andrew_M 1:a14415de3ad5 2 #include "N5110.h"
Andrew_M 1:a14415de3ad5 3 #include "Gamepad.h"
Andrew_M 1:a14415de3ad5 4 #include "Snek.h"
Andrew_M 5:a3a9e0417e04 5 #include "Food.h"
Andrew_M 1:a14415de3ad5 6
Andrew_M 1:a14415de3ad5 7 class Engine
Andrew_M 1:a14415de3ad5 8 {
Andrew_M 1:a14415de3ad5 9
Andrew_M 1:a14415de3ad5 10 public:
Andrew_M 1:a14415de3ad5 11 Engine();
Andrew_M 1:a14415de3ad5 12 ~Engine();
Andrew_M 1:a14415de3ad5 13
Andrew_M 1:a14415de3ad5 14 void init();
Andrew_M 1:a14415de3ad5 15 void read_input(Gamepad &pad);
Andrew_M 1:a14415de3ad5 16 void update(Gamepad &pad);
Andrew_M 1:a14415de3ad5 17 void draw(N5110 &lcd);
Andrew_M 5:a3a9e0417e04 18 string convertString(int a);
Andrew_M 5:a3a9e0417e04 19 void gameOver(N5110 &lcd);
Andrew_M 5:a3a9e0417e04 20
Andrew_M 1:a14415de3ad5 21 private:
Andrew_M 5:a3a9e0417e04 22
Andrew_M 5:a3a9e0417e04 23 int _score;
Andrew_M 1:a14415de3ad5 24 Direction _d;
Andrew_M 2:9ca5e1c221c3 25 int _grid[22][22];
Andrew_M 2:9ca5e1c221c3 26 Snek _solid;
Andrew_M 5:a3a9e0417e04 27 Food _noodles;
Andrew_M 5:a3a9e0417e04 28 bool _gameOver;
Andrew_M 1:a14415de3ad5 29 };