Page
Library
Module
Module type
Parameter
Class
Class type
Source
Tsdl.SdlSourceSDL bindings.
The type for unsigned 8-bit integers.
The type for signed 16-bit integers.
The type for unsigned 16-bit integers.
The type for unsigned 32-bit integers.
The type for unsigned 64-bit integers.
The type for bigarrays.
The type for function results. In the error case, the string is what Sdl.get_error returned.
structure SDL_FPoint
structure SDL_FRect
SDL_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.
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.
The type for gamma ramps, 256 uint16 values.
val compose_custom_blend_mode :
Blend.factor ->
Blend.factor ->
Blend.operation ->
Blend.factor ->
Blend.factor ->
Blend.operation ->
Blend.modeget_pixel_format_format pf is the field format of pf.
get_pixel_format_bits_pp pf is the field BitsPerPixel of pf.
get_pixel_format_bytes_pp pf is the field BytesPerPixel of pf.
Note 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 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.
get_surface_format_neum s is the pixel format enum of the field format 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.
Note If you allocated the palette with alloc_palette you can free_palette after.
type 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;}See 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.
val render_draw_points_f_ba :
renderer ->
(float, Bigarray.float32_elt) bigarray ->
unit resultSee 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 create_texture :
renderer ->
Pixel.format_enum ->
Texture.access ->
w:int ->
h:int ->
texture 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.
Note The pitch is given in bigarray elements not in bytes.
val update_yuv_texture :
texture ->
rect option ->
y:(int, Bigarray.int8_unsigned_elt) bigarray ->
int ->
u:(int, Bigarray.int8_unsigned_elt) bigarray ->
int ->
v:(int, Bigarray.int8_unsigned_elt) bigarray ->
int ->
unit resultNote. Nothing can be done with that.
type display_mode = {dm_format : Pixel.format_enum;dm_w : int;dm_h : int;dm_refresh_rate : int option;dm_driverdata : driverdata option;}val create_window :
string ->
?x:int ->
?y:int ->
w:int ->
h:int ->
Window.flags ->
window resultx and y default to Window.pos_undefined.
Note. According to SDL's documentation the surface is freed when the window is destroyed.
val update_window_surface_rects_ba :
window ->
(int32, Bigarray.int32_elt) bigarray ->
unit resultSee update_window_surface_rects. Each consecutive quadruplet defines a rectangle.
SDL_GLContext
SDL_GL_UnbindTexture Warning Segfaults on SDL 2.0.1 see this report.
val show_simple_message_box :
Message_box.flags ->
title:string ->
string ->
window option ->
unit resultval create_cursor :
(int, Bigarray.int8_unsigned_elt) bigarray ->
(int, Bigarray.int8_unsigned_elt) bigarray ->
w:int ->
h:int ->
hot_x:int ->
hot_y:int ->
cursor resultSDL_ShowCursor with SDL_QUERY.
SDL_ShowCursor. See also get_cursor_shown.
SDL_JoystickEventState with SDL_QUERY.
SDL_JoystickEventState. See also joystick_get_event_state.
SDL_GameControllerAddMappingsFromFile (SDL 2.0.2).
SDL_GameControllerEventState with SDL_QUERY
val 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_bindSDL_EventType. See Event for constants.
event accessors and event_type constants and enumeration.
SDL_EventState with SDL_QUERY.
SDL_EventState. See also get_event_state.
SDL_RegisterEvents called with 1.
The type for audio callbacks.
audio_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 load_wav_rw :
rw_ops ->
audio_spec ->
('a, 'b) Bigarray.kind ->
(audio_spec * ('a, 'b) bigarray) resultval open_audio_device :
string option ->
bool ->
audio_spec ->
Audio.allow ->
(audio_device_id * audio_spec) resultSDL_HasAVX (SDL 2.0.2)
SDL_HasAVX2 (SDL 2.0.4)
( 2.06.0 )
Everything except the following functions/categories are available.
void * type in the interface)void * type in the interface)