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 axi...
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_Contr...
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 mod...
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 )