ELEC2645 (2017/18) / Mbed OS el16ajm
Committer:
Andrew_M
Date:
Sun Apr 29 14:19:38 2018 +0000
Revision:
3:6253a2d374fa
Parent:
2:9ca5e1c221c3
Child:
5:a3a9e0417e04
Snake head now moves across screen, remembers the direction it moved in before so it continues moving without user input

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 1:a14415de3ad5 5
Andrew_M 1:a14415de3ad5 6 class Engine
Andrew_M 1:a14415de3ad5 7 {
Andrew_M 1:a14415de3ad5 8
Andrew_M 1:a14415de3ad5 9 public:
Andrew_M 1:a14415de3ad5 10 Engine();
Andrew_M 1:a14415de3ad5 11 ~Engine();
Andrew_M 1:a14415de3ad5 12
Andrew_M 1:a14415de3ad5 13 void init();
Andrew_M 1:a14415de3ad5 14 void read_input(Gamepad &pad);
Andrew_M 1:a14415de3ad5 15 void update(Gamepad &pad);
Andrew_M 1:a14415de3ad5 16 void draw(N5110 &lcd);
Andrew_M 1:a14415de3ad5 17
Andrew_M 1:a14415de3ad5 18 private:
Andrew_M 1:a14415de3ad5 19
Andrew_M 1:a14415de3ad5 20 Direction _d;
Andrew_M 2:9ca5e1c221c3 21 int _grid[22][22];
Andrew_M 2:9ca5e1c221c3 22 Snek _solid;
Andrew_M 1:a14415de3ad5 23 };