JianWei Lee
/
project_game
Meteor defense project
Diff: main.cpp
- Revision:
- 0:5fbc0fbc9d30
- Child:
- 1:f5cda0674f24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 20 09:15:57 2017 +0000 @@ -0,0 +1,53 @@ +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "Weapon.h" +#include "Spawn.h" + +#define PI 3.14159265 +//Y rows and X columns +#define Rows 47 +#define Cols 83 + +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); +Gamepad pad; +Weapon weap; +Spawn spa; + +int gamefps = 1; +void init(); +void render(); + +int main() +{ + + init(); + while (true) { + + weap.drawWeapon(pad, lcd); + + if (pad.buttonhold == 1) { + printf("hi im working \n"); + weap.fireWeapon(pad, lcd); + } + + render(); + } +} + +void init() +{ + // need to initialise LCD and Gamepad + lcd.init(); + pad.init(); + + // initialise the game +} + +void render() +{ + // clear screen, re-draw and refresh + lcd.refresh(); + wait(1.0/gamefps); + lcd.clear(); +} \ No newline at end of file