您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CG_Text_Width_Ext函数代码示例

51自学网 2021-06-01 20:00:08
  C++
这篇教程C++ CG_Text_Width_Ext函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CG_Text_Width_Ext函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_Text_Width_Ext函数的具体用法?C++ CG_Text_Width_Ext怎么用?C++ CG_Text_Width_Ext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CG_Text_Width_Ext函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CG_LoadPanel_RenderCampaignNameText

void CG_LoadPanel_RenderCampaignNameText(panel_button_t *button){    const char *cs;    float      w;    float      scaleF;    if (cgs.gametype == GT_WOLF_CAMPAIGN)    {        cs = DC->nameForCampaign();        if (!cs)        {            return;        }        cs = va("%s %iof%i", cs, cgs.currentCampaignMap + 1, cgs.campaignData.mapCount);        scaleF = campaignNameTextScaleFactor(Q_PrintStrlen(cs));        w = CG_Text_Width_Ext(cs, button->font->scalex * scaleF, 0, button->font->font);        CG_Text_Paint_Ext(button->rect.x + (button->rect.w - w) * 0.5f, button->rect.y, button->font->scalex * scaleF, button->font->scaley * scaleF, button->font->colour, cs, 0, 0, 0, button->font->font);    }    else    {        if (!cgs.arenaInfoLoaded)        {            return;        }        scaleF = campaignNameTextScaleFactor(Q_PrintStrlen(cgs.arenaData.longname)); // FIXME: up to 128 chars !        w = CG_Text_Width_Ext(cgs.arenaData.longname, button->font->scalex * scaleF, 0, button->font->font);        CG_Text_Paint_Ext(button->rect.x + (button->rect.w - w) * 0.5f, button->rect.y, button->font->scalex * scaleF, button->font->scaley * scaleF, button->font->colour, cgs.arenaData.longname, 0, 0, 0, button->font->font);    }}
开发者ID:rafal1137,项目名称:etlegacy,代码行数:35,


示例2: CG_LoadPanel_RenderCampaignNameText

void CG_LoadPanel_RenderCampaignNameText( panel_button_t* button ) {	const char* cs;	float w;	//char buffer[1024];	//int gametype;	//DC->getConfigString( CS_SERVERINFO, buffer, sizeof( buffer ) );	//cs = Info_ValueForKey( buffer, "g_gametype" );	//gametype = atoi(cs);	if( cgs.gametype == GT_WOLF_CAMPAIGN ) {		cs = DC->nameForCampaign();		if( !cs ) {			return;		}		cs = va( "%s %iof%i", cs, cgs.currentCampaignMap+1, cgs.campaignData.mapCount );		w = CG_Text_Width_Ext( cs, button->font->scalex, 0, button->font->font );		CG_Text_Paint_Ext( button->rect.x + (button->rect.w - w)*0.5f, button->rect.y, button->font->scalex, button->font->scaley, button->font->colour, cs, 0, 0, 0, button->font->font );	} else {		if( !cgs.arenaInfoLoaded ) {			return;		}		w = CG_Text_Width_Ext( cgs.arenaData.longname, button->font->scalex, 0, button->font->font );		CG_Text_Paint_Ext( button->rect.x + (button->rect.w - w)*0.5f, button->rect.y, button->font->scalex, button->font->scaley, button->font->colour, cgs.arenaData.longname, 0, 0, 0, button->font->font );			}}
开发者ID:GenaSG,项目名称:ET,代码行数:32,


示例3: CG_ViewingDraw

qboolean CG_ViewingDraw() {	if ( cg.mvTotalClients < 1 ) {		return( qfalse );	} else {		int w, wTag;		int tSpacing = 15;      // Should derive from CG_Text_Height_Ext		int pID = cg.mvCurrentMainview->mvInfo & MV_PID;		char *viewInfo = "Viewing:";		wTag = CG_Text_Width_Ext( viewInfo, VD_SCALE_X_HDR, 0, FONT_HEADER );		w = wTag + 3 + CG_Text_Width_Ext( cgs.clientinfo[pID].name, VD_SCALE_X_NAME, 0, FONT_TEXT );		CG_DrawRect( VD_X - 2, VD_Y, w + 7, tSpacing + 4, 1, color_border );		CG_FillRect( VD_X - 2, VD_Y, w + 7, tSpacing + 4, color_bg );		CG_Text_Paint_Ext( VD_X, VD_Y + tSpacing,            // x, y						   VD_SCALE_X_HDR, VD_SCALE_Y_HDR,  // scale_x, scale_y						   color_hdr,						   viewInfo,						   0.0f, 0,						   ITEM_TEXTSTYLE_SHADOWED,						   FONT_HEADER );		CG_Text_Paint_Ext( VD_X + wTag + 5, VD_Y + tSpacing, // x, y						   VD_SCALE_X_NAME, VD_SCALE_Y_NAME, // scale_x, scale_y						   color_name,						   cgs.clientinfo[pID].name,						   0.0f, 0,						   ITEM_TEXTSTYLE_SHADOWED,						   FONT_TEXT );		return( qtrue );	}}
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:35,


示例4: CG_PanelButton_RenderEdit

void CG_PanelButton_RenderEdit( panel_button_t* button ) {	qboolean useCvar = button->data[0] ? qfalse : qtrue;	int offset = -1;	if( useCvar ) {		char buffer[256 + 1];		trap_Cvar_VariableStringBuffer( button->text, buffer, sizeof(buffer) );		if( cg_focusButton == button && ((cg.time / 1000) % 2)) {			if( trap_Key_GetOverstrikeMode() )				Q_strcat( buffer, sizeof(buffer), "^0|" );			else				Q_strcat( buffer, sizeof(buffer), "^0_" );		} else {			Q_strcat( buffer, sizeof(buffer), " " );		}		do {			offset++;			if( buffer + offset  == '/0' )				break;		} while( CG_Text_Width_Ext( buffer + offset, button->font->scalex, 0, button->font->font ) > button->rect.w );		CG_Text_Paint_Ext( button->rect.x, button->rect.y + button->rect.h, button->font->scalex, button->font->scaley, button->font->colour, va( "^7%s", buffer + offset ), 0, 0, button->font->style, button->font->font );	//	CG_FillRect( button->rect.x, button->rect.y, button->rect.w, button->rect.h, colorRed );	} else {		int maxlen = button->data[0];		char *s;		if( cg_focusButton == button && ((cg.time / 1000) % 2)) {			if( trap_Key_GetOverstrikeMode() )				s = va( "^7%s^0|", button->text );			else				s = va( "^7%s^0_", button->text );		} else {			s = va( "^7%s ", button->text );	// space hack to make the text not blink		}		do {			offset++;			if( s + offset  == '/0' )				break;		} while( CG_Text_Width_Ext( s + offset, button->font->scalex, 0, button->font->font ) > button->rect.w );		CG_Text_Paint_Ext( button->rect.x, button->rect.y + button->rect.h, button->font->scalex, button->font->scaley, button->font->colour, s + offset, 0, 0, button->font->style, button->font->font );	//	CG_FillRect( button->rect.x, button->rect.y, button->rect.w, button->rect.h, colorRed );	}}
开发者ID:rabb,项目名称:eth32nix-rabbmod,代码行数:50,


示例5: CG_DrawPMItemsBig

void CG_DrawPMItemsBig(void){	vec4_t colour     = { 0.f, 0.f, 0.f, 1.f };	vec4_t colourText = { 1.f, 1.f, 1.f, 1.f };	float  t;	float  y = 270;	float  w;	if (!cg_pmWaitingListBig)	{		return;	}	t = cg_pmWaitingListBig->time + PM_BIGPOPUP_TIME + PM_WAITTIME_BIG;	if (cg.time > t)	{		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME_BIG);	}	trap_R_SetColor(colourText);	CG_DrawPic(Ccg_WideX(SCREEN_WIDTH) - 56, y, 48, 48, cg_pmWaitingListBig->shader);	trap_R_SetColor(NULL);	w = CG_Text_Width_Ext(cg_pmWaitingListBig->message, 0.22f, 0, &cgs.media.limboFont2);	CG_Text_Paint_Ext(Ccg_WideX(SCREEN_WIDTH) - 4 - w, y + 56, 0.22f, 0.24f, colourText, cg_pmWaitingListBig->message, 0, 0, 0, &cgs.media.limboFont2);}
开发者ID:MartijnB,项目名称:ETGoldy,代码行数:27,


示例6: CG_LimboPanel_ClassBar_Draw

void CG_LimboPanel_ClassBar_Draw(panel_button_t *button) {	const char *text = NULL;	char       buffer[64];	float      w;	if (CG_LimboPanel_GetTeam() == TEAM_SPECTATOR) {		text = "JOIN A TEAM";	} else if (BG_CursorInRect(&classButton0.rect)) {		text = BG_ClassnameForNumber(0);	} else if (BG_CursorInRect(&classButton1.rect)) {		text = BG_ClassnameForNumber(1);	} else if (BG_CursorInRect(&classButton2.rect)) {		text = BG_ClassnameForNumber(2);	} else if (BG_CursorInRect(&classButton3.rect)) {		text = BG_ClassnameForNumber(3);	} else if (BG_CursorInRect(&classButton4.rect)) {		text = BG_ClassnameForNumber(4);	}	if (!text) {		text = BG_ClassnameForNumber(CG_LimboPanel_GetClass());	}	Q_strncpyz(buffer, text, sizeof (buffer));	Q_strupr(buffer);	w = CG_Text_Width_Ext(buffer, button->font->scalex, 0, button->font->font);	CG_Text_Paint_Ext(button->rect.x + (button->rect.w - w) * 0.5f, button->rect.y, button->font->scalex, button->font->scaley, button->font->colour, buffer, 0, 0, button->font->style, button->font->font);}
开发者ID:ETrun,项目名称:ETrun,代码行数:29,


示例7: CG_DrawPMItemsBig

void CG_DrawPMItemsBig( void ) {	vec4_t colour = { 0.f, 0.f, 0.f, 1.f };	vec4_t colourText = { 1.f, 1.f, 1.f, 1.f };	float t;	float y = 270;	float w;	if( !cg_pmWaitingListBig ) {		return;	}	if (!tj_drawCPM.integer)		return;	t = cg_pmWaitingListBig->time + CG_TimeForBigPopup( cg_pmWaitingListBig->type ) + PM_WAITTIME_BIG;	if( cg.time > t ) {		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME_BIG);	}	trap_R_SetColor( colourText );	CG_DrawPic( 640 - 56, y, 48, 48, cg_pmWaitingListBig->shader );	trap_R_SetColor( NULL );	w = CG_Text_Width_Ext( cg_pmWaitingListBig->message, 0.22f, 0, &cgs.media.limboFont2 );	CG_Text_Paint_Ext( 640 - 4 - w, y + 56, 0.22f, 0.24f, colourText, cg_pmWaitingListBig->message, 0, 0, 0, &cgs.media.limboFont2 );}
开发者ID:leakcim1324,项目名称:ETrun,代码行数:27,


示例8: CG_DrawTimer

/*=================CG_DrawTimer=================*/static float CG_DrawTimer(float y){	char   *s;	int    w, w2;	vec4_t color = { 0.625f, 0.625f, 0.6f, 1.0f };	int    tens;	char   *rt = (cgs.gametype != GT_WOLF_LMS && (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR || cg.snap->ps.pm_flags & PMF_FOLLOW) && cg_drawReinforcementTime.integer > 0) ?	             va("^F%d%s", CG_CalculateReinfTime(qfalse), ((cgs.timelimit <= 0.0f) ? "" : " ")) : "";	int x;	int msec    = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime);	int seconds = msec / 1000;	int mins    = seconds / 60;	seconds -= mins * 60;	tens     = seconds / 10;	seconds -= tens * 10;	if (cgs.gamestate != GS_PLAYING)	{		s        = va("^7%s", CG_TranslateString("WARMUP")); // don't draw reinforcement time in warmup mode // ^*		color[3] = fabs(sin(cg.time * 0.002));	}	else if (msec < 0 && cgs.timelimit > 0.0f)	{		s        = "^N0:00";		color[3] = fabs(sin(cg.time * 0.002));	}	else	{		if (cgs.timelimit <= 0.0f)		{			s = va("%s", rt);		}		else		{			s = va("%s^7%i:%i%i", rt, mins, tens, seconds);  // ^*		}		color[3] = 1.f;	}	// spawntimer	seconds = msec / 1000;	if (cg_spawnTimer_set.integer != -1 && cg_spawnTimer_period.integer > 0)	{		s = va("^1%d %s", cg_spawnTimer_period.integer + (seconds - cg_spawnTimer_set.integer) % cg_spawnTimer_period.integer, s);	}	// end spawntimer	w  = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1);	w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w;	x = Ccg_WideX(UPPERRIGHT_X) - w2 - 2;	CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background);	CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border);	CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, color, s, 0, 0, 0, &cgs.media.limboFont1);	return y + 12 + 4;}
开发者ID:sxweet,项目名称:etlegacy,代码行数:65,


示例9: CG_DrawPlayerHealth

static void CG_DrawPlayerHealth(float x, float y){	const char *str = va("%i", cg.snap->ps.stats[STAT_HEALTH]);	float      w    = CG_Text_Width_Ext(str, 0.25f, 0, &cgs.media.limboFont1);	CG_Text_Paint_Ext(x - w, y, 0.25f, 0.25f, colorWhite, str, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);	CG_Text_Paint_Ext(x + 2, y, 0.2f, 0.2f, colorWhite, "HP", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);}
开发者ID:sxweet,项目名称:etlegacy,代码行数:8,


示例10: CG_FitTextToWidth_Ext

void CG_FitTextToWidth_Ext(char *instr, float scale, float w, int size, fontInfo_t * font){	char            buffer[1024];	char           *s, *p, *c, *ls;	int             l;	Q_strncpyz(buffer, instr, 1024);	memset(instr, 0, size);	c = s = instr;	p = buffer;	ls = NULL;	l = 0;	while(*p)	{		*c = *p++;		l++;		if(*c == ' ')		{			ls = c;		}						// store last space, to try not to break mid word		c++;		if(*p == '/n')		{			s = c + 1;			l = 0;		}		else if(CG_Text_Width_Ext(s, scale, 0, font) > w)		{			if(ls)			{				*ls = '/n';				s = ls + 1;			}			else			{				*c = *(c - 1);				*(c - 1) = '/n';				s = c++;			}			ls = NULL;			l = 0;		}	}	if(c != buffer && (*(c - 1) != '/n'))	{		*c++ = '/n';	}	*c = '/0';}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:56,


示例11: CG_DrawSnapshot

/*==================CG_DrawSnapshot==================*/static float CG_DrawSnapshot(float y){	char *s = va("t:%i sn:%i cmd:%i", cg.snap->serverTime, cg.latestSnapshotNum, cgs.serverCommandSequence);	int  w  = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1);	int  w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w;	int  x  = Ccg_WideX(UPPERRIGHT_X) - w2 - 2;	CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background);	CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border);	CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, HUD_Text, s, 0, 0, 0, &cgs.media.limboFont1);	return y + 12 + 4;}
开发者ID:sxweet,项目名称:etlegacy,代码行数:17,


示例12: CG_DrawAmmoCount

static void CG_DrawAmmoCount(float x, float y){	int  value, value2, value3;	char buffer[32];	// Draw ammo	CG_PlayerAmmoValue(&value, &value2, &value3);	if (value3 >= 0)	{		Com_sprintf(buffer, sizeof(buffer), "%i|%i/%i", value3, value, value2);		CG_Text_Paint_Ext(x - CG_Text_Width_Ext(buffer, .25f, 0, &cgs.media.limboFont1), y, .25f, .25f, colorWhite, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);	}	else if (value2 >= 0)	{		Com_sprintf(buffer, sizeof(buffer), "%i/%i", value, value2);		CG_Text_Paint_Ext(x - CG_Text_Width_Ext(buffer, .25f, 0, &cgs.media.limboFont1), y, .25f, .25f, colorWhite, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);	}	else if (value >= 0)	{		Com_sprintf(buffer, sizeof(buffer), "%i", value);		CG_Text_Paint_Ext(x - CG_Text_Width_Ext(buffer, .25f, 0, &cgs.media.limboFont1), y, .25f, .25f, colorWhite, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);	}}
开发者ID:sxweet,项目名称:etlegacy,代码行数:23,


示例13: WM_DrawInfoLine

static int WM_DrawInfoLine( int x, int y, float fade ) {	int w, defender, winner;	const char *s;	vec4_t tclr =	{ 0.6f,		0.6f,		0.6f,		1.0f };	if ( cg.snap->ps.pm_type != PM_INTERMISSION ) {		return y;	}	w = 360;//	CG_DrawPic( 320 - w/2, y, w, INFO_LINE_HEIGHT, trap_R_RegisterShaderNoMip( "ui/assets/mp_line_strip.tga" ) );	s = CG_ConfigString( CS_MULTI_INFO );	defender = atoi( Info_ValueForKey( s, "defender" ) );	s = CG_ConfigString( CS_MULTI_MAPWINNER );	winner = atoi( Info_ValueForKey( s, "winner" ) );	if ( cgs.currentRound ) {		// first round		s = va( CG_TranslateString( "CLOCK IS NOW SET TO %s!" ), WM_TimeToString( cgs.nextTimeLimit * 60.f * 1000.f ) );	}	else {		// second round		if ( !defender ) {			if ( winner != defender )				s = "ALLIES SUCCESSFULLY BEAT THE CLOCK!";			else				s = "ALLIES COULDN'T BEAT THE CLOCK!";		}		else {			if ( winner != defender )				s = "AXIS SUCCESSFULLY BEAT THE CLOCK!";			else				s = "AXIS COULDN'T BEAT THE CLOCK!";		}		s = CG_TranslateString( s );	}	CG_FillRect( 320 - w/2, y, w, 20, clrUiBar );	CG_DrawRect_FixedBorder( 320 - w/2, y, w, 20, 1, colorBlack );	w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 );	CG_Text_Paint_Ext( 320 - w*0.5f, y + 15, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );//	CG_DrawSmallString( 320 - w/2, ( y + INFO_LINE_HEIGHT / 2 ) - SMALLCHAR_HEIGHT / 2, s, fade );	return y + INFO_LINE_HEIGHT + 6;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:49,


示例14: CG_windowNormalizeOnText

// Set the window width and height based on the windows text/font parametersvoid CG_windowNormalizeOnText( cg_window_t *w ) {    int i, tmp;    if ( w == NULL ) {        return;    }    w->w = 0;    w->h = 0;    if ( !( w->effects & WFX_TRUETYPE ) ) {        w->fontWidth = w->fontScaleX * WINDOW_FONTWIDTH;        w->fontHeight = w->fontScaleY * WINDOW_FONTHEIGHT;    }    for ( i = 0; i < w->lineCount; i++ ) {        if ( w->effects & WFX_TRUETYPE ) {            tmp = CG_Text_Width_Ext( (char*)w->lineText[i], w->fontScaleX, 0, &cgs.media.limboFont2 );        } else {            tmp = CG_DrawStrlen( (char*)w->lineText[i] ) * w->fontWidth;        }        if ( tmp > w->w ) {            w->w = tmp;        }    }    for ( i = 0; i < w->lineCount; i++ ) {        if ( w->effects & WFX_TRUETYPE ) {            w->lineHeight[i] = CG_Text_Height_Ext( (char*)w->lineText[i], w->fontScaleY, 0, &cgs.media.limboFont2 );        } else {            w->lineHeight[i] = w->fontHeight;        }        w->h += w->lineHeight[i] + 3;    }    // Border + margins    w->w += 10;    w->h += 3;    // Set up bottom alignment    if ( w->x < 0 ) {        w->x += 640 - w->w;    }    if ( w->y < 0 ) {        w->y += 480 - w->h;    }}
开发者ID:GgyuB3,项目名称:Enemy-Territory,代码行数:50,


示例15: CG_LimboPanel_WeaponPanel_DrawWeapon

void CG_LimboPanel_WeaponPanel_DrawWeapon(rectDef_t *rect, weapon_t weap, qboolean highlight, const char *ofTxt, qboolean disabled) {	weaponType_t *wt    = WM_FindWeaponTypeForWeapon(weap);	qhandle_t    shader = cgs.media.limboWeaponCard;	int          width  = CG_Text_Width_Ext(ofTxt, 0.2f, 0, &cgs.media.limboFont2);	float        x      = rect->x + rect->w - width - 4;	vec4_t       clr;	if (!wt) {		return;	}	CG_DrawPic(rect->x, rect->y, rect->w, rect->h, shader);	if (wt->desc) {		if (highlight && BG_CursorInRect(rect)) {			Vector4Copy(weaponPanelNameFont.colour, clr);			clr[3] *= 1.5;			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, clr, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);		} else {			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, weaponPanelNameFont.colour, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);		}	}	{		float x2, y2, w, h, s0, s1, t0, t1;		trap_R_SetColor(NULL);		x2 = rect->x;		y2 = rect->y + (rect->h * 0.25f);		CG_LimboPanel_GetWeaponCardIconData(weap, &shader, &w, &h, &s0, &t0, &s1, &t1);		w *= rect->w;		h *= rect->h * 0.75f;		CG_DrawPicST(x2, y2, w, h, s0, t0, s1, t1, shader);		if (disabled) {			vec4_t clr = { 1.f, 1.f, 1.f, 0.6f };			trap_R_SetColor(clr);			CG_DrawPic(x2, y2 + 4 + (h - 16) * 0.5f, w, 16, cgs.media.limboWeaponCardOOS);			trap_R_SetColor(NULL);		}	}	CG_Text_Paint_Ext(x, rect->y + rect->h - 2, 0.2f, 0.2f, colorBlack, ofTxt, 0, 0, 0, &cgs.media.limboFont2);}
开发者ID:ETrun,项目名称:ETrun,代码行数:47,


示例16: CG_demoTimescaleDraw

void CG_demoTimescaleDraw(void){	if (cg.demoPlayback && cgs.timescaleUpdate > cg.time && demo_drawTimeScale.integer != 0)	{		vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f };		vec4_t bdColor = { 0.5f, 0.5f, 0.5f, 0.5f };		char *s = va("^7Time Scale: ^3%.1fx", cg_timescale.value);		int  h  = CG_Text_Height_Ext("A", cg_fontScaleSP.value, 0, &cgs.media.limboFont2);		int  w  = CG_Text_Width_Ext(s, cg_fontScaleSP.value, 0, &cgs.media.limboFont2);		int  x  = Ccg_WideX(SCREEN_WIDTH) - w - 108;		CG_FillRect(x, SCREEN_HEIGHT - 21, w + 7, h * 2.5, bgColor);		CG_DrawRect(x, SCREEN_HEIGHT - 21, w + 7, h * 2.5, 1, bdColor);		CG_Text_Paint_Ext(x + 3, SCREEN_HEIGHT - 10, cg_fontScaleSP.value, cg_fontScaleSP.value, colorWhite, s, 0, 0, 0, &cgs.media.limboFont2);	}}
开发者ID:belstgut,项目名称:etlegacy,代码行数:17,


示例17: CG_StatsDebugAddText

void CG_StatsDebugAddText(const char *text){	if (cg_debugSkills.integer)	{		statsDebugPos++;		if (statsDebugPos >= 6)		{			statsDebugPos = 0;		}		Q_strncpyz(statsDebugStrings[statsDebugPos], text, 512);		statsDebugTime[statsDebugPos]      = cg.time;		statsDebugTextWidth[statsDebugPos] = CG_Text_Width_Ext(text, .15f, 0, &cgs.media.limboFont2);		CG_Printf("%s/n", text);	}}
开发者ID:sxweet,项目名称:etlegacy,代码行数:18,


示例18: CG_DrawXP

static void CG_DrawXP(float x, float y){	const char *str;	float      w;	vec_t      *clr;	if (cg.time - cg.xpChangeTime < 1000)	{		clr = colorYellow;	}	else	{		clr = colorWhite;	}	str = va("%i", (32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW]) + cg.snap->ps.stats[STAT_XP]);	w   = CG_Text_Width_Ext(str, 0.25f, 0, &cgs.media.limboFont1);	CG_Text_Paint_Ext(x - w, y, 0.25f, 0.25f, clr, str, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);	CG_Text_Paint_Ext(x + 2, y, 0.2f, 0.2f, clr, "XP", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont1);}
开发者ID:sxweet,项目名称:etlegacy,代码行数:20,


示例19: CG_DrawSpawnPointInfo

//.........这里部分代码省略.........		if (scissor)		{			icon_extends[0] *= (scissor->zoomFactor / 5.159);			icon_extends[1] *= (scissor->zoomFactor / 5.159);		}		else		{			icon_extends[0] *= cgs.ccZoomFactor;			icon_extends[1] *= cgs.ccZoomFactor;		}		point[0] -= (icon_extends[0] * (39 / 128.f));		point[1] += (icon_extends[1] * (31 / 128.f));		if (changetime)		{			if (draw)			{				float size;				if (cg.spawnTeams[i] == team)				{					size = 20 * (changetime / SPAWN_SIZEUPTIME);				}				else				{					size = 20 * (1 - (changetime / SPAWN_SIZEUPTIME));				}				if (scissor)				{					size *= (scissor->zoomFactor / 5.159);				}				else				{					size *= cgs.ccZoomFactor;				}				CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]);			}		}		else if ((draw && i == expand) || (!expanded && BG_RectContainsPoint(point[0] - FLAGSIZE_NORMAL * 0.5f, point[1] - FLAGSIZE_NORMAL * 0.5f, FLAGSIZE_NORMAL, FLAGSIZE_NORMAL, cgDC.cursorx, cgDC.cursory)))		{			if (draw)			{				float size = FLAGSIZE_EXPANDED;				if (scissor)				{					size *= (scissor->zoomFactor / 5.159);				}				else				{					size *= cgs.ccZoomFactor;				}				CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]);			}			else			{				if (!scissor)				{					float w;					Com_sprintf(buffer, sizeof(buffer), "%s (Troops: %i)", cg.spawnPoints[i], cg.spawnPlayerCounts[i]);					w = CG_Text_Width_Ext(buffer, 0.2f, 0, &cgs.media.limboFont2);					CG_CommandMap_SetHighlightText(buffer, point[0] - (w * 0.5f), point[1] - 8);				}				e = i;			}		}		else		{			if (draw)			{				float size = FLAGSIZE_NORMAL;				if (scissor)				{					size *= (scissor->zoomFactor / 5.159);				}				else				{					size *= cgs.ccZoomFactor;				}				CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]);				if (!scissor)				{					Com_sprintf(buffer, sizeof(buffer), "(Troops: %i)", cg.spawnPlayerCounts[i]);					CG_Text_Paint_Ext(point[0] + FLAGSIZE_NORMAL * 0.25f, point[1], 0.2f, 0.2f, colorWhite, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);				}			}		}	}	return e;}
开发者ID:harleking,项目名称:etlegacy,代码行数:101,


示例20: WM_DrawClientScore_Small

static void WM_DrawClientScore_Small(int x, int y, score_t *score, float *color, float fade, qboolean livesleft){	int          maxchars = 23, offset = 0;	float        tempx;	vec4_t       hcolor;	clientInfo_t *ci;	int          i, j;    // To draw medals	char         buf[64]; // To draw medals	if (y + 12 >= 470)	{		return;	}	ci = &cgs.clientinfo[score->client];	if (score->client == cg.snap->ps.clientNum)	{		hcolor[3] = fade * 0.3;		VectorSet(hcolor, .5f, .5f, .2f); // DARK-RED		CG_FillRect(x - 5, y, (INFO_TOTAL_WIDTH + 5), 11, hcolor);	}	tempx = x;	VectorSet(hcolor, 1, 1, 1);	hcolor[3] = fade;	y += 10;	// draw GeoIP flag	if (score->ping != -1 && score->ping != 999 && cg_countryflags.integer)	{		if (CG_DrawFlag(tempx - 3, y - 10, fade, ci->clientNum))		{			offset   += 15;			tempx    += 15;			maxchars -= 2;		}	}	if (ci->team != TEAM_SPECTATOR)	{		// draw ready icon if client is ready..		if ((score->scoreflags & 1) && (cgs.gamestate == GS_WARMUP || cgs.gamestate == GS_INTERMISSION))		{			CG_DrawPic(tempx + 1, y - 9, 10, 10, cgs.media.readyShader);			offset   += 14;			tempx    += 14;			maxchars -= 2;		}		if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG)))		{			CG_DrawPic(tempx + 1, y - 9, 10, 10, cgs.media.objectiveShader);			offset   += 14;			tempx    += 14;			maxchars -= 2;		}		// draw the skull icon if out of lives		if (score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1))		{			CG_DrawPic(tempx + 1, y - 9, 10, 10, cgs.media.scoreEliminatedShader);			offset   += 14;			tempx    += 14;			maxchars -= 2;		}		else if (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0)		{			CG_DrawPic(tempx + 1, y - 9, 10, 10, cgs.media.medicIcon);			offset   += 14;			tempx    += 14;			maxchars -= 2;		}	}	// draw name	CG_Text_Paint_Ext(tempx, y, 0.20, 0.25, colorWhite, ci->name, 0, maxchars, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2_lo);	maxchars -= CG_Text_Width_Ext(ci->name, 0.20, 0, &cgs.media.limboFont2_lo);	// draw medals	buf[0] = '/0';	for (i = 0; i < SK_NUM_SKILLS; i++)	{		for (j = 0; j < ci->medals[i]; j++)		{			Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, skillNames[i][0]));		}		maxchars--;	}	if (maxchars > 0)	{		CG_Text_Paint_Ext(tempx + (CG_drawStrlen(ci->name) * 8 + 8), y, 0.20, 0.25, colorWhite, buf, 0, maxchars, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2_lo);	}	tempx += INFO_PLAYER_WIDTH - offset;//.........这里部分代码省略.........
开发者ID:winrid,项目名称:etlegacy,代码行数:101,


示例21: WM_DrawObjectives

//.........这里部分代码省略.........			tens     = seconds / 10;			seconds -= tens * 10;		}		else		{			msec = mins = tens = seconds = 0;		}		if (cgs.gamestate != GS_PLAYING)		{			s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("WARMUP"));		}		else if (msec < 0 && cgs.timelimit > 0.0f)		{			if (cgs.gamestate == GS_WAITING_FOR_PLAYERS)			{				s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("GAME STOPPED"));			}			else			{				s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("SUDDEN DEATH"));			}		}		else		{			s = va("%s   %2.0f:%i%i", CG_TranslateString("MISSION TIME:"), (float)mins, tens, seconds);     // float cast to line up with reinforce time		}		CG_Text_Paint_Ext(x, y, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);		if (cg.warmup)		{			s = va("%s %i", CG_TranslateString("MATCH BEGINS IN:"), (cg.warmup - cg.time) / 1000 + 1);			CG_Text_Paint_Ext(SCREEN_WIDTH - 20 - CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1) + cgs.wideXoffset, y, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);		}		else if ((cgs.gamestate == GS_WARMUP && !cg.warmup) || cgs.gamestate == GS_WAITING_FOR_PLAYERS)		{			s = va(CG_TranslateString("WAITING ON %i %s"), cgs.minclients, cgs.minclients == 1 ? CG_TranslateString("PLAYER") : CG_TranslateString("PLAYERS"));			CG_Text_Paint_Ext(SCREEN_WIDTH - 20 - CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1) + cgs.wideXoffset, y, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);		}		else if (cgs.gametype != GT_WOLF_LMS && !cg.warmup)		{			if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS || cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES)			{				msec = CG_CalculateReinfTime(qfalse) * 1000;			}			else     // no team (spectator mode)			{				msec = 0;			}			if (msec)			{				seconds  = msec / 1000;				mins     = seconds / 60;				seconds -= mins * 60;				tens     = seconds / 10;				seconds -= tens * 10;				s = va("%s %2.0f:%i%i", CG_TranslateString("REINFORCE TIME:"), (float)mins, tens, seconds);				CG_Text_Paint_Ext(SCREEN_WIDTH - 20 - CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1) + cgs.wideXoffset, y, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);			}		}		switch (cgs.gametype)		{
开发者ID:winrid,项目名称:etlegacy,代码行数:67,


示例22: WM_DrawInfoLine

static int WM_DrawInfoLine(int x, int y, float fade){	int        w, defender, winner;	const char *s;	if (cg.snap->ps.pm_type != PM_INTERMISSION)	{		return y;	}	w = 360;	s        = CG_ConfigString(CS_MULTI_INFO);	defender = atoi(Info_ValueForKey(s, "d")); // defender	s      = CG_ConfigString(CS_MULTI_MAPWINNER);	winner = atoi(Info_ValueForKey(s, "w"));	if (cgs.currentRound)	{		// first round		s = va(CG_TranslateString("CLOCK IS NOW SET TO %s!"), WM_TimeToString(cgs.nextTimeLimit * 60.f * 1000.f));	}	else	{		// second round		if (!defender)		{			if (winner != defender)			{				s = "ALLIES SUCCESSFULLY BEAT THE CLOCK!";			}			else			{				s = "ALLIES COULDN'T BEAT THE CLOCK!";			}		}		else		{			if (winner != defender)			{				s = "AXIS SUCCESSFULLY BEAT THE CLOCK!";			}			else			{				s = "AXIS COULDN'T BEAT THE CLOCK!";			}		}		s = CG_TranslateString(s);	}	CG_FillRect(Ccg_WideX(320) - w / 2, y, w, 20, clrUiBar);	CG_DrawRect_FixedBorder(Ccg_WideX(320) - w / 2, y, w, 20, 1, colorBlack);	w = CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1);	CG_Text_Paint_Ext(Ccg_WideX(320) - w * 0.5f, y + 15, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);	return y + INFO_LINE_HEIGHT + 6;}
开发者ID:winrid,项目名称:etlegacy,代码行数:61,


示例23: CG_DrawFireTeamOverlay

// FIXME: add more options to shorten this boxvoid CG_DrawFireTeamOverlay(rectDef_t *rect){	int            x = rect->x;	int            y = rect->y + 1;             // +1, jitter it into place in 1024 :)	int            i;	int            boxWidth  = 106;	int            bestWidth = -1;	char           buffer[64];	float          h   = 16;                    // 12 + 2 + 2	clientInfo_t   *ci = NULL;	fireteamData_t *f  = NULL;	char           *locStr[MAX_FIRETEAM_MEMBERS];	int            locwidth;	int            namewidth;	vec3_t         origin;	int curWeap;	// assign fireteam data, and early out if not on one	if (!(f = CG_IsOnFireteam(cg.clientNum)))	{		return;	}	memset(locStr, 0, sizeof(locStr));	// First get name and location width, also store location names	for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)	{		ci = CG_SortedFireTeamPlayerForPosition(i);		// Make sure it's valid		if (!ci)		{			break;		}		origin[0] = ci->location[0];		origin[1] = ci->location[1];		locStr[i] = CG_BuildLocationString(ci->clientNum, origin, LOC_FTEAM);		if (!locStr[i][1] || !*locStr[i])		{			locStr[i] = "";		}		locwidth = CG_Text_Width_Ext(locStr[i], 0.2f, 0, &cgs.media.limboFont2);		//if ( cg_fixedFTeamSize.integer ) {		//	namewidth = 102;		//}		//else {		namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2);		if (ci->health == 0)		{			namewidth += 7;		}		//}		if ((locwidth + namewidth) > bestWidth)		{			bestWidth = locwidth + namewidth;		}		h += 12.f;	}	boxWidth += bestWidth;	CG_DrawRect(x, y, boxWidth, h, 1, borderColor);	CG_FillRect(x + 1, y + 1, boxWidth - 2, h - 2, bgColor);	x += 2;	y += 2;	CG_FillRect(x, y, boxWidth - 4, 12, clr1);	Com_sprintf(buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident]);	Q_strupr(buffer);	CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1);	x += 2;	for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)	{		y += FT_BAR_HEIGHT + FT_BAR_YSPACING;		x  = rect->x + 2;		// Grab a pointer to the current player		ci = CG_SortedFireTeamPlayerForPosition(i);		// Make sure it's valid		if (!ci)		{			break;		}//.........这里部分代码省略.........
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:101,


示例24: WM_DrawObjectives

//.........这里部分代码省略.........			}*/		}		y += SMALLCHAR_HEIGHT * ( ( rows - 2 ) / 2 );		if ( flagshader ) {			CG_DrawPic( 100, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) );			CG_DrawPic( 325, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) );		}		if ( shader )			CG_DrawPic( 229, 10, 182, 136, trap_R_RegisterShaderNoMip( shader ) );		if ( nameshader ) {			CG_DrawPic( 140, 50, 127, 64, trap_R_RegisterShaderNoMip( nameshader ) );			CG_DrawPic( 365, 50, 127, 64, trap_R_RegisterShaderNoMip( "ui/assets/portraits/text_win.tga" ) );		}		return y;	}// JPW NERVE -- mission time & reinforce time	else {		tempy = y;		rows = 1;		CG_FillRect( x-5, y-2, width+5, 21, clrUiBack );		CG_FillRect( x-5, y-2, width+5, 21, clrUiBar );		CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack );		y += SMALLCHAR_HEIGHT * ( rows - 1 );		if( cgs.timelimit > 0.0f ) {			msec = ( cgs.timelimit * 60.f * 1000.f ) - ( cg.time - cgs.levelStartTime );			seconds = msec / 1000;			mins = seconds / 60;			seconds -= mins * 60;			tens = seconds / 10;			seconds -= tens * 10;		} else {			mins = tens = seconds = 0;		}		if( cgs.gamestate != GS_PLAYING ) {			s = va("%s %s", CG_TranslateString("MISSION TIME:"),  CG_TranslateString("WARMUP"));		} else if ( msec < 0 && cgs.timelimit > 0.0f ) {			if ( cgs.gamestate == GS_WAITING_FOR_PLAYERS )				s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ),  CG_TranslateString( "GAME STOPPED" ) );			else				s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ),  CG_TranslateString( "SUDDEN DEATH" ) );		} else {			s = va( "%s   %2.0f:%i%i", CG_TranslateString( "MISSION TIME:" ), (float)mins, tens, seconds ); // float cast to line up with reinforce time		}		CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );		if( cgs.gametype != GT_WOLF_LMS ) {			if(cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS || cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) {				msec = CG_CalculateReinfTime( qfalse ) * 1000;			}			else // no team (spectator mode)				msec = 0;			if (msec) {				seconds = msec / 1000;				mins = seconds / 60;				seconds -= mins * 60;				tens = seconds / 10;				seconds -= tens * 10;				s = va( "%s %2.0f:%i%i", CG_TranslateString( "REINFORCE TIME:" ), (float)mins, tens, seconds );				CG_Text_Paint_Ext( 640 - 20 - CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ), y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );			}		}		// NERVE - SMF		if ( cgs.gametype == GT_WOLF_STOPWATCH ) {			int w;			s = va( "%s %i", CG_TranslateString( "STOPWATCH ROUND" ), cgs.currentRound + 1 );			w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 );			CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );		} else if( cgs.gametype == GT_WOLF_LMS ) {			int w;			s = va( "%s %i  %s %i-%i", CG_TranslateString( "ROUND" ), cgs.currentRound + 1, CG_TranslateString( "SCORE" ), cg.teamWonRounds[1], cg.teamWonRounds[0] );			w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 );			CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );		} else if( cgs.gametype == GT_WOLF_CAMPAIGN ) {			int w;			s = va( "MAP %i of %i", cgs.currentCampaignMap + 1, cgs.campaignData.mapCount );			w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 );			CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );		}				y += SMALLCHAR_HEIGHT * 2;	}// jpw	return y;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,


示例25: CG_DrawMapEntity

//.........这里部分代码省略.........		if (interactive && !expanded && BG_RectContainsPoint(x + mEnt->transformed[0] - (CONST_ICON_NORMAL_SIZE * 0.5f), y + mEnt->transformed[1] - (CONST_ICON_NORMAL_SIZE * 0.5f), CONST_ICON_NORMAL_SIZE, CONST_ICON_NORMAL_SIZE, cgDC.cursorx, cgDC.cursory))		{			float w;			icon_extends[0] = CONST_ICON_EXPANDED_SIZE;			icon_extends[1] = CONST_ICON_EXPANDED_SIZE;			if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK)			{				icon_extends[1] *= 0.5f;			}			if (scissor)			{				icon_extends[0] *= (scissor->zoomFactor / 5.159);				icon_extends[1] *= (scissor->zoomFactor / 5.159);			}			else			{				icon_extends[0] *= cgs.ccZoomFactor;				icon_extends[1] *= cgs.ccZoomFactor;			}			CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic);			if (oidInfo)			{				name = oidInfo->name;			}			else			{				name = va("%i", j);			}			w = CG_Text_Width_Ext(name, 0.2f, 0, &cgs.media.limboFont2);			CG_CommandMap_SetHighlightText(name, icon_pos[0] - (w * 0.5f), icon_pos[1] - 8);		}		else if (interactive && (mEnt->yaw & 0xFF) & (1 << cgs.ccSelectedObjective))		{			float scalesize;			int   time = cg.time % 1400;			if (time <= 700)			{				scalesize = 12 * (time) / 700.f;			}			else			{				scalesize = 12 * (1 - ((time - 700) / 700.f));			}			icon_extends[0] = CONST_ICON_NORMAL_SIZE + scalesize;			icon_extends[1] = CONST_ICON_NORMAL_SIZE + scalesize;			if (scissor)			{				icon_extends[0] *= (scissor->zoomFactor / 5.159);				icon_extends[1] *= (scissor->zoomFactor / 5.159);			}			else			{				icon_extends[0] *= cgs.ccZoomFactor;				icon_extends[1] *= cgs.ccZoomFactor;			}			if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK)			{				icon_extends[1] *= 0.5f;			}
开发者ID:harleking,项目名称:etlegacy,代码行数:67,


示例26: CG_DrawFireTeamOverlay

//.........这里部分代码省略.........	h = 12 + 2 + 2;	for (i = 0; i < 6; i++)	{		ci = CG_SortedFireTeamPlayerForPosition(i, 6);		if (!ci)		{			break;;		}		h += FT_BAR_HEIGHT + FT_BAR_YSPACING;	}	CG_DrawRect(x, y, 204, h, 1, borderColor);	CG_FillRect(x + 1, y + 1, 204 - 2, h - 2, bgColor);	x += 2;	y += 2;	CG_FillRect(x, y, 204 - 4, 12, clr1);	sprintf(buffer, "Fireteam: %s", bg_fireteamNames[f->ident]);	Q_strupr(buffer);	CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1);	x += 2;	//y += 2;	for (i = 0; i < 6; i++)	{		y += FT_BAR_HEIGHT + FT_BAR_YSPACING;		x  = rect->x + 2;		ci = CG_SortedFireTeamPlayerForPosition(i, 6);		if (!ci)		{			break;;		}		if (ci->selected)		{			CG_FillRect(x, y + FT_BAR_YSPACING, 204 - 4, FT_BAR_HEIGHT, clr3);		}		else		{			CG_FillRect(x, y + FT_BAR_YSPACING, 204 - 4, FT_BAR_HEIGHT, clr2);		}		x += 4;		CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, BG_ClassLetterForNumber(ci->cls), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		x += 10;		CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->team == TEAM_AXIS ? miniRankNames_Axis[ci->rank] : miniRankNames_Allies[ci->rank], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		x += 22;		CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		x += 90;/*		CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.movementAutonomyIcons[0]);        x += FT_BAR_HEIGHT;        CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.weaponAutonomyIcons[0]);        x += FT_BAR_HEIGHT;        x += 4;*//*		if( isLeader ) {            CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", i+4), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2 );        }*/		x += 20;		if (ci->health > 80)		{			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		}		else if (ci->health > 0)		{			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		}		else		{			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		}		//x += 20;		{			vec2_t loc;			char   *s;			loc[0] = ci->location[0];			loc[1] = ci->location[1];			s = va("^3(%s)", BG_GetLocationString(loc));			x = rect->x + (204 - 4 - CG_Text_Width_Ext(s, .2f, 0, &cgs.media.limboFont2));			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("^3(%s)", BG_GetLocationString(loc)), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2);		}	}}
开发者ID:morsik,项目名称:war-territory,代码行数:101,


示例27: CG_SpecHelpDraw

void CG_SpecHelpDraw(void){	if (cg.spechelpWindow == SHOW_OFF)	{		return;	}	else	{		const helpType_t help[] =		{			{ "+zoom",    "hold for pointer"   },			{ "+attack",  "window move/resize" },			{ "+sprint",  "hold to resize"     },			{ "weapnext", "window on/off"      },			{ "weapprev", "swap w/main view"   },			{ NULL,       NULL                 },			{ "weapalt",  "swingcam toggle"    },			{ "spechelp", "help on/off"        }		};		int  i, x, y = 480, w, h;		int  len, maxlen = 0;		char format[MAX_STRING_TOKENS], buf[MAX_STRING_TOKENS];		char *lines[16];		vec4_t bgColor     = COLOR_BG;              // window		vec4_t borderColor = COLOR_BORDER;          // window		vec4_t bgColorTitle     = COLOR_BG_TITLE;       // titlebar		vec4_t borderColorTitle = COLOR_BORDER_TITLE;   // titlebar		// Main header		int        hStyle    = ITEM_TEXTSTYLE_SHADOWED;		float      hScale    = 0.16f;		float      hScaleY   = 0.21f;		fontInfo_t *hFont    = FONT_HEADER;		vec4_t     hdrColor2 = COLOR_HDR2;  // text		// Text settings		int        tStyle   = ITEM_TEXTSTYLE_SHADOWED;		int        tSpacing = 9;        // Should derive from CG_Text_Height_Ext		float      tScale   = 0.19f;		fontInfo_t *tFont   = FONT_TEXT;		vec4_t     tColor   = COLOR_TEXT;   // text		float diff = cg.fadeTime - trap_Milliseconds();		// FIXME: Should compute all this stuff beforehand		// Compute required width		for (i = 0; i < sizeof(help) / sizeof(helpType_t); i++)		{			if (help[i].cmd != NULL)			{				len = strlen(CG_getBindKeyName(help[i].cmd, buf, sizeof(buf)));				if (len > maxlen)				{					maxlen = len;				}			}		}		Q_strncpyz(format, va("^2%%%ds ^N%%s", maxlen), sizeof(format));		for (i = 0, maxlen = 0; i < sizeof(help) / sizeof(helpType_t); i++)		{			if (help[i].cmd != NULL)			{				lines[i] = va(format, CG_getBindKeyName(help[i].cmd, buf, sizeof(buf)), help[i].info);				len      = CG_Text_Width_Ext(lines[i], tScale, 0, FONT_TEXT);				if (len > maxlen)				{					maxlen = len;				}			}			else			{				lines[i] = NULL;			}		}		w = maxlen + 8;		x = SH_X;		y = SH_Y;		h = 2 + tSpacing + 2 +                                  // Header		    2 + 1 +		    tSpacing * (sizeof(help) / sizeof(helpType_t)) +		    2;		// Fade-in effects		if (diff > 0.0f)		{			float scale = (diff / STATS_FADE_TIME);			if (cg.spechelpWindow == SHOW_ON)			{				scale = 1.0f - scale;			}			bgColor[3]          *= scale;			bgColorTitle[3]     *= scale;//.........这里部分代码省略.........
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:101,


示例28: CG_DrawFireTeamOverlay

/** * @brief Draw FireTeam overlay */void CG_DrawFireTeamOverlay(rectDef_t *rect){	int            x = rect->x;	int            y = rect->y + 1;             // +1, jitter it into place	int            i, locwidth, namewidth, puwidth, lineX;	int            boxWidth      = 90;	int            bestNameWidth = -1;	int            bestLocWidth  = -1;	char           buffer[64];	float          h   = 16;                    // 12 + 2 + 2	clientInfo_t   *ci = NULL;	fireteamData_t *f  = NULL;	char           *locStr[MAX_FIRETEAM_MEMBERS];	vec3_t         origin;	int curWeap;	// assign fireteam data, and early out if not on one	if (!(f = CG_IsOnFireteam(cg.clientNum)))	{		return;	}	memset(locStr, 0, sizeof(char *) * MAX_FIRETEAM_MEMBERS);	// First get name and location width, also store location names	for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)	{		ci = CG_SortedFireTeamPlayerForPosition(i);		// Make sure it's valid		if (!ci)		{			break;		}		if (cg_locations.integer & LOC_FTEAM)		{			origin[0] = ci->location[0];			origin[1] = ci->location[1];			origin[2] = ci->location[2];			locStr[i] = CG_BuildLocationString(ci->clientNum, origin, LOC_FTEAM);			if (!locStr[i][1] || !*locStr[i])			{				locStr[i] = "";			}			locwidth = CG_Text_Width_Ext(locStr[i], 0.2f, 0, FONT_TEXT);		}		else		{			locwidth = 0;		}		namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 0, FONT_TEXT);		if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) | (1 << PW_OPS_DISGUISED)))		{			namewidth += 14;		}		if (namewidth > bestNameWidth)		{			bestNameWidth = namewidth;		}		if (locwidth > bestLocWidth)		{			bestLocWidth = locwidth;		}		h += 12.f;	}	boxWidth += bestLocWidth + bestNameWidth;	if (cg_fireteamLatchedClass.integer)	{		boxWidth += 28;	}	if ((Ccg_WideX(640) - MIN_BORDER_DISTANCE) < (x + boxWidth))	{		x = x - ((x + boxWidth) - Ccg_WideX(640)) - MIN_BORDER_DISTANCE;	}	else if (x < MIN_BORDER_DISTANCE)	{		x = MIN_BORDER_DISTANCE;	}	CG_FillRect(x, y, boxWidth, h, FT_bg2);	CG_DrawRect(x, y, boxWidth, h, 1, FT_border);	x += 1;	y += 1;//.........这里部分代码省略.........
开发者ID:belstgut,项目名称:etlegacy,代码行数:101,


示例29: CG_DrawGrid

//.........这里部分代码省略.........			{				continue;			}			if (grid_y > h)			{				break;			}			if (scissor->circular)			{				// clip line against circle				float xc, yc;				line[1] = y + grid_y;				yc      = line[1] >= y + .5f * h ? line[1] - (y + .5f * h) : (y + .5f * h) - line[1];				xc      = SQRTFAST(Square(.5f * h) - Square(yc));				line[0] = x + (.5f * w) - xc;				line[2] = 2 * xc;				line[3] = 1.f;			}			else			{				Vector4Set(line, x + dim_x[0], y + grid_y, w, 1);			}			line[0] *= cgs.screenXScale;			line[1] *= cgs.screenYScale;			line[2] *= cgs.screenXScale;			trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader);		}		trap_R_SetColor(NULL);	}	else	{		char   coord_char[3], coord_int;		float  text_width, text_height;		vec2_t textOrigin;		dim_x[0] = cg.mapcoordsMins[0];		dim_x[1] = cg.mapcoordsMaxs[0];		dim_y[0] = cg.mapcoordsMaxs[1];		dim_y[1] = cg.mapcoordsMins[1];		// transform		xscale = w / dist[0];		yscale = h / -dist[1];		dim_x[0] = (dim_x[0] - cg.mapcoordsMins[0]) * xscale;		dim_x[1] = (dim_x[1] - cg.mapcoordsMins[0]) * xscale;		dim_y[0] = (dim_y[0] - cg.mapcoordsMaxs[1]) * yscale;		dim_y[1] = (dim_y[1] - cg.mapcoordsMaxs[1]) * yscale;		grid_x = gridStartCoord[0] * xscale;		grid_y = gridStartCoord[1] * yscale;		step[0] = gridStep[0] * xscale;		step[1] = gridStep[1] * yscale;		// draw		textOrigin[0] = grid_x;		textOrigin[1] = grid_y;		Vector4Set(gridColour, clrBrownLine[0], clrBrownLine[1], clrBrownLine[2], 1.f);		coord_char[1] = '/0';		for (coord_char[0] = ('A' - 1); grid_x < dim_x[1]; grid_x += step[0], coord_char[0]++)		{			if (coord_char[0] >= 'A')			{				text_width  = CG_Text_Width_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2);				text_height = CG_Text_Height_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2);				CG_Text_Paint_Ext((x + grid_x) - (.5f * step[0]) - (.5f * text_width), y + dim_y[0] + textOrigin[1] + 1.5f * text_height, 0.2f, 0.2f, colorBlack, coord_char, 0, 0, 0, &cgs.media.limboFont2);			}			trap_R_SetColor(gridColour);			Vector4Set(line, x + grid_x, y + dim_y[0], 1, dim_x[1] - dim_x[0]);			CG_AdjustFrom640(&line[0], &line[1], &line[2], &line[3]);			trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader);		}		for (coord_int = -1; grid_y < dim_y[1]; grid_y += step[1], coord_int++)		{			if (coord_int >= 0)			{				Com_sprintf(coord_char, sizeof(coord_char), "%i", coord_int);				text_width  = CG_Text_Width_Ext("0", 0.2f, 0, &cgs.media.limboFont2);				text_height = CG_Text_Height_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2);				CG_Text_Paint_Ext(x + dim_x[0] + textOrigin[0] + .5f * text_width, (y + grid_y) - (.5f * step[1]) + (.5f * text_height), 0.2f, 0.2f, colorBlack, coord_char, 0, 0, 0, &cgs.media.limboFont2);			}			trap_R_SetColor(gridColour);			Vector4Set(line, x + dim_x[0], y + grid_y, dim_y[1] - dim_y[0], 1);			CG_AdjustFrom640(&line[0], &line[1], &line[2], &line[3]);			trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader);		}		trap_R_SetColor(NULL);	}}
开发者ID:harleking,项目名称:etlegacy,代码行数:101,



注:本文中的CG_Text_Width_Ext函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CG_TranslateString函数代码示例
C++ CG_Text_Paint_Ext函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。