Ikenna Adrian Ozoemena 201157039

Dependencies:   mbed

Revision:
44:a6a361bea806
Parent:
34:6d0786582d81
Child:
45:fe5fc85a5c73
--- a/Menu/Menu.cpp	Wed May 08 15:50:40 2019 +0000
+++ b/Menu/Menu.cpp	Wed May 08 16:46:21 2019 +0000
@@ -11,7 +11,7 @@
 {
 
 }
-const int kestrel[44][37] =   {
+const int kestrelSprite[44][37] =   {
     {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,1,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,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -58,7 +58,7 @@
     {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 };
 
-const int  imperion[39][17] = {
+const int  imperionSprite[39][17] = {
     {0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0},
     {0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0},
     {0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0},
@@ -99,7 +99,7 @@
     {0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0},
     {0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0},
 };
-const int orion[45][26] = {
+const int orionSprite[45][26] = {
     {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0},
     {0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,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,1,0,0,0,0,0,0,0},
@@ -159,7 +159,7 @@
 
 };
 
-const int kestrel_stats[45][41]= {
+const int kestrelStats[45][41]= {
 
     {1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,0,0,0,0,0,0},
     {1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0},
@@ -208,7 +208,7 @@
     {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
 };
 
-const int imperion_stats[45][41]= {
+const int imperionStats[45][41]= {
     {1,0,1,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,0},
     {1,0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0},
     {1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0},
@@ -256,7 +256,7 @@
     {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
 
 };
-const int orion_stats[45][41] = {
+const int orionStats[45][41] = {
     {0,0,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
     {0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
     {1,0,0,1,0,1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -308,7 +308,7 @@
     _ycursor = ycursor;
 
 }
-void Menu::title(N5110 &lcd,int shipno)
+void Menu::title(N5110 &lcd,SHIP shipUsed)
 {
 
     // Print start
@@ -316,25 +316,21 @@
     lcd.printString("Ship ",2,3);
     lcd.printString("Menu",2,4);
 
-
-    if(shipno == 0) {
-        lcd.drawSprite(45,1,44,37,(int *)kestrel);
-    }
-    if(shipno == 1) {
-        lcd.drawSprite(55,6,39,17,(int *)imperion);
-    }
-    if(shipno == 2) {
-        lcd.drawSprite(54,1,45,26,(int *)orion);
+    switch (shipUsed) {
+        case kestrel:
+            lcd.drawSprite(45,1,44,37,(int *)kestrelSprite);
+            break;
+        case imperion:
+            lcd.drawSprite(55,6,39,17,(int *)imperionSprite);
+            break;
+        case orion:
+            lcd.drawSprite(54,1,45,26,(int *)orionSprite);
+            break;
     }
     
     // draw border and title sprite
     lcd.drawRect(0,0,84,48,FILL_TRANSPARENT);
     lcd.drawSprite(0,0,9,48,(int *)title_screen);
-    // SCROLLING
-    // as the printString function divides screen into 6 with each line needing eight pixels
-    // The problem with the code currently is that the title is defined outside the normal game loop as such,
-    // the values for _d which are updated in read_input in the RosenEngine function are never called
-
     lcd.drawRect(0,_ycursor-1,26,9,FILL_TRANSPARENT);
     
 }
@@ -379,16 +375,16 @@
 void Menu::disp_ships(N5110 &lcd)
 {
     if(_xcursor == 0) {
-        lcd.drawSprite(2,1,44,37,(int *)kestrel);
-        lcd.drawSprite(41,1,45,41,(int *)kestrel_stats);
+        lcd.drawSprite(2,1,44,37,(int *)kestrelSprite);
+        lcd.drawSprite(41,1,45,41,(int *)kestrelStats);
     }
     if(_xcursor == 1) {
-        lcd.drawSprite(12,6,39,17,(int *)imperion);
-        lcd.drawSprite(41,1,45,41,(int *)imperion_stats);
+        lcd.drawSprite(12,6,39,17,(int *)imperionSprite);
+        lcd.drawSprite(41,1,45,41,(int *)imperionStats);
     }
     if(_xcursor == 2) {
-        lcd.drawSprite(9,1,45,26,(int *)orion);
-        lcd.drawSprite(41,1,45,41,(int *)orion_stats);
+        lcd.drawSprite(9,1,45,26,(int *)orionSprite);
+        lcd.drawSprite(41,1,45,41,(int *)orionStats);
     }
 }
 /*void Menu::scroll(N5110 &lcd, Direction d)