Module Tsdl.Sdl.Event

module Event: sig .. end
Event accessors and Tsdl.Sdl.event_type constants and enumeration.


Event

Once you have determined the Tsdl.Sdl.Event.typ you can access fields available for that type. Safe if you use the wrong accessors: you will just end with garbage data.

type 'b field 
The type for event fields.
val create : unit -> Tsdl.Sdl.event
create () is an uninitialized event structure.
val get : Tsdl.Sdl.event -> 'b field -> 'b
get e f gets the field f of e.
val set : Tsdl.Sdl.event -> 'b field -> 'b -> unit
set e f v sets the field f of e to v.

Event types and their fields



Event type aliases and misc


val first_event : Tsdl.Sdl.event_type
val last_event : Tsdl.Sdl.event_type

Common

These fields are common to all event types.

val typ : Tsdl.Sdl.event_type field
val timestamp : Tsdl.Sdl.uint32 field

Application events


val app_did_enter_background : Tsdl.Sdl.event_type
val app_did_enter_foreground : Tsdl.Sdl.event_type
val app_low_memory : Tsdl.Sdl.event_type
val app_terminating : Tsdl.Sdl.event_type
val app_will_enter_background : Tsdl.Sdl.event_type
val app_will_enter_foreground : Tsdl.Sdl.event_type

Clipboard


val clipboard_update : Tsdl.Sdl.event_type

Controller events


val controller_axis_motion : Tsdl.Sdl.event_type
val controller_button_down : Tsdl.Sdl.event_type
val controller_button_up : Tsdl.Sdl.event_type
val controller_device_added : Tsdl.Sdl.event_type
val controller_device_remapped : Tsdl.Sdl.event_type
val controller_device_removed : Tsdl.Sdl.event_type

SDL_ControllerAxisEvent fields


val controller_axis_which : Tsdl.Sdl.joystick_id field
val controller_axis_axis : Tsdl.Sdl.uint8 field
val controller_axis_value : Tsdl.Sdl.int16 field

SDL_ControllerButtonEvent fields


val controller_button_which : Tsdl.Sdl.joystick_id field
val controller_button_button : Tsdl.Sdl.uint8 field
val controller_button_state : Tsdl.Sdl.button_state field

SDL_ControllerDeviceEvent fields


val controller_device_which : Tsdl.Sdl.joystick_id field

Dollar gesture events


val dollar_gesture : Tsdl.Sdl.event_type
val dollar_record : Tsdl.Sdl.event_type

SDL_DollarGestureEvent fields


val dollar_gesture_touch_id : Tsdl.Sdl.touch_id field
val dollar_gesture_gesture_id : Tsdl.Sdl.gesture_id field
val dollar_gesture_num_fingers : int field
val dollar_gesture_error : float field
val dollar_gesture_x : float field
val dollar_gesture_y : float field

Drop events

Warning If you enable this event Tsdl.Sdl.Event.drop_file_free must be called on the event after you have finished processing it.

val drop_file : Tsdl.Sdl.event_type
val drop_text : Tsdl.Sdl.event_type
val drop_begin : Tsdl.Sdl.event_type
val drop_complete : Tsdl.Sdl.event_type
val drop_file_free : Tsdl.Sdl.event -> unit

SDL_DropEvent fields


val drop_file_file : Tsdl.Sdl.event -> string

Touch events


val finger_down : Tsdl.Sdl.event_type
val finger_motion : Tsdl.Sdl.event_type
val finger_up : Tsdl.Sdl.event_type

SDL_TouchFingerEvent fields


val touch_finger_touch_id : Tsdl.Sdl.touch_id field
val touch_finger_finger_id : Tsdl.Sdl.finger_id field
val touch_finger_x : float field
val touch_finger_y : float field
val touch_finger_dx : float field
val touch_finger_dy : float field
val touch_finger_pressure : float field

Joystick events


val joy_axis_motion : Tsdl.Sdl.event_type
val joy_ball_motion : Tsdl.Sdl.event_type
val joy_button_down : Tsdl.Sdl.event_type
val joy_button_up : Tsdl.Sdl.event_type
val joy_device_added : Tsdl.Sdl.event_type
val joy_device_removed : Tsdl.Sdl.event_type
val joy_hat_motion : Tsdl.Sdl.event_type

SDL_JoyAxisEvent fields


val joy_axis_which : Tsdl.Sdl.joystick_id field
val joy_axis_axis : Tsdl.Sdl.uint8 field
val joy_axis_value : Tsdl.Sdl.int16 field

SDL_JoyBallEvent fields


val joy_ball_which : Tsdl.Sdl.joystick_id field
val joy_ball_ball : Tsdl.Sdl.uint8 field
val joy_ball_xrel : int field
val joy_ball_yrel : int field

SDL_JoyButtonEvent fields


val joy_button_which : Tsdl.Sdl.joystick_id field
val joy_button_button : Tsdl.Sdl.uint8 field
val joy_button_state : Tsdl.Sdl.button_state field

SDL_JoyDeviceEvent fields


val joy_device_which : Tsdl.Sdl.joystick_id field

SDL_JoyHatEvent fields


val joy_hat_which : Tsdl.Sdl.joystick_id field
val joy_hat_hat : Tsdl.Sdl.uint8 field
val joy_hat_value : Tsdl.Sdl.Hat.t field

Keyboard event


val key_down : Tsdl.Sdl.event_type
val key_up : Tsdl.Sdl.event_type
val keymap_changed : Tsdl.Sdl.event_type

SDL_KeyboardEvent fields


val keyboard_window_id : int field
val keyboard_state : Tsdl.Sdl.button_state field
val keyboard_repeat : int field
val keyboard_scancode : Tsdl.Sdl.scancode field
val keyboard_keycode : Tsdl.Sdl.keycode field
val keyboard_keymod : Tsdl.Sdl.keymod field

Mouse events


val mouse_button_down : Tsdl.Sdl.event_type
val mouse_button_up : Tsdl.Sdl.event_type
val mouse_motion : Tsdl.Sdl.event_type
val mouse_wheel : Tsdl.Sdl.event_type

SDL_MouseButtonEvent fields


val mouse_button_window_id : int field
val mouse_button_which : Tsdl.Sdl.uint32 field
val mouse_button_button : Tsdl.Sdl.uint8 field
val mouse_button_state : Tsdl.Sdl.button_state field
val mouse_button_clicks : Tsdl.Sdl.uint8 field
SDL 2.0.2
val mouse_button_x : int field
val mouse_button_y : int field

SDL_MouseMotionEvent fields


val mouse_motion_window_id : int field
val mouse_motion_which : Tsdl.Sdl.uint32 field
val mouse_motion_state : Tsdl.Sdl.uint32 field
val mouse_motion_x : int field
val mouse_motion_y : int field
val mouse_motion_xrel : int field
val mouse_motion_yrel : int field

SDL_MouseWheelEvent fields


val mouse_wheel_window_id : int field
val mouse_wheel_which : Tsdl.Sdl.uint32 field
val mouse_wheel_x : int field
val mouse_wheel_y : int field

Multi gesture events


val multi_gesture : Tsdl.Sdl.event_type

SDL_MultiGestureEvent fields


val multi_gesture_touch_id : Tsdl.Sdl.touch_id field
val multi_gesture_dtheta : float field
val multi_gesture_ddist : float field
val multi_gesture_x : float field
val multi_gesture_y : float field
val multi_gesture_num_fingers : int field

Quit events


val quit : Tsdl.Sdl.event_type

System window manager events


val sys_wm_event : Tsdl.Sdl.event_type

Text events


val text_editing : Tsdl.Sdl.event_type
val text_input : Tsdl.Sdl.event_type

SDL_TextEditingEvent fields


val text_editing_window_id : int field
val text_editing_text : string field
val text_editing_start : int field
val text_editing_length : int field

SDL_TextInputEvent fields


val text_input_window_id : int field
val text_input_text : string field

User events


val user_event : Tsdl.Sdl.event_type

SDL_UserEvent fields


val user_window_id : int field
val user_code : int field

Window events


val window_event : Tsdl.Sdl.event_type
type window_event_id = int 
SDL_WindowEventID
val window_event_enum : window_event_id ->
[ `Close
| `Enter
| `Exposed
| `Focus_gained
| `Focus_lost
| `Hidden
| `Hit_test
| `Leave
| `Maximized
| `Minimized
| `Moved
| `Resized
| `Restored
| `Shown
| `Size_changed
| `Take_focus
| `Unknown of window_event_id ]
val window_event_shown : window_event_id
val window_event_hidden : window_event_id
val window_event_exposed : window_event_id
val window_event_moved : window_event_id
val window_event_resized : window_event_id
val window_event_size_changed : window_event_id
val window_event_minimized : window_event_id
val window_event_maximized : window_event_id
val window_event_restored : window_event_id
val window_event_enter : window_event_id
val window_event_leave : window_event_id
val window_event_focus_gained : window_event_id
val window_event_focus_lost : window_event_id
val window_event_close : window_event_id
val window_event_take_focus : window_event_id
val window_event_hit_test : window_event_id

SDL_WindowEvent fields


val window_window_id : int field
val window_event_id : window_event_id field
val window_data1 : int32 field
val window_data2 : int32 field

Render target


val render_targets_reset : Tsdl.Sdl.event_type
val render_device_reset : Tsdl.Sdl.event_type

Audio hotplug events


val audio_device_added : Tsdl.Sdl.event_type
val audio_device_removed : Tsdl.Sdl.event_type

SDL_AudioDeviceEvent fields


val audio_device_timestamp : Tsdl.Sdl.uint32 field
val audio_device_which : Tsdl.Sdl.uint32 field
val audio_device_is_capture : int field

Event type enum


val enum : Tsdl.Sdl.event_type ->
[ `App_did_enter_background
| `App_did_enter_foreground
| `App_low_memory
| `App_terminating
| `App_will_enter_background
| `App_will_enter_foreground
| `Clipboard_update
| `Controller_axis_motion
| `Controller_button_down
| `Controller_button_up
| `Controller_device_added
| `Controller_device_remapped
| `Controller_device_removed
| `Dollar_gesture
| `Dollar_record
| `Drop_file
| `Finger_down
| `Finger_motion
| `Finger_up
| `Joy_axis_motion
| `Joy_ball_motion
| `Joy_button_down
| `Joy_button_up
| `Joy_device_added
| `Joy_device_removed
| `Joy_hat_motion
| `Key_down
| `Key_up
| `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 ]