summary refs log tree commit diff stats
path: root/htpstate.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2009-06-19 21:22:34 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2009-06-19 21:22:34 -0400
commit1941186fa99ce9a9e333d9ab0deb928937e1ea61 (patch)
tree683188717e4acbb4623460cc28f61d08edb9a3a6 /htpstate.cpp
parentdf28032e41530c0230b1c72c3684e1bd49c7019e (diff)
downloadmazeoflife-1941186fa99ce9a9e333d9ab0deb928937e1ea61.tar.gz
mazeoflife-1941186fa99ce9a9e333d9ab0deb928937e1ea61.tar.bz2
mazeoflife-1941186fa99ce9a9e333d9ab0deb928937e1ea61.zip
Added How To Play
Closes #103
Diffstat (limited to 'htpstate.cpp')
-rw-r--r--htpstate.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/htpstate.cpp b/htpstate.cpp new file mode 100644 index 0000000..273392e --- /dev/null +++ b/htpstate.cpp
@@ -0,0 +1,56 @@
1#include "includes.h"
2
3HowToPlayState::HowToPlayState()
4{
5 background1 = SDL_LoadBMP("htp1.bmp");
6 background2 = SDL_LoadBMP("htp2.bmp");
7 pointer = SDL_LoadBMP("pointer.bmp");
8 secondPage = false;
9 selection = 0;
10}
11
12void HowToPlayState::input(SDLKey key)
13{
14 if ((key == SDLK_LEFT) && (selection != 0))
15 {
16 selection--;
17 } else if ((key == SDLK_RIGHT) && (selection != 1))
18 {
19 selection++;
20 } else if (key == SDLK_RETURN)
21 {
22 switch (selection)
23 {
24 case 0:
25 secondPage = !secondPage;
26
27 break;
28 case 1:
29 changeState(new TitleState());
30
31 break;
32 }
33 }
34}
35
36void HowToPlayState::render(SDL_Surface* screen)
37{
38 SDL_Rect pSpace;
39
40 if (!secondPage)
41 {
42 SDL_BlitSurface(background1, NULL, screen, NULL);
43
44 pSpace.x = (selection==0?74:216);
45 } else {
46 SDL_BlitSurface(background2, NULL, screen, NULL);
47
48 pSpace.x = (selection==0?45:238);
49 }
50
51 pSpace.y = 430;
52 pSpace.w = screen->w;
53 pSpace.h = screen->h;
54
55 SDL_BlitSurface(pointer, NULL, screen, &pSpace);
56}