本文整理汇总了C++中BitmapText::GetZoomedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::GetZoomedWidth方法的具体用法?C++ BitmapText::GetZoomedWidth怎么用?C++ BitmapText::GetZoomedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::GetZoomedWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfterImportOptions
void OptionRow::AfterImportOptions()
{
// Make all selections the same if bOneChoiceForAllPlayers
// Hack: we only import active players, so if only player 2 is imported,
// we need to copy p2 to p1, not p1 to p2.
if( m_RowDef.bOneChoiceForAllPlayers )
{
PlayerNumber pnCopyFrom = GAMESTATE->m_MasterPlayerNumber;
if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID )
pnCopyFrom = PLAYER_1;
FOREACH_PlayerNumber( p )
m_vbSelected[p] = m_vbSelected[pnCopyFrom];
}
FOREACH_PlayerNumber( p )
{
switch( m_RowDef.selectType )
{
case SELECT_ONE:
{
/* Make sure the row actually has a selection. */
bool bHasASelection = false;
for( unsigned i=0; i<m_vbSelected[p].size(); i++ )
{
if( m_vbSelected[p][i] )
bHasASelection = true;
}
if( !bHasASelection && !m_vbSelected[p].empty() )
m_vbSelected[p][0] = true;
m_iChoiceInRowWithFocus[p] = GetOneSelection(p, true); // focus on the selection we just set
}
break;
case SELECT_MULTIPLE:
case SELECT_NONE:
m_iChoiceInRowWithFocus[p] = 0;
break;
default:
ASSERT(0);
}
}
// init row icons
FOREACH_HumanPlayer( p )
{
LoadOptionIcon( p, "" );
}
// If the items will go off the edge of the screen, then re-init with the "long row" style.
{
BitmapText bt;
bt.LoadFromFont( THEME->GetPathF(m_sType,"item") );
bt.RunCommands( ITEMS_ON_COMMAND );
float fX = ITEMS_START_X;
for( unsigned c=0; c<m_RowDef.choices.size(); c++ )
{
CString sText = m_RowDef.choices[c];
PrepareItemText( sText );
bt.SetText( sText );
fX += bt.GetZoomedWidth();
if( c != m_RowDef.choices.size()-1 )
fX += ITEMS_GAP_X;
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 );
//.........这里部分代码省略.........