Andreas Garmannslund / Mbed 2 deprecated SimplePlatformGame

Dependencies:   N5110 PinDetect PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Global.cpp Source File

Global.cpp

Go to the documentation of this file.
00001 #include "Global.h"
00002 
00003 /// @file Global.cpp
00004 
00005 namespace Global
00006 {
00007     int score = 0;
00008     Highscore highscores[3] = {{"AAA", 0}, {"AAA", 0}, {"AAA", 0}};
00009     
00010     void clearHighscoreList()
00011     {
00012         // Clear high score list
00013         for (int i = 0; i < 3; ++i)
00014         {
00015             highscores[i].initials = "---";
00016             highscores[i].score = 0;
00017         }
00018         
00019         // Overwrite file
00020         FILE *fp = fopen("/local/highscores.txt", "w");
00021         
00022         for (int i = 0; i < 3; ++i)
00023             fprintf(fp, "%s %d ", Global::highscores[i].initials, Global::highscores[i].score);
00024             
00025         fclose(fp);
00026     }
00027 }