本文整理汇总了C++中BitmapText::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetName方法的具体用法?C++ BitmapText::SetName怎么用?C++ BitmapText::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetChoices
void LinkedOptionsMenu::SetChoices( const CStringArray &asChoices )
{
ClearChoices();
for( unsigned i = 0; i < asChoices.size(); i++ )
{
CString ch = asChoices[i];
BitmapText *bt = new BitmapText;
m_Rows.push_back( bt );
bt->LoadFromFont( THEME->GetPathF( m_sName, "menutext" ) );
bt->SetName( "Row" );
bt->SetXY( ROW_OFFSET_X, ROW_OFFSET_Y + (ROW_SPACING_Y * (float)(i % ROWS_PER_PAGE)) );
bt->SetText( ch );
m_Frame.AddChild( bt );
ON_COMMAND( *bt );
}
// show first page of choices
for( unsigned i = 0; i < asChoices.size() && i < (unsigned)ROWS_PER_PAGE; i++ )
{
m_Rows[i]->PlayCommand("TweenOn");
}
m_iCurPage = 0;
if ( asChoices.size() > (unsigned)ROWS_PER_PAGE )
{
m_sprIndicatorDown.PlayCommand("TweenOn");
m_bIndTweenedOn[1] = true;
}
if ( m_Rows.size() > 0 )
{
if ( m_bFocus ) m_Cursor.PlayCommand( "TweenOn" );
m_Cursor.SetXY( CURSOR_OFFSET_X + m_Rows[0]->GetX(), m_Rows[0]->GetY() );
m_Cursor.SetBarWidth( floor(m_Rows[0]->GetZoomedWidth()) );
m_iCurrentSelection = 0;
}
else
{
m_iCurrentSelection = -1;
m_Cursor.PlayCommand( "TweenOff" );
if ( m_bFocus )
SCREENMAN->PostMessageToTopScreen( m_smChangeMenu, 0.0f );
}
}
示例2: Init
// begin ScreenTextEntryVisual
void ScreenTextEntryVisual::Init()
{
ROW_START_X.Load( m_sName, "RowStartX" );
ROW_START_Y.Load( m_sName, "RowStartY" );
ROW_END_X.Load( m_sName, "RowEndX" );
ROW_END_Y.Load( m_sName, "RowEndY" );
ScreenTextEntry::Init();
m_sprCursor.Load( THEME->GetPathG(m_sName,"cursor") );
m_sprCursor->SetName( "Cursor" );
LOAD_ALL_COMMANDS( m_sprCursor );
this->AddChild( m_sprCursor );
// Init keyboard
{
BitmapText text;
text.LoadFromFont( THEME->GetPathF(m_sName,"keyboard") );
text.SetName( "Keys" );
ActorUtil::LoadAllCommands( text, m_sName );
text.PlayCommand( "Init" );
FOREACH_KeyboardRow( r )
{
for( int x=0; x<KEYS_PER_ROW; ++x )
{
BitmapText *&pbt = m_ptextKeys[r][x];
pbt = text.Copy();
this->AddChild( pbt );
RString s = g_szKeys[r][x];
if( !s.empty() && r == KEYBOARD_ROW_SPECIAL )
s = THEME->GetString( m_sName, s );
pbt->SetText( s );
}
}
}
m_sndChange.Load( THEME->GetPathS(m_sName,"change"), true );
}
示例3: Init
void ScreenDebugOverlay::Init()
{
Screen::Init();
// Init debug mappings
// TODO: Arch-specific?
{
g_Mappings.Clear();
g_Mappings.holdForDebug1 = DeviceInput(DEVICE_KEYBOARD, KEY_F3);
g_Mappings.holdForDebug2.MakeInvalid();
g_Mappings.holdForSlow = DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT);
g_Mappings.holdForFast = DeviceInput(DEVICE_KEYBOARD, KEY_TAB);
g_Mappings.toggleMute = DeviceInput(DEVICE_KEYBOARD, KEY_PAUSE);
/* TODO: Find a better way of indicating which option is which here.
* Maybe we should take a page from ScreenEdit's menus and make
* RowDefs()? */
int i=0;
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F8);
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F7);
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F6);
i=0;
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C1);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C2);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C3);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C4);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C5);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C6);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C7);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C8);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C9);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C0);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cq);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cw);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ce);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cr);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ct);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cy);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ci);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Co);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cp);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ca);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cs);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cd);
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F5)] = 0;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F6)] = 1;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F7)] = 2;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F8)] = 3;
}
std::map<std::string,int> iNextDebugButton;
int iNextGameplayButton = 0;
for (auto *p: *g_pvpSubscribers)
{
std::string sPageName = p->GetPageName();
DeviceInput di;
switch( p->GetType() )
{
case IDebugLine::all_screens:
di = g_Mappings.debugButton[iNextDebugButton[sPageName]++];
break;
case IDebugLine::gameplay_only:
di = g_Mappings.gameplayButton[iNextGameplayButton++];
break;
}
p->m_Button = di;
if( find(m_asPages.begin(), m_asPages.end(), sPageName) == m_asPages.end() )
m_asPages.push_back( sPageName );
}
m_iCurrentPage = 0;
m_bForcedHidden = false;
m_Quad.StretchTo( Rage::RectF( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
m_Quad.SetDiffuse( BACKGROUND_COLOR );
this->AddChild( &m_Quad );
// if you're going to add user commands, make sure to have the overrides
// set after parsing the metrics. -aj
m_textHeader.SetName( "HeaderText" );
m_textHeader.LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "header") );
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textHeader );
m_textHeader.SetText( DEBUG_MENU.GetValue() );
this->AddChild( &m_textHeader );
for (auto s = m_asPages.begin(); s != m_asPages.end(); ++s)
{
int iPage = s - m_asPages.begin();
DeviceInput di;
bool b = GetKeyFromMap( g_Mappings.pageButton, iPage, di );
ASSERT( b );
std::string sButton = INPUTMAN->GetDeviceSpecificInputString( di );
//.........这里部分代码省略.........
示例4: Init
void ScreenDebugOverlay::Init()
{
Screen::Init();
// Init debug mappings
// TODO: Arch-specific?
{
g_Mappings.Clear();
g_Mappings.holdForDebug1 = DeviceInput(DEVICE_KEYBOARD, KEY_F3);
g_Mappings.holdForDebug2.MakeInvalid();
g_Mappings.holdForSlow = DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT);
g_Mappings.holdForFast = DeviceInput(DEVICE_KEYBOARD, KEY_TAB);
/* TODO: Find a better way of indicating which option is which here.
* Maybe we should take a page from ScreenEdit's menus and make
* RowDefs()? */
int i=0;
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F8);
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F7);
g_Mappings.gameplayButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_F6);
i=0;
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C1);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C2);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C3);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C4);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C5);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C6);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C7);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C8);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C9);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_C0);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cq);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cw);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ce);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cr);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ct);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cy);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cu);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Ci);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Co);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_Cp);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_UP);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_DOWN);
g_Mappings.debugButton[i++] = DeviceInput(DEVICE_KEYBOARD, KEY_BACK);
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F5)] = 0;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F6)] = 1;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F7)] = 2;
g_Mappings.pageButton[DeviceInput(DEVICE_KEYBOARD, KEY_F8)] = 3;
}
map<RString,int> iNextDebugButton;
int iNextGameplayButton = 0;
FOREACH( IDebugLine*, *g_pvpSubscribers, p )
{
RString sPageName = (*p)->GetPageName();
DeviceInput di;
switch( (*p)->GetType() )
{
case IDebugLine::all_screens:
di = g_Mappings.debugButton[iNextDebugButton[sPageName]++];
break;
case IDebugLine::gameplay_only:
di = g_Mappings.gameplayButton[iNextGameplayButton++];
break;
}
(*p)->m_Button = di;
if( find(m_asPages.begin(), m_asPages.end(), sPageName) == m_asPages.end() )
m_asPages.push_back( sPageName );
}
m_iCurrentPage = 0;
m_bForcedHidden = false;
m_Quad.StretchTo( RectF( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
m_Quad.SetDiffuse( BACKGROUND_COLOR );
this->AddChild( &m_Quad );
// if you're going to add user commands, make sure to have the overrides
// set after parsing the metrics. -aj
m_textHeader.SetName( "HeaderText" );
m_textHeader.LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "header") );
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textHeader );
m_textHeader.SetText( DEBUG_MENU );
this->AddChild( &m_textHeader );
FOREACH_CONST( RString, m_asPages, s )
{
int iPage = s - m_asPages.begin();
DeviceInput di;
bool b = GetKeyFromMap( g_Mappings.pageButton, iPage, di );
ASSERT( b );
RString sButton = INPUTMAN->GetDeviceSpecificInputString( di );
BitmapText *p = new BitmapText;
//.........这里部分代码省略.........
示例5: 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 );
}
}