JianWei Lee
/
project_game
Meteor defense project
main.cpp
- Committer:
- jasper0712
- Date:
- 2017-03-21
- Revision:
- 2:2c60c92bf65b
- Parent:
- 1:f5cda0674f24
- Child:
- 3:6b50fe9d3848
File content as of revision 2:2c60c92bf65b:
#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 48 #define Cols 84 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) { spa.moveSpawn(); spa.randomizeSpawn(); spa.updateSpawn(lcd); 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(); }