This commit is contained in:
Glenn Maynard
2005-03-01 15:22:15 +00:00
parent 8e0a6f505d
commit 2b54f34c39
2 changed files with 39 additions and 35 deletions
+16 -12
View File
@@ -243,22 +243,27 @@ void ScreenSystemLayer::AddTimestampLine( const CString &txt, const RageColor &c
m_LastSkip %= NUM_SKIPS_TO_SHOW; m_LastSkip %= NUM_SKIPS_TO_SHOW;
} }
void ScreenSystemLayer::UpdateTimestampAndSkips() void ScreenSystemLayer::UpdateSkips()
{ {
if( !PREFSMAN->m_bTimestamping && !PREFSMAN->m_bLogSkips )
return;
/* Use our own timer, so we ignore `/tab. */ /* Use our own timer, so we ignore `/tab. */
const float UpdateTime = SkipTimer.GetDeltaTime(); const float UpdateTime = SkipTimer.GetDeltaTime();
/* FPS is 0 for a little while after we load a screen; don't report /* FPS is 0 for a little while after we load a screen; don't report
* during this time. Do clear the timer, though, so we don't report * during this time. Do clear the timer, though, so we don't report
* a big "skip" after this period passes. */ * a big "skip" after this period passes. */
if(DISPLAY->GetFPS()) if( !DISPLAY->GetFPS() )
{ return;
/* We want to display skips. We expect to get updates of about 1.0/FPS ms. */ /* We want to display skips. We expect to get updates of about 1.0/FPS ms. */
const float ExpectedUpdate = 1.0f / DISPLAY->GetFPS(); const float ExpectedUpdate = 1.0f / DISPLAY->GetFPS();
/* These are thresholds for severity of skips. The smallest /* These are thresholds for severity of skips. The smallest
* is slightly above expected, to tolerate normal jitter. */ * is slightly above expected, to tolerate normal jitter. */
const float Thresholds[] = { const float Thresholds[] =
{
ExpectedUpdate * 2.0f, ExpectedUpdate * 4.0f, 0.1f, -1 ExpectedUpdate * 2.0f, ExpectedUpdate * 4.0f, 0.1f, -1
}; };
@@ -270,7 +275,8 @@ void ScreenSystemLayer::UpdateTimestampAndSkips()
{ {
CString time(SecondsToMMSSMsMs(RageTimer::GetTimeSinceStart())); CString time(SecondsToMMSSMsMs(RageTimer::GetTimeSinceStart()));
static const RageColor colors[] = { static const RageColor colors[] =
{
RageColor(0,0,0,0), /* unused */ RageColor(0,0,0,0), /* unused */
RageColor(0.2f,0.2f,1,1), /* light blue */ RageColor(0.2f,0.2f,1,1), /* light blue */
RageColor(1,1,0,1), /* yellow */ RageColor(1,1,0,1), /* yellow */
@@ -278,17 +284,12 @@ void ScreenSystemLayer::UpdateTimestampAndSkips()
}; };
if( PREFSMAN->m_bTimestamping ) if( PREFSMAN->m_bTimestamping )
AddTimestampLine( ssprintf("%s: %.0fms (%.0f)", time.c_str(), 1000*UpdateTime, UpdateTime/ExpectedUpdate), AddTimestampLine( ssprintf("%s: %.0fms (%.0f)", time.c_str(), 1000*UpdateTime, UpdateTime/ExpectedUpdate), colors[skip] );
colors[skip] );
if( PREFSMAN->m_bLogSkips ) if( PREFSMAN->m_bLogSkips )
LOG->Trace( "Frame skip: %.0fms (%.0f)", 1000*UpdateTime, UpdateTime/ExpectedUpdate ); LOG->Trace( "Frame skip: %.0fms (%.0f)", 1000*UpdateTime, UpdateTime/ExpectedUpdate );
} }
} }
if( PREFSMAN->m_bTimestamping )
m_textTime.SetText( SecondsToMMSSMsMs(RageTimer::GetTimeSinceStart()) );
}
void ScreenSystemLayer::Update( float fDeltaTime ) void ScreenSystemLayer::Update( float fDeltaTime )
{ {
Screen::Update(fDeltaTime); Screen::Update(fDeltaTime);
@@ -303,7 +304,10 @@ void ScreenSystemLayer::Update( float fDeltaTime )
m_textStats.SetDiffuse( RageColor(1,1,1,0) ); /* hide */ m_textStats.SetDiffuse( RageColor(1,1,1,0) ); /* hide */
} }
UpdateTimestampAndSkips(); UpdateSkips();
if( PREFSMAN->m_bTimestamping )
m_textTime.SetText( SecondsToMMSSMsMs(RageTimer::GetTimeSinceStart()) );
} }
/* /*
+1 -1
View File
@@ -32,7 +32,7 @@ private:
RageTimer SkipTimer; RageTimer SkipTimer;
void AddTimestampLine( const CString &txt, const RageColor &color ); void AddTimestampLine( const CString &txt, const RageColor &color );
void UpdateTimestampAndSkips(); void UpdateSkips();
CString GetCreditsMessage( PlayerNumber pn ) const; CString GetCreditsMessage( PlayerNumber pn ) const;
ThemeMetric<CString> CREDITS_PRESS_START; ThemeMetric<CString> CREDITS_PRESS_START;