self-updating SongMeterDisplay class
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "MeterDisplay.h"
|
#include "MeterDisplay.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "song.h"
|
||||||
|
|
||||||
|
|
||||||
MeterDisplay::MeterDisplay()
|
MeterDisplay::MeterDisplay()
|
||||||
@@ -31,6 +33,18 @@ void MeterDisplay::SetPercent( float fPercent )
|
|||||||
m_sprTip->SetX( SCALE(fPercent, 0.f, 1.f, -m_fStreamWidth/2, m_fStreamWidth/2) );
|
m_sprTip->SetX( SCALE(fPercent, 0.f, 1.f, -m_fStreamWidth/2, m_fStreamWidth/2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SongMeterDisplay::Update( float fDeltaTime )
|
||||||
|
{
|
||||||
|
float fSongStartSeconds = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fFirstBeat );
|
||||||
|
float fSongEndSeconds = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fLastBeat );
|
||||||
|
float fPercentPositionSong = SCALE( GAMESTATE->m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f );
|
||||||
|
CLAMP( fPercentPositionSong, 0, 1 );
|
||||||
|
|
||||||
|
SetPercent( fPercentPositionSong );
|
||||||
|
|
||||||
|
MeterDisplay::Update( fDeltaTime );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Chris Danford
|
* (c) 2003-2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ private:
|
|||||||
AutoActor m_sprTip;
|
AutoActor m_sprTip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SongMeterDisplay: public MeterDisplay
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Update( float fDeltaTime );
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1551,14 +1551,6 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
// update lights
|
// update lights
|
||||||
//
|
//
|
||||||
UpdateLights();
|
UpdateLights();
|
||||||
//
|
|
||||||
// update song position meter
|
|
||||||
//
|
|
||||||
float fSongStartSeconds = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fFirstBeat );
|
|
||||||
float fSongEndSeconds = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fLastBeat );
|
|
||||||
float fPercentPositionSong = SCALE( GAMESTATE->m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f );
|
|
||||||
CLAMP( fPercentPositionSong, 0, 1 );
|
|
||||||
m_meterSongPosition.SetPercent( fPercentPositionSong );
|
|
||||||
|
|
||||||
if( NSMAN->useSMserver )
|
if( NSMAN->useSMserver )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ protected:
|
|||||||
|
|
||||||
BitmapText m_textSurviveTime; // used in extra stage
|
BitmapText m_textSurviveTime; // used in extra stage
|
||||||
BitmapText m_textSongTitle;
|
BitmapText m_textSongTitle;
|
||||||
MeterDisplay m_meterSongPosition;
|
SongMeterDisplay m_meterSongPosition;
|
||||||
|
|
||||||
Player m_Player[NUM_PLAYERS];
|
Player m_Player[NUM_PLAYERS];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user