mirror of
https://github.com/libsdl-org/SDL
synced 2024-11-21 16:09:08 -07:00
Support multiple joystick buttons bound to the same gamepad button
Some checks failed
Build (Android) / CMake (push) Has been cancelled
Build (Android) / Android.mk (push) Has been cancelled
Build (C/P Actions) / FreeBSD (push) Has been cancelled
Build (Emscripten) / emscripten (push) Has been cancelled
Build (iOS/tvOS) / iOS (push) Has been cancelled
Build (iOS/tvOS) / tvOS (push) Has been cancelled
Build / Intel Compiler (Ubuntu 20.04) (push) Has been cancelled
Build / Intel oneAPI (Ubuntu 20.04) (push) Has been cancelled
Build / MacOS (autotools) (push) Has been cancelled
Build / Ubuntu 20.04 (autotools) (push) Has been cancelled
Build / Ubuntu 22.04 (autotools) (push) Has been cancelled
Build / MacOS (CMake) (push) Has been cancelled
Build / Windows (clang32) (push) Has been cancelled
Build / Windows (clang64) (push) Has been cancelled
Build / Windows (mingw32) (push) Has been cancelled
Build / Windows (ucrt64) (push) Has been cancelled
Build / Windows (mingw64) (push) Has been cancelled
Build / Ubuntu 20.04 (CMake) (push) Has been cancelled
Build / Ubuntu 22.04 (CMake) (push) Has been cancelled
Build (MSVC) / Windows (ARM) (push) Has been cancelled
Build (MSVC) / Windows (ARM64) (push) Has been cancelled
Build (MSVC) / Windows static VCRT (x86) (push) Has been cancelled
Build (MSVC) / Windows (x86) (push) Has been cancelled
Build (MSVC) / UWP (x64) (push) Has been cancelled
Build (MSVC) / Windows static VCRT (x64) (push) Has been cancelled
Build (MSVC) / Windows (x64) (push) Has been cancelled
Build (MSVC) / Windows (clang-cl x86) (push) Has been cancelled
Build (MSVC) / Windows (clang-cl x64) (push) Has been cancelled
Build (Nintendo 3DS) / n3ds (push) Has been cancelled
Build (Sony Playstation 2) / ps2 (push) Has been cancelled
Build (Sony Playstation Portable) / psp (push) Has been cancelled
Build (RISC OS) / CMake (push) Has been cancelled
Build (RISC OS) / autotools (push) Has been cancelled
Build (Sony Playstation Vita) / GLES (PVR_PSP2 + gl4es4vita) (push) Has been cancelled
Build (Sony Playstation Vita) / GLES (pib) (push) Has been cancelled
Build (OpenWatcom) / OS/2 (push) Has been cancelled
Build (OpenWatcom) / Windows (push) Has been cancelled
Some checks failed
Build (Android) / CMake (push) Has been cancelled
Build (Android) / Android.mk (push) Has been cancelled
Build (C/P Actions) / FreeBSD (push) Has been cancelled
Build (Emscripten) / emscripten (push) Has been cancelled
Build (iOS/tvOS) / iOS (push) Has been cancelled
Build (iOS/tvOS) / tvOS (push) Has been cancelled
Build / Intel Compiler (Ubuntu 20.04) (push) Has been cancelled
Build / Intel oneAPI (Ubuntu 20.04) (push) Has been cancelled
Build / MacOS (autotools) (push) Has been cancelled
Build / Ubuntu 20.04 (autotools) (push) Has been cancelled
Build / Ubuntu 22.04 (autotools) (push) Has been cancelled
Build / MacOS (CMake) (push) Has been cancelled
Build / Windows (clang32) (push) Has been cancelled
Build / Windows (clang64) (push) Has been cancelled
Build / Windows (mingw32) (push) Has been cancelled
Build / Windows (ucrt64) (push) Has been cancelled
Build / Windows (mingw64) (push) Has been cancelled
Build / Ubuntu 20.04 (CMake) (push) Has been cancelled
Build / Ubuntu 22.04 (CMake) (push) Has been cancelled
Build (MSVC) / Windows (ARM) (push) Has been cancelled
Build (MSVC) / Windows (ARM64) (push) Has been cancelled
Build (MSVC) / Windows static VCRT (x86) (push) Has been cancelled
Build (MSVC) / Windows (x86) (push) Has been cancelled
Build (MSVC) / UWP (x64) (push) Has been cancelled
Build (MSVC) / Windows static VCRT (x64) (push) Has been cancelled
Build (MSVC) / Windows (x64) (push) Has been cancelled
Build (MSVC) / Windows (clang-cl x86) (push) Has been cancelled
Build (MSVC) / Windows (clang-cl x64) (push) Has been cancelled
Build (Nintendo 3DS) / n3ds (push) Has been cancelled
Build (Sony Playstation 2) / ps2 (push) Has been cancelled
Build (Sony Playstation Portable) / psp (push) Has been cancelled
Build (RISC OS) / CMake (push) Has been cancelled
Build (RISC OS) / autotools (push) Has been cancelled
Build (Sony Playstation Vita) / GLES (PVR_PSP2 + gl4es4vita) (push) Has been cancelled
Build (Sony Playstation Vita) / GLES (pib) (push) Has been cancelled
Build (OpenWatcom) / OS/2 (push) Has been cancelled
Build (OpenWatcom) / Windows (push) Has been cancelled
(cherry picked from commited943318e2
) (cherry picked from commit74ff82f4a2
)
This commit is contained in:
parent
9eca707549
commit
ad602924a4
1 changed files with 4 additions and 8 deletions
|
@ -2364,23 +2364,19 @@ Uint8 SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameCo
|
|||
if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
|
||||
valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max);
|
||||
if (valid_input_range) {
|
||||
retval = (value >= threshold) ? SDL_PRESSED : SDL_RELEASED;
|
||||
break;
|
||||
retval |= (value >= threshold) ? SDL_PRESSED : SDL_RELEASED;
|
||||
}
|
||||
} else {
|
||||
valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min);
|
||||
if (valid_input_range) {
|
||||
retval = (value <= threshold) ? SDL_PRESSED : SDL_RELEASED;
|
||||
break;
|
||||
retval |= (value <= threshold) ? SDL_PRESSED : SDL_RELEASED;
|
||||
}
|
||||
}
|
||||
} else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
|
||||
retval = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button);
|
||||
break;
|
||||
retval |= SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button);
|
||||
} else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
|
||||
int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat);
|
||||
retval = (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED;
|
||||
break;
|
||||
retval |= (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue