const std = @import("std"); pub const c = @import("c.zig").c; pub const PenID = u32; pub const WindowID = u32; pub const AudioDeviceID = u32; pub const DisplayID = u32; pub const CameraID = u32; pub const PenInputFlags = packed struct(u32) { penInputDown: bool = false, // pen is pressed down penInputButton1: bool = false, // button 1 is pressed penInputButton2: bool = false, // button 2 is pressed penInputButton3: bool = false, // button 3 is pressed penInputButton4: bool = false, // button 4 is pressed penInputButton5: bool = false, // button 5 is pressed penInputEraserTip: bool = false, // eraser tip is used pad0: u24 = 0, rsvd: bool = false, }; pub const MouseButtonFlags = packed struct(u32) { buttonLeft: bool = false, buttonMiddle: bool = false, buttonX1: bool = false, pad0: u28 = 0, rsvd: bool = false, }; pub const Scancode = enum(c_int) { scancodeUnknown, scancodeA, scancodeB, scancodeC, scancodeD, scancodeE, scancodeF, scancodeG, scancodeH, scancodeI, scancodeJ, scancodeK, scancodeL, scancodeM, scancodeN, scancodeO, scancodeP, scancodeQ, scancodeR, scancodeS, scancodeT, scancodeU, scancodeV, scancodeW, scancodeX, scancodeY, scancodeZ, scancode1, scancode2, scancode3, scancode4, scancode5, scancode6, scancode7, scancode8, scancode9, scancode0, scancodeReturn, scancodeEscape, scancodeBackspace, scancodeTab, scancodeSpace, scancodeMinus, scancodeEquals, scancodeLeftbracket, scancodeRightbracket, scancodeSemicolon, scancodeApostrophe, scancodeComma, scancodePeriod, scancodeSlash, scancodeCapslock, scancodeF1, scancodeF2, scancodeF3, scancodeF4, scancodeF5, scancodeF6, scancodeF7, scancodeF8, scancodeF9, scancodeF10, scancodeF11, scancodeF12, scancodePrintscreen, scancodeScrolllock, scancodePause, scancodeHome, scancodePageup, scancodeDelete, scancodeEnd, scancodePagedown, scancodeRight, scancodeLeft, scancodeDown, scancodeUp, scancodeKpDivide, scancodeKpMultiply, scancodeKpMinus, scancodeKpPlus, scancodeKpEnter, scancodeKp1, scancodeKp2, scancodeKp3, scancodeKp4, scancodeKp5, scancodeKp6, scancodeKp7, scancodeKp8, scancodeKp9, scancodeKp0, scancodeKpPeriod, scancodeKpEquals, scancodeF13, scancodeF14, scancodeF15, scancodeF16, scancodeF17, scancodeF18, scancodeF19, scancodeF20, scancodeF21, scancodeF22, scancodeF23, scancodeF24, scancodeExecute, scancodeSelect, scancodeMute, scancodeVolumeup, scancodeVolumedown, scancodeKpComma, scancodeKpEqualsas400, scancodeInternational2, scancodeInternational4, scancodeInternational5, scancodeInternational6, scancodeInternational7, scancodeInternational8, scancodeInternational9, scancodeSysreq, scancodeClear, scancodePrior, scancodeReturn2, scancodeSeparator, scancodeOut, scancodeOper, scancodeClearagain, scancodeCrsel, scancodeExsel, scancodeKp00, scancodeKp000, scancodeThousandsseparator, scancodeDecimalseparator, scancodeCurrencyunit, scancodeCurrencysubunit, scancodeKpLeftparen, scancodeKpRightparen, scancodeKpLeftbrace, scancodeKpRightbrace, scancodeKpTab, scancodeKpBackspace, scancodeKpA, scancodeKpB, scancodeKpC, scancodeKpD, scancodeKpE, scancodeKpF, scancodeKpXor, scancodeKpPower, scancodeKpPercent, scancodeKpLess, scancodeKpGreater, scancodeKpAmpersand, scancodeKpDblampersand, scancodeKpVerticalbar, scancodeKpDblverticalbar, scancodeKpColon, scancodeKpHash, scancodeKpSpace, scancodeKpAt, scancodeKpExclam, scancodeKpMemstore, scancodeKpMemrecall, scancodeKpMemclear, scancodeKpMemadd, scancodeKpMemsubtract, scancodeKpMemmultiply, scancodeKpMemdivide, scancodeKpPlusminus, scancodeKpClear, scancodeKpClearentry, scancodeKpBinary, scancodeKpOctal, scancodeKpDecimal, scancodeKpHexadecimal, scancodeLctrl, scancodeLshift, scancodeRctrl, scancodeRshift, }; pub const TouchID = u64; pub const KeyboardID = u32; pub const MouseID = u32; pub const Window = opaque {}; pub const FingerID = u64; pub const Keycode = u32; pub const SensorID = u32; pub const JoystickID = u32; pub const Keymod = u16; pub const EventType = enum(c_int) { eventDisplayFirst, eventDisplayLast, eventWindowFirst, eventWindowLast, eventFingerDown, eventFingerUp, eventFingerMotion, eventFingerCanceled, eventPrivate0, eventPrivate1, eventPrivate2, eventPrivate3, eventUser, eventLast, eventEnumPadding, }; pub const CommonEvent = extern struct { type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() }; pub const DisplayEvent = extern struct { type: EventType, // SDL_DISPLAYEVENT_* reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() displayID: DisplayID, // The associated display data1: i32, // event dependent data data2: i32, // event dependent data }; pub const WindowEvent = extern struct { type: EventType, // SDL_EVENT_WINDOW_* reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The associated window data1: i32, // event dependent data data2: i32, // event dependent data }; pub const KeyboardDeviceEvent = extern struct { type: EventType, // SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: KeyboardID, // The keyboard instance id }; pub const KeyboardEvent = extern struct { type: EventType, // SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with keyboard focus, if any which: KeyboardID, // The keyboard instance id, or 0 if unknown or virtual scancode: Scancode, // SDL physical key code key: Keycode, // SDL virtual key code mod: Keymod, // current key modifiers raw: u16, // The platform dependent scancode for this event down: bool, // true if the key is pressed repeat: bool, // true if this is a key repeat }; pub const TextEditingEvent = extern struct { type: EventType, // SDL_EVENT_TEXT_EDITING reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with keyboard focus, if any text: [*c]const u8, // The editing text start: i32, // The start cursor of selected editing text, or -1 if not set length: i32, // The length of selected editing text, or -1 if not set }; pub const TextEditingCandidatesEvent = extern struct { type: EventType, // SDL_EVENT_TEXT_EDITING_CANDIDATES reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with keyboard focus, if any candidates: [*c]const [*c]const u8, // The list of candidates, or NULL if there are no candidates available num_candidates: i32, // The number of strings in `candidates` selected_candidate: i32, // The index of the selected candidate, or -1 if no candidate is selected horizontal: bool, // true if the list is horizontal, false if it's vertical padding1: u8, padding2: u8, padding3: u8, }; pub const TextInputEvent = extern struct { type: EventType, // SDL_EVENT_TEXT_INPUT reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with keyboard focus, if any text: [*c]const u8, // The input text, UTF-8 encoded }; pub const MouseDeviceEvent = extern struct { type: EventType, // SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: MouseID, // The mouse instance id }; pub const MouseMotionEvent = extern struct { type: EventType, // SDL_EVENT_MOUSE_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with mouse focus, if any which: MouseID, // The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 state: MouseButtonFlags, // The current button state x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window xrel: f32, // The relative motion in the X direction yrel: f32, // The relative motion in the Y direction }; pub const MouseButtonEvent = extern struct { type: EventType, // SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with mouse focus, if any which: MouseID, // The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0 button: u8, // The mouse button index down: bool, // true if the button is pressed clicks: u8, // 1 for single-click, 2 for double-click, etc. padding: u8, x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window }; pub const MouseWheelEvent = extern struct { type: EventType, // SDL_EVENT_MOUSE_WHEEL reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with mouse focus, if any which: MouseID, // The mouse instance id in relative mode or 0 x: f32, // The amount scrolled horizontally, positive to the right and negative to the left y: f32, // The amount scrolled vertically, positive away from the user and negative toward the user direction: MouseWheelDirection, // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back mouse_x: f32, // X coordinate, relative to window mouse_y: f32, // Y coordinate, relative to window }; pub const JoyAxisEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_AXIS_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id axis: u8, // The joystick axis index padding1: u8, padding2: u8, padding3: u8, value: i16, // The axis value (range: -32768 to 32767) padding4: u16, }; pub const JoyBallEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_BALL_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id ball: u8, // The joystick trackball index padding1: u8, padding2: u8, padding3: u8, xrel: i16, // The relative motion in the X direction yrel: i16, // The relative motion in the Y direction }; pub const JoyHatEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_HAT_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id hat: u8, // The joystick hat index padding1: u8, padding2: u8, }; pub const JoyButtonEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id button: u8, // The joystick button index down: bool, // true if the button is pressed padding1: u8, padding2: u8, }; pub const JoyDeviceEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id }; pub const JoyBatteryEvent = extern struct { type: EventType, // SDL_EVENT_JOYSTICK_BATTERY_UPDATED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id state: PowerState, // The joystick battery state percent: c_int, // The joystick battery percent charge remaining }; pub const GamepadAxisEvent = extern struct { type: EventType, // SDL_EVENT_GAMEPAD_AXIS_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id axis: u8, // The gamepad axis (SDL_GamepadAxis) padding1: u8, padding2: u8, padding3: u8, value: i16, // The axis value (range: -32768 to 32767) padding4: u16, }; pub const GamepadButtonEvent = extern struct { type: EventType, // SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id button: u8, // The gamepad button (SDL_GamepadButton) down: bool, // true if the button is pressed padding1: u8, padding2: u8, }; pub const GamepadDeviceEvent = extern struct { type: EventType, // SDL_EVENT_GAMEPAD_ADDED, SDL_EVENT_GAMEPAD_REMOVED, or SDL_EVENT_GAMEPAD_REMAPPED, SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id }; pub const GamepadTouchpadEvent = extern struct { type: EventType, // SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id touchpad: i32, // The index of the touchpad finger: i32, // The index of the finger on the touchpad x: f32, // Normalized in the range 0...1 with 0 being on the left y: f32, // Normalized in the range 0...1 with 0 being at the top pressure: f32, // Normalized in the range 0...1 }; pub const GamepadSensorEvent = extern struct { type: EventType, // SDL_EVENT_GAMEPAD_SENSOR_UPDATE reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: JoystickID, // The joystick instance id sensor: i32, // The type of the sensor, one of the values of SDL_SensorType data: [3]f32, // Up to 3 values from the sensor, as defined in SDL_sensor.h sensor_timestamp: u64, // The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock }; pub const AudioDeviceEvent = extern struct { type: EventType, // SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: AudioDeviceID, // SDL_AudioDeviceID for the device being added or removed or changing recording: bool, // false if a playback device, true if a recording device. padding1: u8, padding2: u8, padding3: u8, }; pub const CameraDeviceEvent = extern struct { type: EventType, // SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: CameraID, // SDL_CameraID for the device being added or removed or changing }; pub const RenderEvent = extern struct { type: EventType, // SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window containing the renderer in question. }; pub const TouchFingerEvent = extern struct { type: EventType, // SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() touchID: TouchID, // The touch device id fingerID: FingerID, x: f32, // Normalized in the range 0...1 y: f32, // Normalized in the range 0...1 dx: f32, // Normalized in the range -1...1 dy: f32, // Normalized in the range -1...1 pressure: f32, // Normalized in the range 0...1 windowID: WindowID, // The window underneath the finger, if any }; pub const PenProximityEvent = extern struct { type: EventType, // SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with pen focus, if any which: PenID, // The pen instance id }; pub const PenMotionEvent = extern struct { type: EventType, // SDL_EVENT_PEN_MOTION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with pen focus, if any which: PenID, // The pen instance id pen_state: PenInputFlags, // Complete pen input state at time of event x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window }; pub const PenTouchEvent = extern struct { type: EventType, // SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with pen focus, if any which: PenID, // The pen instance id pen_state: PenInputFlags, // Complete pen input state at time of event x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window eraser: bool, // true if eraser end is used (not all pens support this). down: bool, // true if the pen is touching or false if the pen is lifted off }; pub const PenButtonEvent = extern struct { type: EventType, // SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with mouse focus, if any which: PenID, // The pen instance id pen_state: PenInputFlags, // Complete pen input state at time of event x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window button: u8, // The pen button index (first button is 1). down: bool, // true if the button is pressed }; pub const PenAxisEvent = extern struct { type: EventType, // SDL_EVENT_PEN_AXIS reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window with pen focus, if any which: PenID, // The pen instance id pen_state: PenInputFlags, // Complete pen input state at time of event x: f32, // X coordinate, relative to window y: f32, // Y coordinate, relative to window axis: PenAxis, // Axis that has changed value: f32, // New value of axis }; pub const DropEvent = extern struct { type: EventType, // SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The window that was dropped on, if any x: f32, // X coordinate, relative to window (not on begin) y: f32, // Y coordinate, relative to window (not on begin) source: [*c]const u8, // The source app that sent this drop event, or NULL if that isn't available data: [*c]const u8, // The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events }; pub const ClipboardEvent = extern struct { type: EventType, // SDL_EVENT_CLIPBOARD_UPDATE reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() owner: bool, // are we owning the clipboard (internal update) num_mime_types: i32, // number of mime types mime_types: [*c][*c]const u8, // current mime types }; pub const SensorEvent = extern struct { type: EventType, // SDL_EVENT_SENSOR_UPDATE reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() which: SensorID, // The instance ID of the sensor data: [6]f32, // Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() sensor_timestamp: u64, // The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock }; pub const QuitEvent = extern struct { type: EventType, // SDL_EVENT_QUIT reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() }; pub const UserEvent = extern struct { type: u32, // SDL_EVENT_USER through SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() windowID: WindowID, // The associated window if any code: i32, // User defined event code data1: ?*anyopaque, // User defined data pointer data2: ?*anyopaque, // User defined data pointer }; pub const Event = extern union { type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration common: CommonEvent, // Common event data display: DisplayEvent, // Display event data window: WindowEvent, // Window event data kdevice: KeyboardDeviceEvent, // Keyboard device change event data key: KeyboardEvent, // Keyboard event data edit: TextEditingEvent, // Text editing event data edit_candidates: TextEditingCandidatesEvent, // Text editing candidates event data text: TextInputEvent, // Text input event data mdevice: MouseDeviceEvent, // Mouse device change event data motion: MouseMotionEvent, // Mouse motion event data button: MouseButtonEvent, // Mouse button event data wheel: MouseWheelEvent, // Mouse wheel event data jdevice: JoyDeviceEvent, // Joystick device change event data jaxis: JoyAxisEvent, // Joystick axis event data jball: JoyBallEvent, // Joystick ball event data jhat: JoyHatEvent, // Joystick hat event data jbutton: JoyButtonEvent, // Joystick button event data jbattery: JoyBatteryEvent, // Joystick battery event data gdevice: GamepadDeviceEvent, // Gamepad device event data gaxis: GamepadAxisEvent, // Gamepad axis event data gbutton: GamepadButtonEvent, // Gamepad button event data gtouchpad: GamepadTouchpadEvent, // Gamepad touchpad event data gsensor: GamepadSensorEvent, // Gamepad sensor event data adevice: AudioDeviceEvent, // Audio device event data cdevice: CameraDeviceEvent, // Camera device event data sensor: SensorEvent, // Sensor event data quit: QuitEvent, // Quit request event data user: UserEvent, // Custom event data tfinger: TouchFingerEvent, // Touch finger event data pproximity: PenProximityEvent, // Pen proximity event data ptouch: PenTouchEvent, // Pen tip touching event data pmotion: PenMotionEvent, // Pen motion event data pbutton: PenButtonEvent, // Pen button event data paxis: PenAxisEvent, // Pen axis event data render: RenderEvent, // Render event data drop: DropEvent, // Drag and drop event data clipboard: ClipboardEvent, // Clipboard event data padding: [128]u8, }; pub inline fn pumpEvents() void { return c.SDL_PumpEvents(); } pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int { return c.SDL_PeepEvents(events, numevents, action, minType, maxType); } pub inline fn hasEvent(type: u32) bool { return c.SDL_HasEvent(type); } pub inline fn hasEvents(minType: u32, maxType: u32) bool { return c.SDL_HasEvents(minType, maxType); } pub inline fn flushEvent(type: u32) void { return c.SDL_FlushEvent(type); } pub inline fn flushEvents(minType: u32, maxType: u32) void { return c.SDL_FlushEvents(minType, maxType); } pub inline fn pollEvent(event: ?*Event) bool { return c.SDL_PollEvent(event); } pub inline fn waitEvent(event: ?*Event) bool { return c.SDL_WaitEvent(event); } pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { return c.SDL_WaitEventTimeout(event, timeoutMS); } pub inline fn pushEvent(event: ?*Event) bool { return c.SDL_PushEvent(event); } pub const EventFilter = *const fn (userdata: ?*anyopaque, event: ?*Event) callconv(.C) bool; pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void { return c.SDL_SetEventFilter(filter, userdata); } pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool { return c.SDL_GetEventFilter(filter, userdata); } pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { return c.SDL_AddEventWatch(filter, userdata); } pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void { return c.SDL_RemoveEventWatch(filter, userdata); } pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void { return c.SDL_FilterEvents(filter, userdata); } pub inline fn setEventEnabled(type: u32, enabled: bool) void { return c.SDL_SetEventEnabled(type, enabled); } pub inline fn eventEnabled(type: u32) bool { return c.SDL_EventEnabled(type); } pub inline fn registerEvents(numevents: c_int) u32 { return c.SDL_RegisterEvents(numevents); } pub inline fn getWindowFromEvent(event: *const Event) ?*Window { return c.SDL_GetWindowFromEvent(@ptrCast(event)); }