sig
exception SDL_failure of string
type byte_array =
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
type init_flag =
TIMER
| AUDIO
| VIDEO
| CDROM
| JOYSTICK
| NOPARACHUTE
| EVENTTHREAD
| EVERYTHING
val init : Sdl.init_flag list -> unit
val quit : unit -> unit
val get_error : unit -> string
module Video :
sig
type video_flag =
SWSURFACE
| HWSURFACE
| ANYFORMAT
| HWPALETTE
| DOUBLEBUF
| FULLSCREEN
| HWACCEL
| SRCCOLORKEY
| RLEACCEL
| SRCALPHA
| SRCCLIPPING
| OPENGL
| RESIZABLE
| NOFRAME
type surface
val surface_pixels : Sdl.Video.surface -> Sdl.byte_array
val surface_width : Sdl.Video.surface -> int
val surface_height : Sdl.Video.surface -> int
val surface_flags : Sdl.Video.surface -> Sdl.Video.video_flag list
val surface_bpp : Sdl.Video.surface -> int
val surface_rmask : Sdl.Video.surface -> int
val surface_gmask : Sdl.Video.surface -> int
val surface_bmask : Sdl.Video.surface -> int
val surface_amask : Sdl.Video.surface -> int
val free_surface : Sdl.Video.surface -> unit
val must_lock : Sdl.Video.surface -> bool
val lock_surface : Sdl.Video.surface -> unit
val unlock_surface : Sdl.Video.surface -> unit
val video_mode_ok :
int -> int -> int -> Sdl.Video.video_flag list -> bool
val set_video_mode :
int -> int -> int -> Sdl.Video.video_flag list -> Sdl.Video.surface
val create_rgb_surface :
Sdl.Video.video_flag list -> int -> int -> int -> Sdl.Video.surface
val load_bmp : string -> Sdl.Video.surface
val save_bmp : Sdl.Video.surface -> string -> unit
val set_color_key :
Sdl.Video.surface -> Sdl.Video.video_flag list -> int32 -> unit
val set_alpha :
Sdl.Video.surface -> Sdl.Video.video_flag list -> int -> unit
val set_clipping :
Sdl.Video.surface -> int -> int -> int -> int -> unit
val disable_clipping : Sdl.Video.surface -> unit
val display_format : Sdl.Video.surface -> Sdl.Video.surface
val get_rgb : Sdl.Video.surface -> int32 -> int * int * int
val get_rgba : Sdl.Video.surface -> int32 -> int * int * int * int
val map_rgb : Sdl.Video.surface -> int -> int -> int -> int32
val map_rgba : Sdl.Video.surface -> int -> int -> int -> int -> int32
type rect = {
mutable rect_x : int;
mutable rect_y : int;
mutable rect_w : int;
mutable rect_h : int;
}
val fill_surface : Sdl.Video.surface -> int32 -> unit
val fill_rect : Sdl.Video.surface -> Sdl.Video.rect -> int32 -> unit
val update_surface : Sdl.Video.surface -> unit
val update_rect : Sdl.Video.surface -> int -> int -> int -> int -> unit
val update_rects : Sdl.Video.surface -> Sdl.Video.rect array -> unit
val flip : Sdl.Video.surface -> unit
val blit_surface :
Sdl.Video.surface ->
Sdl.Video.rect option ->
Sdl.Video.surface -> Sdl.Video.rect option -> unit
type color = { red : int; green : int; blue : int; }
val set_colors :
Sdl.Video.surface -> Sdl.Video.color array -> int -> int -> bool
val show_cursor : bool -> unit
val warp_mouse : int -> int -> unit
val string_of_pixels : Sdl.Video.surface -> string
end
module Window :
sig
val set_caption : string -> string -> unit
val get_caption : unit -> string * string
val set_icon : Sdl.Video.surface -> unit
val iconify_window : unit -> unit
val toggle_fullscreen : Sdl.Video.surface -> unit
val set_grab_input : bool -> unit
val get_grab_input : unit -> bool
end
module SDLGL :
sig
type gl_attr =
RED_SIZE
| GREEN_SIZE
| BLUE_SIZE
| ALPHA_SIZE
| DOUBLEBUFFER
| BUFFER_SIZE
| DEPTH_SIZE
| STENCIL_SIZE
| ACCUM_RED_SIZE
| ACCUM_GREEN_SIZE
| ACCUM_BLUE_SIZE
| ACCUM_ALPHA_SIZE
val swap_buffers : unit -> unit
val load_bmp : string -> Sdl.Video.surface
val set_attribute : Sdl.SDLGL.gl_attr -> int -> unit
val get_attribute : Sdl.SDLGL.gl_attr -> int
end
module Event :
sig
type que_dis_ena = QUERY | DISABLE | ENABLE
type off_on = OFF | ON
type pointer
type app_state = APPMOUSEFOCUS | APPINPUTFOCUS | APPACTIVE
val get_app_state : unit -> Sdl.Event.app_state list
type key =
K_UNKNOWN
| K_FIRST
| K_BACKSPACE
| K_TAB
| K_CLEAR
| K_RETURN
| K_PAUSE
| K_ESCAPE
| K_SPACE
| K_EXCLAIM
| K_QUOTEDBL
| K_HASH
| K_DOLLAR
| K_AMPERSAND
| K_QUOTE
| K_LEFTPAREN
| K_RIGHTPAREN
| K_ASTERISK
| K_PLUS
| K_COMMA
| K_MINUS
| K_PERIOD
| K_SLASH
| K_0
| K_1
| K_2
| K_3
| K_4
| K_5
| K_6
| K_7
| K_8
| K_9
| K_COLON
| K_SEMICOLON
| K_LESS
| K_EQUALS
| K_GREATER
| K_QUESTION
| K_AT
| K_LEFTBRACKET
| K_BACKSLASH
| K_RIGHTBRACKET
| K_CARET
| K_UNDERSCORE
| K_BACKQUOTE
| K_A
| K_B
| K_C
| K_D
| K_E
| K_F
| K_G
| K_H
| K_I
| K_J
| K_K
| K_L
| K_M
| K_N
| K_O
| K_P
| K_Q
| K_R
| K_S
| K_T
| K_U
| K_V
| K_W
| K_X
| K_Y
| K_Z
| K_DELETE
| K_WORLD_0
| K_WORLD_1
| K_WORLD_2
| K_WORLD_3
| K_WORLD_4
| K_WORLD_5
| K_WORLD_6
| K_WORLD_7
| K_WORLD_8
| K_WORLD_9
| K_WORLD_10
| K_WORLD_11
| K_WORLD_12
| K_WORLD_13
| K_WORLD_14
| K_WORLD_15
| K_WORLD_16
| K_WORLD_17
| K_WORLD_18
| K_WORLD_19
| K_WORLD_20
| K_WORLD_21
| K_WORLD_22
| K_WORLD_23
| K_WORLD_24
| K_WORLD_25
| K_WORLD_26
| K_WORLD_27
| K_WORLD_28
| K_WORLD_29
| K_WORLD_30
| K_WORLD_31
| K_WORLD_32
| K_WORLD_33
| K_WORLD_34
| K_WORLD_35
| K_WORLD_36
| K_WORLD_37
| K_WORLD_38
| K_WORLD_39
| K_WORLD_40
| K_WORLD_41
| K_WORLD_42
| K_WORLD_43
| K_WORLD_44
| K_WORLD_45
| K_WORLD_46
| K_WORLD_47
| K_WORLD_48
| K_WORLD_49
| K_WORLD_50
| K_WORLD_51
| K_WORLD_52
| K_WORLD_53
| K_WORLD_54
| K_WORLD_55
| K_WORLD_56
| K_WORLD_57
| K_WORLD_58
| K_WORLD_59
| K_WORLD_60
| K_WORLD_61
| K_WORLD_62
| K_WORLD_63
| K_WORLD_64
| K_WORLD_65
| K_WORLD_66
| K_WORLD_67
| K_WORLD_68
| K_WORLD_69
| K_WORLD_70
| K_WORLD_71
| K_WORLD_72
| K_WORLD_73
| K_WORLD_74
| K_WORLD_75
| K_WORLD_76
| K_WORLD_77
| K_WORLD_78
| K_WORLD_79
| K_WORLD_80
| K_WORLD_81
| K_WORLD_82
| K_WORLD_83
| K_WORLD_84
| K_WORLD_85
| K_WORLD_86
| K_WORLD_87
| K_WORLD_88
| K_WORLD_89
| K_WORLD_90
| K_WORLD_91
| K_WORLD_92
| K_WORLD_93
| K_WORLD_94
| K_WORLD_95
| K_KP0
| K_KP1
| K_KP2
| K_KP3
| K_KP4
| K_KP5
| K_KP6
| K_KP7
| K_KP8
| K_KP9
| K_KP_PERIOD
| K_KP_DIVIDE
| K_KP_MULTIPLY
| K_KP_MINUS
| K_KP_PLUS
| K_KP_ENTER
| K_KP_EQUALS
| K_UP
| K_DOWN
| K_RIGHT
| K_LEFT
| K_INSERT
| K_HOME
| K_END
| K_PAGEUP
| K_PAGEDOWN
| K_F1
| K_F2
| K_F3
| K_F4
| K_F5
| K_F6
| K_F7
| K_F8
| K_F9
| K_F10
| K_F11
| K_F12
| K_F13
| K_F14
| K_F15
| K_NUMLOCK
| K_CAPSLOCK
| K_SCROLLLOCK
| K_RSHIFT
| K_LSHIFT
| K_RCTRL
| K_LCTRL
| K_RALT
| K_LALT
| K_RMETA
| K_LMETA
| K_LSUPER
| K_RSUPER
| K_MODE
| K_COMPOSE
| K_HELP
| K_PRINT
| K_SYSREQ
| K_BREAK
| K_MENU
| K_POWER
| K_EURO
type key_mod =
KMOD_NONE
| KMOD_LSHIFT
| KMOD_RSHIFT
| KMOD_LCTRL
| KMOD_RCTRL
| KMOD_LALT
| KMOD_RALT
| KMOD_LMETA
| KMOD_RMETA
| KMOD_NUM
| KMOD_CAPS
| KMOD_MODE
| KMOD_RESERVED
val enable_unicode : Sdl.Event.que_dis_ena -> Sdl.Event.off_on
val default_repeat_delay : int
val default_repeat_interval : int
val enable_key_repeat : int -> int -> unit
val get_mod_state : unit -> Sdl.Event.key_mod list
val set_mod_state : Sdl.Event.key_mod list -> unit
val get_key_name : Sdl.Event.key -> string
type press_release = RELEASED | PRESSED
type lost_gained = LOST | GAINED
type active_event = {
focus : Sdl.Event.lost_gained;
state : Sdl.Event.app_state;
}
type keyboard_event = {
keystate : Sdl.Event.press_release;
scancode : int;
sym : Sdl.Event.key;
modifiers : Sdl.Event.key_mod list;
unicode : int;
}
type mouse_button = LEFT | MIDDLE | RIGHT | WHEELUP | WHEELDOWN
type mouse_motion_event = {
mousestate : Sdl.Event.press_release;
mx : int;
my : int;
mxrel : int;
myrel : int;
}
type mouse_button_event = {
mousebutton : Sdl.Event.mouse_button;
buttonstate : Sdl.Event.press_release;
bx : int;
by : int;
}
type joy_axis_event = { which_axis : int; axis : int; jvalue : int; }
type joy_ball_event = {
which_ball : int;
ball : int;
jxrel : int;
jyrel : int;
}
type joy_hat_event = { which_hat : int; hat : int; hvalue : int; }
type joy_button_event = {
which_button : int;
joybutton : int;
jstate : Sdl.Event.press_release;
}
type resize_event = { w : int; h : int; }
type user_event = {
code : int;
data1 : Sdl.Event.pointer;
data2 : Sdl.Event.pointer;
}
type sys_wm_event
type event =
NoEvent
| Active of Sdl.Event.active_event
| Key of Sdl.Event.keyboard_event
| Motion of Sdl.Event.mouse_motion_event
| Button of Sdl.Event.mouse_button_event
| Jaxis of Sdl.Event.joy_axis_event
| Jball of Sdl.Event.joy_ball_event
| Jhat of Sdl.Event.joy_hat_event
| Jbutton of Sdl.Event.joy_button_event
| Resize of Sdl.Event.resize_event
| Expose
| Quit
| User of Sdl.Event.user_event
| Syswm of Sdl.Event.sys_wm_event
val pump_events : unit -> unit
val poll_event : unit -> Sdl.Event.event
val wait_event : unit -> Sdl.Event.event
end
module Timer : sig val get_ticks : unit -> int val delay : int -> unit end
module Audio :
sig
type sample_type =
U8
| S8
| U16
| S16
| U16LSB
| S16LSB
| U16MSB
| S16MSB
type audio_status = STOPPED | PAUSED | PLAYING | UNKNOWN
type channel_type = MONO | STEREO
type audio_spec = {
frequency : int;
format : Sdl.Audio.sample_type;
channels : Sdl.Audio.channel_type;
silence : int;
samples : int;
size : int;
}
val mix_maxvolume : int
val open_audio :
Sdl.Audio.audio_spec ->
(Sdl.byte_array -> unit) -> Sdl.Audio.audio_spec
val close_audio : unit -> unit
val load_wav : string -> Sdl.Audio.audio_spec * Sdl.byte_array
val free_wav : Sdl.byte_array -> unit
val pause_audio : bool -> unit
val lock_audio : unit -> unit
val unlock_audio : unit -> unit
val mix_audio : Sdl.byte_array -> Sdl.byte_array -> int -> unit
val get_audio_status : unit -> Sdl.Audio.audio_status
val convert_audio :
Sdl.Audio.sample_type ->
Sdl.Audio.channel_type ->
int ->
Sdl.Audio.sample_type ->
Sdl.Audio.channel_type -> int -> Sdl.byte_array -> Sdl.byte_array
val fx_pan : float -> float -> Sdl.byte_array -> Sdl.byte_array
val fx_shift : float -> Sdl.byte_array -> Sdl.byte_array
end
module Draw :
sig
exception TGA_failure of string
exception Sfont_failure of string
type sfont = {
font_list : (int * Sdl.Video.rect) list;
font_surf : Sdl.Video.surface;
font_space : int;
font_letters : int;
font_line : int;
}
type filter =
BOX of int
| TRIANGLE of int
| BELL of int
| BSPLINE of int
| HERMITE of int
| MITCHELL of int
| LANCZOS3 of int
val box : Sdl.Draw.filter
val triangle : Sdl.Draw.filter
val bell : Sdl.Draw.filter
val bspline : Sdl.Draw.filter
val hermite : Sdl.Draw.filter
val mitchell : Sdl.Draw.filter
val lanczos3 : Sdl.Draw.filter
val put_pixel : Sdl.Video.surface -> int -> int -> int32 -> unit
val get_pixel : Sdl.Video.surface -> int -> int -> int32
val scale :
Sdl.Video.surface -> float -> Sdl.Draw.filter -> Sdl.Video.surface
val scale_to :
Sdl.Video.surface ->
int -> int -> Sdl.Draw.filter -> Sdl.Video.surface
type tga_orientation = From_upper_left | From_lower_left
val read_tga :
string -> int * int * int * string * Sdl.Draw.tga_orientation
val load_tga : string -> Sdl.Video.surface
val make_sfont : Sdl.Video.surface -> Sdl.Draw.sfont
val sfont_print :
string -> int -> int -> Sdl.Draw.sfont -> Sdl.Video.surface -> unit
val make_mipmaps :
Sdl.Video.surface -> Sdl.Draw.filter -> Sdl.Video.surface array
end
end