Use autoActor.
Do GainFocus and LoseFocus for previews. Always run On and then either GainFocus or LoseFocus for all previews and icons.
This commit is contained in:
@@ -77,9 +77,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
for( i=0; i<NUM_ICON_PARTS; i++ )
|
for( i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
{
|
{
|
||||||
CString sFName = ssprintf("%s Icon Part%d Choice%d", m_sName.c_str(),i+1,c+1);
|
CString sFName = ssprintf("%s Icon Part%d Choice%d", m_sName.c_str(),i+1,c+1);
|
||||||
m_sprIcon[i][c].SetName( ssprintf("IconPart%dChoice%d",i+1,c+1) );
|
|
||||||
m_sprIcon[i][c].Load( THEME->GetPathToG(sFName) );
|
m_sprIcon[i][c].Load( THEME->GetPathToG(sFName) );
|
||||||
this->AddChild( &m_sprIcon[i][c] );
|
m_sprIcon[i][c]->SetName( ssprintf("IconPart%dChoice%d",i+1,c+1) );
|
||||||
|
this->AddChild( m_sprIcon[i][c] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
@@ -87,9 +87,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
for( i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
{
|
{
|
||||||
CString sFName = ssprintf("%s Preview Part%d Choice%d", m_sName.c_str(),i+1,c+1);
|
CString sFName = ssprintf("%s Preview Part%d Choice%d", m_sName.c_str(),i+1,c+1);
|
||||||
m_sprPreview[i][c][0].SetName( ssprintf("PreviewPart%d",i+1) );
|
|
||||||
m_sprPreview[i][c][0].Load( THEME->GetPathToG(sFName) );
|
m_sprPreview[i][c][0].Load( THEME->GetPathToG(sFName) );
|
||||||
this->AddChild( &m_sprPreview[i][c][0] );
|
m_sprPreview[i][c][0]->SetName( ssprintf("PreviewPart%d",i+1) );
|
||||||
|
this->AddChild( m_sprPreview[i][c][0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -101,9 +101,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
|
|||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
CString sFName = ssprintf("%s Preview Part%d Choice%d P%d", m_sName.c_str(),i+1,c+1,p+1);
|
CString sFName = ssprintf("%s Preview Part%d Choice%d P%d", m_sName.c_str(),i+1,c+1,p+1);
|
||||||
m_sprPreview[i][c][p].SetName( ssprintf("PreviewPart%dP%d",i+1,p+1) );
|
|
||||||
m_sprPreview[i][c][p].Load( THEME->GetPathToG(sFName) );
|
m_sprPreview[i][c][p].Load( THEME->GetPathToG(sFName) );
|
||||||
this->AddChild( &m_sprPreview[i][c][p] );
|
m_sprPreview[i][c][p]->SetName( ssprintf("PreviewPart%dP%d",i+1,p+1) );
|
||||||
|
this->AddChild( m_sprPreview[i][c][p] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,10 +206,10 @@ void ScreenSelectMaster::UpdateSelectableChoices()
|
|||||||
{
|
{
|
||||||
if( m_aModeChoices[c].IsPlayable() )
|
if( m_aModeChoices[c].IsPlayable() )
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
m_sprIcon[i][c].SetDiffuse( RageColor(1,1,1,1) );
|
m_sprIcon[i][c]->SetDiffuse( RageColor(1,1,1,1) );
|
||||||
else
|
else
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
m_sprIcon[i][c].SetDiffuse( DISABLED_COLOR );
|
m_sprIcon[i][c]->SetDiffuse( DISABLED_COLOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
@@ -334,7 +334,6 @@ void ScreenSelectMaster::ChangeSelection( PlayerNumber pn, int iNewChoice )
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
const int iOldChoice = m_iChoice[p];
|
const int iOldChoice = m_iChoice[p];
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
@@ -352,6 +351,14 @@ void ScreenSelectMaster::ChangeSelection( PlayerNumber pn, int iNewChoice )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
|
{
|
||||||
|
COMMAND( m_sprIcon[i][iOldChoice], "LoseFocus" );
|
||||||
|
COMMAND( m_sprIcon[i][iNewChoice], "GainFocus" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_iChoice[p] = iNewChoice;
|
m_iChoice[p] = iNewChoice;
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
@@ -445,18 +452,29 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
for( unsigned c=0; c<m_aModeChoices.size(); c++ )
|
||||||
{
|
{
|
||||||
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
for( int i=0; i<NUM_ICON_PARTS; i++ )
|
||||||
|
{
|
||||||
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprIcon[i][c] ) );
|
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprIcon[i][c] ) );
|
||||||
|
for( int c=0; c<(int) m_aModeChoices.size(); c++ )
|
||||||
|
{
|
||||||
|
const bool GainingFocus = (c == m_iChoice[0]);
|
||||||
|
fSecs = max( fSecs, COMMAND( m_sprIcon[i][c], GainingFocus? "GainFocus":"LoseFocus" ) );
|
||||||
|
if( !GainingFocus )
|
||||||
|
m_sprIcon[i][c]->FinishTweening();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if( SHARED_PREVIEW_AND_CURSOR )
|
if( SHARED_PREVIEW_AND_CURSOR )
|
||||||
{
|
{
|
||||||
int p=0;
|
int p=0;
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
{
|
{
|
||||||
SET_XY( m_sprPreview[i][c][p] );
|
// SET_XY( m_sprPreview[i][c][p] );
|
||||||
if( int(c)==m_iChoice[p] )
|
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] ) );
|
||||||
fSecs = max( fSecs, ON_COMMAND( m_sprPreview[i][c][p] ) );
|
const bool GainingFocus = (int(c) == m_iChoice[p]);
|
||||||
else
|
fSecs = max( fSecs, COMMAND( m_sprPreview[i][c][p], GainingFocus? "GainFocus":"LoseFocus" ) );
|
||||||
m_sprPreview[i][c][p].SetDiffuseAlpha(0);
|
if( !GainingFocus )
|
||||||
|
m_sprPreview[i][c][p]->FinishTweening();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -465,11 +483,12 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
{
|
{
|
||||||
SET_XY( m_sprPreview[i][c][p] );
|
// SET_XY( m_sprPreview[i][c][p] );
|
||||||
if( int(c)==m_iChoice[p] )
|
fSecs = max( fSecs, SET_XY_AND_ON_COMMAND( m_sprPreview[i][c][p] ) );
|
||||||
fSecs = max( fSecs, ON_COMMAND( m_sprPreview[i][c][p] ) );
|
const bool GainingFocus = (int(c) == m_iChoice[p]);
|
||||||
else
|
fSecs = max( fSecs, COMMAND( m_sprPreview[i][c][p], GainingFocus? "GainFocus":"LoseFocus" ) );
|
||||||
m_sprPreview[i][c][p].SetDiffuseAlpha(0);
|
if( !GainingFocus )
|
||||||
|
m_sprPreview[i][c][p]->FinishTweening();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,9 +501,16 @@ float ScreenSelectMaster::TweenOnScreen()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
{
|
||||||
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
|
continue;
|
||||||
|
for( int c=0; c<(int) m_aModeChoices.size(); c++ )
|
||||||
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
for( int i=0; i<NUM_PREVIEW_PARTS; i++ )
|
||||||
fSecs = max( fSecs, COMMAND( m_sprPreview[i][m_iChoice[p]][p], "GainFocus" ) );
|
{
|
||||||
|
const char *cmd = (c == m_iChoice[p])? "GainFocus":"LoseFocus";
|
||||||
|
fSecs = max( fSecs, COMMAND( m_sprPreview[i][c][p], cmd ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -565,10 +591,10 @@ float ScreenSelectMaster::TweenOffScreen()
|
|||||||
|
|
||||||
float ScreenSelectMaster::GetCursorX( PlayerNumber pn, int iPartIndex )
|
float ScreenSelectMaster::GetCursorX( PlayerNumber pn, int iPartIndex )
|
||||||
{
|
{
|
||||||
return m_sprIcon[0][m_iChoice[pn]].GetX() + CURSOR_OFFSET_X_FROM_ICON(pn, iPartIndex);
|
return m_sprIcon[0][m_iChoice[pn]]->GetX() + CURSOR_OFFSET_X_FROM_ICON(pn, iPartIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ScreenSelectMaster::GetCursorY( PlayerNumber pn, int iPartIndex )
|
float ScreenSelectMaster::GetCursorY( PlayerNumber pn, int iPartIndex )
|
||||||
{
|
{
|
||||||
return m_sprIcon[0][m_iChoice[pn]].GetY() + CURSOR_OFFSET_Y_FROM_ICON(pn, iPartIndex);
|
return m_sprIcon[0][m_iChoice[pn]]->GetY() + CURSOR_OFFSET_Y_FROM_ICON(pn, iPartIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "RageSound.h"
|
#include "RageSound.h"
|
||||||
#include "RandomSample.h"
|
#include "RandomSample.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
class ScreenSelectMaster : public ScreenSelect
|
class ScreenSelectMaster : public ScreenSelect
|
||||||
{
|
{
|
||||||
@@ -53,9 +54,9 @@ protected:
|
|||||||
Sprite m_sprExplanation[NUM_PAGES];
|
Sprite m_sprExplanation[NUM_PAGES];
|
||||||
Sprite m_sprMore[NUM_PAGES];
|
Sprite m_sprMore[NUM_PAGES];
|
||||||
#define MAX_ICON_PARTS 3
|
#define MAX_ICON_PARTS 3
|
||||||
Sprite m_sprIcon[MAX_ICON_PARTS][MAX_CHOICES];
|
AutoActor m_sprIcon[MAX_ICON_PARTS][MAX_CHOICES];
|
||||||
#define MAX_PREVIEW_PARTS 3
|
#define MAX_PREVIEW_PARTS 3
|
||||||
Sprite m_sprPreview[MAX_PREVIEW_PARTS][MAX_CHOICES][NUM_PLAYERS];
|
AutoActor m_sprPreview[MAX_PREVIEW_PARTS][MAX_CHOICES][NUM_PLAYERS];
|
||||||
#define MAX_CURSOR_PARTS 3
|
#define MAX_CURSOR_PARTS 3
|
||||||
Sprite m_sprCursor[MAX_CURSOR_PARTS][NUM_PLAYERS];
|
Sprite m_sprCursor[MAX_CURSOR_PARTS][NUM_PLAYERS];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user