text
stringlengths
0
601k
let button_bind_value2 = field button_bind " value2 " int
let ( ) = seal button_bind
module Controller = struct type bind_type = int let bind_type_none = sdl_controller_bindtype_none let bind_type_button = sdl_controller_bindtype_button let bind_type_axis = sdl_controller_bindtype_axis let bind_type_hat = sdl_controller_bindtype_hat type axis = int let axis_invalid = sdl_controller_axis_invalid let axis_left_x = sdl_controller_axis_leftx let axis_left_y = sdl_controller_axis_lefty let axis_right_x = sdl_controller_axis_rightx let axis_right_y = sdl_controller_axis_righty let axis_trigger_left = sdl_controller_axis_triggerleft let axis_trigger_right = sdl_controller_axis_triggerright let axis_max = sdl_controller_axis_max type button = int let button_invalid = sdl_controller_button_invalid let button_a = sdl_controller_button_a let button_b = sdl_controller_button_b let button_x = sdl_controller_button_x let button_y = sdl_controller_button_y let button_back = sdl_controller_button_back let button_guide = sdl_controller_button_guide let button_start = sdl_controller_button_start let button_left_stick = sdl_controller_button_leftstick let button_right_stick = sdl_controller_button_rightstick let button_left_shoulder = sdl_controller_button_leftshoulder let button_right_shoulder = sdl_controller_button_rightshoulder let button_dpad_up = sdl_controller_button_dpad_up let button_dpad_down = sdl_controller_button_dpad_down let button_dpad_left = sdl_controller_button_dpad_left let button_dpad_right = sdl_controller_button_dpad_right let button_max = sdl_controller_button_max type button_bind = _button_bind structure let bind_type v = getf v button_bind_bind_type let bind_button_value v = getf v button_bind_value1 let bind_axis_value v = getf v button_bind_value1 let bind_hat_value v = getf v button_bind_value1 , getf v button_bind_value2 end
let game_controller_add_mapping = foreign " SDL_GameControllerAddMapping " ( string @-> returning bool_to_ok )
let game_controller_add_mapping_from_file = foreign " SDL_GameControllerAddMappingsFromFile " ~ stub ( string @-> returning nat_to_ok )
let game_controller_add_mapping_from_rw = foreign " SDL_GameControllerAddMappingsFromRW " ~ stub ( rw_ops @-> bool @-> returning nat_to_ok )
let game_controller_close = foreign " SDL_GameControllerClose " ( game_controller @-> returning void )
let game_controller_event_state = foreign " SDL_GameControllerEventState " ( int @-> returning nat_to_ok )
let game_controller_from_instance_id = foreign " SDL_GameControllerFromInstanceID " ( joystick_id @-> returning game_controller )
let game_controller_get_event_state ( ) = game_controller_event_state sdl_query
let game_controller_set_event_state t = game_controller_event_state t
let game_controller_get_attached = foreign " SDL_GameControllerGetAttached " ( game_controller @-> returning bool )
let game_controller_get_axis = foreign " SDL_GameControllerGetAxis " ( game_controller @-> int @-> returning int16_t )
let game_controller_get_axis_from_string = foreign " SDL_GameControllerGetAxisFromString " ( string @-> returning int )
let game_controller_get_bind_for_axis = foreign " SDL_GameControllerGetBindForAxis " ( game_controller @-> int @-> returning button_bind )
let game_controller_get_bind_for_button = foreign " SDL_GameControllerGetBindForButton " ( game_controller @-> int @-> returning button_bind )
let game_controller_get_button = foreign " SDL_GameControllerGetButton " ( game_controller @-> int @-> returning int_as_uint8_t )
let game_controller_get_button_from_string = foreign " SDL_GameControllerGetButtonFromString " ( string @-> returning int )
let game_controller_get_joystick = foreign " SDL_GameControllerGetJoystick " ( game_controller @-> returning ( some_to_ok joystick_opt ) )
let game_controller_get_product = foreign " SDL_GameControllerGetProduct " ( game_controller @-> returning int_as_uint16_t )
let game_controller_get_product_version = foreign " SDL_GameControllerGetProductVersion " ( game_controller @-> returning int_as_uint16_t )
let game_controller_get_string_for_axis = foreign " SDL_GameControllerGetStringForAxis " ( int @-> returning string_opt )
let game_controller_get_string_for_button = foreign " SDL_GameControllerGetStringForButton " ( int @-> returning string_opt )
let game_controller_get_vendor = foreign " SDL_GameControllerGetVendor " ( game_controller @-> returning int_as_uint16_t )
let game_controller_mapping = foreign " SDL_GameControllerMapping " ( game_controller @-> returning ( some_to_ok string_opt ) )
let game_controller_mapping_for_index = foreign " SDL_GameControllerMappingForIndex " ( int @-> returning ( some_to_ok string_opt ) )
let game_controller_mapping_for_guid = foreign " SDL_GameControllerMappingForGUID " ( joystick_guid @-> returning ( some_to_ok string_opt ) )
let game_controller_name = foreign " SDL_GameControllerName " ( game_controller @-> returning ( some_to_ok string_opt ) )
let game_controller_name_for_index = foreign " SDL_GameControllerNameForIndex " ( int @-> returning ( some_to_ok string_opt ) )
let game_controller_num_mappings = foreign " SDL_GameControllerNumMappings " ( void @-> returning int )
let game_controller_open = foreign " SDL_GameControllerOpen " ( int @-> returning ( some_to_ok game_controller_opt ) )
let game_controller_update = foreign " SDL_GameControllerUpdate " ( void @-> returning void )
let is_game_controller = foreign " SDL_IsGameController " ( int @-> returning bool )
let event_type : event_type typ = int_as_uint32_t
module Event = struct module Common = struct type t let t : t structure typ = structure " SDL_CommonEvent " let typ = field t " type " int_as_uint32_t let timestamp = field t " timestamp " int32_as_uint32_t let ( ) = seal t end module Controller_axis_event = struct type t let t : t structure typ = structure " SDL_ControllerAxisEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let axis = field t " axis " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let _ = field t " padding3 " uint8_t let value = field t " value " int16_t let _ = field t " padding4 " uint16_t let ( ) = seal t end module Controller_button_event = struct type t let t : t structure typ = structure " SDL_ControllerButtonEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let button = field t " button " int_as_uint8_t let state = field t " state " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let ( ) = seal t end module Controller_device_event = struct type t let t : t structure typ = structure " SDL_ControllerDeviceEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let ( ) = seal t end module Dollar_gesture_event = struct type t let t : t structure typ = structure " SDL_DollarGestureEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let touch_id = field t " touchId " touch_id let gesture_id = field t " gestureId " gesture_id let num_fingers = field t " numFingers " int_as_uint32_t let error = field t " error " float let x = field t " x " float let y = field t " y " float let ( ) = seal t end module Drop_event = struct type t let t : t structure typ = structure " SDL_DropEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let file = field t " file " ( ptr char ) let ( ) = seal t end module Keyboard_event = struct type t let t : t structure typ = structure " SDL_KeyboardEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let state = field t " state " int_as_uint8_t let repeat = field t " repeat " int_as_uint8_t let padding2 = field t " padding2 " uint8_t let padding3 = field t " padding3 " uint8_t let scancode = field t " scancode " scancode let keycode = field t " sym " keycode let keymod = field t " mod " keymod let unused = field t " unused " uint32_t let ( ) = seal t end module Joy_axis_event = struct type t let t : t structure typ = structure " SDL_JoyAxisEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let axis = field t " axis " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let _ = field t " padding3 " uint8_t let value = field t " value " int16_t let _ = field t " padding4 " uint16_t let ( ) = seal t end module Joy_ball_event = struct type t let t : t structure typ = structure " SDL_JoyBallEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let ball = field t " ball " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let _ = field t " padding3 " uint8_t let xrel = field t " xrel " int16_t let yrel = field t " yrel " int16_t let ( ) = seal t end module Joy_button_event = struct type t let t : t structure typ = structure " SDL_JoyButtonEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let button = field t " button " int_as_uint8_t let state = field t " state " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let ( ) = seal t end module Joy_device_event = struct type t let t : t structure typ = structure " SDL_JoyDeviceEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let ( ) = seal t end module Joy_hat_event = struct type t let t : t structure typ = structure " SDL_JoyHatEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " joystick_id let hat = field t " hat " int_as_uint8_t let value = field t " value " int_as_uint8_t let _ = field t " padding1 " uint8_t let _ = field t " padding2 " uint8_t let ( ) = seal t end module Mouse_button_event = struct type t let t : t structure typ = structure " SDL_MouseButtonEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let which = field t " which " int32_as_uint32_t let button = field t " button " int_as_uint8_t let state = field t " state " int_as_uint8_t let clicks = field t " clicks " int_as_uint8_t let _ = field t " padding1 " int_as_uint8_t let x = field t " x " int_as_int32_t let y = field t " y " int_as_int32_t let ( ) = seal t end module Mouse_motion_event = struct type t let t : t structure typ = structure " SDL_MouseMotionEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let which = field t " which " int32_as_uint32_t let state = field t " state " int32_as_uint32_t let x = field t " x " int_as_int32_t let y = field t " y " int_as_int32_t let xrel = field t " xrel " int_as_int32_t let yrel = field t " yrel " int_as_int32_t let ( ) = seal t end type mouse_wheel_direction = int let mouse_wheel_normal = sdl_mousewheel_normal let mouse_wheel_flipped = sdl_mousewheel_flipped module Mouse_wheel_event = struct type t let t : t structure typ = structure " SDL_MouseWheelEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let which = field t " which " int32_as_uint32_t let x = field t " x " int_as_int32_t let y = field t " y " int_as_int32_t let direction = field t " direction " int_as_uint32_t let ( ) = seal t end module Multi_gesture_event = struct type t let t : t structure typ = structure " SDL_MultiGestureEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let touch_id = field t " touchId " touch_id let dtheta = field t " dTheta " float let ddist = field t " ddist " float let x = field t " x " float let y = field t " y " float let num_fingers = field t " numFingers " int_as_uint16_t let _ = field t " padding " uint16_t let ( ) = seal t end module Sensor_event = struct type t let t : t structure typ = structure " SDL_SensorEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let which = field t " which " int32_as_uint32_t let data0 = field t " data0 " float let data1 = field t " data1 " float let data2 = field t " data2 " float let data3 = field t " data3 " float let data4 = field t " data4 " float let data5 = field t " data5 " float let ( ) = seal t end module Quit_event = struct type t let t : t structure typ = structure " SDL_QuitEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let ( ) = seal t end module Sys_wm_event = struct type t let t : t structure typ = structure " SDL_SysWMEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let _ = field t " msg " ( ptr void ) let ( ) = seal t end module Text_editing_event = struct type t let t : t structure typ = structure " SDL_TextEditingEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let text = field t " text " ( string_as_char_array sdl_texteditingevent_text_size ) let start = field t " start " int_as_int32_t let length = field t " end " int_as_int32_t let ( ) = seal t end module Text_input_event = struct type t let t : t structure typ = structure " SDL_TextIfmtsnputEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let text = field t " text " ( string_as_char_array sdl_textinputevent_text_size ) let ( ) = seal t end module Touch_finger_event = struct type t let t : t structure typ = structure " SDL_TouchFingerEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let touch_id = field t " touchId " touch_id let finger_id = field t " fingerId " finger_id let x = field t " x " float let y = field t " y " float let dx = field t " dx " float let dy = field t " dy " float let pressure = field t " pressure " float let ( ) = seal t end module User_event = struct type t let t : t structure typ = structure " SDL_UserEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let code = field t " code " int_as_int32_t let _ = field t " data1 " ( ptr void ) let _ = field t " data2 " ( ptr void ) let ( ) = seal t end module Window_event = struct type t let t : t structure typ = structure " SDL_WindowEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let window_id = field t " windowID " int_as_uint32_t let event = field t " event " int_as_uint8_t let padding1 = field t " padding1 " uint8_t let padding2 = field t " padding2 " uint8_t let padding3 = field t " padding3 " uint8_t let data1 = field t " data1 " int32_t let data2 = field t " data2 " int32_t let ( ) = seal t end module Display_event = struct type t let t : t structure typ = structure " SDL_DisplayEvent " let _ = field t " type " int_as_uint32_t let _ = field t " timestamp " int32_as_uint32_t let display = field t " display " int32_as_uint32_t let event = field t " event " int_as_uint8_t let padding1 = field t " padding1 " uint8_t let padding2 = field t " padding2 " uint8_t let padding3 = field t " padding3 " uint8_t let data1 = field t " data1 " int32_t let ( ) = seal t end module Audio_device_event = struct type t let t : t structure typ = structure " SDL_AudioDevice " let _ = field t " type " int_as_uint32_t let timestamp = field t " timestamp " int32_as_uint32_t let which = field t " which " int32_as_uint32_t let iscapture = field t " iscapture " int_as_uint8_t let ( ) = seal t end type t let t : t union typ = union " SDL_Event " let typ = field t " type " int_as_uint32_t let audio_device_event = field t " adevice " Audio_device_event . t let common = field t " common " Common . t let controller_axis_event = field t " caxis " Controller_axis_event . t let controller_button_event = field t " cbutton " Controller_button_event . t let controller_device_event = field t " cdevice " Controller_device_event . t let dollar_gesture_event = field t " dgesture " Dollar_gesture_event . t let drop_event = field t " drop " Drop_event . t let joy_axis_event = field t " jaxis " Joy_axis_event . t let joy_ball_event = field t " jball " Joy_ball_event . t let joy_button_event = field t " jbutton " Joy_button_event . t let joy_device_event = field t " jdevice " Joy_device_event . t let joy_hat_event = field t " jhat " Joy_hat_event . t let keyboard_event = field t " key " Keyboard_event . t let mouse_button_event = field t " button " Mouse_button_event . t let mouse_motion_event = field t " motion " Mouse_motion_event . t let mouse_wheel_event = field t " wheel " Mouse_wheel_event . t let multi_gesture_event = field t " mgesture " Multi_gesture_event . t let quit_event = field t " quit " Quit_event . t let sys_wm_event = field t " syswm " Sys_wm_event . t let text_editing_event = field t " edit " Text_editing_event . t let text_input_event = field t " text " Text_input_event . t let touch_finger_event = field t " tfinger " Touch_finger_event . t let user_event = field t " user " User_event . t let window_event = field t " window " Window_event . t let display_event = field t " display " Display_event . t let sensor_event = field t " sensor " Sensor_event . t let padding = field t " padding " ( abstract " padding " tsdl_sdl_event_size 1 ) let ( ) = seal t let create ( ) = make t let opt_addr = function | None -> coerce ( ptr void ) ( ptr t ) null | Some v -> addr v type _ field = F : ( ( ' a structure , t union ) Ctypes . field * ( ' b , ' a structure ) Ctypes . field ) -> ' b field let get e ( F ( s , f ) ) = getf ( getf e s ) f let set e ( F ( s , f ) ) v = setf ( getf e s ) f v let first_event = sdl_firstevent let last_event = sdl_lastevent let typ = F ( common , Common . typ ) let timestamp = F ( common , Common . timestamp ) let app_terminating = sdl_app_terminating let app_low_memory = sdl_app_lowmemory let app_will_enter_background = sdl_app_willenterbackground let app_did_enter_background = sdl_app_didenterbackground let app_will_enter_foreground = sdl_app_willenterforeground let app_did_enter_foreground = sdl_app_didenterforeground let clipboard_update = sdl_clipboardupdate let controller_axis_motion = sdl_controlleraxismotion let controller_button_down = sdl_controllerbuttondown let controller_button_up = sdl_controllerbuttonup let controller_device_added = sdl_controllerdeviceadded let controller_device_remapped = sdl_controllerdeviceremapped let controller_device_removed = sdl_controllerdeviceremoved let controller_axis_which = F ( controller_axis_event , Controller_axis_event . which ) let controller_axis_axis = F ( controller_axis_event , Controller_axis_event . axis ) let controller_axis_value = F ( controller_axis_event , Controller_axis_event . value ) let controller_button_which = F ( controller_button_event , Controller_button_event . which ) let controller_button_button = F ( controller_button_event , Controller_button_event . button ) let controller_button_state = F ( controller_button_event , Controller_button_event . state ) let controller_device_which = F ( controller_device_event , Controller_device_event . which ) let dollar_gesture = sdl_dollargesture let dollar_record = sdl_dollarrecord let dollar_gesture_touch_id = F ( dollar_gesture_event , Dollar_gesture_event . touch_id ) let dollar_gesture_gesture_id = F ( dollar_gesture_event , Dollar_gesture_event . gesture_id ) let dollar_gesture_num_fingers = F ( dollar_gesture_event , Dollar_gesture_event . num_fingers ) let dollar_gesture_error = F ( dollar_gesture_event , Dollar_gesture_event . error ) let dollar_gesture_x = F ( dollar_gesture_event , Dollar_gesture_event . x ) let dollar_gesture_y = F ( dollar_gesture_event , Dollar_gesture_event . y ) let drop_file = sdl_dropfile let drop_text = sdl_droptext let drop_begin = sdl_dropbegin let drop_complete = sdl_dropcomplete let drop_file_file = F ( drop_event , Drop_event . file ) let drop_file_free e = sdl_free ( to_voidp ( get e drop_file_file ) ) let drop_file_file e = let sp = get e drop_file_file in if ptr_compare ( to_voidp sp ) null = 0 then invalid_arg err_drop_file else coerce ( ptr char ) string ( get e drop_file_file ) let finger_down = sdl_fingerdown let finger_motion = sdl_fingermotion let finger_up = sdl_fingerup let touch_finger_touch_id = F ( touch_finger_event , Touch_finger_event . touch_id ) let touch_finger_finger_id = F ( touch_finger_event , Touch_finger_event . finger_id ) let touch_finger_x = F ( touch_finger_event , Touch_finger_event . x ) let touch_finger_y = F ( touch_finger_event , Touch_finger_event . y ) let touch_finger_dx = F ( touch_finger_event , Touch_finger_event . dx ) let touch_finger_dy = F ( touch_finger_event , Touch_finger_event . dy ) let touch_finger_pressure = F ( touch_finger_event , Touch_finger_event . pressure ) let joy_axis_motion = sdl_joyaxismotion let joy_ball_motion = sdl_joyballmotion let joy_button_down = sdl_joybuttondown let joy_button_up = sdl_joybuttonup let joy_device_added = sdl_joydeviceadded let joy_device_removed = sdl_joydeviceremoved let joy_hat_motion = sdl_joyhatmotion let joy_axis_which = F ( joy_axis_event , Joy_axis_event . which ) let joy_axis_axis = F ( joy_axis_event , Joy_axis_event . axis ) let joy_axis_value = F ( joy_axis_event , Joy_axis_event . value ) let joy_ball_which = F ( joy_ball_event , Joy_ball_event . which ) let joy_ball_ball = F ( joy_ball_event , Joy_ball_event . ball ) let joy_ball_xrel = F ( joy_ball_event , Joy_ball_event . xrel ) let joy_ball_yrel = F ( joy_ball_event , Joy_ball_event . yrel ) let joy_button_which = F ( joy_button_event , Joy_button_event . which ) let joy_button_button = F ( joy_button_event , Joy_button_event . button ) let joy_button_state = F ( joy_button_event , Joy_button_event . state ) let joy_device_which = F ( joy_device_event , Joy_device_event . which ) let joy_hat_which = F ( joy_hat_event , Joy_hat_event . which ) let joy_hat_hat = F ( joy_hat_event , Joy_hat_event . hat ) let joy_hat_value = F ( joy_hat_event , Joy_hat_event . value ) let key_down = sdl_keydown let key_up = sdl_keyup let keymap_changed = sdl_keymapchanged let keyboard_window_id = F ( keyboard_event , Keyboard_event . window_id ) let keyboard_repeat = F ( keyboard_event , Keyboard_event . repeat ) let keyboard_state = F ( keyboard_event , Keyboard_event . state ) let keyboard_scancode = F ( keyboard_event , Keyboard_event . scancode ) let keyboard_keycode = F ( keyboard_event , Keyboard_event . keycode ) let keyboard_keymod = F ( keyboard_event , Keyboard_event . keymod ) let mouse_button_down = sdl_mousebuttondown let mouse_button_up = sdl_mousebuttonup let mouse_motion = sdl_mousemotion let mouse_wheel = sdl_mousewheel let mouse_button_window_id = F ( mouse_button_event , Mouse_button_event . window_id ) let mouse_button_which = F ( mouse_button_event , Mouse_button_event . which ) let mouse_button_state = F ( mouse_button_event , Mouse_button_event . state ) let mouse_button_button = F ( mouse_button_event , Mouse_button_event . button ) let mouse_button_clicks = F ( mouse_button_event , Mouse_button_event . clicks ) let mouse_button_x = F ( mouse_button_event , Mouse_button_event . x ) let mouse_button_y = F ( mouse_button_event , Mouse_button_event . y ) let mouse_motion_window_id = F ( mouse_motion_event , Mouse_motion_event . window_id ) let mouse_motion_which = F ( mouse_motion_event , Mouse_motion_event . which ) let mouse_motion_state = F ( mouse_motion_event , Mouse_motion_event . state ) let mouse_motion_x = F ( mouse_motion_event , Mouse_motion_event . x ) let mouse_motion_y = F ( mouse_motion_event , Mouse_motion_event . y ) let mouse_motion_xrel = F ( mouse_motion_event , Mouse_motion_event . xrel ) let mouse_motion_yrel = F ( mouse_motion_event , Mouse_motion_event . yrel ) let mouse_wheel_window_id = F ( mouse_wheel_event , Mouse_wheel_event . window_id ) let mouse_wheel_which = F ( mouse_wheel_event , Mouse_wheel_event . which ) let mouse_wheel_x = F ( mouse_wheel_event , Mouse_wheel_event . x ) let mouse_wheel_y = F ( mouse_wheel_event , Mouse_wheel_event . y ) let mouse_wheel_direction = F ( mouse_wheel_event , Mouse_wheel_event . direction ) let multi_gesture = sdl_multigesture let multi_gesture_touch_id = F ( multi_gesture_event , Multi_gesture_event . touch_id ) let multi_gesture_dtheta = F ( multi_gesture_event , Multi_gesture_event . dtheta ) let multi_gesture_ddist = F ( multi_gesture_event , Multi_gesture_event . ddist ) let multi_gesture_x = F ( multi_gesture_event , Multi_gesture_event . x ) let multi_gesture_y = F ( multi_gesture_event , Multi_gesture_event . y ) let multi_gesture_num_fingers = F ( multi_gesture_event , Multi_gesture_event . num_fingers ) let quit = sdl_quit let sys_wm_event = sdl_syswmevent let text_editing = sdl_textediting let text_input = sdl_textinput let text_editing_window_id = F ( text_editing_event , Text_editing_event . window_id ) let text_editing_text = F ( text_editing_event , Text_editing_event . text ) let text_editing_start = F ( text_editing_event , Text_editing_event . start ) let text_editing_length = F ( text_editing_event , Text_editing_event . length ) let text_input_window_id = F ( text_input_event , Text_input_event . window_id ) let text_input_text = F ( text_input_event , Text_input_event . text ) let user_window_id = F ( user_event , User_event . window_id ) let user_code = F ( user_event , User_event . code ) let user_event = sdl_userevent type window_event_id = int let window_event_shown = sdl_windowevent_shown let window_event_hidden = sdl_windowevent_hidden let window_event_exposed = sdl_windowevent_exposed let window_event_moved = sdl_windowevent_moved let window_event_resized = sdl_windowevent_resized let window_event_size_changed = sdl_windowevent_size_changed let window_event_minimized = sdl_windowevent_minimized let window_event_maximized = sdl_windowevent_maximized let window_event_restored = sdl_windowevent_restored let window_event_enter = sdl_windowevent_enter let window_event_leave = sdl_windowevent_leave let window_event_focus_gained = sdl_windowevent_focus_gained let window_event_focus_lost = sdl_windowevent_focus_lost let window_event_close = sdl_windowevent_close let window_event_take_focus = sdl_windowevent_take_focus let window_event_hit_test = sdl_windowevent_hit_test let window_window_id = F ( window_event , Window_event . window_id ) let window_event_id = F ( window_event , Window_event . event ) let window_data1 = F ( window_event , Window_event . data1 ) let window_data2 = F ( window_event , Window_event . data2 ) let window_event = sdl_windowevent type window_event_enum = [ ` Close | ` Enter | ` Exposed | ` Focus_gained | ` Focus_lost | ` Hidden | ` Hit_test | ` Leave | ` Maximized | ` Minimized | ` Moved | ` Resized | ` Restored | ` Shown | ` Size_changed | ` Take_focus | ` Unknown of window_event_id ] let enum_of_window_event_id = let add acc ( k , v ) = Imap . add k v acc in let enums = [ window_event_shown , ` Shown ; window_event_hidden , ` Hidden ; window_event_exposed , ` Exposed ; window_event_moved , ` Moved ; window_event_resized , ` Resized ; window_event_size_changed , ` Size_changed ; window_event_minimized , ` Minimized ; window_event_maximized , ` Maximized ; window_event_restored , ` Restored ; window_event_enter , ` Enter ; window_event_leave , ` Leave ; window_event_focus_gained , ` Focus_gained ; window_event_focus_lost , ` Focus_lost ; window_event_close , ` Close ; window_event_take_focus , ` Take_focus ; window_event_hit_test , ` Hit_test ; ] in List . fold_left add Imap . empty enums let window_event_enum id = try Imap . find id enum_of_window_event_id with Not_found -> ` Unknown id let display_display = F ( display_event , Display_event . display ) let display_event_id = F ( display_event , Display_event . event ) let display_data1 = F ( display_event , Display_event . data1 ) let display_event = sdl_displayevent let sensor_which = F ( sensor_event , Sensor_event . which ) let sensor_data0 = F ( sensor_event , Sensor_event . data0 ) let sensor_data1 = F ( sensor_event , Sensor_event . data1 ) let sensor_data2 = F ( sensor_event , Sensor_event . data2 ) let sensor_data3 = F ( sensor_event , Sensor_event . data3 ) let sensor_data4 = F ( sensor_event , Sensor_event . data4 ) let sensor_data5 = F ( sensor_event , Sensor_event . data5 ) let sensor_update = sdl_sensorupdate let render_targets_reset = sdl_render_targets_reset let render_device_reset = sdl_render_device_reset let audio_device_added = sdl_audiodeviceadded let audio_device_removed = sdl_audiodeviceremoved let audio_device_timestamp = F ( audio_device_event , Audio_device_event . timestamp ) let audio_device_which = F ( audio_device_event , Audio_device_event . which ) let audio_device_is_capture = F ( audio_device_event , Audio_device_event . iscapture ) type enum = [ ` App_did_enter_background | ` App_did_enter_foreground | ` App_low_memory | ` App_terminating | ` App_will_enter_background | ` App_will_enter_foreground | ` Clipboard_update | ` Controller_axis_motion | ` Controller_button_down | ` Controller_button_up | ` Controller_device_added | ` Controller_device_remapped | ` Controller_device_removed | ` Dollar_gesture | ` Dollar_record | ` Drop_file | ` Finger_down | ` Finger_motion | ` Finger_up | ` Joy_axis_motion | ` Joy_ball_motion | ` Joy_button_down | ` Joy_button_up | ` Joy_device_added | ` Joy_device_removed | ` Joy_hat_motion | ` Key_down | ` Key_up | ` Mouse_button_down | ` Mouse_button_up | ` Mouse_motion | ` Mouse_wheel | ` Multi_gesture | ` Quit | ` Sys_wm_event | ` Text_editing | ` Text_input | ` Unknown of int | ` User_event | ` Window_event | ` Display_event | ` Sensor_update ] let enum_of_event_type = let add acc ( k , v ) = Imap . add k v acc in let enums = [ app_terminating , ` App_terminating ; app_low_memory , ` App_low_memory ; app_will_enter_background , ` App_will_enter_background ; app_did_enter_background , ` App_did_enter_background ; app_will_enter_foreground , ` App_will_enter_foreground ; app_did_enter_foreground , ` App_did_enter_foreground ; clipboard_update , ` Clipboard_update ; controller_axis_motion , ` Controller_axis_motion ; controller_button_down , ` Controller_button_down ; controller_button_up , ` Controller_button_up ; controller_device_added , ` Controller_device_added ; controller_device_remapped , ` Controller_device_remapped ; controller_device_removed , ` Controller_device_removed ; dollar_gesture , ` Dollar_gesture ; dollar_record , ` Dollar_record ; drop_file , ` Drop_file ; finger_down , ` Finger_down ; finger_motion , ` Finger_motion ; finger_up , ` Finger_up ; joy_axis_motion , ` Joy_axis_motion ; joy_ball_motion , ` Joy_ball_motion ; joy_button_down , ` Joy_button_down ; joy_button_up , ` Joy_button_up ; joy_device_added , ` Joy_device_added ; joy_device_removed , ` Joy_device_removed ; joy_hat_motion , ` Joy_hat_motion ; key_down , ` Key_down ; key_up , ` Key_up ; mouse_button_down , ` Mouse_button_down ; mouse_button_up , ` Mouse_button_up ; mouse_motion , ` Mouse_motion ; mouse_wheel , ` Mouse_wheel ; multi_gesture , ` Multi_gesture ; sys_wm_event , ` Sys_wm_event ; text_editing , ` Text_editing ; text_input , ` Text_input ; user_event , ` User_event ; quit , ` Quit ; window_event , ` Window_event ; display_event , ` Display_event ; sensor_update , ` Sensor_update ; ] in List . fold_left add Imap . empty enums let enum t = try Imap . find t enum_of_event_type with Not_found -> ` Unknown t end
type event = Event . t union
let event_state = foreign " SDL_EventState " ( event_type @-> int @-> returning int_as_uint8_t )
let get_event_state e = event_state e sdl_query
let set_event_state e s = ignore ( event_state e s )
let flush_event = foreign " SDL_FlushEvent " ( event_type @-> returning void )
let flush_events = foreign " SDL_FlushEvents " ( event_type @-> event_type @-> returning void )
let has_event = foreign " SDL_HasEvent " ( event_type @-> returning bool )
let has_events = foreign " SDL_HasEvents " ( event_type @-> event_type @-> returning bool )
let poll_event = foreign " SDL_PollEvent " ( ptr Event . t @-> returning bool )
let poll_event e = poll_event ( Event . opt_addr e )
let pump_events = foreign " SDL_PumpEvents " ( void @-> returning void )
let push_event = foreign " SDL_PushEvent " ( ptr Event . t @-> returning bool_to_ok )
let push_event e = push_event ( addr e )
let register_events = foreign " SDL_RegisterEvents " ( int @-> returning uint32_t )
let register_event ( ) = match Unsigned . UInt32 . to_int32 ( register_events 1 ) with
let wait_event = foreign ~ release_runtime_lock : true " SDL_WaitEvent " ( ptr Event . t @-> returning int )
let wait_event e = match wait_event ( Event . opt_addr e ) with
let wait_event_timeout = foreign " SDL_WaitEventTimeout " ~ release_runtime_lock : true ( ptr Event . t @-> int @-> returning bool )
let wait_event_timeout e t = wait_event_timeout ( Event . opt_addr e ) t
type haptic = unit ptr
let haptic : haptic typ = ptr void
let haptic_opt : haptic option typ = ptr_opt void
let unsafe_haptic_of_ptr addr : haptic = ptr_of_raw_address addr
let unsafe_ptr_of_haptic haptic = raw_address_of_ptr ( to_voidp haptic )
module Haptic = struct let infinity = - 1l type feature = int let gain = sdl_haptic_gain let autocenter = sdl_haptic_autocenter let status = sdl_haptic_status let pause = sdl_haptic_pause type direction_type = int let polar = sdl_haptic_polar let cartesian = sdl_haptic_cartesian let spherical = sdl_haptic_spherical module Direction = struct type _t type t = _t structure let t : _t structure typ = structure " SDL_HapticDirection " let typ = field t " type " int_as_uint8_t let dir_0 = field t " dir0 " int32_t let dir_1 = field t " dir1 " int32_t let dir_2 = field t " dir2 " int32_t let ( ) = seal t let create typv d0 d1 d2 = let d = make t in setf d typ typv ; setf d dir_0 d0 ; setf d dir_1 d1 ; setf d dir_2 d2 ; d let typ d = getf d typ let dir_0 d = getf d dir_0 let dir_1 d = getf d dir_1 let dir_2 d = getf d dir_2 end module Constant = struct type t let t : t structure typ = structure " SDL_HapticConstant " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let level = field t " level " int16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Periodic = struct type t let t : t structure typ = structure " SDL_HapticPeriodic " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let period = field t " period " int_as_uint16_t let magnitude = field t " magnitude " int16_t let offset = field t " offset " int16_t let phase = field t " phase " int_as_uint16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Condition = struct type t let t : t structure typ = structure " SDL_HapticCondition " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let right_sat_0 = field t " right_sat [ 0 ] " int_as_uint16_t let right_sat_1 = field t " right_sat [ 1 ] " int_as_uint16_t let right_sat_2 = field t " right_sat [ 2 ] " int_as_uint16_t let left_sat_0 = field t " left_sat [ 0 ] " int_as_uint16_t let left_sat_1 = field t " left_sat [ 1 ] " int_as_uint16_t let left_sat_2 = field t " left_sat [ 2 ] " int_as_uint16_t let right_coeff_0 = field t " right_coeff [ 0 ] " int16_t let right_coeff_1 = field t " right_coeff [ 1 ] " int16_t let right_coeff_2 = field t " right_coeff [ 2 ] " int16_t let left_coeff_0 = field t " left_coeff [ 0 ] " int16_t let left_coeff_1 = field t " left_coeff [ 1 ] " int16_t let left_coeff_2 = field t " left_coeff [ 2 ] " int16_t let deadband_0 = field t " deadband [ 0 ] " int_as_uint16_t let deadband_1 = field t " deadband [ 1 ] " int_as_uint16_t let deadband_2 = field t " deadband [ 2 ] " int_as_uint16_t let center_0 = field t " center [ 0 ] " int16_t let center_1 = field t " center [ 1 ] " int16_t let center_2 = field t " center [ 2 ] " int16_t let ( ) = seal t end module Ramp = struct type t let t : t structure typ = structure " SDL_HapticRamp " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let start = field t " start " int16_t let end_ = field t " end " int16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Left_right = struct type t let t : t structure typ = structure " SDL_HapticLeftRight " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let large_magnitude = field t " large_magnitude " int_as_uint16_t let small_magnitude = field t " small_magnitude " int_as_uint16_t let ( ) = seal t end module Custom = struct let int_list_as_uint16_t_ptr = let read _ = invalid_arg err_read_field in let write l = let l = List . map Unsigned . UInt16 . of_int l in let a = CArray . of_list uint16_t l in CArray . start a in view ~ read ~ write ( ptr uint16_t ) type t let t : t structure typ = structure " SDL_HapticCustom " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let channels = field t " channels " int_as_uint8_t let period = field t " period " int_as_uint16_t let samples = field t " samples " int_as_uint16_t let data = field t " data " int_list_as_uint16_t_ptr let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Effect = struct type t let t : t union typ = union " SDL_HapticEffect " let typ = field t " type " int_as_uint16_t let constant = field t " constant " Constant . t let periodic = field t " periodic " Periodic . t let condition = field t " condition " Condition . t let ramp = field t " ramp " Ramp . t let left_right = field t " condition " Left_right . t let custom = field t " custom " Custom . t let ( ) = seal t end type effect_type = int let create_effect ( ) = make Effect . t let opt_addr = function | None -> coerce ( ptr void ) ( ptr Effect . t ) null | Some v -> addr v type _ field = F : ( ( ' a structure , Effect . t union ) Ctypes . field * ( ' b , ' a structure ) Ctypes . field ) -> ' b field let get e ( F ( s , f ) ) = getf ( getf e s ) f let set e ( F ( s , f ) ) v = setf ( getf e s ) f v let typ = F ( Effect . constant , Constant . typ ) let constant = sdl_haptic_constant let constant_type = F ( Effect . constant , Constant . typ ) let constant_direction = F ( Effect . constant , Constant . direction ) let constant_length = F ( Effect . constant , Constant . length ) let constant_delay = F ( Effect . constant , Constant . delay ) let constant_button = F ( Effect . constant , Constant . button ) let constant_interval = F ( Effect . constant , Constant . interval ) let constant_level = F ( Effect . constant , Constant . level ) let constant_attack_length = F ( Effect . constant , Constant . attack_length ) let constant_attack_level = F ( Effect . constant , Constant . attack_level ) let constant_fade_length = F ( Effect . constant , Constant . fade_length ) let constant_fade_level = F ( Effect . constant , Constant . fade_level ) let sine = sdl_haptic_sine let left_right = sdl_haptic_leftright let triangle = sdl_haptic_triangle let sawtooth_up = sdl_haptic_sawtoothup let sawtooth_down = sdl_haptic_sawtoothdown let periodic_type = F ( Effect . periodic , Periodic . typ ) let periodic_direction = F ( Effect . periodic , Periodic . direction ) let periodic_length = F ( Effect . periodic , Periodic . length ) let periodic_delay = F ( Effect . periodic , Periodic . delay ) let periodic_button = F ( Effect . periodic , Periodic . button ) let periodic_interval = F ( Effect . periodic , Periodic . interval ) let periodic_period = F ( Effect . periodic , Periodic . period ) let periodic_magnitude = F ( Effect . periodic , Periodic . magnitude ) let periodic_offset = F ( Effect . periodic , Periodic . offset ) let periodic_phase = F ( Effect . periodic , Periodic . phase ) let periodic_attack_length = F ( Effect . periodic , Periodic . attack_length ) let periodic_attack_level = F ( Effect . periodic , Periodic . attack_level ) let periodic_fade_length = F ( Effect . periodic , Periodic . fade_length ) let periodic_fade_level = F ( Effect . periodic , Periodic . fade_level ) let spring = sdl_haptic_spring let damper = sdl_haptic_damper let inertia = sdl_haptic_inertia let friction = sdl_haptic_friction let condition_type = F ( Effect . condition , Condition . typ ) let condition_direction = F ( Effect . condition , Condition . direction ) let condition_length = F ( Effect . condition , Condition . length ) let condition_delay = F ( Effect . condition , Condition . delay ) let condition_button = F ( Effect . condition , Condition . button ) let condition_interval = F ( Effect . condition , Condition . interval ) let condition_right_sat_0 = F ( Effect . condition , Condition . right_sat_0 ) let condition_right_sat_1 = F ( Effect . condition , Condition . right_sat_1 ) let condition_right_sat_2 = F ( Effect . condition , Condition . right_sat_2 ) let condition_left_sat_0 = F ( Effect . condition , Condition . left_sat_0 ) let condition_left_sat_1 = F ( Effect . condition , Condition . left_sat_1 ) let condition_left_sat_2 = F ( Effect . condition , Condition . left_sat_2 ) let condition_right_coeff_0 = F ( Effect . condition , Condition . right_coeff_0 ) let condition_right_coeff_1 = F ( Effect . condition , Condition . right_coeff_1 ) let condition_right_coeff_2 = F ( Effect . condition , Condition . right_coeff_2 ) let condition_left_coeff_0 = F ( Effect . condition , Condition . left_coeff_0 ) let condition_left_coeff_1 = F ( Effect . condition , Condition . left_coeff_1 ) let condition_left_coeff_2 = F ( Effect . condition , Condition . left_coeff_2 ) let condition_deadband_0 = F ( Effect . condition , Condition . deadband_0 ) let condition_deadband_1 = F ( Effect . condition , Condition . deadband_1 ) let condition_deadband_2 = F ( Effect . condition , Condition . deadband_2 ) let condition_center_0 = F ( Effect . condition , Condition . center_0 ) let condition_center_1 = F ( Effect . condition , Condition . center_1 ) let condition_center_2 = F ( Effect . condition , Condition . center_2 ) let ramp = sdl_haptic_ramp let ramp_type = F ( Effect . ramp , Ramp . typ ) let ramp_direction = F ( Effect . ramp , Ramp . direction ) let ramp_length = F ( Effect . ramp , Ramp . length ) let ramp_delay = F ( Effect . ramp , Ramp . delay ) let ramp_button = F ( Effect . ramp , Ramp . button ) let ramp_interval = F ( Effect . ramp , Ramp . interval ) let ramp_start = F ( Effect . ramp , Ramp . start ) let ramp_end = F ( Effect . ramp , Ramp . end_ ) let ramp_attack_length = F ( Effect . ramp , Ramp . attack_length ) let ramp_attack_level = F ( Effect . ramp , Ramp . attack_level ) let ramp_fade_length = F ( Effect . ramp , Ramp . fade_length ) let ramp_fade_level = F ( Effect . ramp , Ramp . fade_level ) let left_right_type = F ( Effect . left_right , Left_right . typ ) let left_right_length = F ( Effect . left_right , Left_right . length ) let left_right_large_magnitude = F ( Effect . left_right , Left_right . large_magnitude ) let left_right_small_magnitude = F ( Effect . left_right , Left_right . small_magnitude ) let custom = sdl_haptic_custom let custom_type = F ( Effect . custom , Custom . typ ) let custom_direction = F ( Effect . custom , Custom . direction ) let custom_length = F ( Effect . custom , Custom . length ) let custom_delay = F ( Effect . custom , Custom . delay ) let custom_button = F ( Effect . custom , Custom . button ) let custom_interval = F ( Effect . custom , Custom . interval ) let custom_channels = F ( Effect . custom , Custom . channels ) let custom_period = F ( Effect . custom , Custom . period ) let custom_samples = F ( Effect . custom , Custom . samples ) let custom_data = F ( Effect . custom , Custom . data ) let custom_attack_length = F ( Effect . custom , Custom . attack_length ) let custom_attack_level = F ( Effect . custom , Custom . attack_level ) let custom_fade_length = F ( Effect . custom , Custom . fade_length ) let custom_fade_level = F ( Effect . custom , Custom . fade_level ) end
type haptic_effect = Haptic . Effect . t union
let haptic_effect_id : int typ = int
let haptic_close = foreign " SDL_HapticClose " ( haptic @-> returning void )
let haptic_destroy_effect = foreign " SDL_HapticDestroyEffect " ( haptic @-> int @-> returning void )
let haptic_effect_supported = foreign " SDL_HapticEffectSupported " ( haptic @-> ptr Haptic . Effect . t @-> returning bool_to_ok )
let haptic_effect_supported h e = haptic_effect_supported h ( addr e )
let haptic_get_effect_status = foreign " SDL_HapticGetEffectStatus " ( haptic @-> haptic_effect_id @-> returning bool_to_ok )
let haptic_index = foreign " SDL_HapticIndex " ( haptic @-> returning nat_to_ok )
let haptic_name = foreign " SDL_HapticName " ( int @-> returning ( some_to_ok string_opt ) )
let haptic_new_effect = foreign " SDL_HapticNewEffect " ( haptic @-> ptr Haptic . Effect . t @-> returning nat_to_ok )
let haptic_new_effect h e = haptic_new_effect h ( addr e )
let haptic_num_axes = foreign " SDL_HapticNumAxes " ( haptic @-> returning nat_to_ok )
let haptic_num_effects = foreign " SDL_HapticNumEffects " ( haptic @-> returning nat_to_ok )
let haptic_num_effects_playing = foreign " SDL_HapticNumEffectsPlaying " ( haptic @-> returning nat_to_ok )
let haptic_open = foreign " SDL_HapticOpen " ( int @-> returning ( some_to_ok haptic_opt ) )
let haptic_open_from_joystick = foreign " SDL_HapticOpenFromJoystick " ( joystick @-> returning ( some_to_ok haptic_opt ) )
let haptic_open_from_mouse = foreign " SDL_HapticOpenFromMouse " ( void @-> returning ( some_to_ok haptic_opt ) )
let haptic_opened = foreign " SDL_HapticOpened " ( int @-> returning int )
let haptic_opened i = match haptic_opened i with
let haptic_pause = foreign " SDL_HapticPause " ( haptic @-> returning zero_to_ok )
let haptic_query = foreign " SDL_HapticQuery " ( haptic @-> returning int )
let haptic_rumble_init = foreign " SDL_HapticRumbleInit " ( haptic @-> returning zero_to_ok )
let haptic_rumble_play = foreign " SDL_HapticRumblePlay " ( haptic @-> float @-> int32_t @-> returning zero_to_ok )
let haptic_rumble_stop = foreign " SDL_HapticRumbleStop " ( haptic @-> returning zero_to_ok )
let haptic_rumble_supported = foreign " SDL_HapticRumbleSupported " ( haptic @-> returning bool_to_ok )
let haptic_run_effect = foreign " SDL_HapticRunEffect " ( haptic @-> haptic_effect_id @-> int32_t @-> returning zero_to_ok )
let haptic_set_autocenter = foreign " SDL_HapticSetAutocenter " ( haptic @-> int @-> returning zero_to_ok )
let haptic_set_gain = foreign " SDL_HapticSetGain " ( haptic @-> int @-> returning zero_to_ok )
let haptic_stop_all = foreign " SDL_HapticStopAll " ( haptic @-> returning zero_to_ok )
let haptic_stop_effect = foreign " SDL_HapticStopEffect " ( haptic @-> haptic_effect_id @-> returning zero_to_ok )
let haptic_unpause = foreign " SDL_HapticUnpause " ( haptic @-> returning zero_to_ok )
let haptic_update_effect = foreign " SDL_HapticUpdateEffect " ( haptic @-> haptic_effect_id @-> ptr Haptic . Effect . t @-> returning zero_to_ok )
let haptic_update_effect h id e = haptic_update_effect h id ( addr e )
let joystick_is_haptic = foreign " SDL_JoystickIsHaptic " ( joystick @-> returning bool_to_ok )
let mouse_is_haptic = foreign " SDL_MouseIsHaptic " ( void @-> returning bool_to_ok )
let num_haptics = foreign " SDL_NumHaptics " ( void @-> returning nat_to_ok )
let audio_init = foreign " SDL_AudioInit " ( string_opt @-> returning zero_to_ok )
let audio_quit = foreign " SDL_AudioQuit " ( void @-> returning void )
let get_audio_driver = foreign " SDL_GetAudioDriver " ( int @-> returning ( some_to_ok string_opt ) )
let get_current_audio_driver = foreign " SDL_GetCurrentAudioDriver " ( void @-> returning string_opt )