本文整理汇总了C++中BitmapText::SetMaxWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetMaxWidth方法的具体用法?C++ BitmapText::SetMaxWidth怎么用?C++ BitmapText::SetMaxWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetMaxWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void ScreenUnlockStatus::Init()
{
ScreenAttract::Init();
unsigned iNumUnlocks = UNLOCKMAN->m_UnlockEntries.size();
if( !PREFSMAN->m_bUseUnlockSystem || iNumUnlocks == 0 )
{
this->PostScreenMessage( SM_GoToNextScreen, 0 );
return;
}
unsigned NumUnlocks = UNLOCKMAN->m_UnlockEntries.size();
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathF("Common","normal") );
PointsUntilNextUnlock.SetHorizAlign( align_left );
apActorCommands IconCommand = ICON_COMMAND;
for( unsigned i=1; i <= NumUnlocks; i++ )
{
// get pertaining UnlockEntry
const UnlockEntry &entry = UNLOCKMAN->m_UnlockEntries[i-1];
const Song *pSong = entry.m_Song.ToSong();
if( pSong == NULL)
continue;
Sprite* pSpr = new Sprite;
// new unlock graphic
pSpr->Load( THEME->GetPathG("ScreenUnlockStatus",ssprintf("%04d icon", i)) );
// set graphic location
pSpr->SetName( ssprintf("Unlock%04d",i) );
LOAD_ALL_COMMANDS_AND_SET_XY( pSpr );
pSpr->RunCommands(IconCommand);
Unlocks.push_back(pSpr);
if ( !entry.IsLocked() )
this->AddChild(Unlocks[Unlocks.size() - 1]);
}
// scrolling text
if (UNLOCK_TEXT_SCROLL != 0)
{
float ScrollingTextX = UNLOCK_TEXT_SCROLL_X;
float ScrollingTextStartY = UNLOCK_TEXT_SCROLL_START_Y;
float ScrollingTextEndY = UNLOCK_TEXT_SCROLL_END_Y;
float ScrollingTextZoom = UNLOCK_TEXT_SCROLL_ZOOM;
float ScrollingTextRows = UNLOCK_TEXT_SCROLL_ROWS;
float MaxWidth = UNLOCK_TEXT_SCROLL_MAX_WIDTH;
float SecondsToScroll = TIME_TO_DISPLAY;
if (SecondsToScroll > 2) SecondsToScroll--;
float SECS_PER_CYCLE = 0;
if (UNLOCK_TEXT_SCROLL != 3)
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows + NumUnlocks);
else
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4);
for(unsigned i = 1; i <= NumUnlocks; i++)
{
const UnlockEntry &entry = UNLOCKMAN->m_UnlockEntries[i-1];
BitmapText* text = new BitmapText;
text->LoadFromFont( THEME->GetPathF("ScreenUnlockStatus","text") );
text->SetHorizAlign( align_left );
text->SetZoom(ScrollingTextZoom);
switch( entry.m_Type )
{
case UnlockRewardType_Song:
{
const Song *pSong = entry.m_Song.ToSong();
ASSERT( pSong != NULL );
RString title = pSong->GetDisplayMainTitle();
RString subtitle = pSong->GetDisplaySubTitle();
if( subtitle != "" )
title = title + "\n" + subtitle;
text->SetMaxWidth( MaxWidth );
text->SetText( title );
}
break;
case UnlockRewardType_Course:
{
const Course *pCourse = entry.m_Course.ToCourse();
ASSERT( pCourse != NULL );
text->SetMaxWidth( MaxWidth );
text->SetText( pCourse->GetDisplayFullTitle() );
text->SetDiffuse( RageColor(0,1,0,1) );
}
break;
default:
//.........这里部分代码省略.........
示例2: ScreenAttract
ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
{
LOG->Trace("ScreenUnlock::ScreenUnlock()");
unsigned NumUnlocks = NUM_UNLOCKS;
if (UNLOCKMAN->m_SongEntries.size() < NumUnlocks)
NumUnlocks = UNLOCKMAN->m_SongEntries.size();
if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0)
{
this->HandleScreenMessage( SM_GoToNextScreen );
return;
}
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );
unsigned i;
CString IconCommand = ICON_COMMAND;
for(i=1; i <= NumUnlocks; i++)
{
// get pertaining UnlockEntry
CString SongTitle = DISPLAYED_SONG(i);
if (USE_UNLOCKS_DAT == 1)
if ((unsigned)i <= UNLOCKMAN->m_SongEntries.size() )
SongTitle = UNLOCKMAN->m_SongEntries[i-1].m_sSongName;
LOG->Trace("UnlockScreen: Searching for %s", SongTitle.c_str());
const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry( SongTitle );
if( pSong == NULL)
{
LOG->Trace("Can't find song %s", SongTitle.c_str());
continue;
}
Sprite* entry = new Sprite;
// new unlock graphic
entry->Load( THEME->GetPathToG(ssprintf("ScreenUnlock %d icon", i)) );
// set graphic location
entry->SetName( ssprintf("Unlock%d",i) );
SET_XY( *entry );
entry->Command(IconCommand);
Unlocks.push_back(entry);
if ( !pSong->IsLocked() )
this->AddChild(Unlocks[Unlocks.size() - 1]);
}
// scrolling text
if (UNLOCK_TEXT_SCROLL != 0)
{
float ScrollingTextX = UNLOCK_TEXT_SCROLL_X;
float ScrollingTextStartY = UNLOCK_TEXT_SCROLL_START_Y;
float ScrollingTextEndY = UNLOCK_TEXT_SCROLL_END_Y;
float ScrollingTextZoom = UNLOCK_TEXT_SCROLL_ZOOM;
float ScrollingTextRows = UNLOCK_TEXT_SCROLL_ROWS;
float MaxWidth = UNLOCK_TEXT_SCROLL_MAX_WIDTH;
float SecondsToScroll = TIME_TO_DISPLAY;
if (SecondsToScroll > 2) SecondsToScroll--;
float SECS_PER_CYCLE = 0;
if (UNLOCK_TEXT_SCROLL != 3)
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows + NumUnlocks);
else
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumUnlocks + 4);
for(i = 1; i <= NumUnlocks; i++)
{
CString DisplayedSong = DISPLAYED_SONG(i);
if (USE_UNLOCKS_DAT == 1)
if ((unsigned)i <= UNLOCKMAN->m_SongEntries.size() )
DisplayedSong = UNLOCKMAN->m_SongEntries[i-1].m_sSongName;
DisplayedSong.MakeUpper();
const UnlockEntry *pSong = UNLOCKMAN->FindLockEntry(DisplayedSong);
if ( pSong == NULL ) // no such song
continue;
BitmapText* text = new BitmapText;
text->LoadFromFont( THEME->GetPathToF("ScreenUnlock text") );
text->SetHorizAlign( Actor::align_left );
text->SetZoom(ScrollingTextZoom);
if (pSong && pSong->m_pSong != NULL)
{
CString title = pSong->m_pSong->GetDisplayMainTitle();
CString subtitle = pSong->m_pSong->GetDisplaySubTitle();
if( subtitle != "" )
title = title + "\n" + subtitle;
text->SetMaxWidth( MaxWidth );
text->SetText( title );
}
//.........这里部分代码省略.........