From ed1c6ff32f38337a2cdf054f71d38052bb3ec161 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 8 May 2005 09:19:35 +0000 Subject: [PATCH] add input button comments --- stepmania/src/InputFilter.cpp | 13 +++++++++++++ stepmania/src/InputFilter.h | 3 +++ stepmania/src/ScreenTestInput.cpp | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index c9e6860ded..91bf045b47 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -66,6 +66,13 @@ void InputFilter::ButtonPressed( DeviceInput di, bool Down ) queue.push_back( InputEvent(di,Down? IET_FIRST_PRESS:IET_RELEASE) ); } +void InputFilter::SetButtonComment( DeviceInput di, const CString &sComment ) +{ + LockMut(*queuemutex); + ButtonState &bs = m_ButtonState[di.device][di.button]; + bs.m_sComment = sComment; +} + /* Release all buttons on the given device. */ void InputFilter::ResetDevice( InputDevice device ) { @@ -156,6 +163,12 @@ float InputFilter::GetSecsHeld( DeviceInput di ) return m_ButtonState[di.device][di.button].m_fSecsHeld; } +CString InputFilter::GetButtonComment( DeviceInput di ) const +{ + LockMut(*queuemutex); + return m_ButtonState[di.device][di.button].m_sComment; +} + void InputFilter::ResetKeyRepeat( DeviceInput di ) { m_ButtonState[di.device][di.button].m_fSecsHeld = 0; diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h index c81f25a0f7..5692362e9d 100644 --- a/stepmania/src/InputFilter.h +++ b/stepmania/src/InputFilter.h @@ -43,6 +43,7 @@ class InputFilter struct ButtonState { bool m_BeingHeld; + CString m_sComment; float m_fSecsHeld; float m_Level, m_LastLevel; }; @@ -53,6 +54,7 @@ class InputFilter public: void ButtonPressed( DeviceInput di, bool Down ); + void SetButtonComment( DeviceInput di, const CString &sComment = "" ); void ResetDevice( InputDevice dev ); InputFilter(); @@ -66,6 +68,7 @@ public: bool IsBeingPressed( DeviceInput di ); float GetSecsHeld( DeviceInput di ); + CString GetButtonComment( DeviceInput di ) const; void GetInputEvents( InputEventArray &array ); }; diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp index 5f0f328e8a..31dd6b4d23 100644 --- a/stepmania/src/ScreenTestInput.cpp +++ b/stepmania/src/ScreenTestInput.cpp @@ -79,6 +79,10 @@ void ScreenTestInput::Update( float fDeltaTime ) sTemp += " - not mapped"; } + CString sComment = INPUTFILTER->GetButtonComment( di ); + if( sComment != "" ) + sTemp += " - " + sComment; + asInputs.push_back( sTemp ); } }