本文整理汇总了C++中Sprite::GetUnzoomedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::GetUnzoomedWidth方法的具体用法?C++ Sprite::GetUnzoomedWidth怎么用?C++ Sprite::GetUnzoomedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite::GetUnzoomedWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFromAniLayerFile
//.........这里部分代码省略.........
case EFFECT_STRETCH_SCROLL_UP: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = +0.5f; break;
case EFFECT_STRETCH_SCROLL_DOWN: m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = -0.5f; break;
default: break;
}
}
break;
case EFFECT_STRETCH_SPIN:
{
m_Type = TYPE_SPRITE;
Sprite* pSprite = new Sprite;
this->AddChild( pSprite );
pSprite->Load( Sprite::SongBGTexture(sPath) );
const RectF StretchedFullScreenRectF(
FullScreenRectF.left-200,
FullScreenRectF.top-200,
FullScreenRectF.right+200,
FullScreenRectF.bottom+200 );
pSprite->ScaleToCover( StretchedFullScreenRectF );
pSprite->SetEffectSpin( RageVector3(0,0,60) );
}
break;
case EFFECT_PARTICLES_SPIRAL_OUT:
case EFFECT_PARTICLES_SPIRAL_IN:
case EFFECT_PARTICLES_FLOAT_UP:
case EFFECT_PARTICLES_FLOAT_DOWN:
case EFFECT_PARTICLES_FLOAT_LEFT:
case EFFECT_PARTICLES_FLOAT_RIGHT:
case EFFECT_PARTICLES_BOUNCE:
{
m_Type = TYPE_PARTICLES;
Sprite s;
s.Load( sPath );
int iSpriteArea = int( s.GetUnzoomedWidth()*s.GetUnzoomedHeight() );
const int iMaxArea = int(SCREEN_WIDTH*SCREEN_HEIGHT);
int iNumParticles = iMaxArea / iSpriteArea;
iNumParticles = min( iNumParticles, MAX_SPRITES );
for( int i=0; i<iNumParticles; i++ )
{
Sprite* pSprite = new Sprite;
this->AddChild( pSprite );
pSprite->Load( sPath );
pSprite->SetZoom( 0.7f + 0.6f*i/(float)iNumParticles );
switch( effect )
{
case EFFECT_PARTICLES_BOUNCE:
pSprite->SetX( randomf( GetGuardRailLeft(pSprite), GetGuardRailRight(pSprite) ) );
pSprite->SetY( randomf( GetGuardRailTop(pSprite), GetGuardRailBottom(pSprite) ) );
break;
default:
pSprite->SetX( randomf( GetOffScreenLeft(pSprite), GetOffScreenRight(pSprite) ) );
pSprite->SetY( randomf( GetOffScreenTop(pSprite), GetOffScreenBottom(pSprite) ) );
break;
}
switch( effect )
{
case EFFECT_PARTICLES_FLOAT_UP:
case EFFECT_PARTICLES_SPIRAL_OUT:
m_vParticleVelocity.push_back( RageVector3( 0, -PARTICLE_SPEED*pSprite->GetZoom(), 0 ) );
break;
case EFFECT_PARTICLES_FLOAT_DOWN:
case EFFECT_PARTICLES_SPIRAL_IN:
m_vParticleVelocity.push_back( RageVector3( 0, PARTICLE_SPEED*pSprite->GetZoom(), 0 ) );
break;
示例2: Load
void ComboGraph::Load( CString Path, const StageStats &s, PlayerNumber pn )
{
ASSERT( m_SubActors.size() == 0 );
/* Find the largest combo. */
int MaxComboSize = 0;
unsigned i;
for( i = 0; i < s.ComboList[pn].size(); ++i )
MaxComboSize = max( MaxComboSize, s.ComboList[pn][i].GetStageCnt() );
float width = -1;
for( i = 0; i < s.ComboList[pn].size(); ++i )
{
const StageStats::Combo_t &combo = s.ComboList[pn][i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; /* too small */
const bool IsMax = (combo.GetStageCnt() == MaxComboSize);
LOG->Trace("combo %i is %f+%f", i, combo.fStartSecond, combo.fSizeSeconds);
Sprite *sprite = new Sprite;
sprite->SetName( "ComboBar" );
const CString path = ssprintf( "%s %s", Path.c_str(), IsMax? "max":"normal" );
sprite->Load( THEME->GetPathToG(path) );
const float start = SCALE( combo.fStartSecond, s.fFirstSecond[pn], s.fLastSecond[pn], 0.0f, 1.0f );
const float size = SCALE( combo.fSizeSeconds, 0, s.fLastSecond[pn]-s.fFirstSecond[pn], 0.0f, 1.0f );
sprite->SetCropLeft ( SCALE( size, 0.0f, 1.0f, 0.5f, 0.0f ) );
sprite->SetCropRight( SCALE( size, 0.0f, 1.0f, 0.5f, 0.0f ) );
sprite->BeginTweening( .5f );
sprite->SetCropLeft( start );
sprite->SetCropRight( 1 - (size + start) );
if( width < 0 )
width = sprite->GetUnzoomedWidth();
m_Sprites.push_back( sprite );
this->AddChild( sprite );
}
for( i = 0; i < s.ComboList[pn].size(); ++i )
{
const StageStats::Combo_t &combo = s.ComboList[pn][i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; /* too small */
if( !MaxComboSize )
continue;
const bool IsMax = (combo.GetStageCnt() == MaxComboSize);
if( !IsMax )
continue;
BitmapText *text = new BitmapText;
text->SetName( "ComboMaxNumber" );
text->LoadFromFont( THEME->GetPathToF(Path) );
const float start = SCALE( combo.fStartSecond, s.fFirstSecond[pn], s.fLastSecond[pn], 0.0f, 1.0f );
const float size = SCALE( combo.fSizeSeconds, 0, s.fLastSecond[pn]-s.fFirstSecond[pn], 0.0f, 1.0f );
const float CenterPercent = start + size/2;
const float CenterXPos = SCALE( CenterPercent, 0.0f, 1.0f, -width/2.0f, width/2.0f );
text->SetX( CenterXPos );
text->SetText( ssprintf("%i",combo.GetStageCnt()) );
ON_COMMAND( text );
m_Numbers.push_back( text );
this->AddChild( text );
}
}