本文整理汇总了C++中CSprite::SetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetTexture方法的具体用法?C++ CSprite::SetTexture怎么用?C++ CSprite::SetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderRallyPoint
void CEntity::RenderRallyPoint()
{
if( !m_visible )
return;
/*
if ( !entf_get(ENTF_HAS_RALLY_POINT) ||
g_Selection.m_unitUITextures.find(m_base->m_rallyName) == g_Selection.m_unitUITextures.end() )
{
return;
}
*/
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, g_Renderer.m_Options.m_LodBias);
CSprite sprite;
CTexture tex;
// tex.SetHandle( g_Selection.m_unitUITextures[m_base->m_rallyName] );
sprite.SetTexture(&tex);
// Place the sprite slightly above ground/water level.
float terrainHeight = g_Game->GetWorld()->GetTerrain()->GetExactGroundLevel(m_rallyPoint);
float height = std::max(terrainHeight, g_Renderer.GetWaterManager()->m_WaterHeight) + 0.5f;
CVector3D rally(m_rallyPoint.x, height, m_rallyPoint.y);
sprite.SetTranslation(rally);
sprite.Render();
}
示例2: CreateGUIItem
void CUIManager::CreateGUIItem(const UINT nID, const tstring strType, const vector<tstring>& strTexture)
{
if ( strTexture[0].empty() )
{
return;
}
CUserInterface* pUI = GetCurrentUI();;
if (nullptr == pUI)
{
throw tstring(_T("Get current UI field."));
}
CObject* pObject = nullptr;
if (strSpriteName == strType)
{
// Create Sprite
CSprite* pSprite = new CSprite(m_pDDraw);
pSprite->SetTexture(strTexture);
pObject = pSprite;
}
else if (strTextFieldName == strType)
{
// Create Text field
CTextField* pText = new CTextField(m_pDDraw);
pText->SetTexture(strTexture);
pObject = pText;
}
else if (strButtonName == strType)
{
// Create Button
CButton* pButton = new CButton(m_pDDraw);
pButton->SetTexture(strTexture);
pObject = pButton;
}
else
{
throw tstring(_T("Type error"));
}
if (pObject)
{
pUI->DeleteObject(nID);
pObject->SetID(nID);
pUI->AddObject(nID, pObject);
}
}