Example #1
0
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();
}
Example #2
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 ();
}