diff options
author | David Thompson <dthompson2@worcester.edu> | 2024-10-02 21:22:19 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2024-12-17 08:20:10 -0500 |
commit | 90f08d32e5ce7be8b5f3c272bcd9a2773cd134ae (patch) | |
tree | add34d119bea30e134ff36a208f3b6ab41264f41 /sdl3/bindings/events.scm |
First commit!main
Diffstat (limited to 'sdl3/bindings/events.scm')
-rw-r--r-- | sdl3/bindings/events.scm | 750 |
1 files changed, 750 insertions, 0 deletions
diff --git a/sdl3/bindings/events.scm b/sdl3/bindings/events.scm new file mode 100644 index 0000000..c27be68 --- /dev/null +++ b/sdl3/bindings/events.scm @@ -0,0 +1,750 @@ +;;; guile-sdl3 -- Scheme bindings for SDL3 +;;; Copyright © 2024 David Thompson <dthompson2@worcester.edu> +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. + +;;; Commentary: +;; +;; Low-level FFI binding utilities. +;; +;;; Code: + +(define-module (sdl3 bindings events) + #:use-module (bstruct) + #:use-module (sdl3 bindings utils) + #:use-module (system foreign) + #:export (SDL_EventType + symbol->event-type + event-type->symbol + SDL_EVENT_FIRST + SDL_EVENT_QUIT + SDL_EVENT_TERMINATING + SDL_EVENT_LOW_MEMORY + SDL_EVENT_WILL_ENTER_BACKGROUND + SDL_EVENT_DID_ENTER_BACKGROUND + SDL_EVENT_WILL_ENTER_FOREGROUND + SDL_EVENT_DID_ENTER_FOREGROUND + SDL_EVENT_LOCALE_CHANGED + SDL_EVENT_SYSTEM_THEME_CHANGED + SDL_EVENT_DISPLAY_ORIENTATION + SDL_EVENT_DISPLAY_ADDED + SDL_EVENT_DISPLAY_REMOVED + SDL_EVENT_DISPLAY_MOVED + SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED + SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED + SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED + SDL_EVENT_WINDOW_SHOWN + SDL_EVENT_WINDOW_HIDDEN + SDL_EVENT_WINDOW_EXPOSED + SDL_EVENT_WINDOW_MOVED + SDL_EVENT_WINDOW_RESIZED + SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED + SDL_EVENT_WINDOW_METAL_VIEW_RESIZED + SDL_EVENT_WINDOW_MINIMIZED + SDL_EVENT_WINDOW_MAXIMIZED + SDL_EVENT_WINDOW_RESTORED + SDL_EVENT_WINDOW_MOUSE_ENTER + SDL_EVENT_WINDOW_MOUSE_LEAVE + SDL_EVENT_WINDOW_FOCUS_GAINED + SDL_EVENT_WINDOW_FOCUS_LOST + SDL_EVENT_WINDOW_CLOSE_REQUESTED + SDL_EVENT_WINDOW_HIT_TEST + SDL_EVENT_WINDOW_ICCPROF_CHANGED + SDL_EVENT_WINDOW_DISPLAY_CHANGED + SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED + SDL_EVENT_WINDOW_SAFE_AREA_CHANGED + SDL_EVENT_WINDOW_OCCLUDED + SDL_EVENT_WINDOW_ENTER_FULLSCREEN + SDL_EVENT_WINDOW_LEAVE_FULLSCREEN + SDL_EVENT_WINDOW_DESTROYED + SDL_EVENT_WINDOW_HDR_STATE_CHANGED + SDL_EVENT_KEY_DOWN + SDL_EVENT_KEY_UP + SDL_EVENT_TEXT_EDITING + SDL_EVENT_TEXT_INPUT + SDL_EVENT_KEYMAP_CHANGED + SDL_EVENT_KEYBOARD_ADDED + SDL_EVENT_KEYBOARD_REMOVED + SDL_EVENT_TEXT_EDITING_CANDIDATES + SDL_EVENT_MOUSE_MOTION + SDL_EVENT_MOUSE_BUTTON_DOWN + SDL_EVENT_MOUSE_BUTTON_UP + SDL_EVENT_MOUSE_WHEEL + SDL_EVENT_MOUSE_ADDED + SDL_EVENT_MOUSE_REMOVED + SDL_EVENT_JOYSTICK_AXIS_MOTION + SDL_EVENT_JOYSTICK_BALL_MOTION + SDL_EVENT_JOYSTICK_HAT_MOTION + SDL_EVENT_JOYSTICK_BUTTON_DOWN + SDL_EVENT_JOYSTICK_BUTTON_UP + SDL_EVENT_JOYSTICK_ADDED + SDL_EVENT_JOYSTICK_REMOVED + SDL_EVENT_JOYSTICK_BATTERY_UPDATED + SDL_EVENT_JOYSTICK_UPDATE_COMPLETE + SDL_EVENT_GAMEPAD_AXIS_MOTION + SDL_EVENT_GAMEPAD_BUTTON_DOWN + SDL_EVENT_GAMEPAD_BUTTON_UP + SDL_EVENT_GAMEPAD_ADDED + SDL_EVENT_GAMEPAD_REMOVED + SDL_EVENT_GAMEPAD_REMAPPED + SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN + SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION + SDL_EVENT_GAMEPAD_TOUCHPAD_UP + SDL_EVENT_GAMEPAD_SENSOR_UPDATE + SDL_EVENT_GAMEPAD_UPDATE_COMPLETE + SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED + SDL_EVENT_FINGER_DOWN + SDL_EVENT_FINGER_UP + SDL_EVENT_FINGER_MOTION + SDL_EVENT_CLIPBOARD_UPDATE + SDL_EVENT_DROP_FILE + SDL_EVENT_DROP_TEXT + SDL_EVENT_DROP_BEGIN + SDL_EVENT_DROP_COMPLETE + SDL_EVENT_DROP_POSITION + SDL_EVENT_AUDIO_DEVICE_ADDED + SDL_EVENT_AUDIO_DEVICE_REMOVED + SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED + SDL_EVENT_SENSOR_UPDATE + SDL_EVENT_PEN_PROXIMITY_IN + SDL_EVENT_PEN_PROXIMITY_OUT + SDL_EVENT_PEN_DOWN + SDL_EVENT_PEN_UP + SDL_EVENT_PEN_BUTTON_DOWN + SDL_EVENT_PEN_BUTTON_UP + SDL_EVENT_PEN_MOTION + SDL_EVENT_PEN_AXIS + SDL_EVENT_CAMERA_DEVICE_ADDED + SDL_EVENT_CAMERA_DEVICE_REMOVED + SDL_EVENT_CAMERA_DEVICE_APPROVED + SDL_EVENT_CAMERA_DEVICE_DENIED + SDL_EVENT_RENDER_TARGETS_RESET + SDL_EVENT_RENDER_DEVICE_RESET + SDL_EVENT_POLL_SENTINEL + SDL_EVENT_DISPLAY_FIRST + SDL_EVENT_DISPLAY_LAST + SDL_EVENT_WINDOW_FIRST + SDL_EVENT_WINDOW_LAST + SDL_EVENT_USER + SDL_EVENT_LAST + SDL_EVENT_ENUM_PADDING + + SDL_CommonEvent + SDL_DisplayEvent + SDL_WindowEvent + SDL_KeyboardDeviceEvent + SDL_KeyboardEvent + SDL_TextEditingEvent + SDL_TextEditingCandidatesEvent + SDL_TextInputEvent + SDL_MouseDeviceEvent + SDL_MouseMotionEvent + SDL_MouseButtonEvent + SDL_MouseWheelEvent + SDL_JoyAxisEvent + SDL_JoyBallEvent + SDL_JoyHatEvent + SDL_JoyButtonEvent + SDL_JoyDeviceEvent + SDL_JoyBatteryEvent + SDL_GamepadAxisEvent + SDL_GamepadButtonEvent + SDL_GamepadDeviceEvent + SDL_GamepadTouchpadEvent + SDL_GamepadSensorEvent + SDL_AudioDeviceEvent + SDL_CameraDeviceEvent + SDL_TouchFingerEvent + SDL_PenProximityEvent + SDL_PenMotionEvent + SDL_PenTouchEvent + SDL_PenButtonEvent + SDL_PenAxisEvent + SDL_DropEvent + SDL_ClipboardEvent + SDL_SensorEvent + SDL_QuitEvent + SDL_UserEvent + SDL_Event + + SDL_PumpEvents + SDL_HasEvent + SDL_HasEvents + SDL_FlushEvent + SDL_FlushEvents + SDL_PollEvent + SDL_WaitEvent + SDL_WaitEventTimeout + SDL_PushEvent)) + +(define-enum SDL_EventType + symbol->event-type + event-type->symbol + (first SDL_EVENT_FIRST) + (quit SDL_EVENT_QUIT #x100) + (terminating SDL_EVENT_TERMINATING) + (low-memory SDL_EVENT_LOW_MEMORY) + (will-enter-background SDL_EVENT_WILL_ENTER_BACKGROUND) + (did-enter-background SDL_EVENT_DID_ENTER_BACKGROUND) + (will-enter-foreground SDL_EVENT_WILL_ENTER_FOREGROUND) + (did-enter-foreground SDL_EVENT_DID_ENTER_FOREGROUND) + (locale-changed SDL_EVENT_LOCALE_CHANGED) + (system-theme-changed SDL_EVENT_SYSTEM_THEME_CHANGED) + (display-orientation SDL_EVENT_DISPLAY_ORIENTATION #x151) + (display-added SDL_EVENT_DISPLAY_ADDED) + (display-removed SDL_EVENT_DISPLAY_REMOVED) + (display-moved SDL_EVENT_DISPLAY_MOVED) + (display-desktop-mode-changed SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED) + (display-current-mode-changed SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED) + (display-content-scale-changed SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED) + (window-shown SDL_EVENT_WINDOW_SHOWN #x202) + (window-hidden SDL_EVENT_WINDOW_HIDDEN) + (window-exposed SDL_EVENT_WINDOW_EXPOSED) + (window-moved SDL_EVENT_WINDOW_MOVED) + (window-resized SDL_EVENT_WINDOW_RESIZED) + (window-pixel-size-changed SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) + (window-metal-view-resized SDL_EVENT_WINDOW_METAL_VIEW_RESIZED) + (window-minimized SDL_EVENT_WINDOW_MINIMIZED) + (window-maximized SDL_EVENT_WINDOW_MAXIMIZED) + (window-restored SDL_EVENT_WINDOW_RESTORED) + (window-mouse-enter SDL_EVENT_WINDOW_MOUSE_ENTER) + (window-mouse-leave SDL_EVENT_WINDOW_MOUSE_LEAVE) + (window-focus-gained SDL_EVENT_WINDOW_FOCUS_GAINED) + (window-focus-lost SDL_EVENT_WINDOW_FOCUS_LOST) + (window-close-requested SDL_EVENT_WINDOW_CLOSE_REQUESTED) + (window-hit-test SDL_EVENT_WINDOW_HIT_TEST) + (window-iccprof-changed SDL_EVENT_WINDOW_ICCPROF_CHANGED) + (window-display-changed SDL_EVENT_WINDOW_DISPLAY_CHANGED) + (window-display-scale-changed SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED) + (window-safe-area-changed SDL_EVENT_WINDOW_SAFE_AREA_CHANGED) + (window-occluded SDL_EVENT_WINDOW_OCCLUDED) + (window-enter-fullscreen SDL_EVENT_WINDOW_ENTER_FULLSCREEN) + (window-leave-fullscreen SDL_EVENT_WINDOW_LEAVE_FULLSCREEN) + (window-destroyed SDL_EVENT_WINDOW_DESTROYED) + (window-hdr-state-changed SDL_EVENT_WINDOW_HDR_STATE_CHANGED) + (key-down SDL_EVENT_KEY_DOWN #x300) + (key-up SDL_EVENT_KEY_UP) + (text-editing SDL_EVENT_TEXT_EDITING) + (text-input SDL_EVENT_TEXT_INPUT) + (keymap-changed SDL_EVENT_KEYMAP_CHANGED) + (keyboard-added SDL_EVENT_KEYBOARD_ADDED) + (keyboard-removed SDL_EVENT_KEYBOARD_REMOVED) + (text-editing-candidates SDL_EVENT_TEXT_EDITING_CANDIDATES) + (mouse-motion SDL_EVENT_MOUSE_MOTION #x400) + (mouse-button-down SDL_EVENT_MOUSE_BUTTON_DOWN) + (mouse-button-up SDL_EVENT_MOUSE_BUTTON_UP) + (mouse-wheel SDL_EVENT_MOUSE_WHEEL) + (mouse-added SDL_EVENT_MOUSE_ADDED) + (mouse-removed SDL_EVENT_MOUSE_REMOVED) + (joystick-axis-motion SDL_EVENT_JOYSTICK_AXIS_MOTION #x600) + (joystick-ball-motion SDL_EVENT_JOYSTICK_BALL_MOTION) + (joystick-hat-motion SDL_EVENT_JOYSTICK_HAT_MOTION) + (joystick-button-down SDL_EVENT_JOYSTICK_BUTTON_DOWN) + (joystick-button-up SDL_EVENT_JOYSTICK_BUTTON_UP) + (joystick-added SDL_EVENT_JOYSTICK_ADDED) + (joystick-removed SDL_EVENT_JOYSTICK_REMOVED) + (joystick-battery-updated SDL_EVENT_JOYSTICK_BATTERY_UPDATED) + (joystick-update-complete SDL_EVENT_JOYSTICK_UPDATE_COMPLETE) + (gamepad-axis-motion SDL_EVENT_GAMEPAD_AXIS_MOTION #x650) + (gamepad-button-down SDL_EVENT_GAMEPAD_BUTTON_DOWN) + (gamepad-button-up SDL_EVENT_GAMEPAD_BUTTON_UP) + (gamepad-added SDL_EVENT_GAMEPAD_ADDED) + (gamepad-removed SDL_EVENT_GAMEPAD_REMOVED) + (gamepad-remapped SDL_EVENT_GAMEPAD_REMAPPED) + (gamepad-touchpad-down SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN) + (gamepad-touchpad-motion SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION) + (gamepad-touchpad-up SDL_EVENT_GAMEPAD_TOUCHPAD_UP) + (gamepad-sensor-update SDL_EVENT_GAMEPAD_SENSOR_UPDATE) + (gamepad-update-complete SDL_EVENT_GAMEPAD_UPDATE_COMPLETE) + (gamepad-steam-handle-updated SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED) + (finger-down SDL_EVENT_FINGER_DOWN #x700) + (finger-up SDL_EVENT_FINGER_UP) + (finger-motion SDL_EVENT_FINGER_MOTION) + (clipboard-update SDL_EVENT_CLIPBOARD_UPDATE #x900) + (drop-file SDL_EVENT_DROP_FILE #x1000) + (drop-text SDL_EVENT_DROP_TEXT) + (drop-begin SDL_EVENT_DROP_BEGIN) + (drop-complete SDL_EVENT_DROP_COMPLETE) + (drop-position SDL_EVENT_DROP_POSITION) + (audio-device-added SDL_EVENT_AUDIO_DEVICE_ADDED #x1100) + (audio-device-removed SDL_EVENT_AUDIO_DEVICE_REMOVED) + (audio-device-format-changed SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED) + (sensor-update SDL_EVENT_SENSOR_UPDATE #x1200) + (pen-proximity-in SDL_EVENT_PEN_PROXIMITY_IN #x1300) + (pen-proximity-out SDL_EVENT_PEN_PROXIMITY_OUT) + (pen-down SDL_EVENT_PEN_DOWN) + (pen-up SDL_EVENT_PEN_UP) + (pen-button-down SDL_EVENT_PEN_BUTTON_DOWN) + (pen-button-up SDL_EVENT_PEN_BUTTON_UP) + (pen-motion SDL_EVENT_PEN_MOTION) + (pen-axis SDL_EVENT_PEN_AXIS) + (camera-device-added SDL_EVENT_CAMERA_DEVICE_ADDED #x1400) + (camera-device-removed SDL_EVENT_CAMERA_DEVICE_REMOVED) + (camera-device-approved SDL_EVENT_CAMERA_DEVICE_APPROVED) + (camera-device-denied SDL_EVENT_CAMERA_DEVICE_DENIED) + (render-targets-reset SDL_EVENT_RENDER_TARGETS_RESET #x2000) + (render-device-reset SDL_EVENT_RENDER_DEVICE_RESET) + (poll-sentinel SDL_EVENT_POLL_SENTINEL #x7F00)) + +(define SDL_EVENT_DISPLAY_FIRST SDL_EVENT_DISPLAY_ORIENTATION) +(define SDL_EVENT_DISPLAY_LAST SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED) +(define SDL_EVENT_WINDOW_FIRST SDL_EVENT_WINDOW_SHOWN) +(define SDL_EVENT_WINDOW_LAST SDL_EVENT_WINDOW_HDR_STATE_CHANGED) +(define SDL_EVENT_USER #x8000) +(define SDL_EVENT_LAST #xFFFF) +(define SDL_EVENT_ENUM_PADDING #x7FFFFFFF) + +(define-bstruct SDL_CommonEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64))) + +(define-bstruct SDL_DisplayEvent + (struct + (type int) ; SDL_EventType + (reserved uint32) + (timestamp uint64) + (displayID uint32) ; SDL_DisplayID + (data1 int32) + (data2 int32))) + +(define-bstruct SDL_WindowEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (data1 int32) + (data2 int32))) + +(define-bstruct SDL_KeyboardDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_KeyboardID + )) + +(define-bstruct SDL_KeyboardEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_KeyboardID + (scancode int) ; SDL_Scancode + (key int) ; SDL_Keycode + (mod uint16) ; SDL_Keymod + (raw uint16) + (down uint8) ; bool + (repeat uint8) ; bool + )) + +(define-bstruct SDL_TextEditingEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (text (* uint8)) ; char* + (start int32) + (length int32))) + +(define-bstruct SDL_TextEditingCandidatesEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (candidates (* uint8)) + (num_candidates int32) + (selected_candidate int32) + (horizontal uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_TextInputEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (text (* uint8)))) + +(define-bstruct SDL_MouseDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_MouseID + )) + +(define-bstruct SDL_MouseMotionEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_MouseID + (state uint32) ; SDL_MouseButtonFlags + (x float) + (y float) + (xrel float) + (yrel float))) + +(define-bstruct SDL_MouseButtonEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_MouseID + (button uint8) + (down uint8) ; bool + (clicks uint8) + (_ uint8) + (x float) + (y float))) + +(define-bstruct SDL_MouseWheelEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_MouseID + (x float) + (y float) + (direction int) ; SDL_MouseWheelDirection + (mouse_x float) + (mouse_y float))) + +(define-bstruct SDL_JoyAxisEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (axis uint8) + (_ uint8) + (_ uint8) + (_ uint8) + (value int16) + (_ uint16))) + +(define-bstruct SDL_JoyBallEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (ball uint8) + (_ uint8) + (_ uint8) + (_ uint8) + (xrel int32) + (yrel int32))) + +(define-bstruct SDL_JoyHatEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (hat uint8) + (value uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_JoyButtonEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (button uint8) + (down uint8) ; bool + (_ uint8) + (_ uint8) + )) + +(define-bstruct SDL_JoyDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + )) + +(define-bstruct SDL_JoyBatteryEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (state int) ; SDL_PowerState + (percent int))) + +(define-bstruct SDL_GamepadAxisEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (axis uint8) + (_ uint8) + (_ uint8) + (_ uint8) + (value int16) + (_ uint16))) + +(define-bstruct SDL_GamepadButtonEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (button uint8) + (down uint8) ; bool + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_GamepadDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + )) + +(define-bstruct SDL_GamepadTouchpadEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (touchpad int32) + (finger int32) + (x float) + (y float) + (pressure float))) + +(define-bstruct SDL_GamepadSensorEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_JoystickID + (sensor int32) + (data (array 3 float)) + (sensor_timestamp uint64))) + +(define-bstruct SDL_AudioDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_AudioDeviceID + (recording uint8) ; bool + (_ uint8) + (_ uint8) + (_ uint8))) + +(define-bstruct SDL_CameraDeviceEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_CameraID + )) + +(define-bstruct SDL_TouchFingerEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (touchID uint32) ; SDL_TouchID + (fingerID uint32) ; SDL_FingerID + (x float) + (y float) + (dx float) + (dy float) + (pressure float) + (windowID uint32) ; SDL_WindowID + )) + +(define-bstruct SDL_PenProximityEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_PenID + )) + +(define-bstruct SDL_PenMotionEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_PenID + (pen_state uint32) ; SDL_PenInputFlags + )) + +(define-bstruct SDL_PenTouchEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_PenID + (pen_state uint32) ; SDL_PenInputFlags + (x float) + (y float) + (eraser uint8) ; bool + (down uint8) ; bool + )) + +(define-bstruct SDL_PenButtonEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_PenID + (pen_state uint32) ; SDL_PenInputFlags + (x float) + (y float) + (button uint8) + (down uint8) ; bool + )) + +(define-bstruct SDL_PenAxisEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (which uint32) ; SDL_PenID + (pen_state uint32) ; SDL_PenInputFlags + (x float) + (y float) + (axis int) ; SDL_PenAxis + (value float))) + +(define-bstruct SDL_DropEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (x float) + (y float) + (source (* uint8)) ; char* + (data (* uint8)) ; char* + )) + +(define-bstruct SDL_ClipboardEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64))) + +(define-bstruct SDL_SensorEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (which uint32) ; SDL_SensorID + (data (array 6 float)) + (sensor_timestamp uint64))) + +(define-bstruct SDL_QuitEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64))) + +(define-bstruct SDL_UserEvent + (struct + (type uint32) + (reserved uint32) + (timestamp uint64) + (windowID uint32) ; SDL_WindowID + (code int32) + (data1 (* void)) + (data2 (* void)))) + +(define-bstruct SDL_Event + (union + (type uint32) + (common SDL_CommonEvent) + (display SDL_DisplayEvent) + (window SDL_WindowEvent) + (kdevice SDL_KeyboardDeviceEvent) + (key SDL_KeyboardEvent) + (edit SDL_TextEditingEvent) + (edit_candidates SDL_TextEditingCandidatesEvent) + (text SDL_TextInputEvent) + (mdevice SDL_MouseDeviceEvent) + (motion SDL_MouseMotionEvent) + (button SDL_MouseButtonEvent) + (wheel SDL_MouseWheelEvent) + (jdevice SDL_JoyDeviceEvent) + (jaxis SDL_JoyAxisEvent) + (jball SDL_JoyBallEvent) + (jhat SDL_JoyHatEvent) + (jbutton SDL_JoyButtonEvent) + (jbattery SDL_JoyBatteryEvent) + (gdevice SDL_GamepadDeviceEvent) + (gaxis SDL_GamepadAxisEvent) + (gbutton SDL_GamepadButtonEvent) + (gtouchpad SDL_GamepadTouchpadEvent) + (gsensor SDL_GamepadSensorEvent) + (adevice SDL_AudioDeviceEvent) + (cdevice SDL_CameraDeviceEvent) + (sensor SDL_SensorEvent) + (quit SDL_QuitEvent) + (user SDL_UserEvent) + (tfinger SDL_TouchFingerEvent) + (pproximity SDL_PenProximityEvent) + (ptouch SDL_PenTouchEvent) + (pmotion SDL_PenMotionEvent) + (pbutton SDL_PenButtonEvent) + (paxis SDL_PenAxisEvent) + (drop SDL_DropEvent) + (clipboard SDL_ClipboardEvent) + (_ (array 128 uint8)))) + +(define-sdl SDL_PumpEvents) +;; SDL_PeepEvents +(define-sdl SDL_HasEvent uint32 -> bool) +(define-sdl SDL_HasEvents uint32 uint32 -> bool) +(define-sdl SDL_FlushEvent uint32) +(define-sdl SDL_FlushEvents uint32 uint32) +(define-sdl SDL_PollEvent '* -> bool) +(define-sdl SDL_WaitEvent '* -> bool) +(define-sdl SDL_WaitEventTimeout '* int32 -> bool) +(define-sdl SDL_PushEvent '* -> bool) +;; SDL_SetEventFilter +;; SDL_GetEventFilter +;; SDL_AddEventWatch +;; SDL_RemoveEventWatch +;; SDL_FilterEvents +;; SDL_SetEventEnabled +;; SDL_EventEnabled +;; SDL_RegisterEvents +;; SDL_GetWindowFromEvent |