A complex 2D-dungeon game on LPC1768 in SWJTU-Leeds Joint School XJEL2645 project. Referenced from the framework contributed by https://os.mbed.com/users/Siriagus/code/SimplePlatformGame/

Dependencies:   mbed N5110 ShiftReg PinDetect

Global.cpp

Committer:
Siriagus
Date:
2015-05-11
Revision:
17:d6a3b29cab31
Child:
19:89c3eeb3761b

File content as of revision 17:d6a3b29cab31:

#include "Global.h"

/// @file Global.cpp

namespace Global
{
    int score = 0;
    Highscore highscores[3] = {{"AAA", 0}, {"AAA", 0}, {"AAA", 0}};
    
    void clearHighscoreList()
    {
        // Clear high score list
        for (int i = 0; i < 3; ++i)
        {
            highscores[i].initials = "---";
            highscores[i].score = 0;
        }
        
        // Overwrite file
        FILE *fp = fopen("/local/highscores.txt", "w");
        
        for (int i = 0; i < 3; ++i)
            fprintf(fp, "%s %d ", Global::highscores[i].initials, Global::highscores[i].score);
            
        fclose(fp);
    }
}