cursor: tween width at the same time as tweening the position for smoother motion
This commit is contained in:
@@ -44,6 +44,24 @@ void OptionsCursor::Set( PlayerNumber pn )
|
||||
m_sprRight.SetState( iBaseFrameNo+2 );
|
||||
}
|
||||
|
||||
void OptionsCursor::StopTweening()
|
||||
{
|
||||
ActorFrame::StopTweening();
|
||||
|
||||
m_sprLeft.StopTweening();
|
||||
m_sprMiddle.StopTweening();
|
||||
m_sprRight.StopTweening();
|
||||
}
|
||||
|
||||
void OptionsCursor::BeginTweening( float fSecs )
|
||||
{
|
||||
ActorFrame::BeginTweening( fSecs );
|
||||
|
||||
m_sprLeft.BeginTweening( fSecs );
|
||||
m_sprMiddle.BeginTweening( fSecs );
|
||||
m_sprRight.BeginTweening( fSecs );
|
||||
}
|
||||
|
||||
void OptionsCursor::SetBarWidth( int iWidth )
|
||||
{
|
||||
if( iWidth%2 == 1 )
|
||||
@@ -56,19 +74,6 @@ void OptionsCursor::SetBarWidth( int iWidth )
|
||||
m_sprRight.SetX( +iWidth/2 + fFrameWidth/2 );
|
||||
}
|
||||
|
||||
void OptionsCursor::TweenBarWidth( int iNewWidth )
|
||||
{
|
||||
m_sprLeft.StopTweening();
|
||||
m_sprMiddle.StopTweening();
|
||||
m_sprRight.StopTweening();
|
||||
|
||||
m_sprLeft.BeginTweening( 0.2f );
|
||||
m_sprMiddle.BeginTweening( 0.2f );
|
||||
m_sprRight.BeginTweening( 0.2f );
|
||||
|
||||
SetBarWidth( iNewWidth );
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2003 Chris Danford
|
||||
* All rights reserved.
|
||||
|
||||
@@ -16,8 +16,10 @@ public:
|
||||
enum Element { cursor, underline };
|
||||
void Load( CString sType, Element elem );
|
||||
void Set( PlayerNumber pn );
|
||||
|
||||
void StopTweening();
|
||||
void BeginTweening( float fSecs );
|
||||
void SetBarWidth( int iWidth );
|
||||
void TweenBarWidth( int iNewWidth );
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
|
||||
cursor.SetXY( (float)iX, (float)iY );
|
||||
}
|
||||
|
||||
cursor.TweenBarWidth( iWidth );
|
||||
cursor.SetBarWidth( iWidth );
|
||||
|
||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user