本文整理汇总了C++中TextureManager::GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::GetTexture方法的具体用法?C++ TextureManager::GetTexture怎么用?C++ TextureManager::GetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::GetTexture方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name: Init
// Purpose: Initializes the state.
// Original Author: Ethan Pendergraft
// Creation Date: 5/12/2012
// Last Modification By:
// Last Modification Date:
/////////////////////////////////////////////////////////////////////////////////////////////////////
void COptionsState::Init ()
{
m_pGame = CGame::GetInstance();
m_pInput = m_pGame->GetInputManager();
m_pAudio = m_pGame->GetAudioManager();
TextureManager* pTM = TextureManager::GetInstance();
m_lpOptionsVideo = pTM->GetTexture( pTM->LoadTexture("./Resources/Textures/PS_FE_OptionMenu_Video.png" ) );
m_lpOptionsAudio = pTM->GetTexture( pTM->LoadTexture("./Resources/Textures/PS_FE_OptionMenu_Audio.png" ) );
m_lpOptionsExit = pTM->GetTexture( pTM->LoadTexture("./Resources/Textures/PS_FE_OptionMenu_Exit.png" ) );
m_nReticle = pTM->GetTexture( pTM->LoadTexture("./Resources/Textures/T_Reticle_D.png"));
m_nCurrentlySelected = OPT_VIDEO;
}
示例2: imAdr
AnimatedSprite::AnimatedSprite(TextureManager & TM, std::string adr,int nbrFX,int nbrFY,int size,int vit,bool centrer)
{
std::string imAdr(adr);
imAdr.append(".png");
std::string dataAdr(adr);
dataAdr.append(".data");
image.setTexture(*(TM.GetTexture(imAdr)));
frameX = 1;
frameY = 1;
cpt = 0;
vitesse = vit;
nbrFrameX = nbrFX;
nbrFrameY = nbrFY;
scale = size;
image.setTextureRect(sf::IntRect(0,0,image.getTexture()->getSize().x/nbrFrameX,image.getTexture()->getSize().y/nbrFrameY));
image.setScale((((float)size*nbrFrameX)/((float)image.getTexture()->getSize().x)),
(((float)size*nbrFrameY)*(((float)image.getTexture()->getSize().y)/((float)image.getTexture()->getSize().x)))
/((float)image.getTexture()->getSize().y));
if(centrer){
// if(nbrFrame == 1)
// image.SetCenter(0,image.GetImage()->GetHeight()/2);
// else
image.setOrigin(image.getTexture()->getSize().x/(2*(nbrFrameX)),image.getTexture()->getSize().y/(2*nbrFrameY));
}
// dataAnalyser(width,dataAdr);
}
示例3:
Carte::Carte(TextureManager &TM, std::string adr1, std::string adr2, std::string adr3)
{
//hb = new Hitbox(IM,adr);
Iinf.setTexture(*(TM.GetTexture(adr1)));
Isup.setTexture(*(TM.GetTexture(adr2)));
hitbox.setTexture(*(TM.GetTexture(adr3)));
hbpath = adr3;
// Iinf.Resize(w,h);
// Isup.Resize(w,h);
// hitbox.Resize(w,h);
}
示例4: Render
void Sprite::Render(ID3DXSprite *sprite) {
TextureManager *TexMan = TextureManager::GetSingleton();
if (enabled && TexMan->IsTextureValid(tex)) {
TextureRecord *TexRec = TexMan->GetTexture(tex);
if (TexRec->IsType(TR_PLANAR)) {
sprite->SetTransform(&transform);
sprite->Draw((LPDIRECT3DTEXTURE9)TexRec->GetTexture(), 0, 0, &pos, color);
}
}
}
示例5: Render
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name: Render
// Purpose: Render the state.
// Original Author: Rueben Massey
// Creation Date: 5/30/2012
// Last Modification By:
// Last Modification Date:
/////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoOptionsState::Render()
{
TextureManager* pTM = TextureManager::GetInstance();
RenderEngine::RasterTexture( pTM->GetTexture(m_lpCurrentSelection), 0.0f, 0.0f, 1.0f, 1.0f );
// Render Brightness Slider
//RenderEngine::RasterTexture( m_lpOptionsSlider, m_fBrightnessSliderPosVec.x, m_fBrightnessSliderPosVec.y, m_fBrightnessSliderPosVec.x + VSLIDER_WIDTH, m_fBrightnessSliderPosVec.y + VSLIDER_HEIGHT );
// render block out if full screen
if( m_pGame->GetFullScreen() )
{
// Render Gamma Slider
if(m_pInput->LeftMouseButtonDown() && m_nCurrentlySelected == VIDEO_GAMMA && m_bLocked)
{
RenderEngine::RasterTexture( pTM->GetTexture(m_lpOptionsSlider), m_fGammaSliderPosVec.x, m_fGammaSliderPosVec.y, m_fGammaSliderPosVec.x + VSLIDER_DOWN_WIDTH, m_fGammaSliderPosVec.y + VSLIDER_DOWN_HEIGHT );
}
else
{
RenderEngine::RasterTexture( pTM->GetTexture(m_lpOptionsSlider), m_fGammaSliderPosVec.x, m_fGammaSliderPosVec.y, m_fGammaSliderPosVec.x + VSLIDER_WIDTH, m_fGammaSliderPosVec.y + VSLIDER_HEIGHT );
}
}
else
{
RenderEngine::RasterTexture( pTM->GetTexture(m_lpFullScreenBlockOut), m_fGammaSliderPosVec.x, m_fGammaSliderPosVec.y, m_fGammaSliderPosVec.x + VSLIDER_WIDTH, m_fGammaSliderPosVec.y + VSLIDER_HEIGHT );
}
// Render The Check Mark
RenderEngine::RasterTexture( pTM->GetTexture(m_lpOptionsCheck), m_fCheckMarkPos.x, m_fCheckMarkPos.y, m_fCheckMarkPos.x + VCHECKMARK_WIDTH, m_fCheckMarkPos.y + VCHECKMARK_HEIGHT );
//Render the cursor reticle at the mouse position
RenderEngine::RasterTexture(pTM->GetTexture(m_nReticle), _mousePos.x - 0.02f, (-_mousePos.y - 0.02f) + 1.0f, _mousePos.x + 0.02f, (-_mousePos.y + 0.02f) + 1.0f );
}
示例6: GetTexture
Texture* TextureUnit::GetTexture(void)
{
if (mTexture)
{
return mTexture;
}
// get from texture manager
TextureManager* texMgr = TextureManager::getSingleton();
if(texMgr)
{
mTexture = texMgr->GetTexture(this->mPicName);
}
return mTexture;
}
示例7: FillSunMoonStruct
//.........这里部分代码省略.........
time );
break;
}
}
for ( i=0; true; ++i )
{
if ( time >= ambientColorState[i].hour && time < ambientColorState[i+1].hour )
{
sunMoon.rawAmbientColor.r = Interpolate( ambientColorState[i].hour, ambientColorState[i].color.r,
ambientColorState[i+1].hour, ambientColorState[i+1].color.r,
time );
sunMoon.rawAmbientColor.g = Interpolate( ambientColorState[i].hour, ambientColorState[i].color.g,
ambientColorState[i+1].hour, ambientColorState[i+1].color.g,
time );
sunMoon.rawAmbientColor.b = Interpolate( ambientColorState[i].hour, ambientColorState[i].color.b,
ambientColorState[i+1].hour, ambientColorState[i+1].color.b,
time );
break;
}
}
sunMoon.ambientColorH = sunMoon.rawAmbientColor * ambientAmountH;
sunMoon.diffuseColorH = sunMoon.rawDiffuseColor * diffuseAmountH;
sunMoon.ambientColorL = sunMoon.rawAmbientColor * ambientAmountL;
sunMoon.diffuseColorL = sunMoon.rawDiffuseColor * diffuseAmountL;
sunMoon.ambientColorL4.r = sunMoon.ambientColorL.r;
sunMoon.ambientColorL4.g = sunMoon.ambientColorL.g;
sunMoon.ambientColorL4.b = sunMoon.ambientColorL.b;
sunMoon.ambientColorL4.a = 1.0f;
sunMoon.diffuseColorL4.r = sunMoon.diffuseColorL.r;
sunMoon.diffuseColorL4.g = sunMoon.diffuseColorL.g;
sunMoon.diffuseColorL4.b = sunMoon.diffuseColorL.b;
sunMoon.diffuseColorL4.a = 1.0f;
sunMoon.ambientColorH4.r = sunMoon.ambientColorH.r;
sunMoon.ambientColorH4.g = sunMoon.ambientColorH.g;
sunMoon.ambientColorH4.b = sunMoon.ambientColorH.b;
sunMoon.ambientColorH4.a = 1.0f;
sunMoon.diffuseColorH4.r = sunMoon.diffuseColorH.r;
sunMoon.diffuseColorH4.g = sunMoon.diffuseColorH.g;
sunMoon.diffuseColorH4.b = sunMoon.diffuseColorH.b;
sunMoon.diffuseColorH4.a = 1.0f;
sunMoon.vector4.x = sunMoon.vector.x;
sunMoon.vector4.y = sunMoon.vector.y;
sunMoon.vector4.z = sunMoon.vector.z;
sunMoon.vector4.w = 0.0f; // Parallel
//////////////////////////////////////////
// Set up the skybox
//////////////////////////////////////////
TextureManager* texman = TextureManager::Instance();
sunMoon.primarySkydomeTex = 0;
sunMoon.secondarySkydomeTex = 0;
switch( sunMoon.primarySky )
{
case SunMoon::SUNRISE: sunMoon.primarySkydomeTex = texman->GetTexture( "skydomeSunrise", 0 ); break;
case SunMoon::SUNSET: sunMoon.primarySkydomeTex = texman->GetTexture( "skydomeSunset", 0 ); break;
case SunMoon::DAYTIME: sunMoon.primarySkydomeTex = texman->GetTexture( "skydomeDay", day&1 ); break;
case SunMoon::NIGHT: sunMoon.primarySkydomeTex = texman->GetTexture( "skydomeNight", 0 ); break;
default:
GLASSERT( 0 );
}
if ( sunMoon.primarySky != sunMoon.secondarySky )
{
switch( sunMoon.secondarySky )
{
case SunMoon::SUNRISE: sunMoon.secondarySkydomeTex = texman->GetTexture( "skydomeSunrise", 0 ); break;
case SunMoon::SUNSET: sunMoon.secondarySkydomeTex = texman->GetTexture( "skydomeSunset", 0 ); break;
case SunMoon::DAYTIME: sunMoon.secondarySkydomeTex = texman->GetTexture( "skydomeDay", day&1 ); break;
case SunMoon::NIGHT: sunMoon.secondarySkydomeTex = texman->GetTexture( "skydomeNight", 0 ); break;
default:
GLASSERT( 0 );
}
}
if ( !sunMoon.secondarySkydomeTex )
{
sunMoon.skyColor = sunMoon.primarySkydomeTex->AverageOpaqueColor();
}
else
{
Color3F c0 = sunMoon.primarySkydomeTex->AverageOpaqueColor();
Color3F c1 = sunMoon.secondarySkydomeTex->AverageOpaqueColor();
sunMoon.skyColor.r = c0.r*(1.0f-sunMoon.skyBlend) + c1.r*sunMoon.skyBlend;
sunMoon.skyColor.g = c0.g*(1.0f-sunMoon.skyBlend) + c1.g*sunMoon.skyBlend;
sunMoon.skyColor.b = c0.b*(1.0f-sunMoon.skyBlend) + c1.b*sunMoon.skyBlend;
}
}