summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--chl.bmpbin0 -> 921654 bytes
-rw-r--r--chlstate.cpp48
-rw-r--r--chlstate.h16
-rw-r--r--htpstate.cpp4
-rw-r--r--includes.h1
-rw-r--r--resources.h1
-rw-r--r--titlestate.cpp8
7 files changed, 73 insertions, 5 deletions
diff --git a/chl.bmp b/chl.bmp new file mode 100644 index 0000000..b69efd0 --- /dev/null +++ b/chl.bmp
Binary files differ
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
3ChooseHighscoreListState::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
13void 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
37void 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}
diff --git a/chlstate.h b/chlstate.h new file mode 100644 index 0000000..a8905e2 --- /dev/null +++ b/chlstate.h
@@ -0,0 +1,16 @@
1#ifndef CHLSTATE_H
2#define CHLSTATE_H
3
4class ChooseHighscoreListState : public State {
5 public:
6 ChooseHighscoreListState();
7 void input(SDLKey key);
8 void render(SDL_Surface* screen);
9
10 private:
11 SDL_Surface* background;
12 SDL_Surface* pointer;
13 int selection;
14};
15
16#endif
diff --git a/htpstate.cpp b/htpstate.cpp index 8de884f..711dca4 100644 --- a/htpstate.cpp +++ b/htpstate.cpp
@@ -52,8 +52,8 @@ void HowToPlayState::render(SDL_Surface* screen)
52 } 52 }
53 53
54 pSpace.y = 430; 54 pSpace.y = 430;
55 pSpace.w = screen->w; 55 pSpace.w = pointer->w;
56 pSpace.h = screen->h; 56 pSpace.h = pointer->h;
57 57
58 SDL_BlitSurface(pointer, NULL, screen, &pSpace); 58 SDL_BlitSurface(pointer, NULL, screen, &pSpace);
59} 59}
diff --git a/includes.h b/includes.h index 5b0895d..a36c456 100644 --- a/includes.h +++ b/includes.h
@@ -7,4 +7,5 @@
7#include "resources.h" 7#include "resources.h"
8#include "titlestate.h" 8#include "titlestate.h"
9#include "htpstate.h" 9#include "htpstate.h"
10#include "chlstate.h"
10#include "gamestate.h" 11#include "gamestate.h"
diff --git a/resources.h b/resources.h index 457fbec..ced40b0 100644 --- a/resources.h +++ b/resources.h
@@ -13,5 +13,6 @@ DEFIMAGE(title)
13DEFIMAGE(pointer) 13DEFIMAGE(pointer)
14DEFIMAGE(htp1) 14DEFIMAGE(htp1)
15DEFIMAGE(htp2) 15DEFIMAGE(htp2)
16DEFIMAGE(chl)
16 17
17#endif 18#endif
diff --git a/titlestate.cpp b/titlestate.cpp index 6c4401d..980e3b6 100644 --- a/titlestate.cpp +++ b/titlestate.cpp
@@ -30,7 +30,9 @@ void TitleState::input(SDLKey key)
30 changeState(new HowToPlayState()); 30 changeState(new HowToPlayState());
31 31
32 break; 32 break;
33 case 2: // Add choose highscore list 33 case 2:
34 changeState(new ChooseHighscoreListState());
35
34 break; 36 break;
35 case 3: 37 case 3:
36 exit(0); 38 exit(0);
@@ -45,8 +47,8 @@ void TitleState::render(SDL_Surface* screen)
45 SDL_Rect pSpace; 47 SDL_Rect pSpace;
46 pSpace.x = 136; 48 pSpace.x = 136;
47 pSpace.y = (selection==0?316:(selection==1?350:(selection==2?381:417))); 49 pSpace.y = (selection==0?316:(selection==1?350:(selection==2?381:417)));
48 pSpace.w = screen->w; 50 pSpace.w = pointer->w;
49 pSpace.h = screen->h; 51 pSpace.h = pointer->h;
50 52
51 SDL_BlitSurface(pointer, NULL, screen, &pSpace); 53 SDL_BlitSurface(pointer, NULL, screen, &pSpace);
52} 54}