Merge pull request #19 from alanoliveira/fix_gamepad_fn

Use the right enum in the IsGamepadButtonXXX functions. Fixes #18
This commit is contained in:
Nikolas 2022-03-25 16:34:22 +01:00 committed by GitHub
commit a5b3846731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -52,6 +52,9 @@ def fix_enums(arg_name, arg_type, func_name):
if arg_name == "key":
arg_type = "KeyboardKey"
elif arg_name == "button":
if "Gamepad" in func_name:
arg_type = "GamepadButton"
else:
arg_type = "MouseButton"
elif arg_name == "mode" and func_name == "SetCameraMode":
arg_type = "CameraMode"

View File

@ -9,6 +9,7 @@ const Camera3D = rl.Camera3D;
const CameraMode = rl.CameraMode;
const Color = rl.Color;
const Font = rl.Font;
const GamepadButton = rl.GamepadButton;
const Gestures = rl.Gestures;
const GlyphInfo = rl.GlyphInfo;
const Image = rl.Image;
@ -192,10 +193,10 @@ pub extern fn GetKeyPressed() c_int;
pub extern fn GetCharPressed() c_int;
pub extern fn IsGamepadAvailable(gamepad: c_int) bool;
pub extern fn GetGamepadName(gamepad: c_int) [*c]const u8;
pub extern fn IsGamepadButtonPressed(gamepad: c_int, button: MouseButton) bool;
pub extern fn IsGamepadButtonDown(gamepad: c_int, button: MouseButton) bool;
pub extern fn IsGamepadButtonReleased(gamepad: c_int, button: MouseButton) bool;
pub extern fn IsGamepadButtonUp(gamepad: c_int, button: MouseButton) bool;
pub extern fn IsGamepadButtonPressed(gamepad: c_int, button: GamepadButton) bool;
pub extern fn IsGamepadButtonDown(gamepad: c_int, button: GamepadButton) bool;
pub extern fn IsGamepadButtonReleased(gamepad: c_int, button: GamepadButton) bool;
pub extern fn IsGamepadButtonUp(gamepad: c_int, button: GamepadButton) bool;
pub extern fn GetGamepadButtonPressed() c_int;
pub extern fn GetGamepadAxisCount(gamepad: c_int) c_int;
pub extern fn GetGamepadAxisMovement(gamepad: c_int, axis: c_int) f32;