当前位置: 首页>>代码示例>>C++>>正文


C++ FTexture::GetScaledWidthDouble方法代码示例

本文整理汇总了C++中FTexture::GetScaledWidthDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ FTexture::GetScaledWidthDouble方法的具体用法?C++ FTexture::GetScaledWidthDouble怎么用?C++ FTexture::GetScaledWidthDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FTexture的用法示例。


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

示例1: DrawString

	void DrawString(FFont *font, const char* cstring, SBarInfoCoordinate x, SBarInfoCoordinate y, int xOffset, int yOffset, double Alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0, bool drawshadow=false, int shadowX=2, int shadowY=2) const
	{
		x += spacing;
		double ax = *x;
		double ay = *y;

		double xScale = 1.0;
		double yScale = 1.0;

		const BYTE* str = (const BYTE*) cstring;
		const EColorRange boldTranslation = EColorRange(translation ? translation - 1 : NumTextColors - 1);
		FRemapTable *remap = font->GetColorTranslation(translation);

		if(fullScreenOffsets)
		{
			if(hud_scale)
			{
				xScale = script->cleanX;
				yScale = script->cleanY;
			}
			adjustRelCenter(x.RelCenter(), y.RelCenter(), *x, *y, ax, ay, xScale, yScale);
		}
		while(*str != '\0')
		{
			if(*str == ' ')
			{
				if(script->spacingCharacter == '\0')
					ax += font->GetSpaceWidth();
				else
					ax += font->GetCharWidth((unsigned char) script->spacingCharacter);
				str++;
				continue;
			}
			else if(*str == TEXTCOLOR_ESCAPE)
			{
				EColorRange newColor = V_ParseFontColor(++str, translation, boldTranslation);
				if(newColor != CR_UNDEFINED)
					remap = font->GetColorTranslation(newColor);
				continue;
			}

			int width;
			if(script->spacingCharacter == '\0') //No monospace?
				width = font->GetCharWidth((unsigned char) *str);
			else
				width = font->GetCharWidth((unsigned char) script->spacingCharacter);
			FTexture* character = font->GetChar((unsigned char) *str, &width);
			if(character == NULL) //missing character.
			{
				str++;
				continue;
			}
			if(script->spacingCharacter == '\0') //If we are monospaced lets use the offset
				ax += (character->LeftOffset+1); //ignore x offsets since we adapt to character size

			double rx, ry, rw, rh;
			rx = ax + xOffset;
			ry = ay + yOffset;
			rw = character->GetScaledWidthDouble();
			rh = character->GetScaledHeightDouble();

			if(script->spacingCharacter != '\0')
			{
				double spacingSize = font->GetCharWidth((unsigned char) script->spacingCharacter);
				switch(script->spacingAlignment)
				{
					default:
						break;
					case SBarInfo::ALIGN_CENTER:
						rx += (spacingSize/2)-(rw/2);
						break;
					case SBarInfo::ALIGN_RIGHT:
						rx += spacingSize-rw;
						break;
				}
			}

			if(!fullScreenOffsets)
			{
				rx += ST_X;
				ry += ST_Y - (Scaled ? script->resH : 200) + script->height;
				if(Scaled)
					screen->VirtualToRealCoords(rx, ry, rw, rh, script->resW, script->resH, true);
				else
				{
					ry += (200 - script->resH);
				}
			}
			else
			{
				if(vid_fps && ax < 0 && ay >= 0)
					ry += 10;

				bool xright = rx < 0;
				bool ybot = ry < 0;

				if(hud_scale)
				{
					rx *= xScale;
					ry *= yScale;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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