update textInfo max once every 0.5 secs

This commit is contained in:
Chris Danford
2005-04-01 08:34:23 +00:00
parent 5e7afa7f77
commit 745a2141cb
2 changed files with 26 additions and 10 deletions
+22 -9
View File
@@ -48,6 +48,7 @@ const float RECORD_HOLD_SECONDS = 0.3f;
#define PLAY_RECORD_HELP_TEXT THEME->GetMetric(m_sName,"PlayRecordHelpText") #define PLAY_RECORD_HELP_TEXT THEME->GetMetric(m_sName,"PlayRecordHelpText")
AutoScreenMessage( SM_UpdateTextInfo )
AutoScreenMessage( SM_BackFromMainMenu ) AutoScreenMessage( SM_BackFromMainMenu )
AutoScreenMessage( SM_BackFromAreaMenu ) AutoScreenMessage( SM_BackFromAreaMenu )
AutoScreenMessage( SM_BackFromStepsInformation ) AutoScreenMessage( SM_BackFromStepsInformation )
@@ -59,7 +60,6 @@ AutoScreenMessage( SM_BackFromInsertAttackPlayerOptions )
AutoScreenMessage( SM_BackFromPrefs ) AutoScreenMessage( SM_BackFromPrefs )
AutoScreenMessage( SM_BackFromCourseModeMenu ) AutoScreenMessage( SM_BackFromCourseModeMenu )
AutoScreenMessage( SM_DoRevertToLastSave ) AutoScreenMessage( SM_DoRevertToLastSave )
AutoScreenMessage( SM_BackFromBPMChange ) AutoScreenMessage( SM_BackFromBPMChange )
AutoScreenMessage( SM_BackFromStopChange ) AutoScreenMessage( SM_BackFromStopChange )
AutoScreenMessage( SM_DoSaveAndExit ) AutoScreenMessage( SM_DoSaveAndExit )
@@ -596,6 +596,9 @@ void ScreenEdit::Init()
m_soundMusic.Load( m_pSong->GetMusicPath() ); m_soundMusic.Load( m_pSong->GetMusicPath() );
m_soundAssistTick.Load( THEME->GetPathS("ScreenEdit","assist tick"), true ); m_soundAssistTick.Load( THEME->GetPathS("ScreenEdit","assist tick"), true );
this->HandleScreenMessage( SM_UpdateTextInfo );
m_bTextInfoNeedsUpdate = true;
} }
ScreenEdit::~ScreenEdit() ScreenEdit::~ScreenEdit()
@@ -725,6 +728,15 @@ void ScreenEdit::UpdateTextInfo()
if( m_pSteps == NULL ) if( m_pSteps == NULL )
return; return;
// Don't update the text during playback or record. It causes skips.
if( m_EditMode != MODE_EDITING )
return;
if( !m_bTextInfoNeedsUpdate )
return;
m_bTextInfoNeedsUpdate = false;
int iNumTaps = m_NoteDataEdit.GetNumTapNotes(); int iNumTaps = m_NoteDataEdit.GetNumTapNotes();
int iNumJumps = m_NoteDataEdit.GetNumJumps(); int iNumJumps = m_NoteDataEdit.GetNumJumps();
int iNumHands = m_NoteDataEdit.GetNumHands(); int iNumHands = m_NoteDataEdit.GetNumHands();
@@ -787,9 +799,7 @@ void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, c
{ {
case MODE_EDITING: case MODE_EDITING:
InputEdit( di, type, GameI, MenuI, StyleI, EditB ); InputEdit( di, type, GameI, MenuI, StyleI, EditB );
/* Make sure the displayed time is up-to-date after possibly changing something, m_bTextInfoNeedsUpdate = true;
* so it doesn't feel lagged. */
UpdateTextInfo();
break; break;
case MODE_RECORDING: case MODE_RECORDING:
InputRecord( di, type, GameI, MenuI, StyleI, EditB ); InputRecord( di, type, GameI, MenuI, StyleI, EditB );
@@ -1503,12 +1513,15 @@ void ScreenEdit::TransitionEditMode( EditMode em )
void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{ {
// There are lots of different messages that signal information changed. if( SM != SM_UpdateTextInfo )
// Rather than picking out those specific messages, just UpdateTextInfo m_bTextInfoNeedsUpdate = true;
// on all messages.
UpdateTextInfo();
if( SM == SM_GoToNextScreen ) if( SM == SM_UpdateTextInfo )
{
UpdateTextInfo();
this->PostScreenMessage( SM_UpdateTextInfo, 0.5f );
}
else if( SM == SM_GoToNextScreen )
{ {
SCREENMAN->SetNewScreen( PREV_SCREEN ); SCREENMAN->SetNewScreen( PREV_SCREEN );
GAMESTATE->m_bEditing = false; GAMESTATE->m_bEditing = false;
+4 -1
View File
@@ -142,7 +142,6 @@ protected:
void TransitionEditMode( EditMode em ); void TransitionEditMode( EditMode em );
void PlayTicks(); void PlayTicks();
void PlayPreviewMusic(); void PlayPreviewMusic();
void UpdateTextInfo();
// Call this before modifying m_NoteDataEdit. // Call this before modifying m_NoteDataEdit.
void SaveUndo(); void SaveUndo();
@@ -169,7 +168,11 @@ protected:
SnapDisplay m_SnapDisplay; SnapDisplay m_SnapDisplay;
BitmapText m_textInputTips; BitmapText m_textInputTips;
void UpdateTextInfo();
BitmapText m_textInfo; // status information that changes BitmapText m_textInfo; // status information that changes
bool m_bTextInfoNeedsUpdate;
BitmapText m_textPlayRecordHelp; BitmapText m_textPlayRecordHelp;
// keep track of where we are and what we're doing // keep track of where we are and what we're doing