| 347 | } |
| 348 | |
| 349 | static float QueryProfileCode(const Input& in, InputCode code, bool checkFocus) |
| 350 | { |
| 351 | if (!code.valid()) |
| 352 | return 0.0f; |
| 353 | const int packed = code.toLegacy(); |
| 354 | const int value = InputBindingValue(packed); |
| 355 | switch (InputBindingDevice(packed)) |
| 356 | { |
| 357 | case INPUT_DEVICE_KEYBOARD: |
| 358 | return InputBindingIsDoubleTap(packed) ? QueryDoubleTapKey(in, value, checkFocus) |
| 359 | : QueryKey(in, value, checkFocus); |
| 360 | case INPUT_DEVICE_MOUSE: |
| 361 | return InputBindingIsDoubleTap(packed) ? QueryDoubleTapMouseButton(in, value, checkFocus) |
| 362 | : QueryMouseButton(in, value, checkFocus); |
| 363 | case INPUT_DEVICE_STICK: |
| 364 | return QueryJoystickButton(in, value, checkFocus); |
| 365 | case INPUT_DEVICE_STICK_AXIS: |
| 366 | return value >= 0 && value < N_JOYSTICK_AXES ? in.gamepad.stickAxis[value] : 0.0f; |
| 367 | case INPUT_DEVICE_STICK_POV: |
| 368 | return value >= 0 && value < N_JOYSTICK_POV && in.gamepad.stickPov[value] ? 1.0f : 0.0f; |
| 369 | default: |
| 370 | return 0.0f; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | static bool QueryProfileCodeToDo(Input& in, InputCode code, bool reset, bool checkFocus) |
| 375 | { |
no test coverage detected