2003-05-13 13:35:32 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: MeterDisplay.h
|
|
|
|
|
|
|
|
|
|
Desc: The song's MeterDisplay displayed in SelectSong.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "MeterDisplay.h"
|
|
|
|
|
|
|
|
|
|
|
2003-06-30 18:08:27 +00:00
|
|
|
MeterDisplay::MeterDisplay()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-18 20:43:36 +00:00
|
|
|
void MeterDisplay::Load( CString sStreamPath, float fStreamWidth, CString sTipPath )
|
2003-05-13 13:35:32 +00:00
|
|
|
{
|
|
|
|
|
m_fStreamWidth = fStreamWidth;
|
|
|
|
|
|
2004-01-12 01:43:38 +00:00
|
|
|
m_sprStream.Load( sStreamPath );
|
2003-05-13 13:35:32 +00:00
|
|
|
m_sprStream.SetZoomX( fStreamWidth / m_sprStream.GetUnzoomedWidth() );
|
|
|
|
|
|
2004-01-18 20:43:36 +00:00
|
|
|
m_sprTip.Load( sTipPath );
|
|
|
|
|
|
2004-01-20 03:32:48 +00:00
|
|
|
this->AddChild( &m_sprStream );
|
|
|
|
|
this->AddChild( m_sprTip );
|
|
|
|
|
|
2003-05-13 13:35:32 +00:00
|
|
|
SetPercent( 0.5f );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MeterDisplay::SetPercent( float fPercent )
|
|
|
|
|
{
|
|
|
|
|
ASSERT( fPercent >= 0 && fPercent <= 1 );
|
|
|
|
|
|
2003-06-30 18:08:27 +00:00
|
|
|
m_sprStream.SetCropRight( 1-fPercent );
|
2004-01-18 20:43:36 +00:00
|
|
|
|
2004-01-20 03:32:48 +00:00
|
|
|
m_sprTip->SetX( SCALE(fPercent, 0.f, 1.f, -m_fStreamWidth/2, m_fStreamWidth/2) );
|
2003-05-13 13:35:32 +00:00
|
|
|
}
|