"Lost treasure of mBedungu" 100 level puzzle game for RETRO

Dependencies:   LCD_ST7735 RetroPlatform mbed

Into Level 0 Menu Level 99

Revision:
1:dcea5500a32d
Parent:
0:f5f961973d01
--- a/Game/MenuScreen.cpp	Sat Feb 21 06:19:29 2015 +0000
+++ b/Game/MenuScreen.cpp	Sun Mar 01 05:32:06 2015 +0000
@@ -1,24 +1,45 @@
+/*
+ * (C) Copyright 2015 Valentin Ivanov. All rights reserved.
+ *
+ * This file is part of the "Lost treasure of mBedungu" game application for Retro
+ *
+ * The "Lost treasure of mBedungu" application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+ 
 #include "mbed.h"
 #include "MenuScreen.h"
 #include "GameScreen.h"
+#include "LevelScreen.h"
 #include "Retro.h"
-//#include "font_OEM.h"
 #include "Sprites.h"
 
 char options[][13] = {
+    "BACK@@@@@@@@",
     "INTRO@@@@@@@",
     "RESET@@LEVEL",
     "SELECT@LEVEL",
-    "BACK@@@@@@@@"
 };
 
 extern Retro retro;
 extern GameScreen * pGameScreen;
+extern LevelScreen * pLevelScreen;
 
 MenuScreen::MenuScreen()
 {
     _oldSelection = 0;
-    _selection = 3;
+    _selection = 0;
     _state = 0;
 }
 
@@ -30,7 +51,7 @@
         retro.display.clearScreen();
 
         for( int i = 0; i<4; i++) {
-            drawString(8+16, y, options[i]);
+            drawString(8+16, y, options[i], palette);
             y+=16;
         }
         _state = 1;
@@ -43,7 +64,7 @@
         _state = 2;
     }
 
-    if(retro.buttons.pressed(BTN_UP)) {
+    if(retro.pressed(BTN_UP)) {
         _oldSelection = _selection;
         if(_selection == 0)
             _selection = 3;
@@ -51,7 +72,7 @@
             _selection--;
         _state = 1;
     }
-    if(retro.buttons.pressed(BTN_DOWN)) {
+    if(retro.pressed(BTN_DOWN)) {
         _oldSelection = _selection;
         if(_selection == 3)
             _selection = 0;
@@ -59,21 +80,27 @@
             _selection++;
         _state = 1;
     }
-    if(retro.buttons.pressed(BTN_SHIP)) {
+    if(retro.pressed(BTN_SHIP)) {
         
         _state = 0;
         if( _selection == 0 )
+            return Game;
+        if( _selection == 1 )
             return Intro;
-        if( _selection == 1 )
+        if( _selection == 2 )
         {
             if( pGameScreen )
                 pGameScreen->resetLevel();
             return Game;            
         }
         if( _selection == 3 )
-            return Game;
-        if( _selection == 2 )
+        {
+            if( pLevelScreen == NULL )
+                pLevelScreen = new LevelScreen();
+            pLevelScreen->GameLevel = pGameScreen->getLevel();
+                        
             return Level;
+        }
     }
     return Menu;
 }
\ No newline at end of file