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
-3
View File
@@ -214,9 +214,6 @@ void BitmapText::SetText( CString sText, bool DoSubst )
{
ASSERT( m_pFont );
if(DoSubst)
FontCharAliases::ReplaceMarkers(sText);
if(m_szText == sText)
return;
+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;
}
+2
View File
@@ -35,6 +35,8 @@ protected:
virtual void MenuStart( PlayerNumber pn );
virtual void MenuBack( PlayerNumber pn );
void UpdateText();
TransitionFade m_Fade;
BitmapText m_textQuestion;
Quad m_rectAnswerBox;
+6
View File
@@ -20,6 +20,7 @@
#include "IniFile.h"
#include "RageTimer.h"
#include "Font.h"
#include "FontCharAliases.h"
using namespace std;
@@ -369,6 +370,11 @@ try_metric_again:
if( m_pIniMetrics->GetValue(sClassName,sValueName,sValue) )
{
sValue.Replace("::","\n"); // "::" means newline since you can't use line breaks in an ini file.
/* XXX: add a parameter to turn this off if there are some metrics where
* we don't want markers */
FontCharAliases::ReplaceMarkers(sValue);
return sValue;
}