diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 424f7276f1..b7a6fdab7c 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -420,15 +420,20 @@ StartX=0 StartY=-136 SpacingX=0 SpacingY=28 -GainFocusGroupCommand=stoptweening;linear,0.2;x,-40 -LoseFocusGroupCommand=stoptweening;linear,0.2;x,0 -GainFocusItemCommand=glowshift;effectperiod,0.5 -LoseFocusItemCommand=stopeffect -HideItemCommand=linear,0.2;diffusealpha,0 -ShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; +ButtonFrameGainFocusCommand=stoptweening;linear,0.2;x,-40 +ButtonFrameLoseFocusCommand=stoptweening;linear,0.2;x,0 + +ButtonGainFocusCommand=glowshift;effectperiod,0.5 +ButtonLoseFocusCommand=stopeffect +LabelGainFocusCommand=glowshift;effectperiod,0.5 +LabelLoseFocusCommand=stopeffect +ButtonHideItemCommand=linear,0.2;diffusealpha,0 +ButtonShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; +LabelHideItemCommand=linear,0.2;diffusealpha,0 +LabelShowItemCommand=stoptweening;linear,0.2;diffusealpha,1;zoom,1.0; # This just selects the type of tweening used for scrolling the list; it shouldn't actually # queue any commands. -ScrollTweenCommand=stoptweening;linear,0.2; +FrameScrollTweenCommand=stoptweening;linear,0.2; [MusicList] NumColumns=4 diff --git a/stepmania/src/GroupList.cpp b/stepmania/src/GroupList.cpp index 9ebb668e64..44069d00a0 100644 --- a/stepmania/src/GroupList.cpp +++ b/stepmania/src/GroupList.cpp @@ -4,6 +4,7 @@ #include "SongManager.h" #include "RageLog.h" #include "ThemeMetric.h" +#include "ActorUtil.h" /* If this actor is used anywhere other than SelectGroup, we * can add a setting that changes which metric group we pull @@ -12,13 +13,6 @@ static const ThemeMetric START_X ("GroupList","StartX"); static const ThemeMetric START_Y ("GroupList","StartY"); static const ThemeMetric SPACING_X ("GroupList","SpacingX"); static const ThemeMetric SPACING_Y ("GroupList","SpacingY"); -static const ThemeMetric SCROLL_TWEEN_COMMAND ("GroupList","ScrollTweenCommand"); -static const ThemeMetric GAIN_FOCUS_ITEM_COMMAND ("GroupList","GainFocusItemCommand"); -static const ThemeMetric LOSE_FOCUS_ITEM_COMMAND ("GroupList","LoseFocusItemCommand"); -static const ThemeMetric GAIN_FOCUS_GROUP_COMMAND ("GroupList","GainFocusGroupCommand"); -static const ThemeMetric LOSE_FOCUS_GROUP_COMMAND ("GroupList","LoseFocusGroupCommand"); -static const ThemeMetric HIDE_ITEM_COMMAND ("GroupList","HideItemCommand"); -static const ThemeMetric SHOW_ITEM_COMMAND ("GroupList","ShowItemCommand"); const int MAX_GROUPS_ONSCREEN = 7; @@ -48,13 +42,23 @@ void GroupList::Load( const vector& asGroupNames ) { m_asLabels = asGroupNames; + m_Frame.SetName( "Frame" ); this->AddChild( &m_Frame ); + ActorUtil::LoadAllCommands( m_Frame, "GroupList" ); for( unsigned i=0; i < m_asLabels.size(); i++ ) { Sprite *button = new Sprite; + button->SetName( "Button" ); + ActorUtil::LoadAllCommands( *button, "GroupList" ); + BitmapText *label = new BitmapText; + label->SetName( "Label" ); + ActorUtil::LoadAllCommands( *label, "GroupList" ); + ActorFrame *frame = new ActorFrame; + frame->SetName( "ButtonFrame" ); + ActorUtil::LoadAllCommands( *frame, "GroupList" ); m_sprButtons.push_back( button ); m_textLabels.push_back( label ); @@ -105,16 +109,14 @@ void GroupList::ResetTextSize( int i ) void GroupList::BeforeChange() { - m_sprButtons[m_iSelection]->RunCommands( LOSE_FOCUS_ITEM_COMMAND ); - m_textLabels[m_iSelection]->RunCommands( LOSE_FOCUS_ITEM_COMMAND ); - m_ButtonFrames[m_iSelection]->RunCommands( LOSE_FOCUS_GROUP_COMMAND ); + m_ButtonFrames[m_iSelection]->PlayCommand( "LoseFocus" ); } void GroupList::AfterChange() { m_Frame.StopTweening(); - m_Frame.RunCommands( SCROLL_TWEEN_COMMAND ); + m_Frame.PlayCommand( "ScrollTween" ); m_Frame.SetY( -m_iTop*SPACING_Y ); for( int i=0; i < (int) m_asLabels.size(); i++ ) @@ -124,22 +126,18 @@ void GroupList::AfterChange() if( IsHidden && !WasHidden ) { - m_sprButtons[i]->RunCommands( HIDE_ITEM_COMMAND ); - m_textLabels[i]->RunCommands( HIDE_ITEM_COMMAND ); + m_ButtonFrames[i]->PlayCommand( "HideItem" ); } else if( !IsHidden && WasHidden ) { - m_sprButtons[i]->RunCommands( SHOW_ITEM_COMMAND ); - m_textLabels[i]->RunCommands( SHOW_ITEM_COMMAND ); + m_ButtonFrames[i]->PlayCommand( "ShowItem" ); ResetTextSize( i ); } m_bHidden[i] = IsHidden; } - m_sprButtons[m_iSelection]->RunCommands( GAIN_FOCUS_ITEM_COMMAND ); - m_textLabels[m_iSelection]->RunCommands( GAIN_FOCUS_ITEM_COMMAND ); - m_ButtonFrames[m_iSelection]->RunCommands( GAIN_FOCUS_GROUP_COMMAND ); + m_ButtonFrames[m_iSelection]->PlayCommand( "GainFocus" ); } void GroupList::Up() @@ -206,8 +204,7 @@ void GroupList::TweenOnScreen() /* If this item isn't visible, hide it and skip tweens. */ if( !ItemIsOnScreen(i) ) { - m_sprButtons[i]->RunCommands( HIDE_ITEM_COMMAND ); - m_textLabels[i]->RunCommands( HIDE_ITEM_COMMAND ); + m_ButtonFrames[i]->PlayCommand( "HideItem" ); m_sprButtons[i]->FinishTweening(); m_textLabels[i]->FinishTweening(); diff --git a/stepmania/src/LyricDisplay.cpp b/stepmania/src/LyricDisplay.cpp index 689a7720fa..aeccfc5a33 100644 --- a/stepmania/src/LyricDisplay.cpp +++ b/stepmania/src/LyricDisplay.cpp @@ -4,9 +4,8 @@ #include "GameState.h" #include "ThemeMetric.h" #include "song.h" +#include "ActorUtil.h" -static ThemeMetric IN_COMMAND ("LyricDisplay","InCommand"); -static ThemeMetric OUT_COMMAND ("LyricDisplay","OutCommand"); static ThemeMetric IN_LENGTH ("LyricDisplay","InLength"); static ThemeMetric OUT_LENGTH ("LyricDisplay","OutLength"); static ThemeMetric WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor"); @@ -15,6 +14,8 @@ LyricDisplay::LyricDisplay() { for( int i=0; i<2; i++ ) { + m_textLyrics[i].SetName( "Lyric" ); + ActorUtil::LoadAllCommands( m_textLyrics[i], "LyricDisplay" ); m_textLyrics[i].LoadFromFont( THEME->GetPathF("LyricDisplay","text") ); m_textLyrics[i].SetDiffuse( RageColor(1,1,1,1) ); this->AddChild( &m_textLyrics[i] ); @@ -100,14 +101,14 @@ void LyricDisplay::Update( float fDeltaTime ) m_textLyrics[i].SetCropLeft(0); if( i==1 ) m_textLyrics[i].SetCropRight(1); - m_textLyrics[i].RunCommands( IN_COMMAND ); + m_textLyrics[i].PlayCommand( "In" ); m_textLyrics[i].BeginTweening( fShowLength * 0.75f ); /* sleep */ if( i==0 ) m_textLyrics[i].SetCropLeft(1); if( i==1 ) m_textLyrics[i].SetCropRight(0); m_textLyrics[i].BeginTweening( fShowLength * 0.25f ); /* sleep */ - m_textLyrics[i].RunCommands( OUT_COMMAND ); + m_textLyrics[i].PlayCommand( "Out" ); } m_iCurLyricNumber++;