Пример #1
0
StateMenu::StateMenu() : StateBase()
{
	fontDark = spFontLoad( FONT_GENERAL, MENU_FONT_SIZE );
	if ( fontDark )
	{
		spFontAdd( fontDark, SP_FONT_GROUP_ASCII, spGetFastRGB( 0, 0, 0 ) );
		spFontAdd( fontDark, SP_FONT_GROUP_GERMAN, spGetFastRGB( 0, 0, 0 ) );
	}
	fontBright = spFontLoad( FONT_GENERAL, MENU_FONT_SIZE );
	if ( fontBright )
		spFontAdd( fontBright, SP_FONT_GROUP_ASCII, spGetFastRGB( 255, 255, 255 ) );

	addMenuEntry( "start game", stLevel );
	addMenuEntry( "show scores", stHighscores );
	addMenuEntry( "load replay", stReplayLoader );
#ifdef _DEBUG
	addMenuEntry( "collision test", stCollision );
#endif
	addMenuEntry( "exit", -1 );
	timers.push_back( &inputLag );

	text = spCreateSurface( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT / 2 );
	textMode = 1;
	textIndex = -1;
	timers.push_back( &textTimer );
	lines.push_back( std::make_pair( "A game by", "Janek Schäfer" ) );
	lines.push_back( std::make_pair( "Press \""SP_BUTTON_B_NAME"\" or \""SP_BUTTON_START_NAME"\"", "to select an item" ) );
	lines.push_back( std::make_pair( "This is a WIP", "A lot left to do" ) );
	lines.push_back( std::make_pair( "Use the arrow keys", "to navigate" ) );
	lines.push_back( std::make_pair( "Hint: Bombs explode,", "Spikes and Lasers don't" ) );
	lines.push_back( std::make_pair( "Hint: Not entering a name,", "will not add a highscore or replay" ) );
	lines.push_back( std::make_pair( "Hint: Waves may exceed,", "the max unit limit" ) );

	type = stMenu;
}
Пример #2
0
// Stage control
void TitleStage::Begin()
{
	background = spLoadSurface( ".//resource//title.png" );
	mainFont = spFontLoad( ".//resource//standard.ttf", gameSettings->ScreenHeight / 12 );
	spFontAddRange( mainFont, " ", "~", SDL_MapRGB( display->format, 192, 220, 255 ) );
	
}
Пример #3
0
void DebugStage::Begin()
{
	carTexture = spLoadSurface( ".//resource//car.png" );
	roadTexture = spLoadSurface( ".//resource//road.png" );
	offroadTexture = spLoadSurface( ".//resource//off.png" );
	roadsideTexture = spLoadSurface( ".//resource//roadside.png" );
	carMesh = spMeshLoadObjSize( ".//resource/car.obj", carTexture, 65535, 12000 );
	fontHnd = spFontLoad( "./resource/standard.ttf", 32 );
	spFontAddRange( fontHnd, ' ', '~', SDL_MapRGB( display->format, 0, 0, 0 ) );

	fontHiHnd = spFontLoad( "./resource/standard.ttf", 64 );
	spFontAddRange( fontHiHnd, ' ', '~', SDL_MapRGB( display->format, 255, 220, 128 ) );
	fontHiSHnd = spFontLoad( "./resource/standard.ttf", 64 );
	spFontAddRange( fontHiSHnd, ' ', '~', SDL_MapRGB( display->format, 0, 0, 0 ) );

}
Пример #4
0
StateScore::StateScore( StateLevel *level ) :
	StateBase(),
	file( FOLDER_DATA "/" FILE_HIGHSCORE_NORMAL )
{
	SDL_Surface *temp = spCreateSurface( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT );
	killFrame = spCreateSurface( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT );
	spSelectRenderTarget( temp );
	level->render( temp );
	spUnlockRenderTarget();
	SDL_SetAlpha( temp, SDL_SRCALPHA, 128 );
	SDL_BlitSurface( temp, NULL, killFrame, NULL );
	spLockRenderTarget();
	spSelectRenderTarget( spGetWindowSurface() );
	spDeleteSurface( temp );
	if ( level->player->toBeRemoved )
		playerDead = true;
	else
		playerDead = false;

	score = level->scoreKeeper->getScore();
	scoreText = spFontLoad( FONT_GENERAL, SCORE_FONT_SIZE );
	if ( scoreText )
	{
		spFontAdd( scoreText, SP_FONT_GROUP_ALPHABET SP_FONT_GROUP_GERMAN ".:!\"_", -1 );
		spFontAdd( scoreText, SP_FONT_GROUP_NUMBERS, spGetRGB( 255, 128, 0 ) );
	}

	nameBkup[0] = 0;
	if ( level->run->playing )
	{
		state = 1;
		caret = false;
		strcpy( nameBkup, name );
		strcpy( name, level->run->info.name.c_str() );
		run = level->run;
		level->run = NULL;
	}
	else
	{
		caret = true;
		state = 0;
		spPollKeyboardInput( name, SCORE_MAX_NAME_LENGTH, NULL );
		run = level->run;
		level->run = NULL;
	}

	caretTimer.start( SCORE_CARET_BLINK_TIME );
	timers.push_back( &caretTimer );

	type = stScore;
}
Пример #5
0
StateHighscores::StateHighscores() :
	StateBase(),
	file( FOLDER_DATA "/" FILE_HIGHSCORE_NORMAL )
{
	fontW = spFontLoad( FONT_GENERAL, HIGHS_FONT_SIZE );
	fontB = spFontLoad( FONT_GENERAL, HIGHS_FONT_SIZE );
	fontHint = spFontLoad( FONT_GENERAL, HIGHS_FONT_SIZE_SMALL );
	if ( fontW )
		spFontAdd( fontW, SP_FONT_GROUP_ALPHABET SP_FONT_GROUP_GERMAN ".:!\"_" SP_FONT_GROUP_NUMBERS, -1 );
	if ( fontB )
		spFontAdd( fontB, SP_FONT_GROUP_ALPHABET SP_FONT_GROUP_GERMAN ".:!\"_" SP_FONT_GROUP_NUMBERS, 0 );
	if ( fontHint )
		spFontAdd( fontHint, SP_FONT_GROUP_ALPHABET SP_FONT_GROUP_GERMAN ".:!\"_" SP_FONT_GROUP_NUMBERS, 0 );

	drawOffset = 0;
	selOffset = 0;
	offsetIter = file.scores.begin();
	selectionIter = file.scores.begin();
	timers.push_back( &inputLag );
	timers.push_back( &inputLagSwitch );
	lagTime = HIGHS_MAX_INPUT_LAG;

	type = stHighscores;
}