本文整理汇总了C++中BitmapText::SetXY方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::SetXY方法的具体用法?C++ BitmapText::SetXY怎么用?C++ BitmapText::SetXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::SetXY方法的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
//.........这里部分代码省略.........
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 );
BitmapText *p = new BitmapText;
p->SetName( "PageText" );
p->LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "page") );
LOAD_ALL_COMMANDS_AND_ON_COMMAND( p );
// todo: Y value is still hardcoded. -aj
p->SetXY( PAGE_START_X+iPage*PAGE_SPACING_X, SCREEN_TOP+20 );
p->SetText( *s + " (" + sButton + ")" );
m_vptextPages.push_back( p );
this->AddChild( p );
}
auto onEachLine = [this](IDebugLine *) {
{
BitmapText *bt = new BitmapText;
bt->SetName( "ButtonText" );
bt->LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "line") );
bt->SetHorizAlign( align_right );
bt->SetText( "blah" );
LOAD_ALL_COMMANDS_AND_ON_COMMAND( *bt );
m_vptextButton.push_back( bt );
this->AddChild( bt );
}
{
BitmapText *bt = new BitmapText;
bt->SetName( "FunctionText" );
bt->LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "line") );
bt->SetHorizAlign( align_left );
bt->SetText( "blah" );
LOAD_ALL_COMMANDS_AND_ON_COMMAND( *bt );
m_vptextFunction.push_back( bt );
this->AddChild( bt );
}
};
std::for_each(g_pvpSubscribers->begin(), g_pvpSubscribers->end(), onEachLine);
this->SetVisible( false );
}
示例3: Init
//.........这里部分代码省略.........
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;
p->SetName( "PageText" );
p->LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "page") );
LOAD_ALL_COMMANDS_AND_ON_COMMAND( p );
// todo: Y value is still hardcoded. -aj
p->SetXY( PAGE_START_X+iPage*PAGE_SPACING_X, SCREEN_TOP+20 );
p->SetText( *s + " (" + sButton + ")" );
m_vptextPages.push_back( p );
this->AddChild( p );
}
示例4: Init
//.........这里部分代码省略.........
}
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:
text->SetText( "" );
text->SetDiffuse( RageColor(0.5f,0,0,1) );
break;
}
if( entry.IsLocked() )
{
text->SetText("???");
text->SetZoomX(1);
}
else
{
// unlocked. change color
const Song *pSong = entry.m_Song.ToSong();
RageColor color = RageColor(1,1,1,1);
if( pSong )
color = SONGMAN->GetSongGroupColor(pSong->m_sGroupName);
text->SetGlobalDiffuseColor(color);
}
text->SetXY( ScrollingTextX, ScrollingTextStartY );
if (UNLOCK_TEXT_SCROLL == 3 && UNLOCK_TEXT_SCROLL_ROWS + i > NumUnlocks)
{ // special command for last unlocks when scrolling is in effect
float TargetRow = -0.5f + i + UNLOCK_TEXT_SCROLL_ROWS - NumUnlocks;
float StopOffPoint = ScrollingTextEndY - TargetRow / UNLOCK_TEXT_SCROLL_ROWS * (ScrollingTextEndY - ScrollingTextStartY);
float FirstCycleTime = (UNLOCK_TEXT_SCROLL_ROWS - TargetRow) * SECS_PER_CYCLE;
float SecondCycleTime = (6 + TargetRow) * SECS_PER_CYCLE - FirstCycleTime;
//LOG->Trace("Target Row: %f", TargetRow);
//LOG->Trace("command for icon %d: %s", i, ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime * 2, ScrollingTextEndY).c_str() );
RString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime, ScrollingTextEndY);
text->RunCommands( ActorUtil::ParseActorCommands(sCommand) );
}
else
{
RString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), SECS_PER_CYCLE * (ScrollingTextRows), ScrollingTextEndY);
text->RunCommands( ActorUtil::ParseActorCommands(sCommand) );
}
item.push_back(text);
if (UNLOCK_TEXT_SCROLL >= 2)
{
Sprite* IconCount = new Sprite;
// new unlock graphic
IconCount->Load( THEME->GetPathG("ScreenUnlockStatus",ssprintf("%04d icon", i)) );
// set graphic location
IconCount->SetXY( UNLOCK_TEXT_SCROLL_ICON_X, ScrollingTextStartY);
IconCount->SetHeight(UNLOCK_TEXT_SCROLL_ICON_SIZE);
IconCount->SetWidth(UNLOCK_TEXT_SCROLL_ICON_SIZE);
示例5: ScreenAttract
//.........这里部分代码省略.........
if( subtitle != "" )
title = title + "\n" + subtitle;
text->SetMaxWidth( MaxWidth );
text->SetText( title );
}
else // song is missing, might be a course
{
Course *crs = SONGMAN->FindCourse( DisplayedSong );
if (crs != NULL)
{
text->SetMaxWidth( MaxWidth );
text->SetText( crs->GetFullDisplayTitle() );
text->Command("Diffuse,0,1,0,1");
}
else // entry isn't a song or course
{
text->SetText( "" );
text->Command("Diffuse,0.5,0,0,1");
}
}
if (pSong != NULL && pSong->m_pSong != NULL)
{
if( pSong->IsLocked() ) // song is locked
{
text->SetText("???");
text->SetZoomX(1);
} else { // song is unlocked, change color
RageColor color = SONGMAN->GetGroupColor(pSong->m_pSong->m_sGroupName);
text->SetGlobalDiffuseColor(color);
}
}
text->SetXY(ScrollingTextX, ScrollingTextStartY);
if (UNLOCK_TEXT_SCROLL == 3 && UNLOCK_TEXT_SCROLL_ROWS + i > NumUnlocks)
{ // special command for last unlocks when extreme-style scrolling is in effect
float TargetRow = -0.5f + i + UNLOCK_TEXT_SCROLL_ROWS - NumUnlocks;
float StopOffPoint = ScrollingTextEndY - TargetRow / UNLOCK_TEXT_SCROLL_ROWS * (ScrollingTextEndY - ScrollingTextStartY);
float FirstCycleTime = (UNLOCK_TEXT_SCROLL_ROWS - TargetRow) * SECS_PER_CYCLE;
float SecondCycleTime = (6 + TargetRow) * SECS_PER_CYCLE - FirstCycleTime;
LOG->Trace("Target Row: %f", TargetRow);
LOG->Trace("command for icon %d: %s", i, ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime * 2, ScrollingTextEndY).c_str() );
text->Command( ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime, ScrollingTextEndY) );
}
else
text->Command( ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), SECS_PER_CYCLE * (ScrollingTextRows), ScrollingTextEndY) );
item.push_back(text);
if (UNLOCK_TEXT_SCROLL >= 2)
{
Sprite* IconCount = new Sprite;
// new unlock graphic
IconCount->Load( THEME->GetPathToG(ssprintf("ScreenUnlock %d icon", i)) );
// set graphic location
IconCount->SetXY( UNLOCK_TEXT_SCROLL_ICON_X, ScrollingTextStartY);
IconCount->SetHeight(UNLOCK_TEXT_SCROLL_ICON_SIZE);
IconCount->SetWidth(UNLOCK_TEXT_SCROLL_ICON_SIZE);
if (UNLOCK_TEXT_SCROLL == 3 && UNLOCK_TEXT_SCROLL_ROWS + i > NumUnlocks)
{
float TargetRow = -0.5f + i + UNLOCK_TEXT_SCROLL_ROWS - NumUnlocks;