"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/main.cpp	Sat Feb 21 06:19:29 2015 +0000
+++ b/main.cpp	Sun Mar 01 05:32:06 2015 +0000
@@ -1,25 +1,42 @@
+/*
+ * (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 "Retro.h"
 #include "GameScreen.h"
 #include "Levels.h"
 #include "Sprites.h"
+#include "Utils.h"
 
 #include "IntroScreen.h"
-#include "HelpScreen.h"
 #include "MenuScreen.h"
 #include "LevelScreen.h"
 
 
 IntroScreen * pIntroScreen = NULL;
-HelpScreen * pHelpScreen = NULL;
 MenuScreen * pMenuScreen = NULL;
 GameScreen * pGameScreen = NULL;
 LevelScreen * pLevelScreen = NULL;
 
 Retro retro;
 
-bool gameover = false;
-
 uint8_t * pRickFont = NULL;
 
 void unpackFont()
@@ -44,7 +61,7 @@
     }
 }
 
-void drawChar(int x, int y, char c)
+void drawChar(int x, int y, char c, const uint16_t *palette)
 {
     if( pRickFont == NULL )
         return;
@@ -52,7 +69,7 @@
     int index = c-44;
     retro.display.drawBitmapIndexed(x,y,376,8,index*8,0,8,8,pRickFont, palette);
 }
-void drawString(int x, int y, const char *pString)
+void drawString(int x, int y, const char *pString, const uint16_t *palette)
 {
     int i = 0;
     char *p = (char*)pString;
@@ -71,29 +88,20 @@
             continue;
         }
                 
-        drawChar(x + i*8, y, *p++);
+        drawChar(x + i*8, y, *p++, palette);
         i++;
     }
 }
 
 main()
 {
+    
     unpackFont();
     
-    //retro.leftEye = true;
-    
-    //Seed the randomizer
-    AnalogIn ain(P0_15);
-    srand(ain.read_u16());
-
     retro.initialize();
-
-    //retro.display.setPalette(palette);
-
-    int curLevel = 44;
-
+        
     pGameScreen = new GameScreen();
-    pGameScreen->unpackLevel(curLevel);
+    pGameScreen->resetLevel();
 
     Screen currentScreen = Intro;