Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
49:441c32f6603e
Parent:
48:d774bb162c61
Child:
52:c2faa96cf293
--- a/MenuClasses/StartScreen/StartScreen.cpp	Fri Apr 26 12:46:42 2019 +0000
+++ b/MenuClasses/StartScreen/StartScreen.cpp	Fri Apr 26 17:16:22 2019 +0000
@@ -133,7 +133,6 @@
 void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad)
 {
     //this saves the Theme song I want to play at the start.
-    StartScreen::init();
     int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370};
     pad.leds_on();
     
@@ -168,9 +167,10 @@
     pad.leds_off();
 }
     
-void StartScreen::info(N5110 &lcd, Gamepad &pad)
+void StartScreen::credits(N5110 &lcd)
 {   
-    if(sc ==1)  {
+    lcd.clear();
+    if(sc)  {
         lcd.printString("Created BY",8,1);
         lcd.printString("Ahmed",24,3);
         lcd.printString("Adamjee",20,4);
@@ -181,7 +181,12 @@
     lcd.clear();
 }
 
-void StartScreen::main_menu(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
+void StartScreen::read_stats(SDFileSystem &sd)
+{
+    _stats.read(sd);
+}
+
+void StartScreen::main_menu(N5110 &lcd, Gamepad &pad)
 {
     lcd.clear();
     StartScreen::init();
@@ -191,7 +196,7 @@
     }
     pad.tone(1000.0,0.1);
     wait(1/cs);
-    StartScreen::ImplementMM(lcd, pad, sd);
+    StartScreen::ImplementMM(lcd, pad);
 }
 
 void StartScreen::DisplayMMContents(N5110 &lcd, Gamepad &pad)
@@ -214,31 +219,31 @@
     lcd.clear();
 }
 
-void StartScreen::ImplementMM(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
+void StartScreen::ImplementMM(N5110 &lcd, Gamepad &pad)
 {   
     if(i == 16) {
-        game_mode(lcd, pad, sd);
+        game_mode(lcd, pad);
     }
     else if(i == 24) {
         float *cs_sc;
-        cs_sc = settings.Implement(lcd, pad, st, cs);
+        cs_sc = settings.Implement(lcd, pad, cs);
         pad.tone(1000.0,0.1);
         cs = cs_sc[0];
         sc = cs_sc[1];
-        main_menu(lcd, pad, sd);
+        main_menu(lcd, pad);
     }
     else if(i == 32) {
-        _stats.StatsDisplay(lcd, pad, sd);
+        _stats.StatsDisplay(lcd, pad);
         pad.tone(1000.0,0.1);
-        main_menu(lcd, pad, sd);
+        main_menu(lcd, pad);
     }
     else {
-        main_menu(lcd, pad, sd);
+        main_menu(lcd, pad);
         lr=1;
     }
 }
 
-void StartScreen::game_mode(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
+void StartScreen::game_mode(N5110 &lcd, Gamepad &pad)
 {
     lcd.clear();
     wait(2/cs);
@@ -254,12 +259,12 @@
         else {back_pressed = 0;}
     }
     if(back_pressed) {
-        main_menu(lcd, pad, sd);
+        main_menu(lcd, pad);
     }
     else {
         pad.tone(1000.0,0.1);
         lcd.clear();
-        game_speed(lcd, pad, sd);
+        game_speed(lcd, pad);
     }
 }
 
@@ -295,7 +300,7 @@
     lcd.refresh();
 }
 
-void StartScreen::game_speed(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
+void StartScreen::game_speed(N5110 &lcd, Gamepad &pad)
 {
     lcd.clear();
     wait(2/cs);
@@ -311,16 +316,18 @@
         else {back_pressed = 0;}
     }
     if(back_pressed) {
-        game_mode(lcd, pad, sd);
+        game_mode(lcd, pad);
     }
     else {
         pad.tone(1000.0,0.1);
         lcd.clear();
         wait(1/cs);
+        /*
         lcd.printString("Level:",25,1); //created so that the gamer can keep track of their game. //change this to be operated remotely
         lcd.printString("1",40,3);
         lcd.refresh();
         wait(2);
+        */
     }
 }