add input button comments

This commit is contained in:
Glenn Maynard
2005-05-08 09:19:35 +00:00
parent b322255acf
commit ed1c6ff32f
3 changed files with 20 additions and 0 deletions
+13
View File
@@ -66,6 +66,13 @@ void InputFilter::ButtonPressed( DeviceInput di, bool Down )
queue.push_back( InputEvent(di,Down? IET_FIRST_PRESS:IET_RELEASE) ); 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. */ /* Release all buttons on the given device. */
void InputFilter::ResetDevice( InputDevice device ) void InputFilter::ResetDevice( InputDevice device )
{ {
@@ -156,6 +163,12 @@ float InputFilter::GetSecsHeld( DeviceInput di )
return m_ButtonState[di.device][di.button].m_fSecsHeld; 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 ) void InputFilter::ResetKeyRepeat( DeviceInput di )
{ {
m_ButtonState[di.device][di.button].m_fSecsHeld = 0; m_ButtonState[di.device][di.button].m_fSecsHeld = 0;
+3
View File
@@ -43,6 +43,7 @@ class InputFilter
struct ButtonState struct ButtonState
{ {
bool m_BeingHeld; bool m_BeingHeld;
CString m_sComment;
float m_fSecsHeld; float m_fSecsHeld;
float m_Level, m_LastLevel; float m_Level, m_LastLevel;
}; };
@@ -53,6 +54,7 @@ class InputFilter
public: public:
void ButtonPressed( DeviceInput di, bool Down ); void ButtonPressed( DeviceInput di, bool Down );
void SetButtonComment( DeviceInput di, const CString &sComment = "" );
void ResetDevice( InputDevice dev ); void ResetDevice( InputDevice dev );
InputFilter(); InputFilter();
@@ -66,6 +68,7 @@ public:
bool IsBeingPressed( DeviceInput di ); bool IsBeingPressed( DeviceInput di );
float GetSecsHeld( DeviceInput di ); float GetSecsHeld( DeviceInput di );
CString GetButtonComment( DeviceInput di ) const;
void GetInputEvents( InputEventArray &array ); void GetInputEvents( InputEventArray &array );
}; };
+4
View File
@@ -79,6 +79,10 @@ void ScreenTestInput::Update( float fDeltaTime )
sTemp += " - not mapped"; sTemp += " - not mapped";
} }
CString sComment = INPUTFILTER->GetButtonComment( di );
if( sComment != "" )
sTemp += " - " + sComment;
asInputs.push_back( sTemp ); asInputs.push_back( sTemp );
} }
} }