aboutsummaryrefslogtreecommitdiff
path: root/sdl2/gamecontroller.ha
diff options
context:
space:
mode:
Diffstat (limited to 'sdl2/gamecontroller.ha')
-rw-r--r--sdl2/gamecontroller.ha42
1 files changed, 21 insertions, 21 deletions
diff --git a/sdl2/gamecontroller.ha b/sdl2/gamecontroller.ha
index 7bf2e18..113bb37 100644
--- a/sdl2/gamecontroller.ha
+++ b/sdl2/gamecontroller.ha
@@ -1,18 +1,18 @@
// TODO: Flesh me out
-// The gamecontroller structure used to identify an SDL game controller.
+// The SDL_GameController structure used to identify an SDL game controller.
// (Opaque)
-export type gamecontroller = void;
+export type SDL_GameController = void;
// The list of axes available from a controller
//
-// Thumbstick axis values range from [[JOYSTICK_AXIS_MIN]] to
-// [[JOYSTICK_AXIS_MAX]], and are centered within ~8000 of zero, though advanced
+// Thumbstick axis values range from [[SDL_JOYSTICK_AXIS_MIN]] to
+// [[SDL_JOYSTICK_AXIS_MAX]], and are centered within ~8000 of zero, though advanced
// UI will allow users to set or autodetect the dead zone, which varies between
// controllers.
//
-// Trigger axis values range from 0 to [[JOYSTICK_AXIS_MAX]].
-export type controller_axis = enum u8 {
+// Trigger axis values range from 0 to [[SDL_JOYSTICK_AXIS_MAX]].
+export type SDL_GameControllerAxis = enum u8 {
LEFTX,
LEFTY,
RIGHTX,
@@ -23,7 +23,7 @@ export type controller_axis = enum u8 {
};
// The list of buttons available from a controller
-export type controller_button = enum u8 {
+export type SDL_GameControllerBUtton = enum u8 {
INVALID = 255,
A = 0,
B,
@@ -49,31 +49,31 @@ export type controller_button = enum u8 {
};
// Check if the given joystick is supported by the game controller interface.
-//
+//
// 'joystick_index' is the same as the 'device_index' passed to
// [[joystick_open]].
-//
+//
// Returns true if the given joystick is supported by the game controller
// interface, false if it isn't or it's an invalid index.
-export @symbol("SDL_IsGameController") fn is_game_controller(
+export @symbol("SDL_IsGameController") fn SDL_IsGameController(
joystick_index: int) bool;
@symbol("SDL_GameControllerOpen") fn _game_controller_open(
- joystick_index: int) nullable *gamecontroller;
+ joystick_index: int) nullable *SDL_GameController;
// Get the SDL_GameController associated with an instance id.
-export fn game_controller_open(
+export fn SDL_GameControllerOpen(
joystick_index: int,
-) (*gamecontroller | error) = {
- return wrapptr(_game_controller_open(joystick_index))?: *gamecontroller;
+) (*SDL_GameController | error) = {
+ return wrapptr(_game_controller_open(joystick_index))?: *SDL_GameController;
};
// Close a game controller previously opened with [[game_controller_open]].
-export @symbol("SDL_GameControllerClose") fn game_controller_close(
- gamecontroller: *gamecontroller) void;
+export @symbol("SDL_GameControllerClose") fn SDL_GameControllerClose(
+ gamecontroller: *SDL_GameController) void;
-@symbol("SDL_GameControllerRumble") fn _game_controller_rumble(
- gamecontroller: *gamecontroller,
+@symbol("SDL_GameControllerRumble") fn _SDL_GameControllerRumble(
+ gamecontroller: *SDL_GameController,
low_frequency_rumble: u16,
high_frequency_rumble: u16,
duration_ms: u32) int;
@@ -85,13 +85,13 @@ export @symbol("SDL_GameControllerClose") fn game_controller_close(
//
// 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,
+export fn SDL_GameControllerRumble(
+ gamecontroller: *SDL_GameController,
low_frequency_rumble: u16,
high_frequency_rumble: u16,
duration_ms: u32,
) (void | error) = {
- return wrapvoid(_game_controller_rumble(
+ return wrapvoid(_SDL_GameControllerRumble(
gamecontroller,
low_frequency_rumble,
high_frequency_rumble,