本文整理汇总了C++中BitmapText::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetText方法的具体用法?C++ BitmapText::SetText怎么用?C++ BitmapText::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScreenAttract
ScreenMusicScroll::ScreenMusicScroll( CString sClassName ) : ScreenAttract( sClassName )
{
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs );
unsigned i;
for( i=0; i < arraySongs.size(); i++ )
{
BitmapText *bt = new BitmapText;
m_textLines.push_back(bt);
Song* pSong = arraySongs[i];
bt->LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
bt->SetText( pSong->GetFullDisplayTitle(), pSong->GetFullTranslitTitle() );
bt->SetDiffuse( SONGMAN->GetSongColor(pSong) );
bt->SetZoom( TEXT_ZOOM );
this->AddChild( bt );
}
// for( i=0; i<min(NUM_CREDIT_LINES, MAX_CREDIT_LINES); i++ )
// {
// m_textLines[m_iNumLines].LoadFromFont( THEME->GetPathToF("ScreenMusicScroll titles") );
// m_textLines[m_iNumLines].SetText( CREDIT_LINES[i] );
// m_textLines[m_iNumLines].SetZoom( TEXT_ZOOM );
//
// m_iNumLines++;
// }
for( i=0; i<m_textLines.size(); i++ )
{
m_textLines[i]->SetXY( CENTER_X, SCREEN_BOTTOM + 40 );
m_textLines[i]->BeginTweening( SCROLL_DELAY * i );
m_textLines[i]->BeginTweening( 2.0f*SCROLL_SPEED );
m_textLines[i]->SetXY( CENTER_X, SCREEN_TOP - 40 );
}
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
this->PostScreenMessage( SM_BeginFadingOut, 0.2f * i + 3.0f );
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("music scroll") );
}
示例2: 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 );
}
}
示例3: 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 );
}
示例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);
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 );
//.........这里部分代码省略.........
示例5: 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;
//.........这里部分代码省略.........
示例6: 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:
//.........这里部分代码省略.........
示例7: SetPage
//.........这里部分代码省略.........
CourseScoreRowItem *pCourseScoreRowItem = m_vpCourseScoreRowItem[s];
pCourseScoreRowItem->m_sprSongFrame.Reset();
pCourseScoreRowItem->m_sprSongFrame.SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
pCourseScoreRowItem->m_sprSongFrame.SetUseZBuffer( true );
ON_COMMAND( pCourseScoreRowItem->m_sprSongFrame );
pCourseScoreRowItem->m_textSongTitle.Reset();
pCourseScoreRowItem->m_textSongTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
pCourseScoreRowItem->m_textSongTitle.SetUseZBuffer( true );
ON_COMMAND( pCourseScoreRowItem->m_textSongTitle );
FOREACH_ShownCourseDifficulty(d)
{
pCourseScoreRowItem->m_textStepsScore[d].Reset();
pCourseScoreRowItem->m_textStepsScore[d].SetXY( COURSE_SCORE_OFFSET_X(d), COURSE_SCORE_OFFSET_Y );
pCourseScoreRowItem->m_textStepsScore[d].SetUseZBuffer( true );
pCourseScoreRowItem->m_textStepsScore[d].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
ON_COMMAND( pCourseScoreRowItem->m_textStepsScore[d] );
}
}
}
}
// get ranking feat list
//
// init page
//
switch( pts.type )
{
case PAGE_TYPE_CATEGORY:
{
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );
for( int l=0; l<NUM_RANKING_LINES; l++ )
{
HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(pts.nt,pts.category);
HighScore hs;
bool bRecentHighScore = false;
if( l < (int)hsl.vHighScores.size() )
{
hs = hsl.vHighScores[l];
CString *psName = &hsl.vHighScores[l].sName;
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
else
{
hs.sName = NO_SCORE_NAME;
}
m_textNames[l].SetText( hs.GetDisplayName() );
m_textScores[l].SetText( ssprintf("%09i",hs.iScore) );
m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR(pts.colorIndex) );
if( bRecentHighScore )
{
m_textNames[l].SetEffectGlowBlink(0.1f);
m_textScores[l].SetEffectGlowBlink(0.1f);
}
else
{
m_textNames[l].SetEffectNone();
m_textScores[l].SetEffectNone();
示例8: LoadFromWheelItemData
void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID )
{
ASSERT( pWID != NULL );
data = pWID;
/*
// copy all data items
this->m_Type = pWID->m_Type;
this->m_sSectionName = pWID->m_sSectionName;
this->m_pCourse = pWID->m_pCourse;
this->m_pSong = pWID->m_pSong;
this->m_color = pWID->m_color;
this->m_Type = pWID->m_Type; */
// init type specific stuff
switch( pWID->m_Type )
{
case TYPE_SECTION:
case TYPE_COURSE:
case TYPE_SORT:
{
CString sDisplayName, sTranslitName;
BitmapText *bt = NULL;
switch( pWID->m_Type )
{
case TYPE_SECTION:
sDisplayName = SONGMAN->ShortenGroupName(data->m_sSectionName);
bt = &m_textSectionName;
break;
case TYPE_COURSE:
sDisplayName = data->m_pCourse->GetFullDisplayTitle();
sTranslitName = data->m_pCourse->GetFullTranslitTitle();
bt = &m_textCourse;
break;
case TYPE_SORT:
sDisplayName = data->m_sLabel;
bt = &m_textSort;
break;
default:
ASSERT(0);
}
bt->SetZoom( 1 );
bt->SetText( sDisplayName, sTranslitName );
bt->SetDiffuse( data->m_color );
bt->TurnRainbowOff();
const float fSourcePixelWidth = (float)bt->GetUnzoomedWidth();
const float fMaxTextWidth = 200;
if( fSourcePixelWidth > fMaxTextWidth )
bt->SetZoomX( fMaxTextWidth / fSourcePixelWidth );
}
break;
case TYPE_SONG:
{
m_TextBanner.LoadFromSong( data->m_pSong );
m_TextBanner.SetDiffuse( data->m_color );
m_WheelNotifyIcon.SetFlags( data->m_Flags );
RefreshGrades();
}
break;
case TYPE_ROULETTE:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Roulette") );
break;
case TYPE_RANDOM:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Random") );
break;
case TYPE_PORTAL:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Portal") );
break;
default:
ASSERT( 0 ); // invalid type
}
}
示例9: ScreenAttract
ScreenCredits::ScreenCredits( CString sName ) : ScreenAttract( sName )
{
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs );
SongUtil::SortSongPointerArrayByTitle( arraySongs );
// FIXME: Redo this screen with a BGA
m_ScrollerBackgrounds.SetName( "Backgrounds" );
m_ScrollerBackgrounds.Load(
BACKGROUNDS_SCROLL_SECONDS_PER_ITEM,
4,
RageVector3(0, 0, 0),
RageVector3(0, 0, 0),
RageVector3(BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y, 0),
RageVector3(0, 0, 0) );
SET_XY( m_ScrollerBackgrounds );
this->AddChild( &m_ScrollerBackgrounds );
m_ScrollerFrames.SetName( "Backgrounds" );
m_ScrollerFrames.Load(
BACKGROUNDS_SCROLL_SECONDS_PER_ITEM,
4,
RageVector3(0, 0, 0),
RageVector3(0, 0, 0),
RageVector3(BACKGROUNDS_SPACING_X, BACKGROUNDS_SPACING_Y, 0),
RageVector3(0, 0, 0) );
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->GetPathToG("Common fallback background") );
pBackground->ScaleToClipped( BACKGROUNDS_WIDTH, BACKGROUNDS_HEIGHT );
m_ScrollerBackgrounds.AddChild( pBackground );
Sprite* pFrame = new Sprite;
pFrame->Load( THEME->GetPathToG("ScreenCredits background frame") );
m_ScrollerFrames.AddChild( pFrame );
}
const int iFirst = -2, iLast = NUM_BACKGROUNDS+2;
m_ScrollerBackgrounds.SetCurrentAndDestinationItem( iFirst );
m_ScrollerBackgrounds.SetDestinationItem( iLast );
m_ScrollerFrames.SetCurrentAndDestinationItem( iFirst );
m_ScrollerFrames.SetDestinationItem( iLast );
fTime = max( fTime, BACKGROUNDS_SCROLL_SECONDS_PER_ITEM*(iLast-iFirst) );
}
m_ScrollerTexts.SetName( "Texts" );
m_ScrollerTexts.Load(
TEXTS_SCROLL_SECONDS_PER_ITEM,
40,
RageVector3(0, 0, 0),
RageVector3(0, 0, 0),
RageVector3(TEXTS_SPACING_X, TEXTS_SPACING_Y, 0),
RageVector3(0, 0, 0) );
SET_XY( m_ScrollerTexts );
this->AddChild( &m_ScrollerTexts );
{
for( unsigned i=0; i<ARRAYSIZE(CREDIT_LINES); i++ )
{
BitmapText* pText = new BitmapText;
pText->LoadFromFont( THEME->GetPathToF("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 );
}
const int iFirst = -10, iLast = ARRAYSIZE(CREDIT_LINES)+10;
m_ScrollerTexts.SetCurrentAndDestinationItem( iFirst );
m_ScrollerTexts.SetDestinationItem( iLast );
fTime = max( fTime, TEXTS_SCROLL_SECONDS_PER_ITEM*(iLast-iFirst) );
}
m_Overlay.LoadFromAniDir( THEME->GetPathToB("ScreenCredits overlay") );
this->AddChild( &m_Overlay );
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
//.........这里部分代码省略.........
示例10: 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 );
}
//.........这里部分代码省略.........
示例11: 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 );
}
}
示例12: 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 );
}
示例13: SetExitText
void OptionRow::SetExitText( CString sExitText )
{
BitmapText *bt = m_textItems.back();
bt->SetText( sExitText );
}
示例14: 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 );
//.........这里部分代码省略.........
示例15: 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<ARRAYLEN(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 );
//.........这里部分代码省略.........