2003-03-30 20:21:20 +00:00
|
|
|
#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"
|
2003-11-17 01:39:34 +00:00
|
|
|
#include "ActorUtil.h"
|
2003-03-30 20:21:20 +00:00
|
|
|
|
2003-11-17 01:39:34 +00:00
|
|
|
#define TIP_SHOW_TIME THEME->GetMetricF(m_sName,"TipShowTime")
|
2003-03-30 20:21:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
HelpDisplay::HelpDisplay()
|
|
|
|
|
{
|
2003-11-17 01:39:34 +00:00
|
|
|
m_iCurTipIndex = 0;
|
|
|
|
|
m_fSecsUntilSwitch = 0;
|
|
|
|
|
}
|
2003-03-30 20:21:20 +00:00
|
|
|
|
2003-11-17 01:39:34 +00:00
|
|
|
void HelpDisplay::Load()
|
|
|
|
|
{
|
|
|
|
|
m_textTip.SetName( "Tip" );
|
2003-11-17 02:53:54 +00:00
|
|
|
m_textTip.LoadFromFont( THEME->GetPathToF(m_sName) );
|
2003-11-17 01:39:34 +00:00
|
|
|
ON_COMMAND( m_textTip );
|
2003-03-30 20:21:20 +00:00
|
|
|
this->AddChild( &m_textTip );
|
|
|
|
|
|
|
|
|
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-17 02:36:53 +00:00
|
|
|
void HelpDisplay::SetTips( const CStringArray &arrayTips, const CStringArray &arrayTipsAlt )
|
2003-03-30 20:21:20 +00:00
|
|
|
{
|
2003-11-17 02:36:53 +00:00
|
|
|
ASSERT( arrayTips.size() == arrayTipsAlt.size() );
|
2004-01-21 09:40:23 +00:00
|
|
|
|
|
|
|
|
if( arrayTips == m_arrayTips && arrayTipsAlt == m_arrayTipsAlt )
|
|
|
|
|
return;
|
|
|
|
|
|
2003-11-17 02:36:53 +00:00
|
|
|
m_textTip.SetText( "" );
|
|
|
|
|
|
2003-03-30 20:21:20 +00:00
|
|
|
m_arrayTips = arrayTips;
|
2003-11-17 02:36:53 +00:00
|
|
|
m_arrayTipsAlt = arrayTipsAlt;
|
|
|
|
|
|
|
|
|
|
m_iCurTipIndex = 0;
|
|
|
|
|
m_fSecsUntilSwitch = 0;
|
|
|
|
|
Update( 0 );
|
2003-03-30 20:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void HelpDisplay::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
ActorFrame::Update( fDeltaTime );
|
|
|
|
|
|
2003-11-17 02:36:53 +00:00
|
|
|
if( m_arrayTips.empty() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_fSecsUntilSwitch -= fDeltaTime;
|
|
|
|
|
if( m_fSecsUntilSwitch > 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// time to switch states
|
|
|
|
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
|
|
|
|
m_textTip.SetText( m_arrayTips[m_iCurTipIndex], m_arrayTipsAlt[m_iCurTipIndex] );
|
|
|
|
|
m_iCurTipIndex++;
|
|
|
|
|
m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size();
|
2003-03-30 20:21:20 +00:00
|
|
|
}
|