separate frame and per-line highlight

This commit is contained in:
Glenn Maynard
2003-12-19 22:10:06 +00:00
parent 7772266cdf
commit e5fe05024a
2 changed files with 20 additions and 5 deletions
+17 -4
View File
@@ -66,10 +66,6 @@ ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName)
// add everything to m_framePage so we can animate everything at once // add everything to m_framePage so we can animate everything at once
this->AddChild( &m_framePage ); this->AddChild( &m_framePage );
m_sprPage.Load( THEME->GetPathToG(sClassName+" page") );
m_sprPage.SetXY( CENTER_X, CENTER_Y );
m_framePage.AddChild( &m_sprPage );
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
m_iCurrentRow[p] = 0; m_iCurrentRow[p] = 0;
@@ -102,12 +98,23 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi
int p; int p;
m_sprPage.Load( THEME->GetPathToG(m_sName+" page") );
m_sprPage->SetName( "Page" );
UtilSetXYAndOnCommand( m_sprPage, "ScreenOptions" );
m_framePage.AddChild( m_sprPage );
// init highlights // init highlights
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( !GAMESTATE->IsHumanPlayer(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
continue; // skip continue; // skip
m_sprLineHighlight[p].Load( THEME->GetPathToG("ScreenOptions line highlight") );
m_sprLineHighlight[p].SetName( "LineHighlight" );
m_sprLineHighlight[p].SetX( CENTER_X );
m_framePage.AddChild( &m_sprLineHighlight[p] );
UtilOnCommand( m_sprLineHighlight[p], "ScreenOptions" );
m_Highlight[p].Load( (PlayerNumber)p, false ); m_Highlight[p].Load( (PlayerNumber)p, false );
m_framePage.AddChild( &m_Highlight[p] ); m_framePage.AddChild( &m_Highlight[p] );
} }
@@ -258,6 +265,10 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi
ASSERT(0); ASSERT(0);
} }
m_sprFrame.Load( THEME->GetPathToG( "ScreenOptions frame") );
m_sprFrame->SetXY( CENTER_X, CENTER_Y );
m_framePage.AddChild( m_sprFrame );
// poke once at all the explanation metrics so that we catch missing ones early // poke once at all the explanation metrics so that we catch missing ones early
for( r=0; r<m_iNumOptionRows; r++ ) // foreach line for( r=0; r<m_iNumOptionRows; r++ ) // foreach line
{ {
@@ -498,6 +509,8 @@ void ScreenOptions::TweenCursor( PlayerNumber player_no )
highlight.BeginTweening( 0.2f ); highlight.BeginTweening( 0.2f );
highlight.TweenBarWidth( iWidth ); highlight.TweenBarWidth( iWidth );
highlight.SetXY( (float)iX, (float)iY ); highlight.SetXY( (float)iX, (float)iY );
m_sprLineHighlight[player_no].SetY( (float)iY );
} }
void ScreenOptions::UpdateText( PlayerNumber player_no, int iRow ) void ScreenOptions::UpdateText( PlayerNumber player_no, int iRow )
+3 -1
View File
@@ -108,7 +108,8 @@ protected: // derived classes need access to these
int m_iNumOptionRows; int m_iNumOptionRows;
ActorFrame m_framePage; ActorFrame m_framePage;
Sprite m_sprPage; AutoActor m_sprPage;
AutoActor m_sprFrame;
Sprite m_sprBullets[MAX_OPTION_LINES]; Sprite m_sprBullets[MAX_OPTION_LINES];
BitmapText m_textTitles[MAX_OPTION_LINES]; BitmapText m_textTitles[MAX_OPTION_LINES];
vector<BitmapText *> m_textItems[MAX_OPTION_LINES]; vector<BitmapText *> m_textItems[MAX_OPTION_LINES];
@@ -123,6 +124,7 @@ protected: // derived classes need access to these
OptionsCursor m_Underline[NUM_PLAYERS][MAX_OPTION_LINES]; OptionsCursor m_Underline[NUM_PLAYERS][MAX_OPTION_LINES];
OptionIcon m_OptionIcons[NUM_PLAYERS][MAX_OPTION_LINES]; OptionIcon m_OptionIcons[NUM_PLAYERS][MAX_OPTION_LINES];
OptionsCursor m_Highlight[NUM_PLAYERS]; OptionsCursor m_Highlight[NUM_PLAYERS];
Sprite m_sprLineHighlight[NUM_PLAYERS];
BitmapText m_textPlayerName[NUM_PLAYERS]; BitmapText m_textPlayerName[NUM_PLAYERS];
BitmapText m_textExplanation[NUM_PLAYERS]; BitmapText m_textExplanation[NUM_PLAYERS];