Exemple #1
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;
}
Exemple #2
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;
}
Exemple #3
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;
}