Exemple #1
0
void RegistLoop (double timestep ){
	int ww = param.x_resolution;
	int hh = param.y_resolution;
	Music.Update ();    
	check_gl_error();
    ClearRenderContext ();
    set_gl_options (GUI);
    SetupGuiDisplay ();
	TColor col;
		
	update_ui_snow (timestep);
	draw_ui_snow();

	Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), scale);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top, 
//			0, colMBackgr, col, 0.2);

	FT.AutoSizeN (3);
	FT.SetColor (colWhite);
	int top = AutoYPosN (24);
	FT.DrawString (area.left, top, "Select your player name:");
	FT.DrawString (area.left + framewidth + arrowwidth, top, "Select a character:");

	FT.AutoSizeN (4);
	if (curr_focus == 0) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, area.top, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + 20, area.top, Players.GetName (curr_player));
	Tex.DrawDirectFrame (Players.GetAvatarID (curr_player), 
		area.left + 60, AutoYPosN (40), texsize, texsize, 3, colWhite);

	if (curr_focus == 1) col = colDYell; else col = colWhite;
	DrawFrameX (area.left + framewidth + arrowwidth, area.top, 
		framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + framewidth + arrowwidth + 20, 
		area.top, CharList[curr_character].name);
	Tex.DrawDirectFrame (CharList[curr_character].preview, 
		area.right - texsize - 60 - arrowwidth, 
		AutoYPosN (40), texsize, texsize, 3, colWhite);


	FT.SetColor (colWhite);
	PrintArrow (0, (curr_player > 0));	

	PrintArrow (1, (curr_player < last_player));
	PrintArrow (2, (curr_character > 0));	
	PrintArrow (3, (curr_character < last_character));

	PrintTextButton (0, curr_focus);
	PrintTextButton (1, curr_focus);

	if (param.ice_cursor) DrawCursor ();
    Winsys.SwapBuffers();
} 
void EventSelectLoop (double timestep) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;
	TColor col;
		
	check_gl_error();
   	set_gl_options (GUI );
	Music.Update ();    
    ClearRenderContext ();
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow (timestep);
		draw_ui_snow ();
	}

	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), param.scale);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	
//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top, 
//			0, colMBackgr, colBlack, 0.2);

	FT.AutoSizeN (3);
	FT.SetColor (colWhite);
	FT.DrawString (area.left, AutoYPosN (30), Trans.Text (6));
	FT.DrawString (area.left,AutoYPosN (45), Trans.Text (7));
	if (Events.IsUnlocked (curr_event, curr_cup) == false) {
		FT.SetColor (colLGrey);
 		FT.DrawString (CENTER, AutoYPosN (58), Trans.Text (10));
	}

	FT.AutoSizeN (4);

	if (curr_focus == 0) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, frametop1, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (colDYell);
	FT.DrawString (area.left + 20, frametop1, EventList[curr_event].name);

	if (curr_focus == 1) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, frametop2, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	if (Events.IsUnlocked (curr_event, curr_cup)) FT.SetColor (colDYell); 
		else FT.SetColor (colLGrey);
	FT.DrawString (area.left + 20, frametop2, Events.GetCupTrivialName (curr_event, curr_cup));

	PrintArrow (0, (curr_event > 0));	
	PrintArrow (1, (curr_event < last_event));
	PrintArrow (2, (curr_cup > 0));	
	PrintArrow (3, (curr_cup < last_cup));

	if (Events.IsUnlocked (curr_event, curr_cup)) PrintTextButton (0, curr_focus);
	PrintTextButton (1, curr_focus);

	if (param.ice_cursor) DrawCursor ();
    SDL_GL_SwapBuffers ();
}
void CEventSelect::Loop (double timestep) {
    int ww = Winsys.resolution.width;
    int hh = Winsys.resolution.height;
    TColor col;

    check_gl_error();
    ScopedRenderMode rm(GUI);
    Music.Update ();
    ClearRenderContext ();
    SetupGuiDisplay ();

    if (param.ui_snow) {
        update_ui_snow (timestep);
        draw_ui_snow ();
    }

    Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), Winsys.scale);
    Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
    Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
    Tex.Draw (TOP_LEFT, 0, 0, 1);
    Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

    FT.AutoSizeN (3);
    FT.SetColor (colWhite);
    FT.DrawString (area.left, AutoYPosN (30), Trans.Text (6));
    FT.DrawString (area.left,AutoYPosN (45), Trans.Text (7));
    if (Events.IsUnlocked (event->GetValue(), cup->GetValue()) == false) {
        FT.SetColor (colLGrey);
        FT.DrawString (CENTER, AutoYPosN (58), Trans.Text (10));
    }

    FT.AutoSizeN (4);

    if (event->focussed()) col = colDYell;
    else col = colWhite;
    DrawFrameX (area.left, frametop1, framewidth, frameheight, 3, colMBackgr, col, 1.0);
    FT.SetColor (colDYell);
    FT.DrawString (area.left + 20, frametop1, EventList[event->GetValue()].name);

    if (cup->focussed()) col = colDYell;
    else col = colWhite;
    DrawFrameX (area.left, frametop2, framewidth, frameheight, 3, colMBackgr, col, 1.0);
    if (Events.IsUnlocked (event->GetValue(), cup->GetValue()))
        FT.SetColor (colDYell);
    else
        FT.SetColor (colLGrey);
    FT.DrawString (area.left + 20, frametop2, Events.GetCupTrivialName (event->GetValue(), cup->GetValue()));

    textbuttons[0]->SetActive(Events.IsUnlocked (event->GetValue(), cup->GetValue()));
    DrawGUI();

    Winsys.SwapBuffers();
}
void CRegist::Loop (double timestep) {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;
	Music.Update ();
	check_gl_error();
    ClearRenderContext ();
    ScopedRenderMode rm(GUI);
    SetupGuiDisplay ();
	TColor col;

	if (param.ui_snow) {
		update_ui_snow (timestep);
		draw_ui_snow();
	}

	Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), scale);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, col, 0.2);

	FT.AutoSizeN (3);
	FT.SetColor (colWhite);
	int top = AutoYPosN (24);
	FT.DrawString (area.left, top, Trans.Text(58));
	FT.DrawString (area.left + framewidth + arrowwidth, top, Trans.Text(59));

	FT.AutoSizeN (4);
	if (player->focussed()) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, area.top, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + 20, area.top, Players.GetName (player->GetValue()));
	Players.GetAvatarTexture(player->GetValue())->DrawFrame(
		area.left + 60, AutoYPosN (40), texsize, texsize, 3, colWhite);

	if (character->focussed()) col = colDYell; else col = colWhite;
	DrawFrameX (area.left + framewidth + arrowwidth, area.top,
		framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + framewidth + arrowwidth + 20,
		area.top, Char.CharList[character->GetValue()].name);
	if(Char.CharList[character->GetValue()].preview != NULL)
		Char.CharList[character->GetValue()].preview->DrawFrame(
			area.right - texsize - 60 - arrowwidth,
			AutoYPosN (40), texsize, texsize, 3, colWhite);


	FT.SetColor (colWhite);
	DrawGUI();

    Winsys.SwapBuffers();
}
Exemple #5
0
void TTextField::Draw() const {
	const TColor& col = focus?colDYell:colWhite;
	FT.SetColor (col);
	DrawFrameX (mouseRect.left, mouseRect.top, mouseRect.width, mouseRect.height, 3, colMBackgr, col, 1.0);
	FT.AutoSizeN (5);
	FT.DrawString (mouseRect.left+20, mouseRect.top, text);

	if (cursor && focus) {
		int x = mouseRect.left + 20 + 1;
		//if (cursorPos != 0) {
			string temp = text.substr (0, text.length()/*cursorPos*/);
			x += FT.GetTextWidth (temp);
		//}
		int w = 3;
		int h = 26 * Winsys.scale;
		int scrheight = Winsys.resolution.height;

		glDisable (GL_TEXTURE_2D);
		glColor(colYellow);
		const GLshort vtx[] = {
			GLshort(x),     GLshort(scrheight - mouseRect.top - h - 9),
			GLshort(x + w), GLshort(scrheight - mouseRect.top - h - 9),
			GLshort(x + w), GLshort(scrheight - mouseRect.top - 9),
			GLshort(x),     GLshort(scrheight - mouseRect.top - 9)
		};
		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(2, GL_SHORT, 0, vtx);
		glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
		glDisableClientState(GL_VERTEX_ARRAY);
		glEnable (GL_TEXTURE_2D);
	}
}
void CScore::Loop () {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	Music.Update ();
	check_gl_error();
	ClearRenderContext ();
	ScopedRenderMode rm(GUI);
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow ();
		draw_ui_snow();
	}

	Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	//Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), Winsys.scale);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	FT.AutoSizeN (7);
	FT.SetColor (colWhite);
	FT.DrawString (CENTER, AutoYPosN (Winsys.resolution.width > Winsys.resolution.height ? 6 : 22), Trans.Text(62));

	DrawFrameX (area.left, frametop, framewidth - 93, frameheight, 3, colMBackgr, colWhite, 1.0);
	FT.AutoSizeN (4);
	FT.SetColor (colDYell);
	FT.DrawString (area.left+20, frametop, CourseList[course->GetValue()].name);

	const TScoreList *list = Score.GetScorelist (course->GetValue());

	FT.SetColor (colWhite);
	if (list != NULL) {
		FT.AutoSizeN (3);
		if (list->numScores < 1) {
			FT.DrawString (CENTER, area.top + 140, Trans.Text(63));
		} else {
			for (int i=0; i<min(MAX_SCORES, list->numScores); i++) {
				int y = listtop + i*linedist;
				FT.DrawString (area.left, y, ordinals[i]);
				FT.DrawString (area.left + dd1, y, Int_StrN (list->scores[i].points));
				FT.DrawString (area.left + dd2, y, list->scores[i].player);
				FT.DrawString (area.left + dd3, y,
				               Int_StrN (list->scores[i].herrings) + "  herrings");
				FT.DrawString (area.left + dd4, y,
				               Float_StrN (list->scores[i].time, 1) + "  sec");
			}
		}
	} else Message ("score list out of range");

	DrawGUI();

	Winsys.SwapBuffers();
}
Exemple #7
0
void TIconButton::Draw () const {
	TColor framecol = colWhite;
	if (focus) framecol = colDYell;

	int line = 3;
	int framesize = size + 2 * line;
	GLshort t = Winsys.resolution.height - position.y;
	GLshort y = t - size;
	GLshort x = position.x;
	GLshort r = x + size;

	DrawFrameX (position.x-line, position.y-line,
	            framesize, framesize, line, colBlack, framecol, 1.0);

	glEnable (GL_TEXTURE_2D);
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	texture->Bind();
	glColor4f (1.0, 1.0, 1.0, 1.0);

	const GLshort vtx[] = {
		x, y,
		r, y,
		r, t,
		x, t
	};
	static const GLfloat tex[4][8] = {
		{
			0, 0.5,
			0.5, 0.5,
			0.5, 1,
			0, 1
		}, {
			0.5, 0.5,
			1, 0.5,
			1, 1,
			0.5, 1
		}, {
			0, 0,
			0.5, 0,
			0.5, 0.5,
			0, 0.5
		}, {
			0.5, 0,
			1, 0,
			1, 0.5,
			0.5, 0.5
		}
	};
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	glVertexPointer(2, GL_SHORT, 0, vtx);
	glTexCoordPointer(2, GL_FLOAT, 0, tex[value]);
	glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);
}
void TTexture::DrawFrame(int x, int y, int w, int h, int frame, const sf::Color& col) {
	if (w < 1) w = texture.getSize().x;
	if (h < 1) h = texture.getSize().y;

	if (frame > 0)
		DrawFrameX(x - frame, y - frame, w + 2 * frame, h + 2 * frame, frame, colTransp, col, 1.f);

	sf::Sprite temp(texture);
	temp.setPosition(x, y);
	temp.setScale((float) w / (float) texture.getSize().x, (float) h / (float) texture.getSize().y);
	Winsys.draw(temp);
}
void CEvent::Loop (double timestep) {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	check_gl_error();
	ScopedRenderMode rm(GUI);
	Music.Update ();
    ClearRenderContext ();
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow (timestep);
		draw_ui_snow ();
	}
	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), Winsys.scale);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	if (ready == 0) {			// cup not finished
		FT.AutoSizeN (6);
		FT.SetColor (colWhite);
		FT.DrawString (CENTER, AutoYPosN (25), ecup->name);

		DrawBonusExt (bonustop, (int)ecup->races.size(), curr_bonus);

		DrawFrameX (area.left, frametop, framewidth,
			(int)ecup->races.size() * dist + 20, 3, colBackgr, colWhite, 1);

		for (size_t i=0; i<ecup->races.size(); i++) {
			FT.AutoSizeN (3);

			int y = frametop + 10 + (int)i * dist;
			if (i == curr_race)
				FT.SetColor (colDYell);
			else
				FT.SetColor (colWhite);
			FT.DrawString (area.left + 29, y, Course.CourseList[ecup->races[i]->course].name);
			Tex.Draw (CHECKBOX, area.right -54, y, texsize, texsize);
			if (curr_race > i) Tex.Draw (CHECKMARK, area.right-50, y + 4, 0.8);
		}

		FT.AutoSizeN (3);
		int ddd = FT.AutoDistanceN (1);
		FT.SetColor (colDBlue);
		string info = Trans.Text(11);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.i);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.j);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.k);
		FT.DrawString (CENTER, framebottom+15, info);

		info = Trans.Text(12);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.x, 0);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.y, 0);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.z, 0);
		info += "  " + Trans.Text(14);
		FT.DrawString (CENTER, framebottom+15+ddd, info);

	} else if (ready == 1) {		// cup successfully finished
		FT.AutoSizeN (5);
		FT.SetColor (colWhite);
		FT.DrawString (CENTER, messtop, Trans.Text(16));
		DrawBonusExt (bonustop, (int)ecup->races.size(), curr_bonus);
		int res = resultlevel(curr_bonus, ecup->races.size());
		FT.DrawString (CENTER, messtop2, Trans.Text(17) + "  "+Int_StrN (res));
	} else if (ready == 2) {		// cup finished but failed
		FT.AutoSizeN (5);
		FT.SetColor (colLRed);
		FT.DrawString (CENTER, messtop, Trans.Text(18));
		DrawBonusExt (bonustop, ecup->races.size(), curr_bonus);
		FT.DrawString (CENTER, messtop2, Trans.Text(19));
	}

	textbuttons[0]->SetVisible(ready < 1);
	textbuttons[1]->SetVisible(ready < 1);
	textbuttons[2]->SetVisible(!(ready < 1));

	DrawGUI ();
    Winsys.SwapBuffers();
}
Exemple #10
0
void DrawBonusExt (int y, size_t numraces, size_t num) {
	size_t maxtux = numraces * 3;
	if (num > maxtux) return;

	TVector2i bl, tr;

	//TColor col1 = {0.3, 0.5, 0.7, 1};
	TColor col2(0.45, 0.65, 0.85, 1);
	//TColor col3 = {0.6, 0.8, 1.0, 1};
	//TColor gold = {1, 1, 0, 1};

	int lleft[3];

	int framewidth = (int)numraces * 40 + 8;
	int totalwidth = framewidth * 3 + 8;
	int xleft = (Winsys.resolution.width - totalwidth) / 2;
	lleft[0] = xleft;
	lleft[1] = xleft + framewidth + 4;
	lleft[2] = xleft + framewidth + framewidth + 8;

	DrawFrameX (lleft[0], y, framewidth, 40, 1, col2, colBlack, 1);
	DrawFrameX (lleft[1], y, framewidth, 40, 1, col2, colBlack, 1);
	DrawFrameX (lleft[2], y, framewidth, 40, 1, col2, colBlack, 1);
	if (param.use_papercut_font > 0) FT.SetSize (20);
	else FT.SetSize (15);
	bl.y = Winsys.resolution.height - y - 32 -4;
	tr.y = Winsys.resolution.height - y - 0 -4;

	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable (GL_TEXTURE_2D);
	Tex.BindTex (TUXBONUS);
	glColor4f (1.0, 1.0, 1.0, 1.0);

	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	for (size_t i=0; i<maxtux; i++) {
		size_t majr = (i/numraces);
		size_t minr = i - majr * numraces;
		if (majr > 2) majr = 2;
		bl.x = lleft[majr] + (int)minr * 40 + 6;
		tr.x = bl.x + 32;

		// with tux outlines:
		// if (i<num) bott = 0.5; else bott = 0.0;
		// top = bott + 0.5;
		if (i<num) {
			float bott = 0.5;
			float top = 1.0;

			const GLfloat tex[] = {
				0, bott,
				1, bott,
				1, top,
				0, top
			};
			const GLshort vtx[] = {
				GLshort(bl.x), GLshort(bl.y),
				GLshort(tr.x), GLshort(bl.y),
				GLshort(tr.x), GLshort(tr.y),
				GLshort(bl.x), GLshort(tr.y)
			};
			glVertexPointer(2, GL_SHORT, 0, vtx);
			glTexCoordPointer(2, GL_FLOAT, 0, tex);
			glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
		}
	}
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);
}
void CRaceSelect::Loop() {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;
	TColor col;

	check_gl_error();
	ScopedRenderMode rm(GUI);
	ClearRenderContext ();
	SetupGuiDisplay ();

	Music.Update ();
	if (param.ui_snow) {
		update_ui_snow ();
		draw_ui_snow ();
	}

	//Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), 1.0);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	// course selection
	col = colWhite;
	DrawFrameX (area.left, frametop, framewidth - 100, frameheight, 3, colMBackgr, col, 1.0);
	FT.AutoSizeN (4);
	FT.SetColor (colDYell);
	FT.DrawString (area.left+20, frametop, CourseList[course->GetValue()].name);

	if (CourseList[course->GetValue()].preview)
		CourseList[course->GetValue()].preview->DrawFrame(area.left + 3, prevtop, prevwidth, prevheight, 3, colWhite);

	DrawFrameX (area.right-boxwidth, prevtop-3, boxwidth, prevheight+6, 3, colBackgr, colWhite, 1.0);
	FT.AutoSizeN (2);
	FT.SetColor (colWhite);
	int dist = FT.AutoDistanceN (0);
	for (size_t i=0; i<CourseList[course->GetValue()].num_lines; i++) {
		FT.DrawString (boxleft+8, prevtop+i*dist, CourseList[course->GetValue()].desc[i]);
	}

	FT.DrawString (CENTER, prevtop + prevheight + 10, "Author:  " + CourseList[course->GetValue()].author);

	//FT.DrawString (CENTER, AutoYPosN (45), info);

	if (g_game.force_treemap) {
		FT.AutoSizeN (4);
		static const string forcetrees = "Load trees.png";
		string sizevar = "Size: ";
		sizevar += Int_StrN (g_game.treesize);
		sizevar += " Variation: ";
		sizevar += Int_StrN (g_game.treevar);
		FT.SetColor (colYellow);
		FT.DrawString (CENTER, AutoYPosN (85), forcetrees);
		FT.DrawString (CENTER, AutoYPosN (90), sizevar);
	}

	DrawGUI();

	Winsys.SwapBuffers();
}
Exemple #12
0
void EventLoop (double timestep) {
    int ww = param.x_resolution;
    int hh = param.y_resolution;
    int i;
    TColor col;
    int y;
    string info;

    check_gl_error();
    set_gl_options (GUI );
    Music.Update ();
    ClearRenderContext ();
    SetupGuiDisplay ();

    if (param.ui_snow) {
        update_ui_snow (timestep);
        draw_ui_snow ();
    }
    Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), param.scale);
    Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
    Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
    Tex.Draw (TOP_LEFT, 0, 0, 1);
    Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

    if (ready == 0) {			// cup not finished
        FT.AutoSizeN (6);
        FT.SetColor (colWhite);
        FT.DrawString (CENTER, AutoYPosN (25), ecup->name);

        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);

        DrawFrameX (area.left, frametop, framewidth,
                    ecup->num_races * dist + 20, 3, colBackgr, colWhite, 1);

        for (i=0; i<ecup->num_races; i++) {
            if (i == curr_race) col = colDYell;
            else col = colWhite;
            FT.AutoSizeN (3);

            y = frametop + 10 + i * dist;
            FT.SetColor (col);
            FT.DrawString (area.left + 29, y, Course.CourseList[ecourseidx[i]].name);
            Tex.Draw (CHECKBOX, area.right -54, y, texsize, texsize);
            if (curr_race > i) Tex.Draw (CHECKMARK, area.right-50, y + 4, 0.8);
        }

        FT.AutoSizeN (3);
        int ddd = FT.AutoDistanceN (1);
        FT.SetColor (colDBlue);
        info = Trans.Text(11);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.i);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.j);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.k);
        FT.DrawString (CENTER, framebottom+15, info);

        info = Trans.Text(12);
        info += "   " + Float_StrN (eraces[curr_race]->time.x, 0);
        info += "   " + Float_StrN (eraces[curr_race]->time.y, 0);
        info += "   " + Float_StrN (eraces[curr_race]->time.z, 0);
        info += "  " + Trans.Text(14);
        FT.DrawString (CENTER, framebottom+15+ddd, info);

    } else if (ready == 1) {		// cup successfully finished
        FT.AutoSizeN (5);
        FT.SetColor (colWhite);
        FT.DrawString (CENTER, messtop, Trans.Text(16));
        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);
        int res = resultlevel(curr_bonus, ecup->num_races);
        FT.DrawString (CENTER, messtop2, Trans.Text(17) + "  "+Int_StrN (res));
    } else if (ready == 2) {		// cup finished but failed
        FT.AutoSizeN (5);
        FT.SetColor (colLRed);
        FT.DrawString (CENTER, messtop, Trans.Text(18));
        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);
        FT.DrawString (CENTER, messtop2, Trans.Text(19));
    }
    if (ready < 1) {
        PrintTextButton (0, curr_focus);
        PrintTextButton (1, curr_focus);
    } else PrintTextButton (2, curr_focus);

    if (param.ice_cursor) DrawCursor ();
    SDL_GL_SwapBuffers ();
}