This commit is contained in:
Glenn Maynard
2005-02-02 07:14:09 +00:00
parent 544820e8cd
commit b56e0121f2
2 changed files with 19 additions and 6 deletions
+12 -6
View File
@@ -8,16 +8,22 @@
#include "RageLog.h" #include "RageLog.h"
#include "StageStats.h" #include "StageStats.h"
#define DANCE_POINT_DIGITS THEME->GetMetricI(m_sName,"DancePointsDigits")
#define PERCENT_DECIMAL_PLACES THEME->GetMetricI(m_sName,"PercentDecimalPlaces")
#define PERCENT_TOTAL_SIZE THEME->GetMetricI(m_sName,"PercentTotalSize")
#define PERCENT_USE_REMAINDER THEME->GetMetricB(m_sName,"PercentUseRemainder")
PercentageDisplay::PercentageDisplay() PercentageDisplay::PercentageDisplay()
{ {
m_pSource = NULL; m_pSource = NULL;
} }
void PercentageDisplay::SetName( const CString &sName, const CString &sID )
{
ActorFrame::SetName( sName, sID );
DANCE_POINT_DIGITS.Load( m_sName, "DancePointsDigits" );
PERCENT_DECIMAL_PLACES.Load( m_sName, "PercentDecimalPlaces" );
PERCENT_TOTAL_SIZE.Load( m_sName, "PercentTotalSize" );
PERCENT_USE_REMAINDER.Load( m_sName, "PercentUseRemainder" );
}
void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, bool bAutoRefresh ) void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, bool bAutoRefresh )
{ {
ASSERT( m_sName != "" ); // set this! ASSERT( m_sName != "" ); // set this!
@@ -73,7 +79,7 @@ void PercentageDisplay::Refresh()
CString sNumToDisplay; CString sNumToDisplay;
if( PREFSMAN->m_bDancePointsForOni ) if( PREFSMAN->m_bDancePointsForOni )
{ {
sNumToDisplay = ssprintf( "%*d", DANCE_POINT_DIGITS, max( 0, iActualDancePoints ) ); sNumToDisplay = ssprintf( "%*d", (int) DANCE_POINT_DIGITS, max( 0, iActualDancePoints ) );
} }
else else
{ {
@@ -96,7 +102,7 @@ void PercentageDisplay::Refresh()
float fTruncInterval = powf(0.1f, (float) PERCENT_TOTAL_SIZE); float fTruncInterval = powf(0.1f, (float) PERCENT_TOTAL_SIZE);
fPercentDancePoints = ftruncf( fPercentDancePoints, fTruncInterval ); fPercentDancePoints = ftruncf( fPercentDancePoints, fTruncInterval );
sNumToDisplay = ssprintf( "%*.*f%%", PERCENT_TOTAL_SIZE, PERCENT_DECIMAL_PLACES, fPercentDancePoints*100 ); sNumToDisplay = ssprintf( "%*.*f%%", (int) PERCENT_TOTAL_SIZE, (int) PERCENT_DECIMAL_PLACES, fPercentDancePoints*100 );
// HACK: Use the last frame in the numbers texture as '-' // HACK: Use the last frame in the numbers texture as '-'
sNumToDisplay.Replace('-','x'); sNumToDisplay.Replace('-','x');
+7
View File
@@ -5,6 +5,7 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "StageStats.h" #include "StageStats.h"
#include "ThemeMetric.h"
class PercentageDisplay: public ActorFrame class PercentageDisplay: public ActorFrame
{ {
@@ -12,9 +13,15 @@ public:
PercentageDisplay(); PercentageDisplay();
void Load( PlayerNumber pn, PlayerStageStats *pSource, bool bAutoRefresh ); void Load( PlayerNumber pn, PlayerStageStats *pSource, bool bAutoRefresh );
void Update( float fDeltaTime ); void Update( float fDeltaTime );
void SetName( const CString &sName, const CString &sID = "" );
void TweenOffScreen(); void TweenOffScreen();
private: private:
ThemeMetric<int> DANCE_POINT_DIGITS;
ThemeMetric<int> PERCENT_DECIMAL_PLACES;
ThemeMetric<int> PERCENT_TOTAL_SIZE;
ThemeMetric<bool> PERCENT_USE_REMAINDER;
void Refresh(); void Refresh();
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
PlayerStageStats *m_pSource; PlayerStageStats *m_pSource;