summary refs log tree commit diff stats
path: root/titlestate.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2009-06-19 20:46:53 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2009-06-19 20:46:53 -0400
commitab18806cddf99514e7ac8d970587e5f1d6d01603 (patch)
tree51811ba47de36c8911043258f073484e3948c807 /titlestate.cpp
parentf2caf2c09fc431e11068c13a49ae28f18182bea9 (diff)
downloadmazeoflife-ab18806cddf99514e7ac8d970587e5f1d6d01603.tar.gz
mazeoflife-ab18806cddf99514e7ac8d970587e5f1d6d01603.tar.bz2
mazeoflife-ab18806cddf99514e7ac8d970587e5f1d6d01603.zip
Added title screen
Refs #103
Diffstat (limited to 'titlestate.cpp')
-rw-r--r--titlestate.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/titlestate.cpp b/titlestate.cpp new file mode 100644 index 0000000..ee6a2b5 --- /dev/null +++ b/titlestate.cpp
@@ -0,0 +1,47 @@
1#include "includes.h"
2
3TitleState::TitleState()
4{
5 background = SDL_LoadBMP("title.bmp");
6 pointer = SDL_LoadBMP("pointer.bmp");
7 selection = 0;
8}
9
10void TitleState::input(SDLKey key)
11{
12 if ((key == SDLK_UP) && (selection != 0))
13 {
14 selection--;
15 } else if ((key == SDLK_DOWN) && (selection != 3))
16 {
17 selection++;
18 } else if (key == SDLK_RETURN)
19 {
20 switch (selection)
21 {
22 case 0:
23 changeState(new GameState());
24
25 break;
26 case 1: // Add How To Play
27 break;
28 case 2: // Add choose highscore list
29 break;
30 case 3:
31 exit(0);
32 }
33 }
34}
35
36void TitleState::render(SDL_Surface* screen)
37{
38 SDL_BlitSurface(background, NULL, screen, NULL);
39
40 SDL_Rect pSpace;
41 pSpace.x = 136;
42 pSpace.y = (selection==0?316:(selection==1?350:(selection==2?381:417)));
43 pSpace.w = screen->w;
44 pSpace.h = screen->h;
45
46 SDL_BlitSurface(pointer, NULL, screen, &pSpace);
47}