MenuSelect -> backspace

This commit is contained in:
Glenn Maynard
2005-04-29 23:53:55 +00:00
parent 7c991e150a
commit 783a08b58c
2 changed files with 28 additions and 10 deletions
+26 -10
View File
@@ -622,6 +622,8 @@ void ScreenNameEntryTraditional::UpdateSelectionText( int pn )
void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventType type ) void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventType type )
{ {
/* The screen may have started out with nobody entering, in which case we're
* just showing scores and the first Start press moves on. */
if( !AnyStillEntering() ) if( !AnyStillEntering() )
{ {
AllFinished(); AllFinished();
@@ -643,16 +645,7 @@ void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventTyp
break; break;
case CHAR_BACK: case CHAR_BACK:
if( !m_sSelection[pn].size() ) Backspace( pn );
{
m_soundInvalid.Play();
break;
}
m_sSelection[pn].erase( m_sSelection[pn].size()-1, 1 );
UpdateSelectionText( pn );
m_soundKey.Play();
break; break;
default: default:
@@ -673,6 +666,16 @@ void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventTyp
} }
} }
void ScreenNameEntryTraditional::MenuSelect( PlayerNumber pn, const InputEventType type )
{
if( !m_bStillEnteringName[pn] )
return; // ignore
if( type != IET_FIRST_PRESS )
return; // ignore
Backspace( pn );
}
void ScreenNameEntryTraditional::SelectChar( PlayerNumber pn, int c ) void ScreenNameEntryTraditional::SelectChar( PlayerNumber pn, int c )
{ {
FOREACH( int, m_AlphabetLetter[pn], letter ) FOREACH( int, m_AlphabetLetter[pn], letter )
@@ -687,6 +690,19 @@ void ScreenNameEntryTraditional::SelectChar( PlayerNumber pn, int c )
ASSERT( false ); // character not found ASSERT( false ); // character not found
} }
void ScreenNameEntryTraditional::Backspace( PlayerNumber pn )
{
if( !m_sSelection[pn].size() )
{
m_soundInvalid.Play();
return;
}
m_sSelection[pn].erase( m_sSelection[pn].size()-1, 1 );
UpdateSelectionText( pn );
m_soundKey.Play();
}
void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType type ) void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType type )
{ {
if( !m_bStillEnteringName[pn] || IsTransitioning() ) if( !m_bStillEnteringName[pn] || IsTransitioning() )
@@ -52,6 +52,7 @@ public:
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void MenuStart( PlayerNumber pn, const InputEventType type ); void MenuStart( PlayerNumber pn, const InputEventType type );
void MenuSelect( PlayerNumber pn, const InputEventType type );
void MenuLeft( PlayerNumber pn, const InputEventType type ); void MenuLeft( PlayerNumber pn, const InputEventType type );
void MenuRight( PlayerNumber pn, const InputEventType type ); void MenuRight( PlayerNumber pn, const InputEventType type );
@@ -63,6 +64,7 @@ private:
void UpdateSelectionText( int pn ); void UpdateSelectionText( int pn );
void ChangeDisplayedFeat(); void ChangeDisplayedFeat();
void SelectChar( PlayerNumber pn, int c ); void SelectChar( PlayerNumber pn, int c );
void Backspace( PlayerNumber pn );
ThemeMetric<float> FOV; ThemeMetric<float> FOV;
ThemeMetric<float> ALPHABET_GAP_X; ThemeMetric<float> ALPHABET_GAP_X;