simplify InputFilter::GetPressedButtons
This commit is contained in:
Glenn Maynard
2006-09-08 04:26:23 +00:00
parent ed0746a166
commit 3deda620b9
2 changed files with 5 additions and 13 deletions
+3 -11
View File
@@ -315,7 +315,7 @@ const T *FindItemBinarySearch( IT begin, IT end, const T &i )
return &*it;
}
bool InputFilter::IsBeingPressed( const DeviceInput &di, const DeviceInputList *pButtonState )
bool InputFilter::IsBeingPressed( const DeviceInput &di, const DeviceInputList *pButtonState ) const
{
LockMut(*queuemutex);
if( pButtonState == NULL )
@@ -324,7 +324,7 @@ bool InputFilter::IsBeingPressed( const DeviceInput &di, const DeviceInputList *
return pDI != NULL;
}
float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState )
float InputFilter::GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState ) const
{
LockMut(*queuemutex);
if( pButtonState == NULL )
@@ -367,15 +367,7 @@ void InputFilter::FlushInputEvents()
void InputFilter::GetPressedButtons( vector<DeviceInput> &array )
{
LockMut(*queuemutex);
FOREACHM( DeviceInput, ButtonState, g_ButtonStates, b )
{
if( b->second.m_BeingHeld )
{
DeviceInput di = b->first;
di.level = b->second.m_Level;
array.push_back( di );
}
}
array = g_CurrentState;
}
/*
+2 -2
View File
@@ -56,8 +56,8 @@ public:
void ResetKeyRepeat( const DeviceInput &di );
// If aButtonState is NULL, use the last reported state.
bool IsBeingPressed( const DeviceInput &di, const DeviceInputList *pButtonState = NULL );
float GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState = NULL );
bool IsBeingPressed( const DeviceInput &di, const DeviceInputList *pButtonState = NULL ) const;
float GetSecsHeld( const DeviceInput &di, const DeviceInputList *pButtonState = NULL ) const;
RString GetButtonComment( const DeviceInput &di ) const;
void GetInputEvents( vector<InputEvent> &aEventOut );