Simplify by inheriting from SWME.

This commit is contained in:
Steve Checkoway
2006-10-20 07:08:36 +00:00
parent 412413fa5c
commit 18ad948dac
2 changed files with 11 additions and 52 deletions
+9 -41
View File
@@ -27,8 +27,6 @@
// //
// Defines specific to ScreenNameEntry // Defines specific to ScreenNameEntry
// //
#define TIMER_X THEME->GetMetricF(m_sName,"TimerX")
#define TIMER_Y THEME->GetMetricF(m_sName,"TimerY")
#define CATEGORY_Y THEME->GetMetricF(m_sName,"CategoryY") #define CATEGORY_Y THEME->GetMetricF(m_sName,"CategoryY")
#define CATEGORY_ZOOM THEME->GetMetricF(m_sName,"CategoryZoom") #define CATEGORY_ZOOM THEME->GetMetricF(m_sName,"CategoryZoom")
#define CHARS_ZOOM_SMALL THEME->GetMetricF(m_sName,"CharsZoomSmall") #define CHARS_ZOOM_SMALL THEME->GetMetricF(m_sName,"CharsZoomSmall")
@@ -120,7 +118,7 @@ float ScreenNameEntry::ScrollingText::GetClosestCharYOffset( float fFakeBeat ) c
REGISTER_SCREEN_CLASS( ScreenNameEntry ); REGISTER_SCREEN_CLASS( ScreenNameEntry );
ScreenNameEntry::ScreenNameEntry() ScreenNameEntry::ScreenNameEntry()
{ {
#if 0 #if 1
// DEBUGGING STUFF // DEBUGGING STUFF
GAMESTATE->m_pCurGame.Set( GAMEMAN->GetDefaultGame() ); GAMESTATE->m_pCurGame.Set( GAMEMAN->GetDefaultGame() );
GAMESTATE->m_pCurStyle.Set( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) ); GAMESTATE->m_pCurStyle.Set( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) );
@@ -132,7 +130,7 @@ ScreenNameEntry::ScreenNameEntry()
void ScreenNameEntry::Init() void ScreenNameEntry::Init()
{ {
Screen::Init(); ScreenWithMenuElements::Init();
// update cache // update cache
g_fCharsZoomSmall = CHARS_ZOOM_SMALL; g_fCharsZoomSmall = CHARS_ZOOM_SMALL;
@@ -158,7 +156,7 @@ void ScreenNameEntry::Init()
GAMESTATE->GetRankingFeats( p, aFeats[p] ); GAMESTATE->GetRankingFeats( p, aFeats[p] );
GAMESTATE->JoinPlayer( p ); GAMESTATE->JoinPlayer( p );
m_bStillEnteringName[p] = aFeats[p].size()>0; m_bStillEnteringName[p] = aFeats[p].size()>0;
#if 0 // Debugging. #if 1 // Debugging.
m_bStillEnteringName[p] = p == PLAYER_1; m_bStillEnteringName[p] = p == PLAYER_1;
#endif #endif
} }
@@ -268,42 +266,12 @@ void ScreenNameEntry::Init()
} }
m_Timer.Load();
if( !PREFSMAN->m_bMenuTimer )
m_Timer.Disable();
else
m_Timer.SetSeconds(TIMER_SECONDS);
m_Timer.SetXY( TIMER_X, TIMER_Y );
this->AddChild( &m_Timer );
m_In.Load( THEME->GetPathB(m_sName,"in") );
m_In.StartTransitioning();
m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
this->AddChild( &m_In );
m_Out.Load( THEME->GetPathB(m_sName,"out") );
m_Out.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
this->AddChild( &m_Out );
this->SortByDrawOrder(); this->SortByDrawOrder();
m_soundStep.Load( THEME->GetPathS(m_sName,"step") ); m_soundStep.Load( THEME->GetPathS(m_sName,"step") );
m_sPathToMusic = THEME->GetPathS( m_sName, "music" );
m_fFakeBeat = 0; m_fFakeBeat = 0;
} }
void ScreenNameEntry::BeginScreen()
{
Screen::BeginScreen();
SOUND->PlayMusic( m_sPathToMusic );
}
void ScreenNameEntry::EndScreen()
{
SOUND->StopMusic();
Screen::EndScreen();
}
bool ScreenNameEntry::AnyStillEntering() const bool ScreenNameEntry::AnyStillEntering() const
{ {
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
@@ -325,14 +293,14 @@ void ScreenNameEntry::Update( float fDelta )
m_fFakeBeat += fDelta * FAKE_BEATS_PER_SEC; m_fFakeBeat += fDelta * FAKE_BEATS_PER_SEC;
GAMESTATE->m_fSongBeat = m_fFakeBeat; GAMESTATE->m_fSongBeat = m_fFakeBeat;
Screen::Update(fDelta); ScreenWithMenuElements::Update(fDelta);
} }
void ScreenNameEntry::Input( const InputEventPlus &input ) void ScreenNameEntry::Input( const InputEventPlus &input )
{ {
LOG->Trace( "ScreenNameEntry::Input()" ); LOG->Trace( "ScreenNameEntry::Input()" );
if( m_In.IsTransitioning() || m_Out.IsTransitioning() ) if( IsTransitioning() )
return; return;
if( input.type != IET_FIRST_PRESS || !input.GameI.IsValid() ) if( input.type != IET_FIRST_PRESS || !input.GameI.IsValid() )
@@ -352,14 +320,14 @@ void ScreenNameEntry::Input( const InputEventPlus &input )
} }
} }
Screen::Input( input ); ScreenWithMenuElements::Input( input );
} }
void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM ) void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_MenuTimer ) if( SM == SM_MenuTimer )
{ {
if( !m_Out.IsTransitioning() ) if( !IsTransitioning() )
{ {
InputEventPlus iep; InputEventPlus iep;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
@@ -370,7 +338,7 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
} }
} }
Screen::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
@@ -395,7 +363,7 @@ void ScreenNameEntry::MenuStart( const InputEventPlus &input )
GAMESTATE->StoreRankingName( pn, m_sSelectedName[pn] ); GAMESTATE->StoreRankingName( pn, m_sSelectedName[pn] );
if( !AnyStillEntering() && !m_Out.IsTransitioning() ) if( !AnyStillEntering() && !m_Out.IsTransitioning() )
m_Out.StartTransitioning( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
} }
/* /*
+2 -11
View File
@@ -3,13 +3,13 @@
#ifndef SCREEN_NAME_ENTRY_H #ifndef SCREEN_NAME_ENTRY_H
#define SCREEN_NAME_ENTRY_H #define SCREEN_NAME_ENTRY_H
#include "Screen.h" #include "ScreenWithMenuElements.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "Transition.h" #include "Transition.h"
#include "ReceptorArrowRow.h" #include "ReceptorArrowRow.h"
#include "MenuTimer.h" #include "MenuTimer.h"
class ScreenNameEntry : public Screen class ScreenNameEntry : public ScreenWithMenuElements
{ {
public: public:
ScreenNameEntry(); ScreenNameEntry();
@@ -17,13 +17,10 @@ public:
virtual ~ScreenNameEntry(); virtual ~ScreenNameEntry();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
//virtual void DrawPrimitives();
virtual void Input( const InputEventPlus &input ); virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input ); virtual void MenuStart( const InputEventPlus &input );
virtual void BeginScreen();
virtual void EndScreen();
enum { ABS_MAX_RANKING_NAME_LENGTH = 10 }; enum { ABS_MAX_RANKING_NAME_LENGTH = 10 };
private: private:
@@ -52,11 +49,6 @@ private:
ReceptorArrowRow m_ReceptorArrowRow[NUM_PLAYERS]; ReceptorArrowRow m_ReceptorArrowRow[NUM_PLAYERS];
BitmapText m_textSelectedChars[NUM_PLAYERS][ABS_MAX_RANKING_NAME_LENGTH]; BitmapText m_textSelectedChars[NUM_PLAYERS][ABS_MAX_RANKING_NAME_LENGTH];
BitmapText m_textCategory[NUM_PLAYERS]; BitmapText m_textCategory[NUM_PLAYERS];
MenuTimer m_Timer;
Transition m_In;
Transition m_Out;
RageSound m_soundStep; RageSound m_soundStep;
float m_fFakeBeat; float m_fFakeBeat;
@@ -65,7 +57,6 @@ private:
ScrollingText m_Text[NUM_PLAYERS]; ScrollingText m_Text[NUM_PLAYERS];
vector<int> m_ColToStringIndex[NUM_PLAYERS]; vector<int> m_ColToStringIndex[NUM_PLAYERS];
RString m_sPathToMusic;
}; };
#endif #endif