diff --git a/lib/sdl3/parser/src/types.zig b/lib/sdl3/parser/src/types.zig index 99a3652..c9180d0 100644 --- a/lib/sdl3/parser/src/types.zig +++ b/lib/sdl3/parser/src/types.zig @@ -59,6 +59,8 @@ pub fn convertType(c_type: []const u8, allocator: Allocator) ![]const u8 { if (std.mem.eql(u8, trimmed, "void **")) return try allocator.dupe(u8, "[*c]?*anyopaque"); if (std.mem.eql(u8, trimmed, "const Uint8 *")) return try allocator.dupe(u8, "[*c]const u8"); if (std.mem.eql(u8, trimmed, "Uint8 *")) return try allocator.dupe(u8, "[*c]u8"); + if (std.mem.eql(u8, trimmed, "Uint8 **")) return try allocator.dupe(u8, "[*c][*c]u8"); + if (std.mem.eql(u8, trimmed, "const int *")) return try allocator.dupe(u8, "[*c]const c_int"); // Handle SDL types with pointers // Check for double pointers like "SDL_Type **" diff --git a/lib/sdl3/v2/audio.zig b/lib/sdl3/v2/audio.zig index ac8ca72..a5613d3 100644 --- a/lib/sdl3/v2/audio.zig +++ b/lib/sdl3/v2/audio.zig @@ -4,7 +4,7 @@ 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: Uint8 **, audio_len: *u32) bool { + pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { return c.SDL_LoadWAV_IO(iostream, closeio, spec, audio_buf, @ptrCast(audio_len)); } @@ -69,11 +69,11 @@ pub const AudioStream = opaque { return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(audiostream, @ptrCast(count))); } - pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: const int *, count: c_int) bool { + pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { return c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count); } - pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: const int *, count: c_int) bool { + pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { return c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count); } @@ -231,7 +231,7 @@ pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostm return c.SDL_SetAudioPostmixCallback(devid, callback, userdata); } -pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: Uint8 **, audio_len: *u32) bool { +pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { return c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len)); } @@ -239,7 +239,7 @@ pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: return c.SDL_MixAudio(dst, src, @bitCast(format), len, volume); } -pub inline fn convertAudioSamples(src_spec: *const AudioSpec, src_data: [*c]const u8, src_len: c_int, dst_spec: *const AudioSpec, dst_data: Uint8 **, dst_len: *c_int) bool { +pub inline fn convertAudioSamples(src_spec: *const AudioSpec, src_data: [*c]const u8, src_len: c_int, dst_spec: *const AudioSpec, dst_data: [*c][*c]u8, dst_len: *c_int) bool { return c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len)); } diff --git a/lib/sdl3/v2/render.zig b/lib/sdl3/v2/render.zig index c8e9331..799d0d1 100644 --- a/lib/sdl3/v2/render.zig +++ b/lib/sdl3/v2/render.zig @@ -83,7 +83,6 @@ pub const Surface = opaque { pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer { return c.SDL_CreateSoftwareRenderer(surface); } - }; pub const ScaleMode = enum(c_int) { @@ -102,7 +101,6 @@ pub const Window = opaque { pub inline fn getRenderer(window: *Window) ?*Renderer { return c.SDL_GetRenderer(window); } - }; pub const FRect = extern struct { @@ -386,7 +384,7 @@ pub const Renderer = opaque { return c.SDL_RenderTexture9Grid(renderer, 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: const int *, num_indices: c_int) bool { + 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 c.SDL_RenderGeometry(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices); } @@ -435,9 +433,13 @@ pub const Renderer = opaque { } pub inline fn renderDebugTextFormat(renderer: *Renderer, x: f32, y: f32, fmt: [*c]const u8, ...) bool { - return c.SDL_RenderDebugTextFormat(renderer, x, y, fmt, ); + return c.SDL_RenderDebugTextFormat( + renderer, + x, + y, + fmt, + ); } - }; pub const Texture = opaque { @@ -528,7 +530,6 @@ pub const Texture = opaque { pub inline fn destroyTexture(texture: *Texture) void { return c.SDL_DestroyTexture(texture); } - }; pub inline fn getNumRenderDrivers() c_int { @@ -546,4 +547,3 @@ pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer { return c.SDL_CreateRendererWithProperties(props); } -