const std = @import("std"); pub const c = @import("c.zig").c; pub const FPoint = extern struct { x: f32, y: f32, }; pub const PixelFormat = enum(c_int) { pixelformatYv12 = 0x32315659, //Planar mode: Y + V + U (3 planes) pixelformatIyuv = 0x56555949, //Planar mode: Y + U + V (3 planes) pixelformatYuy2 = 0x32595559, //Packed mode: Y0+U0+Y1+V0 (1 plane) pixelformatUyvy = 0x59565955, //Packed mode: U0+Y0+V0+Y1 (1 plane) pixelformatYvyu = 0x55595659, //Packed mode: Y0+V0+Y1+U0 (1 plane) pixelformatNv12 = 0x3231564e, //Planar mode: Y + U/V interleaved (2 planes) pixelformatNv21 = 0x3132564e, //Planar mode: Y + V/U interleaved (2 planes) pixelformatP010 = 0x30313050, //Planar mode: Y + U/V interleaved (2 planes) pixelformatExternalOes = 0x2053454f, //Android video texture format }; pub const FColor = extern struct { r: f32, g: f32, b: f32, a: f32, }; pub const Surface = opaque { pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer { return @ptrCast(c.SDL_CreateSoftwareRenderer(@ptrCast(surface))); } }; pub const ScaleMode = enum(c_int) { scalemodeNearest, //nearest pixel sampling scalemodeLinear, //linear filtering }; pub const PropertiesID = u32; pub const BlendMode = u32; pub const Window = opaque { pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer { return @ptrCast(c.SDL_CreateRenderer(@ptrCast(window), name)); } pub inline fn getRenderer(window: *Window) ?*Renderer { return @ptrCast(c.SDL_GetRenderer(@ptrCast(window))); } }; pub const FRect = extern struct { x: f32, y: f32, w: f32, h: f32, }; 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 QuitEvent = extern struct { _type: EventType, // SDL_EVENT_QUIT reserved: u32, timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS() }; 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 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 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 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 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 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 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 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 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 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 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 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 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 EventType = enum(c_int) { eventFirst = 0, //Unused (do not remove) eventQuit = 0x100, //User-requested quit eventTerminating, eventLowMemory, eventWillEnterBackground, eventDidEnterBackground, eventWillEnterForeground, eventDidEnterForeground, eventLocaleChanged, //The user's locale preferences have changed. eventSystemThemeChanged, //The system theme changed eventDisplayOrientation = 0x151, //Display orientation has changed to data1 eventDisplayAdded, //Display has been added to the system eventDisplayRemoved, //Display has been removed from the system eventDisplayMoved, //Display has changed position eventDisplayDesktopModeChanged, //Display has changed desktop mode eventDisplayCurrentModeChanged, //Display has changed current mode eventDisplayContentScaleChanged, //Display has changed content scale eventWindowShown = 0x202, //Window has been shown eventWindowHidden, //Window has been hidden eventWindowExposed, //Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event eventWindowMoved, //Window has been moved to data1, data2 eventWindowResized, //Window has been resized to data1xdata2 eventWindowPixelSizeChanged, //The pixel size of the window has changed to data1xdata2 eventWindowMetalViewResized, //The pixel size of a Metal view associated with the window has changed eventWindowMinimized, //Window has been minimized eventWindowMaximized, //Window has been maximized eventWindowRestored, //Window has been restored to normal size and position eventWindowMouseEnter, //Window has gained mouse focus eventWindowMouseLeave, //Window has lost mouse focus eventWindowFocusGained, //Window has gained keyboard focus eventWindowFocusLost, //Window has lost keyboard focus eventWindowCloseRequested, //The window manager requests that the window be closed eventWindowHitTest, //Window had a hit test that wasn't SDL_HITTEST_NORMAL eventWindowIccprofChanged, //The ICC profile of the window's display has changed eventWindowDisplayChanged, //Window has been moved to display data1 eventWindowDisplayScaleChanged, //Window display scale has been changed eventWindowSafeAreaChanged, //The window safe area has been changed eventWindowOccluded, //The window has been occluded eventWindowEnterFullscreen, //The window has entered fullscreen mode eventWindowLeaveFullscreen, //The window has left fullscreen mode eventWindowDestroyed, eventWindowHdrStateChanged, //Window HDR properties have changed eventKeyDown = 0x300, //Key pressed eventKeyUp, //Key released eventTextEditing, //Keyboard text editing (composition) eventTextInput, //Keyboard text input eventKeymapChanged, eventKeyboardAdded, //A new keyboard has been inserted into the system eventKeyboardRemoved, //A keyboard has been removed eventTextEditingCandidates, //Keyboard text editing candidates eventMouseMotion = 0x400, //Mouse moved eventMouseButtonDown, //Mouse button pressed eventMouseButtonUp, //Mouse button released eventMouseWheel, //Mouse wheel motion eventMouseAdded, //A new mouse has been inserted into the system eventMouseRemoved, //A mouse has been removed eventJoystickAxisMotion = 0x600, //Joystick axis motion eventJoystickBallMotion, //Joystick trackball motion eventJoystickHatMotion, //Joystick hat position change eventJoystickButtonDown, //Joystick button pressed eventJoystickButtonUp, //Joystick button released eventJoystickAdded, //A new joystick has been inserted into the system eventJoystickRemoved, //An opened joystick has been removed eventJoystickBatteryUpdated, //Joystick battery level change eventJoystickUpdateComplete, //Joystick update is complete eventGamepadAxisMotion = 0x650, //Gamepad axis motion eventGamepadButtonDown, //Gamepad button pressed eventGamepadButtonUp, //Gamepad button released eventGamepadAdded, //A new gamepad has been inserted into the system eventGamepadRemoved, //A gamepad has been removed eventGamepadRemapped, //The gamepad mapping was updated eventGamepadTouchpadDown, //Gamepad touchpad was touched eventGamepadTouchpadMotion, //Gamepad touchpad finger was moved eventGamepadTouchpadUp, //Gamepad touchpad finger was lifted eventGamepadSensorUpdate, //Gamepad sensor was updated eventGamepadUpdateComplete, //Gamepad update is complete eventGamepadSteamHandleUpdated, //Gamepad Steam handle has changed eventFingerUp, eventFingerMotion, eventFingerCanceled, eventClipboardUpdate = 0x900, //The clipboard or primary selection changed eventDropFile = 0x1000, //The system requests a file open eventDropText, //text/plain drag-and-drop event eventDropBegin, //A new set of drops is beginning (NULL filename) eventDropComplete, //Current set of drops is now complete (NULL filename) eventDropPosition, //Position while moving over the window eventAudioDeviceAdded = 0x1100, //A new audio device is available eventAudioDeviceRemoved, //An audio device has been removed. eventAudioDeviceFormatChanged, //An audio device's format has been changed by the system. eventSensorUpdate = 0x1200, //A sensor was updated eventPenProximityIn = 0x1300, //Pressure-sensitive pen has become available eventPenProximityOut, //Pressure-sensitive pen has become unavailable eventPenDown, //Pressure-sensitive pen touched drawing surface eventPenUp, //Pressure-sensitive pen stopped touching drawing surface eventPenButtonDown, //Pressure-sensitive pen button pressed eventPenButtonUp, //Pressure-sensitive pen button released eventPenMotion, //Pressure-sensitive pen is moving on the tablet eventPenAxis, //Pressure-sensitive pen angle/pressure/etc changed eventCameraDeviceAdded = 0x1400, //A new camera device is available eventCameraDeviceRemoved, //A camera device has been removed. eventCameraDeviceApproved, //A camera device has been approved for use by the user. eventCameraDeviceDenied, //A camera device has been denied for use by the user. eventRenderTargetsReset = 0x2000, //The render targets have been reset and their contents need to be updated eventRenderDeviceReset, //The device has been reset and all textures need to be recreated eventRenderDeviceLost, //The device has been lost and can't be recovered. eventPrivate1, eventPrivate2, eventPrivate3, eventPollSentinel = 0x7F00, //Signals the end of an event poll cycle }; pub const JoystickID = u32; pub const WindowID = u32; pub const MouseID = u32; pub const MouseButtonFlags = packed struct(u32) { buttonLeft: bool = false, buttonMiddle: bool = false, buttonX1: bool = false, pad0: u28 = 0, rsvd: bool = false, pub const None = MouseButtonFlags{}; pub const ButtonRight: MouseButtonFlags = @bitCast(@as(u32, 3)); pub const ButtonX2: MouseButtonFlags = @bitCast(@as(u32, 5)); }; 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 None = PenInputFlags{}; }; pub const PenID = packed struct(u32) { pad0: u31 = 0, rsvd: bool = false, pub const None = PenID{}; }; pub const DisplayID = u32; pub const CameraID = u32; pub const KeyboardID = u32; pub const PowerState = enum(c_int) { powerstateError = -1, //error determining power status powerstateUnknown, //cannot determine power status powerstateOnBattery, //Not plugged in, running on the battery powerstateNoBattery, //Plugged in, no battery available powerstateCharging, //Plugged in, charging battery powerstateCharged, }; pub const TouchID = u64; pub const FingerID = u64; pub const SensorID = u32; pub const AudioDeviceID = u32; pub const MouseWheelDirection = enum(c_int) { mousewheelNormal, //The scroll direction is normal mousewheelFlipped, //The scroll direction is flipped / natural }; pub const PenAxis = enum(c_int) { penAxisPressure, //Pen pressure. Unidirectional: 0 to 1.0 penAxisXtilt, //Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right). penAxisYtilt, //Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down). penAxisDistance, //Pen distance to drawing surface. Unidirectional: 0.0 to 1.0 penAxisRotation, //Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). penAxisSlider, //Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 penAxisTangentialPressure, //Pressure from squeezing the pen ("barrel pressure"). penAxisCount, //Total known pen axis types in this version of SDL. This number may grow in future releases! }; pub const Scancode = enum(c_int) { scancodeBackslash = 49, scancodeNonushash = 50, scancodeGrave = 53, scancodeInsert = 73, scancodeNumlockclear = 83, scancodeNonusbackslash = 100, scancodeApplication = 101, //windows contextual menu, compose scancodePower = 102, scancodeHelp = 117, //AL Integrated Help Center scancodeMenu = 118, //Menu (show menu) scancodeStop = 120, //AC Stop scancodeAgain = 121, //AC Redo/Repeat scancodeUndo = 122, //AC Undo scancodeCut = 123, //AC Cut scancodeCopy = 124, //AC Copy scancodePaste = 125, //AC Paste scancodeFind = 126, //AC Find scancodeInternational1 = 135, scancodeInternational3 = 137, //Yen scancodeLang1 = 144, //Hangul/English toggle scancodeLang2 = 145, //Hanja conversion scancodeLang3 = 146, //Katakana scancodeLang4 = 147, //Hiragana scancodeLang5 = 148, //Zenkaku/Hankaku scancodeLang6 = 149, //reserved scancodeLang7 = 150, //reserved scancodeLang8 = 151, //reserved scancodeLang9 = 152, //reserved scancodeAlterase = 153, //Erase-Eaze scancodeCancel = 155, //AC Cancel scancodeLalt = 226, //alt, option scancodeLgui = 227, //windows, command (apple), meta scancodeRalt = 230, //alt gr, option scancodeRgui = 231, //windows, command (apple), meta scancodeMode = 257, scancodeSleep = 258, //Sleep scancodeWake = 259, //Wake scancodeChannelIncrement = 260, //Channel Increment scancodeChannelDecrement = 261, //Channel Decrement scancodeMediaPlay = 262, //Play scancodeMediaPause = 263, //Pause scancodeMediaRecord = 264, //Record scancodeMediaFastForward = 265, //Fast Forward scancodeMediaRewind = 266, //Rewind scancodeMediaNextTrack = 267, //Next Track scancodeMediaPreviousTrack = 268, //Previous Track scancodeMediaStop = 269, //Stop scancodeMediaEject = 270, //Eject scancodeMediaPlayPause = 271, //Play / Pause scancodeMediaSelect = 272, scancodeAcNew = 273, //AC New scancodeAcOpen = 274, //AC Open scancodeAcClose = 275, //AC Close scancodeAcExit = 276, //AC Exit scancodeAcSave = 277, //AC Save scancodeAcPrint = 278, //AC Print scancodeAcProperties = 279, //AC Properties scancodeAcSearch = 280, //AC Search scancodeAcHome = 281, //AC Home scancodeAcBack = 282, //AC Back scancodeAcForward = 283, //AC Forward scancodeAcStop = 284, //AC Stop scancodeAcRefresh = 285, //AC Refresh scancodeAcBookmarks = 286, //AC Bookmarks scancodeSoftleft = 287, scancodeSoftright = 288, scancodeCall = 289, //Used for accepting phone calls. scancodeEndcall = 290, //Used for rejecting phone calls. scancodeReserved = 400, //400-500 reserved for dynamic keycodes scancodeCount = 512, }; pub const Keymod = u16; pub const Keycode = u32; pub const FlipMode = enum(c_int) { flipNone, //Do not flip flipHorizontal, //flip horizontally flipVertical, //flip vertically }; pub const Rect = extern struct { x: c_int, y: c_int, w: c_int, h: c_int, }; pub const WindowFlags = packed struct(u64) { windowFullscreen: bool = false, // window is in fullscreen mode windowOpengl: bool = false, // window usable with OpenGL context windowOccluded: bool = false, // window is occluded windowHidden: bool = false, // window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible windowBorderless: bool = false, // no window decoration windowResizable: bool = false, // window can be resized windowMinimized: bool = false, // window is minimized windowMaximized: bool = false, // window is maximized windowMouseGrabbed: bool = false, // window has grabbed mouse input windowInputFocus: bool = false, // window has input focus windowMouseFocus: bool = false, // window has mouse focus windowExternal: bool = false, // window not created by SDL windowModal: bool = false, // window is modal windowHighPixelDensity: bool = false, // window uses high pixel density back buffer if possible windowMouseCapture: bool = false, // window has mouse captured (unrelated to MOUSE_GRABBED) windowMouseRelativeMode: bool = false, // window has relative mode enabled windowAlwaysOnTop: bool = false, // window should always be above others windowUtility: bool = false, // window should be treated as a utility window, not showing in the task bar and window list windowTooltip: bool = false, // window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window windowPopupMenu: bool = false, // window should be treated as a popup menu, requires a parent window windowKeyboardGrabbed: bool = false, // window has grabbed keyboard input windowVulkan: bool = false, // window usable for Vulkan surface windowMetal: bool = false, // window usable for Metal view windowTransparent: bool = false, // window with transparent buffer windowNotFocusable: bool = false, // window should not be focusable pad0: u38 = 0, rsvd: bool = false, pub const None = WindowFlags{}; }; pub const Vertex = extern struct { position: FPoint, // Vertex position, in SDL_Renderer coordinates color: FColor, // Vertex color tex_coord: FPoint, // Normalized texture coordinates, if needed }; pub const TextureAccess = enum(c_int) { textureaccessStatic, //Changes rarely, not lockable textureaccessStreaming, //Changes frequently, lockable textureaccessTarget, //Texture can be used as a render target }; pub const RendererLogicalPresentation = enum(c_int) { logicalPresentationDisabled, //There is no logical size in effect logicalPresentationStretch, //The rendered content is stretched to the output resolution logicalPresentationLetterbox, //The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars logicalPresentationOverscan, //The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds logicalPresentationIntegerScale, //The rendered content is scaled up by integer multiples to fit the output resolution }; pub const Renderer = opaque { pub inline fn getRenderWindow(renderer: *Renderer) ?*Window { return @ptrCast(c.SDL_GetRenderWindow(@ptrCast(renderer))); } pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 { return c.SDL_GetRendererName(@ptrCast(renderer)); } pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID { return c.SDL_GetRendererProperties(@ptrCast(renderer)); } pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetRenderOutputSize(@ptrCast(renderer), @ptrCast(w), @ptrCast(h))); } pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetCurrentRenderOutputSize(@ptrCast(renderer), @ptrCast(w), @ptrCast(h))); } pub inline fn createTexture(renderer: *Renderer, format: PixelFormat, access: TextureAccess, w: c_int, h: c_int) ?*Texture { return @ptrCast(c.SDL_CreateTexture(@ptrCast(renderer), @bitCast(format), access, w, h)); } pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture { return @ptrCast(c.SDL_CreateTextureFromSurface(@ptrCast(renderer), @ptrCast(surface))); } pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture { return @ptrCast(c.SDL_CreateTextureWithProperties(@ptrCast(renderer), props)); } pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { return @bitCast(c.SDL_SetRenderTarget(@ptrCast(renderer), @ptrCast(texture))); } pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { return @ptrCast(c.SDL_GetRenderTarget(@ptrCast(renderer))); } pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool { return @bitCast(c.SDL_SetRenderLogicalPresentation(@ptrCast(renderer), w, h, mode)); } pub inline fn getRenderLogicalPresentation(renderer: *Renderer, w: *c_int, h: *c_int, mode: ?*RendererLogicalPresentation) bool { return @bitCast(c.SDL_GetRenderLogicalPresentation(@ptrCast(renderer), @ptrCast(w), @ptrCast(h), @ptrCast(mode))); } pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { return @bitCast(c.SDL_GetRenderLogicalPresentationRect(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderCoordinatesFromWindow(renderer: *Renderer, window_x: f32, window_y: f32, x: *f32, y: *f32) bool { return @bitCast(c.SDL_RenderCoordinatesFromWindow(@ptrCast(renderer), window_x, window_y, @ptrCast(x), @ptrCast(y))); } pub inline fn renderCoordinatesToWindow(renderer: *Renderer, x: f32, y: f32, window_x: *f32, window_y: *f32) bool { return @bitCast(c.SDL_RenderCoordinatesToWindow(@ptrCast(renderer), x, y, @ptrCast(window_x), @ptrCast(window_y))); } pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool { return @bitCast(c.SDL_ConvertEventToRenderCoordinates(@ptrCast(renderer), @ptrCast(event))); } pub inline fn setRenderViewport(renderer: *Renderer, rect: ?*const Rect) bool { return @bitCast(c.SDL_SetRenderViewport(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { return @bitCast(c.SDL_GetRenderViewport(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderViewportSet(renderer: *Renderer) bool { return @bitCast(c.SDL_RenderViewportSet(@ptrCast(renderer))); } pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { return @bitCast(c.SDL_GetRenderSafeArea(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn setRenderClipRect(renderer: *Renderer, rect: ?*const Rect) bool { return @bitCast(c.SDL_SetRenderClipRect(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { return @bitCast(c.SDL_GetRenderClipRect(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderClipEnabled(renderer: *Renderer) bool { return @bitCast(c.SDL_RenderClipEnabled(@ptrCast(renderer))); } pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { return @bitCast(c.SDL_SetRenderScale(@ptrCast(renderer), scaleX, scaleY)); } pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool { return @bitCast(c.SDL_GetRenderScale(@ptrCast(renderer), @ptrCast(scaleX), @ptrCast(scaleY))); } pub inline fn setRenderDrawColor(renderer: *Renderer, r: u8, g: u8, b: u8, a: u8) bool { return @bitCast(c.SDL_SetRenderDrawColor(@ptrCast(renderer), r, g, b, a)); } pub inline fn setRenderDrawColorFloat(renderer: *Renderer, r: f32, g: f32, b: f32, a: f32) bool { return @bitCast(c.SDL_SetRenderDrawColorFloat(@ptrCast(renderer), r, g, b, a)); } pub inline fn getRenderDrawColor(renderer: *Renderer, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool { return @bitCast(c.SDL_GetRenderDrawColor(@ptrCast(renderer), r, g, b, a)); } pub inline fn getRenderDrawColorFloat(renderer: *Renderer, r: *f32, g: *f32, b: *f32, a: *f32) bool { return @bitCast(c.SDL_GetRenderDrawColorFloat(@ptrCast(renderer), @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); } pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool { return @bitCast(c.SDL_SetRenderColorScale(@ptrCast(renderer), scale)); } pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { return @bitCast(c.SDL_GetRenderColorScale(@ptrCast(renderer), @ptrCast(scale))); } pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { return @bitCast(c.SDL_SetRenderDrawBlendMode(@ptrCast(renderer), @intFromEnum(blendMode))); } pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { return @bitCast(c.SDL_GetRenderDrawBlendMode(@ptrCast(renderer), @ptrCast(blendMode))); } pub inline fn renderClear(renderer: *Renderer) bool { return @bitCast(c.SDL_RenderClear(@ptrCast(renderer))); } pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { return @bitCast(c.SDL_RenderPoint(@ptrCast(renderer), x, y)); } pub inline fn renderPoints(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool { return @bitCast(c.SDL_RenderPoints(@ptrCast(renderer), @ptrCast(points), count)); } pub inline fn renderLine(renderer: *Renderer, x1: f32, y1: f32, x2: f32, y2: f32) bool { return @bitCast(c.SDL_RenderLine(@ptrCast(renderer), x1, y1, x2, y2)); } pub inline fn renderLines(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool { return @bitCast(c.SDL_RenderLines(@ptrCast(renderer), @ptrCast(points), count)); } pub inline fn renderRect(renderer: *Renderer, rect: ?*const FRect) bool { return @bitCast(c.SDL_RenderRect(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool { return @bitCast(c.SDL_RenderRects(@ptrCast(renderer), @ptrCast(rects), count)); } pub inline fn renderFillRect(renderer: *Renderer, rect: ?*const FRect) bool { return @bitCast(c.SDL_RenderFillRect(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderFillRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool { return @bitCast(c.SDL_RenderFillRects(@ptrCast(renderer), @ptrCast(rects), count)); } pub inline fn renderTexture(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, dstrect: ?*const FRect) bool { return @bitCast(c.SDL_RenderTexture(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), @ptrCast(dstrect))); } pub inline fn renderTextureRotated(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, dstrect: ?*const FRect, angle: f64, center: ?*const FPoint, flip: FlipMode) bool { return @bitCast(c.SDL_RenderTextureRotated(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip))); } pub inline fn renderTextureAffine(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, origin: ?*const FPoint, right: ?*const FPoint, down: ?*const FPoint) bool { return @bitCast(c.SDL_RenderTextureAffine(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down))); } pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, scale: f32, dstrect: ?*const FRect) bool { return @bitCast(c.SDL_RenderTextureTiled(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), scale, @ptrCast(dstrect))); } pub inline fn renderTexture9Grid(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, left_width: f32, right_width: f32, top_height: f32, bottom_height: f32, scale: f32, dstrect: ?*const FRect) bool { return @bitCast(c.SDL_RenderTexture9Grid(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect))); } pub inline fn renderGeometry(renderer: *Renderer, texture: ?*Texture, vertices: ?*const Vertex, num_vertices: c_int, indices: [*c]const c_int, num_indices: c_int) bool { return @bitCast(c.SDL_RenderGeometry(@ptrCast(renderer), @ptrCast(texture), @ptrCast(vertices), num_vertices, indices, num_indices)); } pub inline fn renderGeometryRaw(renderer: *Renderer, texture: ?*Texture, xy: *const f32, xy_stride: c_int, color: ?*const FColor, color_stride: c_int, uv: *const f32, uv_stride: c_int, num_vertices: c_int, indices: ?*const anyopaque, num_indices: c_int, size_indices: c_int) bool { return @bitCast(c.SDL_RenderGeometryRaw(@ptrCast(renderer), @ptrCast(texture), @ptrCast(xy), xy_stride, @ptrCast(color), color_stride, @ptrCast(uv), uv_stride, num_vertices, indices, num_indices, size_indices)); } pub inline fn renderReadPixels(renderer: *Renderer, rect: ?*const Rect) ?*Surface { return @ptrCast(c.SDL_RenderReadPixels(@ptrCast(renderer), @ptrCast(rect))); } pub inline fn renderPresent(renderer: *Renderer) bool { return @bitCast(c.SDL_RenderPresent(@ptrCast(renderer))); } pub inline fn destroyRenderer(renderer: *Renderer) void { return c.SDL_DestroyRenderer(@ptrCast(renderer)); } pub inline fn flushRenderer(renderer: *Renderer) bool { return @bitCast(c.SDL_FlushRenderer(@ptrCast(renderer))); } pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { return c.SDL_GetRenderMetalLayer(@ptrCast(renderer)); } pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque { return c.SDL_GetRenderMetalCommandEncoder(@ptrCast(renderer)); } pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool { return @bitCast(c.SDL_AddVulkanRenderSemaphores(@ptrCast(renderer), wait_stage_mask, wait_semaphore, signal_semaphore)); } pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool { return @bitCast(c.SDL_SetRenderVSync(@ptrCast(renderer), vsync)); } pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { return @bitCast(c.SDL_GetRenderVSync(@ptrCast(renderer), @ptrCast(vsync))); } pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool { return @bitCast(c.SDL_RenderDebugText(@ptrCast(renderer), x, y, str)); } }; pub const Texture = opaque { pub inline fn getTextureProperties(texture: *Texture) PropertiesID { return c.SDL_GetTextureProperties(@ptrCast(texture)); } pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer { return @ptrCast(c.SDL_GetRendererFromTexture(@ptrCast(texture))); } pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { return @bitCast(c.SDL_GetTextureSize(@ptrCast(texture), @ptrCast(w), @ptrCast(h))); } pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool { return @bitCast(c.SDL_SetTextureColorMod(@ptrCast(texture), r, g, b)); } pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool { return @bitCast(c.SDL_SetTextureColorModFloat(@ptrCast(texture), r, g, b)); } pub inline fn getTextureColorMod(texture: *Texture, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool { return @bitCast(c.SDL_GetTextureColorMod(@ptrCast(texture), r, g, b)); } pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool { return @bitCast(c.SDL_GetTextureColorModFloat(@ptrCast(texture), @ptrCast(r), @ptrCast(g), @ptrCast(b))); } pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool { return @bitCast(c.SDL_SetTextureAlphaMod(@ptrCast(texture), alpha)); } pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { return @bitCast(c.SDL_SetTextureAlphaModFloat(@ptrCast(texture), alpha)); } pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { return @bitCast(c.SDL_GetTextureAlphaMod(@ptrCast(texture), alpha)); } pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { return @bitCast(c.SDL_GetTextureAlphaModFloat(@ptrCast(texture), @ptrCast(alpha))); } pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { return @bitCast(c.SDL_SetTextureBlendMode(@ptrCast(texture), @intFromEnum(blendMode))); } pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { return @bitCast(c.SDL_GetTextureBlendMode(@ptrCast(texture), @ptrCast(blendMode))); } pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { return @bitCast(c.SDL_SetTextureScaleMode(@ptrCast(texture), @intFromEnum(scaleMode))); } pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { return @bitCast(c.SDL_GetTextureScaleMode(@ptrCast(texture), @ptrCast(scaleMode))); } pub inline fn updateTexture(texture: *Texture, rect: ?*const Rect, pixels: ?*const anyopaque, pitch: c_int) bool { return @bitCast(c.SDL_UpdateTexture(@ptrCast(texture), @ptrCast(rect), pixels, pitch)); } pub inline fn updateYUVTexture(texture: *Texture, rect: ?*const Rect, Yplane: [*c]const u8, Ypitch: c_int, Uplane: [*c]const u8, Upitch: c_int, Vplane: [*c]const u8, Vpitch: c_int) bool { return @bitCast(c.SDL_UpdateYUVTexture(@ptrCast(texture), @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch)); } pub inline fn updateNVTexture(texture: *Texture, rect: ?*const Rect, Yplane: [*c]const u8, Ypitch: c_int, UVplane: [*c]const u8, UVpitch: c_int) bool { return @bitCast(c.SDL_UpdateNVTexture(@ptrCast(texture), @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch)); } pub inline fn lockTexture(texture: *Texture, rect: ?*const Rect, pixels: [*c]?*anyopaque, pitch: *c_int) bool { return @bitCast(c.SDL_LockTexture(@ptrCast(texture), @ptrCast(rect), pixels, @ptrCast(pitch))); } pub inline fn lockTextureToSurface(texture: *Texture, rect: ?*const Rect, surface: [*c]?*Surface) bool { return @bitCast(c.SDL_LockTextureToSurface(@ptrCast(texture), @ptrCast(rect), surface)); } pub inline fn unlockTexture(texture: *Texture) void { return c.SDL_UnlockTexture(@ptrCast(texture)); } pub inline fn destroyTexture(texture: *Texture) void { return c.SDL_DestroyTexture(@ptrCast(texture)); } }; pub inline fn getNumRenderDrivers() c_int { return c.SDL_GetNumRenderDrivers(); } pub inline fn getRenderDriver(index: c_int) [*c]const u8 { return c.SDL_GetRenderDriver(index); } pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: c_int, window_flags: WindowFlags, window: [*c]?*Window, renderer: [*c]?*Renderer) bool { return @bitCast(c.SDL_CreateWindowAndRenderer(title, width, height, @bitCast(window_flags), window, renderer)); } pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer { return @ptrCast(c.SDL_CreateRendererWithProperties(props)); }