@@ -957,6 +957,13 @@ pub fn rlDisableStatePointer(
957
957
);
958
958
}
959
959
960
+ /// Get the last gamepad button pressed
961
+ pub fn GetGamepadButtonPressed () ? GamepadButton {
962
+ if (raylib .GetGamepadButtonPressed () == -1 ) return null ;
963
+
964
+ return @intToEnum (GamepadButton , raylib .GetGamepadButtonPressed ());
965
+ }
966
+
960
967
/// Initialize window and OpenGL context
961
968
pub fn InitWindow (
962
969
width : i32 ,
@@ -2190,52 +2197,47 @@ pub fn GetGamepadName(
2190
2197
/// Check if a gamepad button has been pressed once
2191
2198
pub fn IsGamepadButtonPressed (
2192
2199
gamepad : i32 ,
2193
- button : i32 ,
2200
+ button : GamepadButton ,
2194
2201
) bool {
2195
2202
return raylib .mIsGamepadButtonPressed (
2196
2203
gamepad ,
2197
- button ,
2204
+ @enumToInt ( button ) ,
2198
2205
);
2199
2206
}
2200
2207
2201
2208
/// Check if a gamepad button is being pressed
2202
2209
pub fn IsGamepadButtonDown (
2203
2210
gamepad : i32 ,
2204
- button : i32 ,
2211
+ button : GamepadButton ,
2205
2212
) bool {
2206
2213
return raylib .mIsGamepadButtonDown (
2207
2214
gamepad ,
2208
- button ,
2215
+ @enumToInt ( button ) ,
2209
2216
);
2210
2217
}
2211
2218
2212
2219
/// Check if a gamepad button has been released once
2213
2220
pub fn IsGamepadButtonReleased (
2214
2221
gamepad : i32 ,
2215
- button : i32 ,
2222
+ button : GamepadButton ,
2216
2223
) bool {
2217
2224
return raylib .mIsGamepadButtonReleased (
2218
2225
gamepad ,
2219
- button ,
2226
+ @enumToInt ( button ) ,
2220
2227
);
2221
2228
}
2222
2229
2223
2230
/// Check if a gamepad button is NOT being pressed
2224
2231
pub fn IsGamepadButtonUp (
2225
2232
gamepad : i32 ,
2226
- button : i32 ,
2233
+ button : GamepadButton ,
2227
2234
) bool {
2228
2235
return raylib .mIsGamepadButtonUp (
2229
2236
gamepad ,
2230
- button ,
2237
+ @enumToInt ( button ) ,
2231
2238
);
2232
2239
}
2233
2240
2234
- /// Get the last gamepad button pressed
2235
- pub fn GetGamepadButtonPressed () i32 {
2236
- return raylib .mGetGamepadButtonPressed ();
2237
- }
2238
-
2239
2241
/// Get gamepad axis count for a gamepad
2240
2242
pub fn GetGamepadAxisCount (
2241
2243
gamepad : i32 ,
@@ -2248,11 +2250,11 @@ pub fn GetGamepadAxisCount(
2248
2250
/// Get axis movement value for a gamepad axis
2249
2251
pub fn GetGamepadAxisMovement (
2250
2252
gamepad : i32 ,
2251
- axis : i32 ,
2253
+ axis : GamepadAxis ,
2252
2254
) f32 {
2253
2255
return raylib .mGetGamepadAxisMovement (
2254
2256
gamepad ,
2255
- axis ,
2257
+ @enumToInt ( axis ) ,
2256
2258
);
2257
2259
}
2258
2260
0 commit comments