Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.

Dependencies:   mbed FXOS8700CQ mbed-rtos

Revision:
1:61b67654ffb7
Parent:
0:1da4db5de653
Child:
2:464c7e62d97d
diff -r 1da4db5de653 -r 61b67654ffb7 main.cpp
--- a/main.cpp	Mon Mar 11 19:48:14 2019 +0000
+++ b/main.cpp	Fri Mar 22 10:40:52 2019 +0000
@@ -8,3 +8,105 @@
 Date: 11/03/2019
 */
 
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+
+/////////////// objects ///////////////
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);  // K64F - pwr from 3V3
+Gamepad pad;
+
+///////////// prototypes ///////////////
+void init();
+void welcome();
+
+///////////// functions ////////////////
+int main(){
+    
+    int fps = 8;  // frames per second
+
+    init();     // initialise and then display welcome screen...
+    welcome();  // waiting for the user to start
+
+    wait(1.0f/fps);  // and wait for one frame period
+    
+    while(1) {
+        
+    }
+    
+}
+
+// initialies all classes and libraries
+void init()
+{
+    lcd.init();
+    // change set contrast in range 0.0 to 1.0
+    // 0.4 appears to be a good starting point
+    lcd.setContrast(0.4);
+}
+
+// simple splash screen displayed on start-up
+void welcome() 
+{    
+    lcd.clear();
+        static int title_data[] = {
+            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,0,0,0,
+            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+        };
+
+        lcd.drawSprite(10, 3, 35, 65, title_data);
+  
+        static int start_data[] = {
+            1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,
+            1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,
+            1,1,1,0,1,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,1,0,
+            1,0,0,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,
+            1,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0
+        };
+        
+        bool flash = true;
+        if (flash) {
+            lcd.drawSprite(22, 41, 5, 41, start_data);
+            flash = !flash;
+        }
+        else {
+            flash = !flash;
+        }
+
+        lcd.refresh();
+        
+        wait(1.0);
+}
\ No newline at end of file