Esempio n. 1
0
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("*****@*****.**", 825,30,kernelsettings_ref);

	return true;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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;
}