コード例 #1
0
ファイル: cg_draw_hud.c プロジェクト: sxweet/etlegacy
/*
=====================
CG_DrawUpperRight
=====================
*/
void CG_DrawUpperRight(void)
{
	int y = 152; // 20 + 100 + 32;

	if (cg_drawFireteamOverlay.integer && CG_IsOnFireteam(cg.clientNum))
	{
		CG_DrawFireTeamOverlay(&activehud->fireteam.location);
	}

	if (!(cg.snap->ps.pm_flags & PMF_LIMBO) && (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR) &&
	    (cgs.autoMapExpanded || (!cgs.autoMapExpanded && (cg.time - cgs.autoMapExpandTime < 250.f))))
	{
		return;
	}

	if (cg_drawRoundTimer.integer)
	{
		y = CG_DrawTimer(y);
	}

	if (cg_drawFPS.integer)
	{
		y = CG_DrawFPS(y);
	}

	if (cg_drawSnapshot.integer)
	{
		y = CG_DrawSnapshot(y);
	}
}
コード例 #2
0
static void CG_DrawMiniMap ( menuDef_t *menuHUD, vec4_t opacity )
{
    itemDef_t *focusItem;

    if (!menuHUD)
	{
	    return;
	}	

	// Render the minimap
	// Use a default fixed radius of 500 units for now
	MiniMap_Render(menuHUD, 1500.0f);

	focusItem = Menu_FindItemByName(menuHUD, "frame");
	if (focusItem)
	{
		trap_R_SetColor(opacity);
		CG_DrawPic( 
			focusItem->window.rect.x, 
			focusItem->window.rect.y, 
			focusItem->window.rect.w, 
			focusItem->window.rect.h, 
			focusItem->window.background 
			);			
	}

	//Render the credit display
	focusItem = Menu_FindItemByName(menuHUD, "credits");
	if (focusItem)
	{
		trap_R_SetColor(opacity);
		trap_R_Font_DrawString(focusItem->window.rect.x, focusItem->window.rect.y, va("Credits: %i", cg.predictedPlayerState.persistant[PERS_CREDITS]), opacity, cgDC.Assets.qhSmall3Font, -1, focusItem->textscale);
	}

	focusItem = Menu_FindItemByName(menuHUD, "smalltext");
	if(focusItem)
	{
		char buffer[1024];
		int mins, sec, msec;
		int numberItems = 0;
		buffer[0] = '\0';
		trap_R_SetColor(opacity);
		if(cg_drawTimer.integer == 1 || cg_drawTimer.integer == 3)
		{
			//Draw server time
			msec = cg.time - cgs.levelStartTime;
			sec = msec/1000;

			//Convert to mm:ss format
			mins = floor((float)sec/60);
			sec -= (mins * 60);

			strcat(buffer, va("Timer: %.2i:%.2i ", mins, sec));
			numberItems++;
		}
		if(cg_drawTimer.integer == 2 || cg_drawTimer.integer == 3)
		{
			//Add a slash
			if(numberItems > 0)
			{
				strcat(buffer, "/ ");
				numberItems++;
			}
			if(T_meridiem())
			{
				strcat(buffer, va("Clock: %.2i:%.2i PM ", T_hour(qfalse), T_minute()));
			}
			else
			{
				strcat(buffer, va("Clock: %.2i:%.2i AM ", T_hour(qfalse), T_minute()));
			}
		}

		//TODO: Add more s***e

		//strcat(buffer, '\0');

		trap_R_Font_DrawString(focusItem->window.rect.x, focusItem->window.rect.y, buffer, opacity, cgDC.Assets.qhSmall3Font, -1, focusItem->textscale);
	}

	if(cg_drawFPS.integer > 0)
	{
		focusItem = Menu_FindItemByName(menuHUD, "fps");
		if(focusItem)
		{
			CG_DrawFPS(focusItem->window.rect.x, focusItem->window.rect.y, focusItem->window.rect.w, focusItem->window.rect.h, focusItem->iMenuFont, focusItem->textscale);
		}
	}
}