From 62833f56cbff1c5048d9b9378720a476d1e903d2 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 26 Jan 2006 06:17:57 +0000 Subject: [PATCH] show input device list on mapping screen --- stepmania/src/RageInput.cpp | 19 ++++++++++++++++++- stepmania/src/RageInput.h | 3 ++- stepmania/src/ScreenMapControllers.cpp | 14 ++++++++++++++ stepmania/src/ScreenMapControllers.h | 4 ++-- stepmania/src/ScreenTestInput.cpp | 17 +---------------- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index fac9af9268..2d397a657e 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -62,7 +62,7 @@ bool RageInput::DevicesChanged() return false; } -void RageInput::GetDevicesAndDescriptions( vector& vDevicesOut, vector& vDescriptionsOut ) +void RageInput::GetDevicesAndDescriptions( vector& vDevicesOut, vector& vDescriptionsOut ) const { for( unsigned i = 0; i < m_pDevices.size(); ++i ) m_pDevices[i]->GetDevicesAndDescriptions( vDevicesOut, vDescriptionsOut ); @@ -112,6 +112,23 @@ InputDeviceState RageInput::GetInputDeviceState( InputDevice id ) return InputDeviceState_INVALID; } +RString RageInput::GetDisplayDevicesString() const +{ + vector vDevices; + vector vDescriptions; + vector vs; + GetDevicesAndDescriptions( vDevices, vDescriptions ); + ASSERT( vDevices.size() == vDescriptions.size() ); + for( unsigned i=0; i& vDevicesOut, vector& vsDescriptionsOut ); + void GetDevicesAndDescriptions( vector& vDevicesOut, vector& vsDescriptionsOut ) const; void WindowReset(); void AddHandler( InputHandler *pHandler ); RString GetDeviceSpecificInputString( const DeviceInput &di ); InputDeviceState GetInputDeviceState( InputDevice id ); + RString GetDisplayDevicesString() const; // Lua void PushSelf( lua_State *L ); diff --git a/stepmania/src/ScreenMapControllers.cpp b/stepmania/src/ScreenMapControllers.cpp index 4c8424463f..72a63c4c62 100644 --- a/stepmania/src/ScreenMapControllers.cpp +++ b/stepmania/src/ScreenMapControllers.cpp @@ -38,6 +38,14 @@ void ScreenMapControllers::Init() m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true ); m_soundDelete.Load( THEME->GetPathS(m_sName,"delete"), true ); + + m_textDevices.LoadFromFont( THEME->GetPathF("Common","normal") ); + m_textDevices.SetXY( SCREEN_CENTER_X, SCREEN_TOP+30 ); + m_textDevices.SetDiffuse( RageColor(1,1,1,1) ); + m_textDevices.SetZoom( 0.6f ); + this->AddChild( &m_textDevices ); + + RString sButtons = BUTTONS_TO_MAP; if( sButtons.empty() ) { @@ -167,6 +175,12 @@ void ScreenMapControllers::Update( float fDeltaTime ) ScreenWithMenuElements::Update( fDeltaTime ); + // + // Update devices text + // + m_textDevices.SetText( INPUTMAN->GetDisplayDevicesString() ); + + if( !m_WaitingForPress.IsZero() && m_DeviceIToMap.IsValid() ) // we're going to map an input { if( m_WaitingForPress.PeekDeltaTime() < g_fSecondsToWaitForInput ) diff --git a/stepmania/src/ScreenMapControllers.h b/stepmania/src/ScreenMapControllers.h index 8a8108f1b3..cb9f854eec 100644 --- a/stepmania/src/ScreenMapControllers.h +++ b/stepmania/src/ScreenMapControllers.h @@ -9,8 +9,6 @@ #include "ActorScroller.h" #include "RageSound.h" -enum { NUM_SHOWN_GAME_TO_DEVICE_SLOTS = 3 }; - class ScreenMapControllers : public ScreenWithMenuElements { public: @@ -48,6 +46,8 @@ private: }; vector m_KeysToMap; + BitmapText m_textDevices; + BitmapText m_textLabel[MAX_GAME_CONTROLLERS]; AutoActor m_sprExit; diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp index fa77e57e7a..89edd800e1 100644 --- a/stepmania/src/ScreenTestInput.cpp +++ b/stepmania/src/ScreenTestInput.cpp @@ -49,22 +49,7 @@ void ScreenTestInput::Update( float fDeltaTime ) // // Update devices text // - { - vector vDevices; - vector vDescriptions; - vector vs; - INPUTMAN->GetDevicesAndDescriptions( vDevices, vDescriptions ); - ASSERT( vDevices.size() == vDescriptions.size() ); - for( unsigned i=0; iGetDisplayDevicesString() ); // // Update input texts