saving, using 3.2.28 stable

This commit is contained in:
peterino2 2026-01-26 23:43:32 -08:00
parent 1dcfa945e9
commit acd3f608ca
12 changed files with 113 additions and 384 deletions

View File

@ -5,7 +5,8 @@
.minimum_zig_version = "0.15.2",
.dependencies = .{
.sdl = .{
.path = "../castholm-sdl",
.url = "git+https://github.com/castholm/SDL.git?ref=v0.3.3+3.2.28#2cde21ea89c7b67d6e16f7f1e2faaa6f44618ecb",
.hash = "sdl-0.3.3+3.2.28-7uIn9MiRfwFhqxnwBi_vCQlKr82YpwkQBVwdz2uy46S1",
},
},
.paths = .{

View File

@ -1,14 +1,14 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PropertiesID = u32;
pub const IOStream = opaque {
pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool {
return @bitCast(c.SDL_LoadWAV_IO(@ptrCast(iostream), @bitCast(closeio), @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
}
};
pub const PropertiesID = u32;
pub const AudioFormat = enum(c_int) {
audioUnknown = 0x0000, //Unspecified audio format
audioU8 = 0x0008, //Unsigned 8-bit samples
@ -86,14 +86,6 @@ pub const AudioStream = opaque {
return @bitCast(c.SDL_PutAudioStreamData(@ptrCast(audiostream), buf, len));
}
pub inline fn putAudioStreamDataNoCopy(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int, callback: AudioStreamDataCompleteCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_PutAudioStreamDataNoCopy(@ptrCast(audiostream), buf, len, callback, userdata));
}
pub inline fn putAudioStreamPlanarData(audiostream: *AudioStream, channel_buffers: [*c]const *anyopaque, num_channels: c_int, num_samples: c_int) bool {
return @bitCast(c.SDL_PutAudioStreamPlanarData(@ptrCast(audiostream), channel_buffers, num_channels, num_samples));
}
pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int {
return c.SDL_GetAudioStreamData(@ptrCast(audiostream), buf, len);
}
@ -231,8 +223,6 @@ pub inline fn createAudioStream(src_spec: ?*const AudioSpec, dst_spec: ?*const A
return @ptrCast(c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)));
}
pub const AudioStreamDataCompleteCallback = c.SDL_AudioStreamDataCompleteCallback;
pub const AudioStreamCallback = c.SDL_AudioStreamCallback;
pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: ?*const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream {

View File

@ -43,7 +43,7 @@ pub const Colorspace = enum(c_int) {
colorspaceBt2020Full = 0x22102609, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
pub const colorspaceRgbDefault = .colorspaceSrgb; //The default colorspace for RGB surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceBt601Limited; //The default colorspace for YUV surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceJpeg; //The default colorspace for YUV surfaces if no colorspace is specified
};
pub const PropertiesID = u32;
@ -51,7 +51,7 @@ pub const PropertiesID = u32;
pub const CameraID = u32;
pub const Camera = opaque {
pub inline fn getCameraPermissionState(camera: *Camera) CameraPermissionState {
pub inline fn getCameraPermissionState(camera: *Camera) c_int {
return c.SDL_GetCameraPermissionState(@ptrCast(camera));
}
@ -95,11 +95,6 @@ pub const CameraPosition = enum(c_int) {
cameraPositionBackFacing,
};
pub const CameraPermissionState = enum(c_int) {
cameraPermissionStatePending,
cameraPermissionStateApproved,
};
pub inline fn getNumCameraDrivers() c_int {
return c.SDL_GetNumCameraDrivers();
}

View File

@ -19,8 +19,7 @@ pub const PenInputFlags = packed struct(u32) {
penInputButton4: bool = false, // button 4 is pressed
penInputButton5: bool = false, // button 5 is pressed
penInputEraserTip: bool = false, // eraser tip is used
penInputInProximity: bool = false, // pen is in proximity (since SDL 3.4.0)
pad0: u23 = 0,
pad0: u24 = 0,
rsvd: bool = false,
pub const None = PenInputFlags{};
@ -34,6 +33,8 @@ pub const MouseButtonFlags = packed struct(u32) {
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 Scancode = enum(c_int) {
@ -170,10 +171,9 @@ pub const EventType = enum(c_int) {
eventDisplayDesktopModeChanged, //Display has changed desktop mode
eventDisplayCurrentModeChanged, //Display has changed current mode
eventDisplayContentScaleChanged, //Display has changed content scale
eventDisplayUsableBoundsChanged, //Display has changed usable bounds
eventWindowShown = 0x202, //Window has been shown
eventWindowHidden, //Window has been hidden
eventWindowExposed,
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
@ -204,8 +204,6 @@ pub const EventType = enum(c_int) {
eventKeyboardAdded, //A new keyboard has been inserted into the system
eventKeyboardRemoved, //A keyboard has been removed
eventTextEditingCandidates, //Keyboard text editing candidates
eventScreenKeyboardShown, //The on-screen keyboard has been shown
eventScreenKeyboardHidden, //The on-screen keyboard has been hidden
eventMouseMotion = 0x400, //Mouse moved
eventMouseButtonDown, //Mouse button pressed
eventMouseButtonUp, //Mouse button released
@ -236,10 +234,7 @@ pub const EventType = enum(c_int) {
eventFingerUp,
eventFingerMotion,
eventFingerCanceled,
eventPinchBegin = 0x710, //Pinch gesture started
eventPinchUpdate, //Pinch gesture updated
eventPinchEnd, //Pinch gesture ended
eventClipboardUpdate = 0x900, //The clipboard changed
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)
@ -277,7 +272,7 @@ pub const CommonEvent = extern struct {
};
pub const DisplayEvent = extern struct {
_type: EventType, // SDL_EVENT_DISPLAY_*
_type: EventType, // SDL_DISPLAYEVENT_*
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
displayID: DisplayID, // The associated display
@ -551,14 +546,6 @@ pub const TouchFingerEvent = extern struct {
windowID: WindowID, // The window underneath the finger, if any
};
pub const PinchFingerEvent = extern struct {
_type: EventType, // ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
scale: f32, // The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in".
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,
@ -653,7 +640,7 @@ pub const QuitEvent = extern struct {
};
pub const UserEvent = extern struct {
_type: u32, // SDL_EVENT_USER through SDL_EVENT_LAST, Uint32 because these are not in the SDL_EventType enumeration
_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
@ -693,7 +680,6 @@ pub const Event = extern union {
quit: QuitEvent, // Quit request event data
user: UserEvent, // Custom event data
tfinger: TouchFingerEvent, // Touch finger event data
pinch: PinchFingerEvent, // Pinch event data
pproximity: PenProximityEvent, // Pen proximity event data
ptouch: PenTouchEvent, // Pen tip touching event data
pmotion: PenMotionEvent, // Pen motion event data
@ -788,7 +774,3 @@ pub inline fn registerEvents(numevents: c_int) u32 {
pub inline fn getWindowFromEvent(event: ?*const Event) ?*Window {
return @ptrCast(c.SDL_GetWindowFromEvent(@ptrCast(event)));
}
pub inline fn getEventDescription(event: ?*const Event, buf: [*c]u8, buflen: c_int) c_int {
return c.SDL_GetEventDescription(@ptrCast(event), buf, buflen);
}

View File

@ -217,7 +217,6 @@ pub const GamepadType = enum(c_int) {
gamepadTypeNintendoSwitchJoyconLeft,
gamepadTypeNintendoSwitchJoyconRight,
gamepadTypeNintendoSwitchJoyconPair,
gamepadTypeGamecube,
gamepadTypeCount,
};
@ -238,14 +237,14 @@ pub const GamepadButton = enum(c_int) {
gamepadButtonDpadLeft,
gamepadButtonDpadRight,
gamepadButtonMisc1, //Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)
gamepadButtonRightPaddle1, //Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button)
gamepadButtonLeftPaddle1, //Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button)
gamepadButtonRightPaddle2, //Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button)
gamepadButtonLeftPaddle2, //Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button)
gamepadButtonRightPaddle1, //Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)
gamepadButtonLeftPaddle1, //Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)
gamepadButtonRightPaddle2, //Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)
gamepadButtonLeftPaddle2, //Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)
gamepadButtonTouchpad, //PS4/PS5 touchpad button
gamepadButtonMisc2, //Additional button
gamepadButtonMisc3, //Additional button (e.g. Nintendo GameCube left trigger click)
gamepadButtonMisc4, //Additional button (e.g. Nintendo GameCube right trigger click)
gamepadButtonMisc3, //Additional button
gamepadButtonMisc4, //Additional button
gamepadButtonMisc5, //Additional button
gamepadButtonMisc6, //Additional button
gamepadButtonCount,

View File

@ -10,19 +10,6 @@ pub const FColor = extern struct {
pub const PropertiesID = u32;
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
pixelformatMjpg = 0x47504a4d, //Motion JPEG
};
pub const Rect = extern struct {
x: c_int,
y: c_int,
@ -32,13 +19,10 @@ pub const Rect = extern struct {
pub const Window = opaque {};
pub const FlipMode = packed struct(u32) {
flipHorizontal: bool = false, // flip horizontally
flipVertical: bool = false, // flip vertically
pad0: u29 = 0,
rsvd: bool = false,
pub const None = FlipMode{};
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
};
pub const GPUDevice = opaque {
@ -54,10 +38,6 @@ pub const GPUDevice = opaque {
return @bitCast(c.SDL_GetGPUShaderFormats(@ptrCast(gpudevice)));
}
pub inline fn getGPUDeviceProperties(gpudevice: *GPUDevice) PropertiesID {
return c.SDL_GetGPUDeviceProperties(@ptrCast(gpudevice));
}
pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUComputePipelineCreateInfo) ?*GPUComputePipeline {
return @ptrCast(c.SDL_CreateGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
}
@ -967,7 +947,7 @@ pub const GPUMultisampleState = extern struct {
sample_count: GPUSampleCount, // The number of samples to be used in rasterization.
sample_mask: u32, // Reserved for future use. Must be set to 0.
enable_mask: bool, // Reserved for future use. Must be set to false.
enable_alpha_to_coverage: bool, // true enables the alpha-to-coverage feature.
padding1: u8,
padding2: u8,
padding3: u8,
};
@ -1055,8 +1035,8 @@ pub const GPUDepthStencilTargetInfo = extern struct {
stencil_store_op: GPUStoreOp, // What is done with the stencil results of the render pass.
cycle: bool, // true cycles the texture if the texture is bound and any load ops are not LOAD
clear_stencil: u8, // The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used.
mip_level: u8, // The mip level to use as the depth stencil target.
layer: u8, // The layer index to use as the depth stencil target.
padding1: u8,
padding2: u8,
};
pub const GPUBlitInfo = extern struct {
@ -1116,16 +1096,6 @@ pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {
return @ptrCast(c.SDL_CreateGPUDeviceWithProperties(props));
}
pub const GPUVulkanOptions = extern struct {
vulkan_api_version: u32, // The Vulkan API version to request for the instance. Use Vulkan's VK_MAKE_VERSION or VK_MAKE_API_VERSION.
feature_list: ?*anyopaque, // Pointer to the first element of a chain of Vulkan feature structs. (Requires API version 1.1 or higher.)
vulkan_10_physical_device_features: ?*anyopaque, // Pointer to a VkPhysicalDeviceFeatures struct to enable additional Vulkan 1.0 features.
device_extension_count: u32, // Number of additional device extensions to require.
device_extension_names: [*c][*c]const u8, // Pointer to a list of additional device extensions to require.
instance_extension_count: u32, // Number of additional instance extensions to require.
instance_extension_names: [*c][*c]const u8, // Pointer to a list of additional instance extensions to require.
};
pub inline fn getNumGPUDrivers() c_int {
return c.SDL_GetNumGPUDrivers();
}
@ -1141,11 +1111,3 @@ pub inline fn gpuTextureFormatTexelBlockSize(format: GPUTextureFormat) u32 {
pub inline fn calculateGPUTextureFormatSize(format: GPUTextureFormat, width: u32, height: u32, depth_or_layer_count: u32) u32 {
return c.SDL_CalculateGPUTextureFormatSize(@bitCast(format), width, height, depth_or_layer_count);
}
pub inline fn getPixelFormatFromGPUTextureFormat(format: GPUTextureFormat) PixelFormat {
return @bitCast(c.SDL_GetPixelFormatFromGPUTextureFormat(@bitCast(format)));
}
pub inline fn getGPUTextureFormatFromPixelFormat(format: PixelFormat) GPUTextureFormat {
return @bitCast(c.SDL_GetGPUTextureFormatFromPixelFormat(@bitCast(format)));
}

View File

@ -44,27 +44,27 @@ pub const Haptic = opaque {
return @bitCast(c.SDL_HapticEffectSupported(@ptrCast(haptic), @ptrCast(effect)));
}
pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) HapticEffectID {
pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) c_int {
return c.SDL_CreateHapticEffect(@ptrCast(haptic), @ptrCast(effect));
}
pub inline fn updateHapticEffect(haptic: *Haptic, effect: HapticEffectID, data: ?*const HapticEffect) bool {
pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: ?*const HapticEffect) bool {
return @bitCast(c.SDL_UpdateHapticEffect(@ptrCast(haptic), effect, @ptrCast(data)));
}
pub inline fn runHapticEffect(haptic: *Haptic, effect: HapticEffectID, iterations: u32) bool {
pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool {
return @bitCast(c.SDL_RunHapticEffect(@ptrCast(haptic), effect, iterations));
}
pub inline fn stopHapticEffect(haptic: *Haptic, effect: HapticEffectID) bool {
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_StopHapticEffect(@ptrCast(haptic), effect));
}
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: HapticEffectID) void {
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
return c.SDL_DestroyHapticEffect(@ptrCast(haptic), effect);
}
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: HapticEffectID) bool {
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_GetHapticEffectStatus(@ptrCast(haptic), effect));
}
@ -105,19 +105,13 @@ pub const Haptic = opaque {
}
};
pub const HapticEffectType = u16;
pub const HapticDirectionType = u8;
pub const HapticEffectID = c_int;
pub const HapticDirection = extern struct {
_type: HapticDirectionType, // The type of encoding.
_type: u8, // The type of encoding.
dir: [3]i32, // The encoded direction.
};
pub const HapticConstant = extern struct {
_type: HapticEffectType, // SDL_HAPTIC_CONSTANT
_type: u16, // SDL_HAPTIC_CONSTANT
direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect.
@ -161,7 +155,7 @@ pub const HapticCondition = extern struct {
};
pub const HapticRamp = extern struct {
_type: HapticEffectType, // SDL_HAPTIC_RAMP
_type: u16, // SDL_HAPTIC_RAMP
direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect.
@ -176,14 +170,14 @@ pub const HapticRamp = extern struct {
};
pub const HapticLeftRight = extern struct {
_type: HapticEffectType, // SDL_HAPTIC_LEFTRIGHT
_type: u16, // SDL_HAPTIC_LEFTRIGHT
length: u32, // Duration of the effect in milliseconds.
large_magnitude: u16, // Control of the large controller motor.
small_magnitude: u16, // Control of the small controller motor.
};
pub const HapticCustom = extern struct {
_type: HapticEffectType, // SDL_HAPTIC_CUSTOM
_type: u16, // SDL_HAPTIC_CUSTOM
direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect.
@ -200,7 +194,7 @@ pub const HapticCustom = extern struct {
};
pub const HapticEffect = extern union {
_type: HapticEffectType, // Effect type.
_type: u16, // Effect type.
constant: HapticConstant, // Constant effect.
periodic: HapticPeriodic, // Periodic effect.
condition: HapticCondition, // Condition effect.

View File

@ -62,11 +62,6 @@ pub const MouseWheelDirection = enum(c_int) {
mousewheelFlipped, //The scroll direction is flipped / natural
};
pub const CursorFrameInfo = extern struct {
surface: ?*Surface, // The surface data for this frame
duration: u32, // The frame duration in milliseconds (a duration of 0 is infinite)
};
pub const MouseButtonFlags = packed struct(u32) {
buttonLeft: bool = false,
buttonMiddle: bool = false,
@ -75,10 +70,10 @@ pub const MouseButtonFlags = packed struct(u32) {
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 MouseMotionTransformCallback = c.SDL_MouseMotionTransformCallback;
pub inline fn hasMouse() bool {
return @bitCast(c.SDL_HasMouse());
}
@ -111,10 +106,6 @@ pub inline fn warpMouseGlobal(x: f32, y: f32) bool {
return @bitCast(c.SDL_WarpMouseGlobal(x, y));
}
pub inline fn setRelativeMouseTransform(callback: MouseMotionTransformCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetRelativeMouseTransform(callback, userdata));
}
pub inline fn captureMouse(enabled: bool) bool {
return @bitCast(c.SDL_CaptureMouse(@bitCast(enabled)));
}
@ -123,10 +114,6 @@ pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h:
return @ptrCast(c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y));
}
pub inline fn createAnimatedCursor(frames: ?*CursorFrameInfo, frame_count: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor {
return @ptrCast(c.SDL_CreateAnimatedCursor(@ptrCast(frames), frame_count, hot_x, hot_y));
}
pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor {
return @ptrCast(c.SDL_CreateSystemCursor(id));
}

View File

@ -151,7 +151,7 @@ pub const Colorspace = enum(c_int) {
colorspaceBt2020Full = 0x22102609, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
pub const colorspaceRgbDefault = .colorspaceSrgb; //The default colorspace for RGB surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceBt601Limited; //The default colorspace for YUV surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceJpeg; //The default colorspace for YUV surfaces if no colorspace is specified
};
pub const Color = extern struct {
@ -230,10 +230,10 @@ pub inline fn mapRGBA(format: ?*const PixelFormatDetails, palette: ?*const Palet
return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a);
}
pub inline fn getRGB(pixelvalue: u32, format: ?*const PixelFormatDetails, palette: ?*const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8) void {
return c.SDL_GetRGB(pixelvalue, @ptrCast(format), @ptrCast(palette), r, g, b);
pub inline fn getRGB(pixel: u32, format: ?*const PixelFormatDetails, palette: ?*const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8) void {
return c.SDL_GetRGB(pixel, @ptrCast(format), @ptrCast(palette), r, g, b);
}
pub inline fn getRGBA(pixelvalue: u32, format: ?*const PixelFormatDetails, palette: ?*const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) void {
return c.SDL_GetRGBA(pixelvalue, @ptrCast(format), @ptrCast(palette), r, g, b, a);
pub inline fn getRGBA(pixel: u32, format: ?*const PixelFormatDetails, palette: ?*const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) void {
return c.SDL_GetRGBA(pixel, @ptrCast(format), @ptrCast(palette), r, g, b, a);
}

View File

@ -6,6 +6,19 @@ pub const FPoint = extern struct {
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
pixelformatMjpg = 0x47504a4d, //Motion JPEG
};
pub const FColor = extern struct {
r: f32,
g: f32,
@ -19,8 +32,15 @@ pub const Surface = opaque {
}
};
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));
@ -38,77 +58,6 @@ pub const FRect = extern struct {
h: f32,
};
pub const GPUTextureSamplerBinding = extern struct {
texture: ?*GPUTexture, // The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
sampler: ?*GPUSampler, // The sampler to bind.
};
pub const GPUSampler = opaque {};
pub const GPUTexture = opaque {};
pub const GPUShader = opaque {};
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
windowFillDocument: bool = false, // window is in fill-document mode (Emscripten only), since SDL 3.4.0
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: u37 = 0,
rsvd: bool = false,
pub const None = WindowFlags{};
};
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
pixelformatMjpg = 0x47504a4d, //Motion JPEG
};
pub const ScaleMode = enum(c_int) {
scalemodeNearest, //nearest pixel sampling
scalemodeLinear, //linear filtering
scalemodePixelart,
};
pub const GPUDevice = opaque {
pub inline fn createGPURenderer(gpudevice: *GPUDevice, window: ?*Window) ?*Renderer {
return @ptrCast(c.SDL_CreateGPURenderer(@ptrCast(gpudevice), @ptrCast(window)));
}
};
pub const BlendMode = u32;
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
@ -140,7 +89,6 @@ pub const Event = extern union {
quit: QuitEvent, // Quit request event data
user: UserEvent, // Custom event data
tfinger: TouchFingerEvent, // Touch finger event data
pinch: PinchFingerEvent, // Pinch event data
pproximity: PenProximityEvent, // Pen proximity event data
ptouch: PenTouchEvent, // Pen tip touching event data
pmotion: PenMotionEvent, // Pen motion event data
@ -166,7 +114,7 @@ pub const JoyAxisEvent = extern struct {
};
pub const UserEvent = extern struct {
_type: u32, // SDL_EVENT_USER through SDL_EVENT_LAST, Uint32 because these are not in the SDL_EventType enumeration
_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
@ -175,14 +123,6 @@ pub const UserEvent = extern struct {
data2: ?*anyopaque, // User defined data pointer
};
pub const PinchFingerEvent = extern struct {
_type: EventType, // ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
scale: f32, // The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in".
windowID: WindowID, // The window underneath the finger, if any
};
pub const MouseMotionEvent = extern struct {
_type: EventType, // SDL_EVENT_MOUSE_MOTION
reserved: u32,
@ -283,7 +223,7 @@ pub const GamepadAxisEvent = extern struct {
};
pub const DisplayEvent = extern struct {
_type: EventType, // SDL_EVENT_DISPLAY_*
_type: EventType, // SDL_DISPLAYEVENT_*
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
displayID: DisplayID, // The associated display
@ -562,10 +502,9 @@ pub const EventType = enum(c_int) {
eventDisplayDesktopModeChanged, //Display has changed desktop mode
eventDisplayCurrentModeChanged, //Display has changed current mode
eventDisplayContentScaleChanged, //Display has changed content scale
eventDisplayUsableBoundsChanged, //Display has changed usable bounds
eventWindowShown = 0x202, //Window has been shown
eventWindowHidden, //Window has been hidden
eventWindowExposed,
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
@ -596,8 +535,6 @@ pub const EventType = enum(c_int) {
eventKeyboardAdded, //A new keyboard has been inserted into the system
eventKeyboardRemoved, //A keyboard has been removed
eventTextEditingCandidates, //Keyboard text editing candidates
eventScreenKeyboardShown, //The on-screen keyboard has been shown
eventScreenKeyboardHidden, //The on-screen keyboard has been hidden
eventMouseMotion = 0x400, //Mouse moved
eventMouseButtonDown, //Mouse button pressed
eventMouseButtonUp, //Mouse button released
@ -628,10 +565,7 @@ pub const EventType = enum(c_int) {
eventFingerUp,
eventFingerMotion,
eventFingerCanceled,
eventPinchBegin = 0x710, //Pinch gesture started
eventPinchUpdate, //Pinch gesture updated
eventPinchEnd, //Pinch gesture ended
eventClipboardUpdate = 0x900, //The clipboard changed
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)
@ -676,6 +610,8 @@ pub const MouseButtonFlags = packed struct(u32) {
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) {
@ -686,8 +622,7 @@ pub const PenInputFlags = packed struct(u32) {
penInputButton4: bool = false, // button 4 is pressed
penInputButton5: bool = false, // button 5 is pressed
penInputEraserTip: bool = false, // eraser tip is used
penInputInProximity: bool = false, // pen is in proximity (since SDL 3.4.0)
pad0: u23 = 0,
pad0: u24 = 0,
rsvd: bool = false,
pub const None = PenInputFlags{};
@ -811,17 +746,12 @@ pub const Keymod = u16;
pub const Keycode = u32;
pub const FlipMode = packed struct(u32) {
flipHorizontal: bool = false, // flip horizontally
flipVertical: bool = false, // flip vertically
pad0: u29 = 0,
rsvd: bool = false,
pub const None = FlipMode{};
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
};
pub const GPUBuffer = opaque {};
pub const Rect = extern struct {
x: c_int,
y: c_int,
@ -829,18 +759,36 @@ pub const Rect = extern struct {
h: c_int,
};
pub const Palette = extern struct {
ncolors: c_int, // number of elements in `colors`.
colors: ?*Color, // an array of colors, `ncolors` long.
version: u32, // internal use only, do not touch.
refcount: c_int, // internal use only, do not touch.
};
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 Color = extern struct {
r: u8,
g: u8,
b: u8,
a: u8,
pub const None = WindowFlags{};
};
pub const Vertex = extern struct {
@ -855,25 +803,15 @@ pub const TextureAccess = enum(c_int) {
textureaccessTarget, //Texture can be used as a render target
};
pub const TextureAddressMode = enum(c_int) {
textureAddressAuto, //Wrapping is enabled if texture coordinates are outside [0, 1], this is the default
textureAddressClamp, //Texture coordinates are clamped to the [0, 1] range
textureAddressWrap, //The texture is repeated (tiled)
};
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 the clear color
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 getGPURendererDevice(renderer: *Renderer) ?*GPUDevice {
return @ptrCast(c.SDL_GetGPURendererDevice(@ptrCast(renderer)));
}
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
return @ptrCast(c.SDL_GetRenderWindow(@ptrCast(renderer)));
}
@ -1062,10 +1000,6 @@ pub const Renderer = opaque {
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 renderTexture9GridTiled(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, left_width: f32, right_width: f32, top_height: f32, bottom_height: f32, scale: f32, dstrect: ?*const FRect, tileScale: f32) bool {
return @bitCast(c.SDL_RenderTexture9GridTiled(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect), tileScale));
}
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));
}
@ -1074,14 +1008,6 @@ pub const Renderer = opaque {
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 setRenderTextureAddressMode(renderer: *Renderer, u_mode: TextureAddressMode, v_mode: TextureAddressMode) bool {
return @bitCast(c.SDL_SetRenderTextureAddressMode(@ptrCast(renderer), @intFromEnum(u_mode), @intFromEnum(v_mode)));
}
pub inline fn getRenderTextureAddressMode(renderer: *Renderer, u_mode: ?*TextureAddressMode, v_mode: ?*TextureAddressMode) bool {
return @bitCast(c.SDL_GetRenderTextureAddressMode(@ptrCast(renderer), @ptrCast(u_mode), @ptrCast(v_mode)));
}
pub inline fn renderReadPixels(renderer: *Renderer, rect: ?*const Rect) ?*Surface {
return @ptrCast(c.SDL_RenderReadPixels(@ptrCast(renderer), @ptrCast(rect)));
}
@ -1121,22 +1047,6 @@ pub const Renderer = opaque {
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 inline fn setDefaultTextureScaleMode(renderer: *Renderer, scale_mode: ScaleMode) bool {
return @bitCast(c.SDL_SetDefaultTextureScaleMode(@ptrCast(renderer), @intFromEnum(scale_mode)));
}
pub inline fn getDefaultTextureScaleMode(renderer: *Renderer, scale_mode: ?*ScaleMode) bool {
return @bitCast(c.SDL_GetDefaultTextureScaleMode(@ptrCast(renderer), @ptrCast(scale_mode)));
}
pub inline fn createGPURenderState(renderer: *Renderer, createinfo: ?*GPURenderStateCreateInfo) ?*GPURenderState {
return @ptrCast(c.SDL_CreateGPURenderState(@ptrCast(renderer), @ptrCast(createinfo)));
}
pub inline fn setGPURenderState(renderer: *Renderer, state: ?*GPURenderState) bool {
return @bitCast(c.SDL_SetGPURenderState(@ptrCast(renderer), @ptrCast(state)));
}
};
pub const Texture = opaque {
@ -1152,14 +1062,6 @@ pub const Texture = opaque {
return @bitCast(c.SDL_GetTextureSize(@ptrCast(texture), @ptrCast(w), @ptrCast(h)));
}
pub inline fn setTexturePalette(texture: *Texture, palette: ?*Palette) bool {
return @bitCast(c.SDL_SetTexturePalette(@ptrCast(texture), @ptrCast(palette)));
}
pub inline fn getTexturePalette(texture: *Texture) ?*Palette {
return @ptrCast(c.SDL_GetTexturePalette(@ptrCast(texture)));
}
pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetTextureColorMod(@ptrCast(texture), r, g, b));
}
@ -1252,24 +1154,3 @@ pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height:
pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer {
return @ptrCast(c.SDL_CreateRendererWithProperties(props));
}
pub const GPURenderStateCreateInfo = extern struct {
fragment_shader: ?*GPUShader, // The fragment shader to use when this render state is active
num_sampler_bindings: i32, // The number of additional fragment samplers to bind when this render state is active
sampler_bindings: ?*const GPUTextureSamplerBinding, // Additional fragment samplers to bind when this render state is active
num_storage_textures: i32, // The number of storage textures to bind when this render state is active
storage_textures: [*c]?*const GPUTexture, // Storage textures to bind when this render state is active
num_storage_buffers: i32, // The number of storage buffers to bind when this render state is active
storage_buffers: [*c]?*const GPUBuffer, // Storage buffers to bind when this render state is active
props: PropertiesID, // A properties ID for extensions. Should be 0 if no extensions are needed.
};
pub const GPURenderState = opaque {
pub inline fn setGPURenderStateFragmentUniforms(gpurenderstate: *GPURenderState, slot_index: u32, data: ?*const anyopaque, length: u32) bool {
return @bitCast(c.SDL_SetGPURenderStateFragmentUniforms(@ptrCast(gpurenderstate), slot_index, data, length));
}
pub inline fn destroyGPURenderState(gpurenderstate: *GPURenderState) void {
return c.SDL_DestroyGPURenderState(@ptrCast(gpurenderstate));
}
};

View File

@ -17,17 +17,9 @@ pub const PixelFormat = enum(c_int) {
pub const BlendMode = u32;
pub const IOStream = opaque {
pub inline fn loadSurface_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return @ptrCast(c.SDL_LoadSurface_IO(@ptrCast(iostream), @bitCast(closeio)));
}
pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return @ptrCast(c.SDL_LoadBMP_IO(@ptrCast(iostream), @bitCast(closeio)));
}
pub inline fn loadPNG_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return @ptrCast(c.SDL_LoadPNG_IO(@ptrCast(iostream), @bitCast(closeio)));
}
};
pub const Rect = extern struct {
@ -78,7 +70,7 @@ pub const Colorspace = enum(c_int) {
colorspaceBt2020Full = 0x22102609, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
pub const colorspaceRgbDefault = .colorspaceSrgb; //The default colorspace for RGB surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceBt601Limited; //The default colorspace for YUV surfaces if no colorspace is specified
pub const colorspaceYuvDefault = .colorspaceJpeg; //The default colorspace for YUV surfaces if no colorspace is specified
};
pub const PropertiesID = u32;
@ -97,16 +89,12 @@ pub const SurfaceFlags = packed struct(u32) {
pub const ScaleMode = enum(c_int) {
scalemodeNearest, //nearest pixel sampling
scalemodeLinear, //linear filtering
scalemodePixelart,
};
pub const FlipMode = packed struct(u32) {
flipHorizontal: bool = false, // flip horizontally
flipVertical: bool = false, // flip vertically
pad0: u29 = 0,
rsvd: bool = false,
pub const None = FlipMode{};
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
};
pub const Surface = opaque {
@ -170,14 +158,6 @@ pub const Surface = opaque {
return @bitCast(c.SDL_SaveBMP(@ptrCast(surface), file));
}
pub inline fn savePNG_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool {
return @bitCast(c.SDL_SavePNG_IO(@ptrCast(surface), @ptrCast(dst), @bitCast(closeio)));
}
pub inline fn savePNG(surface: *Surface, file: [*c]const u8) bool {
return @bitCast(c.SDL_SavePNG(@ptrCast(surface), file));
}
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return @bitCast(c.SDL_SetSurfaceRLE(@ptrCast(surface), @bitCast(enabled)));
}
@ -234,10 +214,6 @@ pub const Surface = opaque {
return @bitCast(c.SDL_FlipSurface(@ptrCast(surface), @intFromEnum(flip)));
}
pub inline fn rotateSurface(surface: *Surface, angle: f32) ?*Surface {
return @ptrCast(c.SDL_RotateSurface(@ptrCast(surface), angle));
}
pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
return @ptrCast(c.SDL_DuplicateSurface(@ptrCast(surface)));
}
@ -335,18 +311,10 @@ pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat
return @ptrCast(c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch));
}
pub inline fn loadSurface(file: [*c]const u8) ?*Surface {
return @ptrCast(c.SDL_LoadSurface(file));
}
pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
return @ptrCast(c.SDL_LoadBMP(file));
}
pub inline fn loadPNG(file: [*c]const u8) ?*Surface {
return @ptrCast(c.SDL_LoadPNG(file));
}
pub inline fn convertPixels(width: c_int, height: c_int, src_format: PixelFormat, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst: ?*anyopaque, dst_pitch: c_int) bool {
return @bitCast(c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch));
}

View File

@ -189,10 +189,6 @@ pub const Window = opaque {
return @bitCast(c.SDL_SetWindowAlwaysOnTop(@ptrCast(window), @bitCast(on_top)));
}
pub inline fn setWindowFillDocument(window: *Window, fill: bool) bool {
return @bitCast(c.SDL_SetWindowFillDocument(@ptrCast(window), @bitCast(fill)));
}
pub inline fn showWindow(window: *Window) bool {
return @bitCast(c.SDL_ShowWindow(@ptrCast(window)));
}
@ -313,22 +309,6 @@ pub const Window = opaque {
return @bitCast(c.SDL_FlashWindow(@ptrCast(window), @intFromEnum(operation)));
}
pub inline fn setWindowProgressState(window: *Window, state: ProgressState) bool {
return @bitCast(c.SDL_SetWindowProgressState(@ptrCast(window), state));
}
pub inline fn getWindowProgressState(window: *Window) ProgressState {
return c.SDL_GetWindowProgressState(@ptrCast(window));
}
pub inline fn setWindowProgressValue(window: *Window, value: f32) bool {
return @bitCast(c.SDL_SetWindowProgressValue(@ptrCast(window), value));
}
pub inline fn getWindowProgressValue(window: *Window) f32 {
return c.SDL_GetWindowProgressValue(@ptrCast(window));
}
pub inline fn destroyWindow(window: *Window) void {
return c.SDL_DestroyWindow(@ptrCast(window));
}
@ -372,12 +352,11 @@ pub const WindowFlags = packed struct(u64) {
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
windowFillDocument: bool = false, // window is in fill-document mode (Emscripten only), since SDL 3.4.0
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: u37 = 0,
pad0: u38 = 0,
rsvd: bool = false,
pub const None = WindowFlags{};
@ -389,15 +368,6 @@ pub const FlashOperation = enum(c_int) {
flashUntilFocused, //Flash the window until it gets focus
};
pub const ProgressState = enum(c_int) {
progressStateInvalid = -1, //An invalid progress state indicating an error; check SDL_GetError()
progressStateNone, //No progress bar is shown
progressStateIndeterminate, //The progress bar is shown in a indeterminate state
progressStateNormal, //The progress bar is shown in a normal state
progressStatePaused, //The progress bar is shown in a paused state
progressStateError, //The progress bar is shown in a state indicating the application had an error
};
pub const GLContext = *anyopaque;
pub const EGLDisplay = ?*anyopaque;
@ -437,7 +407,7 @@ pub const GLAttr = enum(c_int) {
glContextFlags, //some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0.
glContextProfileMask, //type of GL context (Core, Compatibility, ES). See SDL_GLProfile; default value depends on platform.
glShareWithCurrentContext, //OpenGL context sharing; defaults to 0.
glFramebufferSrgbCapable, //requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply!
glFramebufferSrgbCapable, //requests sRGB capable visual; defaults to 0.
glContextReleaseBehavior, //sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH.
glContextResetNotification, //set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION.
glContextNoError,