@@ -121,6 +121,52 @@ bool KeyBindings::ActionDownUp( InputContext& input, BindContextHandle bindConte
121
121
}
122
122
}
123
123
124
+ bool KeyBindings::ActionUpDownConsume ( InputContext& input, BindContextHandle bindContextHandle, ActionIdentifier action, INPUT_TYPE inputType, bool ignorePause ) const {
125
+ assert ( static_cast <int >( action ) < m_ActionDescriptions.size () );
126
+ const BindContext* context = GetBindContext ( bindContextHandle );
127
+ if ( inputType == INPUT_TYPE_KEYBOARD ) {
128
+ return input.KeyUpDownConsume ( context->GetKeyBindCollection ().GetPrimaryScancodeFromAction ( action )/* , ignorePause*/ ) ||
129
+ input.KeyUpDownConsume ( context->GetKeyBindCollection ().GetSecondaryScancodeFromAction ( action )/* , ignorePause*/ );
130
+ } else if ( inputType == INPUT_TYPE_ANY ) {
131
+ if ( ActionUpDownConsume ( input, bindContextHandle, action, INPUT_TYPE_KEYBOARD, ignorePause ) ) {
132
+ return true ;
133
+ }
134
+ for ( int i = 0 ; i < INPUT_MAX_NR_OF_GAMEPADS; ++i ) {
135
+ if ( ActionUpDownConsume ( input, bindContextHandle, action, static_cast <INPUT_TYPE>( i ), ignorePause ) ) {
136
+ return true ;
137
+ }
138
+ }
139
+ return false ;
140
+ } else {
141
+ assert ( inputType >= 0 && static_cast <int >( inputType ) < INPUT_MAX_NR_OF_GAMEPADS );
142
+ const GamepadContext& gamepad = input.GetGamepadContext ( inputType );
143
+ return gamepad.ButtonUpDown ( context->GetGamepadBindCollection ().GetButtonFromAction ( action ) );
144
+ }
145
+ }
146
+
147
+ bool KeyBindings::ActionDownUpConsume ( InputContext& input, BindContextHandle bindContextHandle, ActionIdentifier action, INPUT_TYPE inputType, bool ignorePause ) const {
148
+ assert ( static_cast <int >( action ) < m_ActionDescriptions.size () );
149
+ const BindContext* context = GetBindContext ( bindContextHandle );
150
+ if ( inputType == INPUT_TYPE_KEYBOARD ) {
151
+ return input.KeyDownUpConsume ( context->GetKeyBindCollection ().GetPrimaryScancodeFromAction ( action )/* , ignorePause*/ ) ||
152
+ input.KeyDownUpConsume ( context->GetKeyBindCollection ().GetSecondaryScancodeFromAction ( action )/* , ignorePause*/ );
153
+ } else if ( inputType == INPUT_TYPE_ANY ) {
154
+ if ( ActionDownUpConsume ( input, bindContextHandle, action, INPUT_TYPE_KEYBOARD, ignorePause ) ) {
155
+ return true ;
156
+ }
157
+ for ( int i = 0 ; i < INPUT_MAX_NR_OF_GAMEPADS; ++i ) {
158
+ if ( ActionDownUpConsume ( input, bindContextHandle, action, static_cast <INPUT_TYPE>( i ), ignorePause ) ) {
159
+ return true ;
160
+ }
161
+ }
162
+ return false ;
163
+ } else {
164
+ assert ( inputType >= 0 && static_cast <int >( inputType ) < INPUT_MAX_NR_OF_GAMEPADS );
165
+ const GamepadContext& gamepad = input.GetGamepadContext ( inputType );
166
+ return gamepad.ButtonDownUp ( context->GetGamepadBindCollection ().GetButtonFromAction ( action ) );
167
+ }
168
+ }
169
+
124
170
bool KeyBindings::ActionUp ( InputContext& input, BindContextHandle bindContextHandle, ActionIdentifier action, INPUT_TYPE inputType, bool ignorePause ) const {
125
171
assert ( static_cast <int >( action ) < m_ActionDescriptions.size () );
126
172
const BindContext* context = GetBindContext ( bindContextHandle );
0 commit comments