Su 200943147

Dependencies:   Gamepad N5110 mbed

Revision:
3:9dd35424cdfe
Parent:
0:444b4d0a113d
Child:
4:1faa216ac5cd
Child:
5:afa6592a4ba5
diff -r 84e6975dd4b2 -r 9dd35424cdfe main.cpp
--- a/main.cpp	Fri Apr 21 13:26:10 2017 +0000
+++ b/main.cpp	Sat Apr 29 13:10:21 2017 +0000
@@ -1,6 +1,40 @@
 #include "mbed.h"
 #include "N5110.h"
+#include "Engine.h"
+#include "Gamepad.h"
 
-//N5110 lcd(p7,p8,p9,p10,p11,p13,p21);  
+struct UserInput {
+    Direction d;
+};
+
+//N5110 lcd(p7,p8,p9,p10,p11,p13,p21);
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+Gamepad pad;
+Engine Engine;
+void Init();
 
+int main()
+{
+    Init();
+    // game loop - read input, update the game state and render the display
+    while (1) {
+        Engine.ReadInput(pad);
+        Engine.Update(pad);
+        Engine.Pixel(lcd);
+        lcd.refresh();
+        wait(0.1);
+    }
+}
+
+void Init()
+{
+    // need to initialise LCD and Gamepad
+    lcd.init();
+    pad.init();
+
+    // initialise the game
+    Engine.Init();
+    lcd.normalMode();      // normal colour mode
+    lcd.setBrightness(0.5); // put LED backlight on 50%
+    
+}