Beispiel #1
0
StateMenu::~StateMenu()
{
	spFontDelete( fontDark );
	spFontDelete( fontBright );
	spResetAxisState();
	spResetButtonsState();
}
Beispiel #2
0
StateHighscores::~StateHighscores()
{
	spFontDelete( fontW );
	spFontDelete( fontB );
	spResetAxisState();
	spResetButtonsState();
}
Beispiel #3
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) );
}
Beispiel #4
0
void DebugStage::Finish()
{
	spMeshDelete( carMesh );
	SDL_FreeSurface( carTexture );
	SDL_FreeSurface( roadTexture );
	SDL_FreeSurface( offroadTexture );
	SDL_FreeSurface( roadsideTexture );
	spFontDelete( fontHnd );
}
Beispiel #5
0
StateScore::~StateScore()
{
	spDeleteSurface( killFrame );
	spFontDelete( scoreText );
	spResetAxisState();
	spResetButtonsState();
	delete run;
	if ( nameBkup[0] != 0 )
		strcpy( name, nameBkup );
}
Beispiel #6
0
void resize(Uint16 w,Uint16 h)
{
	//Font Loading
	if ( font )
		spFontDelete( font );
	font = spFontLoad( "./font/StayPuft.ttf", 17 * spGetSizeFactor() >> SP_ACCURACY );
	spFontAdd( font, SP_FONT_GROUP_ASCII, 0 ); //whole ASCII
	spFontAddBorder( font, 65535 );
	spFontAddButton( font, 'A', SP_BUTTON_A_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'B', SP_BUTTON_B_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'X', SP_BUTTON_X_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'Y', SP_BUTTON_Y_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'L', SP_BUTTON_L_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'R', SP_BUTTON_R_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'S', SP_BUTTON_START_NAME, 65535, spGetRGB( 64, 64, 64 ) );
	spFontAddButton( font, 'E', SP_BUTTON_SELECT_NAME, 65535, spGetRGB( 64, 64, 64 ) );
}
Beispiel #7
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;
}
Beispiel #8
0
int main( int argc, char **argv )
{
	//sparrow3D Init
	spInitCore();
	
	//spSetDefaultWindowSize(800,480);

	//Setup
	#if (defined ZOOMUP || defined ZOOMDOWN) && !(defined ZOOMUP && defined ZOOMDOWN)
		real_screen = spCreateDefaultWindow();
		resize( real_screen->w, real_screen->h );
	#else
		screen = spCreateDefaultWindow();
		resize( screen->w, screen->h );
	#endif

	//Setting the first level
	levelPointer = getLevelOverPointer();
	if (argc < 2)
		sprintf(get_saved_level(),"./level/tile_test.tmx");
	else
		sprintf(get_saved_level(),"%s",argv[1]);
	levelFade = FADE_TIME;
	(*levelPointer) = loadLevel(get_saved_level());
	createPhysicsFromLevel((*levelPointer));
	
	//All glory the main loop
	spLoop( draw_schizo, calc_schizo, 10, resize, NULL );

	//Winter Wrap up, Winter Wrap up …
	clearPhysics();
	deleteLevel((*levelPointer));
	spFontDelete( font );
	spDeleteSurface(screen);
	spQuitCore();
	return 0;
}
Beispiel #9
0
void TitleStage::Finish()
{
	SDL_FreeSurface( background );
	spFontDelete( mainFont );
}
Beispiel #10
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();	
}
Beispiel #11
0
int main(int argc, char **argv)
{
	//puzzletube setup
	srand(time(NULL));
	settings_load();
	highscore_load();
	
	//Language setup
	spReadPossibleLanguages("./translations/languages.txt");
	spBundlePointer translation = spLoadBundle("./translations/translations.txt",1);
	/* //counting all hashes:
	spTextPointer mom = translation->firstText;
	int mesh[257];
	memset(mesh,0,257*4);
	int count = 0;
	while (mom)
	{
		if (mom->hash >= 0 && mom->hash < 256)
		{
			mesh[mom->hash]++;
		}
		else
			mesh[256]++;
		count++;
		mom = mom->next;
	}
	int i,j;
	for (i = 0; i < 16; i++)
	{
		for (j = 0; j < 16; j++)
		{
			printf(" %3i",mesh[i+j*16]);
		}
		printf("\n");
	}
	printf("Invalid hash: %i\n",mesh[256]);
	printf("Total hash: %i\n",count);*/
	settings_set_translation(translation);

	//sparrow3D Init
	//spSetDefaultWindowSize( 800, 480 );
	spInitCore();
	spInitNet();
	spSetAffineTextureHack(0); //We don't need it :)
	spInitMath();
	
	//Setup
	screen = spCreateDefaultWindow();
	resize(screen->w,screen->h);
	
	run_splashscreen(resize);
	spSetCulling(0);
	init_music();
	prepare_game_objects(1);
	change_music("Midnight Mediation","Nick May");
	highscore_save();
	init_c4a();
	run_menu(resize);
	quit_c4a();
	delete_game_objects();
	spDeleteBundle(translation,0);
	spFontDelete(font);
	spFontDelete(small_font);
	spFontDelete(middle_font);
	quit_music();
	spQuitNet();
	spQuitCore();
	return 0;
}