Set up tsDestination directly. It doesn't make sense for a

function named "UpdateEnabledDisabled" to do this, and we
don't need to delay it anymore as GetWidthXY says (that was
before we moved the text into a frame).
This commit is contained in:
Glenn Maynard
2006-01-30 08:06:31 +00:00
parent e89b93ba21
commit cb0c7ce59d
3 changed files with 20 additions and 11 deletions
+11 -8
View File
@@ -556,6 +556,17 @@ void OptionRow::SetRowHasFocus( PlayerNumber pn, bool bRowHasFocus )
m_bRowHasFocus[pn] = bRowHasFocus;
}
void OptionRow::SetDestination( Actor::TweenState &ts )
{
if( m_Frame.DestTweenState() != ts )
{
m_Frame.StopTweening();
if( m_pParentType->TWEEN_SECONDS != 0 )
m_Frame.BeginTweening( m_pParentType->TWEEN_SECONDS );
m_Frame.DestTweenState() = ts;
}
}
void OptionRow::UpdateEnabledDisabled()
{
bool bThisRowHasFocusByAny = false;
@@ -568,14 +579,6 @@ void OptionRow::UpdateEnabledDisabled()
bool bRowEnabled = !m_pHand->m_Def.m_vEnabledForPlayers.empty();
if( m_Frame.DestTweenState() != m_tsDestination )
{
m_Frame.StopTweening();
if( m_pParentType->TWEEN_SECONDS != 0 )
m_Frame.BeginTweening( m_pParentType->TWEEN_SECONDS );
m_Frame.DestTweenState() = m_tsDestination;
}
if( bThisRowHasFocusByAny )
m_textTitle->RunCommands( m_pParentType->TITLE_GAIN_FOCUS_COMMAND );
else
+2 -1
View File
@@ -220,9 +220,10 @@ protected:
int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus
// Only one will true at a time if m_pHand->m_Def.bMultiSelect
vector<bool> m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size()
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
public:
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
void SetDestination( Actor::TweenState &ts );
protected:
bool m_bHidden; // currently off screen
};
+7 -2
View File
@@ -682,7 +682,8 @@ void ScreenOptions::PositionRows()
else if( i >= first_end && i < second_start ) fPos = ((int)NUM_ROWS_SHOWN)/2-0.5f;
else if( i >= second_end ) fPos = ((int)NUM_ROWS_SHOWN)-0.5f;
row.m_tsDestination = m_exprRowPositionTransformFunction.GetPosition( (float) fPos, i, min( (int)Rows.size(), (int)NUM_ROWS_SHOWN ) );
Actor::TweenState tsDestination = m_exprRowPositionTransformFunction.GetPosition( (float) fPos, i, min( (int)Rows.size(), (int)NUM_ROWS_SHOWN ) );
row.SetDestination( tsDestination );
bool bHidden =
i < first_start ||
@@ -695,7 +696,11 @@ void ScreenOptions::PositionRows()
if( pSeparateExitRow )
{
pSeparateExitRow->m_tsDestination.pos.y = SEPARATE_EXIT_ROW_Y;
Actor::TweenState tsDestination;
tsDestination.Init();
tsDestination.pos.y = SEPARATE_EXIT_ROW_Y;
pSeparateExitRow->SetDestination( tsDestination );
pSeparateExitRow->SetRowHidden( second_end != (int) Rows.size() );
}
}