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


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

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


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

示例1: DisplayProfile

void DisplayProfile(sf::RenderWindow * renderWindow, CProfileIterator * iter, int x, int & y)
{
    if (!renderWindow) return;
    FontManager * fontManager = FontManager::Get();

    y += 15;
    while ( !iter->Is_Done() )
    {
        sf::Text text("", *fontManager->GetFont(""));
        text.setCharacterSize(12);
        ostringstream texte;
        if ( CProfileManager::Get_Frame_Count_Since_Reset() != 0 )
            texte << fixed <<  iter->Get_Current_Name()   << " Calls/Frame:" << iter->Get_Current_Total_Calls()/CProfileManager::Get_Frame_Count_Since_Reset()
                                                << " Time/Frame:" << iter->Get_Current_Total_Time()/CProfileManager::Get_Frame_Count_Since_Reset()
                                                << " %Time/Parent " << iter->Get_Current_Total_Time()/iter->Get_Current_Parent_Total_Time()*100.0f;
        text.setString(texte.str());
        text.setPosition(x,y);
        renderWindow->draw(text);

        //Childs
        CProfileIterator * childIter = CProfileManager::Get_Iterator();
        *childIter = *iter;
        childIter->Enter_Child(0);
        DisplayProfile(renderWindow, childIter, x+15, y);
        CProfileManager::Release_Iterator(childIter);

        y += 15;
        iter->Next();
    }
}
开发者ID:AntonioModer,项目名称:GD,代码行数:30,代码来源:RuntimeScene.cpp

示例2: DrawHUD

void Weapon::DrawHUD( Screen3D& Screen, MeshManager& MM, FontManager& FM, Camera& Viewer )
{

	HitPlayer = false;

	Screen.Clear(true);
	// Set the matrices to the origin
    D3DXMATRIX matWorld;
    D3DXMatrixIdentity( &matWorld );
    Screen.SetTransform(  matWorld );

//Set render states
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
					ScreenPtr->D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
					ScreenPtr->D3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_DISABLE );
					ScreenPtr->D3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
					ScreenPtr->D3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
					ScreenPtr->D3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_DISABLE );

	//Draw the weapon model
	WeaponFont = FM.GetFont("Lucida Console", 16);
	Screen.D3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );

	Matrix ViewMatrix = Viewer.GetLookAtMatrix(  -10 );
	Matrix WorldMatrix;
	Matrix DisplacementMat;
	Matrix DisplacementMat2;
	Matrix ScaleMatrix;


	Screen.SetRenderState(D3DRS_ALPHABLENDENABLE,   TRUE);
	Screen.SetRenderState(D3DRS_SRCBLEND,           D3DBLEND_ONE);
	Screen.SetRenderState(D3DRS_DESTBLEND,          D3DBLEND_ONE);
	Screen.SetRenderState(D3DRS_ALPHATESTENABLE, FALSE );
	Screen.SetRenderState(D3DRS_ZENABLE, FALSE );

	RECT muzzleDim = { Screen.GetWidth()/2, Screen.GetHeight()/2-Screen.GetHeight()/5,Screen.GetWidth()/2+(Screen.GetHeight()/5)*2, Screen.GetHeight()/2+Screen.GetHeight()/5};

	int fade = (int)(MuzzleFlashFade*255.0f);
	Screen.DrawSpriteRect( muzzleDim, MuzzleFlash, true, D3DCOLOR_RGBA( fade, fade, fade, fade ) );
	Screen.SetRenderState(D3DRS_ZENABLE, TRUE );

	Screen.SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW);
	//Screen.SetTextureMode( TMSphereMap);
	//Screen.SetTexture(GlossMap, 1);


	
	Matrix RMat;
	RMat.Rotate( Viewer.Yaw, Viewer.Pitch, Viewer.Roll);
	ScreenPtr->D3DDevice->MultiplyTransform( D3DTS_TEXTURE1, &RMat.Mat );
		
	//draw
	if(!RightHanded)
	{
		//First, apply a -1 scale to the transform
		//matrix so that the gun draws on the opposite side
		//(since it's left handed). Also, change the 
		//culling order so it doesn't draw inside out.
		Screen.SetRenderState( D3DRS_CULLMODE, D3DCULL_CW);

		DisplacementMat.Translate( 0.10f, 3.1f, -4.3f);
		ScaleMatrix.Scale( -1, 1, 1 );
		D3DXMatrixMultiply(&DisplacementMat.Mat, &DisplacementMat.Mat, &ScaleMatrix.Mat);
		D3DXMatrixMultiply(&ViewMatrix.Mat, &ViewMatrix.Mat, &DisplacementMat.Mat);
		D3DXMatrixInverse(&WorldMatrix.Mat, NULL, &ViewMatrix.Mat);
		Screen.SetTransform(WorldMatrix);


		//Draw the mesh now and return the culling state
		//DisplayMesh.Draw( Screen );
		Screen.SetRenderState(D3DRS_LIGHTING, FALSE );
		MeshA.Draw( Screen, WorldMatrix );
		Screen.SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW);
		D3DMATRIX OldState;
		Screen.D3DDevice->GetTransform( D3DTS_VIEW, &OldState);
		
		Matrix I;
		Screen.SetViewTransform(I);

		
				
		
		Smoke.MoveSpawn( -1.0f, -1.2f, 9.0f);
		Smoke.Draw( Screen, Viewer );
		
		if(DualWeapons)
		{
			Smoke.MoveSpawn( 1.0f, -1.1f, 8.0f);
			Smoke.Draw( Screen, Viewer );
		}
		
		Screen.D3DDevice->SetTransform( D3DTS_VIEW, &OldState);
       
	}
	else
//.........这里部分代码省略.........
开发者ID:fathat,项目名称:game-src,代码行数:101,代码来源:Weapon.cpp


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