| 236 | } |
| 237 | |
| 238 | static float QueryAction(const Input& in, UserAction action, bool checkFocus) |
| 239 | { |
| 240 | float sum = 0; |
| 241 | for (int i = 0; i < in.userKeys[action].Size(); i++) |
| 242 | { |
| 243 | if (!ModifierHeld(in, action, i)) |
| 244 | continue; |
| 245 | int key = in.userKeys[action][i]; |
| 246 | const int value = InputBindingValue(key); |
| 247 | switch (InputBindingDevice(key)) |
| 248 | { |
| 249 | case INPUT_DEVICE_KEYBOARD: |
| 250 | sum += InputBindingIsDoubleTap(key) ? QueryDoubleTapKey(in, value, checkFocus) |
| 251 | : QueryKey(in, value, checkFocus); |
| 252 | break; |
| 253 | case INPUT_DEVICE_MOUSE: |
| 254 | sum += InputBindingIsDoubleTap(key) ? QueryDoubleTapMouseButton(in, value, checkFocus) |
| 255 | : QueryMouseButton(in, value, checkFocus); |
| 256 | break; |
| 257 | case INPUT_DEVICE_STICK: |
| 258 | sum += QueryJoystickButton(in, value, checkFocus); |
| 259 | break; |
| 260 | case INPUT_DEVICE_STICK_AXIS: |
| 261 | { |
| 262 | int offset = value; |
| 263 | PoseidonAssert(offset >= 0); |
| 264 | PoseidonAssert(offset < N_JOYSTICK_AXES); |
| 265 | sum += in.gamepad.stickAxis[offset]; |
| 266 | } |
| 267 | break; |
| 268 | case INPUT_DEVICE_STICK_POV: |
| 269 | { |
| 270 | int offset = value; |
| 271 | PoseidonAssert(offset >= 0); |
| 272 | PoseidonAssert(offset < N_JOYSTICK_POV); |
| 273 | sum += in.gamepad.stickPov[offset]; |
| 274 | } |
| 275 | break; |
| 276 | } |
| 277 | } |
| 278 | return sum; |
| 279 | } |
| 280 | |
| 281 | static bool QueryActionToDo(Input& in, UserAction action, bool reset, bool checkFocus) |
| 282 | { |
nothing calls this directly
no test coverage detected