Exemple #1
0
void draw_primitives(int rotation)
{
	spSetZTest( primitives_z );
	spSetZSet( primitives_z );
	spSetBlending( primitives_blending?spFloatToFixed(0.5):SP_ONE );
	SDL_Surface* screen = spGetWindowSurface();
	srand( 0 );
	int i;
	for ( i = 0; i < 8; i++ )
		spEllipseBorder( rand() % screen->w, rand() % screen->h, 0, rand() % screen->w / 4, rand() % screen->h / 4, 10, 20, rand() % 65536 );
	for ( i = 0; i < 8; i++ )
		spEllipse( rand() % screen->w, rand() % screen->h, 0, rand() % screen->w / 4, rand() % screen->h / 4, rand() % 65536 );
	for ( i = 0; i < 8; i++ )
		spRectangleBorder( rand() % screen->w, rand() % screen->h, 0,
							 rand() % screen->w / 2, rand() % screen->h / 2, 12, 6, rand() % 65536 );
	for ( i = 0; i < 8; i++ )
		spRectangle( rand() % screen->w, rand() % screen->h, 0,
					 rand() % screen->w / 2, rand() % screen->h / 2, rand() % 65536 );
	for ( i = 0; i < 64; i++ )
	{
		spSetLineWidth(rand()%8+1);
		spLine( rand() % screen->w, rand() % screen->h, 0,
		        rand() % screen->w, rand() % screen->h, 0, rand() % 65536 );
	}
	/*spSetLineWidth(5);
	spLine(292,113,0,29,192,0,12345);*/
	spSetLineWidth(1);
	spSetZTest( 1 );
	spSetZSet( 1 );
	spSetBlending( SP_ONE );
}
Exemple #2
0
void ItemVortex::render( SDL_Surface *const target )
{
	if ( vortex.running() )
	{
		for( int r = shape.radius; r > 0; r-- )
		{
			switch( ( r + animationOffset ) % 11 )
			{
			case 0:
			case 1:
			case 2:
				spEllipseBorder( *x, *y, -1, r, r, 1, 1, spGetFastRGB( 192, 0, 192 ) );
				break;
			default:
				break;
			}
		}

		//spEllipse( *x, *y, -1, shape.radius, shape.radius, spGetFastRGB( 192, 192, 192 ) );
	}
	else
	{
		UnitBase::render( target );
	}
}
Exemple #3
0
void draw_function( void )
{
	//Cleaning the target (in this case the screen surface) with 0 (black).
	//In this case I don't clean the zBuffer, because I don't use it. ;-)
	//But you ARE able to use it, if you want!
	spResetZBuffer();
	spClearTarget( 34567 );


	//Set the origin:
	switch ( ( rotation >> 17 ) % 9 )
	{
	case 0:
		spSetHorizontalOrigin( SP_CENTER );
		spSetVerticalOrigin( SP_CENTER );
		break;
	case 1:
		spSetHorizontalOrigin( SP_LEFT );
		spSetVerticalOrigin( SP_CENTER );
		break;
	case 2:
		spSetHorizontalOrigin( SP_LEFT );
		spSetVerticalOrigin( SP_TOP );
		break;
	case 3:
		spSetHorizontalOrigin( SP_CENTER );
		spSetVerticalOrigin( SP_TOP );
		break;
	case 4:
		spSetHorizontalOrigin( SP_RIGHT );
		spSetVerticalOrigin( SP_TOP );
		break;
	case 5:
		spSetHorizontalOrigin( SP_RIGHT );
		spSetVerticalOrigin( SP_CENTER );
		break;
	case 6:
		spSetHorizontalOrigin( SP_RIGHT );
		spSetVerticalOrigin( SP_BOTTOM );
		break;
	case 7:
		spSetHorizontalOrigin( SP_CENTER );
		spSetVerticalOrigin( SP_BOTTOM );
		break;
	case 8:
		spSetHorizontalOrigin( SP_LEFT );
		spSetVerticalOrigin( SP_BOTTOM );
		break;
	}

	//Drawing the sprite in the middle of the screen
	spDrawSprite( screen->w / 2, screen->h / 2, -1, sprite );
	spDrawSprite( screen->w - 1, screen->h - 1, -1, sprite );
	spDrawSprite( screen->w - 1, 0, -1, sprite );
	spDrawSprite( 0, screen->h - 1, -1, sprite );
	spDrawSprite( 0, 0, -1, sprite );

	//mark the center
	//spEllipseBorder( screen->w / 2, screen->h / 2, -100, 60+spSin(rotation/2)/1000, 60+spCos(rotation/3)/1000, 20+spCos(rotation/7)/10000, 20+spSin(rotation/5)/10000, 0 );
	spEllipseBorder( screen->w / 2, screen->h / 2, -100, 6, 6, 2, 2, 0 );

	//Show it!
	spFlip();
}