Skip to content

Instantly share code, notes, and snippets.

@fccm
Created April 30, 2019 13:23
Show Gist options
  • Save fccm/99469a7ab436ef6a47927e5d1e6dda59 to your computer and use it in GitHub Desktop.
Save fccm/99469a7ab436ef6a47927e5d1e6dda59 to your computer and use it in GitHub Desktop.
[blue_prawn@localhost tsdl (master)]$ git diff
diff --git a/src/tsdl.ml b/src/tsdl.ml
index 51112ff..2ee1c0a 100644
--- a/src/tsdl.ml
+++ b/src/tsdl.ml
@@ -3934,6 +3934,20 @@ module Event = struct
let () = seal t
end
+ module Display_event = struct
+ type t
+ let t : t structure typ = structure "SDL_DisplayEvent"
+ let _ = field t "type" int_as_uint32_t
+ let _ = field t "timestamp" int32_as_uint32_t
+ let display = field t "display" int32_as_uint32_t
+ let event = field t "event" int_as_uint8_t
+ let padding1 = field t "padding1" uint8_t
+ let padding2 = field t "padding2" uint8_t
+ let padding3 = field t "padding3" uint8_t
+ let data1 = field t "data1" int32_t
+ let () = seal t
+ end
+
module Audio_device_event = struct
type t
let t : t structure typ = structure "SDL_AudioDevice"
@@ -3971,6 +3985,7 @@ module Event = struct
let touch_finger_event = field t "tfinger" Touch_finger_event.t
let user_event = field t "user" User_event.t
let window_event = field t "window" Window_event.t
+ let display_event = field t "display" Display_event.t
let padding = field t "padding" (abstract "padding" tsdl_sdl_event_size 1)
let () = seal t
@@ -4253,7 +4268,20 @@ module Event = struct
let window_event_enum id =
try Imap.find id enum_of_window_event_id with Not_found -> `Unknown id
- (* Redner events *)
+ (* Display event *)
+
+ let display_display =
+ F (display_event, Display_event.display)
+
+ let display_event_id =
+ F (display_event, Display_event.event)
+
+ let display_data1 =
+ F (display_event, Display_event.data1)
+
+ let display_event = 0x150 (* sdl_displayevent *)
+
+ (* Render events *)
let render_targets_reset = sdl_render_targets_reset
let render_device_reset = sdl_render_device_reset
@@ -4314,7 +4342,8 @@ module Event = struct
text_input, `Text_input;
user_event, `User_event;
quit, `Quit;
- window_event, `Window_event; ]
+ window_event, `Window_event;
+ display_event, `Display_event; ]
in
List.fold_left add Imap.empty enums
diff --git a/src/tsdl.mli b/src/tsdl.mli
index 9fd939b..961f380 100644
--- a/src/tsdl.mli
+++ b/src/tsdl.mli
@@ -3033,6 +3033,16 @@ module Event : sig
val user_window_id : int field
val user_code : int field
+ (** {2:display Display events} *)
+
+ val display_event : event_type
+
+ (** {3 {{:http://wiki.libsdl.org/SDL_DisplayEvent}SDL_DisplayEvent} fields} *)
+
+ val display_display : int32 field
+ val display_event_id : int field
+ val display_data1 : int32 field
+
(** {2:window Window events} *)
val window_event : event_type
@@ -3103,7 +3113,7 @@ module Event : sig
| `Mouse_button_down | `Mouse_button_up | `Mouse_motion
| `Mouse_wheel | `Multi_gesture | `Quit | `Sys_wm_event
| `Text_editing | `Text_input | `Unknown of int | `User_event
- | `Window_event ]
+ | `Window_event | `Display_event ]
end
val get_event_state : event_type -> toggle_state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment