Meteor defense project

Dependencies:   N5110 mbed

Committer:
jasper0712
Date:
Mon Apr 10 09:56:47 2017 +0000
Revision:
17:53aedd20155a
Parent:
14:064b8d7f348d
Child:
28:450ab72fabdc
done with drone? maybe.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jasper0712 0:5fbc0fbc9d30 1 #include "mbed.h"
jasper0712 0:5fbc0fbc9d30 2 #include "N5110.h"
jasper0712 0:5fbc0fbc9d30 3 #include "Gamepad.h"
jasper0712 4:4145abd09075 4 #include "GameEngine.h"
jasper0712 0:5fbc0fbc9d30 5
jasper0712 0:5fbc0fbc9d30 6 #define PI 3.14159265
jasper0712 0:5fbc0fbc9d30 7 //Y rows and X columns
jasper0712 1:f5cda0674f24 8 #define Rows 48
jasper0712 1:f5cda0674f24 9 #define Cols 84
jasper0712 0:5fbc0fbc9d30 10
jasper0712 0:5fbc0fbc9d30 11 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
jasper0712 0:5fbc0fbc9d30 12 Gamepad pad;
jasper0712 4:4145abd09075 13 GameEngine game;
jasper0712 5:c74bbdda06f4 14
jasper0712 4:4145abd09075 15
jasper0712 0:5fbc0fbc9d30 16
jasper0712 8:9814b7261854 17 int gamefps = 15;
jasper0712 0:5fbc0fbc9d30 18 void init();
jasper0712 0:5fbc0fbc9d30 19 void render();
jasper0712 0:5fbc0fbc9d30 20
jasper0712 0:5fbc0fbc9d30 21 int main()
jasper0712 0:5fbc0fbc9d30 22 {
jasper0712 0:5fbc0fbc9d30 23
jasper0712 0:5fbc0fbc9d30 24 init();
jasper0712 0:5fbc0fbc9d30 25 while (true) {
jasper0712 17:53aedd20155a 26 game.update(pad, lcd);
jasper0712 0:5fbc0fbc9d30 27 render();
jasper0712 0:5fbc0fbc9d30 28 }
jasper0712 0:5fbc0fbc9d30 29 }
jasper0712 0:5fbc0fbc9d30 30
jasper0712 0:5fbc0fbc9d30 31 void init()
jasper0712 0:5fbc0fbc9d30 32 {
jasper0712 0:5fbc0fbc9d30 33 // need to initialise LCD and Gamepad
jasper0712 0:5fbc0fbc9d30 34 lcd.init();
jasper0712 0:5fbc0fbc9d30 35 pad.init();
jasper0712 17:53aedd20155a 36 game.init();
jasper0712 0:5fbc0fbc9d30 37 // initialise the game
jasper0712 0:5fbc0fbc9d30 38 }
jasper0712 0:5fbc0fbc9d30 39
jasper0712 0:5fbc0fbc9d30 40 void render()
jasper0712 0:5fbc0fbc9d30 41 {
jasper0712 0:5fbc0fbc9d30 42 // clear screen, re-draw and refresh
jasper0712 0:5fbc0fbc9d30 43 lcd.refresh();
jasper0712 0:5fbc0fbc9d30 44 wait(1.0/gamefps);
jasper0712 0:5fbc0fbc9d30 45 lcd.clear();
jasper0712 0:5fbc0fbc9d30 46 }