本文整理汇总了C++中BitmapText::SetZoom方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetZoom方法的具体用法?C++ BitmapText::SetZoom怎么用?C++ BitmapText::SetZoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetZoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScreenAttract
ScreenCredits::ScreenCredits( CString sName ) : ScreenAttract( sName )
{
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs );
// FIXME: Redo this screen with a BGA
CString sBackgroundsTransformFunction = ssprintf(
"function(self,offset,itemIndex,numItems) "
" self:x(%f*offset); "
" self:y(%f*offset); "
"end",
(float)BACKGROUNDS_SPACING_X,
(float)BACKGROUNDS_SPACING_Y );
m_ScrollerBackgrounds.SetName( "Backgrounds" );
m_ScrollerBackgrounds.Load3(
BACKGROUNDS_SCROLL_SECONDS_PER_ITEM,
4,
false,
sBackgroundsTransformFunction,
false );
SET_XY( m_ScrollerBackgrounds );
this->AddChild( &m_ScrollerBackgrounds );
m_ScrollerFrames.SetName( "Backgrounds" );
m_ScrollerFrames.Load3(
BACKGROUNDS_SCROLL_SECONDS_PER_ITEM,
4,
false,
sBackgroundsTransformFunction,
false );
SET_XY( m_ScrollerFrames );
this->AddChild( &m_ScrollerFrames );
float fTime = 0;
{
for( int i=0; i<NUM_BACKGROUNDS; i++ )
{
Song* pSong = NULL;
for( int j=0; j<50; j++ )
{
pSong = arraySongs[ rand()%arraySongs.size() ];
if( pSong->HasBackground() )
break;
}
Sprite* pBackground = new Sprite;
pBackground->LoadBG( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background") );
pBackground->ScaleToClipped( BACKGROUNDS_WIDTH, BACKGROUNDS_HEIGHT );
m_ScrollerBackgrounds.AddChild( pBackground );
Sprite* pFrame = new Sprite;
pFrame->Load( THEME->GetPathG("ScreenCredits","background frame") );
m_ScrollerFrames.AddChild( pFrame );
}
float fFirst = -2;
float fLast = NUM_BACKGROUNDS+2;
m_ScrollerBackgrounds.SetCurrentAndDestinationItem( fFirst );
m_ScrollerBackgrounds.SetDestinationItem( fLast );
m_ScrollerFrames.SetCurrentAndDestinationItem( fFirst );
m_ScrollerFrames.SetDestinationItem( fLast );
fTime = max( fTime, BACKGROUNDS_SCROLL_SECONDS_PER_ITEM*(fLast-fFirst) );
}
CString sTextsTransformFunction = ssprintf(
"function(self,offset,itemIndex,numItems) "
" self:x(%f*offset); "
" self:y(%f*offset); "
"end",
(float)TEXTS_SPACING_X,
(float)TEXTS_SPACING_Y );
m_ScrollerTexts.SetName( "Texts" );
m_ScrollerTexts.Load3(
TEXTS_SCROLL_SECONDS_PER_ITEM,
40,
false,
sTextsTransformFunction,
false );
SET_XY( m_ScrollerTexts );
this->AddChild( &m_ScrollerTexts );
{
for( unsigned i=0; i<ARRAYSIZE(CREDIT_LINES); i++ )
{
BitmapText* pText = new BitmapText;
pText->LoadFromFont( THEME->GetPathF("ScreenCredits","titles") );
pText->SetText( CREDIT_LINES[i].text );
switch( CREDIT_LINES[i].colorIndex )
{
case 1: pText->SetDiffuse( TEXTS_COLOR_INTRO ); break;
case 2: pText->SetDiffuse( TEXTS_COLOR_HEADER ); break;
case 0: pText->SetDiffuse( TEXTS_COLOR_NORMAL ); break;
default: ASSERT(0);
}
pText->SetZoom( TEXTS_ZOOM );
m_ScrollerTexts.AddChild( pText );
//.........这里部分代码省略.........