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:
- 72:ade25d595dc9
- Parent:
- 71:8f66a957b79a
- Child:
- 73:1b03202c987a
--- a/main.cpp Fri May 08 09:02:06 2015 +0000 +++ b/main.cpp Fri May 08 12:42:59 2015 +0000 @@ -11,10 +11,9 @@ #include <ctime> #include <cstdlib> - ///writes to CFG file. void write() -{ +{ ///Sets a Key and Value. if (!cfg.setValue("Open1", player1initials)) {//key/value error("Failure to set a value.\n"); @@ -43,8 +42,8 @@ } ///Reads CFG file. -void read(){ - +void read() +{ //Checks if key matches. char *key1 = "Open1"; char *key2 = "Open2"; @@ -1058,7 +1057,7 @@ highScore3 = highScore2; n = score; highScore2 = n; - sprintf (player3initials, "3.%c%c%c.....%i",player2initials[2],player3initials[3],player3initials[4],highScore3); + sprintf (player3initials, "3.%c%c%c.....%i",player2initials[2],player2initials[3],player2initials[4],highScore3); sprintf (player2initials, "2.%c%c%c.....%i",x,y,z,highScore2); } //if player beats High Score 1, 2 and 3, replace highScore1 with new score @@ -1067,7 +1066,7 @@ highScore2 = highScore1; n = score; highScore1 = n; - sprintf (player3initials, "3.%c%c%c.....%i",player2initials[2],player3initials[3],player3initials[4],highScore3); + sprintf (player3initials, "3.%c%c%c.....%i",player2initials[2],player2initials[3],player2initials[4],highScore3); sprintf (player2initials, "2.%c%c%c.....%i",player1initials[2],player1initials[3],player1initials[4],highScore2); sprintf (player1initials, "1.%c%c%c.....%i",x,y,z,highScore1); }