
Final Commit
Dependencies: mbed
Diff: main.cpp
- Revision:
- 6:f3f508cea1c4
- Parent:
- 5:27fcb9b36e7e
- Child:
- 7:c38800a428a6
--- a/main.cpp Tue Mar 13 09:42:49 2018 +0000 +++ b/main.cpp Fri Mar 16 13:02:55 2018 +0000 @@ -3,6 +3,15 @@ #include "Gamepad.h" #include "N5110.h" #include "Testing.h" +#include "SnakeEngine.h" + +struct UserInput +{ + + Direction d; + +}; + /* ELEC2645 Embedded Systems Project School @@ -14,13 +23,26 @@ Date: 28/02/2018 */ +// ----- Objects ----- + +SnakeEngine snake_engine; +Gamepad pad; +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Testing test; +// ----- Prototypes ----- + +void init(); +void update_game(UserInput input); +void render(); +void start_menu(); + int main() { - // ----- Testing Program ----- + // ----- Testing Program ----- while(1){ - + + if(test.food_test_position()) { printf("Passed position test \n"); @@ -44,10 +66,36 @@ printf("Failed Range Test \n"); } - - wait(1.0); - + + wait(1.0); } + + } - } \ No newline at end of file +// initialies all classes and libraries +void init() +{ + // need to initialise LCD and Gamepad + lcd.init(); + pad.init(); + + // initialise the game with food, snake... + // snake_engine.init( ); + +} + +// this function draws each frame on the LCD +void render() +{ + // clear screen, re-draw and refresh + lcd.clear(); + // snake_engine.draw(lcd); + lcd.refresh(); +} + +void start_menu() { + + // brings up start menu, levels, scores + +} \ No newline at end of file