Example #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();
} 
Example #2
0
void TestLoop (double timestep) {
	check_gl_error();

	// ------------- 3d scenery ---------------------------------------
	set_gl_options (TUX);
    ClearRenderContext (colDDBackgr);

	glLoadIdentity ();
	glPushMatrix ();
 	SetTestLight ();

/*
	glTranslatef (xposition, yposition, zposition);	
	glRotatef (xrotation, 1, 0, 0);
	glRotatef (yrotation, 0, 1, 0);
	glRotatef (zrotation, 0, 0, 1);
*/
	glPopMatrix ();

	// --------------- 2d screen --------------------------------------
	SetupGuiDisplay ();
	set_gl_options (TEXFONT);
	FT.SetFont ("bold");
	FT.SetSize (24);
	FT.SetColor (colWhite);
	FT.DrawString (CENTER, 10, "Test screen");
	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers ();
} 
Example #3
0
void CreditsLoop (double time_step) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;
	
	Music.Update ();    
	check_gl_error();
    ClearRenderContext ();
    set_gl_options (GUI);
    SetupGuiDisplay ();

//	DrawBackLogo (-1,  AutoYPos (200), 1.0);
	DrawCreditsText (time_step);
	if (param.ui_snow) {
		update_ui_snow (time_step);
		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), param.scale);
	

	Reshape (ww, hh);
    Winsys.SwapBuffers();
}
Example #4
0
void CCredits::Loop() {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

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

	DrawCreditsText ();
	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);


	Reshape (ww, hh);
	Winsys.SwapBuffers();
}
static void GameSelectLoop (double time_step) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;

	check_gl_error();
	Music.Update ();    
    set_gl_options (GUI);
    ClearRenderContext ();
    SetupGuiDisplay ();
    
	if (param.ui_snow) {
		update_ui_snow (time_step);
		draw_ui_snow();
    }

	Tex.Draw (T_TITLE, 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);

	PrintTextButton (0, scope);
	PrintTextButton (1, scope);
	PrintTextButton (2, scope);
	PrintTextButton (3, scope);
	PrintTextButton (4, scope);
	PrintTextButton (5, scope);
	PrintTextButton (6, scope);

	if (param.ice_cursor) DrawCursor ();
	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Example #6
0
void CHelp::Loop(double timestep) {
	Music.Update ();
	check_gl_error();
    ClearRenderContext ();
	ScopedRenderMode rm(GUI);
    SetupGuiDisplay ();

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

	FT.AutoSizeN (4);
	FT.SetColor (colWhite);
	FT.DrawString (xleft1, AutoYPosN (5), Trans.Text (57));

	FT.AutoSizeN (3);
	int offs = FT.AutoDistanceN (2);
	FT.DrawString (xleft1, ytop, Trans.Text(44));
	FT.DrawString (xleft1, ytop + offs, Trans.Text(45));
	FT.DrawString (xleft1, ytop + offs * 2, Trans.Text(46));
	FT.DrawString (xleft1, ytop + offs * 3, Trans.Text(47));
	FT.DrawString (xleft1, ytop + offs * 4, Trans.Text(48));
	FT.DrawString (xleft1, ytop + offs * 5, Trans.Text(49));
	FT.DrawString (xleft1, ytop + offs * 6, Trans.Text(50));
	FT.DrawString (xleft1, ytop + offs * 7, Trans.Text(51));
	FT.DrawString (xleft1, ytop + offs * 8,Trans.Text(52));
	FT.DrawString (xleft1, ytop + offs * 9, Trans.Text(53));
	FT.DrawString (xleft1, ytop + offs * 10, Trans.Text(54));
	FT.DrawString (xleft1, ytop + offs * 11, Trans.Text(55));
	FT.DrawString (xleft1, ytop + offs * 12, Trans.Text(56));

	FT.DrawString (CENTER, AutoYPosN (90), Trans.Text(65));
    Winsys.SwapBuffers();
}
Example #7
0
void RenderSingleFrame (double timestep) {
	if (!must_render) return;
	check_gl_error ();

	// ------------------ 3d scenery ----------------------------------
	set_gl_options (TUX);
    ClearRenderContext (colDDBackgr);

	string hlname = TestFrame.GetHighlightName (curr_joint);
	TestChar.highlight_node = TestChar.GetNodeName (hlname);

	glPushMatrix ();
 	SetToolLight ();
	GluCamera.Update (timestep);

	TestFrame.CalcKeyframe (curr_frame, &TestChar, ref_position);
	TestChar.Draw ();
	glPopMatrix ();

	// ----------------- 2d screen ------------------------------------
	SetupGuiDisplay ();
	set_gl_options (TEXFONT);

	if (FrameHasChanged ()) DrawChanged ();

	FT.SetFont ("bold");
	FT.SetSize (20);
	FT.SetColor (colYellow);
	FT.DrawString (-1, 10, "Keyframe mode");

	FT.SetFont ("normal");
	FT.SetSize (16);
	int xl, yt;
	for (int i=0; i<TestFrame.numFrames; i++) {
		if (i != curr_frame) {
			FT.SetColor (colLGrey); 
			FT.SetFont ("normal");
		} else {
			FT.SetColor (colYellow);
			FT.SetFont ("bold");
		}
		xl = ITrunc (i, framebase) * 100 + 20;
		yt = IFrac (i, framebase) * 18 + 20;
		FT.DrawString (xl, yt, Int_StrN (i));		
	}

	FT.SetFont ("normal");
	FT.SetColor (colLGrey); 
	PrintFrameParams (param.y_resolution - 330, TestFrame.GetFrame (curr_frame));

	if (ToolsFinalStage ()) {
		FT.SetSize (20);
		FT.SetColor (colYellow);
		FT.DrawString (-1, param.y_resolution - 50, "Quit program. Save character list (y/n)");
	}

	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers();
	must_render = false;
}
Example #8
0
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 ();
}
Example #9
0
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();
}
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();
}
Example #11
0
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();
}
void CGameConfig::Loop () {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	Music.Update ();

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

	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);

	FT.AutoSizeN (4);

	FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top, Trans.Text(86));
	FT.DrawString (area.left, area.top + dd, Trans.Text(94));
	FT.DrawString (area.left, area.top + dd * 2, Trans.Text(33));
	FT.DrawString (area.left, area.top + dd * 3, Trans.Text(34));
	FT.DrawString (area.left, area.top + dd * 4, Trans.Text(36));
	FT.DrawString (area.left, area.top + dd * 5, Trans.Text(35));

	FT.DrawString (area.left+240, area.top, Trans.Text(87 + vid_orient->GetValue()));
	FT.DrawString (area.left+240, area.top + dd, Float_StrN(sensit->GetValue() / 10.0f, 1));
	FT.DrawString (area.left+240, area.top + dd * 2, Int_StrN (mus_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 3, Int_StrN (sound_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 4, Int_StrN (detail_level->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 5, Trans.languages[language->GetValue()].language);

	DrawGUI();

	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Example #13
0
// -------------------------------------------------------
void DrawHud (const CControl *ctrl) {
	if (!param.show_hud)
		return;

	ETR_DOUBLE speed = ctrl->cvel.Length();
	SetupGuiDisplay ();

	//draw_gauge (speed * 3.6, ctrl->jump_amt);
	ScopedRenderMode rm(TEXFONT);
	draw_time();
	draw_herring_count (g_game.herring);
	DrawSpeed (speed * 3.6);
	DrawFps ();
	DrawCoursePosition (ctrl);
	DrawWind (Wind.Angle (), Wind.Speed (), ctrl);
}
Example #14
0
// -------------------------------------------------------
void DrawHud (CControl *ctrl) {
    TVector3 vel;
    double speed;

	if (!param.show_hud) return;
    vel = ctrl->cvel;
    speed = NormVector (&vel);
    SetupGuiDisplay ();

    draw_gauge (speed * 3.6, ctrl->jump_amt);
	set_gl_options (TEXFONT);
	glColor4f (1, 1, 1, 1);
    draw_time();
    draw_herring_count (g_game.herring);
    DrawSpeed (speed * 3.6);
	DrawFps ();
	DrawCoursePosition (ctrl);
	if (g_game.wind_id > 0) DrawWind2 (Wind.Angle (), Wind.Speed (), ctrl);
}
Example #15
0
void GameOverLoop (double time_step) {
    CControl *ctrl = Players.GetCtrl (g_game.player_id);
    int width, height;
    width = param.x_resolution;
    height = param.y_resolution;
    check_gl_error();

    Music.Update ();

    ClearRenderContext ();
    Env.SetupFog ();

    update_view (ctrl, 0);

    if (final_frame != NULL) final_frame->Update (time_step, ctrl);

    SetupViewFrustum (ctrl);
    Env.DrawSkybox (ctrl->viewpos);
    Env.DrawFog ();
    Env.SetupLight ();

    RenderCourse ();
    DrawTrackmarks ();
    DrawTrees ();

    UpdateWind (time_step, ctrl);
    UpdateSnow (time_step, ctrl);
    DrawSnow (ctrl);

    Char.Draw (g_game.char_id);

    set_gl_options (GUI);
    SetupGuiDisplay ();
    if (final_frame != NULL) {
        if (!final_frame->active) GameOverMessage (ctrl);
    } else GameOverMessage (ctrl);
    DrawHud (ctrl);
    Reshape (width, height);
    Winsys.SwapBuffers ();
}
void CNewPlayer::Loop() {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;
	TColor col;

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

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

	textfield->UpdateCursor();

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

	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);

	FT.SetColor (colWhite);
	FT.AutoSizeN (4);
	FT.DrawString (CENTER, AutoYPosN (30), Trans.Text(66));

	if (avatar->focussed()) col = colDYell;
	else col = colWhite;
	Players.GetAvatarTexture(avatar->GetValue())->DrawFrame(
	    prevleft, prevtop, prevwidth, prevwidth, 2, col);

	DrawGUI();
	Winsys.SwapBuffers();
}
Example #17
0
void SplashLoop (double /*timestep*/){
	Music.Update ();    
	check_gl_error();
	ClearRenderContext ();
	set_gl_options (GUI);
	SetupGuiDisplay ();


//	FT.SetFont ("normal");
	Tex.Draw (TEXLOGO, CENTER, 60, param.scale);
	FT.SetColor (colDYell);
	FT.AutoSizeN (6);
	int top = AutoYPosN (60);
	int dist = FT.AutoDistanceN (3);
	FT.DrawText (CENTER, top, "Loading resources,");
	FT.DrawText (CENTER, top+dist, "please wait ...");


	if (param.ice_cursor) DrawCursor ();
    Winsys.SwapBuffers();

	Trans.LoadLanguages ();
	Trans.LoadTranslations (param.language);
	LoadCreditList ();
	Char.LoadCharacterList ();
	Course.LoadObjectTypes (); 
	Course.LoadTerrainTypes ();
	Env.LoadEnvironmentList ();
	Course.LoadCourseList ();
	Score.LoadHighScore (); // after LoadCourseList !!!
	Events.LoadEventList ();
	Players.LoadAvatars (); // before LoadPlayers !!!
	Players.LoadPlayers ();

	Winsys.Delay (10);
	Winsys.SetMode (REGIST);
} 
Example #18
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();
}
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();
}
void CGameConfig::Loop () {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	Music.Update ();

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

	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);

	FT.AutoSizeN (4);

#ifndef PANDORA
	if (resolution->focussed()) FT.SetColor (colDYell);
	else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd, Trans.Text(32));
#endif
	if (mus_vol->focussed()) FT.SetColor (colDYell);
	else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*2, Trans.Text(33));
	if (sound_vol->focussed()) FT.SetColor (colDYell);
	else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*3, Trans.Text(34));
	if (detail_level->focussed()) FT.SetColor (colDYell);
	else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*4, Trans.Text(36));
	if (language->focussed()) FT.SetColor (colDYell);
	else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*5, Trans.Text(35));

	FT.SetColor (colWhite);
#ifndef PANDORA
	FT.DrawString (area.left+240, area.top + dd, res_names[resolution->GetValue()]);
#endif
	FT.DrawString (area.left+240, area.top + dd*2, Int_StrN (mus_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd*3, Int_StrN (sound_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd*4, Int_StrN (detail_level->GetValue()));
	FT.DrawString (area.left+240, area.top + dd*5, Trans.languages[language->GetValue()].language);

#if defined (_WIN32)
	if (fullscreen->checked != param.fullscreen) {
		FT.SetColor (colDYell);
		FT.AutoSizeN (4);
		FT.DrawString (CENTER, AutoYPosN (68), Trans.Text(84));
		FT.DrawString (CENTER, AutoYPosN (72), Trans.Text(85));
	} else {
		FT.SetColor (colLGrey);
		FT.AutoSizeN (3);
		FT.DrawString (CENTER, AutoYPosN (68), Trans.Text(41));
		FT.DrawString (CENTER, AutoYPosN (72), Trans.Text(42));
	}
#else
#ifndef PANDORA
	FT.SetColor (colWhite);
	FT.AutoSizeN (3);
	FT.DrawString (CENTER, AutoYPosN (68), Trans.Text(41));
	FT.DrawString (CENTER, AutoYPosN (72), Trans.Text(42));
#endif
#endif

	DrawGUI();

	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Example #21
0
void GameConfigLoop (double time_step) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;

	Music.Update ();    
			
	check_gl_error();
	Music.Update ();    
    set_gl_options (GUI);
    ClearRenderContext ();
    SetupGuiDisplay ();
    
	if (param.ui_snow) {
		update_ui_snow (time_step);
		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);

	FT.AutoSizeN (4);
	PrintCheckbox (0, curr_focus, curr_fullscreen);

	if (curr_focus == 1) FT.SetColor (colDYell); else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd, Trans.Text(32));
	if (curr_focus == 2) FT.SetColor (colDYell); else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*2, Trans.Text(33));
	if (curr_focus == 3) FT.SetColor (colDYell); else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*3, Trans.Text(34));
	if (curr_focus == 4) FT.SetColor (colDYell); else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*4, Trans.Text(36));
	if (curr_focus == 5) FT.SetColor (colDYell); else FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top + dd*5, Trans.Text(35));

	FT.SetColor (colWhite);
	FT.DrawString (area.left+240, area.top + dd, res_names[curr_res]);
	FT.DrawString (area.left+240, area.top + dd*2, Int_StrN (curr_mus_vol));
	FT.DrawString (area.left+240, area.top + dd*3, Int_StrN (curr_sound_vol));
	FT.DrawString (area.left+240, area.top + dd*4, Int_StrN (curr_detail_level));
	FT.DrawString (area.left+240, area.top + dd*5, LangList[curr_language].language);

	PrintArrow (0, (curr_res < (NUM_RESOLUTIONS-1)));
	PrintArrow (1, (curr_res > 0));	
	PrintArrow (2, (curr_mus_vol < 120));
	PrintArrow (3, (curr_mus_vol > 0));	
	PrintArrow (4, (curr_sound_vol < 120));
	PrintArrow (5, (curr_sound_vol > 0));	
	PrintArrow (6, (curr_detail_level < 3));
	PrintArrow (7, (curr_detail_level > 1));	
	PrintArrow (8, (curr_language > 0));	
 	PrintArrow (9, (curr_language < lastLang));
	
	PrintTextButton (0, curr_focus);
	PrintTextButton (1, curr_focus);

	#if defined (OS_WIN32_MINGW)
		if ((curr_res != prev_res || curr_fullscreen != prev_fullscreen) &&
		param.restart_on_res_change) {
			FT.SetColor (colDYell);
			FT.AutoSizeN (4);
			FT.DrawString (CENTER, AutoYPosN (68), "The video adjustments have changed,");
			FT.DrawString (CENTER, AutoYPosN (72), "You need to restart the game");
		} else {
			FT.SetColor (colLGrey);
			FT.AutoSizeN (3);
			FT.DrawString (CENTER, AutoYPosN (68), Trans.Text(41));
			FT.DrawString (CENTER, AutoYPosN (72), Trans.Text(42));
		}
	#else 
		FT.SetColor (colWhite);
		FT.AutoSizeN (3);
		FT.DrawString (CENTER, AutoYPosN (68), Trans.Text(41));
		FT.DrawString (CENTER, AutoYPosN (72), Trans.Text(42));
	#endif

	if (param.ice_cursor) DrawCursor ();
	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Example #22
0
void RenderChar (double timestep) {
	if (!must_render) return;
	bool is_visible = false;
	check_gl_error();

	// ------------- 3d scenery ---------------------------------------
	set_gl_options (TUX);
    ClearRenderContext (colDDBackgr);
	TestChar.highlight_node = TestChar.GetNodeName (curr_node);

	glLoadIdentity ();
	glPushMatrix ();
 	SetToolLight ();

	TestChar.ResetRoot ();
	TestChar.ResetJoints ();
	glTranslatef (xposition, yposition, zposition);	
	glRotatef (xrotation, 1, 0, 0);
	glRotatef (yrotation, 0, 1, 0);
	glRotatef (zrotation, 0, 0, 1);

	if (drawcount > 0) TestChar.Draw ();
	glPopMatrix ();
	drawcount++;

	// --------------- 2d screen --------------------------------------
	SetupGuiDisplay ();
	set_gl_options (TEXFONT);

	FT.SetFont ("bold");
	FT.SetSize (20);
	FT.SetColor (colYellow);
	FT.DrawString (-1, 10, "Edit mode");

	if (CharHasChanged ()) DrawChanged ();

	FT.SetFont ("normal");
	FT.SetSize (16);
	int xl, yt;
	for (int i=0; i<=lastnode; i++) {
		if (i != curr_node) {
			FT.SetColor (colLGrey); 
			FT.SetFont ("normal");
		} else {
			FT.SetColor (colYellow);
			FT.SetFont ("bold");
		}
		xl = ITrunc (i, charbase) * 100 + 20;
		yt = IFrac (i, charbase) * 18 + 60;
		FT.DrawString (xl, yt, TestChar.GetNodeJoint (i));		
	}

	int num = action->num;
	int type;
	if (num > 0) {
		for (int i=0; i<num; i++) {
			is_visible = false;
			type = action->type[i];
			yt = param.y_resolution - 120 + i * 18;
			switch (type) {
				case 0: DrawActionVec (i, "trans", yt, action->vec[i]); break;
				case 1: DrawActionFloat (i, "x-rot", yt, action->dval[i]); break;
				case 2: DrawActionFloat (i, "y-rot", yt, action->dval[i]); break;
				case 3: DrawActionFloat (i, "z-rot", yt, action->dval[i]); break;
				case 4: DrawActionVec (i, "scale", yt, action->vec[i]); break;
				case 5: DrawActionFloat (i, "vis", yt, action->dval[i]); 
					is_visible = true; break;
				default: break;
			}
		}
	}

	if (is_visible) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
	FT.DrawString (20, 20, action->name);

	if (ToolsFinalStage ()) {
		FT.SetSize (20);
		FT.SetColor (colYellow);
		FT.DrawString (-1, param.y_resolution - 50, "Quit program. Save character list (y/n)");
	}

	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers ();
	if (drawcount > 3) must_render = false;
}
Example #23
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 ();
}