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


C++ FontManager::RenderText方法代码示例

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


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

示例1: DisplayCameraAndControlInfo

bool HeadsUpDisplay::DisplayCameraAndControlInfo(const FontManager& fontmanager_ref, const EntitySet& entityset_ref, const KernelSettings kernelsettings_ref) const
{
	//display entity number in lower half of HUD
	stringstream ss1;
	string s1,s2;
	ss1 << entityset_ref.GetControlTargetID();
	ss1 >> s1;
	s2 = "Entity Control: " + s1;
	fontmanager_ref.RenderText(s2.c_str(),10,kernelsettings_ref.iAppHeight-10,kernelsettings_ref);
	
	//display entity number in lower half of HUD
	stringstream ss2;
	s1 = "";
	s2 = "";
	//display camera source in lower half of HUD
	ss2 << entityset_ref.GetCameraTargetID();
	ss2 >> s1;
	s2 = "Camera Source: " + s1;
	fontmanager_ref.RenderText(s2.c_str(),10,kernelsettings_ref.iAppHeight-25,kernelsettings_ref);

	stringstream ss3;
	s1 = "";
	s2 = "";
	//display hyperfactor of control entity
	ss3 << entityset_ref.GetControlTargetRef()->fHVS[0];
//	ss3 << MathManipulations::SizVEC(entityset_ref.GetControlTargetRef()->vSVS[3]);
	ss3 >> s1;
	s2 = "HyperFactor: " + s1;
	fontmanager_ref.RenderText(s2.c_str(),200,kernelsettings_ref.iAppHeight-25,kernelsettings_ref);
//	fontmanager_ref.RenderText(s2.c_str(),200,kernelsettings_ref.iAppHeight-25,kernelsettings_ref);

	//Redner User Info
	fontmanager_ref.RenderText("Martin Goulet - Copyright 2005", 770,15,kernelsettings_ref);
	fontmanager_ref.RenderText("[email protected]", 825,30,kernelsettings_ref);

	return true;
}
开发者ID:mgoulet,项目名称:phase4,代码行数:37,代码来源:HeadsUpDisplay.cpp

示例2: RenderFPS

bool FPSCounter::RenderFPS(const Timer& timer_ref,
						   const FontManager& fontmanager_ref,
						   const KernelSettings& kernelsettings_ref) const
{
	
	glPushMatrix();

	//get actual favlue to display
	char* output = this->GetFPS(timer_ref);
	//call to fontmanager to render FPS text
	fontmanager_ref.RenderText(output, 2, 12, kernelsettings_ref);

	glPopMatrix();
	
	return true;
}
开发者ID:mgoulet,项目名称:phase4,代码行数:16,代码来源:FPSCounter.cpp

示例3: RenderConsole

bool Console::RenderConsole(const KernelSettings& kernelsettings_ref,
							const TextureSet& textureset_ref,
							const FontManager& fontmanager_ref,
							const Timer& timer_ref) const
{
	//selection of projection matrix
	glMatrixMode(GL_PROJECTION);
	//push/save current projection matrix
	glPushMatrix();
	//reset our new/current copy
	glLoadIdentity();
	//setup orthogonal projection (parallel)
	glOrtho(0.0f, kernelsettings_ref.iAppWidth, kernelsettings_ref.iAppHeight, 0.0f, -1.0f, 1.0f);
	//select modelview
	
	glMatrixMode(GL_MODELVIEW);
	//save matrix
	glPushMatrix();
	//reset it
	glLoadIdentity();
	//save attribs
	glPushAttrib(GL_ALL_ATTRIB_BITS);

	//enable alpha
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glDisable(GL_CULL_FACE);
	glDisable(GL_LIGHTING);
	glDisable(GL_DEPTH_TEST);

	//set color
	glColor4f(kernelsettings_ref.consolesettings[0], kernelsettings_ref.consolesettings[1],
			  kernelsettings_ref.consolesettings[2], kernelsettings_ref.consolesettings[3]);

	//bind console texture
	glBindTexture(GL_TEXTURE_2D, textureset_ref.GetTextureIndices()[0]);
	glEnable(GL_TEXTURE_2D);

	//draw triangle strip consisting console
	glBegin(GL_TRIANGLE_STRIP);
		glTexCoord2f(0.0, 1.0);	glVertex2f(0, /*0*/55);
		glTexCoord2f(0.0, 0.0);	glVertex2f(0, kernelsettings_ref.iAppHeight/2);
		glTexCoord2f(2.0, 1.0);	glVertex2f( kernelsettings_ref.iAppWidth, /*0*/55);
		glTexCoord2f(2.0, 0.0);	glVertex2f( (kernelsettings_ref.iAppWidth), kernelsettings_ref.iAppHeight/2);
	glEnd();

	//draw bottom frame (black bottom line)
	glColor4f(0.0, 0.0, 0.0, 0.5);
	glRectf(	0,kernelsettings_ref.iAppHeight/2,
				kernelsettings_ref.iAppWidth, kernelsettings_ref.iAppHeight/2+5);

	//RENDERING MESSAGE LIST
	fontmanager_ref.RenderText("->", 0, (kernelsettings_ref.iAppHeight/2), kernelsettings_ref);
	fontmanager_ref.RenderText(this->GetCurrentMessage().c_str(), 25, (kernelsettings_ref.iAppHeight/2), kernelsettings_ref);
	for (int i = 0; i < this->GetMessageList().size(); i++)
	{
		int iFontSize = kernelsettings_ref.iFontSize;
		fontmanager_ref.RenderText(this->GetMessageList().at(i).c_str(), 0, (kernelsettings_ref.iAppHeight/2) - ( (i+1) * iFontSize), kernelsettings_ref);
		if (i > 8) break;	//break so messages dont go beyond console delimiters
	}

	//disable textures
	glDisable(GL_TEXTURE_2D);
	//disable blend
	glDisable(GL_BLEND);
	//pop attribs
	glPopAttrib();

	//select and pop old projection matrix back
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();

	//select and pop old modelview matrix
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();

	return true;
}
开发者ID:mgoulet,项目名称:phase4,代码行数:78,代码来源:Console.cpp


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