cleanup edges on graphics

This commit is contained in:
Chris Danford
2003-03-30 19:30:54 +00:00
parent 214c2b67af
commit eaa888e2c9
8 changed files with 92 additions and 140 deletions
+67 -32
View File
@@ -25,9 +25,8 @@
BPMDisplay::BPMDisplay()
{
m_fCurrentBPM = m_fLowBPM = m_fHighBPM = 0;
m_CountingState = holding_down;
m_fTimeLeftInState = 0;
m_bExtraStage = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2();
m_CountingState = holding_down;
m_textBPM.LoadFromNumbers( THEME->GetPathTo("Numbers","BPMDisplay") );
m_textBPM.EnableShadow( false );
@@ -50,40 +49,64 @@ void BPMDisplay::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
if( m_bExtraStage )
m_fTimeLeftInState -= fDeltaTime;
if( m_fTimeLeftInState < 0 )
{
m_fTimeLeftInState -= fDeltaTime;
if( m_fTimeLeftInState < 0 )
{
// XXX: the numbers font doesn't have "?".
m_textBPM.SetText( (RandomFloat(0,1)>0.90) ? "xxx" : ssprintf("%03.0f",RandomFloat(0,600)) );
m_fTimeLeftInState = 0.2f; // reset timer
}
}
else // !m_bExtraStage
{
m_fTimeLeftInState -= fDeltaTime;
if( m_fTimeLeftInState < 0 )
{
// go to next state
switch( m_CountingState )
{
case counting_up: m_CountingState = holding_up; break;
case holding_up: m_CountingState = counting_down; break;
case counting_down: m_CountingState = holding_down; break;
case holding_down: m_CountingState = counting_up; break;
}
m_fTimeLeftInState = 1; // reset timer
}
// go to next state
switch( m_CountingState )
{
case counting_down: m_fCurrentBPM = m_fLowBPM + (m_fHighBPM-m_fLowBPM)*m_fTimeLeftInState; break;
case counting_up: m_fCurrentBPM = m_fHighBPM + (m_fLowBPM-m_fHighBPM)*m_fTimeLeftInState; break;
case holding_up: m_fCurrentBPM = m_fHighBPM; break;
case holding_down: m_fCurrentBPM = m_fLowBPM; break;
case counting_up:
m_CountingState = holding_up;
m_fTimeLeftInState = 1; // reset timer
break;
case holding_up:
m_CountingState = counting_down;
m_fTimeLeftInState = 1; // reset timer
break;
case counting_down:
m_CountingState = holding_down;
m_fTimeLeftInState = 1; // reset timer
break;
case holding_down:
m_CountingState = counting_up;
m_fTimeLeftInState = 1; // reset timer
break;
case cycle_randomly:
m_textBPM.SetText( (RandomFloat(0,1)>0.90) ? "xxx" : ssprintf("%03.0f",RandomFloat(0,600)) );
m_fTimeLeftInState = 0.2f; // reset timer
break;
case no_bpm:
m_fTimeLeftInState = 0;
break;
default:
ASSERT(0);
}
m_textBPM.SetText( ssprintf("%03.0f", m_fCurrentBPM) );
}
// update m_fCurrentBPM
int iLastCurBPM = (int)m_fCurrentBPM;
switch( m_CountingState )
{
case counting_down: m_fCurrentBPM = m_fLowBPM + (m_fHighBPM-m_fLowBPM)*m_fTimeLeftInState; break;
case counting_up: m_fCurrentBPM = m_fHighBPM + (m_fLowBPM-m_fHighBPM)*m_fTimeLeftInState; break;
case holding_up: m_fCurrentBPM = m_fHighBPM; break;
case holding_down: m_fCurrentBPM = m_fLowBPM; break;
case cycle_randomly: break;
case no_bpm: break;
default:
ASSERT(0);
}
// update text
switch( m_CountingState )
{
case counting_down:
case counting_up:
case holding_up:
case holding_down:
if( (int)m_fCurrentBPM != iLastCurBPM )
m_textBPM.SetText( ssprintf("%03.0f", m_fCurrentBPM) );
break;
}
}
@@ -120,3 +143,15 @@ void BPMDisplay::SetBPMRange( float fLowBPM, float fHighBPM )
}
}
void BPMDisplay::CycleRandomly()
{
m_CountingState = cycle_randomly;
m_fTimeLeftInState = 0;
}
void BPMDisplay::NoBPM()
{
m_CountingState = no_bpm;
m_textBPM.SetText( "..." );
}
+10 -4
View File
@@ -24,6 +24,8 @@ public:
BPMDisplay();
virtual void Update( float fDeltaTime );
void SetBPMRange( float fLowBPM, float fHighBPM );
void CycleRandomly();
void NoBPM();
protected:
BitmapText m_textBPM;
@@ -31,11 +33,15 @@ protected:
float m_fCurrentBPM;
float m_fLowBPM, m_fHighBPM;
enum CountingState{ counting_up, holding_up, counting_down, holding_down };
CountingState m_CountingState;
enum CountingState {
counting_up,
holding_up,
counting_down,
holding_down,
cycle_randomly,
no_bpm // show dashes
} m_CountingState;
float m_fTimeLeftInState;
bool m_bExtraStage; // cycle BPM through random values if extra stage
};
#endif
+1 -1
View File
@@ -186,7 +186,7 @@ ScreenNameEntry::ScreenNameEntry()
//this->AddChild( &m_textScrollingChars[p][t] ); // draw these manually
}
m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","header2") );
m_textCategory[p].LoadFromFont( THEME->GetPathTo("Fonts","ScreenNameEntry category") );
m_textCategory[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
m_textCategory[p].SetY( CATEGORY_Y );
CString sCategoryText = ssprintf("No. %d in\n", GAMESTATE->m_iRankingIndex[p]+1);
+13 -6
View File
@@ -770,7 +770,7 @@ void ScreenSelectMusic::AfterMusicChange()
if(!no_banner_change)
m_Banner.LoadFromGroup( sGroup ); // if this isn't a group, it'll default to the fallback banner
m_BPMDisplay.SetBPMRange( 0, 0 );
m_BPMDisplay.NoBPM();
m_sprCDTitle.UnloadTexture();
}
break;
@@ -791,9 +791,16 @@ void ScreenSelectMusic::AfterMusicChange()
if(!no_banner_change)
m_Banner.LoadFromSong( pSong );
float fMinBPM, fMaxBPM;
pSong->GetMinMaxBPM( fMinBPM, fMaxBPM );
m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM );
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
m_BPMDisplay.CycleRandomly();
}
else
{
float fMinBPM, fMaxBPM;
pSong->GetMinMaxBPM( fMinBPM, fMaxBPM );
m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM );
}
if( pSong->HasCDTitle() )
m_sprCDTitle.Load( pSong->GetCDTitlePath() );
@@ -837,7 +844,7 @@ void ScreenSelectMusic::AfterMusicChange()
case TYPE_ROULETTE:
if(!no_banner_change)
m_Banner.LoadRoulette();
m_BPMDisplay.SetBPMRange( 0, 0 );
m_BPMDisplay.NoBPM();
m_sprCDTitle.UnloadTexture();
SOUNDMAN->StopMusic();
@@ -850,7 +857,7 @@ void ScreenSelectMusic::AfterMusicChange()
case TYPE_RANDOM:
if(!no_banner_change)
m_Banner.LoadRandom();
m_BPMDisplay.SetBPMRange( 0, 0 );
m_BPMDisplay.NoBPM();
m_sprCDTitle.UnloadTexture();
SOUNDMAN->StopMusic();
-60
View File
@@ -1,60 +0,0 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: TipDisplay
Desc: See header
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "TipDisplay.h"
#include "RageUtil.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "ThemeManager.h"
const float TIP_SHOW_TIME = 3.5f;
TipDisplay::TipDisplay()
{
LOG->Trace( "TipDisplay::TipDisplay()" );
m_textTip.LoadFromFont( THEME->GetPathTo("Fonts","help") );
m_textTip.SetEffectDiffuseBlink();
m_textTip.EnableShadow( false );
this->AddChild( &m_textTip );
m_iCurTipIndex = 0;
m_fSecsUntilSwitch = TIP_SHOW_TIME;
}
void TipDisplay::SetTips( CStringArray &arrayTips )
{
m_arrayTips = arrayTips;
if( !m_arrayTips.empty() )
m_textTip.SetText( m_arrayTips[0] );
}
void TipDisplay::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] );
}
}
}
-37
View File
@@ -1,37 +0,0 @@
#ifndef TIPDISPLAY_H
#define TIPDISPLAY_H
/*
-----------------------------------------------------------------------------
Class: TipDisplay
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 TipDisplay : public ActorFrame
{
public:
TipDisplay();
void SetTips( CStringArray &arrayTips );
virtual void Update( float fDeltaTime );
protected:
BitmapText m_textTip;
CStringArray m_arrayTips;
int m_iCurTipIndex;
float m_fSecsUntilSwitch;
};
#endif