replacing markers in BMT::SetText is too expensive; do it
manually
This commit is contained in:
@@ -214,9 +214,6 @@ void BitmapText::SetText( CString sText, bool DoSubst )
|
|||||||
{
|
{
|
||||||
ASSERT( m_pFont );
|
ASSERT( m_pFont );
|
||||||
|
|
||||||
if(DoSubst)
|
|
||||||
FontCharAliases::ReplaceMarkers(sText);
|
|
||||||
|
|
||||||
if(m_szText == sText)
|
if(m_szText == sText)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -65,12 +65,19 @@ ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuesti
|
|||||||
|
|
||||||
m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
||||||
m_textAnswer.SetXY( ANSWER_X, ANSWER_Y );
|
m_textAnswer.SetXY( ANSWER_X, ANSWER_Y );
|
||||||
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
|
UpdateText();
|
||||||
this->AddChild( &m_textAnswer );
|
this->AddChild( &m_textAnswer );
|
||||||
|
|
||||||
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu prompt") );
|
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 )
|
void ScreenTextEntry::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Screen::Update( fDeltaTime );
|
Screen::Update( fDeltaTime );
|
||||||
@@ -101,7 +108,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
case SDLK_BACKSPACE:
|
case SDLK_BACKSPACE:
|
||||||
if(!m_sAnswer.empty())
|
if(!m_sAnswer.empty())
|
||||||
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
m_sAnswer = m_sAnswer.erase( m_sAnswer.size()-1 );
|
||||||
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
|
UpdateText();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
char c;
|
char c;
|
||||||
@@ -146,7 +153,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
if( c != '\0' )
|
if( c != '\0' )
|
||||||
{
|
{
|
||||||
m_sAnswer += c;
|
m_sAnswer += c;
|
||||||
m_textAnswer.SetText( LStringToCString(m_sAnswer) );
|
UpdateText();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ protected:
|
|||||||
virtual void MenuStart( PlayerNumber pn );
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
virtual void MenuBack( PlayerNumber pn );
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
|
|
||||||
|
void UpdateText();
|
||||||
|
|
||||||
TransitionFade m_Fade;
|
TransitionFade m_Fade;
|
||||||
BitmapText m_textQuestion;
|
BitmapText m_textQuestion;
|
||||||
Quad m_rectAnswerBox;
|
Quad m_rectAnswerBox;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "RageTimer.h"
|
#include "RageTimer.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
#include "FontCharAliases.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -369,6 +370,11 @@ try_metric_again:
|
|||||||
if( m_pIniMetrics->GetValue(sClassName,sValueName,sValue) )
|
if( m_pIniMetrics->GetValue(sClassName,sValueName,sValue) )
|
||||||
{
|
{
|
||||||
sValue.Replace("::","\n"); // "::" means newline since you can't use line breaks in an ini file.
|
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;
|
return sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user