diff options
| author | Drew DeVault <sir@cmpwn.com> | 2022-02-05 09:41:17 +0100 |
|---|---|---|
| committer | Drew DeVault <sir@cmpwn.com> | 2022-02-05 09:41:17 +0100 |
| commit | 0fdfa823b404fff3d18d72bf2dccfe0ce444cfd5 (patch) | |
| tree | baea256e596312905159b8d860a07ebc553ef2fd /sdl2 | |
| parent | add gl.ha (diff) | |
| download | hare-chip8-0fdfa823b404fff3d18d72bf2dccfe0ce444cfd5.tar.gz | |
Add controller rumble support
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat (limited to 'sdl2')
| -rw-r--r-- | sdl2/gamecontroller.ha | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sdl2/gamecontroller.ha b/sdl2/gamecontroller.ha index 46b5f5c..4af8677 100644 --- a/sdl2/gamecontroller.ha +++ b/sdl2/gamecontroller.ha @@ -71,3 +71,29 @@ export fn game_controller_open( // Close a game controller previously opened with [[game_controller_open]]. export @symbol("SDL_GameControllerClose") fn game_controller_close( gamecontroller: *gamecontroller) void; + +@symbol("SDL_GameControllerRumble") fn _game_controller_rumble( + gamecontroller: *gamecontroller, + low_frequency_rumble: u16, + high_frequency_rumble: u16, + duration_ms: u32) int; + +// Start a rumble effect on a game controller. +// +// Each call to this function cancels any previous rumble effect, and calling +// it with 0 intensity stops any rumbling. +// +// The low-frequency motor is generally on the left, and the high-frequency +// motor is generally on the right. +export fn game_controller_rumble( + gamecontroller: *gamecontroller, + low_frequency_rumble: u16, + high_frequency_rumble: u16, + duration_ms: u32, +) (void | error) = { + return wrapvoid(_game_controller_rumble( + gamecontroller, + low_frequency_rumble, + high_frequency_rumble, + duration_ms)); +}; |
