Пример #1
0
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();
}
Пример #2
0
void StateHighscores::render(SDL_Surface* target)
{
	spClearTarget( COLOUR_BACKGROUND );

	int posOffset = spFontWidth( (unsigned char*) Utility::numToStr( file.scores.size() ).c_str(), fontB );
	int numEntries = std::min( HIGHS_ENTRIES_ON_SCREEN, (int)file.scores.size() );
	int vertOffset = ( APP_SCREEN_HEIGHT + 40 - numEntries * HIGHS_FONT_SIZE ) / 2;

	int I = drawOffset;
	for ( HighscoreFile::scoreIter iter = offsetIter; I < drawOffset + numEntries && iter != file.scores.end(); ++iter )
	{
		spFontPointer temp = fontB;
		if ( I == selOffset )
			temp = fontW;
		int yPos = APP_SCREEN_HEIGHT - vertOffset - ( I - drawOffset + 1 ) * HIGHS_FONT_SIZE;
		spFontDrawRight( posOffset + 16, yPos, -1,
						 (unsigned char*) (Utility::numToStr( I + 1 ) + "." ).c_str(), temp );
		spFontDraw( posOffset + 28, yPos, -1,
					(unsigned char*) iter->name.c_str(), temp );
		spFontDrawRight( APP_SCREEN_WIDTH - 16, yPos, -1,
						(unsigned char*) Utility::numToStr( iter->score ).c_str(), temp );
		++I;
	}

	if ( file.scores.empty() )
	{
		spFontDrawMiddle( APP_SCREEN_WIDTH / 2, APP_SCREEN_HEIGHT / 2, -1,
						(unsigned char*) "No highscores set yet, go play the game!", fontB );
	}
	else
	{
		spFontDrawMiddle( APP_SCREEN_WIDTH / 2, APP_SCREEN_HEIGHT - HIGHS_FONT_SIZE, -1,
						(unsigned char*) "Press \""SP_BUTTON_B_NAME"\" to load the replay for a score. Press \""SP_BUTTON_START_NAME"\" to exit.", fontHint );
	}
}
Пример #3
0
void draw_account(spFontPointer font,spFontPointer font_small,spFontPointer font_very_small)
{
	SDL_Surface* screen = spGetWindowSurface();
	spFontDrawRight( screen->w-2, 2, 0, "[X] Back", font_very_small );
	if (spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS)	
		spFontDrawMiddle( screen->w*2/3, 2, 0, "[B] Enter letter", font_very_small );
	if (spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS)
		spFontDraw( 2, 2, 0, "[L] & [R]: Select Row", font_very_small );
	else
		spFontDraw( 2, 2, 0, SP_PAD_NAME": Select Row", font_very_small );
	switch (mode)
	{
		case 0:
			spFontDrawMiddle( 2*screen->w/3, 1*screen->h/9, 0, ">>> Account Creating <<<", font);
			spFontDrawMiddle( 2*screen->w/3, 2*screen->h/11, 0, "Press [S] to create the account", font_small);
			break;		
		case 1:
			spFontDrawMiddle( 2*screen->w/3, 1*screen->h/9, 0, ">>> Account Editing <<<", font);
			spFontDrawMiddle( 2*screen->w/3, 2*screen->h/11, 0, "Press [S] to save the changes", font_small);
			spFontDrawMiddle( 2*screen->w/3, 2*screen->h/8, 0, "Press [E] to delete the account", font_small);
			break;		
	}
	
	char* mom_line = NULL;
	switch (line)
	{
		case 0: mom_line = shortName; break;
		case 1: mom_line = longName; break;
		case 2: mom_line = password; break;
		case 3: mom_line = mail; break;
	}
	spLine( 2*screen->w/3 + spFontWidth(mom_line,font)/2+1, (line*2+6)*screen->h/18, 0,
	        2*screen->w/3 + spFontWidth(mom_line,font)/2+1, (line*2+7)*screen->h/18, 0, ((blink/512)&1)?0:65535);
	
	spFontDrawRight( screen->w/3, 3*screen->h/9, 0, "3 Letter Nick:", font);
	spFontDrawMiddle( 2*screen->w/3, 3*screen->h/9, 0, shortName, font);
	spLine( screen->w/3+10, 7*screen->h/18, 0, screen->w-10, 7*screen->h/18,0,65535);
	spFontDrawMiddle( 2*screen->w/3, 7*screen->h/18, 0, "(e.g. JHN)", font_very_small);

	spFontDrawRight( screen->w/3, 4*screen->h/9, 0, "Display Nick:", font);
	spFontDrawMiddle( 2*screen->w/3, 4*screen->h/9, 0, longName, font);
	spLine( screen->w/3+10, 9*screen->h/18, 0, screen->w-10, 9*screen->h/18,0,65535);
	spFontDrawMiddle( 2*screen->w/3, 9*screen->h/18, 0, "(e.g. JohnSmith)", font_very_small);

	spFontDrawRight( screen->w/3, 5*screen->h/9, 0, "Password:"******"(alphanumeric, e.g. aBc123)", font_very_small);

	spFontDrawRight( screen->w/3, 6*screen->h/9, 0, "E-Mail address:", font);
	spFontDrawMiddle( 2*screen->w/3, 6*screen->h/9, 0, mail, font);
	spLine( screen->w/3+10, 13*screen->h/18, 0, screen->w-10, 13*screen->h/18,0,65535);
	spFontDrawMiddle( 2*screen->w/3, 13*screen->h/18, 0, "(for score being beaten notification)", font_very_small);
	if (spIsKeyboardPolled() && spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS)
		spBlitSurface(screen->w/2,screen->h-spGetVirtualKeyboard()->h/2,0,spGetVirtualKeyboard());
	
	switch (askMode)
	{
		case 1:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Are you sure to delete your profile forever?", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[S] Yes...     [X] Hell No!", font);
			break;
		case 2:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Your 3 Letter Nick needs 3 alphanumeric letters.", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Okay...", font);
			break;
		case 3:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Only numbers and characters are allowed for your Nick!", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Uuups...", font);
			break;
		case 4:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Only numbers and characters are allowed for passwords!", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Okay...", font);
			break;
		case 5:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "IF you enter a e-mail, make sure it contains an @.", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Okay...", font);
			break;
		case 6:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Couldn't connect to Server! Check your connection.", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Ok", font);
			break;
		case 7:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Account created successfully", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Ok", font);
			break;
		case 8:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Account edited successfully", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Ok", font);
			break;
		case 9:
			spInterpolateTargetToColor(0,3*SP_ONE/4);
			spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Account deleted successfully", font);
			spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, "[B] Ok", font);
			break;
	}	
	if (spNetC4AGetStatus() > 0)
	{
		spInterpolateTargetToColor(0,3*SP_ONE/4);
		spFontDrawMiddle( screen->w/2, screen->h/2-font->maxheight/2, 0, "Connecting to server...", font);
		char buffer[256];
		sprintf(buffer,"Timeout in %i.%i",spNetC4AGetTimeOut()/1000,(spNetC4AGetTimeOut()/100)%10);
		spFontDrawMiddle( screen->w/2, screen->h/2+font->maxheight/2, 0, buffer, font);
	}
}