summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/help.cpp
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/help.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/help.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/games/sfcave-sdl/help.cpp b/noncore/games/sfcave-sdl/help.cpp
index 91c62da..f1728f6 100644
--- a/noncore/games/sfcave-sdl/help.cpp
+++ b/noncore/games/sfcave-sdl/help.cpp
@@ -32,35 +32,34 @@ void Help :: handleKeys( SDL_KeyboardEvent &key )
32 else if ( key.keysym.sym == SDLK_UP ) 32 else if ( key.keysym.sym == SDLK_UP )
33 { 33 {
34 if ( textSpeed > 0 ) 34 if ( textSpeed > 0 )
35 textSpeed = 0; 35 textSpeed = 0;
36 else textSpeed = 1; 36 else textSpeed = 1;
37 } 37 }
38 38
39 } 39 }
40 else if ( key.type == SDL_KEYUP ) 40 else if ( key.type == SDL_KEYUP )
41 { 41 {
42 if ( key.keysym.sym == SDLK_DOWN ) 42 if ( key.keysym.sym == SDLK_DOWN )
43 textSpeed = 1; 43 textSpeed = 1;
44 } 44 }
45} 45}
46void Help :: init() 46void Help :: init()
47{ 47{
48 startPos = 320; 48 startPos = 320;
49 currLine = 0; 49 currLine = 0;
50 textSpeed = 1; 50 textSpeed = 1;
51 51
52 // Create our coloured font 52 // Create our coloured font
53 FontHandler :: changeColor( FONT_HELP_FONT, 0, 0, 255 ); 53 FontHandler :: changeColor( FONT_HELP_FONT, 0, 0, 255 );
54} 54}
55 55
56void Help :: draw( SDL_Surface *screen ) 56void Help :: draw( SDL_Surface *screen )
57{ 57{
58 stars->draw( screen ); 58 stars->draw( screen );
59 59
60
61 list<string>::iterator it = textList.begin(); 60 list<string>::iterator it = textList.begin();
62 61
63 // Move to start of text 62 // Move to start of text
64 for ( int i = 0 ; i < currLine && it != textList.end() ; ++i ) 63 for ( int i = 0 ; i < currLine && it != textList.end() ; ++i )
65 it++; 64 it++;
66 65
@@ -72,19 +71,19 @@ void Help :: draw( SDL_Surface *screen )
72 71
73 // draw text 72 // draw text
74 FontHandler::draw( screen, FONT_COLOURED_TEXT, text.c_str(), -1, pos ); 73 FontHandler::draw( screen, FONT_COLOURED_TEXT, text.c_str(), -1, pos );
75 pos += FontHandler::FontHeight( FONT_COLOURED_TEXT ); 74 pos += FontHandler::FontHeight( FONT_COLOURED_TEXT );
76 it ++; 75 it ++;
77 } 76 }
78 77
79} 78}
80 79
81void Help :: update() 80void Help :: update()
82{ 81{
83 stars->move(); 82 stars->move();
84 83
85 startPos -= textSpeed; 84 startPos -= textSpeed;
86 if ( startPos <= -FontHandler::FontHeight( FONT_COLOURED_TEXT ) ) 85 if ( startPos <= -FontHandler::FontHeight( FONT_COLOURED_TEXT ) )
87 { 86 {
88 startPos = 0; 87 startPos = 0;
89 currLine ++; 88 currLine ++;
90 89