From efb1eb16cf2b0712032f7d2dafb0a9f7c341ac17 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 9 Jan 2004 03:44:15 +0000 Subject: [PATCH] fix option underlines being the wrong width after changing for one frame --- stepmania/src/OptionsCursor.cpp | 29 ++++++++++++----------------- stepmania/src/OptionsCursor.h | 1 - 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/stepmania/src/OptionsCursor.cpp b/stepmania/src/OptionsCursor.cpp index af6471578e..9220731db1 100644 --- a/stepmania/src/OptionsCursor.cpp +++ b/stepmania/src/OptionsCursor.cpp @@ -51,30 +51,25 @@ void OptionsCursor::Load( PlayerNumber pn, bool bUnderline ) void OptionsCursor::SetBarWidth( int iWidth ) { - TweenBarWidth( iWidth, 0.001f ); + if( iWidth%2 == 1 ) + iWidth++; // round up to nearest even number + float fFrameWidth = m_sprLeft.GetUnzoomedWidth(); + + m_sprMiddle.SetZoomX( iWidth/(float)fFrameWidth ); + + m_sprLeft.SetX( -iWidth/2 - fFrameWidth/2 ); + m_sprRight.SetX( +iWidth/2 + fFrameWidth/2 ); } void OptionsCursor::TweenBarWidth( int iNewWidth ) { - TweenBarWidth( iNewWidth, 0.2f ); -} - -void OptionsCursor::TweenBarWidth( int iNewWidth, float fTweenTime ) -{ - if( iNewWidth%2 == 1 ) - iNewWidth++; // round up to nearest even number - float fFrameWidth = m_sprLeft.GetUnzoomedWidth(); - m_sprLeft.StopTweening(); m_sprMiddle.StopTweening(); m_sprRight.StopTweening(); - m_sprLeft.BeginTweening( fTweenTime ); - m_sprMiddle.BeginTweening( fTweenTime ); - m_sprRight.BeginTweening( fTweenTime ); + m_sprLeft.BeginTweening( 0.2f ); + m_sprMiddle.BeginTweening( 0.2f ); + m_sprRight.BeginTweening( 0.2f ); - m_sprMiddle.SetZoomX( iNewWidth/(float)fFrameWidth ); - - m_sprLeft.SetX( -iNewWidth/2 - fFrameWidth/2 ); - m_sprRight.SetX( +iNewWidth/2 + fFrameWidth/2 ); + SetBarWidth( iNewWidth ); } diff --git a/stepmania/src/OptionsCursor.h b/stepmania/src/OptionsCursor.h index 749f6c8a6b..262a602fc6 100644 --- a/stepmania/src/OptionsCursor.h +++ b/stepmania/src/OptionsCursor.h @@ -26,7 +26,6 @@ public: void TweenBarWidth( int iNewWidth ); protected: - void TweenBarWidth( int iNewWidth, float fTweenTime ); Sprite m_sprLeft; Sprite m_sprMiddle;