2002-01-16 10:01:32 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-08-20 21:00:56 +00:00
|
|
|
Class: TipDisplay
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-08-20 21:00:56 +00:00
|
|
|
Desc: See header
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-07-23 01:41:40 +00:00
|
|
|
Chris Danford
|
2002-01-16 10:01:32 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "TipDisplay.h"
|
|
|
|
|
#include "RageUtil.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "RageLog.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
|
|
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
const float TIP_SHOW_TIME = 3.5f;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
TipDisplay::TipDisplay()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "TipDisplay::TipDisplay()" );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-08-20 21:00:56 +00:00
|
|
|
m_textTip.LoadFromFont( THEME->GetPathTo("Fonts","help") );
|
2002-07-23 01:41:40 +00:00
|
|
|
m_textTip.SetEffectBlinking();
|
|
|
|
|
m_textTip.TurnShadowOff();
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_textTip );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
m_iCurTipIndex = 0;
|
|
|
|
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
2002-01-16 10:01:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TipDisplay::SetTips( CStringArray &arrayTips )
|
|
|
|
|
{
|
|
|
|
|
m_arrayTips.RemoveAll();
|
|
|
|
|
m_arrayTips.Copy( arrayTips );
|
2002-07-23 01:41:40 +00:00
|
|
|
if( m_arrayTips.GetSize() > 0 )
|
|
|
|
|
m_textTip.SetText( m_arrayTips[0] );
|
2002-01-16 10:01:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TipDisplay::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
ActorFrame::Update( fDeltaTime );
|
|
|
|
|
|
2002-08-27 03:59:22 +00:00
|
|
|
if( m_arrayTips.GetSize() > 0 )
|
2002-01-16 10:01:32 +00:00
|
|
|
{
|
2002-08-27 03:59:22 +00:00
|
|
|
m_fSecsUntilSwitch -= fDeltaTime;
|
|
|
|
|
if( m_fSecsUntilSwitch < 0 ) // time to switch states
|
|
|
|
|
{
|
|
|
|
|
m_iCurTipIndex++;
|
|
|
|
|
m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.GetSize();
|
|
|
|
|
m_fSecsUntilSwitch = TIP_SHOW_TIME;
|
|
|
|
|
m_textTip.SetText( m_arrayTips[m_iCurTipIndex] );
|
|
|
|
|
}
|
2002-01-16 10:01:32 +00:00
|
|
|
}
|
|
|
|
|
}
|