diff --git a/stepmania/src/HelpDisplay.cpp b/stepmania/src/HelpDisplay.cpp new file mode 100644 index 0000000000..209f3e6513 --- /dev/null +++ b/stepmania/src/HelpDisplay.cpp @@ -0,0 +1,60 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: HelpDisplay + + Desc: See header + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "HelpDisplay.h" +#include "RageUtil.h" +#include "PrefsManager.h" +#include "RageLog.h" +#include "ThemeManager.h" + + +const float TIP_SHOW_TIME = 3.5f; + + +HelpDisplay::HelpDisplay() +{ + LOG->Trace( "HelpDisplay::HelpDisplay()" ); + + m_textTip.LoadFromFont( THEME->GetPathTo("Fonts","HelpDisplay") ); + m_textTip.SetEffectDiffuseBlink(); + m_textTip.EnableShadow( false ); + this->AddChild( &m_textTip ); + + m_iCurTipIndex = 0; + m_fSecsUntilSwitch = TIP_SHOW_TIME; +} + + +void HelpDisplay::SetTips( CStringArray &arrayTips ) +{ + m_arrayTips = arrayTips; + if( !m_arrayTips.empty() ) + m_textTip.SetText( m_arrayTips[0] ); +} + + +void HelpDisplay::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + if( !m_arrayTips.empty() ) + { + m_fSecsUntilSwitch -= fDeltaTime; + if( m_fSecsUntilSwitch < 0 ) // time to switch states + { + m_iCurTipIndex++; + m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size(); + m_fSecsUntilSwitch = TIP_SHOW_TIME; + m_textTip.SetText( m_arrayTips[m_iCurTipIndex] ); + } + } +} diff --git a/stepmania/src/HelpDisplay.h b/stepmania/src/HelpDisplay.h new file mode 100644 index 0000000000..a11d7e1e90 --- /dev/null +++ b/stepmania/src/HelpDisplay.h @@ -0,0 +1,37 @@ +#ifndef HelpDisplay_H +#define HelpDisplay_H +/* +----------------------------------------------------------------------------- + Class: HelpDisplay + + Desc: A BitmapText that cycles through messages. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "song.h" +#include "ActorFrame.h" +#include "BitmapText.h" + + +class HelpDisplay : public ActorFrame +{ +public: + HelpDisplay(); + void SetTips( CStringArray &arrayTips ); + + virtual void Update( float fDeltaTime ); + +protected: + BitmapText m_textTip; + + CStringArray m_arrayTips; + int m_iCurTipIndex; + + float m_fSecsUntilSwitch; +}; + +#endif