本文整理汇总了C++中BitmapText::SetX方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetX方法的具体用法?C++ BitmapText::SetX怎么用?C++ BitmapText::SetX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadExit
void OptionRow::LoadExit()
{
m_RowType = OptionRow::ROW_EXIT;
m_RowDef.name = EXIT_NAME;
m_RowDef.choices.push_back( "" );
BitmapText *bt = new BitmapText;
m_textItems.push_back( bt );
bt->LoadFromFont( THEME->GetPathF(m_sType,"item") );
CString sText = "Exit";
PrepareItemText( sText );
bt->SetText( sText );
bt->RunCommands( ITEMS_ON_COMMAND );
bt->SetShadowLength( 0 );
bt->SetX( ITEMS_LONG_ROW_SHARED_X );
m_Frame.AddChild( bt );
FOREACH_PlayerNumber( p )
m_OptionIcons[p].SetHidden( true );
m_sprBullet.SetHidden( true );
m_textTitle.SetHidden( true );
}
示例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 );
}
}
示例3: Set
void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
{
using std::max;
const float fFirstSecond = 0;
const float fLastSecond = s.GetTotalPossibleStepsSeconds();
// Find the largest combo.
int iMaxComboSize = 0;
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
iMaxComboSize = max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() );
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
{
const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; // too small
const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize);
LOG->Trace( "combo %i is %f+%f of %f", i, combo.m_fStartSecond, combo.m_fSizeSeconds, fLastSecond );
Actor *pSprite = bIsMax? m_pMaxCombo->Copy() : m_pNormalCombo->Copy();
const float fStart = Rage::scale( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f );
const float fSize = Rage::scale( combo.m_fSizeSeconds, 0.f, fLastSecond-fFirstSecond, 0.0f, 1.0f );
pSprite->SetCropLeft ( Rage::scale( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) );
pSprite->SetCropRight( Rage::scale( fSize, 0.0f, 1.0f, 0.5f, 0.0f ) );
pSprite->SetCropLeft( fStart );
pSprite->SetCropRight( 1 - (fSize + fStart) );
this->AddChild( pSprite );
}
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
{
const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; // too small
if( !iMaxComboSize )
continue;
const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize);
if( !bIsMax )
continue;
BitmapText *pText = m_pComboNumber->Copy();
const float fStart = Rage::scale( combo.m_fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f );
const float fSize = Rage::scale( combo.m_fSizeSeconds, 0.f, fLastSecond-fFirstSecond, 0.0f, 1.0f );
const float fCenterPercent = fStart + fSize/2;
const float fCenterXPos = Rage::scale( fCenterPercent, 0.0f, 1.0f, -BODY_WIDTH/2.0f, BODY_WIDTH/2.0f );
pText->SetX( fCenterXPos );
pText->SetText( fmt::sprintf("%i",combo.GetStageCnt()) );
this->AddChild( pText );
}
// Hide the templates.
m_pNormalCombo->SetVisible( false );
m_pMaxCombo->SetVisible( false );
m_pComboNumber->SetVisible( false );
}
示例4: AfterImportOptions
//.........这里部分代码省略.........
if( fX > ITEMS_END_X )
{
m_RowDef.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
break;
}
}
}
//
// load m_textItems
//
switch( m_RowDef.layoutType )
{
case LAYOUT_SHOW_ONE_IN_ROW:
// init text
FOREACH_HumanPlayer( p )
{
BitmapText *bt = new BitmapText;
m_textItems.push_back( bt );
const int iChoiceInRowWithFocus = m_iChoiceInRowWithFocus[p];
bt->LoadFromFont( THEME->GetPathF(m_sType,"item") );
CString sText = (iChoiceInRowWithFocus==-1) ? "" : m_RowDef.choices[iChoiceInRowWithFocus];
// ugly hack for Speed mods --infamouspat
PrepareItemText( sText );
bt->SetText( sText );
bt->RunCommands( ITEMS_ON_COMMAND );
bt->SetShadowLength( 0 );
if( m_RowDef.bOneChoiceForAllPlayers )
{
bt->SetX( ITEMS_LONG_ROW_SHARED_X );
break; // only initialize one item since it's shared
}
else
{
bt->SetX( ITEMS_LONG_ROW_X.GetValue(p) );
}
}
// init underlines
FOREACH_HumanPlayer( p )
{
OptionsCursor *ul = new OptionsCursor;
m_Underline[p].push_back( ul );
ul->Load( m_sType, OptionsCursor::underline );
ul->Set( p );
int iWidth, iX, iY;
GetWidthXY( p, 0, iWidth, iX, iY );
ul->SetX( float(iX) );
ul->SetWidth( float(iWidth) );
}
break;
case LAYOUT_SHOW_ALL_IN_ROW:
{
float fX = ITEMS_START_X;
for( unsigned c=0; c<m_RowDef.choices.size(); c++ )
{
// init text
BitmapText *bt = new BitmapText;
m_textItems.push_back( bt );
bt->LoadFromFont( THEME->GetPathF(m_sType,"item") );
CString sText = m_RowDef.choices[c];