text
stringlengths 0
601k
|
---|
let set_window_maximum_size = foreign " SDL_SetWindowMaximumSize " ( window @-> int @-> int @-> returning void ) |
let set_window_maximum_size win ~ w ~ h = set_window_maximum_size win w h |
let set_window_minimum_size = foreign " SDL_SetWindowMinimumSize " ( window @-> int @-> int @-> returning void ) |
let set_window_minimum_size win ~ w ~ h = set_window_minimum_size win w h |
let set_window_modal_for = foreign " SDL_SetWindowModalFor " ( window @-> window @-> returning zero_to_ok ) |
let set_window_modal_for ~ modal ~ parent = set_window_modal_for modal parent |
let set_window_opacity = foreign " SDL_SetWindowOpacity " ( window @-> float @-> returning zero_to_ok ) |
let set_window_position = foreign " SDL_SetWindowPosition " ( window @-> int @-> int @-> returning void ) |
let set_window_position win ~ x ~ y = set_window_position win x y |
let set_window_resizable = foreign " SDL_SetWindowResizable " ( window @-> bool @-> returning void ) |
let set_window_size = foreign " SDL_SetWindowSize " ( window @-> int @-> int @-> returning void ) |
let set_window_size win ~ w ~ h = set_window_size win w h |
let set_window_title = foreign " SDL_SetWindowTitle " ( window @-> string @-> returning void ) |
let show_window = foreign " SDL_ShowWindow " ( window @-> returning void ) |
let update_window_surface = foreign " SDL_UpdateWindowSurface " ( window @-> returning zero_to_ok ) |
let update_window_surface_rects = foreign " SDL_UpdateWindowSurfaceRects " ( window @-> ptr void @-> int @-> returning zero_to_ok ) |
let update_window_surface_rects_ba w rs = let len = Bigarray . Array1 . dim rs in if len mod 4 <> 0 then invalid_arg ( err_length_mul len 4 ) else let count = len / 4 in let rs = to_voidp ( bigarray_start array1 rs ) in update_window_surface_rects w rs count |
let update_window_surface_rects w rs = let count = List . length rs in let rs = to_voidp ( CArray . start ( CArray . of_list rect rs ) ) in update_window_surface_rects w rs count |
type gl_context = unit ptr |
let gl_context : unit ptr typ = ptr void |
let gl_context_opt : unit ptr option typ = ptr_opt void |
let unsafe_gl_context_of_ptr addr : gl_context = ptr_of_raw_address addr |
let unsafe_ptr_of_gl_context gl_context = raw_address_of_ptr ( to_voidp gl_context ) |
module Gl = struct type context_flags = int let context_debug_flag = sdl_gl_context_debug_flag let context_forward_compatible_flag = sdl_gl_context_forward_compatible_flag let context_robust_access_flag = sdl_gl_context_robust_access_flag let context_reset_isolation_flag = sdl_gl_context_reset_isolation_flag type profile = int let context_profile_core = sdl_gl_context_profile_core let context_profile_compatibility = sdl_gl_context_profile_compatibility let context_profile_es = sdl_gl_context_profile_es type attr = int let red_size = sdl_gl_red_size let green_size = sdl_gl_green_size let blue_size = sdl_gl_blue_size let alpha_size = sdl_gl_alpha_size let buffer_size = sdl_gl_buffer_size let doublebuffer = sdl_gl_doublebuffer let depth_size = sdl_gl_depth_size let stencil_size = sdl_gl_stencil_size let accum_red_size = sdl_gl_accum_red_size let accum_green_size = sdl_gl_accum_green_size let accum_blue_size = sdl_gl_accum_blue_size let accum_alpha_size = sdl_gl_accum_alpha_size let stereo = sdl_gl_stereo let multisamplebuffers = sdl_gl_multisamplebuffers let multisamplesamples = sdl_gl_multisamplesamples let accelerated_visual = sdl_gl_accelerated_visual let context_major_version = sdl_gl_context_major_version let context_minor_version = sdl_gl_context_minor_version let context_egl = sdl_gl_context_egl let context_flags = sdl_gl_context_flags let context_profile_mask = sdl_gl_context_profile_mask let context_release_behavior = sdl_gl_context_release_behavior let share_with_current_context = sdl_gl_share_with_current_context let framebuffer_srgb_capable = sdl_gl_framebuffer_srgb_capable end |
let gl_bind_texture = foreign " SDL_GL_BindTexture " ( texture @-> ptr float @-> ptr float @-> returning zero_to_ok ) |
let gl_bind_texture t = let w = allocate float 0 . in let h = allocate float 0 . in match gl_bind_texture t w h with | Ok ( ) -> Ok ( !@ w , !@ h ) | Error _ as e -> e |
let gl_create_context = foreign " SDL_GL_CreateContext " ( window @-> returning ( some_to_ok gl_context_opt ) ) |
let gl_delete_context = foreign " SDL_GL_DeleteContext " ( gl_context @-> returning void ) |
let gl_extension_supported = foreign " SDL_GL_ExtensionSupported " ( string @-> returning bool ) |
let gl_get_attribute = foreign " SDL_GL_GetAttribute " ( int @-> ( ptr int ) @-> returning int ) |
let gl_get_attribute att = let value = allocate int 0 in match gl_get_attribute att value with | 0 -> Ok ( !@ value ) | err -> error ( ) |
let gl_get_current_context = foreign " SDL_GL_GetCurrentContext " ( void @-> returning ( some_to_ok gl_context_opt ) ) |
let gl_get_drawable_size = foreign " SDL_GL_GetDrawableSize " ( window @-> ptr int @-> ptr int @-> returning void ) |
let gl_get_drawable_size win = let w = allocate int 0 in let h = allocate int 0 in gl_get_drawable_size win w h ; ( !@ w , !@ h ) |
let gl_get_swap_interval = foreign " SDL_GL_GetSwapInterval " ( void @-> returning nat_to_ok ) |
let gl_make_current = foreign " SDL_GL_MakeCurrent " ( window @-> gl_context @-> returning zero_to_ok ) |
let gl_reset_attributes = foreign " SDL_GL_ResetAttributes " ~ stub ( void @-> returning void ) |
let gl_set_attribute = foreign " SDL_GL_SetAttribute " ( int @-> int @-> returning zero_to_ok ) |
let gl_set_swap_interval = foreign " SDL_GL_SetSwapInterval " ( int @-> returning zero_to_ok ) |
let gl_swap_window = foreign " SDL_GL_SwapWindow " ( window @-> returning void ) |
let gl_unbind_texture = foreign " SDL_GL_UnbindTexture " ( texture @-> returning zero_to_ok ) |
module Vulkan = struct type instance = unit ptr let instance = ptr void let unsafe_ptr_of_instance = raw_address_of_ptr let unsafe_instance_of_ptr x = ptr_of_raw_address x type surface = uint64 let surface = int64_t let unsafe_uint64_of_surface x = x let unsafe_surface_of_uint64 x = x let load_library = foreign " SDL_Vulkan_LoadLibrary " ( string_opt @-> returning zero_to_ok ) let unload_library = foreign " SDL_Vulkan_UnloadLibrary " ( void @-> returning void ) let get_instance_extensions = foreign " SDL_Vulkan_GetInstanceExtensions " ( window @-> ptr int @-> ptr string @-> returning bool ) let get_instance_extensions window = let n = allocate int 0 in match get_instance_extensions window n ( Ctypes . coerce ( ptr void ) ( ptr string ) null ) with | false -> None | true -> let exts = allocate_n string ( !@ n ) in match get_instance_extensions window n exts with | false -> None | true -> Some CArray . ( to_list @@ from_ptr exts ( !@ n ) ) let create_surface = foreign " SDL_Vulkan_CreateSurface " ( window @-> instance @-> ptr surface @-> returning bool ) let create_surface window instance = let s = allocate_n surface 1 in if create_surface window instance s then Some !@ s else None let get_drawable_size = foreign " SDL_Vulkan_GetDrawableSize " ( window @-> ptr int @-> ptr int @-> returning void ) let get_drawable_size window = let w = allocate int 0 in let h = allocate int 0 in get_drawable_size window w h ; !@ w , !@ h end |
let disable_screen_saver = foreign " SDL_DisableScreenSaver " ( void @-> returning void ) |
let enable_screen_saver = foreign " SDL_EnableScreenSaver " ( void @-> returning void ) |
let is_screen_saver_enabled = foreign " SDL_IsScreenSaverEnabled " ( void @-> returning bool ) |
module Message_box = struct let i = Unsigned . UInt32 . of_int type button_flags = Unsigned . uint32 let button_no_default = i 0 let button_returnkey_default = i sdl_messagebox_button_returnkey_default let button_escapekey_default = i sdl_messagebox_button_escapekey_default type button_data = { button_flags : button_flags ; button_id : int ; button_text : string } let button_data = structure " SDL_MessageBoxButtonData " let button_flags = field button_data " flags " uint32_t let button_buttonid = field button_data " buttonid " int let button_text = field button_data " text " string let ( ) = seal button_data type flags = Unsigned . uint32 let error = i sdl_messagebox_error let warning = i sdl_messagebox_warning let information = i sdl_messagebox_information type color = int * int * int let color = structure " SDL_MessageBoxColor " let color_r = field color " r " uint8_t let color_g = field color " g " uint8_t let color_b = field color " b " uint8_t let ( ) = seal color type color_type = int let color_background = sdl_messagebox_color_background let color_text = sdl_messagebox_color_text let color_button_border = sdl_messagebox_color_button_border let color_button_background = sdl_messagebox_color_button_background let color_button_selected = sdl_messagebox_color_button_selected let color_button_max = sdl_messagebox_color_max type color_scheme = { color_background : color ; color_text : color ; color_button_border : color ; color_button_background : color ; color_button_selected : color ; } let color_scheme = structure " SDL_MessageBoxColorScheme " let colors = field color_scheme " colors " ( array color_button_max color ) let ( ) = seal color_scheme type data = { flags : flags ; window : window option ; title : string ; message : string ; buttons : button_data list ; color_scheme : color_scheme option } let data = structure " SDL_MessageBoxData " let d_flags = field data " flags " uint32_t let d_window = field data " window " window let d_title = field data " title " string let d_message = field data " message " string let d_numbuttons = field data " numbuttons " int let d_buttons = field data " buttons " ( ptr button_data ) let d_color_scheme = field data " colorScheme " ( ptr color_scheme ) let ( ) = seal data let buttons_to_c bl = let button_data_to_c b = let bt = make button_data in setf bt button_flags b . button_flags ; setf bt button_buttonid b . button_id ; setf bt button_text b . button_text ; bt in CArray . start ( CArray . of_list button_data ( List . map button_data_to_c bl ) ) let color_scheme_to_c s = let st = make color_scheme in let colors = getf st colors in let set i ( rv , gv , bv ) = let ct = CArray . get colors i in setf ct color_r ( Unsigned . UInt8 . of_int rv ) ; setf ct color_g ( Unsigned . UInt8 . of_int rv ) ; setf ct color_b ( Unsigned . UInt8 . of_int rv ) ; in set color_background s . color_background ; set color_text s . color_text ; set color_button_border s . color_button_border ; set color_button_background s . color_button_background ; set color_button_selected s . color_button_selected ; st let data_to_c d = let dt = make data in setf dt d_flags d . flags ; setf dt d_window ( match d . window with None -> null | Some w -> w ) ; setf dt d_title d . title ; setf dt d_message d . message ; setf dt d_numbuttons ( List . length d . buttons ) ; setf dt d_buttons ( buttons_to_c d . buttons ) ; setf dt d_color_scheme begin match d . color_scheme with | None -> coerce ( ptr void ) ( ptr color_scheme ) null | Some s -> addr ( color_scheme_to_c s ) end ; dt end |
let show_message_box = foreign " SDL_ShowMessageBox " ( ptr Message_box . data @-> ptr int @-> returning zero_to_ok ) |
let show_message_box d = let d = addr ( Message_box . data_to_c d ) in let ret = allocate int 0 in match show_message_box d ret with | Ok ( ) -> Ok ( !@ ret ) | Error _ as e -> e |
let show_simple_message_box = foreign " SDL_ShowSimpleMessageBox " ( uint32_t @-> string @-> string @-> window_opt @-> returning zero_to_ok ) |
let show_simple_message_box t ~ title msg w = show_simple_message_box t title msg w |
let get_clipboard_text = foreign " SDL_GetClipboardText " ( void @-> returning ( ptr char ) ) |
let get_clipboard_text ( ) = let p = get_clipboard_text ( ) in if ( to_voidp p ) = null then error ( ) else let b = Buffer . create 255 in let ptr = ref p in while ( !@ ! ptr ) <> ' \ 000 ' do Buffer . add_char b ( !@ ! ptr ) ; ptr := ! ptr +@ 1 ; done ; sdl_free ( to_voidp p ) ; Ok ( Buffer . contents b ) |
let has_clipboard_text = foreign " SDL_HasClipboardText " ( void @-> returning bool ) |
let set_clipboard_text = foreign " SDL_SetClipboardText " ( string @-> returning zero_to_ok ) |
module Scancode = struct let num_scancodes = sdl_num_scancodes let unknown = sdl_scancode_unknown let a = sdl_scancode_a let b = sdl_scancode_b let c = sdl_scancode_c let d = sdl_scancode_d let e = sdl_scancode_e let f = sdl_scancode_f let g = sdl_scancode_g let h = sdl_scancode_h let i = sdl_scancode_i let j = sdl_scancode_j let k = sdl_scancode_k let l = sdl_scancode_l let m = sdl_scancode_m let n = sdl_scancode_n let o = sdl_scancode_o let p = sdl_scancode_p let q = sdl_scancode_q let r = sdl_scancode_r let s = sdl_scancode_s let t = sdl_scancode_t let u = sdl_scancode_u let v = sdl_scancode_v let w = sdl_scancode_w let x = sdl_scancode_x let y = sdl_scancode_y let z = sdl_scancode_z let k1 = sdl_scancode_1 let k2 = sdl_scancode_2 let k3 = sdl_scancode_3 let k4 = sdl_scancode_4 let k5 = sdl_scancode_5 let k6 = sdl_scancode_6 let k7 = sdl_scancode_7 let k8 = sdl_scancode_8 let k9 = sdl_scancode_9 let k0 = sdl_scancode_0 let return = sdl_scancode_return let escape = sdl_scancode_escape let backspace = sdl_scancode_backspace let tab = sdl_scancode_tab let space = sdl_scancode_space let minus = sdl_scancode_minus let equals = sdl_scancode_equals let leftbracket = sdl_scancode_leftbracket let rightbracket = sdl_scancode_rightbracket let backslash = sdl_scancode_backslash let nonushash = sdl_scancode_nonushash let semicolon = sdl_scancode_semicolon let apostrophe = sdl_scancode_apostrophe let grave = sdl_scancode_grave let comma = sdl_scancode_comma let period = sdl_scancode_period let slash = sdl_scancode_slash let capslock = sdl_scancode_capslock let f1 = sdl_scancode_f1 let f2 = sdl_scancode_f2 let f3 = sdl_scancode_f3 let f4 = sdl_scancode_f4 let f5 = sdl_scancode_f5 let f6 = sdl_scancode_f6 let f7 = sdl_scancode_f7 let f8 = sdl_scancode_f8 let f9 = sdl_scancode_f9 let f10 = sdl_scancode_f10 let f11 = sdl_scancode_f11 let f12 = sdl_scancode_f12 let printscreen = sdl_scancode_printscreen let scrolllock = sdl_scancode_scrolllock let pause = sdl_scancode_pause let insert = sdl_scancode_insert let home = sdl_scancode_home let pageup = sdl_scancode_pageup let delete = sdl_scancode_delete let kend = sdl_scancode_end let pagedown = sdl_scancode_pagedown let right = sdl_scancode_right let left = sdl_scancode_left let down = sdl_scancode_down let up = sdl_scancode_up let numlockclear = sdl_scancode_numlockclear let kp_divide = sdl_scancode_kp_divide let kp_multiply = sdl_scancode_kp_multiply let kp_minus = sdl_scancode_kp_minus let kp_plus = sdl_scancode_kp_plus let kp_enter = sdl_scancode_kp_enter let kp_1 = sdl_scancode_kp_1 let kp_2 = sdl_scancode_kp_2 let kp_3 = sdl_scancode_kp_3 let kp_4 = sdl_scancode_kp_4 let kp_5 = sdl_scancode_kp_5 let kp_6 = sdl_scancode_kp_6 let kp_7 = sdl_scancode_kp_7 let kp_8 = sdl_scancode_kp_8 let kp_9 = sdl_scancode_kp_9 let kp_0 = sdl_scancode_kp_0 let kp_period = sdl_scancode_kp_period let nonusbackslash = sdl_scancode_nonusbackslash let application = sdl_scancode_application let kp_equals = sdl_scancode_kp_equals let f13 = sdl_scancode_f13 let f14 = sdl_scancode_f14 let f15 = sdl_scancode_f15 let f16 = sdl_scancode_f16 let f17 = sdl_scancode_f17 let f18 = sdl_scancode_f18 let f19 = sdl_scancode_f19 let f20 = sdl_scancode_f20 let f21 = sdl_scancode_f21 let f22 = sdl_scancode_f22 let f23 = sdl_scancode_f23 let f24 = sdl_scancode_f24 let execute = sdl_scancode_execute let help = sdl_scancode_help let menu = sdl_scancode_menu let select = sdl_scancode_select let stop = sdl_scancode_stop let again = sdl_scancode_again let undo = sdl_scancode_undo let cut = sdl_scancode_cut let copy = sdl_scancode_copy let paste = sdl_scancode_paste let find = sdl_scancode_find let mute = sdl_scancode_mute let volumeup = sdl_scancode_volumeup let volumedown = sdl_scancode_volumedown let kp_comma = sdl_scancode_kp_comma let kp_equalsas400 = sdl_scancode_kp_equalsas400 let international1 = sdl_scancode_international1 let international2 = sdl_scancode_international2 let international3 = sdl_scancode_international3 let international4 = sdl_scancode_international4 let international5 = sdl_scancode_international5 let international6 = sdl_scancode_international6 let international7 = sdl_scancode_international7 let international8 = sdl_scancode_international8 let international9 = sdl_scancode_international9 let lang1 = sdl_scancode_lang1 let lang2 = sdl_scancode_lang2 let lang3 = sdl_scancode_lang3 let lang4 = sdl_scancode_lang4 let lang5 = sdl_scancode_lang5 let lang6 = sdl_scancode_lang6 let lang7 = sdl_scancode_lang7 let lang8 = sdl_scancode_lang8 let lang9 = sdl_scancode_lang9 let alterase = sdl_scancode_alterase let sysreq = sdl_scancode_sysreq let cancel = sdl_scancode_cancel let clear = sdl_scancode_clear let prior = sdl_scancode_prior let return2 = sdl_scancode_return2 let separator = sdl_scancode_separator let out = sdl_scancode_out let oper = sdl_scancode_oper let clearagain = sdl_scancode_clearagain let crsel = sdl_scancode_crsel let exsel = sdl_scancode_exsel let kp_00 = sdl_scancode_kp_00 let kp_000 = sdl_scancode_kp_000 let thousandsseparator = sdl_scancode_thousandsseparator let decimalseparator = sdl_scancode_decimalseparator let currencyunit = sdl_scancode_currencyunit let currencysubunit = sdl_scancode_currencysubunit let kp_leftparen = sdl_scancode_kp_leftparen let kp_rightparen = sdl_scancode_kp_rightparen let kp_leftbrace = sdl_scancode_kp_leftbrace let kp_rightbrace = sdl_scancode_kp_rightbrace let kp_tab = sdl_scancode_kp_tab let kp_backspace = sdl_scancode_kp_backspace let kp_a = sdl_scancode_kp_a let kp_b = sdl_scancode_kp_b let kp_c = sdl_scancode_kp_c let kp_d = sdl_scancode_kp_d let kp_e = sdl_scancode_kp_e let kp_f = sdl_scancode_kp_f let kp_xor = sdl_scancode_kp_xor let kp_power = sdl_scancode_kp_power let kp_percent = sdl_scancode_kp_percent let kp_less = sdl_scancode_kp_less let kp_greater = sdl_scancode_kp_greater let kp_ampersand = sdl_scancode_kp_ampersand let kp_dblampersand = sdl_scancode_kp_dblampersand let kp_verticalbar = sdl_scancode_kp_verticalbar let kp_dblverticalbar = sdl_scancode_kp_dblverticalbar let kp_colon = sdl_scancode_kp_colon let kp_hash = sdl_scancode_kp_hash let kp_space = sdl_scancode_kp_space let kp_at = sdl_scancode_kp_at let kp_exclam = sdl_scancode_kp_exclam let kp_memstore = sdl_scancode_kp_memstore let kp_memrecall = sdl_scancode_kp_memrecall let kp_memclear = sdl_scancode_kp_memclear let kp_memadd = sdl_scancode_kp_memadd let kp_memsubtract = sdl_scancode_kp_memsubtract let kp_memmultiply = sdl_scancode_kp_memmultiply let kp_memdivide = sdl_scancode_kp_memdivide let kp_plusminus = sdl_scancode_kp_plusminus let kp_clear = sdl_scancode_kp_clear let kp_clearentry = sdl_scancode_kp_clearentry let kp_binary = sdl_scancode_kp_binary let kp_octal = sdl_scancode_kp_octal let kp_decimal = sdl_scancode_kp_decimal let kp_hexadecimal = sdl_scancode_kp_hexadecimal let lctrl = sdl_scancode_lctrl let lshift = sdl_scancode_lshift let lalt = sdl_scancode_lalt let lgui = sdl_scancode_lgui let rctrl = sdl_scancode_rctrl let rshift = sdl_scancode_rshift let ralt = sdl_scancode_ralt let rgui = sdl_scancode_rgui let mode = sdl_scancode_mode let audionext = sdl_scancode_audionext let audioprev = sdl_scancode_audioprev let audiostop = sdl_scancode_audiostop let audioplay = sdl_scancode_audioplay let audiomute = sdl_scancode_audiomute let mediaselect = sdl_scancode_mediaselect let www = sdl_scancode_www let mail = sdl_scancode_mail let calculator = sdl_scancode_calculator let computer = sdl_scancode_computer let ac_search = sdl_scancode_ac_search let ac_home = sdl_scancode_ac_home let ac_back = sdl_scancode_ac_back let ac_forward = sdl_scancode_ac_forward let ac_stop = sdl_scancode_ac_stop let ac_refresh = sdl_scancode_ac_refresh let ac_bookmarks = sdl_scancode_ac_bookmarks let brightnessdown = sdl_scancode_brightnessdown let brightnessup = sdl_scancode_brightnessup let displayswitch = sdl_scancode_displayswitch let kbdillumtoggle = sdl_scancode_kbdillumtoggle let kbdillumdown = sdl_scancode_kbdillumdown let kbdillumup = sdl_scancode_kbdillumup let eject = sdl_scancode_eject let sleep = sdl_scancode_sleep let app1 = sdl_scancode_app1 let app2 = sdl_scancode_app2 let enum_of_scancode = [ | ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` A ; ` B ; ` C ; ` D ; ` E ; ` F ; ` G ; ` H ; ` I ; ` J ; ` K ; ` L ; ` M ; ` N ; ` O ; ` P ; ` Q ; ` R ; ` S ; ` T ; ` U ; ` V ; ` W ; ` X ; ` Y ; ` Z ; ` K1 ; ` K2 ; ` K3 ; ` K4 ; ` K5 ; ` K6 ; ` K7 ; ` K8 ; ` K9 ; ` K0 ; ` Return ; ` Escape ; ` Backspace ; ` Tab ; ` Space ; ` Minus ; ` Equals ; ` Leftbracket ; ` Rightbracket ; ` Backslash ; ` Nonushash ; ` Semicolon ; ` Apostrophe ; ` Grave ; ` Comma ; ` Period ; ` Slash ; ` Capslock ; ` F1 ; ` F2 ; ` F3 ; ` F4 ; ` F5 ; ` F6 ; ` F7 ; ` F8 ; ` F9 ; ` F10 ; ` F11 ; ` F12 ; ` Printscreen ; ` Scrolllock ; ` Pause ; ` Insert ; ` Home ; ` Pageup ; ` Delete ; ` End ; ` Pagedown ; ` Right ; ` Left ; ` Down ; ` Up ; ` Numlockclear ; ` Kp_divide ; ` Kp_multiply ; ` Kp_minus ; ` Kp_plus ; ` Kp_enter ; ` Kp_1 ; ` Kp_2 ; ` Kp_3 ; ` Kp_4 ; ` Kp_5 ; ` Kp_6 ; ` Kp_7 ; ` Kp_8 ; ` Kp_9 ; ` Kp_0 ; ` Kp_period ; ` Nonusbackslash ; ` Application ; ` Power ; ` Kp_equals ; ` F13 ; ` F14 ; ` F15 ; ` F16 ; ` F17 ; ` F18 ; ` F19 ; ` F20 ; ` F21 ; ` F22 ; ` F23 ; ` F24 ; ` Execute ; ` Help ; ` Menu ; ` Select ; ` Stop ; ` Again ; ` Undo ; ` Cut ; ` Copy ; ` Paste ; ` Find ; ` Mute ; ` Volumeup ; ` Volumedown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Kp_comma ; ` Kp_equalsas400 ; ` International1 ; ` International2 ; ` International3 ; ` International4 ; ` International5 ; ` International6 ; ` International7 ; ` International8 ; ` International9 ; ` Lang1 ; ` Lang2 ; ` Lang3 ; ` Lang4 ; ` Lang5 ; ` Lang6 ; ` Lang7 ; ` Lang8 ; ` Lang9 ; ` Alterase ; ` Sysreq ; ` Cancel ; ` Clear ; ` Prior ; ` Return2 ; ` Separator ; ` Out ; ` Oper ; ` Clearagain ; ` Crsel ; ` Exsel ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Kp_00 ; ` Kp_000 ; ` Thousandsseparator ; ` Decimalseparator ; ` Currencyunit ; ` Currencysubunit ; ` Kp_leftparen ; ` Kp_rightparen ; ` Kp_leftbrace ; ` Kp_rightbrace ; ` Kp_tab ; ` Kp_backspace ; ` Kp_a ; ` Kp_b ; ` Kp_c ; ` Kp_d ; ` Kp_e ; ` Kp_f ; ` Kp_xor ; ` Kp_power ; ` Kp_percent ; ` Kp_less ; ` Kp_greater ; ` Kp_ampersand ; ` Kp_dblampersand ; ` Kp_verticalbar ; ` Kp_dblverticalbar ; ` Kp_colon ; ` Kp_hash ; ` Kp_space ; ` Kp_at ; ` Kp_exclam ; ` Kp_memstore ; ` Kp_memrecall ; ` Kp_memclear ; ` Kp_memadd ; ` Kp_memsubtract ; ` Kp_memmultiply ; ` Kp_memdivide ; ` Kp_plusminus ; ` Kp_clear ; ` Kp_clearentry ; ` Kp_binary ; ` Kp_octal ; ` Kp_decimal ; ` Kp_hexadecimal ; ` Unknown ; ` Unknown ; ` Lctrl ; ` Lshift ; ` Lalt ; ` Lgui ; ` Rctrl ; ` Rshift ; ` Ralt ; ` Rgui ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Unknown ; ` Mode ; ` Audionext ; ` Audioprev ; ` Audiostop ; ` Audioplay ; ` Audiomute ; ` Mediaselect ; ` Www ; ` Mail ; ` Calculator ; ` Computer ; ` Ac_search ; ` Ac_home ; ` Ac_back ; ` Ac_forward ; ` Ac_stop ; ` Ac_refresh ; ` Ac_bookmarks ; ` Brightnessdown ; ` Brightnessup ; ` Displayswitch ; ` Kbdillumtoggle ; ` Kbdillumdown ; ` Kbdillumup ; ` Eject ; ` Sleep ; ` App1 ; ` App2 ; ] | let enum s = if 0 <= s && s <= app2 then unsafe_get enum_of_scancode s else ` Unknown end |
module K = struct let scancode_mask = sdlk_scancode_mask let unknown = sdlk_unknown let return = sdlk_return let escape = sdlk_escape let backspace = sdlk_backspace let tab = sdlk_tab let space = sdlk_space let exclaim = sdlk_exclaim let quotedbl = sdlk_quotedbl let hash = sdlk_hash let percent = sdlk_percent let dollar = sdlk_dollar let ampersand = sdlk_ampersand let quote = sdlk_quote let leftparen = sdlk_leftparen let rightparen = sdlk_rightparen let asterisk = sdlk_asterisk let plus = sdlk_plus let comma = sdlk_comma let minus = sdlk_minus let period = sdlk_period let slash = sdlk_slash let k0 = sdlk_0 let k1 = sdlk_1 let k2 = sdlk_2 let k3 = sdlk_3 let k4 = sdlk_4 let k5 = sdlk_5 let k6 = sdlk_6 let k7 = sdlk_7 let k8 = sdlk_8 let k9 = sdlk_9 let colon = sdlk_colon let semicolon = sdlk_semicolon let less = sdlk_less let equals = sdlk_equals let greater = sdlk_greater let question = sdlk_question let at = sdlk_at let leftbracket = sdlk_leftbracket let backslash = sdlk_backslash let rightbracket = sdlk_rightbracket let caret = sdlk_caret let underscore = sdlk_underscore let backquote = sdlk_backquote let a = sdlk_a let b = sdlk_b let c = sdlk_c let d = sdlk_d let e = sdlk_e let f = sdlk_f let g = sdlk_g let h = sdlk_h let i = sdlk_i let j = sdlk_j let k = sdlk_k let l = sdlk_l let m = sdlk_m let n = sdlk_n let o = sdlk_o let p = sdlk_p let q = sdlk_q let r = sdlk_r let s = sdlk_s let t = sdlk_t let u = sdlk_u let v = sdlk_v let w = sdlk_w let x = sdlk_x let y = sdlk_y let z = sdlk_z let capslock = sdlk_capslock let f1 = sdlk_f1 let f2 = sdlk_f2 let f3 = sdlk_f3 let f4 = sdlk_f4 let f5 = sdlk_f5 let f6 = sdlk_f6 let f7 = sdlk_f7 let f8 = sdlk_f8 let f9 = sdlk_f9 let f10 = sdlk_f10 let f11 = sdlk_f11 let f12 = sdlk_f12 let printscreen = sdlk_printscreen let scrolllock = sdlk_scrolllock let pause = sdlk_pause let insert = sdlk_insert let home = sdlk_home let pageup = sdlk_pageup let delete = sdlk_delete let kend = sdlk_end let pagedown = sdlk_pagedown let right = sdlk_right let left = sdlk_left let down = sdlk_down let up = sdlk_up let numlockclear = sdlk_numlockclear let kp_divide = sdlk_kp_divide let kp_multiply = sdlk_kp_multiply let kp_minus = sdlk_kp_minus let kp_plus = sdlk_kp_plus let kp_enter = sdlk_kp_enter let kp_1 = sdlk_kp_1 let kp_2 = sdlk_kp_2 let kp_3 = sdlk_kp_3 let kp_4 = sdlk_kp_4 let kp_5 = sdlk_kp_5 let kp_6 = sdlk_kp_6 let kp_7 = sdlk_kp_7 let kp_8 = sdlk_kp_8 let kp_9 = sdlk_kp_9 let kp_0 = sdlk_kp_0 let kp_period = sdlk_kp_period let application = sdlk_application let power = sdlk_power let kp_equals = sdlk_kp_equals let f13 = sdlk_f13 let f14 = sdlk_f14 let f15 = sdlk_f15 let f16 = sdlk_f16 let f17 = sdlk_f17 let f18 = sdlk_f18 let f19 = sdlk_f19 let f20 = sdlk_f20 let f21 = sdlk_f21 let f22 = sdlk_f22 let f23 = sdlk_f23 let f24 = sdlk_f24 let execute = sdlk_execute let help = sdlk_help let menu = sdlk_menu let select = sdlk_select let stop = sdlk_stop let again = sdlk_again let undo = sdlk_undo let cut = sdlk_cut let copy = sdlk_copy let paste = sdlk_paste let find = sdlk_find let mute = sdlk_mute let volumeup = sdlk_volumeup let volumedown = sdlk_volumedown let kp_comma = sdlk_kp_comma let kp_equalsas400 = sdlk_kp_equalsas400 let alterase = sdlk_alterase let sysreq = sdlk_sysreq let cancel = sdlk_cancel let clear = sdlk_clear let prior = sdlk_prior let return2 = sdlk_return2 let separator = sdlk_separator let out = sdlk_out let oper = sdlk_oper let clearagain = sdlk_clearagain let crsel = sdlk_crsel let exsel = sdlk_exsel let kp_00 = sdlk_kp_00 let kp_000 = sdlk_kp_000 let thousandsseparator = sdlk_thousandsseparator let decimalseparator = sdlk_decimalseparator let currencyunit = sdlk_currencyunit let currencysubunit = sdlk_currencysubunit let kp_leftparen = sdlk_kp_leftparen let kp_rightparen = sdlk_kp_rightparen let kp_leftbrace = sdlk_kp_leftbrace let kp_rightbrace = sdlk_kp_rightbrace let kp_tab = sdlk_kp_tab let kp_backspace = sdlk_kp_backspace let kp_a = sdlk_kp_a let kp_b = sdlk_kp_b let kp_c = sdlk_kp_c let kp_d = sdlk_kp_d let kp_e = sdlk_kp_e let kp_f = sdlk_kp_f let kp_xor = sdlk_kp_xor let kp_power = sdlk_kp_power let kp_percent = sdlk_kp_percent let kp_less = sdlk_kp_less let kp_greater = sdlk_kp_greater let kp_ampersand = sdlk_kp_ampersand let kp_dblampersand = sdlk_kp_dblampersand let kp_verticalbar = sdlk_kp_verticalbar let kp_dblverticalbar = sdlk_kp_dblverticalbar let kp_colon = sdlk_kp_colon let kp_hash = sdlk_kp_hash let kp_space = sdlk_kp_space let kp_at = sdlk_kp_at let kp_exclam = sdlk_kp_exclam let kp_memstore = sdlk_kp_memstore let kp_memrecall = sdlk_kp_memrecall let kp_memclear = sdlk_kp_memclear let kp_memadd = sdlk_kp_memadd let kp_memsubtract = sdlk_kp_memsubtract let kp_memmultiply = sdlk_kp_memmultiply let kp_memdivide = sdlk_kp_memdivide let kp_plusminus = sdlk_kp_plusminus let kp_clear = sdlk_kp_clear let kp_clearentry = sdlk_kp_clearentry let kp_binary = sdlk_kp_binary let kp_octal = sdlk_kp_octal let kp_decimal = sdlk_kp_decimal let kp_hexadecimal = sdlk_kp_hexadecimal let lctrl = sdlk_lctrl let lshift = sdlk_lshift let lalt = sdlk_lalt let lgui = sdlk_lgui let rctrl = sdlk_rctrl let rshift = sdlk_rshift let ralt = sdlk_ralt let rgui = sdlk_rgui let mode = sdlk_mode let audionext = sdlk_audionext let audioprev = sdlk_audioprev let audiostop = sdlk_audiostop let audioplay = sdlk_audioplay let audiomute = sdlk_audiomute let mediaselect = sdlk_mediaselect let www = sdlk_www let mail = sdlk_mail let calculator = sdlk_calculator let computer = sdlk_computer let ac_search = sdlk_ac_search let ac_home = sdlk_ac_home let ac_back = sdlk_ac_back let ac_forward = sdlk_ac_forward let ac_stop = sdlk_ac_stop let ac_refresh = sdlk_ac_refresh let ac_bookmarks = sdlk_ac_bookmarks let brightnessdown = sdlk_brightnessdown let brightnessup = sdlk_brightnessup let displayswitch = sdlk_displayswitch let kbdillumtoggle = sdlk_kbdillumtoggle let kbdillumdown = sdlk_kbdillumdown let kbdillumup = sdlk_kbdillumup let eject = sdlk_eject let sleep = sdlk_sleep end |
module Kmod = struct let none = kmod_none let lshift = kmod_lshift let rshift = kmod_rshift let lctrl = kmod_lctrl let rctrl = kmod_rctrl let lalt = kmod_lalt let ralt = kmod_ralt let lgui = kmod_lgui let rgui = kmod_rgui let num = kmod_num let caps = kmod_caps let mode = kmod_mode let reserved = kmod_reserved let ctrl = kmod_ctrl let shift = kmod_shift let alt = kmod_alt let gui = kmod_gui end |
let get_keyboard_focus = foreign " SDL_GetKeyboardFocus " ( void @-> returning window_opt ) |
let get_keyboard_state = foreign " SDL_GetKeyboardState " ( ptr int @-> returning ( ptr int ) ) |
let get_keyboard_state ( ) = let count = allocate int 0 in let p = get_keyboard_state count in bigarray_of_ptr array1 ( !@ count ) Bigarray . int8_unsigned p |
let get_key_from_name = foreign " SDL_GetKeyFromName " ( string @-> returning keycode ) |
let get_key_from_scancode = foreign " SDL_GetKeyFromScancode " ( scancode @-> returning keycode ) |
let get_key_name = foreign " SDL_GetKeyName " ( keycode @-> returning string ) |
let get_mod_state = foreign " SDL_GetModState " ( void @-> returning keymod ) |
let get_scancode_from_key = foreign " SDL_GetScancodeFromKey " ( keycode @-> returning scancode ) |
let get_scancode_from_name = foreign " SDL_GetScancodeFromName " ( string @-> returning scancode ) |
let get_scancode_name = foreign " SDL_GetScancodeName " ( scancode @-> returning string ) |
let has_screen_keyboard_support = foreign " SDL_HasScreenKeyboardSupport " ( void @-> returning bool ) |
let is_screen_keyboard_shown = foreign " SDL_IsScreenKeyboardShown " ( window @-> returning bool ) |
let is_text_input_active = foreign " SDL_IsTextInputActive " ( void @-> returning bool ) |
let set_mod_state = foreign " SDL_SetModState " ( keymod @-> returning void ) |
let set_text_input_rect = foreign " SDL_SetTextInputRect " ( ptr rect @-> returning void ) |
let set_text_input_rect r = set_text_input_rect ( Rect . opt_addr r ) |
let start_text_input = foreign " SDL_StartTextInput " ( void @-> returning void ) |
let stop_text_input = foreign " SDL_StopTextInput " ( void @-> returning void ) |
type cursor = unit ptr |
let cursor : cursor typ = ptr void |
let cursor_opt : cursor option typ = ptr_opt void |
let unsafe_cursor_of_ptr addr : cursor = ptr_of_raw_address addr |
let unsafe_ptr_of_cursor cursor = raw_address_of_ptr ( to_voidp cursor ) |
module System_cursor = struct type t = int let arrow = sdl_system_cursor_arrow let ibeam = sdl_system_cursor_ibeam let wait = sdl_system_cursor_wait let crosshair = sdl_system_cursor_crosshair let waitarrow = sdl_system_cursor_waitarrow let size_nw_se = sdl_system_cursor_sizenwse let size_ne_sw = sdl_system_cursor_sizenesw let size_we = sdl_system_cursor_sizewe let size_ns = sdl_system_cursor_sizens let size_all = sdl_system_cursor_sizeall let no = sdl_system_cursor_no let hand = sdl_system_cursor_hand end |
module Button = struct let left = sdl_button_left let right = sdl_button_right let middle = sdl_button_middle let x1 = sdl_button_x1 let x2 = sdl_button_x2 let i = Int32 . of_int let lmask = i sdl_button_lmask let mmask = i sdl_button_mmask let rmask = i sdl_button_rmask let x1mask = i sdl_button_x1mask let x2mask = i sdl_button_x2mask end |
let capture_mouse = foreign " SDL_CaptureMouse " ( bool @-> returning zero_to_ok ) |
let create_color_cursor = foreign " SDL_CreateColorCursor " ( surface @-> int @-> int @-> returning ( some_to_ok cursor_opt ) ) |
let create_color_cursor s ~ hot_x ~ hot_y = create_color_cursor s hot_x hot_y |
let create_cursor = foreign " SDL_CreateCursor " ( ptr void @-> ptr void @-> int @-> int @-> int @-> int @-> returning ( some_to_ok cursor_opt ) ) |
let create_cursor d m ~ w ~ h ~ hot_x ~ hot_y = let d = to_voidp ( bigarray_start array1 d ) in let m = to_voidp ( bigarray_start array1 m ) in create_cursor d m w h hot_x hot_y |
let create_system_cursor = foreign " SDL_CreateSystemCursor " ( int @-> returning ( some_to_ok cursor_opt ) ) |
let free_cursor = foreign " SDL_FreeCursor " ( cursor @-> returning void ) |
let get_cursor = foreign " SDL_GetCursor " ( void @-> returning cursor_opt ) |
let get_default_cursor = foreign " SDL_GetDefaultCursor " ( void @-> returning cursor_opt ) |
let get_global_mouse_state = foreign " SDL_GetGlobalMouseState " ( ptr int @-> ptr int @-> returning int32_as_uint32_t ) |
let get_global_mouse_state ( ) = let x = allocate int 0 in let y = allocate int 0 in let s = get_global_mouse_state x y in s , ( !@ x , !@ y ) |
let get_mouse_focus = foreign " SDL_GetMouseFocus " ( void @-> returning window_opt ) |
let get_mouse_state = foreign " SDL_GetMouseState " ( ptr int @-> ptr int @-> returning int32_as_uint32_t ) |
let get_mouse_state ( ) = let x = allocate int 0 in let y = allocate int 0 in let s = get_mouse_state x y in s , ( !@ x , !@ y ) |
let get_relative_mouse_mode = foreign " SDL_GetRelativeMouseMode " ( void @-> returning bool ) |
let get_relative_mouse_state = foreign " SDL_GetRelativeMouseState " ( ptr int @-> ptr int @-> returning int32_as_uint32_t ) |
let get_relative_mouse_state ( ) = let x = allocate int 0 in let y = allocate int 0 in let s = get_relative_mouse_state x y in s , ( !@ x , !@ y ) |
let show_cursor = foreign " SDL_ShowCursor " ( int @-> returning bool_to_ok ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.