cursor: tween width at the same time as tweening the position for smoother motion

This commit is contained in:
Chris Danford
2005-04-22 20:59:01 +00:00
parent 6aba73c3dc
commit ef6ea34f69
3 changed files with 22 additions and 15 deletions
+18 -13
View File
@@ -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.
+3 -1
View File
@@ -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:
+1 -1
View File
@@ -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) )
{