Set the actor to use for graying, instead of passing it around in an

overloaded "DrawPrimitives".  It's too confusing to have different
DrawPrimitives overloads.
This commit is contained in:
Glenn Maynard
2005-05-05 03:01:39 +00:00
parent ac55b2d24f
commit af6a452ee9
3 changed files with 24 additions and 17 deletions
+10 -9
View File
@@ -223,6 +223,15 @@ void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID, bool bExpanded
default: ASSERT(0);
}
Sprite *pBar = NULL;
if( m_sprBar.GetVisible() )
pBar = &m_sprBar;
else if( m_sprSectionBar.GetVisible() )
pBar = &m_sprSectionBar;
else
pBar = &m_sprExpandedBar;
SetGrayBar( pBar );
}
void MusicWheelItem::RefreshGrades()
@@ -254,15 +263,7 @@ void MusicWheelItem::RefreshGrades()
void MusicWheelItem::DrawPrimitives()
{
Sprite *pBar = NULL;
if( m_sprBar.GetVisible() )
pBar = &m_sprBar;
else if( m_sprSectionBar.GetVisible() )
pBar = &m_sprSectionBar;
else
pBar = &m_sprExpandedBar;
WheelItemBase::DrawPrimitives( *pBar );
WheelItemBase::DrawPrimitives();
}
/*
+6 -3
View File
@@ -28,6 +28,7 @@ WheelItemBaseData::WheelItemBaseData( WheelItemType wit, CString sText, RageColo
WheelItemBase::WheelItemBase(CString sType)
{
SetName( sType );
m_pBar = NULL;
Load(sType);
}
@@ -42,6 +43,7 @@ void WheelItemBase::Load( CString sType )
m_sprBar.Load( THEME->GetPathG(sType,"bar") );
m_sprBar.SetXY( 0, 0 );
this->AddChild( &m_sprBar );
m_pBar = &m_sprBar;
m_text.LoadFromFont( THEME->GetPathF(sType,"text") );
m_text.SetShadowLength( 0 );
@@ -79,7 +81,7 @@ void WheelItemBase::Update( float fDeltaTime )
Actor::Update( fDeltaTime );
}
void WheelItemBase::DrawGrayBar( Sprite& bar )
void WheelItemBase::DrawGrayBar( Actor& bar )
{
if( m_fPercentGray == 0 )
return;
@@ -91,11 +93,12 @@ void WheelItemBase::DrawGrayBar( Sprite& bar )
bar.SetGlow( RageColor(0,0,0,0) );
}
void WheelItemBase::DrawPrimitives(Sprite& bar)
void WheelItemBase::DrawPrimitives()
{
ActorFrame::DrawPrimitives();
DrawGrayBar( bar );
if( m_pBar != NULL )
DrawGrayBar( *m_pBar );
}
/*
+8 -5
View File
@@ -28,20 +28,23 @@ enum WheelItemType
class WheelItemBase : public ActorFrame
{
public:
WheelItemBase(CString sType = "WheelItemBase");
WheelItemBaseData* data;
WheelItemBase( CString sType = "WheelItemBase" );
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(Sprite& bar);
virtual void DrawPrimitives() { DrawPrimitives( m_sprBar ); }
virtual void DrawPrimitives();
void Load( CString sType );
void DrawGrayBar( Sprite& bar );
void DrawGrayBar( Actor& bar );
virtual void LoadFromWheelItemBaseData( WheelItemBaseData* pWID );
float m_fPercentGray;
protected:
void SetGrayBar( Actor *pBar ) { m_pBar = pBar; }
WheelItemBaseData* data;
Actor *m_pBar;
Sprite m_sprBar;
BitmapText m_text;
WheelItemType m_Type;