diff options
Diffstat (limited to 'chlstate.cpp')
-rw-r--r-- | chlstate.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chlstate.cpp b/chlstate.cpp new file mode 100644 index 0000000..24dd674 --- /dev/null +++ b/chlstate.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | #include "includes.h" | ||
2 | |||
3 | ChooseHighscoreListState::ChooseHighscoreListState() | ||
4 | { | ||
5 | LOADIMAGE(background,chl) | ||
6 | LOADIMAGE(pointer,pointer) | ||
7 | |||
8 | selection = 0; | ||
9 | |||
10 | SDL_WM_SetCaption("Maze Of Life - Choose Highscore List", NULL); | ||
11 | } | ||
12 | |||
13 | void ChooseHighscoreListState::input(SDLKey key) | ||
14 | { | ||
15 | if ((key == SDLK_UP) && (selection != 0)) | ||
16 | { | ||
17 | selection--; | ||
18 | } else if ((key == SDLK_DOWN) && (selection != 2)) | ||
19 | { | ||
20 | selection++; | ||
21 | } else if (key == SDLK_RETURN) | ||
22 | { | ||
23 | switch (selection) | ||
24 | { | ||
25 | case 0: // Go to local highscore list | ||
26 | break; | ||
27 | case 1: // Go to global highscore list | ||
28 | break; | ||
29 | case 2: | ||
30 | changeState(new TitleState()); | ||
31 | |||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | |||
37 | void ChooseHighscoreListState::render(SDL_Surface* screen) | ||
38 | { | ||
39 | SDL_BlitSurface(background, NULL, screen, NULL); | ||
40 | |||
41 | SDL_Rect pSpace; | ||
42 | pSpace.x = 127; | ||
43 | pSpace.y = (selection==0?306:(selection==1?336:396)); | ||
44 | pSpace.w = pointer->w; | ||
45 | pSpace.h = pointer->h; | ||
46 | |||
47 | SDL_BlitSurface(pointer, NULL, screen, &pSpace); | ||
48 | } | ||