#include "stdafx.h" /* ----------------------------------------------------------------------------- File: ScoreDisplayRolling.h Desc: A graphic displayed in the ScoreDisplayRolling during Dancing. Copyright (c) 2001 Chris Danford. All rights reserved. ----------------------------------------------------------------------------- */ #include "ScoreDisplayRolling.h" #include "RageUtil.h" #include "ThemeManager.h" const float TIME_BETWEEN_TICKS = 0.05f; ScoreDisplayRolling::ScoreDisplayRolling() { RageLog( "ScoreDisplayRolling::ScoreDisplayRolling()" ); for( int i=0; iGetPathTo(FONT_SCORE_NUMBERS) ); m_textDigits[i].TurnShadowOff(); // get the width of the numbers m_textDigits[i].SetText( "0" ); float fCharWidth = m_textDigits[i].GetWidestLineWidthInSourcePixels(); m_textDigits[i].SetText( " " ); float fCharOffsetsFromCenter = i - float(MAX_SCORE_DIGITS-1)/2; m_textDigits[i].SetXY( fCharOffsetsFromCenter * fCharWidth, 0 ); iCurrentScoreDigits[i] = 0; iDestinationScoreDigits[i] = 0; this->AddActor( &m_textDigits[i] ); } m_fTimeUntilNextTick = 0; SetScore( 0 ); } void ScoreDisplayRolling::SetScore( float fNewScore ) { // super inefficient (but isn't called very often) CString sFormatString = ssprintf( "%%%d.0f", MAX_SCORE_DIGITS ); CString sScore = ssprintf( sFormatString, fNewScore ); for( int i=0; i 9 ) iCurrentScoreDigits[i] = 0; m_textDigits[i].SetText( ssprintf("%d", iCurrentScoreDigits[i]) ); } } } }