Exemplo n.º 1
0
void StateMenu::render(SDL_Surface* target)
{
	spClearTarget( spGetRGB(128,0,0) );

	if ( textMode == -1 )
	{
		SDL_SetAlpha( text, SDL_SRCALPHA, (1.0f - (float)textTimer.getTime() / (float)textTimer.getDuration()) * 255.0f );
		if ( textTimer.isStopped() )
		{
			textTimer.start( MENU_TEXT_SHOW_TIME );
			textMode = 0;
			SDL_SetAlpha( text, SDL_SRCALPHA, SDL_ALPHA_OPAQUE );
		}
	}
	else if ( textMode == 0 )
	{
		if ( textTimer.isStopped() )
		{
			textTimer.start( MENU_TEXT_FADE_TIME );
			textMode = 1;
		}
	}
	else if ( textMode == 1 )
	{
		SDL_SetAlpha( text, SDL_SRCALPHA, (float)textTimer.getTime() / (float)textTimer.getDuration() * 255.0f );
		if ( textTimer.isStopped() )
		{
			++textIndex;
			if ( textIndex >= lines.size() )
				textIndex = 0;
			textTimer.start( MENU_TEXT_FADE_TIME );
			textMode = -1;
			SDL_FillRect( text, NULL, spGetRGB( 255, 0, 255 ) );
			SDL_SetColorKey( text, SDL_SRCCOLORKEY, spGetRGB( 255, 0, 255 ) );
			spSelectRenderTarget( text );
			spFontDraw( 20, 10, -1, (unsigned char*) lines[textIndex].first.c_str(), fontDark );
			spFontDraw( 20, 10 + MENU_FONT_SIZE, -1, (unsigned char*) lines[textIndex].second.c_str(), fontDark );
			spSelectRenderTarget( spGetWindowSurface() );
			SDL_SetAlpha( text, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT );
		}
	}
	SDL_Rect rect = { 0,0,APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT / 2 };
	spUnlockRenderTarget();
	SDL_BlitSurface( text, NULL, spGetWindowSurface(), &rect );
	spLockRenderTarget();

	for ( int I = entries.size()-1; I >= 0; --I )
	{
		if ( choice == I )
		{
			spFontDrawRight( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT - MENU_FONT_SIZE * (I+1), -1,
							 (unsigned char*) entries[I].name.c_str(), fontBright );
		}
		else
		{
			spFontDrawRight( APP_SCREEN_WIDTH, APP_SCREEN_HEIGHT - MENU_FONT_SIZE * (I+1), -1,
							 (unsigned char*) entries[I].name.c_str(), fontDark );
		}
	}
}
Exemplo n.º 2
0
void TransitionStrips::PrepareStrips( Uint16 FadeFrames, Uint16 NumberOfStrips )
{
	numStrips = NumberOfStrips;
	frameMax = FadeFrames;
	stripWidth = Framework::System->GetDisplayWidth() / NumberOfStrips;
	if( stripWidth * NumberOfStrips < Framework::System->GetDisplayWidth() )	// Correct any rounding issues
	{
		stripWidth++;
	}
	frameIndex = 0;
	slowestSpeed = Framework::System->GetDisplayHeight() / FadeFrames;
	SourceScreen = spUniqueCopySurface( spGetWindowSurface() );
	spSelectRenderTarget( SourceScreen );
	Source->Render();
	TargetScreen = spUniqueCopySurface( spGetWindowSurface() );
	spSelectRenderTarget( TargetScreen );
	Target->Render();
	spSelectRenderTarget( spGetWindowSurface() );

	speedList = (int*)malloc( sizeof(int) * NumberOfStrips );
	for( int i = 0; i < NumberOfStrips; i++ )
	{
		speedList[i] = slowestSpeed + (rand() % slowestSpeed);
		if( speedList[i] == 0 )
		{
			speedList[i] = 1;
		}
	}
}
Exemplo n.º 3
0
void ShaderBlur::Apply( SDL_Surface* Target )
{
	// Keep render target (might not be applying shader to screen)
	SDL_Surface* r = spGetRenderTarget();

	SDL_Surface* t = spUniqueCopySurface( Target );
	
	spSetHorizontalOrigin( SP_LEFT );
	spSetVerticalOrigin( SP_TOP );

	spSelectRenderTarget( t );
	spSetBlending( SP_ONE );
	spBlitSurface( 0, 0, -1, Target );
	spSetBlending( SP_ONE >> 2 );
	for( int y = -1; y <= 1; y++ )
	{
		for( int x = -1; x <= 1; x++ )
		{
			if( x != 0 && y != 0 )
			{
				spBlitSurface( x, y, -1, Target );
			}
		}
	}

	spSelectRenderTarget( Target );
	spSetBlending( SP_ONE );
	spBlitSurface( 0, 0, -1, t );

	spDeleteSurface( t );

	// Restore render target
	spSelectRenderTarget( r );
}
Exemplo n.º 4
0
void UnitLaser::generateIdleImage()
{
	idle = spCreateSurface( LASER_RADIUS * 2, LASER_RADIUS * 2 );
	SDL_FillRect( idle, NULL, SP_ALPHA_COLOR );
	spSelectRenderTarget( idle );
	spEllipse( LASER_RADIUS, LASER_RADIUS, -1, LASER_RADIUS, LASER_RADIUS, 0 );
	spSelectRenderTarget( spGetWindowSurface() );
}
Exemplo n.º 5
0
void UnitBomb::generateFlashingImage()
{
    flashing = spCreateSurface( BOMB_RADIUS * 2, BOMB_RADIUS * 2 );
    SDL_FillRect( flashing, NULL, SP_ALPHA_COLOR );
    spSelectRenderTarget( flashing );
    spEllipse( BOMB_RADIUS ,BOMB_RADIUS, -1, BOMB_RADIUS, BOMB_RADIUS, spGetFastRGB( 255, 255, 255 ) );
    spSelectRenderTarget( spGetWindowSurface() );
}
Exemplo n.º 6
0
void TransitionFade::PrepareFade( Uint16 FadeFrames )
{
	Alpha = 0;
	FadePerUpdate = SP_ONE / FadeFrames;
	SourceScreen = spUniqueCopySurface( spGetWindowSurface() );
	spSelectRenderTarget( SourceScreen );
	Source->Render();
	TargetScreen = spUniqueCopySurface( spGetWindowSurface() );
	spSelectRenderTarget( TargetScreen );
	Target->Render();
	spSelectRenderTarget( spGetWindowSurface() );
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
0
void ItemSlowmo::generateIdleImage()
{
	idle = spCreateSurface( ITEM_SLOWMO_RADIUS * 2, ITEM_SLOWMO_RADIUS * 2 );
	SDL_FillRect( idle, NULL, SP_ALPHA_COLOR );
	spSelectRenderTarget( idle );
	Uint16 col = spGetRGB( 0, 192, 0 );
	spEllipse( ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS, -1, ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS, -1);
	spEllipse( ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS, -1, ITEM_SLOWMO_RADIUS * 0.9, ITEM_SLOWMO_RADIUS * 0.9, col );
	spEllipse( ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS, -1, ITEM_SLOWMO_RADIUS * 0.65, ITEM_SLOWMO_RADIUS * 0.65, -1);
	spEllipse( ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS, -1, ITEM_SLOWMO_RADIUS * 0.55, ITEM_SLOWMO_RADIUS * 0.55, col );
	spRectangle( ITEM_SLOWMO_RADIUS, ITEM_SLOWMO_RADIUS * 0.8, -1, ITEM_SLOWMO_RADIUS * 0.1, ITEM_SLOWMO_RADIUS * 0.4, -1 );
	spRectangle( ITEM_SLOWMO_RADIUS * 1.2, ITEM_SLOWMO_RADIUS, -1, ITEM_SLOWMO_RADIUS * 0.4, ITEM_SLOWMO_RADIUS * 0.1, -1 );
	spSelectRenderTarget( spGetWindowSurface() );
}
Exemplo n.º 9
0
int main(int argc, char **argv)
{
	spInitCore();
	SDL_EnableUNICODE( 1 );

	gameSettings = new Settings();

	display = spCreateWindow( gameSettings->ScreenWidth, gameSettings->ScreenHeight, gameSettings->FullScreen, 0 );
  //Setup of the new/resized window
  spSelectRenderTarget(spGetWindowSurface());
  spSetPerspective(50.0f,(float)spGetWindowSurface()->w/(float)spGetWindowSurface()->h,0.1f,100.0f);


	spSetZTest( 0 );
	spSetZSet( 0 );
	spSetAlphaTest( 1 );

  gameStack = new StageStack();
  gameStack->Push( (Stage*)(new BootStage()) );

	deltaTime = 0;
	spLoop( engineDraw, engineUpdate, 10, resizeWindow, engineSDLEvent);

	spQuitCore();
	return 0;
}
Exemplo n.º 10
0
int main(int argc, char **argv)
{
	//sparrow3D Init
	spSetDefaultWindowSize(640,480); //Creates a 640x480 window at PC instead of 320x240
	spInitCore();
	
	//Setup
	screen = spCreateDefaultWindow();
	//Selecting the renderTarget. It could be every surface
	spSelectRenderTarget(screen);
	resize(screen->w,screen->h);
	
	//Textures loading
	texture = spLoadSurface("./data/garfield.png");
	//Setting alpha test to 0, because the texture has pink parts
	spSetAlphaTest(0);
	//Mesh loading
	mesh = spMeshLoadObj("./data/testmeshuv_tri.obj",texture,65535);
		
	//Light on! There is one "default" light at 0,0,0 with color white. We just use it.
	spSetLight(1);
	
	//All glory the main loop
	//every frame the draw_function is called
	//every frame the calc_function is called with the past time as argument
	//at least 10 ms have to be between to frames (max 100 fps)
	//if the window is resized, the resize feedback-function is called (again)
	spLoop(draw_function,calc_function,10,resize,NULL);
	
	//Winter Wrap up, Winter Wrap up
	spMeshDelete(mesh);
	spDeleteSurface(texture);
	spQuitCore();
	return 0;
}
Exemplo n.º 11
0
void ItemVortex::generateIdleImage()
{
	idle = spCreateSurface( ITEM_VORTEX_RADIUS * 2, ITEM_VORTEX_RADIUS * 2 );
	SDL_FillRect( idle, NULL, SP_ALPHA_COLOR );
	spSelectRenderTarget( idle );
	Uint16 col = spGetRGB( 0, 192, 0 );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1 );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.9, ITEM_VORTEX_RADIUS * 0.9, col );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.65, ITEM_VORTEX_RADIUS * 0.65, -1 );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.55, ITEM_VORTEX_RADIUS * 0.55, col );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.45, ITEM_VORTEX_RADIUS * 0.45, -1 );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.35, ITEM_VORTEX_RADIUS * 0.35, col );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.25, ITEM_VORTEX_RADIUS * 0.25, -1 );
	spEllipse( ITEM_VORTEX_RADIUS, ITEM_VORTEX_RADIUS, -1, ITEM_VORTEX_RADIUS * 0.15, ITEM_VORTEX_RADIUS * 0.15, col );
	spSelectRenderTarget( spGetWindowSurface() );
}
Exemplo n.º 12
0
void resize( Uint16 w, Uint16 h )
{
	#if defined ZOOMUP || defined ZOOMDOWN
		#if defined ZOOMUP && defined ZOOMDOWN
			if (dummy_screen)
				spDeleteSurface(dummy_screen);
			#ifdef FIRSTUP
				dummy_screen = spCreateSurface(screen->w*2,screen->h*2);
			#else
				dummy_screen = spCreateSurface(screen->w/2,screen->h/2);
			#endif
		#else
			if (screen)
				spDeleteSurface(screen);
			#ifdef ZOOMUP
				screen = spCreateSurface(real_screen->w/2,real_screen->h/2);
			#else
				screen = spCreateSurface(real_screen->w*2,real_screen->h*2);
			#endif
		#endif
	#endif
	spSelectRenderTarget(screen);
	//Font Loading
	if ( font )
		spFontDelete( font );
	int zoom = spMin( ( screen->w << SP_ACCURACY ) / 320, ( screen->h << SP_ACCURACY ) / 240 ); //at 320x240 == 1.0
	font = spFontLoad( "./font/LiberationMono-Regular.ttf", 10 * zoom >> SP_ACCURACY );
	spFontAdd( font,SP_FONT_GROUP_ASCII, 0 ); //Just for debug stuff
	spFontAddBorder( font, spGetFastRGB(127,127,127) );
}
Exemplo n.º 13
0
void resizeWindow( Uint16 w, Uint16 h )
{
	spDeleteSurface(display);
	display = spCreateWindow( w, h, gameSettings->FullScreen, 0 );
  //Setup of the new/resized window
  spSelectRenderTarget(spGetWindowSurface());
  spSetPerspective(50.0f,(float)spGetWindowSurface()->w/(float)spGetWindowSurface()->h,0.1f,100.0f);
}
Exemplo n.º 14
0
void TransitionFadeIn::Render()
{
	SDL_Surface* b = spGetWindowSurface();
	SDL_Surface* t = spUniqueCopySurface( b );

	// Fade from colour
	spClearTarget( SourceColour );

	// Buffer the next stages screen
	spSelectRenderTarget( t );
	Target->Render();
	spSelectRenderTarget( b );

	// Alpha it to the actual screen
	spSetHorizontalOrigin( SP_LEFT );
	spSetVerticalOrigin( SP_TOP );
	spSetBlending( Alpha );
	spBlitSurface( 0, 0, -1, t );
	spSetBlending( SP_ONE );

	spDeleteSurface( t );
}
Exemplo n.º 15
0
void resize( Uint16 w, Uint16 h )
{
	screen = spGetWindowSurface();
	spSelectRenderTarget(screen);
	spFontSetShadeColor(0);
	//Font Loading
	if ( font )
	{
		if (spGetSizeFactor() > SP_ONE)
		{
			spFontReload( font     , "./data/DejaVuSans-Bold.ttf", 8 * spGetSizeFactor() >> SP_ACCURACY);
			spFontReload( font_dark, "./data/DejaVuSans-Bold.ttf", 8 * spGetSizeFactor() >> SP_ACCURACY);
		}
		else
		{
Exemplo n.º 16
0
int main( int argc, char **argv )
{
	//sparrow3D Init
	spSetDefaultWindowSize( 640, 480 ); //Creates a 640x480 window at PC instead of 320x240
	spInitCore();

	//Setup
	screen = spCreateDefaultWindow();
	spSelectRenderTarget(screen);
	resize(screen->w,screen->h);
	spSetZSet(0);
	spSetZTest(0);

	spLoop( draw_function, calc_function, 10, resize, NULL );

	//Winter Wrap up, Winter Wrap up
	spFontDelete( font );
	spQuitCore();
	return 0;
}
Exemplo n.º 17
0
int main( int argc, char **argv )
{
	//sparrow3D Init
	spSetDefaultWindowSize( 640, 480 ); //Creates a 640x480 window at PC instead of 320x240
	spInitCore();

	//Setup
	screen = spCreateDefaultWindow();
	spSelectRenderTarget(screen);

	//Tile map loading
	tile_map = spLoadSurface( "./data/science_guy_frames01.png" );

	//Creating an empty sprite
	sprite = spNewSprite();
	//Filling it with it subsprites.
	int i;
	for ( i = 0; i < 9; i++ )
		spNewSubSpriteWithTiling( sprite, tile_map, i * 24 + 1, 1, 22, 46, 100 );

	//We don't want to use the zBuffer in any way
	spSetZSet(0);
	spSetZTest(0);

	//All glory the main loop
	//every frame the draw_function is called
	//every frame the calc_function is called with the past time as argument
	//at least 10 ms have to be between to frames (max 100 fps)
	//if the window is resized, the resize feedback-function is called (again)
	spLoop( draw_function, calc_function, 10, NULL, NULL );

	//Winter Wrap up, Winter Wrap up
	spDeleteSprite( sprite );
	spDeleteSurface( tile_map );
	spQuitCore();
	return 0;
}
Exemplo n.º 18
0
void draw_target(int rotation)
{
	SDL_Surface* screen = spGetWindowSurface();
  //drawing on the target_texture
  spSelectRenderTarget(target_texture);
	spClearTarget(65535);
	spSetZSet(0);
	spSetZTest(0);
	target_sprite->rotation = 0;
	spDrawSprite( target_texture->w / 4, target_texture->h / 4, 0, target_sprite );
	target_sprite->zoomX = spSin( rotation * 8 ) + spFloatToFixed( 1.5f );
	target_sprite->zoomY = spCos( rotation * 6 ) + spFloatToFixed( 1.5f );
	spDrawSprite( 3 * target_texture->w / 4, target_texture->h / 4, 0, target_sprite );
	target_sprite->rotation = rotation * 4;
	spDrawSprite( target_texture->w / 4, 3 * target_texture->h / 4, 0, target_sprite );
	target_sprite->zoomX = SP_ONE;
	target_sprite->zoomY = SP_ONE;
	spDrawSprite( 3 * target_texture->w / 4, 3 * target_texture->h / 4, 0, target_sprite );

  //drawing on the target_graph
  spSelectRenderTarget(target_graph);
	spClearTarget(01234);
	spSetZSet(0);
	spSetZTest(0);
	Uint16* pixeldata = spGetTargetPixel();
	int x;
	for (x = 0;x < GRAPH_SIZE; x++)
	{
		Sint32 sx = spIntToFixed(x-GRAPH_SIZE/2)/16;
		Sint32 sy = spSin(sx+rotation*16);
		int y = spFixedToInt(sy*16)+GRAPH_SIZE/2;
		if (y>=0 && y<GRAPH_SIZE)
      pixeldata[y*GRAPH_SIZE+x] = 56789;
		sy = spCos(sx+rotation*32);
		y = spFixedToInt(sy*16)+GRAPH_SIZE/2;
		if (y>=0 && y<GRAPH_SIZE)
      pixeldata[y*GRAPH_SIZE+x] = 45678;
  }
  spUnlockRenderTarget();
	for (x = 0;x < GRAPH_SIZE-1; x++)
	{
		Sint32 sx1 = spIntToFixed(x-GRAPH_SIZE/2)/16;
		Sint32 sy1 = spTan(sx1+rotation*8);
		int y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2;
		Sint32 sx2 = spIntToFixed(x+1-GRAPH_SIZE/2)/16;
		Sint32 sy2 = spTan(sx2+rotation*8);
		int y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2;
		spLine(x,y1,0,x+1,y2,0,34567);
		sy1 = spAcos(sx1/2+spSin(rotation*24));
		y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2;
		sy2 = spAcos(sx2/2+spSin(rotation*24));
		y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2;
		spLine(x,y1,0,x+1,y2,0,23456);
		sy1 = spAsin(sx1/2+spCos(rotation*24));
		y1 = spFixedToInt(sy1*16)+GRAPH_SIZE/2;
		sy2 = spAsin(sx2/2+spCos(rotation*24));
		y2 = spFixedToInt(sy2*16)+GRAPH_SIZE/2;
		spLine(x,y1,0,x+1,y2,0,12345);
  }
  
  //drawing on the screen
  spSelectRenderTarget(screen);
	spClearTarget(0);
	spSetZSet(1);
	spSetZTest(1);
  spResetZBuffer();
	spIdentity();

	spTranslate( 0,0, spFloatToFixed( -7.0f ) );
	spRotateX( rotation );
	spRotateY( rotation );
	spRotateZ( rotation );

	//Front / Back
	spBindTexture(target_texture);
	spQuadTex3D( -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_texture->h - 1,
				 -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, 0,
				 spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_texture->w - 1, 0,
				 spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_texture->w - 1, target_texture->h - 1, 65535);
	spQuadTex3D( spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, target_texture->h - 1,
				 spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0,
				 -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_texture->w - 1, 0,
				 -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_texture->w - 1, target_texture->h - 1, 65535 );
	//Left / Right
	spBindTexture(target_graph);
	spQuadTex3D( -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_graph->h - 1,
				 -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0,
				 -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_graph->w - 1, 0,
				 -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_graph->w - 1, target_graph->h - 1, 65535 );
	spQuadTex3D( spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_graph->h - 1,
				 spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0,
				 spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_graph->w - 1, 0,
				 spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_graph->w - 1, target_graph->h - 1, 65535 );
	//Up / Down
	spBindTexture(target_garfield);
	spQuadTex3D( spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_garfield->h - 1,
				 spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0,
				 -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_garfield->w - 1, 0,
				 -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_garfield->w - 1, target_garfield->h - 1, 65535 );
	spQuadTex3D( -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), 0, target_garfield->h - 1,
				 -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), 0, 0,
				 spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), target_garfield->w - 1, 0,
				 spFloatToFixed( 1.5f ), -spFloatToFixed( 1.5f ), spFloatToFixed( 1.5f ), target_garfield->w - 1, target_garfield->h - 1, 65535 );
}
Exemplo n.º 19
0
void resize(Uint16 w,Uint16 h)
{
  //Setup of the new/resized window
  spSelectRenderTarget(spGetWindowSurface());
  spSetPerspective(50.0,(float)spGetWindowSurface()->w/(float)spGetWindowSurface()->h,1.0,100);
	spBundlePointer translation = settings_get_translation();
	spFontShadeButtons(1);

	//Font Loading
	spFontSetShadeColor(FONT_BORDER_1);
	if (font)
		spFontDelete(font);
	font = spFontLoad(FONT_LOCATION,FONT_SIZE*spGetSizeFactor()>>SP_ACCURACY);
	spFontAdd(font,SP_FONT_GROUP_ASCII,FONT_COLOR_1);//whole ASCII
	spFontAddEveryLetterOfTextBundle(font,translation,FONT_COLOR_1);
	spFontAddBorder(font,FONT_BORDER_1);
	spFontMulWidth(font,15<<SP_ACCURACY-4);
	spFontAddButton( font, 'A', SP_BUTTON_LEFT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'B', SP_BUTTON_RIGHT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'X', SP_BUTTON_DOWN_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'Y', SP_BUTTON_UP_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'L', SP_BUTTON_L_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'R', SP_BUTTON_R_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'S', SP_BUTTON_START_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( font, 'E', SP_BUTTON_SELECT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	settings_set_font(font);

	spFontSetShadeColor(FONT_BORDER_2);
	if (small_font)
		spFontDelete(small_font);
	small_font = spFontLoad(FONT_LOCATION,FONT_SMALL_SIZE*spGetSizeFactor()>>SP_ACCURACY);
	spFontAdd(small_font,SP_FONT_GROUP_ASCII,FONT_COLOR_2);//whole ASCII
	//spFontAdd(small_font,SP_FONT_GROUP_GERMAN,0);//some German letters
	spFontAddEveryLetterOfTextBundle(small_font,translation,FONT_COLOR_2);
	spFontAddBorder(small_font,FONT_BORDER_2);
	spFontMulWidth(small_font,15<<SP_ACCURACY-4);
	spFontAddButton( small_font, 'A', SP_BUTTON_LEFT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'B', SP_BUTTON_RIGHT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'X', SP_BUTTON_DOWN_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'Y', SP_BUTTON_UP_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'L', SP_BUTTON_L_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'R', SP_BUTTON_R_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'S', SP_BUTTON_START_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( small_font, 'E', SP_BUTTON_SELECT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	settings_set_small_font(small_font);

	spFontSetShadeColor(FONT_BORDER_1);
	if (middle_font)
		spFontDelete(middle_font);
	middle_font = spFontLoad(FONT_LOCATION,FONT_MIDDLE_SIZE*spGetSizeFactor()>>SP_ACCURACY);
	spFontAdd(middle_font,SP_FONT_GROUP_ASCII,FONT_COLOR_1);//whole ASCII
	//spFontAdd(middle_font,SP_FONT_GROUP_GERMAN,0);//some German letters
	spFontAddEveryLetterOfTextBundle(middle_font,translation,FONT_COLOR_1);
	spFontAddBorder(middle_font,FONT_BORDER_1);
	spFontMulWidth(middle_font,15<<SP_ACCURACY-4);
	spFontAddButton( middle_font, 'A', SP_BUTTON_LEFT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'B', SP_BUTTON_RIGHT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'X', SP_BUTTON_DOWN_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'Y', SP_BUTTON_UP_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'L', SP_BUTTON_L_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'R', SP_BUTTON_R_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'S', SP_BUTTON_START_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	spFontAddButton( middle_font, 'E', SP_BUTTON_SELECT_NAME, spGetRGB(230,230,230), spGetRGB(64,64,64));
	settings_set_middle_font(middle_font);

	spFontSetShadeColor(FONT_BORDER_1);
	if (countdown_font)
		spFontDelete(countdown_font);
	countdown_font = spFontLoad(FONT_LOCATION,FONT_COUNTDOWN_SIZE*spGetSizeFactor()>>SP_ACCURACY);
	spFontAdd(countdown_font,"0123",FONT_COLOR_1);
	spFontAddBorder(countdown_font,FONT_BORDER_1);
	settings_set_countdown_font(countdown_font);

	spFontSetShadeColor(FONT_BORDER_1);
	if (highscore_font)
		spFontDelete(highscore_font);
	highscore_font = spFontLoad(FONT_LOCATION,FONT_HIGHSCORE_SIZE*spGetSizeFactor()>>SP_ACCURACY);
	spFontAdd(highscore_font,"ABCDEFGHIJKLMNOPQRSTUVWXYZ",FONT_COLOR_1);
	spFontAddBorder(highscore_font,FONT_BORDER_1);
	settings_set_highscore_font(highscore_font);

	//Particles
	resize_particle(w,h);
	init_stars();	
}