@@ -2042,8 +2042,11 @@ let get_display_mode d i =
20422042 | Ok () -> Ok (display_mode_of_c mode) | Error _ as e -> e
20432043
20442044let get_display_usable_bounds =
2045- pre " SDL_GetDisplayUsableBounds" ; foreign " SDL_GetDisplayUsableBounds"
2046- (int @-> ptr rect @-> returning zero_to_ok)
2045+ pre " SDL_GetDisplayUsableBounds" ;
2046+ if sdl2_version > = (2 ,0 ,14 )
2047+ then foreign " SDL_GetDisplayUsableBounds"
2048+ (int @-> ptr rect @-> returning zero_to_ok)
2049+ else fun _ -> failwith " SDL_GetDisplayUsableBounds not implemented (need SDL >= 2.0.14)"
20472050
20482051let get_display_usable_bounds i =
20492052 let r = make rect in
@@ -5404,11 +5407,17 @@ let dequeue_audio dev ba =
54045407 dequeue_audio dev (to_voidp (bigarray_start array1 ba)) (len * kind_size)
54055408
54065409let get_queued_audio_size =
5407- pre " SDL_GetQueuedAudioSize" ; foreign " SDL_GetQueuedAudioSize"
5408- (audio_device_id @-> returning int_as_uint32_t)
5410+ pre " SDL_GetQueuedAudioSize" ;
5411+ if sdl2_version > = (2 ,0 ,12 )
5412+ then foreign " SDL_GetQueuedAudioSize"
5413+ (audio_device_id @-> returning int_as_uint32_t)
5414+ else fun _ -> failwith " SDL_GetQueuedAudioSize not implemented (need SDL >= 2.0.12)"
54095415
54105416let clear_queued_audio =
5411- pre " SDL_ClearQueuedAudio" ; foreign " SDL_ClearQueuedAudio" (audio_device_id @-> returning void)
5417+ pre " SDL_ClearQueuedAudio" ;
5418+ if sdl2_version > = (2 ,0 ,12 )
5419+ then foreign " SDL_ClearQueuedAudio" (audio_device_id @-> returning void)
5420+ else fun _ -> failwith " SDL_ClearQueuedAudio not implemented (need SDL >= 2.0.12)"
54125421
54135422(* Timer *)
54145423
@@ -5495,7 +5504,10 @@ type power_info =
54955504 pi_pct : int option ; }
54965505
54975506let get_power_info =
5498- pre " SDL_GetPowerInfo" ; foreign " SDL_GetPowerInfo" ((ptr int ) @-> (ptr int ) @-> returning int )
5507+ pre " SDL_GetPowerInfo" ;
5508+ if sdl2_version > = (2 ,0 ,16 )
5509+ then foreign " SDL_GetPowerInfo" ((ptr int ) @-> (ptr int ) @-> returning int )
5510+ else fun _ -> failwith " SDL_GetPowerInfo not implemented (need SDL >= 2.0.16)"
54995511
55005512let get_power_info () =
55015513 let secs = allocate int 0 in
0 commit comments