Example #1
0
void engineDraw()
{
	if( gameStack->IsEmpty() )
		return;
  spResetZBuffer();
	gameStack->Current()->Render();
	spFlip();
}
Example #2
0
File: about.c Project: theZiz/hase
void help_draw(void)
{
	spClearTarget(LL_BG);
	const int B1 = spMax(spGetSizeFactor()>>16,1);
	const int B2 = spMax(spGetSizeFactor()>>15,1);
	spFontDrawMiddle( spGetWindowSurface()->w/2,   2, 0, "How to Play", help_font );
	int h = spGetWindowSurface()->h - 4 - 4*help_font->maxheight;
	spFontDrawTextBlock(left,2+spGetWindowSurface()->w/6,2*help_font->maxheight+2, 0,help_block,h,help_scroll,help_font);
	if (help_scroll != SP_ONE)
	{
		const char button_text[] = "[v]";
		help_button[2].w = spFontWidth( button_text, help_font );
		help_button[2].h = help_font->maxheight;
		help_button[2].x = 2+spGetWindowSurface()->w*5/6;
		help_button[2].y = spGetWindowSurface()->h-2-2*help_font->maxheight;
		int width = help_button[2].w;
		int height = help_font->maxheight;
		draw_edgy_rectangle(help_button[2].x,help_button[2].y,&width,&height,B1,B2);
		spFontDraw( help_button[2].x, help_button[2].y, 0, button_text, help_font );
	}
	else
	{
		help_button[2].x = -1;
		help_button[2].y = -1;
		help_button[2].w = -1;
		help_button[2].h = -1;
	}
	if (help_scroll != 0)
	{
		const char button_text[] = "[^]";
		help_button[1].w = spFontWidth( button_text, help_font );
		help_button[1].h = help_font->maxheight;
		help_button[1].x = 2+spGetWindowSurface()->w*5/6;
		help_button[1].y = 2+  help_font->maxheight;
		int width = help_button[1].w;
		int height = help_font->maxheight;
		draw_edgy_rectangle(help_button[1].x,help_button[1].y,&width,&height,B1,B2);
		spFontDraw( help_button[1].x, help_button[1].y, 0, button_text, help_font );
	}
	else
	{
		help_button[1].x = -1;
		help_button[1].y = -1;
		help_button[1].w = -1;
		help_button[1].h = -1;
	}
	const char button_text[] = "{jump}Okay";
	help_button[0].w = spFontWidth( button_text, help_font );
	help_button[0].h = help_font->maxheight;
	help_button[0].x = spGetWindowSurface()->w/2 - help_button[0].w/2;
	help_button[0].y = spGetWindowSurface()->h-B2*2-help_font->maxheight;
	int width = help_button[0].w;
	int height = help_font->maxheight;
	draw_edgy_rectangle(help_button[0].x,help_button[0].y,&width,&height,B1,B2);
	spFontDraw( help_button[0].x, help_button[0].y, 0, button_text, help_font );
	spFlip();
}
Example #3
0
void draw_function( void )
{
	spClearTarget( 0 );

	char buffer[256];
	sprintf(buffer,"FPS: %i",spGetFPS());
	spFontDrawRight( spGetWindowSurface()->w-1, spGetWindowSurface()->h-font->maxheight, -1, buffer, font );
	spFlip();
}
Example #4
0
void draw_splash(void)
{
  spClearTarget(0);
  spResetZBuffer();
	spIdentity();
	spTranslate(0,0,-3<<SP_ACCURACY);
	spSetZTest(0);
	spSetZSet(0);
	spMesh3D( sparrow_mesh, 1 );
	spMesh3D( logo_mesh, 1 );
  spFlip();  	
}
Example #5
0
void draw_schizo( void )
{
	RESET_ZBUFFER
	CLEAN_TARGET((*levelPointer)->backgroundColor)
	spSetZSet( Z_SORTING );
	spSetZTest( Z_SORTING );
	spSetAlphaTest( 1 );

	drawLevel((*levelPointer));

	//HUD (for debug reasons)
	spSetZSet( 0 );
	spSetZTest( 0 );
	spSetAlphaTest( 1 );
	char buffer[256];
	sprintf( buffer, "camera X: %i\ncamera Y: %i\ncollisiontests: %i\nfps: %i\nspeed:%.5i,%.5i",
			(*levelPointer)->currentCamera.x >> SP_ACCURACY-5,(*levelPointer)->currentCamera.y >> SP_ACCURACY-5,
			getCollisionCount(),spGetFPS(),
			(*levelPointer)->choosenPlayer->physicsElement->speed.x,
			(*levelPointer)->choosenPlayer->physicsElement->speed.y);
	spFontDrawRight( screen->w-1, screen->h-font->maxheight*5, -1, buffer, font );
	#if defined ZOOMUP && defined ZOOMDOWN
		#ifdef FIRSTUP
			spScale2XSmooth(screen,dummy_screen);
			spScaleDownSmooth(dummy_screen,screen);
		#else
			spScaleDownSmooth(screen,dummy_screen);
			spScale2XSmooth(dummy_screen,screen);
		#endif
	#elif defined ZOOMUP
		spScale2XSmooth(screen,real_screen);
	#elif defined ZOOMDOWN
		spScaleDownSmooth(screen,real_screen);
	#endif
	if (levelFade > 0) // Fade in
		spInterpolateTargetToColor(0,(levelFade*SP_ONE)/FADE_TIME);
	if (levelFade < 0) // Fade out
		spInterpolateTargetToColor(0,SP_ONE+(levelFade*SP_ONE)/FADE_TIME);
	spFlip();
}
Example #6
0
void draw_function(void)
{
	//Reseting Z Buffer to the maximal negative value
	spResetZBuffer();
	//Cleaning the target (in this case the screen surface) with 0 (black).
	spClearTarget(0);
	//Reseting the ModelViewMatrix to an identity matrix.
	spIdentity();
	
	//Binding the texture
	spBindTexture(texture);
	
	//Going to the "position" -8.0f
	spTranslate(0,0,-8<<SP_ACCURACY);
	//rotation aorund every axis
	spRotateX(rotation);
	spRotateY(rotation);
	spRotateZ(rotation);
	spRotateX(SP_PI/8);
	//Drawing the mesh and no update of the edgelist 
	spMesh3D(mesh,0);
	//Show it!
	spFlip();
}
Example #7
0
void loadInformation(char* information)
{
	spClearTarget(0);
	spFontDrawMiddle(screen->w/2,screen->h/2,0,information,font);
	spFlip();
}
Example #8
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();
}