From c027f1b9cd6c9deb60931a7f9f75bb4ee130291b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 18 Oct 2009 15:24:07 -0400 Subject: Added local highscore list You can now view and add to a local highscore list. A change to State was necessary due to how the user's name would be entered into the highscore list and thus all states have been modified. Refs #104 --- hslist.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 hslist.cpp (limited to 'hslist.cpp') diff --git a/hslist.cpp b/hslist.cpp new file mode 100644 index 0000000..d2901b4 --- /dev/null +++ b/hslist.cpp @@ -0,0 +1,85 @@ +#include "includes.h" + +SDL_Surface* HighscoreList::render() +{ + SDL_Surface* tmp = SDL_CreateRGBSurface(SDL_SWSURFACE || SDL_SRCCOLORKEY, 480, 480, 32, 0,0,0,0); + Uint32 bgColor = SDL_MapRGB(tmp->format, 255, 255, 255); + SDL_FillRect(tmp, NULL, bgColor); + SDL_SetColorKey(tmp, SDL_SRCCOLORKEY, bgColor); + TTF_Font* posFont = loadFont(40); + TTF_Font* dataFont = loadFont(25); + SDL_Color fontColor = {0, 0, 0, 0}; + + for (int i=0; i HighscoreList::getLocalHighscores() +{ + std::vector temp = std::vector(); + + std::ifstream exists(getDataFile()); + if (exists) + { + FILE* hslist = fopen(getDataFile(), "r"); + int scores; + fscanf(hslist, "%d%*c", &scores); + + for (int i=0; i HighscoreList::getGlobalHighscores() +{ + +} + +LocalHighscoreList::LocalHighscoreList() +{ + this->hslist = getLocalHighscores(); +} -- cgit 1.4.1