text
stringlengths 12
786k
|
---|
let _ = field joystick_guid " data8 " uint8_t
|
let _ = field joystick_guid " data9 " uint8_t
|
let _ = field joystick_guid " data10 " uint8_t
|
let _ = field joystick_guid " data11 " uint8_t
|
let _ = field joystick_guid " data12 " uint8_t
|
let _ = field joystick_guid " data13 " uint8_t
|
let _ = field joystick_guid " data14 " uint8_t
|
let _ = field joystick_guid " data15 " uint8_t
|
let ( ) = seal joystick_guid
|
type joystick = unit ptr
|
let joystick : joystick typ = ptr void
|
let joystick_opt : joystick option typ = ptr_opt void
|
let unsafe_joystick_of_ptr addr : joystick = ptr_of_raw_address addr
|
let unsafe_ptr_of_joystick joystick = raw_address_of_ptr ( to_voidp joystick )
|
module Hat = struct type t = int let centered = sdl_hat_centered let up = sdl_hat_up let right = sdl_hat_right let down = sdl_hat_down let left = sdl_hat_left let rightup = sdl_hat_rightup let rightdown = sdl_hat_rightdown let leftup = sdl_hat_leftup let leftdown = sdl_hat_leftdown end
|
module Joystick_power_level = struct type t = int let unknown = sdl_joystick_power_unknown let low = sdl_joystick_power_low let medium = sdl_joystick_power_medium let full = sdl_joystick_power_full let wired = sdl_joystick_power_wired let max = sdl_joystick_power_max end
|
module Joystick_type = struct type t = int let unknown = sdl_joystick_type_unknown let gamecontroller = sdl_joystick_type_gamecontroller let wheel = sdl_joystick_type_wheel let arcade_stick = sdl_joystick_type_arcade_stick let flight_stick = sdl_joystick_type_flight_stick let dance_pad = sdl_joystick_type_dance_pad let guitar = sdl_joystick_type_guitar let drum_kit = sdl_joystick_type_drum_kit let arcade_pad = sdl_joystick_type_arcade_pad let throttle = sdl_joystick_type_throttle end
|
let joystick_close = foreign " SDL_JoystickClose " ( joystick @-> returning void )
|
let joystick_current_power_level = foreign " SDL_JoystickCurrentPowerLevel " ( joystick @-> returning int )
|
let joystick_event_state = foreign " SDL_JoystickEventState " ( int @-> returning nat_to_ok )
|
let joystick_from_instance_id = foreign " SDL_JoystickFromInstanceID " ( joystick_id @-> returning joystick )
|
let joystick_get_event_state ( ) = joystick_event_state sdl_query
|
let joystick_set_event_state s = joystick_event_state s
|
let joystick_get_attached = foreign " SDL_JoystickGetAttached " ( joystick @-> returning bool )
|
let joystick_get_axis = foreign " SDL_JoystickGetAxis " ( joystick @-> int @-> returning int16_t )
|
let joystick_get_axis_initial_state = foreign " SDL_JoystickGetAxisInitialState " ( joystick @-> int @-> returning int16_t )
|
let joystick_get_ball = foreign " SDL_JoystickGetBall " ( joystick @-> int @-> ( ptr int ) @-> ( ptr int ) @-> returning int )
|
let joystick_get_ball j i = let x = allocate int 0 in let y = allocate int 0 in match joystick_get_ball j i x y with | 0 -> Ok ( !@ x , !@ y ) | _ -> error ( )
|
let joystick_get_button = foreign " SDL_JoystickGetButton " ( joystick @-> int @-> returning int_as_uint8_t )
|
let joystick_get_device_guid = foreign " SDL_JoystickGetDeviceGUID " ( int @-> returning joystick_guid )
|
let joystick_get_device_product = foreign " SDL_JoystickGetDeviceProduct " ( int @-> returning int_as_uint16_t )
|
let joystick_get_device_product_version = foreign " SDL_JoystickGetDeviceProductVersion " ( int @-> returning int_as_uint16_t )
|
let joystick_get_device_type = foreign " SDL_JoystickGetDeviceType " ( int @-> returning int )
|
let joystick_get_device_instance_id = foreign " SDL_JoystickGetDeviceInstanceID " ( int @-> returning joystick_id )
|
let joystick_get_device_vendor = foreign " SDL_JoystickGetDeviceVendor " ( int @-> returning int_as_uint16_t )
|
let joystick_get_guid = foreign " SDL_JoystickGetGUID " ( joystick @-> returning joystick_guid )
|
let joystick_get_guid_from_string = foreign " SDL_JoystickGetGUIDFromString " ( string @-> returning joystick_guid )
|
let joystick_get_guid_string = foreign " SDL_JoystickGetGUIDString " ( joystick_guid @-> ptr char @-> int @-> returning void )
|
let joystick_get_guid_string guid = let len = 33 in let s = CArray . start ( CArray . make char 33 ) in joystick_get_guid_string guid s len ; coerce ( ptr char ) string s
|
let joystick_get_hat = foreign " SDL_JoystickGetHat " ( joystick @-> int @-> returning int_as_uint8_t )
|
let joystick_get_product = foreign " SDL_JoystickGetProduct " ( joystick @-> returning int_as_uint16_t )
|
let joystick_get_product_version = foreign " SDL_JoystickGetProductVersion " ( joystick @-> returning int_as_uint16_t )
|
let joystick_get_type = foreign " SDL_JoystickGetType " ( joystick @-> returning int )
|
let joystick_get_vendor = foreign " SDL_JoystickGetVendor " ( joystick @-> returning int_as_uint16_t )
|
let joystick_instance_id = foreign " SDL_JoystickInstanceID " ( joystick @-> returning joystick_id )
|
let joystick_instance_id j = match joystick_instance_id j with | n when n < 0l -> error ( ) | n -> Ok n
|
let joystick_name = foreign " SDL_JoystickName " ( joystick @-> returning ( some_to_ok string_opt ) )
|
let joystick_name_for_index = foreign " SDL_JoystickNameForIndex " ( int @-> returning ( some_to_ok string_opt ) )
|
let joystick_num_axes = foreign " SDL_JoystickNumAxes " ( joystick @-> returning nat_to_ok )
|
let joystick_num_balls = foreign " SDL_JoystickNumBalls " ( joystick @-> returning nat_to_ok )
|
let joystick_num_buttons = foreign " SDL_JoystickNumButtons " ( joystick @-> returning nat_to_ok )
|
let joystick_num_hats = foreign " SDL_JoystickNumHats " ( joystick @-> returning nat_to_ok )
|
let joystick_open = foreign " SDL_JoystickOpen " ( int @-> returning ( some_to_ok joystick_opt ) )
|
let joystick_update = foreign " SDL_JoystickUpdate " ( void @-> returning void )
|
let num_joysticks = foreign " SDL_NumJoysticks " ( void @-> returning nat_to_ok )
|
type game_controller = unit ptr
|
let game_controller : game_controller typ = ptr void
|
let game_controller_opt : game_controller option typ = ptr_opt void
|
let unsafe_game_controller_of_ptr addr : game_controller = ptr_of_raw_address addr
|
let unsafe_ptr_of_game_controller game_controller = raw_address_of_ptr ( to_voidp game_controller )
|
let button_bind : _button_bind structure typ = structure " SDL_GameControllerBindType "
|
let button_bind_bind_type = field button_bind " bindType " int
|
let button_bind_value1 = field button_bind " value1 " int
|
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 )
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.