summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/help.cpp
Side-by-side diff
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
@@ -1,132 +1,131 @@
#include "SDL.h"
#include "constants.h"
#include "font.h"
#include "help.h"
#include "sfcave.h"
#include "starfield.h"
Help :: Help( SFCave *p )
{
parent = p;
stars = new StarField( false, 200 );
loadText();
init();
}
Help :: ~Help()
{
delete stars;
}
void Help :: handleKeys( SDL_KeyboardEvent &key )
{
if ( key.type == SDL_KEYDOWN )
{
if ( key.keysym.sym == SDLK_SPACE )
parent->changeState( STATE_MENU );
else if ( key.keysym.sym == SDLK_DOWN )
textSpeed = 5;
else if ( key.keysym.sym == SDLK_UP )
{
if ( textSpeed > 0 )
textSpeed = 0;
else textSpeed = 1;
}
-
+
}
else if ( key.type == SDL_KEYUP )
{
if ( key.keysym.sym == SDLK_DOWN )
textSpeed = 1;
}
}
void Help :: init()
{
startPos = 320;
currLine = 0;
textSpeed = 1;
-
+
// Create our coloured font
FontHandler :: changeColor( FONT_HELP_FONT, 0, 0, 255 );
}
void Help :: draw( SDL_Surface *screen )
{
stars->draw( screen );
-
list<string>::iterator it = textList.begin();
// Move to start of text
for ( int i = 0 ; i < currLine && it != textList.end() ; ++i )
it++;
int pos = startPos;
while ( pos < 320 && it != textList.end() )
{
// get next line
string text = *it;
// draw text
FontHandler::draw( screen, FONT_COLOURED_TEXT, text.c_str(), -1, pos );
pos += FontHandler::FontHeight( FONT_COLOURED_TEXT );
it ++;
}
-
+
}
void Help :: update()
{
stars->move();
-
+
startPos -= textSpeed;
if ( startPos <= -FontHandler::FontHeight( FONT_COLOURED_TEXT ) )
{
startPos = 0;
currLine ++;
if ( currLine > textList.size() )
{
startPos = 320;
currLine = 0;
}
}
}
void Help :: loadText()
{
textList.push_back( "SFCave" );
textList.push_back( "Written By AndyQ" );
textList.push_back( "" );
textList.push_back( "Instructions" );
textList.push_back( "To return to the menu" );
textList.push_back( "press the space or " );
textList.push_back( "middle button." );
textList.push_back( "" );
textList.push_back( "To speed up the text" );
textList.push_back( "hold the down button" );
textList.push_back( "(releasing will return" );
textList.push_back( "to normal speed)" );
textList.push_back( "" );
textList.push_back( "" );
textList.push_back( "SFCave is a flying game" );
textList.push_back( "writtin originally for the" );
textList.push_back( "Sharp Zaurus." );
textList.push_back( "" );
textList.push_back( "The aim is to stay alive" );
textList.push_back( "for as long as possible," );
textList.push_back( "and get the highest score" );
textList.push_back( "you can." );
textList.push_back( "" );
textList.push_back( "There are currently three" );
textList.push_back( "game types - SFCave," );
textList.push_back( "Gates, and Fly." );
textList.push_back( "" );
textList.push_back( "SFCave is a remake of" );
textList.push_back( "the classic SFCave game." );
textList.push_back( "Fly through the cavern" );
textList.push_back( "avoiding all the blocks" );