harry rance
/
Revised_Space_Invaders
Harry Rance 200925395 Embedded Systems Project
main.cpp
- Committer:
- harryrance
- Date:
- 2017-04-13
- Revision:
- 1:95d7dd44bb0d
- Parent:
- 0:c9bf674fe0c7
- Child:
- 2:50feb42b982c
File content as of revision 1:95d7dd44bb0d:
////////// pre-processor directives ////////// #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "GameEngine.h" #define SHIELD_X 0 #define SHIELD_Y 0 #define US_X 42 #define AA_X 2 #define SPEED 1 ////////// structs ////////// struct UserInput { Direction d; float mag; }; ////////// objects ////////// N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; GameEngine engine; ////////// prototypes ////////// void init(); void render(); void update_game(UserInput input); ////////// functions ////////// int main() { int fps = 30; init(); render(); wait(1.0f/fps); while(1){ engine.read_input(pad); engine.update(pad); render(); wait(1.0f/fps); } } void render() { lcd.clear(); engine.draw(lcd); lcd.refresh(); } void init() { lcd.init(); pad.init(); engine.initialise(SHIELD_X, SHIELD_Y, US_X, AA_X, SPEED); }