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
+11 -11
View File
@@ -96,7 +96,7 @@ BitmapText & BitmapText::operator=(const BitmapText &cpy)
if( m_pFont )
FONT->UnloadFont( m_pFont );
if( cpy.m_pFont != NULL )
m_pFont = FONT->CopyFont( cpy.m_pFont );
else
@@ -198,7 +198,7 @@ void BitmapText::BuildChars()
m_aVertices.clear();
m_vpFontPageTextures.clear();
if( m_wTextLines.empty() )
return;
@@ -244,8 +244,8 @@ void BitmapText::BuildChars()
iX += g.m_iHadvance;
// set texture coordinates
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[0].t = RageVector2( g.m_TexRect.left, g.m_TexRect.top );
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[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;
}
/* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade all the way to
* 0 if the crop is beyond the outer edge.) */
/* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade
* 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 fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 );
@@ -314,7 +314,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
float fAlpha = 1.0f;
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 );
fPercent = clamp( fPercent, 0.0f, 1.0f );
fAlpha *= fPercent * fLeftAlpha;
@@ -403,7 +403,7 @@ void BitmapText::SetTextInternal()
// This does not work in all languages:
/* "...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
vector<RString> asLines;
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 )
{
float fHorizAlign = m_fHorizAlign;
@@ -798,7 +798,7 @@ void BitmapText::Attribute::FromStack( lua_State *L, int iPos )
// Get the glow color.
lua_getfield( L, iTab, "Glow" );
glow.FromStack( L, -1 );
lua_settop( L, iTab - 1 );
}
@@ -840,7 +840,7 @@ public:
{
size_t iPos = IArg(1);
BitmapText::Attribute attr = p->GetDefaultAttribute();
attr.FromStack( L, 2 );
p->AddAttribute( iPos, attr );
return 0;
+9 -2
View File
@@ -16,6 +16,7 @@ static ThemeMetric<bool> SHOW_TRAINING ("WheelNotifyIcon","ShowTraining");
WheelNotifyIcon::WheelNotifyIcon()
{
// Load( THEME->GetPathG("MusicWheelItem","WheelNotifyIcon") );
Load( THEME->GetPathG("WheelNotifyIcon","icons 4x2") );
StopAnimating();
}
@@ -38,7 +39,7 @@ void WheelNotifyIcon::SetFlags( Flags flags )
switch( flags.iStagesForSong )
{
case 1: break;
case 1: break;
case 2: m_vIconsToShow.push_back( long_ver ); break;
case 3: m_vIconsToShow.push_back( marathon ); break;
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.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
* we get another update. */
Update(0);
@@ -75,6 +79,9 @@ void WheelNotifyIcon::Update( float fDeltaTime )
{
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 int index = (int)(fSecondFraction*m_vIconsToShow.size());
Sprite::SetState( m_vIconsToShow[index] );