blob: 95023e572d180b8502a2380c253505da4681f183 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "includes.h"
TitleState::TitleState()
{
background = SDL_LoadBMP("title.bmp");
pointer = SDL_LoadBMP("pointer.bmp");
selection = 0;
}
void TitleState::input(SDL_keysym key)
{
if ((key.sym == SDLK_UP) && (selection != 0))
{
selection--;
} else if ((key.sym == SDLK_DOWN) && (selection != 3))
{
selection++;
} else if (key.sym == SDLK_RETURN)
{
switch (selection)
{
case 0:
changeState(new GameState());
break;
case 1:
changeState(new HowToPlayState());
break;
case 2:
changeState(new ChooseHighscoreListState());
break;
case 3:
exit(0);
}
}
}
void TitleState::render(SDL_Surface* screen)
{
SDL_BlitSurface(background, NULL, screen, NULL);
SDL_Rect pSpace;
pSpace.x = 136;
pSpace.y = (selection==0?316:(selection==1?350:(selection==2?381:417)));
pSpace.w = pointer->w;
pSpace.h = pointer->h;
SDL_BlitSurface(pointer, NULL, screen, &pSpace);
}
|