separate exit row

This commit is contained in:
Glenn Maynard
2005-12-09 04:25:30 +00:00
parent bea1d2dfd8
commit f8104c0731
2 changed files with 44 additions and 9 deletions
+40 -8
View File
@@ -104,9 +104,19 @@ void ScreenMapControllers::Init()
m_LineScroller.AddChild( &m_Line[b] ); m_LineScroller.AddChild( &m_Line[b] );
} }
{
m_pExit = ActorUtil::MakeActor( THEME->GetPathG(m_sName,"exit") );
m_pExit->SetName( "Exit" );
ActorUtil::LoadAllCommands( *m_pExit, m_sName );
unsigned b = m_KeysToMap.size();
m_Line[b].AddChild( m_pExit );
m_LineScroller.AddChild( &m_Line[b] );
}
m_LineScroller.SetName( "LineScroller" ); m_LineScroller.SetName( "LineScroller" );
ActorUtil::LoadAllCommands( m_LineScroller, m_sName ); ActorUtil::LoadAllCommands( m_LineScroller, m_sName );
m_LineScroller.Load2( (float) m_KeysToMap.size()*2, false ); m_LineScroller.Load2( (float) m_LineScroller.GetNumChildren()*2, false );
this->AddChild( &m_LineScroller ); this->AddChild( &m_LineScroller );
} }
@@ -136,6 +146,7 @@ void ScreenMapControllers::Update( float fDeltaTime )
return; /* keep waiting */ return; /* keep waiting */
m_WaitingForPress.SetZero(); m_WaitingForPress.SetZero();
ASSERT( m_iCurButton < (int) m_KeysToMap.size() );
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton]; const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton ); GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton );
@@ -268,6 +279,9 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
case KEY_SPACE: case KEY_SPACE:
case KEY_BACK: /* Clear the selected input mapping. */ case KEY_BACK: /* Clear the selected input mapping. */
#endif #endif
if( m_iCurButton == (int) m_KeysToMap.size() )
break; // on exit
{ {
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton]; const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton ); GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton );
@@ -283,6 +297,8 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
} }
break; break;
case KEY_LEFT: /* Move the selection left, wrapping up. */ case KEY_LEFT: /* Move the selection left, wrapping up. */
if( m_iCurButton == (int) m_KeysToMap.size() )
break; // on exit
if( m_iCurSlot == 0 && m_iCurController == 0 ) if( m_iCurSlot == 0 && m_iCurController == 0 )
break; // can't go left any more break; // can't go left any more
BeforeChangeFocus(); BeforeChangeFocus();
@@ -296,6 +312,8 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
m_soundChange.Play(); m_soundChange.Play();
break; break;
case KEY_RIGHT: /* Move the selection right, wrapping down. */ case KEY_RIGHT: /* Move the selection right, wrapping down. */
if( m_iCurButton == (int) m_KeysToMap.size() )
break; // on exit
if( m_iCurSlot == NUM_CHANGABLE_SLOTS-1 && m_iCurController == MAX_GAME_CONTROLLERS-1 ) if( m_iCurSlot == NUM_CHANGABLE_SLOTS-1 && m_iCurController == MAX_GAME_CONTROLLERS-1 )
break; // can't go right any more break; // can't go right any more
BeforeChangeFocus(); BeforeChangeFocus();
@@ -317,7 +335,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
m_soundChange.Play(); m_soundChange.Play();
break; break;
case KEY_DOWN: /* Move the selection down. */ case KEY_DOWN: /* Move the selection down. */
if( m_iCurButton == (int) m_KeysToMap.size()-1 ) if( m_iCurButton == (int) m_KeysToMap.size() )
break; // can't go down any more break; // can't go down any more
BeforeChangeFocus(); BeforeChangeFocus();
m_iCurButton++; m_iCurButton++;
@@ -336,6 +354,13 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
break; break;
case KEY_ENTER: /* Change the selection. */ case KEY_ENTER: /* Change the selection. */
case KEY_KP_ENTER: case KEY_KP_ENTER:
if( m_iCurButton == (int) m_KeysToMap.size() )
{
SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToNextScreen );
break;
}
{ {
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton]; const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot]; BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
@@ -362,18 +387,25 @@ void ScreenMapControllers::TweenOffScreen()
OFF_COMMAND( m_LineScroller ); OFF_COMMAND( m_LineScroller );
} }
Actor *ScreenMapControllers::GetActorWithFocus()
{
if( m_iCurButton == (int) m_KeysToMap.size() )
return m_pExit;
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
return pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
}
void ScreenMapControllers::BeforeChangeFocus() void ScreenMapControllers::BeforeChangeFocus()
{ {
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton]; Actor *pActor = GetActorWithFocus();
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot]; pActor->PlayCommand( "LoseFocus" );
pText->PlayCommand( "LoseFocus" );
} }
void ScreenMapControllers::AfterChangeFocus() void ScreenMapControllers::AfterChangeFocus()
{ {
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton]; Actor *pActor = GetActorWithFocus();
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot]; pActor->PlayCommand( "GainFocus" );
pText->PlayCommand( "GainFocus" );
} }
void ScreenMapControllers::Refresh() void ScreenMapControllers::Refresh()
+4 -1
View File
@@ -24,6 +24,7 @@ public:
virtual void TweenOffScreen(); virtual void TweenOffScreen();
private: private:
Actor *GetActorWithFocus();
void BeforeChangeFocus(); void BeforeChangeFocus();
void AfterChangeFocus(); void AfterChangeFocus();
virtual bool GenericTweenOn() const { return true; } virtual bool GenericTweenOn() const { return true; }
@@ -44,8 +45,10 @@ private:
BitmapText *m_textMappedTo[MAX_GAME_CONTROLLERS][NUM_SHOWN_GAME_TO_DEVICE_SLOTS]; BitmapText *m_textMappedTo[MAX_GAME_CONTROLLERS][NUM_SHOWN_GAME_TO_DEVICE_SLOTS];
}; };
vector<KeyToMap> m_KeysToMap; vector<KeyToMap> m_KeysToMap;
// owned by m_Line
Actor *m_pExit;
ActorFrame m_Line[MAX_GAME_BUTTONS]; ActorFrame m_Line[MAX_GAME_BUTTONS+1];
ActorScroller m_LineScroller; ActorScroller m_LineScroller;
RageSound m_soundChange; RageSound m_soundChange;