From 3f0557139b51f5e2c02ba690146f3ce66c5be934 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 3 Sep 2003 06:47:10 +0000 Subject: [PATCH] Hopefully fix GroupList tweening weirdness --- stepmania/Themes/default/metrics.ini | 6 +++-- stepmania/src/GroupList.cpp | 33 ++++++++++++++-------------- stepmania/src/GroupList.h | 1 + 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 6b625ec60a..6a4347e26d 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -486,8 +486,10 @@ StartX=0 StartY=-136 SpacingX=0 SpacingY=28 -GainFocusCommand=glowshift;effectperiod,0.5;linear,0.2;x,-40 -LoseFocusCommand=stoptweening;stopeffect;linear,0.2;x,0 +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; # This just selects the type of tweening used for scrolling the list; it shouldn't actually diff --git a/stepmania/src/GroupList.cpp b/stepmania/src/GroupList.cpp index 000a4bd62b..5499f7634a 100644 --- a/stepmania/src/GroupList.cpp +++ b/stepmania/src/GroupList.cpp @@ -12,8 +12,10 @@ #define SPACING_X THEME->GetMetricF("GroupList","SpacingX") #define SPACING_Y THEME->GetMetricF("GroupList","SpacingY") #define SCROLL_TWEEN_COMMAND THEME->GetMetric ("GroupList","ScrollTweenCommand") -#define GAIN_FOCUS_COMMAND THEME->GetMetric ("GroupList","GainFocusCommand") -#define LOSE_FOCUS_COMMAND THEME->GetMetric ("GroupList","LoseFocusCommand") +#define GAIN_FOCUS_ITEM_COMMAND THEME->GetMetric ("GroupList","GainFocusItemCommand") +#define LOSE_FOCUS_ITEM_COMMAND THEME->GetMetric ("GroupList","LoseFocusItemCommand") +#define GAIN_FOCUS_GROUP_COMMAND THEME->GetMetric ("GroupList","GainFocusGroupCommand") +#define LOSE_FOCUS_GROUP_COMMAND THEME->GetMetric ("GroupList","LoseFocusGroupCommand") #define HIDE_ITEM_COMMAND THEME->GetMetric ("GroupList","HideItemCommand") #define SHOW_ITEM_COMMAND THEME->GetMetric ("GroupList","ShowItemCommand") @@ -30,6 +32,7 @@ GroupList::~GroupList() { delete m_sprButtons[i]; delete m_textLabels[i]; + delete m_ButtonFrames[i]; } } @@ -50,17 +53,20 @@ void GroupList::Load( const CStringArray& asGroupNames ) { Sprite *button = new Sprite; BitmapText *label = new BitmapText; + ActorFrame *frame = new ActorFrame; m_sprButtons.push_back( button ); m_textLabels.push_back( label ); + m_ButtonFrames.push_back( frame ); button->Load( THEME->GetPathToG("GroupList bar") ); label->LoadFromFont( THEME->GetPathToF("GroupList label") ); label->SetShadowLength( 2 ); label->SetText( SONGMAN->ShortenGroupName( asGroupNames[i] ) ); - m_Frame.AddChild( button ); - m_Frame.AddChild( label ); + frame->AddChild( button ); + frame->AddChild( label ); + m_Frame.AddChild( frame ); button->SetXY( START_X + i*SPACING_X, START_Y + i*SPACING_Y ); label->SetXY( START_X + i*SPACING_X, START_Y + i*SPACING_Y ); @@ -98,8 +104,9 @@ void GroupList::ResetTextSize( int i ) void GroupList::BeforeChange() { - m_sprButtons[m_iSelection]->Command( LOSE_FOCUS_COMMAND ); - m_textLabels[m_iSelection]->Command( LOSE_FOCUS_COMMAND ); + m_sprButtons[m_iSelection]->Command( LOSE_FOCUS_ITEM_COMMAND ); + m_textLabels[m_iSelection]->Command( LOSE_FOCUS_ITEM_COMMAND ); + m_ButtonFrames[m_iSelection]->Command( LOSE_FOCUS_GROUP_COMMAND ); } @@ -129,8 +136,9 @@ void GroupList::AfterChange() m_bHidden[i] = IsHidden; } - m_sprButtons[m_iSelection]->Command( GAIN_FOCUS_COMMAND ); - m_textLabels[m_iSelection]->Command( GAIN_FOCUS_COMMAND ); + m_sprButtons[m_iSelection]->Command( GAIN_FOCUS_ITEM_COMMAND ); + m_textLabels[m_iSelection]->Command( GAIN_FOCUS_ITEM_COMMAND ); + m_ButtonFrames[m_iSelection]->Command( GAIN_FOCUS_GROUP_COMMAND ); } void GroupList::Up() @@ -175,15 +183,6 @@ void GroupList::SetSelection( unsigned sel ) AfterChange(); } -/* either tweened off screen (to come on screen), - tweened off screen (invisible), - onscreen (unselected), - or onscreen (selected) - - coming on/ofscreen is internal - always invis<->unselected<->selected - */ - void GroupList::TweenOnScreen() { diff --git a/stepmania/src/GroupList.h b/stepmania/src/GroupList.h index dbe983749a..378fcd37cf 100644 --- a/stepmania/src/GroupList.h +++ b/stepmania/src/GroupList.h @@ -9,6 +9,7 @@ class GroupList: public ActorFrame { ActorFrame m_Frame; vector m_sprButtons; vector m_textLabels; + vector m_ButtonFrames; vector m_asLabels; vector m_bHidden;