From 49900856bece81481a56888b7bbce45bf746c422 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 22 Jun 2009 10:02:20 -0400 Subject: Added Choose Highscore List state Refs #104 --- chlstate.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 chlstate.cpp (limited to 'chlstate.cpp') diff --git a/chlstate.cpp b/chlstate.cpp new file mode 100644 index 0000000..24dd674 --- /dev/null +++ b/chlstate.cpp @@ -0,0 +1,48 @@ +#include "includes.h" + +ChooseHighscoreListState::ChooseHighscoreListState() +{ + LOADIMAGE(background,chl) + LOADIMAGE(pointer,pointer) + + selection = 0; + + SDL_WM_SetCaption("Maze Of Life - Choose Highscore List", NULL); +} + +void ChooseHighscoreListState::input(SDLKey key) +{ + if ((key == SDLK_UP) && (selection != 0)) + { + selection--; + } else if ((key == SDLK_DOWN) && (selection != 2)) + { + selection++; + } else if (key == SDLK_RETURN) + { + switch (selection) + { + case 0: // Go to local highscore list + break; + case 1: // Go to global highscore list + break; + case 2: + changeState(new TitleState()); + + break; + } + } +} + +void ChooseHighscoreListState::render(SDL_Surface* screen) +{ + SDL_BlitSurface(background, NULL, screen, NULL); + + SDL_Rect pSpace; + pSpace.x = 127; + pSpace.y = (selection==0?306:(selection==1?336:396)); + pSpace.w = pointer->w; + pSpace.h = pointer->h; + + SDL_BlitSurface(pointer, NULL, screen, &pSpace); +} -- cgit 1.4.1