A retro gaming programme, designed for use on a portable embedded system. Incorporates power saving techniques.
Dependencies: ConfigFile N5110 PowerControl beep mbed
Diff: main.cpp
- Revision:
- 71:8f66a957b79a
- Parent:
- 70:8f76ea42f084
- Child:
- 72:ade25d595dc9
--- a/main.cpp Fri May 08 07:48:40 2015 +0000 +++ b/main.cpp Fri May 08 09:02:06 2015 +0000 @@ -19,14 +19,22 @@ if (!cfg.setValue("Open1", player1initials)) {//key/value error("Failure to set a value.\n"); } - ///Sets a Key and Value. + ///Sets a Key and Value. if (!cfg.setValue("Open2", player2initials)) {//key/value error("Failure to set a value.\n"); } - ///Sets a Key and Value. + ///Sets a Key and Value. if (!cfg.setValue("Open3", player3initials)) {//key/value error("Failure to set a value.\n"); } +// ///Sets a Key and Value. +// if (!cfg.setValue("Open4", diff)) {//key/value +// error("Failure to set a value.\n"); +// } +// ///Sets a Key and Value. +// if (!cfg.setValue("Open5", fx)) {//key/value +// error("Failure to set a value.\n"); +// } ///If a file does not already exist, create one. ///If one already exits, append the file. if (!cfg.write("/local/towerMemory.cfg")) {//Write key and value to CFG file @@ -41,6 +49,8 @@ char *key1 = "Open1"; char *key2 = "Open2"; char *key3 = "Open3"; + char *key4 = "Open4"; + char *key5 = "Open5"; ///Checks Key and Value - if read is unsuccessful it an prints error message. if (!cfg.read("/local/towerMemory.cfg")) { @@ -58,6 +68,14 @@ if (cfg.getValue(key3, &player3initials[0], sizeof(player3initials))) { serial.printf("%s\n",player3initials); } +// //check file size - if size acceptable, prints buffer to location. +// if (cfg.getValue(key4, &diff[0], sizeof(diff))) { +// serial.printf("%s\n",diff); +// } +// //check file size - if size acceptable, prints buffer to location. +// if (cfg.getValue(key5, &fx[0], sizeof(fx))) { +// serial.printf("%s\n",fx); +// } } ///Struct declaration for storing alphabet arrays. @@ -905,7 +923,6 @@ refreshCursor3(); if(buttonFlagA) { - //rightness(1.0); buttonFlagA =0; FX = 0; serial.printf("FX = %d\n",FX); @@ -917,8 +934,7 @@ refreshCursor1(); refreshCursor2(); - if(buttonFlagA) { - //rightness(1.0); + if(buttonFlagA) { buttonFlagA =0; FX = 1; serial.printf("FX = %d\n",FX); @@ -944,7 +960,6 @@ void newScore() { if(score >= highScore3) {//entry condition - //rightness(1.0); buttonFlagA = 0;//reset flags buttonFlagB = 0; lcd.clear();//clears screen @@ -1254,7 +1269,6 @@ //================sound FX menu========================== if((option ==1)&&(buttonFlagA)) { - //rightness(1.0); buttonFlagA = 0;//reset flags buttonFlagB = 0; actionButtons(); @@ -1265,8 +1279,7 @@ soundFXMenu(fxOption);//presents options //back to options menu - if(buttonFlagB) { - //rightness(1.0); + if(buttonFlagB) { buttonFlagB = 0;//reset flags buttonFlagA = 0; lcd.clear();//clear screen @@ -1278,7 +1291,6 @@ } //back to mainmenu if(buttonFlagB) { - //rightness(1.0); buttonFlagB = 0;//reset flags buttonFlagA = 0; lcd.clear();//clear