Tsdl.SdlSDL bindings.
The type for function results. In the error case, the string is what Sdl.get_error returned.
module Init : sig ... endSubsystem flags.
val quit_sub_system : Init.t -> unitmodule Hint : sig ... endval get_hint : Hint.t -> string optionval get_hint_boolean : Hint.t -> bool -> boolval set_hint : Hint.t -> string -> boolval set_hint_with_priority : Hint.t -> string -> Hint.priority -> boolmodule Log : sig ... endval log_critical : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_debug : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_error : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_get_priority : Log.category -> Log.priorityval log_info : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_message : 
  Log.category ->
  Log.priority ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_set_all_priority : Log.priority -> unitval log_set_priority : Log.category -> Log.priority -> unitval log_verbose : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval log_warn : 
  Log.category ->
  ('b, Stdlib.Format.formatter, unit) Stdlib.format ->
  'bval load_file : string -> string resultval get_base_path : unit -> string resultval get_pref_path : org:string -> app:string -> string resultmodule Color : sig ... endmodule Point : sig ... endmodule Fpoint : sig ... endmodule Vertex : sig ... endmodule Rect : sig ... endmodule Frect : sig ... endSDL_EnclosePoints. Returns None if all the points were outside the clipping rectangle (if provided).
See enclose_points. Each consecutive pair in the array defines a point.
val intersect_rect_and_line : 
  rect ->
  int ->
  int ->
  int ->
  int ->
  ((int * int) * (int * int)) optionSDL_IntersectRectAndLine. Returns the clipped segment if it intersects.
val rect_empty : rect -> boolval free_palette : palette -> unitval get_palette_ncolors : palette -> intget_palette_ncolors p is the field ncolors of p.
get_palette_colors p is a copy of the contents of the field colors of s.
get_palette_colors_ba p is a copy of the contents of the field colors of p.
val set_palette_colors_ba : 
  palette ->
  (int, Bigarray.int8_unsigned_elt) bigarray ->
  fst:int ->
  unit resultSee set_palette_colors. Each consecutive quadruplet defines a color. The data is copied.
type gamma_ramp = (int, Bigarray.int16_unsigned_elt) bigarrayThe type for gamma ramps, 256 uint16 values.
val calculate_gamma_ramp : float -> gamma_rampmodule Blend : sig ... endval compose_custom_blend_mode : 
  Blend.factor ->
  Blend.factor ->
  Blend.operation ->
  Blend.factor ->
  Blend.factor ->
  Blend.operation ->
  Blend.modemodule Pixel : sig ... endval alloc_format : Pixel.format_enum -> pixel_format resultval free_format : pixel_format -> unitval get_pixel_format_name : Pixel.format_enum -> stringval get_pixel_format_format : pixel_format -> Pixel.format_enumget_pixel_format_format pf is the field format of pf.
val get_pixel_format_bits_pp : pixel_format -> intget_pixel_format_bits_pp pf is the field BitsPerPixel of pf.
val get_pixel_format_bytes_pp : pixel_format -> intget_pixel_format_bytes_pp pf is the field BytesPerPixel of pf.
val get_rgb : pixel_format -> uint32 -> uint8 * uint8 * uint8val map_rgb : pixel_format -> uint8 -> uint8 -> uint8 -> uint32val masks_to_pixel_format_enum : 
  int ->
  uint32 ->
  uint32 ->
  uint32 ->
  uint32 ->
  Pixel.format_enumval set_pixel_format_palette : pixel_format -> palette -> unit resultNote If you allocated the palette with alloc_palette you can free_palette after.
val convert_pixels : 
  w:int ->
  h:int ->
  src:Pixel.format_enum ->
  ('a, 'b) bigarray ->
  int ->
  dst:Pixel.format_enum ->
  ('c, 'd) bigarray ->
  int ->
  unit resultNote Pitches are given in bigarray elements not in bytes.
Warning. Unsafe, make sure your parameters don't result in invalid access to memory.
val convert_surface : surface -> pixel_format -> surface resultval convert_surface_format : surface -> Pixel.format_enum -> surface resultval create_rgb_surface_from : 
  ('a, 'b) bigarray ->
  w:int ->
  h:int ->
  depth:int ->
  pitch:int ->
  uint32 ->
  uint32 ->
  uint32 ->
  uint32 ->
  surface resultNote The pitch is given in bigarray elements not in bytes.
Warning Unsafe, make sure your parameters don't result in invalid access to memory. The bigarray data is not copied, it must remain valid until free_surface is called on the surface.
val create_rgb_surface_with_format : 
  w:int ->
  h:int ->
  depth:int ->
  Pixel.format_enum ->
  surface resultval create_rgb_surface_with_format_from : 
  ('a, 'b) bigarray ->
  w:int ->
  h:int ->
  depth:int ->
  pitch:int ->
  Pixel.format_enum ->
  surface resultSee fill_rects. Each consecutive quadruplet defines a rectangle.
val free_surface : surface -> unitval get_surface_blend_mode : surface -> Blend.mode resultval get_surface_format_enum : surface -> Pixel.format_enumget_surface_format_neum s is the pixel format enum of the field format of s.
val get_surface_pitch : surface -> intget_surface_pitch s is the field pitch of s.
get_surface_pixels s kind is the field pixels of s viewed as a kind bigarray. Note that you must lock the surface before accessing this.
Warning. The bigarray memory becomes invalid once the surface is unlocked or freed.
val get_surface_size : surface -> int * intget_surface_size s is the fields w and h of s.
val set_surface_blend_mode : surface -> Blend.mode -> unit resultNote If you allocated the palette with alloc_palette you can free_palette after.
val unlock_surface : surface -> unitmodule Flip : sig ... endmodule Renderer : sig ... endtype renderer_info = {ri_name : string;ri_flags : Renderer.flags;ri_texture_formats : Pixel.format_enum list;ri_max_texture_width : int;ri_max_texture_height : int;}val create_renderer : 
  ?index:int ->
  ?flags:Renderer.flags ->
  window ->
  renderer resultval destroy_renderer : renderer -> unitval get_num_render_drivers : unit -> int resultval get_render_draw_blend_mode : renderer -> Blend.mode resultval get_render_driver_info : int -> renderer_info resultval get_renderer_info : renderer -> renderer_info resultSee render_draw_lines. Each consecutive pair in the array defines a point.
See render_draw_points. Each consecutive pair in the array defines a point.
See render_draw_points. Each consecutive pair in the array defines a point.
See render_draw_rects. Each consecutive quadruple in the array defines a rectangle.
See render_draw_rects. Each consecutive quadruple in the array defines a rectangle.
val render_geometry_raw : 
  ?indices:(int32, Bigarray.int32_elt) bigarray ->
  ?texture:texture ->
  renderer ->
  xy:(float, Bigarray.float32_elt) bigarray ->
  ?xy_stride:int ->
  color:(int, Bigarray.int8_unsigned_elt) bigarray ->
  ?color_stride:int ->
  uv:(float, Bigarray.float32_elt) bigarray ->
  ?uv_stride:int ->
  num_vertices:int ->
  unit ->
  unit resultNote. The stride arguments are in bytes, like in the C call. The defaults assume packed arrays.
val render_get_integer_scale : renderer -> boolval render_get_logical_size : renderer -> int * intval render_get_scale : renderer -> float * floatval render_is_clip_enabled : renderer -> boolval render_present : renderer -> unitval render_read_pixels : 
  renderer ->
  rect option ->
  Pixel.format_enum option ->
  ('a, 'b) bigarray ->
  int ->
  unit resultval render_target_supported : renderer -> boolval set_render_draw_blend_mode : renderer -> Blend.mode -> unit resultmodule Texture : sig ... endval create_texture : 
  renderer ->
  Pixel.format_enum ->
  Texture.access ->
  w:int ->
  h:int ->
  texture resultval destroy_texture : texture -> unitval get_texture_blend_mode : texture -> Blend.mode resultval lock_texture : 
  texture ->
  rect option ->
  ('a, 'b) Bigarray.kind ->
  (('a, 'b) bigarray * int) resultNote. The returned pitch is in bigarray element, not in bytes.
val query_texture : 
  texture ->
  (Pixel.format_enum * Texture.access * (int * int)) resultval set_texture_blend_mode : texture -> Blend.mode -> unit resultval unlock_texture : texture -> unitNote The pitch is given in bigarray elements not in bytes.
val get_num_video_drivers : unit -> int resultval get_video_driver : int -> string resultval video_init : string option -> unit resulttype display_mode = {dm_format : Pixel.format_enum;dm_w : int;dm_h : int;dm_refresh_rate : int option;dm_driverdata : driverdata option;}val get_closest_display_mode : int -> display_mode -> display_mode optionval get_current_display_mode : int -> display_mode resultval get_desktop_display_mode : int -> display_mode resultval get_display_dpi : int -> (float * float * float) resultval get_display_mode : int -> int -> display_mode resultval get_display_name : int -> string resultval get_num_display_modes : int -> int resultval get_num_video_displays : unit -> int resultmodule Window : sig ... endval create_window : 
  string ->
  ?x:int ->
  ?y:int ->
  w:int ->
  h:int ->
  Window.flags ->
  window resultx and y default to Window.pos_undefined.
val create_window_and_renderer : 
  w:int ->
  h:int ->
  Window.flags ->
  (window * renderer) resultval destroy_window : window -> unitval get_window_brightness : window -> floatval get_window_display_mode : window -> display_mode resultval get_window_flags : window -> Window.flagsval get_window_gamma_ramp : 
  window ->
  (gamma_ramp * gamma_ramp * gamma_ramp) resultval get_window_grab : window -> boolval get_grabbed_window : unit -> windowval get_window_id : window -> intval get_window_maximum_size : window -> int * intval get_window_minimum_size : window -> int * intval get_window_pixel_format : window -> Pixel.format_enumval get_window_position : window -> int * intval get_window_size : window -> int * intNote. According to SDL's documentation the surface is freed when the window is destroyed.
val get_window_title : window -> stringval hide_window : window -> unitval maximize_window : window -> unitval minimize_window : window -> unitval raise_window : window -> unitval restore_window : window -> unitval set_window_bordered : window -> bool -> unitval set_window_display_mode : window -> display_mode -> unit resultval set_window_fullscreen : window -> Window.flags -> unit resultval set_window_gamma_ramp : 
  window ->
  gamma_ramp ->
  gamma_ramp ->
  gamma_ramp ->
  unit resultval set_window_grab : window -> bool -> unitval set_window_maximum_size : window -> w:int -> h:int -> unitval set_window_minimum_size : window -> w:int -> h:int -> unitval set_window_position : window -> x:int -> y:int -> unitval set_window_resizable : window -> bool -> unitval set_window_size : window -> w:int -> h:int -> unitval set_window_title : window -> string -> unitval show_window : window -> unitSee update_window_surface_rects. Each consecutive quadruplet defines a rectangle.
SDL_GLContext
module Gl : sig ... endval gl_create_context : window -> gl_context resultval gl_delete_context : gl_context -> unitval gl_get_current_context : unit -> gl_context resultval gl_get_drawable_size : window -> int * intval gl_get_swap_interval : unit -> int resultval gl_make_current : window -> gl_context -> unit resultval gl_set_swap_interval : int -> unit resultval gl_swap_window : window -> unitSDL_GL_UnbindTexture Warning Segfaults on SDL 2.0.1 see this report.
module Vulkan : sig ... endmodule Message_box : sig ... endval show_message_box : Message_box.data -> int resultval show_simple_message_box : 
  Message_box.flags ->
  title:string ->
  string ->
  window option ->
  unit resultval get_clipboard_text : unit -> string resultval set_clipboard_text : string -> unit resultval pressed : button_stateval released : button_stateval disable : toggle_stateval enable : toggle_stateval get_keyboard_focus : unit -> window optionval get_keyboard_state : unit -> (int, Bigarray.int8_unsigned_elt) bigarrayval get_key_from_name : string -> keycodeval get_key_name : keycode -> stringval get_mod_state : unit -> keymodval get_scancode_from_name : string -> scancodeval get_scancode_name : scancode -> stringval is_screen_keyboard_shown : window -> boolval set_mod_state : keymod -> unitval set_text_input_rect : rect option -> unitmodule System_cursor : sig ... endmodule Button : sig ... endval capture_mouse : bool -> unit resultval create_system_cursor : System_cursor.t -> cursor resultval free_cursor : cursor -> unitval get_cursor : unit -> cursor optionval get_default_cursor : unit -> cursor optionval get_global_mouse_state : unit -> uint32 * (int * int)val get_mouse_focus : unit -> window optionval get_mouse_state : unit -> uint32 * (int * int)val get_relative_mouse_state : unit -> uint32 * (int * int)val get_cursor_shown : unit -> bool resultSDL_ShowCursor with SDL_QUERY.
val set_cursor : cursor option -> unitval set_relative_mouse_mode : bool -> unit resultval show_cursor : bool -> bool resultSDL_ShowCursor. See also get_cursor_shown.
val warp_mouse_global : x:int -> y:int -> unit resultval warp_mouse_in_window : window option -> x:int -> y:int -> unitval touch_mouse_id : touch_idmodule Finger : sig ... endval get_num_touch_fingers : touch_id -> intval save_dollar_template : gesture_id -> rw_ops -> unit resultmodule Hat : sig ... endmodule Joystick_power_level : sig ... endmodule Joystick_type : sig ... endval joystick_close : joystick -> unitval joystick_current_power_level : joystick -> Joystick_power_level.tval joystick_from_instance_id : joystick_id -> joystickval joystick_get_device_instance_id : int -> joystick_idval joystick_get_device_product : int -> int16val joystick_get_device_product_version : int -> int16val joystick_get_device_type : int -> Joystick_type.tval joystick_get_device_vendor : int -> int16val joystick_get_event_state : unit -> toggle_state resultSDL_JoystickEventState with SDL_QUERY.
val joystick_set_event_state : toggle_state -> toggle_state resultSDL_JoystickEventState. See also joystick_get_event_state.
val joystick_get_attached : joystick -> boolval joystick_get_device_guid : int -> joystick_guidval joystick_get_guid : joystick -> joystick_guidval joystick_get_guid_from_string : string -> joystick_guidval joystick_get_guid_string : joystick_guid -> stringval joystick_get_type : joystick -> Joystick_type.tval joystick_instance_id : joystick -> joystick_id resultval joystick_name_for_index : int -> string resultval num_joysticks : unit -> int resultmodule Controller : sig ... endval game_controller_add_mapping : string -> bool resultSDL_GameControllerAddMappingsFromFile (SDL 2.0.2).
val game_controller_close : game_controller -> unitval game_controller_from_instance_id : joystick_id -> game_controllerval game_controller_get_event_state : unit -> toggle_state resultSDL_GameControllerEventState with SDL_QUERY
val game_controller_set_event_state : toggle_state -> toggle_state resultval game_controller_get_attached : game_controller -> boolval game_controller_get_axis : game_controller -> Controller.axis -> int16val game_controller_get_axis_from_string : string -> Controller.axisval game_controller_get_bind_for_axis : 
  game_controller ->
  Controller.axis ->
  Controller.button_bindval game_controller_get_bind_for_button : 
  game_controller ->
  Controller.button ->
  Controller.button_bindval game_controller_get_button : game_controller -> Controller.button -> uint8val game_controller_get_button_from_string : string -> Controller.buttonval game_controller_get_joystick : game_controller -> joystick resultval game_controller_get_product : game_controller -> uint16val game_controller_get_product_version : game_controller -> uint16val game_controller_get_string_for_axis : Controller.axis -> string optionval game_controller_get_string_for_button : Controller.button -> string optionval game_controller_get_vendor : game_controller -> uint16val game_controller_mapping : game_controller -> string resultval game_controller_mapping_for_index : int -> string resultval game_controller_mapping_for_guid : joystick_guid -> string resultval game_controller_name : game_controller -> string resultval game_controller_name_for_index : int -> string resultval game_controller_open : int -> game_controller resultSDL_EventType. See Event for constants.
module Event : sig ... endevent accessors and event_type constants and enumeration.
val get_event_state : event_type -> toggle_stateSDL_EventState with SDL_QUERY.
val set_event_state : event_type -> toggle_state -> unitSDL_EventState. See also get_event_state.
val flush_event : event_type -> unitval flush_events : event_type -> event_type -> unitval has_event : event_type -> boolval has_events : event_type -> event_type -> boolval poll_event : event option -> boolval register_event : unit -> event_type optionSDL_RegisterEvents called with 1.
val wait_event_timeout : event option -> int -> boolmodule Haptic : sig ... endval haptic_close : haptic -> unitval haptic_destroy_effect : haptic -> haptic_effect_id -> unitval haptic_effect_supported : haptic -> haptic_effect -> bool resultval haptic_get_effect_status : haptic -> haptic_effect_id -> bool resultval haptic_name : int -> string resultval haptic_new_effect : haptic -> haptic_effect -> haptic_effect_id resultval haptic_query : haptic -> intval haptic_run_effect : haptic -> haptic_effect_id -> uint32 -> unit resultval haptic_stop_effect : haptic -> haptic_effect_id -> unit resultval haptic_update_effect : 
  haptic ->
  haptic_effect_id ->
  haptic_effect ->
  unit resultval mouse_is_haptic : unit -> bool resultval num_haptics : unit -> int resultmodule Audio : sig ... endval audio_init : string option -> unit resultval get_audio_driver : int -> string resultval get_num_audio_drivers : unit -> int resulttype audio_device_id = uint32val audio_callback : 
  ('a, 'b) Bigarray.kind ->
  (('a, 'b) bigarray -> unit) ->
  audio_callbackaudio_callback k f is an audio callback. A reference needs to be kept on the callback value until it is no longer needed.
type audio_spec = {as_freq : int;as_format : Audio.format;as_channels : uint8;as_silence : uint8;as_samples : uint8;as_size : uint32;as_callback : audio_callback option;}val close_audio_device : audio_device_id -> unitval free_wav : ('a, 'b) bigarray -> unitval get_audio_device_name : int -> bool -> string resultval get_audio_device_status : audio_device_id -> Audio.statusval get_num_audio_devices : bool -> int resultval load_wav_rw : 
  rw_ops ->
  audio_spec ->
  ('a, 'b) Bigarray.kind ->
  (audio_spec * ('a, 'b) bigarray) resultval lock_audio_device : audio_device_id -> unitval open_audio_device : 
  string option ->
  bool ->
  audio_spec ->
  Audio.allow ->
  (audio_device_id * audio_spec) resultval pause_audio_device : audio_device_id -> bool -> unitval unlock_audio_device : audio_device_id -> unitval queue_audio : audio_device_id -> ('a, 'b) bigarray -> unit resultval dequeue_audio : audio_device_id -> ('a, 'b) bigarray -> intval get_queued_audio_size : audio_device_id -> intval clear_queued_audio : audio_device_id -> unitval get_ticks : unit -> uint32val get_ticks64 : unit -> uint64val get_performance_counter : unit -> uint64val get_performance_frequency : unit -> uint64val get_cpu_cache_line_size : unit -> int resultSDL_HasAVX (SDL 2.0.2)
SDL_HasAVX2 (SDL 2.0.4)
val get_power_info : unit -> power_infoEverything except the following functions/categories are available.
void * type in the interface)void * type in the interface)