From 9b1d91b4c68477145434021ea7392c16d849ebaa Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 2 Oct 2024 21:22:19 -0400 Subject: First commit! --- sdl3/bindings/events.scm | 750 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 750 insertions(+) create mode 100644 sdl3/bindings/events.scm (limited to 'sdl3/bindings/events.scm') diff --git a/sdl3/bindings/events.scm b/sdl3/bindings/events.scm new file mode 100644 index 0000000..f123b95 --- /dev/null +++ b/sdl3/bindings/events.scm @@ -0,0 +1,750 @@ +;;; guile-sdl3 -- Scheme bindings for SDL3 +;;; Copyright © 2024 David Thompson +;;; +;;; 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 u32) + (reserved u32) + (timestamp u64))) + +(define-bstruct SDL_DisplayEvent + (struct + (type int) ; SDL_EventType + (reserved u32) + (timestamp u64) + (displayID u32) ; SDL_DisplayID + (data1 s32) + (data2 s32))) + +(define-bstruct SDL_WindowEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (data1 s32) + (data2 s32))) + +(define-bstruct SDL_KeyboardDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_KeyboardID + )) + +(define-bstruct SDL_KeyboardEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_KeyboardID + (scancode int) ; SDL_Scancode + (key int) ; SDL_Keycode + (mod u16) ; SDL_Keymod + (raw u16) + (down u8) ; bool + (repeat u8) ; bool + )) + +(define-bstruct SDL_TextEditingEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (text (* u8)) ; char* + (start s32) + (length s32))) + +(define-bstruct SDL_TextEditingCandidatesEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (candidates (* u8)) + (num_candidates s32) + (selected_candidate s32) + (horizontal u8) ; bool + (_ u8) + (_ u8) + (_ u8))) + +(define-bstruct SDL_TextInputEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (text (* u8)))) + +(define-bstruct SDL_MouseDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_MouseID + )) + +(define-bstruct SDL_MouseMotionEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_MouseID + (state u32) ; SDL_MouseButtonFlags + (x f32) + (y f32) + (xrel f32) + (yrel f32))) + +(define-bstruct SDL_MouseButtonEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_MouseID + (button u8) + (down u8) ; bool + (clicks u8) + (_ u8) + (x f32) + (y f32))) + +(define-bstruct SDL_MouseWheelEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_MouseID + (x f32) + (y f32) + (direction int) ; SDL_MouseWheelDirection + (mouse_x f32) + (mouse_y f32))) + +(define-bstruct SDL_JoyAxisEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (axis u8) + (_ u8) + (_ u8) + (_ u8) + (value s16) + (_ u16))) + +(define-bstruct SDL_JoyBallEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (ball u8) + (_ u8) + (_ u8) + (_ u8) + (xrel s32) + (yrel s32))) + +(define-bstruct SDL_JoyHatEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (hat u8) + (value u8) + (_ u8) + (_ u8))) + +(define-bstruct SDL_JoyButtonEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (button u8) + (down u8) ; bool + (_ u8) + (_ u8) + )) + +(define-bstruct SDL_JoyDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + )) + +(define-bstruct SDL_JoyBatteryEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (state int) ; SDL_PowerState + (percent int))) + +(define-bstruct SDL_GamepadAxisEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (axis u8) + (_ u8) + (_ u8) + (_ u8) + (value s16) + (_ u16))) + +(define-bstruct SDL_GamepadButtonEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (button u8) + (down u8) ; bool + (_ u8) + (_ u8))) + +(define-bstruct SDL_GamepadDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + )) + +(define-bstruct SDL_GamepadTouchpadEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (touchpad s32) + (finger s32) + (x f32) + (y f32) + (pressure f32))) + +(define-bstruct SDL_GamepadSensorEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_JoystickID + (sensor s32) + (data (array 3 f32)) + (sensor_timestamp u64))) + +(define-bstruct SDL_AudioDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_AudioDeviceID + (recording u8) ; bool + (_ u8) + (_ u8) + (_ u8))) + +(define-bstruct SDL_CameraDeviceEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_CameraID + )) + +(define-bstruct SDL_TouchFingerEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (touchID u32) ; SDL_TouchID + (fingerID u32) ; SDL_FingerID + (x f32) + (y f32) + (dx f32) + (dy f32) + (pressure f32) + (windowID u32) ; SDL_WindowID + )) + +(define-bstruct SDL_PenProximityEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_PenID + )) + +(define-bstruct SDL_PenMotionEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_PenID + (pen_state u32) ; SDL_PenInputFlags + )) + +(define-bstruct SDL_PenTouchEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_PenID + (pen_state u32) ; SDL_PenInputFlags + (x f32) + (y f32) + (eraser u8) ; bool + (down u8) ; bool + )) + +(define-bstruct SDL_PenButtonEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_PenID + (pen_state u32) ; SDL_PenInputFlags + (x f32) + (y f32) + (button u8) + (down u8) ; bool + )) + +(define-bstruct SDL_PenAxisEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (which u32) ; SDL_PenID + (pen_state u32) ; SDL_PenInputFlags + (x f32) + (y f32) + (axis int) ; SDL_PenAxis + (value f32))) + +(define-bstruct SDL_DropEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (x f32) + (y f32) + (source (* u8)) ; char* + (data (* u8)) ; char* + )) + +(define-bstruct SDL_ClipboardEvent + (struct + (type u32) + (reserved u32) + (timestamp u64))) + +(define-bstruct SDL_SensorEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (which u32) ; SDL_SensorID + (data (array 6 f32)) + (sensor_timestamp u64))) + +(define-bstruct SDL_QuitEvent + (struct + (type u32) + (reserved u32) + (timestamp u64))) + +(define-bstruct SDL_UserEvent + (struct + (type u32) + (reserved u32) + (timestamp u64) + (windowID u32) ; SDL_WindowID + (code s32) + (data1 (* void)) + (data2 (* void)))) + +(define-bstruct SDL_Event + (union + (type u32) + (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 u8)))) + +(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 -- cgit v1.2.3