explicit focus changing

This commit is contained in:
Glenn Maynard
2005-12-09 02:49:31 +00:00
parent 81f38d89c3
commit 03e0d20277
3 changed files with 37 additions and 16 deletions
+4 -3
View File
@@ -2532,10 +2532,11 @@ MappedToP1S3X=SCREEN_CENTER_X-120
MappedToP2S1X=SCREEN_CENTER_X+120 MappedToP2S1X=SCREEN_CENTER_X+120
MappedToP2S2X=SCREEN_CENTER_X+195 MappedToP2S2X=SCREEN_CENTER_X+195
MappedToP2S3X=SCREEN_CENTER_X+270 MappedToP2S3X=SCREEN_CENTER_X+270
MappedToOnCommand=zoom,0.5;shadowlength,0 MappedToOnCommand=diffuse,#808080;zoom,0.5;shadowlength,0
MappedToWaitingCommand=diffuse,#FF8080;pulse;effectperiod,0.5;effectmagnitude,0.5,0.6,1 MappedToWaitingCommand=diffuse,#FF8080;pulse;effectperiod,0.5;effectmagnitude,0.5,0.6,1
MappedToSelectedCommand=diffuse,#FFFFFF;stopeffect MappedToMappedInputCommand=diffuse,#FFFFFF;stopeffect
MappedToUnselectedCommand=diffuse,#808080;stopeffect MappedToGainFocusCommand=diffuse,#FFFFFF;stopeffect
MappedToLoseFocusCommand=diffuse,#808080;stopeffect
[ScreenCenterImage] [ScreenCenterImage]
Class=ScreenCenterImage Class=ScreenCenterImage
+31 -13
View File
@@ -118,6 +118,7 @@ void ScreenMapControllers::BeginScreen()
m_WaitingForPress.SetZero(); m_WaitingForPress.SetZero();
Refresh(); Refresh();
AfterChangeFocus();
} }
@@ -143,6 +144,9 @@ void ScreenMapControllers::Update( float fDeltaTime )
INPUTMAPPER->SaveMappingsToDisk(); INPUTMAPPER->SaveMappingsToDisk();
Refresh(); Refresh();
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
pText->PlayCommand( "MappedInput" );
} }
} }
@@ -270,33 +274,40 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
case KEY_LEFT: /* Move the selection left, wrapping up. */ case KEY_LEFT: /* Move the selection left, wrapping up. */
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();
m_iCurSlot--; m_iCurSlot--;
if( m_iCurSlot < 0 ) if( m_iCurSlot < 0 )
{ {
m_iCurSlot = NUM_CHANGABLE_SLOTS-1; m_iCurSlot = NUM_CHANGABLE_SLOTS-1;
m_iCurController--; m_iCurController--;
} }
AfterChangeFocus();
break; break;
case KEY_RIGHT: /* Move the selection right, wrapping down. */ case KEY_RIGHT: /* Move the selection right, wrapping down. */
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();
m_iCurSlot++; m_iCurSlot++;
if( m_iCurSlot > NUM_CHANGABLE_SLOTS-1 ) if( m_iCurSlot > NUM_CHANGABLE_SLOTS-1 )
{ {
m_iCurSlot = 0; m_iCurSlot = 0;
m_iCurController++; m_iCurController++;
} }
AfterChangeFocus();
break; break;
case KEY_UP: /* Move the selection up. */ case KEY_UP: /* Move the selection up. */
if( m_iCurButton == 0 ) if( m_iCurButton == 0 )
break; // can't go up any more break; // can't go up any more
BeforeChangeFocus();
m_iCurButton--; m_iCurButton--;
AfterChangeFocus();
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()-1 )
break; // can't go down any more break; // can't go down any more
BeforeChangeFocus();
m_iCurButton++; m_iCurButton++;
AfterChangeFocus();
break; break;
case KEY_ESC: /* Quit the screen. */ case KEY_ESC: /* Quit the screen. */
if( !IsTransitioning() ) if( !IsTransitioning() )
@@ -310,6 +321,11 @@ 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:
{
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
pText->PlayCommand( "Waiting" );
}
m_WaitingForPress.Touch(); m_WaitingForPress.Touch();
m_DeviceIToMap.MakeInvalid(); m_DeviceIToMap.MakeInvalid();
break; break;
@@ -330,6 +346,20 @@ void ScreenMapControllers::TweenOffScreen()
OFF_COMMAND( m_LineScroller ); OFF_COMMAND( m_LineScroller );
} }
void ScreenMapControllers::BeforeChangeFocus()
{
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
pText->PlayCommand( "LoseFocus" );
}
void ScreenMapControllers::AfterChangeFocus()
{
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
BitmapText *pText = pKey->m_textMappedTo[m_iCurController][m_iCurSlot];
pText->PlayCommand( "GainFocus" );
}
void ScreenMapControllers::Refresh() void ScreenMapControllers::Refresh()
{ {
FOREACH_GameController( p ) FOREACH_GameController( p )
@@ -339,8 +369,6 @@ void ScreenMapControllers::Refresh()
const KeyToMap *pKey = &m_KeysToMap[b]; const KeyToMap *pKey = &m_KeysToMap[b];
for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ ) for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ )
{ {
bool bSelected = p == m_iCurController && (int) b == m_iCurButton && s == m_iCurSlot;
BitmapText *pText = pKey->m_textMappedTo[p][s]; BitmapText *pText = pKey->m_textMappedTo[p][s];
GameInput cur_gi( p, pKey->m_GameButton ); GameInput cur_gi( p, pKey->m_GameButton );
DeviceInput di; DeviceInput di;
@@ -348,16 +376,6 @@ void ScreenMapControllers::Refresh()
if( INPUTMAPPER->GameToDevice( cur_gi, s, di ) ) if( INPUTMAPPER->GameToDevice( cur_gi, s, di ) )
sText = INPUTMAN->GetDeviceSpecificInputString( di ); sText = INPUTMAN->GetDeviceSpecificInputString( di );
pText->SetText( sText ); pText->SetText( sText );
if( bSelected )
{
if( !m_WaitingForPress.IsZero() )
pText->PlayCommand( "Waiting" );
else
pText->PlayCommand( "Selected" );
}
else
pText->PlayCommand( "Unselected" );
} }
} }
} }
+2
View File
@@ -23,6 +23,8 @@ public:
virtual void TweenOffScreen(); virtual void TweenOffScreen();
private: private:
void BeforeChangeFocus();
void AfterChangeFocus();
virtual bool GenericTweenOn() const { return true; } virtual bool GenericTweenOn() const { return true; }
void Refresh(); void Refresh();