some cleanup

This commit is contained in:
AJ Kelly
2010-04-20 23:03:11 -05:00
parent 3d00646b6f
commit bfda4f2e23
2 changed files with 20 additions and 13 deletions
+7 -7
View File
@@ -244,8 +244,8 @@ void BitmapText::BuildChars()
iX += g.m_iHadvance; iX += g.m_iHadvance;
// set texture coordinates // set texture coordinates
v[0].t = RageVector2( g.m_TexRect.left, g.m_TexRect.top ); v[0].t = RageVector2( g.m_TexRect.left, g.m_TexRect.top );
v[1].t = RageVector2( g.m_TexRect.left, g.m_TexRect.bottom ); v[1].t = RageVector2( g.m_TexRect.left, g.m_TexRect.bottom );
v[2].t = RageVector2( g.m_TexRect.right, g.m_TexRect.bottom ); v[2].t = RageVector2( g.m_TexRect.right, g.m_TexRect.bottom );
v[3].t = RageVector2( g.m_TexRect.right, g.m_TexRect.top ); v[3].t = RageVector2( g.m_TexRect.right, g.m_TexRect.top );
@@ -292,8 +292,8 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
FadeSize.right = (1.0f-LeftPercent) * fHorizRemaining; FadeSize.right = (1.0f-LeftPercent) * fHorizRemaining;
} }
/* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade all the way to /* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade
* 0 if the crop is beyond the outer edge.) */ * all the way to 0 if the crop is beyond the outer edge.) */
const float fRightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 ); const float fRightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 );
const float fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 ); const float fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 );
@@ -314,7 +314,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
float fAlpha = 1.0f; float fAlpha = 1.0f;
if( FadeSize.left > 0.001f ) if( FadeSize.left > 0.001f )
{ {
/* Add .5, so we fade wrt. the center of the vert, not the left side. */ // Add .5, so we fade wrt. the center of the vert, not the left side.
float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f ); float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f );
fPercent = clamp( fPercent, 0.0f, 1.0f ); fPercent = clamp( fPercent, 0.0f, 1.0f );
fAlpha *= fPercent * fLeftAlpha; fAlpha *= fPercent * fLeftAlpha;
@@ -403,7 +403,7 @@ void BitmapText::SetTextInternal()
// This does not work in all languages: // This does not work in all languages:
/* "...I can add Japanese wrapping, at least. We could handle hyphens /* "...I can add Japanese wrapping, at least. We could handle hyphens
* and soft hyphens and pretty easily, too. -glenn */ * and soft hyphens and pretty easily, too." -glenn */
// TODO: Move this wrapping logic into Font // TODO: Move this wrapping logic into Font
vector<RString> asLines; vector<RString> asLines;
split( m_sText, "\n", asLines, false ); split( m_sText, "\n", asLines, false );
@@ -709,7 +709,7 @@ void BitmapText::DrawPrimitives()
} }
} }
/* Rebuild when these change. */ // Rebuild when these change.
void BitmapText::SetHorizAlign( float f ) void BitmapText::SetHorizAlign( float f )
{ {
float fHorizAlign = m_fHorizAlign; float fHorizAlign = m_fHorizAlign;
+9 -2
View File
@@ -16,6 +16,7 @@ static ThemeMetric<bool> SHOW_TRAINING ("WheelNotifyIcon","ShowTraining");
WheelNotifyIcon::WheelNotifyIcon() WheelNotifyIcon::WheelNotifyIcon()
{ {
// Load( THEME->GetPathG("MusicWheelItem","WheelNotifyIcon") );
Load( THEME->GetPathG("WheelNotifyIcon","icons 4x2") ); Load( THEME->GetPathG("WheelNotifyIcon","icons 4x2") );
StopAnimating(); StopAnimating();
} }
@@ -38,7 +39,7 @@ void WheelNotifyIcon::SetFlags( Flags flags )
switch( flags.iStagesForSong ) switch( flags.iStagesForSong )
{ {
case 1: break; case 1: break;
case 2: m_vIconsToShow.push_back( long_ver ); break; case 2: m_vIconsToShow.push_back( long_ver ); break;
case 3: m_vIconsToShow.push_back( marathon ); break; case 3: m_vIconsToShow.push_back( marathon ); break;
default: FAIL_M( ssprintf("flags.iStagesForSong = %d", flags.iStagesForSong) ); default: FAIL_M( ssprintf("flags.iStagesForSong = %d", flags.iStagesForSong) );
@@ -56,9 +57,12 @@ void WheelNotifyIcon::SetFlags( Flags flags )
m_vIconsToShow.push_back( empty ); m_vIconsToShow.push_back( empty );
} }
m_vIconsToShow.resize( min(m_vIconsToShow.size(),2u) ); // crop to most important 2 m_vIconsToShow.resize( min(m_vIconsToShow.size(),2u) ); // crop to most important 2
// Broadcast Set message so items can react. (futures) -aj
//Message msg("Set");
//this->HandleMessage( msg );
/* Make sure the right icon is selected, since we might be drawn before /* Make sure the right icon is selected, since we might be drawn before
* we get another update. */ * we get another update. */
Update(0); Update(0);
@@ -75,6 +79,9 @@ void WheelNotifyIcon::Update( float fDeltaTime )
{ {
if( m_vIconsToShow.size() > 0 ) if( m_vIconsToShow.size() > 0 )
{ {
/* We should probably end up parsing the vector and then dynamically
* insert flag icons based on "priority". Easy to do, hopefully
- Midiman */
const float fSecondFraction = fmodf( RageTimer::GetTimeSinceStartFast(), 1 ); const float fSecondFraction = fmodf( RageTimer::GetTimeSinceStartFast(), 1 );
const int index = (int)(fSecondFraction*m_vIconsToShow.size()); const int index = (int)(fSecondFraction*m_vIconsToShow.size());
Sprite::SetState( m_vIconsToShow[index] ); Sprite::SetState( m_vIconsToShow[index] );