replacing markers in BMT::SetText is too expensive; do it

manually
This commit is contained in:
Glenn Maynard
2003-01-18 09:18:30 +00:00
parent cbeb0d1288
commit 49ffa7b45f
4 changed files with 18 additions and 6 deletions
+10 -3
View File
@@ -65,12 +65,19 @@ ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuesti
m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
m_textAnswer.SetXY( ANSWER_X, ANSWER_Y );
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
UpdateText();
this->AddChild( &m_textAnswer );
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu prompt") );
}
void ScreenTextEntry::UpdateText()
{
CString txt = LStringToCString(m_sAnswer);
FontCharAliases::ReplaceMarkers(txt);
m_textAnswer.SetText( txt );
}
void ScreenTextEntry::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
@@ -101,7 +108,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
case SDLK_BACKSPACE:
if(!m_sAnswer.empty())
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
UpdateText();
break;
default:
char c;
@@ -146,7 +153,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
if( c != '\0' )
{
m_sAnswer += c;
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
UpdateText();
}
break;
}