forked from Clones/Controlify
🐘 Bump SDL2 to 2.28.2
This commit is contained in:
@ -18,7 +18,7 @@ quilt_json5 = "1.0.3"
|
||||
sodium = "mc1.20.1-0.5.0"
|
||||
iris = "1.6.5+1.20.1"
|
||||
immediately_fast = "1.1.25+1.20.1"
|
||||
sdl2_jni = "2.26.5-24"
|
||||
sdl2_jni = "2.28.2-26"
|
||||
|
||||
[libraries]
|
||||
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
|
||||
|
@ -39,6 +39,9 @@ public class SDL2GamepadDriver implements BasicGamepadInputDriver, GyroDriver, R
|
||||
}
|
||||
SDL.SDL_GameControllerUpdate();
|
||||
|
||||
// Axis values are in the range [-32768, 32767] (short)
|
||||
// Triggers are in the range [0, 32767] (thanks SDL!)
|
||||
// https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAxis
|
||||
GamepadState.AxesState axes = new GamepadState.AxesState(
|
||||
Mth.inverseLerp(SDL.SDL_GameControllerGetAxis(ptrGamepad, SDL.SDL_CONTROLLER_AXIS_LEFTX), Short.MIN_VALUE, Short.MAX_VALUE) * 2f - 1f,
|
||||
Mth.inverseLerp(SDL.SDL_GameControllerGetAxis(ptrGamepad, SDL.SDL_CONTROLLER_AXIS_LEFTY), Short.MIN_VALUE, Short.MAX_VALUE) * 2f - 1f,
|
||||
@ -47,6 +50,8 @@ public class SDL2GamepadDriver implements BasicGamepadInputDriver, GyroDriver, R
|
||||
Mth.inverseLerp(SDL.SDL_GameControllerGetAxis(ptrGamepad, SDL.SDL_CONTROLLER_AXIS_TRIGGERLEFT), 0, Short.MAX_VALUE),
|
||||
Mth.inverseLerp(SDL.SDL_GameControllerGetAxis(ptrGamepad, SDL.SDL_CONTROLLER_AXIS_TRIGGERRIGHT), 0, Short.MAX_VALUE)
|
||||
);
|
||||
// Button values return 1 if pressed, 0 if not
|
||||
// https://wiki.libsdl.org/SDL2/SDL_GameControllerGetButton
|
||||
GamepadState.ButtonState buttons = new GamepadState.ButtonState(
|
||||
SDL.SDL_GameControllerGetButton(ptrGamepad, SDL.SDL_CONTROLLER_BUTTON_A) == 1,
|
||||
SDL.SDL_GameControllerGetButton(ptrGamepad, SDL.SDL_CONTROLLER_BUTTON_B) == 1,
|
||||
|
Reference in New Issue
Block a user