updates for enum flags

This commit is contained in:
peterino2 2026-01-26 23:54:49 -08:00
parent 9b02a95231
commit 29f193533a
958 changed files with 25909 additions and 23513 deletions

View File

@ -5,7 +5,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, 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 @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV_IO(@ptrCast(iostream), @bitCast(closeio), @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -31,107 +31,107 @@ pub const AudioSpec = extern struct {
pub const AudioStream = opaque { pub const AudioStream = opaque {
pub inline fn unbindAudioStream(audiostream: *AudioStream) void { pub inline fn unbindAudioStream(audiostream: *AudioStream) void {
return c.SDL_UnbindAudioStream(audiostream); return c.SDL_UnbindAudioStream(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID { pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID {
return c.SDL_GetAudioStreamDevice(audiostream); return c.SDL_GetAudioStreamDevice(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID { pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID {
return c.SDL_GetAudioStreamProperties(audiostream); return c.SDL_GetAudioStreamProperties(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool { pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool {
return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec)); return @bitCast(c.SDL_GetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: *const AudioSpec, dst_spec: *const AudioSpec) bool { pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) bool {
return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec))); return @bitCast(c.SDL_SetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamFrequencyRatio(audiostream); return c.SDL_GetAudioStreamFrequencyRatio(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio)); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(@ptrCast(audiostream), ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamGain(audiostream); return c.SDL_GetAudioStreamGain(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain)); return @bitCast(c.SDL_SetAudioStreamGain(@ptrCast(audiostream), gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool { pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool {
return @bitCast(c.SDL_PutAudioStreamData(audiostream, buf, len)); return @bitCast(c.SDL_PutAudioStreamData(@ptrCast(audiostream), buf, len));
} }
pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int { pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int {
return c.SDL_GetAudioStreamData(audiostream, buf, len); return c.SDL_GetAudioStreamData(@ptrCast(audiostream), buf, len);
} }
pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamAvailable(audiostream); return c.SDL_GetAudioStreamAvailable(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamQueued(audiostream); return c.SDL_GetAudioStreamQueued(@ptrCast(audiostream));
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_FlushAudioStream(audiostream)); return @bitCast(c.SDL_FlushAudioStream(@ptrCast(audiostream)));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ClearAudioStream(audiostream)); return @bitCast(c.SDL_ClearAudioStream(@ptrCast(audiostream)));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream)); return @bitCast(c.SDL_PauseAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream)); return @bitCast(c.SDL_ResumeAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_LockAudioStream(audiostream)); return @bitCast(c.SDL_LockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_UnlockAudioStream(audiostream)); return @bitCast(c.SDL_UnlockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamGetCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamPutCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
return c.SDL_DestroyAudioStream(audiostream); return c.SDL_DestroyAudioStream(@ptrCast(audiostream));
} }
}; };
@ -148,11 +148,11 @@ pub inline fn getCurrentAudioDriver() [*c]const u8 {
} }
pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioPlaybackDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioPlaybackDevices(@ptrCast(count)));
} }
pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioRecordingDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioRecordingDevices(@ptrCast(count)));
} }
pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 { pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
@ -160,14 +160,14 @@ pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
} }
pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool { pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool {
return @bitCast(c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames))); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, @ptrCast(spec), @ptrCast(sample_frames)));
} }
pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int { pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count)));
} }
pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) AudioDeviceID { pub inline fn openAudioDevice(devid: AudioDeviceID, spec: ?*const AudioSpec) AudioDeviceID {
return c.SDL_OpenAudioDevice(devid, @ptrCast(spec)); return c.SDL_OpenAudioDevice(devid, @ptrCast(spec));
} }
@ -195,26 +195,26 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
return c.SDL_CloseAudioDevice(devid); return c.SDL_CloseAudioDevice(devid);
} }
pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c][*c]AudioStream, num_streams: c_int) bool { pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]?*AudioStream, num_streams: c_int) bool {
return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams)); return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams));
} }
pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool { pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool {
return @bitCast(c.SDL_BindAudioStream(devid, stream)); return @bitCast(c.SDL_BindAudioStream(devid, @ptrCast(stream)));
} }
pub inline fn unbindAudioStreams(streams: [*c][*c]AudioStream, num_streams: c_int) void { pub inline fn unbindAudioStreams(streams: [*c]?*AudioStream, num_streams: c_int) void {
return c.SDL_UnbindAudioStreams(streams, num_streams); return c.SDL_UnbindAudioStreams(streams, num_streams);
} }
pub inline fn createAudioStream(src_spec: *const AudioSpec, dst_spec: *const AudioSpec) ?*AudioStream { pub inline fn createAudioStream(src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) ?*AudioStream {
return c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)); return @ptrCast(c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub const AudioStreamCallback = c.SDL_AudioStreamCallback; pub const AudioStreamCallback = c.SDL_AudioStreamCallback;
pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream { pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: ?*const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream {
return c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata); return @ptrCast(c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata));
} }
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
@ -224,14 +224,14 @@ pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostm
} }
pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool {
return @bitCast(c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV(path, @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool { pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool {
return @bitCast(c.SDL_MixAudio(dst, src, @bitCast(format), len, volume)); return @bitCast(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: [*c][*c]u8, 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 @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len))); return @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len)));
} }

View File

@ -51,31 +51,31 @@ pub const CameraID = u32;
pub const Camera = opaque { pub const Camera = opaque {
pub inline fn getCameraPermissionState(camera: *Camera) c_int { pub inline fn getCameraPermissionState(camera: *Camera) c_int {
return c.SDL_GetCameraPermissionState(camera); return c.SDL_GetCameraPermissionState(@ptrCast(camera));
} }
pub inline fn getCameraID(camera: *Camera) CameraID { pub inline fn getCameraID(camera: *Camera) CameraID {
return c.SDL_GetCameraID(camera); return c.SDL_GetCameraID(@ptrCast(camera));
} }
pub inline fn getCameraProperties(camera: *Camera) PropertiesID { pub inline fn getCameraProperties(camera: *Camera) PropertiesID {
return c.SDL_GetCameraProperties(camera); return c.SDL_GetCameraProperties(@ptrCast(camera));
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return @bitCast(c.SDL_GetCameraFormat(camera, spec)); return @bitCast(c.SDL_GetCameraFormat(@ptrCast(camera), @ptrCast(spec)));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {
return c.SDL_AcquireCameraFrame(camera, @ptrCast(timestampNS)); return @ptrCast(c.SDL_AcquireCameraFrame(@ptrCast(camera), @ptrCast(timestampNS)));
} }
pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void { pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void {
return c.SDL_ReleaseCameraFrame(camera, frame); return c.SDL_ReleaseCameraFrame(@ptrCast(camera), @ptrCast(frame));
} }
pub inline fn closeCamera(camera: *Camera) void { pub inline fn closeCamera(camera: *Camera) void {
return c.SDL_CloseCamera(camera); return c.SDL_CloseCamera(@ptrCast(camera));
} }
}; };
@ -107,10 +107,10 @@ pub inline fn getCurrentCameraDriver() [*c]const u8 {
} }
pub inline fn getCameras(count: *c_int) ?*CameraID { pub inline fn getCameras(count: *c_int) ?*CameraID {
return c.SDL_GetCameras(@ptrCast(count)); return @ptrCast(c.SDL_GetCameras(@ptrCast(count)));
} }
pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c][*c]CameraSpec { pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c]?*CameraSpec {
return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count)); return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count));
} }
@ -122,6 +122,6 @@ pub inline fn getCameraPosition(instance_id: CameraID) CameraPosition {
return c.SDL_GetCameraPosition(instance_id); return c.SDL_GetCameraPosition(instance_id);
} }
pub inline fn openCamera(instance_id: CameraID, spec: *const CameraSpec) ?*Camera { pub inline fn openCamera(instance_id: CameraID, spec: ?*const CameraSpec) ?*Camera {
return c.SDL_OpenCamera(instance_id, @ptrCast(spec)); return @ptrCast(c.SDL_OpenCamera(instance_id, @ptrCast(spec)));
} }

View File

@ -10,14 +10,14 @@ pub const DialogFileFilter = extern struct {
pub const DialogFileCallback = c.SDL_DialogFileCallback; pub const DialogFileCallback = c.SDL_DialogFileCallback;
pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location, @bitCast(allow_many));
} }
pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void { pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void {
return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location); return c.SDL_ShowSaveFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location);
} }
pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFolderDialog(callback, userdata, @ptrCast(window), default_location, @bitCast(allow_many));
} }

View File

@ -1,7 +1,12 @@
const std = @import("std"); const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const PenID = u32; pub const PenID = packed struct(u32) {
pad0: u31 = 0,
rsvd: bool = false,
pub const None = PenID{};
};
pub const WindowID = u32; pub const WindowID = u32;
@ -21,6 +26,8 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const MouseButtonFlags = packed struct(u32) { pub const MouseButtonFlags = packed struct(u32) {
@ -29,6 +36,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const Scancode = enum(c_int) {
@ -685,7 +696,7 @@ pub const EventAction = enum(c_int) {
}; };
pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int { pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int {
return c.SDL_PeepEvents(events, numevents, action, minType, maxType); return c.SDL_PeepEvents(@ptrCast(events), numevents, action, minType, maxType);
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
@ -705,19 +716,19 @@ pub inline fn flushEvents(minType: u32, maxType: u32) void {
} }
pub inline fn pollEvent(event: ?*Event) bool { pub inline fn pollEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PollEvent(event)); return @bitCast(c.SDL_PollEvent(@ptrCast(event)));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return @bitCast(c.SDL_WaitEvent(event)); return @bitCast(c.SDL_WaitEvent(@ptrCast(event)));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS)); return @bitCast(c.SDL_WaitEventTimeout(@ptrCast(event), timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PushEvent(event)); return @bitCast(c.SDL_PushEvent(@ptrCast(event)));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -727,7 +738,7 @@ pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool { pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool {
return @bitCast(c.SDL_GetEventFilter(filter, userdata)); return @bitCast(c.SDL_GetEventFilter(@ptrCast(filter), userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
@ -754,6 +765,6 @@ pub inline fn registerEvents(numevents: c_int) u32 {
return c.SDL_RegisterEvents(numevents); return c.SDL_RegisterEvents(numevents);
} }
pub inline fn getWindowFromEvent(event: *const Event) ?*Window { pub inline fn getWindowFromEvent(event: ?*const Event) ?*Window {
return c.SDL_GetWindowFromEvent(@ptrCast(event)); return @ptrCast(c.SDL_GetWindowFromEvent(@ptrCast(event)));
} }

View File

@ -49,6 +49,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
@ -80,7 +82,7 @@ pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetPathInfo(path, info)); return @bitCast(c.SDL_GetPathInfo(path, @ptrCast(info)));
} }
pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {

View File

@ -15,7 +15,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int { pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int {
return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio)); return c.SDL_AddGamepadMappingsFromIO(@ptrCast(iostream), @bitCast(closeio));
} }
}; };
@ -45,163 +45,163 @@ pub const Joystick = opaque {};
pub const Gamepad = opaque { pub const Gamepad = opaque {
pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 { pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 {
return c.SDL_GetGamepadMapping(gamepad); return c.SDL_GetGamepadMapping(@ptrCast(gamepad));
} }
pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID { pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID {
return c.SDL_GetGamepadProperties(gamepad); return c.SDL_GetGamepadProperties(@ptrCast(gamepad));
} }
pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID { pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID {
return c.SDL_GetGamepadID(gamepad); return c.SDL_GetGamepadID(@ptrCast(gamepad));
} }
pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadName(gamepad); return c.SDL_GetGamepadName(@ptrCast(gamepad));
} }
pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadPath(gamepad); return c.SDL_GetGamepadPath(@ptrCast(gamepad));
} }
pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetGamepadType(gamepad)); return @intFromEnum(c.SDL_GetGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetRealGamepadType(gamepad)); return @intFromEnum(c.SDL_GetRealGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int { pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int {
return c.SDL_GetGamepadPlayerIndex(gamepad); return c.SDL_GetGamepadPlayerIndex(@ptrCast(gamepad));
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index)); return @bitCast(c.SDL_SetGamepadPlayerIndex(@ptrCast(gamepad), player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadVendor(gamepad); return c.SDL_GetGamepadVendor(@ptrCast(gamepad));
} }
pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 { pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProduct(gamepad); return c.SDL_GetGamepadProduct(@ptrCast(gamepad));
} }
pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProductVersion(gamepad); return c.SDL_GetGamepadProductVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadFirmwareVersion(gamepad); return c.SDL_GetGamepadFirmwareVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadSerial(gamepad); return c.SDL_GetGamepadSerial(@ptrCast(gamepad));
} }
pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 { pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 {
return c.SDL_GetGamepadSteamHandle(gamepad); return c.SDL_GetGamepadSteamHandle(@ptrCast(gamepad));
} }
pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState { pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState {
return c.SDL_GetGamepadConnectionState(gamepad); return c.SDL_GetGamepadConnectionState(@ptrCast(gamepad));
} }
pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState { pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState {
return c.SDL_GetGamepadPowerInfo(gamepad, @ptrCast(percent)); return c.SDL_GetGamepadPowerInfo(@ptrCast(gamepad), @ptrCast(percent));
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return @bitCast(c.SDL_GamepadConnected(gamepad)); return @bitCast(c.SDL_GamepadConnected(@ptrCast(gamepad)));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
return c.SDL_GetGamepadJoystick(gamepad); return @ptrCast(c.SDL_GetGamepadJoystick(@ptrCast(gamepad)));
} }
pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c][*c]GamepadBinding { pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c]?*GamepadBinding {
return c.SDL_GetGamepadBindings(gamepad, @ptrCast(count)); return c.SDL_GetGamepadBindings(@ptrCast(gamepad), @ptrCast(count));
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis)); return @bitCast(c.SDL_GamepadHasAxis(@ptrCast(gamepad), axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
return c.SDL_GetGamepadAxis(gamepad, axis); return c.SDL_GetGamepadAxis(@ptrCast(gamepad), axis);
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GamepadHasButton(gamepad, button)); return @bitCast(c.SDL_GamepadHasButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GetGamepadButton(gamepad, button)); return @bitCast(c.SDL_GetGamepadButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
return c.SDL_GetGamepadButtonLabel(gamepad, button); return c.SDL_GetGamepadButtonLabel(@ptrCast(gamepad), button);
} }
pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int { pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int {
return c.SDL_GetNumGamepadTouchpads(gamepad); return c.SDL_GetNumGamepadTouchpads(@ptrCast(gamepad));
} }
pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int { pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int {
return c.SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad); return c.SDL_GetNumGamepadTouchpadFingers(@ptrCast(gamepad), touchpad);
} }
pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool { pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool {
return @bitCast(c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure))); return @bitCast(c.SDL_GetGamepadTouchpadFinger(@ptrCast(gamepad), touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)));
} }
pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadHasSensor(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool { pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool {
return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled))); return @bitCast(c.SDL_SetGamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(_type)); return c.SDL_GetGamepadSensorDataRate(@ptrCast(gamepad), @intFromEnum(_type));
} }
pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool { pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values)); return @bitCast(c.SDL_GetGamepadSensorData(@ptrCast(gamepad), @intFromEnum(_type), @ptrCast(data), num_values));
} }
pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepad(@ptrCast(gamepad), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepadTriggers(@ptrCast(gamepad), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool { pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetGamepadLED(gamepad, red, green, blue)); return @bitCast(c.SDL_SetGamepadLED(@ptrCast(gamepad), red, green, blue));
} }
pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size)); return @bitCast(c.SDL_SendGamepadEffect(@ptrCast(gamepad), data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
return c.SDL_CloseGamepad(gamepad); return c.SDL_CloseGamepad(@ptrCast(gamepad));
} }
pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button); return c.SDL_GetGamepadAppleSFSymbolsNameForButton(@ptrCast(gamepad), button);
} }
pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis); return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(@ptrCast(gamepad), axis);
} }
}; };
@ -308,7 +308,7 @@ pub inline fn hasGamepad() bool {
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
return c.SDL_GetGamepads(@ptrCast(count)); return @ptrCast(c.SDL_GetGamepads(@ptrCast(count)));
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
@ -356,15 +356,15 @@ pub inline fn getGamepadMappingForID(instance_id: JoystickID) [*c]u8 {
} }
pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad { pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad {
return c.SDL_OpenGamepad(instance_id); return @ptrCast(c.SDL_OpenGamepad(instance_id));
} }
pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad { pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad {
return c.SDL_GetGamepadFromID(instance_id); return @ptrCast(c.SDL_GetGamepadFromID(instance_id));
} }
pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad { pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
return c.SDL_GetGamepadFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetGamepadFromPlayerIndex(player_index));
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {

View File

@ -27,147 +27,147 @@ pub const FlipMode = enum(c_int) {
pub const GPUDevice = opaque { pub const GPUDevice = opaque {
pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void {
return c.SDL_DestroyGPUDevice(gpudevice); return c.SDL_DestroyGPUDevice(@ptrCast(gpudevice));
} }
pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 { pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 {
return c.SDL_GetGPUDeviceDriver(gpudevice); return c.SDL_GetGPUDeviceDriver(@ptrCast(gpudevice));
} }
pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat { pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat {
return @bitCast(c.SDL_GetGPUShaderFormats(gpudevice)); return @bitCast(c.SDL_GetGPUShaderFormats(@ptrCast(gpudevice)));
} }
pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: *const GPUComputePipelineCreateInfo) ?*GPUComputePipeline { pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUComputePipelineCreateInfo) ?*GPUComputePipeline {
return c.SDL_CreateGPUComputePipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: *const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline { pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline {
return c.SDL_CreateGPUGraphicsPipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: *const GPUSamplerCreateInfo) ?*GPUSampler { pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: ?*const GPUSamplerCreateInfo) ?*GPUSampler {
return c.SDL_CreateGPUSampler(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUSampler(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: *const GPUShaderCreateInfo) ?*GPUShader { pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: ?*const GPUShaderCreateInfo) ?*GPUShader {
return c.SDL_CreateGPUShader(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUShader(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: *const GPUTextureCreateInfo) ?*GPUTexture { pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: ?*const GPUTextureCreateInfo) ?*GPUTexture {
return c.SDL_CreateGPUTexture(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTexture(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: *const GPUBufferCreateInfo) ?*GPUBuffer { pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUBufferCreateInfo) ?*GPUBuffer {
return c.SDL_CreateGPUBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: *const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer { pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer {
return c.SDL_CreateGPUTransferBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void { pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void {
return c.SDL_SetGPUBufferName(gpudevice, buffer, text); return c.SDL_SetGPUBufferName(@ptrCast(gpudevice), @ptrCast(buffer), text);
} }
pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void { pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void {
return c.SDL_SetGPUTextureName(gpudevice, texture, text); return c.SDL_SetGPUTextureName(@ptrCast(gpudevice), @ptrCast(texture), text);
} }
pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void { pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void {
return c.SDL_ReleaseGPUTexture(gpudevice, texture); return c.SDL_ReleaseGPUTexture(@ptrCast(gpudevice), @ptrCast(texture));
} }
pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void { pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void {
return c.SDL_ReleaseGPUSampler(gpudevice, sampler); return c.SDL_ReleaseGPUSampler(@ptrCast(gpudevice), @ptrCast(sampler));
} }
pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void { pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void {
return c.SDL_ReleaseGPUBuffer(gpudevice, buffer); return c.SDL_ReleaseGPUBuffer(@ptrCast(gpudevice), @ptrCast(buffer));
} }
pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_ReleaseGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_ReleaseGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_ReleaseGPUComputePipeline(gpudevice, compute_pipeline); return c.SDL_ReleaseGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(compute_pipeline));
} }
pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void { pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void {
return c.SDL_ReleaseGPUShader(gpudevice, shader); return c.SDL_ReleaseGPUShader(@ptrCast(gpudevice), @ptrCast(shader));
} }
pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_ReleaseGPUGraphicsPipeline(gpudevice, graphics_pipeline); return c.SDL_ReleaseGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(graphics_pipeline));
} }
pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer { pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer {
return c.SDL_AcquireGPUCommandBuffer(gpudevice); return @ptrCast(c.SDL_AcquireGPUCommandBuffer(@ptrCast(gpudevice)));
} }
pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque { pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque {
return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle)); return c.SDL_MapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer), @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_UnmapGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_UnmapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool { pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool {
return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition)); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition));
} }
pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool { pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode))); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(@ptrCast(gpudevice), @ptrCast(window), @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window)); return @bitCast(c.SDL_ClaimWindowForGPUDevice(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
return c.SDL_ReleaseWindowFromGPUDevice(gpudevice, window); return c.SDL_ReleaseWindowFromGPUDevice(@ptrCast(gpudevice), @ptrCast(window));
} }
pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool { pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode))); return @bitCast(c.SDL_SetGPUSwapchainParameters(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition, @intFromEnum(present_mode)));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(gpudevice, window)); return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return @bitCast(c.SDL_WaitForGPUIdle(gpudevice)); return @bitCast(c.SDL_WaitForGPUIdle(@ptrCast(gpudevice)));
} }
pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]*const GPUFence, num_fences: u32) bool { pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]?*const GPUFence, num_fences: u32) bool {
return @bitCast(c.SDL_WaitForGPUFences(gpudevice, @bitCast(wait_all), fences, num_fences)); return @bitCast(c.SDL_WaitForGPUFences(@ptrCast(gpudevice), @bitCast(wait_all), fences, num_fences));
} }
pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool { pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool {
return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence)); return @bitCast(c.SDL_QueryGPUFence(@ptrCast(gpudevice), @ptrCast(fence)));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
return c.SDL_ReleaseGPUFence(gpudevice, fence); return c.SDL_ReleaseGPUFence(@ptrCast(gpudevice), @ptrCast(fence));
} }
pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool { pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool {
return @bitCast(c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage))); return @bitCast(c.SDL_GPUTextureSupportsFormat(@ptrCast(gpudevice), @bitCast(format), @intFromEnum(_type), @bitCast(usage)));
} }
pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool { pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool {
return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count)); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(@ptrCast(gpudevice), @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKSuspendGPU(gpudevice); return c.SDL_GDKSuspendGPU(@ptrCast(gpudevice));
} }
pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void { pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKResumeGPU(gpudevice); return c.SDL_GDKResumeGPU(@ptrCast(gpudevice));
} }
}; };
@ -187,197 +187,197 @@ pub const GPUGraphicsPipeline = opaque {};
pub const GPUCommandBuffer = opaque { pub const GPUCommandBuffer = opaque {
pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void { pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void {
return c.SDL_InsertGPUDebugLabel(gpucommandbuffer, text); return c.SDL_InsertGPUDebugLabel(@ptrCast(gpucommandbuffer), text);
} }
pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void { pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void {
return c.SDL_PushGPUDebugGroup(gpucommandbuffer, name); return c.SDL_PushGPUDebugGroup(@ptrCast(gpucommandbuffer), name);
} }
pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void { pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void {
return c.SDL_PopGPUDebugGroup(gpucommandbuffer); return c.SDL_PopGPUDebugGroup(@ptrCast(gpucommandbuffer));
} }
pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUVertexUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUVertexUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUFragmentUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUFragmentUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUComputeUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUComputeUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: *const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: *const GPUDepthStencilTargetInfo) ?*GPURenderPass { pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: ?*const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: ?*const GPUDepthStencilTargetInfo) ?*GPURenderPass {
return c.SDL_BeginGPURenderPass(gpucommandbuffer, @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)); return @ptrCast(c.SDL_BeginGPURenderPass(@ptrCast(gpucommandbuffer), @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)));
} }
pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: *const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: *const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass { pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: ?*const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: ?*const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass {
return c.SDL_BeginGPUComputePass(gpucommandbuffer, @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings); return @ptrCast(c.SDL_BeginGPUComputePass(@ptrCast(gpucommandbuffer), @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings));
} }
pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass { pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass {
return c.SDL_BeginGPUCopyPass(gpucommandbuffer); return @ptrCast(c.SDL_BeginGPUCopyPass(@ptrCast(gpucommandbuffer)));
} }
pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void { pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void {
return c.SDL_GenerateMipmapsForGPUTexture(gpucommandbuffer, texture); return c.SDL_GenerateMipmapsForGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(texture));
} }
pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: *const GPUBlitInfo) void { pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: ?*const GPUBlitInfo) void {
return c.SDL_BlitGPUTexture(gpucommandbuffer, @ptrCast(info)); return c.SDL_BlitGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(info));
} }
pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_SubmitGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
return c.SDL_SubmitGPUCommandBufferAndAcquireFence(gpucommandbuffer); return @ptrCast(c.SDL_SubmitGPUCommandBufferAndAcquireFence(@ptrCast(gpucommandbuffer)));
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_CancelGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
}; };
pub const GPURenderPass = opaque { pub const GPURenderPass = opaque {
pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_BindGPUGraphicsPipeline(gpurenderpass, graphics_pipeline); return c.SDL_BindGPUGraphicsPipeline(@ptrCast(gpurenderpass), @ptrCast(graphics_pipeline));
} }
pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: *const GPUViewport) void { pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: ?*const GPUViewport) void {
return c.SDL_SetGPUViewport(gpurenderpass, @ptrCast(viewport)); return c.SDL_SetGPUViewport(@ptrCast(gpurenderpass), @ptrCast(viewport));
} }
pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: *const Rect) void { pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: ?*const Rect) void {
return c.SDL_SetGPUScissor(gpurenderpass, @ptrCast(scissor)); return c.SDL_SetGPUScissor(@ptrCast(gpurenderpass), @ptrCast(scissor));
} }
pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void { pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void {
return c.SDL_SetGPUBlendConstants(gpurenderpass, blend_constants); return c.SDL_SetGPUBlendConstants(@ptrCast(gpurenderpass), blend_constants);
} }
pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void { pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void {
return c.SDL_SetGPUStencilReference(gpurenderpass, reference); return c.SDL_SetGPUStencilReference(@ptrCast(gpurenderpass), reference);
} }
pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: *const GPUBufferBinding, num_bindings: u32) void { pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: ?*const GPUBufferBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexBuffers(gpurenderpass, first_slot, @ptrCast(bindings), num_bindings); return c.SDL_BindGPUVertexBuffers(@ptrCast(gpurenderpass), first_slot, @ptrCast(bindings), num_bindings);
} }
pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: *const GPUBufferBinding, index_element_size: GPUIndexElementSize) void { pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: ?*const GPUBufferBinding, index_element_size: GPUIndexElementSize) void {
return c.SDL_BindGPUIndexBuffer(gpurenderpass, @ptrCast(binding), index_element_size); return c.SDL_BindGPUIndexBuffer(@ptrCast(gpurenderpass), @ptrCast(binding), index_element_size);
} }
pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUVertexSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUVertexStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUVertexStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUFragmentSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUFragmentSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUFragmentStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUFragmentStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void { pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void {
return c.SDL_DrawGPUIndexedPrimitives(gpurenderpass, num_indices, num_instances, first_index, vertex_offset, first_instance); return c.SDL_DrawGPUIndexedPrimitives(@ptrCast(gpurenderpass), num_indices, num_instances, first_index, vertex_offset, first_instance);
} }
pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void { pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void {
return c.SDL_DrawGPUPrimitives(gpurenderpass, num_vertices, num_instances, first_vertex, first_instance); return c.SDL_DrawGPUPrimitives(@ptrCast(gpurenderpass), num_vertices, num_instances, first_vertex, first_instance);
} }
pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUIndexedPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUIndexedPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void { pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void {
return c.SDL_EndGPURenderPass(gpurenderpass); return c.SDL_EndGPURenderPass(@ptrCast(gpurenderpass));
} }
}; };
pub const GPUComputePass = opaque { pub const GPUComputePass = opaque {
pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_BindGPUComputePipeline(gpucomputepass, compute_pipeline); return c.SDL_BindGPUComputePipeline(@ptrCast(gpucomputepass), @ptrCast(compute_pipeline));
} }
pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUComputeSamplers(gpucomputepass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUComputeSamplers(@ptrCast(gpucomputepass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageTextures(gpucomputepass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUComputeStorageTextures(@ptrCast(gpucomputepass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageBuffers(gpucomputepass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUComputeStorageBuffers(@ptrCast(gpucomputepass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void { pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void {
return c.SDL_DispatchGPUCompute(gpucomputepass, groupcount_x, groupcount_y, groupcount_z); return c.SDL_DispatchGPUCompute(@ptrCast(gpucomputepass), groupcount_x, groupcount_y, groupcount_z);
} }
pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void { pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void {
return c.SDL_DispatchGPUComputeIndirect(gpucomputepass, buffer, offset); return c.SDL_DispatchGPUComputeIndirect(@ptrCast(gpucomputepass), @ptrCast(buffer), offset);
} }
pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void { pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void {
return c.SDL_EndGPUComputePass(gpucomputepass); return c.SDL_EndGPUComputePass(@ptrCast(gpucomputepass));
} }
}; };
pub const GPUCopyPass = opaque { pub const GPUCopyPass = opaque {
pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureTransferInfo, destination: *const GPUTextureRegion, cycle: bool) void { pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureTransferInfo, destination: ?*const GPUTextureRegion, cycle: bool) void {
return c.SDL_UploadToGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUTransferBufferLocation, destination: *const GPUBufferRegion, cycle: bool) void { pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUTransferBufferLocation, destination: ?*const GPUBufferRegion, cycle: bool) void {
return c.SDL_UploadToGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureLocation, destination: *const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void { pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureLocation, destination: ?*const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void {
return c.SDL_CopyGPUTextureToTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle)); return c.SDL_CopyGPUTextureToTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle));
} }
pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferLocation, destination: *const GPUBufferLocation, size: u32, cycle: bool) void { pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferLocation, destination: ?*const GPUBufferLocation, size: u32, cycle: bool) void {
return c.SDL_CopyGPUBufferToBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle)); return c.SDL_CopyGPUBufferToBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle));
} }
pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureRegion, destination: *const GPUTextureTransferInfo) void { pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureRegion, destination: ?*const GPUTextureTransferInfo) void {
return c.SDL_DownloadFromGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferRegion, destination: *const GPUTransferBufferLocation) void { pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferRegion, destination: ?*const GPUTransferBufferLocation) void {
return c.SDL_DownloadFromGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void { pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void {
return c.SDL_EndGPUCopyPass(gpucopypass); return c.SDL_EndGPUCopyPass(@ptrCast(gpucopypass));
} }
}; };
@ -527,6 +527,8 @@ pub const GPUTextureUsageFlags = packed struct(u32) {
textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUTextureUsageFlags{};
}; };
pub const GPUTextureType = enum(c_int) { pub const GPUTextureType = enum(c_int) {
@ -562,6 +564,8 @@ pub const GPUBufferUsageFlags = packed struct(u32) {
bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage. bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage.
pad0: u25 = 0, pad0: u25 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUBufferUsageFlags{};
}; };
pub const GPUTransferBufferUsage = enum(c_int) { pub const GPUTransferBufferUsage = enum(c_int) {
@ -574,7 +578,18 @@ pub const GPUShaderStage = enum(c_int) {
shaderstageFragment, shaderstageFragment,
}; };
pub const GPUShaderFormat = u32; pub const GPUShaderFormat = packed struct(u32) {
shaderformatPrivate: bool = false, // Shaders for NDA'd platforms.
shaderformatSpirv: bool = false, // SPIR-V shaders for Vulkan.
shaderformatDxbc: bool = false, // DXBC SM5_0 shaders for D3D11.
shaderformatDxil: bool = false, // DXIL shaders for D3D12.
shaderformatMsl: bool = false, // MSL shaders for Metal.
shaderformatMetallib: bool = false, // Precompiled metallib shaders for Metal.
pad0: u25 = 0,
rsvd: bool = false,
pub const None = GPUShaderFormat{};
};
pub const GPUVertexElementFormat = enum(c_int) { pub const GPUVertexElementFormat = enum(c_int) {
vertexelementformatInvalid, vertexelementformatInvalid,
@ -688,6 +703,8 @@ pub const GPUColorComponentFlags = packed struct(u8) {
colorcomponentA: bool = false, // the alpha component colorcomponentA: bool = false, // the alpha component
pad0: u3 = 0, pad0: u3 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUColorComponentFlags{};
}; };
pub const GPUFilter = enum(c_int) { pub const GPUFilter = enum(c_int) {
@ -837,9 +854,9 @@ pub const GPUVertexAttribute = extern struct {
}; };
pub const GPUVertexInputState = extern struct { pub const GPUVertexInputState = extern struct {
vertex_buffer_descriptions: *const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions. vertex_buffer_descriptions: ?*const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions.
num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array. num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array.
vertex_attributes: *const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions. vertex_attributes: ?*const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions.
num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array. num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array.
}; };
@ -943,7 +960,7 @@ pub const GPUColorTargetDescription = extern struct {
}; };
pub const GPUGraphicsPipelineTargetInfo = extern struct { pub const GPUGraphicsPipelineTargetInfo = extern struct {
color_target_descriptions: *const GPUColorTargetDescription, // A pointer to an array of color target descriptions. color_target_descriptions: ?*const GPUColorTargetDescription, // A pointer to an array of color target descriptions.
num_color_targets: u32, // The number of color target descriptions in the above array. num_color_targets: u32, // The number of color target descriptions in the above array.
depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target. has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target.
@ -1060,11 +1077,11 @@ pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
} }
pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice { pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice {
return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name); return @ptrCast(c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name));
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {
return c.SDL_CreateGPUDeviceWithProperties(props); return @ptrCast(c.SDL_CreateGPUDeviceWithProperties(props));
} }
pub inline fn getNumGPUDrivers() c_int { pub inline fn getNumGPUDrivers() c_int {

View File

@ -3,105 +3,105 @@ pub const c = @import("c.zig").c;
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn isJoystickHaptic(joystick: *Joystick) bool { pub inline fn isJoystickHaptic(joystick: *Joystick) bool {
return @bitCast(c.SDL_IsJoystickHaptic(joystick)); return @bitCast(c.SDL_IsJoystickHaptic(@ptrCast(joystick)));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
return c.SDL_OpenHapticFromJoystick(joystick); return @ptrCast(c.SDL_OpenHapticFromJoystick(@ptrCast(joystick)));
} }
}; };
pub const Haptic = opaque { pub const Haptic = opaque {
pub inline fn getHapticID(haptic: *Haptic) HapticID { pub inline fn getHapticID(haptic: *Haptic) HapticID {
return c.SDL_GetHapticID(haptic); return c.SDL_GetHapticID(@ptrCast(haptic));
} }
pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 { pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 {
return c.SDL_GetHapticName(haptic); return c.SDL_GetHapticName(@ptrCast(haptic));
} }
pub inline fn closeHaptic(haptic: *Haptic) void { pub inline fn closeHaptic(haptic: *Haptic) void {
return c.SDL_CloseHaptic(haptic); return c.SDL_CloseHaptic(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffects(haptic); return c.SDL_GetMaxHapticEffects(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffectsPlaying(haptic); return c.SDL_GetMaxHapticEffectsPlaying(@ptrCast(haptic));
} }
pub inline fn getHapticFeatures(haptic: *Haptic) u32 { pub inline fn getHapticFeatures(haptic: *Haptic) u32 {
return c.SDL_GetHapticFeatures(haptic); return c.SDL_GetHapticFeatures(@ptrCast(haptic));
} }
pub inline fn getNumHapticAxes(haptic: *Haptic) c_int { pub inline fn getNumHapticAxes(haptic: *Haptic) c_int {
return c.SDL_GetNumHapticAxes(haptic); return c.SDL_GetNumHapticAxes(@ptrCast(haptic));
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: ?*const HapticEffect) bool {
return @bitCast(c.SDL_HapticEffectSupported(haptic, @ptrCast(effect))); return @bitCast(c.SDL_HapticEffectSupported(@ptrCast(haptic), @ptrCast(effect)));
} }
pub inline fn createHapticEffect(haptic: *Haptic, effect: *const HapticEffect) c_int { pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) c_int {
return c.SDL_CreateHapticEffect(haptic, @ptrCast(effect)); return c.SDL_CreateHapticEffect(@ptrCast(haptic), @ptrCast(effect));
} }
pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: *const HapticEffect) bool { pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: ?*const HapticEffect) bool {
return @bitCast(c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data))); return @bitCast(c.SDL_UpdateHapticEffect(@ptrCast(haptic), effect, @ptrCast(data)));
} }
pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool { pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool {
return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations)); return @bitCast(c.SDL_RunHapticEffect(@ptrCast(haptic), effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_StopHapticEffect(haptic, effect)); return @bitCast(c.SDL_StopHapticEffect(@ptrCast(haptic), effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
return c.SDL_DestroyHapticEffect(haptic, effect); return c.SDL_DestroyHapticEffect(@ptrCast(haptic), effect);
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect)); return @bitCast(c.SDL_GetHapticEffectStatus(@ptrCast(haptic), effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return @bitCast(c.SDL_SetHapticGain(haptic, gain)); return @bitCast(c.SDL_SetHapticGain(@ptrCast(haptic), gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter)); return @bitCast(c.SDL_SetHapticAutocenter(@ptrCast(haptic), autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_PauseHaptic(haptic)); return @bitCast(c.SDL_PauseHaptic(@ptrCast(haptic)));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_ResumeHaptic(haptic)); return @bitCast(c.SDL_ResumeHaptic(@ptrCast(haptic)));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticEffects(haptic)); return @bitCast(c.SDL_StopHapticEffects(@ptrCast(haptic)));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return @bitCast(c.SDL_HapticRumbleSupported(haptic)); return @bitCast(c.SDL_HapticRumbleSupported(@ptrCast(haptic)));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_InitHapticRumble(haptic)); return @bitCast(c.SDL_InitHapticRumble(@ptrCast(haptic)));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length)); return @bitCast(c.SDL_PlayHapticRumble(@ptrCast(haptic), strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticRumble(haptic)); return @bitCast(c.SDL_StopHapticRumble(@ptrCast(haptic)));
} }
}; };
@ -206,7 +206,7 @@ pub const HapticEffect = extern union {
pub const HapticID = u32; pub const HapticID = u32;
pub inline fn getHaptics(count: *c_int) ?*HapticID { pub inline fn getHaptics(count: *c_int) ?*HapticID {
return c.SDL_GetHaptics(@ptrCast(count)); return @ptrCast(c.SDL_GetHaptics(@ptrCast(count)));
} }
pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 { pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
@ -214,11 +214,11 @@ pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
} }
pub inline fn openHaptic(instance_id: HapticID) ?*Haptic { pub inline fn openHaptic(instance_id: HapticID) ?*Haptic {
return c.SDL_OpenHaptic(instance_id); return @ptrCast(c.SDL_OpenHaptic(instance_id));
} }
pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic { pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
return c.SDL_GetHapticFromID(instance_id); return @ptrCast(c.SDL_GetHapticFromID(instance_id));
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
@ -226,5 +226,5 @@ pub inline fn isMouseHaptic() bool {
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {
return c.SDL_OpenHapticFromMouse(); return @ptrCast(c.SDL_OpenHapticFromMouse());
} }

View File

@ -12,6 +12,8 @@ pub const InitFlags = packed struct(u32) {
initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`
pad0: u23 = 0, pad0: u23 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = InitFlags{};
}; };
pub const AppResult = enum(c_int) { pub const AppResult = enum(c_int) {

View File

@ -29,147 +29,147 @@ pub const PowerState = enum(c_int) {
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool { pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualAxis(joystick, axis, value)); return @bitCast(c.SDL_SetJoystickVirtualAxis(@ptrCast(joystick), axis, value));
} }
pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool { pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel)); return @bitCast(c.SDL_SetJoystickVirtualBall(@ptrCast(joystick), ball, xrel, yrel));
} }
pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool { pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool {
return @bitCast(c.SDL_SetJoystickVirtualButton(joystick, button, @bitCast(down))); return @bitCast(c.SDL_SetJoystickVirtualButton(@ptrCast(joystick), button, @bitCast(down)));
} }
pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool { pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool {
return @bitCast(c.SDL_SetJoystickVirtualHat(joystick, hat, value)); return @bitCast(c.SDL_SetJoystickVirtualHat(@ptrCast(joystick), hat, value));
} }
pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool { pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool {
return @bitCast(c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, @bitCast(down), x, y, pressure)); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(@ptrCast(joystick), touchpad, finger, @bitCast(down), x, y, pressure));
} }
pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool { pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool {
return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values)); return @bitCast(c.SDL_SendJoystickVirtualSensorData(@ptrCast(joystick), @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
return c.SDL_GetJoystickProperties(joystick); return c.SDL_GetJoystickProperties(@ptrCast(joystick));
} }
pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickName(joystick); return c.SDL_GetJoystickName(@ptrCast(joystick));
} }
pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickPath(joystick); return c.SDL_GetJoystickPath(@ptrCast(joystick));
} }
pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int { pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int {
return c.SDL_GetJoystickPlayerIndex(joystick); return c.SDL_GetJoystickPlayerIndex(@ptrCast(joystick));
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index)); return @bitCast(c.SDL_SetJoystickPlayerIndex(@ptrCast(joystick), player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
return c.SDL_GetJoystickGUID(joystick); return c.SDL_GetJoystickGUID(@ptrCast(joystick));
} }
pub inline fn getJoystickVendor(joystick: *Joystick) u16 { pub inline fn getJoystickVendor(joystick: *Joystick) u16 {
return c.SDL_GetJoystickVendor(joystick); return c.SDL_GetJoystickVendor(@ptrCast(joystick));
} }
pub inline fn getJoystickProduct(joystick: *Joystick) u16 { pub inline fn getJoystickProduct(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProduct(joystick); return c.SDL_GetJoystickProduct(@ptrCast(joystick));
} }
pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 { pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProductVersion(joystick); return c.SDL_GetJoystickProductVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 { pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickFirmwareVersion(joystick); return c.SDL_GetJoystickFirmwareVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickSerial(joystick); return c.SDL_GetJoystickSerial(@ptrCast(joystick));
} }
pub inline fn getJoystickType(joystick: *Joystick) JoystickType { pub inline fn getJoystickType(joystick: *Joystick) JoystickType {
return @intFromEnum(c.SDL_GetJoystickType(joystick)); return @intFromEnum(c.SDL_GetJoystickType(@ptrCast(joystick)));
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return @bitCast(c.SDL_JoystickConnected(joystick)); return @bitCast(c.SDL_JoystickConnected(@ptrCast(joystick)));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
return c.SDL_GetJoystickID(joystick); return c.SDL_GetJoystickID(@ptrCast(joystick));
} }
pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int { pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickAxes(joystick); return c.SDL_GetNumJoystickAxes(@ptrCast(joystick));
} }
pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int { pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickBalls(joystick); return c.SDL_GetNumJoystickBalls(@ptrCast(joystick));
} }
pub inline fn getNumJoystickHats(joystick: *Joystick) c_int { pub inline fn getNumJoystickHats(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickHats(joystick); return c.SDL_GetNumJoystickHats(@ptrCast(joystick));
} }
pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int { pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickButtons(joystick); return c.SDL_GetNumJoystickButtons(@ptrCast(joystick));
} }
pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 { pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 {
return c.SDL_GetJoystickAxis(joystick, axis); return c.SDL_GetJoystickAxis(@ptrCast(joystick), axis);
} }
pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool { pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool {
return @bitCast(c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state))); return @bitCast(c.SDL_GetJoystickAxisInitialState(@ptrCast(joystick), axis, @ptrCast(state)));
} }
pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool { pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool {
return @bitCast(c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy))); return @bitCast(c.SDL_GetJoystickBall(@ptrCast(joystick), ball, @ptrCast(dx), @ptrCast(dy)));
} }
pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 { pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 {
return c.SDL_GetJoystickHat(joystick, hat); return c.SDL_GetJoystickHat(@ptrCast(joystick), hat);
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return @bitCast(c.SDL_GetJoystickButton(joystick, button)); return @bitCast(c.SDL_GetJoystickButton(@ptrCast(joystick), button));
} }
pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystick(@ptrCast(joystick), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystickTriggers(@ptrCast(joystick), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool { pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetJoystickLED(joystick, red, green, blue)); return @bitCast(c.SDL_SetJoystickLED(@ptrCast(joystick), red, green, blue));
} }
pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size)); return @bitCast(c.SDL_SendJoystickEffect(@ptrCast(joystick), data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
return c.SDL_CloseJoystick(joystick); return c.SDL_CloseJoystick(@ptrCast(joystick));
} }
pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState { pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState {
return c.SDL_GetJoystickConnectionState(joystick); return c.SDL_GetJoystickConnectionState(@ptrCast(joystick));
} }
pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState { pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState {
return c.SDL_GetJoystickPowerInfo(joystick, @ptrCast(percent)); return c.SDL_GetJoystickPowerInfo(@ptrCast(joystick), @ptrCast(percent));
} }
}; };
@ -208,7 +208,7 @@ pub inline fn hasJoystick() bool {
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
return c.SDL_GetJoysticks(@ptrCast(count)); return @ptrCast(c.SDL_GetJoysticks(@ptrCast(count)));
} }
pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 {
@ -244,15 +244,15 @@ pub inline fn getJoystickTypeForID(instance_id: JoystickID) JoystickType {
} }
pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick { pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick {
return c.SDL_OpenJoystick(instance_id); return @ptrCast(c.SDL_OpenJoystick(instance_id));
} }
pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick { pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick {
return c.SDL_GetJoystickFromID(instance_id); return @ptrCast(c.SDL_GetJoystickFromID(instance_id));
} }
pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick { pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick {
return c.SDL_GetJoystickFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetJoystickFromPlayerIndex(player_index));
} }
pub const VirtualJoystickTouchpadDesc = extern struct { pub const VirtualJoystickTouchpadDesc = extern struct {
@ -279,8 +279,8 @@ pub const VirtualJoystickDesc = extern struct {
nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions
padding2: [2]u16, // unused padding2: [2]u16, // unused
name: [*c]const u8, // the name of the joystick name: [*c]const u8, // the name of the joystick
touchpads: *const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 touchpads: ?*const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0
sensors: *const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0 sensors: ?*const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0
userdata: ?*anyopaque, // User data pointer passed to callbacks userdata: ?*anyopaque, // User data pointer passed to callbacks
Update: ?*const anyopaque, // Called when the joystick state should be updated Update: ?*const anyopaque, // Called when the joystick state should be updated
SetPlayerIndex: ?*const anyopaque, // Called when the player index is set SetPlayerIndex: ?*const anyopaque, // Called when the player index is set
@ -292,7 +292,7 @@ pub const VirtualJoystickDesc = extern struct {
Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached
}; };
pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID { pub inline fn attachVirtualJoystick(desc: ?*const VirtualJoystickDesc) JoystickID {
return c.SDL_AttachVirtualJoystick(@ptrCast(desc)); return c.SDL_AttachVirtualJoystick(@ptrCast(desc));
} }

View File

@ -5,14 +5,14 @@ pub const FunctionPointer = c.SDL_FunctionPointer;
pub const SharedObject = opaque { pub const SharedObject = opaque {
pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer { pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer {
return c.SDL_LoadFunction(sharedobject, name); return c.SDL_LoadFunction(@ptrCast(sharedobject), name);
} }
pub inline fn unloadObject(sharedobject: *SharedObject) void { pub inline fn unloadObject(sharedobject: *SharedObject) void {
return c.SDL_UnloadObject(sharedobject); return c.SDL_UnloadObject(@ptrCast(sharedobject));
} }
}; };
pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject { pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject {
return c.SDL_LoadObject(sofile); return @ptrCast(c.SDL_LoadObject(sofile));
} }

View File

@ -11,6 +11,8 @@ pub const MessageBoxFlags = packed struct(u32) {
messageboxButtonsRightToLeft: bool = false, // buttons placed right to left messageboxButtonsRightToLeft: bool = false, // buttons placed right to left
pad0: u26 = 0, pad0: u26 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxFlags{};
}; };
pub const MessageBoxButtonFlags = packed struct(u32) { pub const MessageBoxButtonFlags = packed struct(u32) {
@ -18,6 +20,8 @@ pub const MessageBoxButtonFlags = packed struct(u32) {
messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit
pad0: u29 = 0, pad0: u29 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxButtonFlags{};
}; };
pub const MessageBoxButtonData = extern struct { pub const MessageBoxButtonData = extern struct {
@ -51,14 +55,14 @@ pub const MessageBoxData = extern struct {
title: [*c]const u8, // UTF-8 title title: [*c]const u8, // UTF-8 title
message: [*c]const u8, // UTF-8 message text message: [*c]const u8, // UTF-8 message text
numbuttons: c_int, numbuttons: c_int,
buttons: *const MessageBoxButtonData, buttons: ?*const MessageBoxButtonData,
colorScheme: *const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings colorScheme: ?*const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: ?*const MessageBoxData, buttonid: *c_int) bool {
return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid))); return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid)));
} }
pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool { pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool {
return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window)); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, @ptrCast(window)));
} }

View File

@ -3,21 +3,21 @@ pub const c = @import("c.zig").c;
pub const Window = opaque { pub const Window = opaque {
pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void { pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void {
return c.SDL_WarpMouseInWindow(window, x, y); return c.SDL_WarpMouseInWindow(@ptrCast(window), x, y);
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled))); return @bitCast(c.SDL_SetWindowRelativeMouseMode(@ptrCast(window), @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return @bitCast(c.SDL_GetWindowRelativeMouseMode(window)); return @bitCast(c.SDL_GetWindowRelativeMouseMode(@ptrCast(window)));
} }
}; };
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateColorCursor(surface, hot_x, hot_y); return @ptrCast(c.SDL_CreateColorCursor(@ptrCast(surface), hot_x, hot_y));
} }
}; };
@ -25,11 +25,11 @@ pub const MouseID = u32;
pub const Cursor = opaque { pub const Cursor = opaque {
pub inline fn setCursor(cursor: *Cursor) bool { pub inline fn setCursor(cursor: *Cursor) bool {
return @bitCast(c.SDL_SetCursor(cursor)); return @bitCast(c.SDL_SetCursor(@ptrCast(cursor)));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
return c.SDL_DestroyCursor(cursor); return c.SDL_DestroyCursor(@ptrCast(cursor));
} }
}; };
@ -68,6 +68,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MouseButtonFlags{};
pub const ButtonRight: MouseButtonFlags = @bitCast(@as(u32, 3));
pub const ButtonX2: MouseButtonFlags = @bitCast(@as(u32, 5));
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
@ -75,7 +79,7 @@ pub inline fn hasMouse() bool {
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
return c.SDL_GetMice(@ptrCast(count)); return @ptrCast(c.SDL_GetMice(@ptrCast(count)));
} }
pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 { pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
@ -83,7 +87,7 @@ pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
} }
pub inline fn getMouseFocus() ?*Window { pub inline fn getMouseFocus() ?*Window {
return c.SDL_GetMouseFocus(); return @ptrCast(c.SDL_GetMouseFocus());
} }
pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags { pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags {
@ -107,19 +111,19 @@ pub inline fn captureMouse(enabled: bool) bool {
} }
pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y); return @ptrCast(c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y));
} }
pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor { pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor {
return c.SDL_CreateSystemCursor(id); return @ptrCast(c.SDL_CreateSystemCursor(id));
} }
pub inline fn getCursor() ?*Cursor { pub inline fn getCursor() ?*Cursor {
return c.SDL_GetCursor(); return @ptrCast(c.SDL_GetCursor());
} }
pub inline fn getDefaultCursor() ?*Cursor { pub inline fn getDefaultCursor() ?*Cursor {
return c.SDL_GetDefaultCursor(); return @ptrCast(c.SDL_GetDefaultCursor());
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {

View File

@ -205,34 +205,34 @@ pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask:
return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask)); return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask));
} }
pub inline fn getPixelFormatDetails(format: PixelFormat) *const PixelFormatDetails { pub inline fn getPixelFormatDetails(format: PixelFormat) ?*const PixelFormatDetails {
return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format))); return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format)));
} }
pub inline fn createPalette(ncolors: c_int) ?*Palette { pub inline fn createPalette(ncolors: c_int) ?*Palette {
return c.SDL_CreatePalette(ncolors); return @ptrCast(c.SDL_CreatePalette(ncolors));
} }
pub inline fn setPaletteColors(palette: ?*Palette, colors: *const Color, firstcolor: c_int, ncolors: c_int) bool { pub inline fn setPaletteColors(palette: ?*Palette, colors: ?*const Color, firstcolor: c_int, ncolors: c_int) bool {
return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors)); return @bitCast(c.SDL_SetPaletteColors(@ptrCast(palette), @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {
return c.SDL_DestroyPalette(palette); return c.SDL_DestroyPalette(@ptrCast(palette));
} }
pub inline fn mapRGB(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8) u32 { pub inline fn mapRGB(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b); return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b);
} }
pub inline fn mapRGBA(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapRGBA(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a); return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a);
} }
pub inline fn getRGB(pixel: u32, format: *const PixelFormatDetails, palette: *const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8) void { 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); return c.SDL_GetRGB(pixel, @ptrCast(format), @ptrCast(palette), r, g, b);
} }
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 { 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); return c.SDL_GetRGBA(pixel, @ptrCast(format), @ptrCast(palette), r, g, b, a);
} }

View File

@ -25,42 +25,42 @@ pub const FRect = extern struct {
h: f32, h: f32,
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: ?*const Rect, B: ?*const Rect) bool {
return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersection(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectIntersection(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnion(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectUnion(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPoints(points: *const Point, count: c_int, clip: *const Rect, result: ?*Rect) bool { pub inline fn getRectEnclosingPoints(points: ?*const Point, count: c_int, clip: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersection(rect: *const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool { pub inline fn getRectAndLineIntersection(rect: ?*const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool {
return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }
pub inline fn hasRectIntersectionFloat(A: *const FRect, B: *const FRect) bool { pub inline fn hasRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect) bool {
return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersectionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectUnionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPointsFloat(points: *const FPoint, count: c_int, clip: *const FRect, result: ?*FRect) bool { pub inline fn getRectEnclosingPointsFloat(points: ?*const FPoint, count: c_int, clip: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersectionFloat(rect: *const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool { pub inline fn getRectAndLineIntersectionFloat(rect: ?*const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool {
return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }

View File

@ -27,7 +27,7 @@ pub const FColor = extern struct {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer { pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer {
return c.SDL_CreateSoftwareRenderer(surface); return @ptrCast(c.SDL_CreateSoftwareRenderer(@ptrCast(surface)));
} }
}; };
@ -42,11 +42,11 @@ pub const BlendMode = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer { pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer {
return c.SDL_CreateRenderer(window, name); return @ptrCast(c.SDL_CreateRenderer(@ptrCast(window), name));
} }
pub inline fn getRenderer(window: *Window) ?*Renderer { pub inline fn getRenderer(window: *Window) ?*Renderer {
return c.SDL_GetRenderer(window); return @ptrCast(c.SDL_GetRenderer(@ptrCast(window)));
} }
}; };
@ -596,6 +596,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const PenInputFlags = packed struct(u32) {
@ -608,9 +612,16 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const PenID = u32; pub const PenID = packed struct(u32) {
pad0: u31 = 0,
rsvd: bool = false,
pub const None = PenID{};
};
pub const DisplayID = u32; pub const DisplayID = u32;
@ -769,6 +780,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const Vertex = extern struct { pub const Vertex = extern struct {
@ -793,325 +806,325 @@ pub const RendererLogicalPresentation = enum(c_int) {
pub const Renderer = opaque { pub const Renderer = opaque {
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window { pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
return c.SDL_GetRenderWindow(renderer); return @ptrCast(c.SDL_GetRenderWindow(@ptrCast(renderer)));
} }
pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 { pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 {
return c.SDL_GetRendererName(renderer); return c.SDL_GetRendererName(@ptrCast(renderer));
} }
pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID { pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID {
return c.SDL_GetRendererProperties(renderer); return c.SDL_GetRendererProperties(@ptrCast(renderer));
} }
pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetRenderOutputSize(@ptrCast(renderer), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); 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 { pub inline fn createTexture(renderer: *Renderer, format: PixelFormat, access: TextureAccess, w: c_int, h: c_int) ?*Texture {
return c.SDL_CreateTexture(renderer, @bitCast(format), access, w, h); return @ptrCast(c.SDL_CreateTexture(@ptrCast(renderer), @bitCast(format), access, w, h));
} }
pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture { pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture {
return c.SDL_CreateTextureFromSurface(renderer, surface); return @ptrCast(c.SDL_CreateTextureFromSurface(@ptrCast(renderer), @ptrCast(surface)));
} }
pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture { pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture {
return c.SDL_CreateTextureWithProperties(renderer, props); return @ptrCast(c.SDL_CreateTextureWithProperties(@ptrCast(renderer), props));
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return @bitCast(c.SDL_SetRenderTarget(renderer, texture)); return @bitCast(c.SDL_SetRenderTarget(@ptrCast(renderer), @ptrCast(texture)));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
return c.SDL_GetRenderTarget(renderer); return @ptrCast(c.SDL_GetRenderTarget(@ptrCast(renderer)));
} }
pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool { pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool {
return @bitCast(c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode)); 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 { pub inline fn getRenderLogicalPresentation(renderer: *Renderer, w: *c_int, h: *c_int, mode: ?*RendererLogicalPresentation) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode)); return @bitCast(c.SDL_GetRenderLogicalPresentation(@ptrCast(renderer), @ptrCast(w), @ptrCast(h), @ptrCast(mode)));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, rect)); 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 { pub inline fn renderCoordinatesFromWindow(renderer: *Renderer, window_x: f32, window_y: f32, x: *f32, y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y))); 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 { pub inline fn renderCoordinatesToWindow(renderer: *Renderer, x: f32, y: f32, window_x: *f32, window_y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y))); return @bitCast(c.SDL_RenderCoordinatesToWindow(@ptrCast(renderer), x, y, @ptrCast(window_x), @ptrCast(window_y)));
} }
pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool { pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool {
return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event)); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(@ptrCast(renderer), @ptrCast(event)));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderViewport(renderer, rect)); return @bitCast(c.SDL_GetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderViewportSet(renderer)); return @bitCast(c.SDL_RenderViewportSet(@ptrCast(renderer)));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect)); return @bitCast(c.SDL_GetRenderSafeArea(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderClipRect(renderer, rect)); return @bitCast(c.SDL_GetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClipEnabled(renderer)); return @bitCast(c.SDL_RenderClipEnabled(@ptrCast(renderer)));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return @bitCast(c.SDL_SetRenderScale(renderer, scaleX, scaleY)); return @bitCast(c.SDL_SetRenderScale(@ptrCast(renderer), scaleX, scaleY));
} }
pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool { pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool {
return @bitCast(c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY))); 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 { pub inline fn setRenderDrawColor(renderer: *Renderer, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_SetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn setRenderDrawColorFloat(renderer: *Renderer, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColor(renderer: *Renderer, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_GetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColorFloat(renderer: *Renderer, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_GetRenderDrawColorFloat(@ptrCast(renderer), @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool { pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool {
return @bitCast(c.SDL_SetRenderColorScale(renderer, scale)); return @bitCast(c.SDL_SetRenderColorScale(@ptrCast(renderer), scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale))); return @bitCast(c.SDL_GetRenderColorScale(@ptrCast(renderer), @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetRenderDrawBlendMode(@ptrCast(renderer), @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetRenderDrawBlendMode(@ptrCast(renderer), @ptrCast(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClear(renderer)); return @bitCast(c.SDL_RenderClear(@ptrCast(renderer)));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return @bitCast(c.SDL_RenderPoint(renderer, x, y)); return @bitCast(c.SDL_RenderPoint(@ptrCast(renderer), x, y));
} }
pub inline fn renderPoints(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderPoints(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderPoints(renderer, @ptrCast(points), count)); 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 { pub inline fn renderLine(renderer: *Renderer, x1: f32, y1: f32, x2: f32, y2: f32) bool {
return @bitCast(c.SDL_RenderLine(renderer, x1, y1, x2, y2)); return @bitCast(c.SDL_RenderLine(@ptrCast(renderer), x1, y1, x2, y2));
} }
pub inline fn renderLines(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderLines(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderLines(renderer, @ptrCast(points), count)); return @bitCast(c.SDL_RenderLines(@ptrCast(renderer), @ptrCast(points), count));
} }
pub inline fn renderRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderRects(renderer, @ptrCast(rects), count)); return @bitCast(c.SDL_RenderRects(@ptrCast(renderer), @ptrCast(rects), count));
} }
pub inline fn renderFillRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderFillRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderFillRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderFillRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderFillRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderFillRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderFillRects(renderer, @ptrCast(rects), count)); 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 { pub inline fn renderTexture(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip))); return @bitCast(c.SDL_RenderTextureRotated(@ptrCast(renderer), @ptrCast(texture), @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip)));
} }
pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: *const FRect, scale: f32, dstrect: *const FRect) bool { pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, scale: f32, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices)); 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 { 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(renderer, texture, @ptrCast(xy), xy_stride, @ptrCast(color), color_stride, @ptrCast(uv), uv_stride, num_vertices, indices, num_indices, size_indices)); 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 { pub inline fn renderReadPixels(renderer: *Renderer, rect: ?*const Rect) ?*Surface {
return c.SDL_RenderReadPixels(renderer, @ptrCast(rect)); return @ptrCast(c.SDL_RenderReadPixels(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderPresent(renderer)); return @bitCast(c.SDL_RenderPresent(@ptrCast(renderer)));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
return c.SDL_DestroyRenderer(renderer); return c.SDL_DestroyRenderer(@ptrCast(renderer));
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return @bitCast(c.SDL_FlushRenderer(renderer)); return @bitCast(c.SDL_FlushRenderer(@ptrCast(renderer)));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalLayer(renderer); return c.SDL_GetRenderMetalLayer(@ptrCast(renderer));
} }
pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalCommandEncoder(renderer); return c.SDL_GetRenderMetalCommandEncoder(@ptrCast(renderer));
} }
pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool { pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool {
return @bitCast(c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore)); return @bitCast(c.SDL_AddVulkanRenderSemaphores(@ptrCast(renderer), wait_stage_mask, wait_semaphore, signal_semaphore));
} }
pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool { pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool {
return @bitCast(c.SDL_SetRenderVSync(renderer, vsync)); return @bitCast(c.SDL_SetRenderVSync(@ptrCast(renderer), vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return @bitCast(c.SDL_GetRenderVSync(renderer, @ptrCast(vsync))); return @bitCast(c.SDL_GetRenderVSync(@ptrCast(renderer), @ptrCast(vsync)));
} }
pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool { pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool {
return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str)); return @bitCast(c.SDL_RenderDebugText(@ptrCast(renderer), x, y, str));
} }
}; };
pub const Texture = opaque { pub const Texture = opaque {
pub inline fn getTextureProperties(texture: *Texture) PropertiesID { pub inline fn getTextureProperties(texture: *Texture) PropertiesID {
return c.SDL_GetTextureProperties(texture); return c.SDL_GetTextureProperties(@ptrCast(texture));
} }
pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer { pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer {
return c.SDL_GetRendererFromTexture(texture); return @ptrCast(c.SDL_GetRendererFromTexture(@ptrCast(texture)));
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return @bitCast(c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetTextureSize(@ptrCast(texture), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool { pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_SetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool { pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool {
return @bitCast(c.SDL_SetTextureColorModFloat(texture, r, g, b)); 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 { pub inline fn getTextureColorMod(texture: *Texture, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_GetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool { pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool {
return @bitCast(c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b))); return @bitCast(c.SDL_GetTextureColorModFloat(@ptrCast(texture), @ptrCast(r), @ptrCast(g), @ptrCast(b)));
} }
pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool { pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool {
return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaModFloat(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_GetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha))); return @bitCast(c.SDL_GetTextureAlphaModFloat(@ptrCast(texture), @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetTextureBlendMode(@ptrCast(texture), @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetTextureBlendMode(@ptrCast(texture), @ptrCast(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode))); return @bitCast(c.SDL_SetTextureScaleMode(@ptrCast(texture), @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode))); 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 { pub inline fn updateTexture(texture: *Texture, rect: ?*const Rect, pixels: ?*const anyopaque, pitch: c_int) bool {
return @bitCast(c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch)); 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 { pub inline fn lockTexture(texture: *Texture, rect: ?*const Rect, pixels: [*c]?*anyopaque, pitch: *c_int) bool {
return @bitCast(c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch))); return @bitCast(c.SDL_LockTexture(@ptrCast(texture), @ptrCast(rect), pixels, @ptrCast(pitch)));
} }
pub inline fn lockTextureToSurface(texture: *Texture, rect: *const Rect, surface: [*c][*c]Surface) bool { pub inline fn lockTextureToSurface(texture: *Texture, rect: ?*const Rect, surface: [*c]?*Surface) bool {
return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface)); return @bitCast(c.SDL_LockTextureToSurface(@ptrCast(texture), @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
return c.SDL_UnlockTexture(texture); return c.SDL_UnlockTexture(@ptrCast(texture));
} }
pub inline fn destroyTexture(texture: *Texture) void { pub inline fn destroyTexture(texture: *Texture) void {
return c.SDL_DestroyTexture(texture); return c.SDL_DestroyTexture(@ptrCast(texture));
} }
}; };
@ -1123,10 +1136,10 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
return c.SDL_GetRenderDriver(index); return c.SDL_GetRenderDriver(index);
} }
pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: c_int, window_flags: WindowFlags, window: [*c][*c]Window, renderer: [*c][*c]Renderer) bool { 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)); return @bitCast(c.SDL_CreateWindowAndRenderer(title, width, height, @bitCast(window_flags), window, renderer));
} }
pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer { pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer {
return c.SDL_CreateRendererWithProperties(props); return @ptrCast(c.SDL_CreateRendererWithProperties(props));
} }

View File

@ -5,31 +5,31 @@ pub const PropertiesID = u32;
pub const Sensor = opaque { pub const Sensor = opaque {
pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID { pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID {
return c.SDL_GetSensorProperties(sensor); return c.SDL_GetSensorProperties(@ptrCast(sensor));
} }
pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 { pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 {
return c.SDL_GetSensorName(sensor); return c.SDL_GetSensorName(@ptrCast(sensor));
} }
pub inline fn getSensorType(sensor: *Sensor) SensorType { pub inline fn getSensorType(sensor: *Sensor) SensorType {
return @intFromEnum(c.SDL_GetSensorType(sensor)); return @intFromEnum(c.SDL_GetSensorType(@ptrCast(sensor)));
} }
pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int { pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int {
return c.SDL_GetSensorNonPortableType(sensor); return c.SDL_GetSensorNonPortableType(@ptrCast(sensor));
} }
pub inline fn getSensorID(sensor: *Sensor) SensorID { pub inline fn getSensorID(sensor: *Sensor) SensorID {
return c.SDL_GetSensorID(sensor); return c.SDL_GetSensorID(@ptrCast(sensor));
} }
pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool { pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values)); return @bitCast(c.SDL_GetSensorData(@ptrCast(sensor), @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {
return c.SDL_CloseSensor(sensor); return c.SDL_CloseSensor(@ptrCast(sensor));
} }
}; };
@ -47,7 +47,7 @@ pub const SensorType = enum(c_int) {
}; };
pub inline fn getSensors(count: *c_int) ?*SensorID { pub inline fn getSensors(count: *c_int) ?*SensorID {
return c.SDL_GetSensors(@ptrCast(count)); return @ptrCast(c.SDL_GetSensors(@ptrCast(count)));
} }
pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 { pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 {
@ -63,11 +63,11 @@ pub inline fn getSensorNonPortableTypeForID(instance_id: SensorID) c_int {
} }
pub inline fn openSensor(instance_id: SensorID) ?*Sensor { pub inline fn openSensor(instance_id: SensorID) ?*Sensor {
return c.SDL_OpenSensor(instance_id); return @ptrCast(c.SDL_OpenSensor(instance_id));
} }
pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor { pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor {
return c.SDL_GetSensorFromID(instance_id); return @ptrCast(c.SDL_GetSensorFromID(instance_id));
} }
pub inline fn updateSensors() void { pub inline fn updateSensors() void {

View File

@ -22,6 +22,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
@ -45,70 +47,70 @@ pub const StorageInterface = extern struct {
pub const Storage = opaque { pub const Storage = opaque {
pub inline fn closeStorage(storage: *Storage) bool { pub inline fn closeStorage(storage: *Storage) bool {
return @bitCast(c.SDL_CloseStorage(storage)); return @bitCast(c.SDL_CloseStorage(@ptrCast(storage)));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return @bitCast(c.SDL_StorageReady(storage)); return @bitCast(c.SDL_StorageReady(@ptrCast(storage)));
} }
pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool { pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool {
return @bitCast(c.SDL_GetStorageFileSize(storage, path, @ptrCast(length))); return @bitCast(c.SDL_GetStorageFileSize(@ptrCast(storage), path, @ptrCast(length)));
} }
pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool { pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool {
return @bitCast(c.SDL_ReadStorageFile(storage, path, destination, length)); return @bitCast(c.SDL_ReadStorageFile(@ptrCast(storage), path, destination, length));
} }
pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool { pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool {
return @bitCast(c.SDL_WriteStorageFile(storage, path, source, length)); return @bitCast(c.SDL_WriteStorageFile(@ptrCast(storage), path, source, length));
} }
pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool { pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_CreateStorageDirectory(storage, path)); return @bitCast(c.SDL_CreateStorageDirectory(@ptrCast(storage), path));
} }
pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata)); return @bitCast(c.SDL_EnumerateStorageDirectory(@ptrCast(storage), path, callback, userdata));
} }
pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool { pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_RemoveStoragePath(storage, path)); return @bitCast(c.SDL_RemoveStoragePath(@ptrCast(storage), path));
} }
pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_RenameStoragePath(storage, oldpath, newpath)); return @bitCast(c.SDL_RenameStoragePath(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_CopyStorageFile(storage, oldpath, newpath)); return @bitCast(c.SDL_CopyStorageFile(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info)); return @bitCast(c.SDL_GetStoragePathInfo(@ptrCast(storage), path, @ptrCast(info)));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {
return c.SDL_GetStorageSpaceRemaining(storage); return c.SDL_GetStorageSpaceRemaining(@ptrCast(storage));
} }
pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {
return c.SDL_GlobStorageDirectory(storage, path, pattern, @bitCast(flags), @ptrCast(count)); return c.SDL_GlobStorageDirectory(@ptrCast(storage), path, pattern, @bitCast(flags), @ptrCast(count));
} }
}; };
pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenTitleStorage(override, props); return @ptrCast(c.SDL_OpenTitleStorage(override, props));
} }
pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenUserStorage(org, app, props); return @ptrCast(c.SDL_OpenUserStorage(org, app, props));
} }
pub inline fn openFileStorage(path: [*c]const u8) ?*Storage { pub inline fn openFileStorage(path: [*c]const u8) ?*Storage {
return c.SDL_OpenFileStorage(path); return @ptrCast(c.SDL_OpenFileStorage(path));
} }
pub inline fn openStorage(iface: *const StorageInterface, userdata: ?*anyopaque) ?*Storage { pub inline fn openStorage(iface: ?*const StorageInterface, userdata: ?*anyopaque) ?*Storage {
return c.SDL_OpenStorage(@ptrCast(iface), userdata); return @ptrCast(c.SDL_OpenStorage(@ptrCast(iface), userdata));
} }

View File

@ -17,7 +17,7 @@ pub const BlendMode = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface { pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio)); return @ptrCast(c.SDL_LoadBMP_IO(@ptrCast(iostream), @bitCast(closeio)));
} }
}; };
@ -81,6 +81,8 @@ pub const SurfaceFlags = packed struct(u32) {
surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc() surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc()
pad0: u27 = 0, pad0: u27 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = SurfaceFlags{};
}; };
pub const ScaleMode = enum(c_int) { pub const ScaleMode = enum(c_int) {
@ -96,216 +98,216 @@ pub const FlipMode = enum(c_int) {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn destroySurface(surface: *Surface) void { pub inline fn destroySurface(surface: *Surface) void {
return c.SDL_DestroySurface(surface); return c.SDL_DestroySurface(@ptrCast(surface));
} }
pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID { pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID {
return c.SDL_GetSurfaceProperties(surface); return c.SDL_GetSurfaceProperties(@ptrCast(surface));
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace)); return @bitCast(c.SDL_SetSurfaceColorspace(@ptrCast(surface), colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
return c.SDL_GetSurfaceColorspace(surface); return c.SDL_GetSurfaceColorspace(@ptrCast(surface));
} }
pub inline fn createSurfacePalette(surface: *Surface) ?*Palette { pub inline fn createSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_CreateSurfacePalette(surface); return @ptrCast(c.SDL_CreateSurfacePalette(@ptrCast(surface)));
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return @bitCast(c.SDL_SetSurfacePalette(surface, palette)); return @bitCast(c.SDL_SetSurfacePalette(@ptrCast(surface), @ptrCast(palette)));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_GetSurfacePalette(surface); return @ptrCast(c.SDL_GetSurfacePalette(@ptrCast(surface)));
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image)); return @bitCast(c.SDL_AddSurfaceAlternateImage(@ptrCast(surface), @ptrCast(image)));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasAlternateImages(surface)); return @bitCast(c.SDL_SurfaceHasAlternateImages(@ptrCast(surface)));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c]?*Surface {
return c.SDL_GetSurfaceImages(surface, @ptrCast(count)); return c.SDL_GetSurfaceImages(@ptrCast(surface), @ptrCast(count));
} }
pub inline fn removeSurfaceAlternateImages(surface: *Surface) void { pub inline fn removeSurfaceAlternateImages(surface: *Surface) void {
return c.SDL_RemoveSurfaceAlternateImages(surface); return c.SDL_RemoveSurfaceAlternateImages(@ptrCast(surface));
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return @bitCast(c.SDL_LockSurface(surface)); return @bitCast(c.SDL_LockSurface(@ptrCast(surface)));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
return c.SDL_UnlockSurface(surface); return c.SDL_UnlockSurface(@ptrCast(surface));
} }
pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool { pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool {
return @bitCast(c.SDL_SaveBMP_IO(surface, dst, @bitCast(closeio))); return @bitCast(c.SDL_SaveBMP_IO(@ptrCast(surface), @ptrCast(dst), @bitCast(closeio)));
} }
pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool { pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool {
return @bitCast(c.SDL_SaveBMP(surface, file)); return @bitCast(c.SDL_SaveBMP(@ptrCast(surface), file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled))); return @bitCast(c.SDL_SetSurfaceRLE(@ptrCast(surface), @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasRLE(surface)); return @bitCast(c.SDL_SurfaceHasRLE(@ptrCast(surface)));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key)); return @bitCast(c.SDL_SetSurfaceColorKey(@ptrCast(surface), @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasColorKey(surface)); return @bitCast(c.SDL_SurfaceHasColorKey(@ptrCast(surface)));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return @bitCast(c.SDL_GetSurfaceColorKey(surface, @ptrCast(key))); return @bitCast(c.SDL_GetSurfaceColorKey(@ptrCast(surface), @ptrCast(key)));
} }
pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool { pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_SetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool { pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_GetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_SetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_GetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetSurfaceBlendMode(@ptrCast(surface), @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetSurfaceBlendMode(@ptrCast(surface), @ptrCast(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect))); return @bitCast(c.SDL_SetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect)); return @bitCast(c.SDL_GetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip))); return @bitCast(c.SDL_FlipSurface(@ptrCast(surface), @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
return c.SDL_DuplicateSurface(surface); return @ptrCast(c.SDL_DuplicateSurface(@ptrCast(surface)));
} }
pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface { pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface {
return c.SDL_ScaleSurface(surface, width, height, @intFromEnum(scaleMode)); return @ptrCast(c.SDL_ScaleSurface(@ptrCast(surface), width, height, @intFromEnum(scaleMode)));
} }
pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface { pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface {
return c.SDL_ConvertSurface(surface, @bitCast(format)); return @ptrCast(c.SDL_ConvertSurface(@ptrCast(surface), @bitCast(format)));
} }
pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface { pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface {
return c.SDL_ConvertSurfaceAndColorspace(surface, @bitCast(format), palette, colorspace, props); return @ptrCast(c.SDL_ConvertSurfaceAndColorspace(@ptrCast(surface), @bitCast(format), @ptrCast(palette), colorspace, props));
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return @bitCast(c.SDL_PremultiplySurfaceAlpha(surface, @bitCast(linear))); return @bitCast(c.SDL_PremultiplySurfaceAlpha(@ptrCast(surface), @bitCast(linear)));
} }
pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_ClearSurface(surface, r, g, b, a)); return @bitCast(c.SDL_ClearSurface(@ptrCast(surface), r, g, b, a));
} }
pub inline fn fillSurfaceRect(surface: *Surface, rect: *const Rect, color: u32) bool { pub inline fn fillSurfaceRect(surface: *Surface, rect: ?*const Rect, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color)); return @bitCast(c.SDL_FillSurfaceRect(@ptrCast(surface), @ptrCast(rect), color));
} }
pub inline fn fillSurfaceRects(surface: *Surface, rects: *const Rect, count: c_int, color: u32) bool { pub inline fn fillSurfaceRects(surface: *Surface, rects: ?*const Rect, count: c_int, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color)); return @bitCast(c.SDL_FillSurfaceRects(@ptrCast(surface), @ptrCast(rects), count, color));
} }
pub inline fn blitSurface(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceUnchecked(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: *const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: ?*const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(@ptrCast(surface), @ptrCast(srcrect), scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurface9Grid(surface: *Surface, srcrect: *const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface9Grid(surface: *Surface, srcrect: ?*const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface9Grid(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface9Grid(@ptrCast(surface), @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 { pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapSurfaceRGB(surface, r, g, b); return c.SDL_MapSurfaceRGB(@ptrCast(surface), r, g, b);
} }
pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapSurfaceRGBA(surface, r, g, b, a); return c.SDL_MapSurfaceRGBA(@ptrCast(surface), r, g, b, a);
} }
pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool { pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_ReadSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool { pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_ReadSurfacePixelFloat(@ptrCast(surface), x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool { pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixelFloat(@ptrCast(surface), x, y, r, g, b, a));
} }
}; };
pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface { pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface {
return c.SDL_CreateSurface(width, height, @bitCast(format)); return @ptrCast(c.SDL_CreateSurface(width, height, @bitCast(format)));
} }
pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface { pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface {
return c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch); return @ptrCast(c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch));
} }
pub inline fn loadBMP(file: [*c]const u8) ?*Surface { pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
return c.SDL_LoadBMP(file); return @ptrCast(c.SDL_LoadBMP(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 { 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 {

View File

@ -5,7 +5,7 @@ pub const DisplayID = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool { pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool {
return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam)); return @bitCast(c.SDL_SetiOSAnimationCallback(@ptrCast(window), interval, callback, callbackParam));
} }
}; };

View File

@ -27,19 +27,19 @@ pub const TimeFormat = enum(c_int) {
}; };
pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool { pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool {
return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat))); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@ptrCast(dateFormat), @ptrCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return @bitCast(c.SDL_GetCurrentTime(ticks)); return @bitCast(c.SDL_GetCurrentTime(@ptrCast(ticks)));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime))); return @bitCast(c.SDL_TimeToDateTime(ticks, @ptrCast(dt), @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: ?*const DateTime, ticks: ?*Time) bool {
return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), ticks)); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), @ptrCast(ticks)));
} }
pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void { pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void {

View File

@ -19,7 +19,7 @@ pub const Finger = extern struct {
}; };
pub inline fn getTouchDevices(count: *c_int) ?*TouchID { pub inline fn getTouchDevices(count: *c_int) ?*TouchID {
return c.SDL_GetTouchDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetTouchDevices(@ptrCast(count)));
} }
pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 { pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 {
@ -30,7 +30,7 @@ pub inline fn getTouchDeviceType(touchID: TouchID) TouchDeviceType {
return @intFromEnum(c.SDL_GetTouchDeviceType(touchID)); return @intFromEnum(c.SDL_GetTouchDeviceType(touchID));
} }
pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c][*c]Finger { pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c]?*Finger {
return c.SDL_GetTouchFingers(touchID, @ptrCast(count)); return c.SDL_GetTouchFingers(touchID, @ptrCast(count));
} }

View File

@ -65,267 +65,267 @@ pub const DisplayOrientation = enum(c_int) {
pub const Window = opaque { pub const Window = opaque {
pub inline fn getDisplayForWindow(window: *Window) DisplayID { pub inline fn getDisplayForWindow(window: *Window) DisplayID {
return c.SDL_GetDisplayForWindow(window); return c.SDL_GetDisplayForWindow(@ptrCast(window));
} }
pub inline fn getWindowPixelDensity(window: *Window) f32 { pub inline fn getWindowPixelDensity(window: *Window) f32 {
return c.SDL_GetWindowPixelDensity(window); return c.SDL_GetWindowPixelDensity(@ptrCast(window));
} }
pub inline fn getWindowDisplayScale(window: *Window) f32 { pub inline fn getWindowDisplayScale(window: *Window) f32 {
return c.SDL_GetWindowDisplayScale(window); return c.SDL_GetWindowDisplayScale(@ptrCast(window));
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: ?*const DisplayMode) bool {
return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode))); return @bitCast(c.SDL_SetWindowFullscreenMode(@ptrCast(window), @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) ?*const DisplayMode {
return @ptrCast(c.SDL_GetWindowFullscreenMode(window)); return @ptrCast(c.SDL_GetWindowFullscreenMode(@ptrCast(window)));
} }
pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque { pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque {
return c.SDL_GetWindowICCProfile(window, @ptrCast(size)); return c.SDL_GetWindowICCProfile(@ptrCast(window), @ptrCast(size));
} }
pub inline fn getWindowPixelFormat(window: *Window) PixelFormat { pub inline fn getWindowPixelFormat(window: *Window) PixelFormat {
return @bitCast(c.SDL_GetWindowPixelFormat(window)); return @bitCast(c.SDL_GetWindowPixelFormat(@ptrCast(window)));
} }
pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreatePopupWindow(window, offset_x, offset_y, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreatePopupWindow(@ptrCast(window), offset_x, offset_y, w, h, @bitCast(flags)));
} }
pub inline fn getWindowID(window: *Window) WindowID { pub inline fn getWindowID(window: *Window) WindowID {
return c.SDL_GetWindowID(window); return c.SDL_GetWindowID(@ptrCast(window));
} }
pub inline fn getWindowParent(window: *Window) ?*Window { pub inline fn getWindowParent(window: *Window) ?*Window {
return c.SDL_GetWindowParent(window); return @ptrCast(c.SDL_GetWindowParent(@ptrCast(window)));
} }
pub inline fn getWindowProperties(window: *Window) PropertiesID { pub inline fn getWindowProperties(window: *Window) PropertiesID {
return c.SDL_GetWindowProperties(window); return c.SDL_GetWindowProperties(@ptrCast(window));
} }
pub inline fn getWindowFlags(window: *Window) WindowFlags { pub inline fn getWindowFlags(window: *Window) WindowFlags {
return @bitCast(c.SDL_GetWindowFlags(window)); return @bitCast(c.SDL_GetWindowFlags(@ptrCast(window)));
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return @bitCast(c.SDL_SetWindowTitle(window, title)); return @bitCast(c.SDL_SetWindowTitle(@ptrCast(window), title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
return c.SDL_GetWindowTitle(window); return c.SDL_GetWindowTitle(@ptrCast(window));
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowIcon(window, icon)); return @bitCast(c.SDL_SetWindowIcon(@ptrCast(window), @ptrCast(icon)));
} }
pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool { pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_SetWindowPosition(window, x, y)); return @bitCast(c.SDL_SetWindowPosition(@ptrCast(window), x, y));
} }
pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool { pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool {
return @bitCast(c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y))); return @bitCast(c.SDL_GetWindowPosition(@ptrCast(window), @ptrCast(x), @ptrCast(y)));
} }
pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool { pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool {
return @bitCast(c.SDL_SetWindowSize(window, w, h)); return @bitCast(c.SDL_SetWindowSize(@ptrCast(window), w, h));
} }
pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetWindowSafeArea(window, rect)); return @bitCast(c.SDL_GetWindowSafeArea(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool { pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool {
return @bitCast(c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect)); return @bitCast(c.SDL_SetWindowAspectRatio(@ptrCast(window), min_aspect, max_aspect));
} }
pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool { pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool {
return @bitCast(c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect))); return @bitCast(c.SDL_GetWindowAspectRatio(@ptrCast(window), @ptrCast(min_aspect), @ptrCast(max_aspect)));
} }
pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool { pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool {
return @bitCast(c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right))); return @bitCast(c.SDL_GetWindowBordersSize(@ptrCast(window), @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)));
} }
pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSizeInPixels(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool { pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMinimumSize(window, min_w, min_h)); return @bitCast(c.SDL_SetWindowMinimumSize(@ptrCast(window), min_w, min_h));
} }
pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMinimumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool { pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMaximumSize(window, max_w, max_h)); return @bitCast(c.SDL_SetWindowMaximumSize(@ptrCast(window), max_w, max_h));
} }
pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMaximumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered))); return @bitCast(c.SDL_SetWindowBordered(@ptrCast(window), @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable))); return @bitCast(c.SDL_SetWindowResizable(@ptrCast(window), @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top))); return @bitCast(c.SDL_SetWindowAlwaysOnTop(@ptrCast(window), @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return @bitCast(c.SDL_ShowWindow(window)); return @bitCast(c.SDL_ShowWindow(@ptrCast(window)));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return @bitCast(c.SDL_HideWindow(window)); return @bitCast(c.SDL_HideWindow(@ptrCast(window)));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return @bitCast(c.SDL_RaiseWindow(window)); return @bitCast(c.SDL_RaiseWindow(@ptrCast(window)));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MaximizeWindow(window)); return @bitCast(c.SDL_MaximizeWindow(@ptrCast(window)));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MinimizeWindow(window)); return @bitCast(c.SDL_MinimizeWindow(@ptrCast(window)));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return @bitCast(c.SDL_RestoreWindow(window)); return @bitCast(c.SDL_RestoreWindow(@ptrCast(window)));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen))); return @bitCast(c.SDL_SetWindowFullscreen(@ptrCast(window), @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return @bitCast(c.SDL_SyncWindow(window)); return @bitCast(c.SDL_SyncWindow(@ptrCast(window)));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return @bitCast(c.SDL_WindowHasSurface(window)); return @bitCast(c.SDL_WindowHasSurface(@ptrCast(window)));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
return c.SDL_GetWindowSurface(window); return @ptrCast(c.SDL_GetWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync)); return @bitCast(c.SDL_SetWindowSurfaceVSync(@ptrCast(window), vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync))); return @bitCast(c.SDL_GetWindowSurfaceVSync(@ptrCast(window), @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_UpdateWindowSurface(window)); return @bitCast(c.SDL_UpdateWindowSurface(@ptrCast(window)));
} }
pub inline fn updateWindowSurfaceRects(window: *Window, rects: *const Rect, numrects: c_int) bool { pub inline fn updateWindowSurfaceRects(window: *Window, rects: ?*const Rect, numrects: c_int) bool {
return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects)); return @bitCast(c.SDL_UpdateWindowSurfaceRects(@ptrCast(window), @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_DestroyWindowSurface(window)); return @bitCast(c.SDL_DestroyWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowKeyboardGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowMouseGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowKeyboardGrab(window)); return @bitCast(c.SDL_GetWindowKeyboardGrab(@ptrCast(window)));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowMouseGrab(window)); return @bitCast(c.SDL_GetWindowMouseGrab(@ptrCast(window)));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect))); return @bitCast(c.SDL_SetWindowMouseRect(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) ?*const Rect {
return @ptrCast(c.SDL_GetWindowMouseRect(window)); return @ptrCast(c.SDL_GetWindowMouseRect(@ptrCast(window)));
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return @bitCast(c.SDL_SetWindowOpacity(window, opacity)); return @bitCast(c.SDL_SetWindowOpacity(@ptrCast(window), opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
return c.SDL_GetWindowOpacity(window); return c.SDL_GetWindowOpacity(@ptrCast(window));
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return @bitCast(c.SDL_SetWindowParent(window, parent)); return @bitCast(c.SDL_SetWindowParent(@ptrCast(window), @ptrCast(parent)));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal))); return @bitCast(c.SDL_SetWindowModal(@ptrCast(window), @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return @bitCast(c.SDL_SetWindowFocusable(window, @bitCast(focusable))); return @bitCast(c.SDL_SetWindowFocusable(@ptrCast(window), @bitCast(focusable)));
} }
pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool { pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_ShowWindowSystemMenu(window, x, y)); return @bitCast(c.SDL_ShowWindowSystemMenu(@ptrCast(window), x, y));
} }
pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool { pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool {
return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data)); return @bitCast(c.SDL_SetWindowHitTest(@ptrCast(window), callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowShape(window, shape)); return @bitCast(c.SDL_SetWindowShape(@ptrCast(window), @ptrCast(shape)));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation))); return @bitCast(c.SDL_FlashWindow(@ptrCast(window), @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
return c.SDL_DestroyWindow(window); return c.SDL_DestroyWindow(@ptrCast(window));
} }
pub inline fn gl_CreateContext(window: *Window) GLContext { pub inline fn gl_CreateContext(window: *Window) GLContext {
return c.SDL_GL_CreateContext(window); return c.SDL_GL_CreateContext(@ptrCast(window));
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return @bitCast(c.SDL_GL_MakeCurrent(window, context)); return @bitCast(c.SDL_GL_MakeCurrent(@ptrCast(window), context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
return c.SDL_EGL_GetWindowSurface(window); return c.SDL_EGL_GetWindowSurface(@ptrCast(window));
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return @bitCast(c.SDL_GL_SwapWindow(window)); return @bitCast(c.SDL_GL_SwapWindow(@ptrCast(window)));
} }
}; };
@ -357,6 +357,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const FlashOperation = enum(c_int) { pub const FlashOperation = enum(c_int) {
@ -437,7 +439,7 @@ pub inline fn getSystemTheme() SystemTheme {
} }
pub inline fn getDisplays(count: *c_int) ?*DisplayID { pub inline fn getDisplays(count: *c_int) ?*DisplayID {
return c.SDL_GetDisplays(@ptrCast(count)); return @ptrCast(c.SDL_GetDisplays(@ptrCast(count)));
} }
pub inline fn getPrimaryDisplay() DisplayID { pub inline fn getPrimaryDisplay() DisplayID {
@ -453,11 +455,11 @@ pub inline fn getDisplayName(displayID: DisplayID) [*c]const u8 {
} }
pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -472,48 +474,48 @@ pub inline fn getDisplayContentScale(displayID: DisplayID) f32 {
return c.SDL_GetDisplayContentScale(displayID); return c.SDL_GetDisplayContentScale(displayID);
} }
pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c][*c]DisplayMode { pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c]?*DisplayMode {
return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count))); return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count)));
} }
pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, mode: ?*DisplayMode) bool { pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, mode: ?*DisplayMode) bool {
return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(mode))); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @ptrCast(mode)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID)); return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID));
} }
pub inline fn getCurrentDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getCurrentDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID)); return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID));
} }
pub inline fn getDisplayForPoint(point: *const Point) DisplayID { pub inline fn getDisplayForPoint(point: ?*const Point) DisplayID {
return c.SDL_GetDisplayForPoint(@ptrCast(point)); return c.SDL_GetDisplayForPoint(@ptrCast(point));
} }
pub inline fn getDisplayForRect(rect: *const Rect) DisplayID { pub inline fn getDisplayForRect(rect: ?*const Rect) DisplayID {
return c.SDL_GetDisplayForRect(@ptrCast(rect)); return c.SDL_GetDisplayForRect(@ptrCast(rect));
} }
pub inline fn getWindows(count: *c_int) [*c][*c]Window { pub inline fn getWindows(count: *c_int) [*c]?*Window {
return c.SDL_GetWindows(@ptrCast(count)); return c.SDL_GetWindows(@ptrCast(count));
} }
pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreateWindow(title, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreateWindow(title, w, h, @bitCast(flags)));
} }
pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window { pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window {
return c.SDL_CreateWindowWithProperties(props); return @ptrCast(c.SDL_CreateWindowWithProperties(props));
} }
pub inline fn getWindowFromID(id: WindowID) ?*Window { pub inline fn getWindowFromID(id: WindowID) ?*Window {
return c.SDL_GetWindowFromID(id); return @ptrCast(c.SDL_GetWindowFromID(id));
} }
pub inline fn getGrabbedWindow() ?*Window { pub inline fn getGrabbedWindow() ?*Window {
return c.SDL_GetGrabbedWindow(); return @ptrCast(c.SDL_GetGrabbedWindow());
} }
pub const HitTestResult = enum(c_int) { pub const HitTestResult = enum(c_int) {
@ -576,7 +578,7 @@ pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
return c.SDL_GL_GetCurrentWindow(); return @ptrCast(c.SDL_GL_GetCurrentWindow());
} }
pub inline fn gl_GetCurrentContext() GLContext { pub inline fn gl_GetCurrentContext() GLContext {

View File

@ -19,7 +19,7 @@ pub const Finger = extern struct {
}; };
pub inline fn getTouchDevices(count: *c_int) ?*TouchID { pub inline fn getTouchDevices(count: *c_int) ?*TouchID {
return c.SDL_GetTouchDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetTouchDevices(@ptrCast(count)));
} }
pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 { pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 {
@ -30,7 +30,7 @@ pub inline fn getTouchDeviceType(touchID: TouchID) TouchDeviceType {
return @intFromEnum(c.SDL_GetTouchDeviceType(touchID)); return @intFromEnum(c.SDL_GetTouchDeviceType(touchID));
} }
pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c][*c]Finger { pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c]?*Finger {
return c.SDL_GetTouchFingers(touchID, @ptrCast(count)); return c.SDL_GetTouchFingers(touchID, @ptrCast(count));
} }

View File

@ -41,12 +41,7 @@
"name": "SDL_GPUFence" "name": "SDL_GPUFence"
} }
], ],
"typedefs": [ "typedefs": [],
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32"
}
],
"function_pointers": [], "function_pointers": [],
"c_type_aliases": [], "c_type_aliases": [],
"enums": [ "enums": [
@ -2295,6 +2290,42 @@
} }
] ]
}, },
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_GPU_SHADERFORMAT_PRIVATE",
"value": "(1u << 0)",
"comment": "Shaders for NDA'd platforms."
},
{
"name": "SDL_GPU_SHADERFORMAT_SPIRV",
"value": "(1u << 1)",
"comment": "SPIR-V shaders for Vulkan."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXBC",
"value": "(1u << 2)",
"comment": "DXBC SM5_0 shaders for D3D11."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXIL",
"value": "(1u << 3)",
"comment": "DXIL shaders for D3D12."
},
{
"name": "SDL_GPU_SHADERFORMAT_MSL",
"value": "(1u << 4)",
"comment": "MSL shaders for Metal."
},
{
"name": "SDL_GPU_SHADERFORMAT_METALLIB",
"value": "(1u << 5)",
"comment": "Precompiled metallib shaders for Metal."
}
]
},
{ {
"name": "SDL_GPUColorComponentFlags", "name": "SDL_GPUColorComponentFlags",
"underlying_type": "Uint8", "underlying_type": "Uint8",

View File

@ -45,40 +45,40 @@
"values": [ "values": [
{ {
"name": "SDL_INIT_AUDIO", "name": "SDL_INIT_AUDIO",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_VIDEO", "name": "SDL_INIT_VIDEO",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_JOYSTICK", "name": "SDL_INIT_JOYSTICK",
"value": "0x00000200u", "value": "(1u << 9)",
"comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD" "comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD"
}, },
{ {
"name": "SDL_INIT_HAPTIC", "name": "SDL_INIT_HAPTIC",
"value": "0x00001000u" "value": "(1u << 12)"
}, },
{ {
"name": "SDL_INIT_GAMEPAD", "name": "SDL_INIT_GAMEPAD",
"value": "0x00002000u", "value": "(1u << 13)",
"comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`" "comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`"
}, },
{ {
"name": "SDL_INIT_EVENTS", "name": "SDL_INIT_EVENTS",
"value": "0x00004000u" "value": "(1u << 14)"
}, },
{ {
"name": "SDL_INIT_SENSOR", "name": "SDL_INIT_SENSOR",
"value": "0x00008000u", "value": "(1u << 15)",
"comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_CAMERA", "name": "SDL_INIT_CAMERA",
"value": "0x00010000u", "value": "(1u << 16)",
"comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`"
} }
] ]

View File

@ -122,27 +122,27 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_ERROR", "name": "SDL_MESSAGEBOX_ERROR",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "error dialog" "comment": "error dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_WARNING", "name": "SDL_MESSAGEBOX_WARNING",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "warning dialog" "comment": "warning dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_INFORMATION", "name": "SDL_MESSAGEBOX_INFORMATION",
"value": "0x00000040u", "value": "(1u << 6)",
"comment": "informational dialog" "comment": "informational dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT", "name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT",
"value": "0x00000080u", "value": "(1u << 7)",
"comment": "buttons placed left to right" "comment": "buttons placed left to right"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT", "name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT",
"value": "0x00000100u", "value": "(1u << 8)",
"comment": "buttons placed right to left" "comment": "buttons placed right to left"
} }
] ]
@ -153,12 +153,12 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Marks the default button when return is hit" "comment": "Marks the default button when return is hit"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Marks the default button when escape is hit" "comment": "Marks the default button when escape is hit"
} }
] ]

View File

@ -125,23 +125,15 @@
"values": [ "values": [
{ {
"name": "SDL_BUTTON_LEFT", "name": "SDL_BUTTON_LEFT",
"value": "1" "value": "(1u << 0)"
}, },
{ {
"name": "SDL_BUTTON_MIDDLE", "name": "SDL_BUTTON_MIDDLE",
"value": "2" "value": "(1u << 1)"
},
{
"name": "SDL_BUTTON_RIGHT",
"value": "3"
}, },
{ {
"name": "SDL_BUTTON_X1", "name": "SDL_BUTTON_X1",
"value": "4" "value": "(1u << 2)"
},
{
"name": "SDL_BUTTON_X2",
"value": "5"
} }
] ]
} }

View File

@ -49,22 +49,22 @@
"values": [ "values": [
{ {
"name": "SDL_SURFACE_PREALLOCATED", "name": "SDL_SURFACE_PREALLOCATED",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Surface uses preallocated pixel memory" "comment": "Surface uses preallocated pixel memory"
}, },
{ {
"name": "SDL_SURFACE_LOCK_NEEDED", "name": "SDL_SURFACE_LOCK_NEEDED",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Surface needs to be locked to access pixels" "comment": "Surface needs to be locked to access pixels"
}, },
{ {
"name": "SDL_SURFACE_LOCKED", "name": "SDL_SURFACE_LOCKED",
"value": "0x00000004u", "value": "(1u << 2)",
"comment": "Surface is currently locked" "comment": "Surface is currently locked"
}, },
{ {
"name": "SDL_SURFACE_SIMD_ALIGNED", "name": "SDL_SURFACE_SIMD_ALIGNED",
"value": "0x00000008u", "value": "(1u << 3)",
"comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()" "comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()"
} }
] ]

View File

@ -349,127 +349,127 @@
"values": [ "values": [
{ {
"name": "SDL_WINDOW_FULLSCREEN", "name": "SDL_WINDOW_FULLSCREEN",
"value": "SDL_UINT64_C(0x0000000000000001)", "value": "(1u << 0)",
"comment": "window is in fullscreen mode" "comment": "window is in fullscreen mode"
}, },
{ {
"name": "SDL_WINDOW_OPENGL", "name": "SDL_WINDOW_OPENGL",
"value": "SDL_UINT64_C(0x0000000000000002)", "value": "(1u << 1)",
"comment": "window usable with OpenGL context" "comment": "window usable with OpenGL context"
}, },
{ {
"name": "SDL_WINDOW_OCCLUDED", "name": "SDL_WINDOW_OCCLUDED",
"value": "SDL_UINT64_C(0x0000000000000004)", "value": "(1u << 2)",
"comment": "window is occluded" "comment": "window is occluded"
}, },
{ {
"name": "SDL_WINDOW_HIDDEN", "name": "SDL_WINDOW_HIDDEN",
"value": "SDL_UINT64_C(0x0000000000000008)", "value": "(1u << 3)",
"comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible" "comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible"
}, },
{ {
"name": "SDL_WINDOW_BORDERLESS", "name": "SDL_WINDOW_BORDERLESS",
"value": "SDL_UINT64_C(0x0000000000000010)", "value": "(1u << 4)",
"comment": "no window decoration" "comment": "no window decoration"
}, },
{ {
"name": "SDL_WINDOW_RESIZABLE", "name": "SDL_WINDOW_RESIZABLE",
"value": "SDL_UINT64_C(0x0000000000000020)", "value": "(1u << 5)",
"comment": "window can be resized" "comment": "window can be resized"
}, },
{ {
"name": "SDL_WINDOW_MINIMIZED", "name": "SDL_WINDOW_MINIMIZED",
"value": "SDL_UINT64_C(0x0000000000000040)", "value": "(1u << 6)",
"comment": "window is minimized" "comment": "window is minimized"
}, },
{ {
"name": "SDL_WINDOW_MAXIMIZED", "name": "SDL_WINDOW_MAXIMIZED",
"value": "SDL_UINT64_C(0x0000000000000080)", "value": "(1u << 7)",
"comment": "window is maximized" "comment": "window is maximized"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_GRABBED", "name": "SDL_WINDOW_MOUSE_GRABBED",
"value": "SDL_UINT64_C(0x0000000000000100)", "value": "(1u << 8)",
"comment": "window has grabbed mouse input" "comment": "window has grabbed mouse input"
}, },
{ {
"name": "SDL_WINDOW_INPUT_FOCUS", "name": "SDL_WINDOW_INPUT_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000200)", "value": "(1u << 9)",
"comment": "window has input focus" "comment": "window has input focus"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_FOCUS", "name": "SDL_WINDOW_MOUSE_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000400)", "value": "(1u << 10)",
"comment": "window has mouse focus" "comment": "window has mouse focus"
}, },
{ {
"name": "SDL_WINDOW_EXTERNAL", "name": "SDL_WINDOW_EXTERNAL",
"value": "SDL_UINT64_C(0x0000000000000800)", "value": "(1u << 11)",
"comment": "window not created by SDL" "comment": "window not created by SDL"
}, },
{ {
"name": "SDL_WINDOW_MODAL", "name": "SDL_WINDOW_MODAL",
"value": "SDL_UINT64_C(0x0000000000001000)", "value": "(1u << 12)",
"comment": "window is modal" "comment": "window is modal"
}, },
{ {
"name": "SDL_WINDOW_HIGH_PIXEL_DENSITY", "name": "SDL_WINDOW_HIGH_PIXEL_DENSITY",
"value": "SDL_UINT64_C(0x0000000000002000)", "value": "(1u << 13)",
"comment": "window uses high pixel density back buffer if possible" "comment": "window uses high pixel density back buffer if possible"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_CAPTURE", "name": "SDL_WINDOW_MOUSE_CAPTURE",
"value": "SDL_UINT64_C(0x0000000000004000)", "value": "(1u << 14)",
"comment": "window has mouse captured (unrelated to MOUSE_GRABBED)" "comment": "window has mouse captured (unrelated to MOUSE_GRABBED)"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_RELATIVE_MODE", "name": "SDL_WINDOW_MOUSE_RELATIVE_MODE",
"value": "SDL_UINT64_C(0x0000000000008000)", "value": "(1u << 15)",
"comment": "window has relative mode enabled" "comment": "window has relative mode enabled"
}, },
{ {
"name": "SDL_WINDOW_ALWAYS_ON_TOP", "name": "SDL_WINDOW_ALWAYS_ON_TOP",
"value": "SDL_UINT64_C(0x0000000000010000)", "value": "(1u << 16)",
"comment": "window should always be above others" "comment": "window should always be above others"
}, },
{ {
"name": "SDL_WINDOW_UTILITY", "name": "SDL_WINDOW_UTILITY",
"value": "SDL_UINT64_C(0x0000000000020000)", "value": "(1u << 17)",
"comment": "window should be treated as a utility window, not showing in the task bar and window list" "comment": "window should be treated as a utility window, not showing in the task bar and window list"
}, },
{ {
"name": "SDL_WINDOW_TOOLTIP", "name": "SDL_WINDOW_TOOLTIP",
"value": "SDL_UINT64_C(0x0000000000040000)", "value": "(1u << 18)",
"comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window" "comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_POPUP_MENU", "name": "SDL_WINDOW_POPUP_MENU",
"value": "SDL_UINT64_C(0x0000000000080000)", "value": "(1u << 19)",
"comment": "window should be treated as a popup menu, requires a parent window" "comment": "window should be treated as a popup menu, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_KEYBOARD_GRABBED", "name": "SDL_WINDOW_KEYBOARD_GRABBED",
"value": "SDL_UINT64_C(0x0000000000100000)", "value": "(1u << 20)",
"comment": "window has grabbed keyboard input" "comment": "window has grabbed keyboard input"
}, },
{ {
"name": "SDL_WINDOW_VULKAN", "name": "SDL_WINDOW_VULKAN",
"value": "SDL_UINT64_C(0x0000000010000000)", "value": "(1u << 28)",
"comment": "window usable for Vulkan surface" "comment": "window usable for Vulkan surface"
}, },
{ {
"name": "SDL_WINDOW_METAL", "name": "SDL_WINDOW_METAL",
"value": "SDL_UINT64_C(0x0000000020000000)", "value": "(1u << 29)",
"comment": "window usable for Metal view" "comment": "window usable for Metal view"
}, },
{ {
"name": "SDL_WINDOW_TRANSPARENT", "name": "SDL_WINDOW_TRANSPARENT",
"value": "SDL_UINT64_C(0x0000000040000000)", "value": "(1u << 30)",
"comment": "window with transparent buffer" "comment": "window with transparent buffer"
}, },
{ {
"name": "SDL_WINDOW_NOT_FOCUSABLE", "name": "SDL_WINDOW_NOT_FOCUSABLE",
"value": "SDL_UINT64_C(0x0000000080000000)", "value": "(1u << 31)",
"comment": "window should not be focusable" "comment": "window should not be focusable"
} }
] ]

View File

@ -5,7 +5,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, 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 @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV_IO(@ptrCast(iostream), @bitCast(closeio), @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -31,107 +31,107 @@ pub const AudioSpec = extern struct {
pub const AudioStream = opaque { pub const AudioStream = opaque {
pub inline fn unbindAudioStream(audiostream: *AudioStream) void { pub inline fn unbindAudioStream(audiostream: *AudioStream) void {
return c.SDL_UnbindAudioStream(audiostream); return c.SDL_UnbindAudioStream(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID { pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID {
return c.SDL_GetAudioStreamDevice(audiostream); return c.SDL_GetAudioStreamDevice(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID { pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID {
return c.SDL_GetAudioStreamProperties(audiostream); return c.SDL_GetAudioStreamProperties(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool { pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool {
return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec)); return @bitCast(c.SDL_GetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: *const AudioSpec, dst_spec: *const AudioSpec) bool { pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) bool {
return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec))); return @bitCast(c.SDL_SetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamFrequencyRatio(audiostream); return c.SDL_GetAudioStreamFrequencyRatio(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio)); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(@ptrCast(audiostream), ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamGain(audiostream); return c.SDL_GetAudioStreamGain(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain)); return @bitCast(c.SDL_SetAudioStreamGain(@ptrCast(audiostream), gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool { pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool {
return @bitCast(c.SDL_PutAudioStreamData(audiostream, buf, len)); return @bitCast(c.SDL_PutAudioStreamData(@ptrCast(audiostream), buf, len));
} }
pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int { pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int {
return c.SDL_GetAudioStreamData(audiostream, buf, len); return c.SDL_GetAudioStreamData(@ptrCast(audiostream), buf, len);
} }
pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamAvailable(audiostream); return c.SDL_GetAudioStreamAvailable(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamQueued(audiostream); return c.SDL_GetAudioStreamQueued(@ptrCast(audiostream));
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_FlushAudioStream(audiostream)); return @bitCast(c.SDL_FlushAudioStream(@ptrCast(audiostream)));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ClearAudioStream(audiostream)); return @bitCast(c.SDL_ClearAudioStream(@ptrCast(audiostream)));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream)); return @bitCast(c.SDL_PauseAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream)); return @bitCast(c.SDL_ResumeAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_LockAudioStream(audiostream)); return @bitCast(c.SDL_LockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_UnlockAudioStream(audiostream)); return @bitCast(c.SDL_UnlockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamGetCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamPutCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
return c.SDL_DestroyAudioStream(audiostream); return c.SDL_DestroyAudioStream(@ptrCast(audiostream));
} }
}; };
@ -148,11 +148,11 @@ pub inline fn getCurrentAudioDriver() [*c]const u8 {
} }
pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioPlaybackDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioPlaybackDevices(@ptrCast(count)));
} }
pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioRecordingDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioRecordingDevices(@ptrCast(count)));
} }
pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 { pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
@ -160,14 +160,14 @@ pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
} }
pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool { pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool {
return @bitCast(c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames))); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, @ptrCast(spec), @ptrCast(sample_frames)));
} }
pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int { pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count)));
} }
pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) AudioDeviceID { pub inline fn openAudioDevice(devid: AudioDeviceID, spec: ?*const AudioSpec) AudioDeviceID {
return c.SDL_OpenAudioDevice(devid, @ptrCast(spec)); return c.SDL_OpenAudioDevice(devid, @ptrCast(spec));
} }
@ -203,26 +203,26 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
return c.SDL_CloseAudioDevice(devid); return c.SDL_CloseAudioDevice(devid);
} }
pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]*const AudioStream, num_streams: c_int) bool { pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]?*const AudioStream, num_streams: c_int) bool {
return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams)); return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams));
} }
pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool { pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool {
return @bitCast(c.SDL_BindAudioStream(devid, stream)); return @bitCast(c.SDL_BindAudioStream(devid, @ptrCast(stream)));
} }
pub inline fn unbindAudioStreams(streams: [*c]*const AudioStream, num_streams: c_int) void { pub inline fn unbindAudioStreams(streams: [*c]?*const AudioStream, num_streams: c_int) void {
return c.SDL_UnbindAudioStreams(streams, num_streams); return c.SDL_UnbindAudioStreams(streams, num_streams);
} }
pub inline fn createAudioStream(src_spec: *const AudioSpec, dst_spec: *const AudioSpec) ?*AudioStream { pub inline fn createAudioStream(src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) ?*AudioStream {
return c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)); return @ptrCast(c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub const AudioStreamCallback = c.SDL_AudioStreamCallback; pub const AudioStreamCallback = c.SDL_AudioStreamCallback;
pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream { pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: ?*const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream {
return c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata); return @ptrCast(c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata));
} }
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
@ -232,14 +232,14 @@ pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostm
} }
pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool {
return @bitCast(c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV(path, @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool { pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool {
return @bitCast(c.SDL_MixAudio(dst, src, @bitCast(format), len, volume)); return @bitCast(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: [*c][*c]u8, 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 @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len))); return @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len)));
} }

View File

@ -51,31 +51,31 @@ pub const CameraID = u32;
pub const Camera = opaque { pub const Camera = opaque {
pub inline fn getCameraPermissionState(camera: *Camera) c_int { pub inline fn getCameraPermissionState(camera: *Camera) c_int {
return c.SDL_GetCameraPermissionState(camera); return c.SDL_GetCameraPermissionState(@ptrCast(camera));
} }
pub inline fn getCameraID(camera: *Camera) CameraID { pub inline fn getCameraID(camera: *Camera) CameraID {
return c.SDL_GetCameraID(camera); return c.SDL_GetCameraID(@ptrCast(camera));
} }
pub inline fn getCameraProperties(camera: *Camera) PropertiesID { pub inline fn getCameraProperties(camera: *Camera) PropertiesID {
return c.SDL_GetCameraProperties(camera); return c.SDL_GetCameraProperties(@ptrCast(camera));
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return @bitCast(c.SDL_GetCameraFormat(camera, spec)); return @bitCast(c.SDL_GetCameraFormat(@ptrCast(camera), @ptrCast(spec)));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {
return c.SDL_AcquireCameraFrame(camera, @ptrCast(timestampNS)); return @ptrCast(c.SDL_AcquireCameraFrame(@ptrCast(camera), @ptrCast(timestampNS)));
} }
pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void { pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void {
return c.SDL_ReleaseCameraFrame(camera, frame); return c.SDL_ReleaseCameraFrame(@ptrCast(camera), @ptrCast(frame));
} }
pub inline fn closeCamera(camera: *Camera) void { pub inline fn closeCamera(camera: *Camera) void {
return c.SDL_CloseCamera(camera); return c.SDL_CloseCamera(@ptrCast(camera));
} }
}; };
@ -107,10 +107,10 @@ pub inline fn getCurrentCameraDriver() [*c]const u8 {
} }
pub inline fn getCameras(count: *c_int) ?*CameraID { pub inline fn getCameras(count: *c_int) ?*CameraID {
return c.SDL_GetCameras(@ptrCast(count)); return @ptrCast(c.SDL_GetCameras(@ptrCast(count)));
} }
pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c][*c]CameraSpec { pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c]?*CameraSpec {
return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count)); return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count));
} }
@ -122,6 +122,6 @@ pub inline fn getCameraPosition(instance_id: CameraID) CameraPosition {
return c.SDL_GetCameraPosition(instance_id); return c.SDL_GetCameraPosition(instance_id);
} }
pub inline fn openCamera(instance_id: CameraID, spec: *const CameraSpec) ?*Camera { pub inline fn openCamera(instance_id: CameraID, spec: ?*const CameraSpec) ?*Camera {
return c.SDL_OpenCamera(instance_id, @ptrCast(spec)); return @ptrCast(c.SDL_OpenCamera(instance_id, @ptrCast(spec)));
} }

View File

@ -12,16 +12,16 @@ pub const DialogFileFilter = extern struct {
pub const DialogFileCallback = c.SDL_DialogFileCallback; pub const DialogFileCallback = c.SDL_DialogFileCallback;
pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location, @bitCast(allow_many));
} }
pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void { pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void {
return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location); return c.SDL_ShowSaveFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location);
} }
pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFolderDialog(callback, userdata, @ptrCast(window), default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -1,7 +1,12 @@
const std = @import("std"); const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const PenID = u32; pub const PenID = packed struct(u32) {
pad0: u31 = 0,
rsvd: bool = false,
pub const None = PenID{};
};
pub const WindowID = u32; pub const WindowID = u32;
@ -21,6 +26,8 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const MouseButtonFlags = packed struct(u32) { pub const MouseButtonFlags = packed struct(u32) {
@ -29,6 +36,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const Scancode = enum(c_int) {
@ -694,7 +705,7 @@ pub const EventAction = enum(c_int) {
}; };
pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int { pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int {
return c.SDL_PeepEvents(events, numevents, action, minType, maxType); return c.SDL_PeepEvents(@ptrCast(events), numevents, action, minType, maxType);
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
@ -714,19 +725,19 @@ pub inline fn flushEvents(minType: u32, maxType: u32) void {
} }
pub inline fn pollEvent(event: ?*Event) bool { pub inline fn pollEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PollEvent(event)); return @bitCast(c.SDL_PollEvent(@ptrCast(event)));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return @bitCast(c.SDL_WaitEvent(event)); return @bitCast(c.SDL_WaitEvent(@ptrCast(event)));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS)); return @bitCast(c.SDL_WaitEventTimeout(@ptrCast(event), timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PushEvent(event)); return @bitCast(c.SDL_PushEvent(@ptrCast(event)));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,7 +747,7 @@ pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool { pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool {
return @bitCast(c.SDL_GetEventFilter(filter, userdata)); return @bitCast(c.SDL_GetEventFilter(@ptrCast(filter), userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
@ -763,6 +774,6 @@ pub inline fn registerEvents(numevents: c_int) u32 {
return c.SDL_RegisterEvents(numevents); return c.SDL_RegisterEvents(numevents);
} }
pub inline fn getWindowFromEvent(event: *const Event) ?*Window { pub inline fn getWindowFromEvent(event: ?*const Event) ?*Window {
return c.SDL_GetWindowFromEvent(@ptrCast(event)); return @ptrCast(c.SDL_GetWindowFromEvent(@ptrCast(event)));
} }

View File

@ -49,6 +49,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
@ -80,7 +82,7 @@ pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetPathInfo(path, info)); return @bitCast(c.SDL_GetPathInfo(path, @ptrCast(info)));
} }
pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {

View File

@ -15,7 +15,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int { pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int {
return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio)); return c.SDL_AddGamepadMappingsFromIO(@ptrCast(iostream), @bitCast(closeio));
} }
}; };
@ -45,163 +45,163 @@ pub const Joystick = opaque {};
pub const Gamepad = opaque { pub const Gamepad = opaque {
pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 { pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 {
return c.SDL_GetGamepadMapping(gamepad); return c.SDL_GetGamepadMapping(@ptrCast(gamepad));
} }
pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID { pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID {
return c.SDL_GetGamepadProperties(gamepad); return c.SDL_GetGamepadProperties(@ptrCast(gamepad));
} }
pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID { pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID {
return c.SDL_GetGamepadID(gamepad); return c.SDL_GetGamepadID(@ptrCast(gamepad));
} }
pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadName(gamepad); return c.SDL_GetGamepadName(@ptrCast(gamepad));
} }
pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadPath(gamepad); return c.SDL_GetGamepadPath(@ptrCast(gamepad));
} }
pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetGamepadType(gamepad)); return @intFromEnum(c.SDL_GetGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetRealGamepadType(gamepad)); return @intFromEnum(c.SDL_GetRealGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int { pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int {
return c.SDL_GetGamepadPlayerIndex(gamepad); return c.SDL_GetGamepadPlayerIndex(@ptrCast(gamepad));
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index)); return @bitCast(c.SDL_SetGamepadPlayerIndex(@ptrCast(gamepad), player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadVendor(gamepad); return c.SDL_GetGamepadVendor(@ptrCast(gamepad));
} }
pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 { pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProduct(gamepad); return c.SDL_GetGamepadProduct(@ptrCast(gamepad));
} }
pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProductVersion(gamepad); return c.SDL_GetGamepadProductVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadFirmwareVersion(gamepad); return c.SDL_GetGamepadFirmwareVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadSerial(gamepad); return c.SDL_GetGamepadSerial(@ptrCast(gamepad));
} }
pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 { pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 {
return c.SDL_GetGamepadSteamHandle(gamepad); return c.SDL_GetGamepadSteamHandle(@ptrCast(gamepad));
} }
pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState { pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState {
return c.SDL_GetGamepadConnectionState(gamepad); return c.SDL_GetGamepadConnectionState(@ptrCast(gamepad));
} }
pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState { pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState {
return c.SDL_GetGamepadPowerInfo(gamepad, @ptrCast(percent)); return c.SDL_GetGamepadPowerInfo(@ptrCast(gamepad), @ptrCast(percent));
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return @bitCast(c.SDL_GamepadConnected(gamepad)); return @bitCast(c.SDL_GamepadConnected(@ptrCast(gamepad)));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
return c.SDL_GetGamepadJoystick(gamepad); return @ptrCast(c.SDL_GetGamepadJoystick(@ptrCast(gamepad)));
} }
pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c][*c]GamepadBinding { pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c]?*GamepadBinding {
return c.SDL_GetGamepadBindings(gamepad, @ptrCast(count)); return c.SDL_GetGamepadBindings(@ptrCast(gamepad), @ptrCast(count));
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis)); return @bitCast(c.SDL_GamepadHasAxis(@ptrCast(gamepad), axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
return c.SDL_GetGamepadAxis(gamepad, axis); return c.SDL_GetGamepadAxis(@ptrCast(gamepad), axis);
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GamepadHasButton(gamepad, button)); return @bitCast(c.SDL_GamepadHasButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GetGamepadButton(gamepad, button)); return @bitCast(c.SDL_GetGamepadButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
return c.SDL_GetGamepadButtonLabel(gamepad, button); return c.SDL_GetGamepadButtonLabel(@ptrCast(gamepad), button);
} }
pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int { pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int {
return c.SDL_GetNumGamepadTouchpads(gamepad); return c.SDL_GetNumGamepadTouchpads(@ptrCast(gamepad));
} }
pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int { pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int {
return c.SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad); return c.SDL_GetNumGamepadTouchpadFingers(@ptrCast(gamepad), touchpad);
} }
pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool { pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool {
return @bitCast(c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure))); return @bitCast(c.SDL_GetGamepadTouchpadFinger(@ptrCast(gamepad), touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)));
} }
pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadHasSensor(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool { pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool {
return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled))); return @bitCast(c.SDL_SetGamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(_type)); return c.SDL_GetGamepadSensorDataRate(@ptrCast(gamepad), @intFromEnum(_type));
} }
pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool { pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values)); return @bitCast(c.SDL_GetGamepadSensorData(@ptrCast(gamepad), @intFromEnum(_type), @ptrCast(data), num_values));
} }
pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepad(@ptrCast(gamepad), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepadTriggers(@ptrCast(gamepad), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool { pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetGamepadLED(gamepad, red, green, blue)); return @bitCast(c.SDL_SetGamepadLED(@ptrCast(gamepad), red, green, blue));
} }
pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size)); return @bitCast(c.SDL_SendGamepadEffect(@ptrCast(gamepad), data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
return c.SDL_CloseGamepad(gamepad); return c.SDL_CloseGamepad(@ptrCast(gamepad));
} }
pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button); return c.SDL_GetGamepadAppleSFSymbolsNameForButton(@ptrCast(gamepad), button);
} }
pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis); return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(@ptrCast(gamepad), axis);
} }
}; };
@ -308,7 +308,7 @@ pub inline fn hasGamepad() bool {
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
return c.SDL_GetGamepads(@ptrCast(count)); return @ptrCast(c.SDL_GetGamepads(@ptrCast(count)));
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
@ -356,15 +356,15 @@ pub inline fn getGamepadMappingForID(instance_id: JoystickID) [*c]u8 {
} }
pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad { pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad {
return c.SDL_OpenGamepad(instance_id); return @ptrCast(c.SDL_OpenGamepad(instance_id));
} }
pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad { pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad {
return c.SDL_GetGamepadFromID(instance_id); return @ptrCast(c.SDL_GetGamepadFromID(instance_id));
} }
pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad { pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
return c.SDL_GetGamepadFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetGamepadFromPlayerIndex(player_index));
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {

View File

@ -27,155 +27,155 @@ pub const FlipMode = enum(c_int) {
pub const GPUDevice = opaque { pub const GPUDevice = opaque {
pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void {
return c.SDL_DestroyGPUDevice(gpudevice); return c.SDL_DestroyGPUDevice(@ptrCast(gpudevice));
} }
pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 { pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 {
return c.SDL_GetGPUDeviceDriver(gpudevice); return c.SDL_GetGPUDeviceDriver(@ptrCast(gpudevice));
} }
pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat { pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat {
return @bitCast(c.SDL_GetGPUShaderFormats(gpudevice)); return @bitCast(c.SDL_GetGPUShaderFormats(@ptrCast(gpudevice)));
} }
pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: *const GPUComputePipelineCreateInfo) ?*GPUComputePipeline { pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUComputePipelineCreateInfo) ?*GPUComputePipeline {
return c.SDL_CreateGPUComputePipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: *const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline { pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline {
return c.SDL_CreateGPUGraphicsPipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: *const GPUSamplerCreateInfo) ?*GPUSampler { pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: ?*const GPUSamplerCreateInfo) ?*GPUSampler {
return c.SDL_CreateGPUSampler(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUSampler(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: *const GPUShaderCreateInfo) ?*GPUShader { pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: ?*const GPUShaderCreateInfo) ?*GPUShader {
return c.SDL_CreateGPUShader(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUShader(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: *const GPUTextureCreateInfo) ?*GPUTexture { pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: ?*const GPUTextureCreateInfo) ?*GPUTexture {
return c.SDL_CreateGPUTexture(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTexture(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: *const GPUBufferCreateInfo) ?*GPUBuffer { pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUBufferCreateInfo) ?*GPUBuffer {
return c.SDL_CreateGPUBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: *const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer { pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer {
return c.SDL_CreateGPUTransferBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void { pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void {
return c.SDL_SetGPUBufferName(gpudevice, buffer, text); return c.SDL_SetGPUBufferName(@ptrCast(gpudevice), @ptrCast(buffer), text);
} }
pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void { pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void {
return c.SDL_SetGPUTextureName(gpudevice, texture, text); return c.SDL_SetGPUTextureName(@ptrCast(gpudevice), @ptrCast(texture), text);
} }
pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void { pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void {
return c.SDL_ReleaseGPUTexture(gpudevice, texture); return c.SDL_ReleaseGPUTexture(@ptrCast(gpudevice), @ptrCast(texture));
} }
pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void { pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void {
return c.SDL_ReleaseGPUSampler(gpudevice, sampler); return c.SDL_ReleaseGPUSampler(@ptrCast(gpudevice), @ptrCast(sampler));
} }
pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void { pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void {
return c.SDL_ReleaseGPUBuffer(gpudevice, buffer); return c.SDL_ReleaseGPUBuffer(@ptrCast(gpudevice), @ptrCast(buffer));
} }
pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_ReleaseGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_ReleaseGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_ReleaseGPUComputePipeline(gpudevice, compute_pipeline); return c.SDL_ReleaseGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(compute_pipeline));
} }
pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void { pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void {
return c.SDL_ReleaseGPUShader(gpudevice, shader); return c.SDL_ReleaseGPUShader(@ptrCast(gpudevice), @ptrCast(shader));
} }
pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_ReleaseGPUGraphicsPipeline(gpudevice, graphics_pipeline); return c.SDL_ReleaseGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(graphics_pipeline));
} }
pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer { pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer {
return c.SDL_AcquireGPUCommandBuffer(gpudevice); return @ptrCast(c.SDL_AcquireGPUCommandBuffer(@ptrCast(gpudevice)));
} }
pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque { pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque {
return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle)); return c.SDL_MapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer), @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_UnmapGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_UnmapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool { pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool {
return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition)); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition));
} }
pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool { pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode))); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(@ptrCast(gpudevice), @ptrCast(window), @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window)); return @bitCast(c.SDL_ClaimWindowForGPUDevice(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
return c.SDL_ReleaseWindowFromGPUDevice(gpudevice, window); return c.SDL_ReleaseWindowFromGPUDevice(@ptrCast(gpudevice), @ptrCast(window));
} }
pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool { pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode))); return @bitCast(c.SDL_SetGPUSwapchainParameters(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition, @intFromEnum(present_mode)));
} }
pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool { pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool {
return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight)); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(@ptrCast(gpudevice), allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(gpudevice, window)); return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window)); return @bitCast(c.SDL_WaitForGPUSwapchain(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return @bitCast(c.SDL_WaitForGPUIdle(gpudevice)); return @bitCast(c.SDL_WaitForGPUIdle(@ptrCast(gpudevice)));
} }
pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]*const GPUFence, num_fences: u32) bool { pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]?*const GPUFence, num_fences: u32) bool {
return @bitCast(c.SDL_WaitForGPUFences(gpudevice, @bitCast(wait_all), fences, num_fences)); return @bitCast(c.SDL_WaitForGPUFences(@ptrCast(gpudevice), @bitCast(wait_all), fences, num_fences));
} }
pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool { pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool {
return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence)); return @bitCast(c.SDL_QueryGPUFence(@ptrCast(gpudevice), @ptrCast(fence)));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
return c.SDL_ReleaseGPUFence(gpudevice, fence); return c.SDL_ReleaseGPUFence(@ptrCast(gpudevice), @ptrCast(fence));
} }
pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool { pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool {
return @bitCast(c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage))); return @bitCast(c.SDL_GPUTextureSupportsFormat(@ptrCast(gpudevice), @bitCast(format), @intFromEnum(_type), @bitCast(usage)));
} }
pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool { pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool {
return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count)); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(@ptrCast(gpudevice), @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKSuspendGPU(gpudevice); return c.SDL_GDKSuspendGPU(@ptrCast(gpudevice));
} }
pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void { pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKResumeGPU(gpudevice); return c.SDL_GDKResumeGPU(@ptrCast(gpudevice));
} }
}; };
@ -195,201 +195,201 @@ pub const GPUGraphicsPipeline = opaque {};
pub const GPUCommandBuffer = opaque { pub const GPUCommandBuffer = opaque {
pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void { pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void {
return c.SDL_InsertGPUDebugLabel(gpucommandbuffer, text); return c.SDL_InsertGPUDebugLabel(@ptrCast(gpucommandbuffer), text);
} }
pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void { pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void {
return c.SDL_PushGPUDebugGroup(gpucommandbuffer, name); return c.SDL_PushGPUDebugGroup(@ptrCast(gpucommandbuffer), name);
} }
pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void { pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void {
return c.SDL_PopGPUDebugGroup(gpucommandbuffer); return c.SDL_PopGPUDebugGroup(@ptrCast(gpucommandbuffer));
} }
pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUVertexUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUVertexUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUFragmentUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUFragmentUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUComputeUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUComputeUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: *const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: *const GPUDepthStencilTargetInfo) ?*GPURenderPass { pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: ?*const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: ?*const GPUDepthStencilTargetInfo) ?*GPURenderPass {
return c.SDL_BeginGPURenderPass(gpucommandbuffer, @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)); return @ptrCast(c.SDL_BeginGPURenderPass(@ptrCast(gpucommandbuffer), @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)));
} }
pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: *const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: *const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass { pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: ?*const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: ?*const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass {
return c.SDL_BeginGPUComputePass(gpucommandbuffer, @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings); return @ptrCast(c.SDL_BeginGPUComputePass(@ptrCast(gpucommandbuffer), @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings));
} }
pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass { pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass {
return c.SDL_BeginGPUCopyPass(gpucommandbuffer); return @ptrCast(c.SDL_BeginGPUCopyPass(@ptrCast(gpucommandbuffer)));
} }
pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void { pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void {
return c.SDL_GenerateMipmapsForGPUTexture(gpucommandbuffer, texture); return c.SDL_GenerateMipmapsForGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(texture));
} }
pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: *const GPUBlitInfo) void { pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: ?*const GPUBlitInfo) void {
return c.SDL_BlitGPUTexture(gpucommandbuffer, @ptrCast(info)); return c.SDL_BlitGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(info));
} }
pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_SubmitGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
return c.SDL_SubmitGPUCommandBufferAndAcquireFence(gpucommandbuffer); return @ptrCast(c.SDL_SubmitGPUCommandBufferAndAcquireFence(@ptrCast(gpucommandbuffer)));
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_CancelGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
}; };
pub const GPURenderPass = opaque { pub const GPURenderPass = opaque {
pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_BindGPUGraphicsPipeline(gpurenderpass, graphics_pipeline); return c.SDL_BindGPUGraphicsPipeline(@ptrCast(gpurenderpass), @ptrCast(graphics_pipeline));
} }
pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: *const GPUViewport) void { pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: ?*const GPUViewport) void {
return c.SDL_SetGPUViewport(gpurenderpass, @ptrCast(viewport)); return c.SDL_SetGPUViewport(@ptrCast(gpurenderpass), @ptrCast(viewport));
} }
pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: *const Rect) void { pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: ?*const Rect) void {
return c.SDL_SetGPUScissor(gpurenderpass, @ptrCast(scissor)); return c.SDL_SetGPUScissor(@ptrCast(gpurenderpass), @ptrCast(scissor));
} }
pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void { pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void {
return c.SDL_SetGPUBlendConstants(gpurenderpass, blend_constants); return c.SDL_SetGPUBlendConstants(@ptrCast(gpurenderpass), blend_constants);
} }
pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void { pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void {
return c.SDL_SetGPUStencilReference(gpurenderpass, reference); return c.SDL_SetGPUStencilReference(@ptrCast(gpurenderpass), reference);
} }
pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: *const GPUBufferBinding, num_bindings: u32) void { pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: ?*const GPUBufferBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexBuffers(gpurenderpass, first_slot, @ptrCast(bindings), num_bindings); return c.SDL_BindGPUVertexBuffers(@ptrCast(gpurenderpass), first_slot, @ptrCast(bindings), num_bindings);
} }
pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: *const GPUBufferBinding, index_element_size: GPUIndexElementSize) void { pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: ?*const GPUBufferBinding, index_element_size: GPUIndexElementSize) void {
return c.SDL_BindGPUIndexBuffer(gpurenderpass, @ptrCast(binding), index_element_size); return c.SDL_BindGPUIndexBuffer(@ptrCast(gpurenderpass), @ptrCast(binding), index_element_size);
} }
pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUVertexSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUVertexStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUVertexStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUFragmentSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUFragmentSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUFragmentStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUFragmentStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void { pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void {
return c.SDL_DrawGPUIndexedPrimitives(gpurenderpass, num_indices, num_instances, first_index, vertex_offset, first_instance); return c.SDL_DrawGPUIndexedPrimitives(@ptrCast(gpurenderpass), num_indices, num_instances, first_index, vertex_offset, first_instance);
} }
pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void { pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void {
return c.SDL_DrawGPUPrimitives(gpurenderpass, num_vertices, num_instances, first_vertex, first_instance); return c.SDL_DrawGPUPrimitives(@ptrCast(gpurenderpass), num_vertices, num_instances, first_vertex, first_instance);
} }
pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUIndexedPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUIndexedPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void { pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void {
return c.SDL_EndGPURenderPass(gpurenderpass); return c.SDL_EndGPURenderPass(@ptrCast(gpurenderpass));
} }
}; };
pub const GPUComputePass = opaque { pub const GPUComputePass = opaque {
pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_BindGPUComputePipeline(gpucomputepass, compute_pipeline); return c.SDL_BindGPUComputePipeline(@ptrCast(gpucomputepass), @ptrCast(compute_pipeline));
} }
pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUComputeSamplers(gpucomputepass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUComputeSamplers(@ptrCast(gpucomputepass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageTextures(gpucomputepass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUComputeStorageTextures(@ptrCast(gpucomputepass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageBuffers(gpucomputepass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUComputeStorageBuffers(@ptrCast(gpucomputepass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void { pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void {
return c.SDL_DispatchGPUCompute(gpucomputepass, groupcount_x, groupcount_y, groupcount_z); return c.SDL_DispatchGPUCompute(@ptrCast(gpucomputepass), groupcount_x, groupcount_y, groupcount_z);
} }
pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void { pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void {
return c.SDL_DispatchGPUComputeIndirect(gpucomputepass, buffer, offset); return c.SDL_DispatchGPUComputeIndirect(@ptrCast(gpucomputepass), @ptrCast(buffer), offset);
} }
pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void { pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void {
return c.SDL_EndGPUComputePass(gpucomputepass); return c.SDL_EndGPUComputePass(@ptrCast(gpucomputepass));
} }
}; };
pub const GPUCopyPass = opaque { pub const GPUCopyPass = opaque {
pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureTransferInfo, destination: *const GPUTextureRegion, cycle: bool) void { pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureTransferInfo, destination: ?*const GPUTextureRegion, cycle: bool) void {
return c.SDL_UploadToGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUTransferBufferLocation, destination: *const GPUBufferRegion, cycle: bool) void { pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUTransferBufferLocation, destination: ?*const GPUBufferRegion, cycle: bool) void {
return c.SDL_UploadToGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureLocation, destination: *const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void { pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureLocation, destination: ?*const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void {
return c.SDL_CopyGPUTextureToTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle)); return c.SDL_CopyGPUTextureToTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle));
} }
pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferLocation, destination: *const GPUBufferLocation, size: u32, cycle: bool) void { pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferLocation, destination: ?*const GPUBufferLocation, size: u32, cycle: bool) void {
return c.SDL_CopyGPUBufferToBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle)); return c.SDL_CopyGPUBufferToBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle));
} }
pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureRegion, destination: *const GPUTextureTransferInfo) void { pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureRegion, destination: ?*const GPUTextureTransferInfo) void {
return c.SDL_DownloadFromGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferRegion, destination: *const GPUTransferBufferLocation) void { pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferRegion, destination: ?*const GPUTransferBufferLocation) void {
return c.SDL_DownloadFromGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void { pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void {
return c.SDL_EndGPUCopyPass(gpucopypass); return c.SDL_EndGPUCopyPass(@ptrCast(gpucopypass));
} }
}; };
@ -539,6 +539,8 @@ pub const GPUTextureUsageFlags = packed struct(u32) {
textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUTextureUsageFlags{};
}; };
pub const GPUTextureType = enum(c_int) { pub const GPUTextureType = enum(c_int) {
@ -574,6 +576,8 @@ pub const GPUBufferUsageFlags = packed struct(u32) {
bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage. bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage.
pad0: u25 = 0, pad0: u25 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUBufferUsageFlags{};
}; };
pub const GPUTransferBufferUsage = enum(c_int) { pub const GPUTransferBufferUsage = enum(c_int) {
@ -586,7 +590,18 @@ pub const GPUShaderStage = enum(c_int) {
shaderstageFragment, shaderstageFragment,
}; };
pub const GPUShaderFormat = u32; pub const GPUShaderFormat = packed struct(u32) {
shaderformatPrivate: bool = false, // Shaders for NDA'd platforms.
shaderformatSpirv: bool = false, // SPIR-V shaders for Vulkan.
shaderformatDxbc: bool = false, // DXBC SM5_1 shaders for D3D12.
shaderformatDxil: bool = false, // DXIL SM6_0 shaders for D3D12.
shaderformatMsl: bool = false, // MSL shaders for Metal.
shaderformatMetallib: bool = false, // Precompiled metallib shaders for Metal.
pad0: u25 = 0,
rsvd: bool = false,
pub const None = GPUShaderFormat{};
};
pub const GPUVertexElementFormat = enum(c_int) { pub const GPUVertexElementFormat = enum(c_int) {
vertexelementformatInvalid, vertexelementformatInvalid,
@ -700,6 +715,8 @@ pub const GPUColorComponentFlags = packed struct(u8) {
colorcomponentA: bool = false, // the alpha component colorcomponentA: bool = false, // the alpha component
pad0: u3 = 0, pad0: u3 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUColorComponentFlags{};
}; };
pub const GPUFilter = enum(c_int) { pub const GPUFilter = enum(c_int) {
@ -849,9 +866,9 @@ pub const GPUVertexAttribute = extern struct {
}; };
pub const GPUVertexInputState = extern struct { pub const GPUVertexInputState = extern struct {
vertex_buffer_descriptions: *const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions. vertex_buffer_descriptions: ?*const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions.
num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array. num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array.
vertex_attributes: *const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions. vertex_attributes: ?*const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions.
num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array. num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array.
}; };
@ -955,7 +972,7 @@ pub const GPUColorTargetDescription = extern struct {
}; };
pub const GPUGraphicsPipelineTargetInfo = extern struct { pub const GPUGraphicsPipelineTargetInfo = extern struct {
color_target_descriptions: *const GPUColorTargetDescription, // A pointer to an array of color target descriptions. color_target_descriptions: ?*const GPUColorTargetDescription, // A pointer to an array of color target descriptions.
num_color_targets: u32, // The number of color target descriptions in the above array. num_color_targets: u32, // The number of color target descriptions in the above array.
depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target. has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target.
@ -1072,11 +1089,11 @@ pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
} }
pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice { pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice {
return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name); return @ptrCast(c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name));
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {
return c.SDL_CreateGPUDeviceWithProperties(props); return @ptrCast(c.SDL_CreateGPUDeviceWithProperties(props));
} }
pub inline fn getNumGPUDrivers() c_int { pub inline fn getNumGPUDrivers() c_int {

View File

@ -3,105 +3,105 @@ pub const c = @import("c.zig").c;
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn isJoystickHaptic(joystick: *Joystick) bool { pub inline fn isJoystickHaptic(joystick: *Joystick) bool {
return @bitCast(c.SDL_IsJoystickHaptic(joystick)); return @bitCast(c.SDL_IsJoystickHaptic(@ptrCast(joystick)));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
return c.SDL_OpenHapticFromJoystick(joystick); return @ptrCast(c.SDL_OpenHapticFromJoystick(@ptrCast(joystick)));
} }
}; };
pub const Haptic = opaque { pub const Haptic = opaque {
pub inline fn getHapticID(haptic: *Haptic) HapticID { pub inline fn getHapticID(haptic: *Haptic) HapticID {
return c.SDL_GetHapticID(haptic); return c.SDL_GetHapticID(@ptrCast(haptic));
} }
pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 { pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 {
return c.SDL_GetHapticName(haptic); return c.SDL_GetHapticName(@ptrCast(haptic));
} }
pub inline fn closeHaptic(haptic: *Haptic) void { pub inline fn closeHaptic(haptic: *Haptic) void {
return c.SDL_CloseHaptic(haptic); return c.SDL_CloseHaptic(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffects(haptic); return c.SDL_GetMaxHapticEffects(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffectsPlaying(haptic); return c.SDL_GetMaxHapticEffectsPlaying(@ptrCast(haptic));
} }
pub inline fn getHapticFeatures(haptic: *Haptic) u32 { pub inline fn getHapticFeatures(haptic: *Haptic) u32 {
return c.SDL_GetHapticFeatures(haptic); return c.SDL_GetHapticFeatures(@ptrCast(haptic));
} }
pub inline fn getNumHapticAxes(haptic: *Haptic) c_int { pub inline fn getNumHapticAxes(haptic: *Haptic) c_int {
return c.SDL_GetNumHapticAxes(haptic); return c.SDL_GetNumHapticAxes(@ptrCast(haptic));
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: ?*const HapticEffect) bool {
return @bitCast(c.SDL_HapticEffectSupported(haptic, @ptrCast(effect))); return @bitCast(c.SDL_HapticEffectSupported(@ptrCast(haptic), @ptrCast(effect)));
} }
pub inline fn createHapticEffect(haptic: *Haptic, effect: *const HapticEffect) c_int { pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) c_int {
return c.SDL_CreateHapticEffect(haptic, @ptrCast(effect)); return c.SDL_CreateHapticEffect(@ptrCast(haptic), @ptrCast(effect));
} }
pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: *const HapticEffect) bool { pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: ?*const HapticEffect) bool {
return @bitCast(c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data))); return @bitCast(c.SDL_UpdateHapticEffect(@ptrCast(haptic), effect, @ptrCast(data)));
} }
pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool { pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool {
return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations)); return @bitCast(c.SDL_RunHapticEffect(@ptrCast(haptic), effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_StopHapticEffect(haptic, effect)); return @bitCast(c.SDL_StopHapticEffect(@ptrCast(haptic), effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
return c.SDL_DestroyHapticEffect(haptic, effect); return c.SDL_DestroyHapticEffect(@ptrCast(haptic), effect);
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect)); return @bitCast(c.SDL_GetHapticEffectStatus(@ptrCast(haptic), effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return @bitCast(c.SDL_SetHapticGain(haptic, gain)); return @bitCast(c.SDL_SetHapticGain(@ptrCast(haptic), gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter)); return @bitCast(c.SDL_SetHapticAutocenter(@ptrCast(haptic), autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_PauseHaptic(haptic)); return @bitCast(c.SDL_PauseHaptic(@ptrCast(haptic)));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_ResumeHaptic(haptic)); return @bitCast(c.SDL_ResumeHaptic(@ptrCast(haptic)));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticEffects(haptic)); return @bitCast(c.SDL_StopHapticEffects(@ptrCast(haptic)));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return @bitCast(c.SDL_HapticRumbleSupported(haptic)); return @bitCast(c.SDL_HapticRumbleSupported(@ptrCast(haptic)));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_InitHapticRumble(haptic)); return @bitCast(c.SDL_InitHapticRumble(@ptrCast(haptic)));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length)); return @bitCast(c.SDL_PlayHapticRumble(@ptrCast(haptic), strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticRumble(haptic)); return @bitCast(c.SDL_StopHapticRumble(@ptrCast(haptic)));
} }
}; };
@ -206,7 +206,7 @@ pub const HapticEffect = extern union {
pub const HapticID = u32; pub const HapticID = u32;
pub inline fn getHaptics(count: *c_int) ?*HapticID { pub inline fn getHaptics(count: *c_int) ?*HapticID {
return c.SDL_GetHaptics(@ptrCast(count)); return @ptrCast(c.SDL_GetHaptics(@ptrCast(count)));
} }
pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 { pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
@ -214,11 +214,11 @@ pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
} }
pub inline fn openHaptic(instance_id: HapticID) ?*Haptic { pub inline fn openHaptic(instance_id: HapticID) ?*Haptic {
return c.SDL_OpenHaptic(instance_id); return @ptrCast(c.SDL_OpenHaptic(instance_id));
} }
pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic { pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
return c.SDL_GetHapticFromID(instance_id); return @ptrCast(c.SDL_GetHapticFromID(instance_id));
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
@ -226,5 +226,5 @@ pub inline fn isMouseHaptic() bool {
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {
return c.SDL_OpenHapticFromMouse(); return @ptrCast(c.SDL_OpenHapticFromMouse());
} }

View File

@ -12,6 +12,8 @@ pub const InitFlags = packed struct(u32) {
initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`
pad0: u23 = 0, pad0: u23 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = InitFlags{};
}; };
pub const AppResult = enum(c_int) { pub const AppResult = enum(c_int) {

View File

@ -29,147 +29,147 @@ pub const PowerState = enum(c_int) {
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool { pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualAxis(joystick, axis, value)); return @bitCast(c.SDL_SetJoystickVirtualAxis(@ptrCast(joystick), axis, value));
} }
pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool { pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel)); return @bitCast(c.SDL_SetJoystickVirtualBall(@ptrCast(joystick), ball, xrel, yrel));
} }
pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool { pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool {
return @bitCast(c.SDL_SetJoystickVirtualButton(joystick, button, @bitCast(down))); return @bitCast(c.SDL_SetJoystickVirtualButton(@ptrCast(joystick), button, @bitCast(down)));
} }
pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool { pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool {
return @bitCast(c.SDL_SetJoystickVirtualHat(joystick, hat, value)); return @bitCast(c.SDL_SetJoystickVirtualHat(@ptrCast(joystick), hat, value));
} }
pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool { pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool {
return @bitCast(c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, @bitCast(down), x, y, pressure)); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(@ptrCast(joystick), touchpad, finger, @bitCast(down), x, y, pressure));
} }
pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool { pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool {
return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values)); return @bitCast(c.SDL_SendJoystickVirtualSensorData(@ptrCast(joystick), @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
return c.SDL_GetJoystickProperties(joystick); return c.SDL_GetJoystickProperties(@ptrCast(joystick));
} }
pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickName(joystick); return c.SDL_GetJoystickName(@ptrCast(joystick));
} }
pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickPath(joystick); return c.SDL_GetJoystickPath(@ptrCast(joystick));
} }
pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int { pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int {
return c.SDL_GetJoystickPlayerIndex(joystick); return c.SDL_GetJoystickPlayerIndex(@ptrCast(joystick));
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index)); return @bitCast(c.SDL_SetJoystickPlayerIndex(@ptrCast(joystick), player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
return c.SDL_GetJoystickGUID(joystick); return c.SDL_GetJoystickGUID(@ptrCast(joystick));
} }
pub inline fn getJoystickVendor(joystick: *Joystick) u16 { pub inline fn getJoystickVendor(joystick: *Joystick) u16 {
return c.SDL_GetJoystickVendor(joystick); return c.SDL_GetJoystickVendor(@ptrCast(joystick));
} }
pub inline fn getJoystickProduct(joystick: *Joystick) u16 { pub inline fn getJoystickProduct(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProduct(joystick); return c.SDL_GetJoystickProduct(@ptrCast(joystick));
} }
pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 { pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProductVersion(joystick); return c.SDL_GetJoystickProductVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 { pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickFirmwareVersion(joystick); return c.SDL_GetJoystickFirmwareVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickSerial(joystick); return c.SDL_GetJoystickSerial(@ptrCast(joystick));
} }
pub inline fn getJoystickType(joystick: *Joystick) JoystickType { pub inline fn getJoystickType(joystick: *Joystick) JoystickType {
return @intFromEnum(c.SDL_GetJoystickType(joystick)); return @intFromEnum(c.SDL_GetJoystickType(@ptrCast(joystick)));
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return @bitCast(c.SDL_JoystickConnected(joystick)); return @bitCast(c.SDL_JoystickConnected(@ptrCast(joystick)));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
return c.SDL_GetJoystickID(joystick); return c.SDL_GetJoystickID(@ptrCast(joystick));
} }
pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int { pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickAxes(joystick); return c.SDL_GetNumJoystickAxes(@ptrCast(joystick));
} }
pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int { pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickBalls(joystick); return c.SDL_GetNumJoystickBalls(@ptrCast(joystick));
} }
pub inline fn getNumJoystickHats(joystick: *Joystick) c_int { pub inline fn getNumJoystickHats(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickHats(joystick); return c.SDL_GetNumJoystickHats(@ptrCast(joystick));
} }
pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int { pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickButtons(joystick); return c.SDL_GetNumJoystickButtons(@ptrCast(joystick));
} }
pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 { pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 {
return c.SDL_GetJoystickAxis(joystick, axis); return c.SDL_GetJoystickAxis(@ptrCast(joystick), axis);
} }
pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool { pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool {
return @bitCast(c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state))); return @bitCast(c.SDL_GetJoystickAxisInitialState(@ptrCast(joystick), axis, @ptrCast(state)));
} }
pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool { pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool {
return @bitCast(c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy))); return @bitCast(c.SDL_GetJoystickBall(@ptrCast(joystick), ball, @ptrCast(dx), @ptrCast(dy)));
} }
pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 { pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 {
return c.SDL_GetJoystickHat(joystick, hat); return c.SDL_GetJoystickHat(@ptrCast(joystick), hat);
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return @bitCast(c.SDL_GetJoystickButton(joystick, button)); return @bitCast(c.SDL_GetJoystickButton(@ptrCast(joystick), button));
} }
pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystick(@ptrCast(joystick), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystickTriggers(@ptrCast(joystick), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool { pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetJoystickLED(joystick, red, green, blue)); return @bitCast(c.SDL_SetJoystickLED(@ptrCast(joystick), red, green, blue));
} }
pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size)); return @bitCast(c.SDL_SendJoystickEffect(@ptrCast(joystick), data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
return c.SDL_CloseJoystick(joystick); return c.SDL_CloseJoystick(@ptrCast(joystick));
} }
pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState { pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState {
return c.SDL_GetJoystickConnectionState(joystick); return c.SDL_GetJoystickConnectionState(@ptrCast(joystick));
} }
pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState { pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState {
return c.SDL_GetJoystickPowerInfo(joystick, @ptrCast(percent)); return c.SDL_GetJoystickPowerInfo(@ptrCast(joystick), @ptrCast(percent));
} }
}; };
@ -208,7 +208,7 @@ pub inline fn hasJoystick() bool {
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
return c.SDL_GetJoysticks(@ptrCast(count)); return @ptrCast(c.SDL_GetJoysticks(@ptrCast(count)));
} }
pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 {
@ -244,15 +244,15 @@ pub inline fn getJoystickTypeForID(instance_id: JoystickID) JoystickType {
} }
pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick { pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick {
return c.SDL_OpenJoystick(instance_id); return @ptrCast(c.SDL_OpenJoystick(instance_id));
} }
pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick { pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick {
return c.SDL_GetJoystickFromID(instance_id); return @ptrCast(c.SDL_GetJoystickFromID(instance_id));
} }
pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick { pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick {
return c.SDL_GetJoystickFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetJoystickFromPlayerIndex(player_index));
} }
pub const VirtualJoystickTouchpadDesc = extern struct { pub const VirtualJoystickTouchpadDesc = extern struct {
@ -279,8 +279,8 @@ pub const VirtualJoystickDesc = extern struct {
nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions
padding2: [2]u16, // unused padding2: [2]u16, // unused
name: [*c]const u8, // the name of the joystick name: [*c]const u8, // the name of the joystick
touchpads: *const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 touchpads: ?*const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0
sensors: *const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0 sensors: ?*const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0
userdata: ?*anyopaque, // User data pointer passed to callbacks userdata: ?*anyopaque, // User data pointer passed to callbacks
Update: ?*const anyopaque, // Called when the joystick state should be updated Update: ?*const anyopaque, // Called when the joystick state should be updated
SetPlayerIndex: ?*const anyopaque, // Called when the player index is set SetPlayerIndex: ?*const anyopaque, // Called when the player index is set
@ -292,7 +292,7 @@ pub const VirtualJoystickDesc = extern struct {
Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached
}; };
pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID { pub inline fn attachVirtualJoystick(desc: ?*const VirtualJoystickDesc) JoystickID {
return c.SDL_AttachVirtualJoystick(@ptrCast(desc)); return c.SDL_AttachVirtualJoystick(@ptrCast(desc));
} }

View File

@ -5,14 +5,14 @@ pub const FunctionPointer = c.SDL_FunctionPointer;
pub const SharedObject = opaque { pub const SharedObject = opaque {
pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer { pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer {
return c.SDL_LoadFunction(sharedobject, name); return c.SDL_LoadFunction(@ptrCast(sharedobject), name);
} }
pub inline fn unloadObject(sharedobject: *SharedObject) void { pub inline fn unloadObject(sharedobject: *SharedObject) void {
return c.SDL_UnloadObject(sharedobject); return c.SDL_UnloadObject(@ptrCast(sharedobject));
} }
}; };
pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject { pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject {
return c.SDL_LoadObject(sofile); return @ptrCast(c.SDL_LoadObject(sofile));
} }

View File

@ -11,6 +11,8 @@ pub const MessageBoxFlags = packed struct(u32) {
messageboxButtonsRightToLeft: bool = false, // buttons placed right to left messageboxButtonsRightToLeft: bool = false, // buttons placed right to left
pad0: u26 = 0, pad0: u26 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxFlags{};
}; };
pub const MessageBoxButtonFlags = packed struct(u32) { pub const MessageBoxButtonFlags = packed struct(u32) {
@ -18,6 +20,8 @@ pub const MessageBoxButtonFlags = packed struct(u32) {
messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit
pad0: u29 = 0, pad0: u29 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxButtonFlags{};
}; };
pub const MessageBoxButtonData = extern struct { pub const MessageBoxButtonData = extern struct {
@ -51,14 +55,14 @@ pub const MessageBoxData = extern struct {
title: [*c]const u8, // UTF-8 title title: [*c]const u8, // UTF-8 title
message: [*c]const u8, // UTF-8 message text message: [*c]const u8, // UTF-8 message text
numbuttons: c_int, numbuttons: c_int,
buttons: *const MessageBoxButtonData, buttons: ?*const MessageBoxButtonData,
colorScheme: *const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings colorScheme: ?*const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: ?*const MessageBoxData, buttonid: *c_int) bool {
return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid))); return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid)));
} }
pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool { pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool {
return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window)); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, @ptrCast(window)));
} }

View File

@ -3,21 +3,21 @@ pub const c = @import("c.zig").c;
pub const Window = opaque { pub const Window = opaque {
pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void { pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void {
return c.SDL_WarpMouseInWindow(window, x, y); return c.SDL_WarpMouseInWindow(@ptrCast(window), x, y);
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled))); return @bitCast(c.SDL_SetWindowRelativeMouseMode(@ptrCast(window), @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return @bitCast(c.SDL_GetWindowRelativeMouseMode(window)); return @bitCast(c.SDL_GetWindowRelativeMouseMode(@ptrCast(window)));
} }
}; };
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateColorCursor(surface, hot_x, hot_y); return @ptrCast(c.SDL_CreateColorCursor(@ptrCast(surface), hot_x, hot_y));
} }
}; };
@ -25,11 +25,11 @@ pub const MouseID = u32;
pub const Cursor = opaque { pub const Cursor = opaque {
pub inline fn setCursor(cursor: *Cursor) bool { pub inline fn setCursor(cursor: *Cursor) bool {
return @bitCast(c.SDL_SetCursor(cursor)); return @bitCast(c.SDL_SetCursor(@ptrCast(cursor)));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
return c.SDL_DestroyCursor(cursor); return c.SDL_DestroyCursor(@ptrCast(cursor));
} }
}; };
@ -68,6 +68,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MouseButtonFlags{};
pub const ButtonRight: MouseButtonFlags = @bitCast(@as(u32, 3));
pub const ButtonX2: MouseButtonFlags = @bitCast(@as(u32, 5));
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
@ -75,7 +79,7 @@ pub inline fn hasMouse() bool {
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
return c.SDL_GetMice(@ptrCast(count)); return @ptrCast(c.SDL_GetMice(@ptrCast(count)));
} }
pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 { pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
@ -83,7 +87,7 @@ pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
} }
pub inline fn getMouseFocus() ?*Window { pub inline fn getMouseFocus() ?*Window {
return c.SDL_GetMouseFocus(); return @ptrCast(c.SDL_GetMouseFocus());
} }
pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags { pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags {
@ -107,19 +111,19 @@ pub inline fn captureMouse(enabled: bool) bool {
} }
pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y); return @ptrCast(c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y));
} }
pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor { pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor {
return c.SDL_CreateSystemCursor(id); return @ptrCast(c.SDL_CreateSystemCursor(id));
} }
pub inline fn getCursor() ?*Cursor { pub inline fn getCursor() ?*Cursor {
return c.SDL_GetCursor(); return @ptrCast(c.SDL_GetCursor());
} }
pub inline fn getDefaultCursor() ?*Cursor { pub inline fn getDefaultCursor() ?*Cursor {
return c.SDL_GetDefaultCursor(); return @ptrCast(c.SDL_GetDefaultCursor());
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {

View File

@ -205,34 +205,34 @@ pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask:
return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask)); return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask));
} }
pub inline fn getPixelFormatDetails(format: PixelFormat) *const PixelFormatDetails { pub inline fn getPixelFormatDetails(format: PixelFormat) ?*const PixelFormatDetails {
return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format))); return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format)));
} }
pub inline fn createPalette(ncolors: c_int) ?*Palette { pub inline fn createPalette(ncolors: c_int) ?*Palette {
return c.SDL_CreatePalette(ncolors); return @ptrCast(c.SDL_CreatePalette(ncolors));
} }
pub inline fn setPaletteColors(palette: ?*Palette, colors: *const Color, firstcolor: c_int, ncolors: c_int) bool { pub inline fn setPaletteColors(palette: ?*Palette, colors: ?*const Color, firstcolor: c_int, ncolors: c_int) bool {
return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors)); return @bitCast(c.SDL_SetPaletteColors(@ptrCast(palette), @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {
return c.SDL_DestroyPalette(palette); return c.SDL_DestroyPalette(@ptrCast(palette));
} }
pub inline fn mapRGB(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8) u32 { pub inline fn mapRGB(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b); return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b);
} }
pub inline fn mapRGBA(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapRGBA(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a); return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a);
} }
pub inline fn getRGB(pixel: u32, format: *const PixelFormatDetails, palette: *const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8) void { 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); return c.SDL_GetRGB(pixel, @ptrCast(format), @ptrCast(palette), r, g, b);
} }
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 { 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); return c.SDL_GetRGBA(pixel, @ptrCast(format), @ptrCast(palette), r, g, b, a);
} }

View File

@ -25,42 +25,42 @@ pub const FRect = extern struct {
h: f32, h: f32,
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: ?*const Rect, B: ?*const Rect) bool {
return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersection(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectIntersection(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnion(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectUnion(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPoints(points: *const Point, count: c_int, clip: *const Rect, result: ?*Rect) bool { pub inline fn getRectEnclosingPoints(points: ?*const Point, count: c_int, clip: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersection(rect: *const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool { pub inline fn getRectAndLineIntersection(rect: ?*const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool {
return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }
pub inline fn hasRectIntersectionFloat(A: *const FRect, B: *const FRect) bool { pub inline fn hasRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect) bool {
return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersectionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectUnionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPointsFloat(points: *const FPoint, count: c_int, clip: *const FRect, result: ?*FRect) bool { pub inline fn getRectEnclosingPointsFloat(points: ?*const FPoint, count: c_int, clip: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersectionFloat(rect: *const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool { pub inline fn getRectAndLineIntersectionFloat(rect: ?*const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool {
return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }

View File

@ -27,7 +27,7 @@ pub const FColor = extern struct {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer { pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer {
return c.SDL_CreateSoftwareRenderer(surface); return @ptrCast(c.SDL_CreateSoftwareRenderer(@ptrCast(surface)));
} }
}; };
@ -42,11 +42,11 @@ pub const BlendMode = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer { pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer {
return c.SDL_CreateRenderer(window, name); return @ptrCast(c.SDL_CreateRenderer(@ptrCast(window), name));
} }
pub inline fn getRenderer(window: *Window) ?*Renderer { pub inline fn getRenderer(window: *Window) ?*Renderer {
return c.SDL_GetRenderer(window); return @ptrCast(c.SDL_GetRenderer(@ptrCast(window)));
} }
}; };
@ -605,6 +605,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const PenInputFlags = packed struct(u32) {
@ -617,9 +621,16 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const PenID = u32; pub const PenID = packed struct(u32) {
pad0: u31 = 0,
rsvd: bool = false,
pub const None = PenID{};
};
pub const DisplayID = u32; pub const DisplayID = u32;
@ -778,6 +789,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const Vertex = extern struct { pub const Vertex = extern struct {
@ -802,329 +815,329 @@ pub const RendererLogicalPresentation = enum(c_int) {
pub const Renderer = opaque { pub const Renderer = opaque {
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window { pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
return c.SDL_GetRenderWindow(renderer); return @ptrCast(c.SDL_GetRenderWindow(@ptrCast(renderer)));
} }
pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 { pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 {
return c.SDL_GetRendererName(renderer); return c.SDL_GetRendererName(@ptrCast(renderer));
} }
pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID { pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID {
return c.SDL_GetRendererProperties(renderer); return c.SDL_GetRendererProperties(@ptrCast(renderer));
} }
pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetRenderOutputSize(@ptrCast(renderer), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); 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 { pub inline fn createTexture(renderer: *Renderer, format: PixelFormat, access: TextureAccess, w: c_int, h: c_int) ?*Texture {
return c.SDL_CreateTexture(renderer, @bitCast(format), access, w, h); return @ptrCast(c.SDL_CreateTexture(@ptrCast(renderer), @bitCast(format), access, w, h));
} }
pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture { pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture {
return c.SDL_CreateTextureFromSurface(renderer, surface); return @ptrCast(c.SDL_CreateTextureFromSurface(@ptrCast(renderer), @ptrCast(surface)));
} }
pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture { pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture {
return c.SDL_CreateTextureWithProperties(renderer, props); return @ptrCast(c.SDL_CreateTextureWithProperties(@ptrCast(renderer), props));
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return @bitCast(c.SDL_SetRenderTarget(renderer, texture)); return @bitCast(c.SDL_SetRenderTarget(@ptrCast(renderer), @ptrCast(texture)));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
return c.SDL_GetRenderTarget(renderer); return @ptrCast(c.SDL_GetRenderTarget(@ptrCast(renderer)));
} }
pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool { pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool {
return @bitCast(c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode)); 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 { pub inline fn getRenderLogicalPresentation(renderer: *Renderer, w: *c_int, h: *c_int, mode: ?*RendererLogicalPresentation) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode)); return @bitCast(c.SDL_GetRenderLogicalPresentation(@ptrCast(renderer), @ptrCast(w), @ptrCast(h), @ptrCast(mode)));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, rect)); 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 { pub inline fn renderCoordinatesFromWindow(renderer: *Renderer, window_x: f32, window_y: f32, x: *f32, y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y))); 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 { pub inline fn renderCoordinatesToWindow(renderer: *Renderer, x: f32, y: f32, window_x: *f32, window_y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y))); return @bitCast(c.SDL_RenderCoordinatesToWindow(@ptrCast(renderer), x, y, @ptrCast(window_x), @ptrCast(window_y)));
} }
pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool { pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool {
return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event)); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(@ptrCast(renderer), @ptrCast(event)));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderViewport(renderer, rect)); return @bitCast(c.SDL_GetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderViewportSet(renderer)); return @bitCast(c.SDL_RenderViewportSet(@ptrCast(renderer)));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect)); return @bitCast(c.SDL_GetRenderSafeArea(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderClipRect(renderer, rect)); return @bitCast(c.SDL_GetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClipEnabled(renderer)); return @bitCast(c.SDL_RenderClipEnabled(@ptrCast(renderer)));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return @bitCast(c.SDL_SetRenderScale(renderer, scaleX, scaleY)); return @bitCast(c.SDL_SetRenderScale(@ptrCast(renderer), scaleX, scaleY));
} }
pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool { pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool {
return @bitCast(c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY))); 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 { pub inline fn setRenderDrawColor(renderer: *Renderer, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_SetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn setRenderDrawColorFloat(renderer: *Renderer, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColor(renderer: *Renderer, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_GetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColorFloat(renderer: *Renderer, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_GetRenderDrawColorFloat(@ptrCast(renderer), @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool { pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool {
return @bitCast(c.SDL_SetRenderColorScale(renderer, scale)); return @bitCast(c.SDL_SetRenderColorScale(@ptrCast(renderer), scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale))); return @bitCast(c.SDL_GetRenderColorScale(@ptrCast(renderer), @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetRenderDrawBlendMode(@ptrCast(renderer), @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetRenderDrawBlendMode(@ptrCast(renderer), @ptrCast(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClear(renderer)); return @bitCast(c.SDL_RenderClear(@ptrCast(renderer)));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return @bitCast(c.SDL_RenderPoint(renderer, x, y)); return @bitCast(c.SDL_RenderPoint(@ptrCast(renderer), x, y));
} }
pub inline fn renderPoints(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderPoints(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderPoints(renderer, @ptrCast(points), count)); 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 { pub inline fn renderLine(renderer: *Renderer, x1: f32, y1: f32, x2: f32, y2: f32) bool {
return @bitCast(c.SDL_RenderLine(renderer, x1, y1, x2, y2)); return @bitCast(c.SDL_RenderLine(@ptrCast(renderer), x1, y1, x2, y2));
} }
pub inline fn renderLines(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderLines(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderLines(renderer, @ptrCast(points), count)); return @bitCast(c.SDL_RenderLines(@ptrCast(renderer), @ptrCast(points), count));
} }
pub inline fn renderRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderRects(renderer, @ptrCast(rects), count)); return @bitCast(c.SDL_RenderRects(@ptrCast(renderer), @ptrCast(rects), count));
} }
pub inline fn renderFillRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderFillRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderFillRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderFillRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderFillRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderFillRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderFillRects(renderer, @ptrCast(rects), count)); 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 { pub inline fn renderTexture(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip))); 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 { 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(renderer, texture, @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down))); 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 { pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, scale: f32, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices)); 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 { 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(renderer, texture, @ptrCast(xy), xy_stride, @ptrCast(color), color_stride, @ptrCast(uv), uv_stride, num_vertices, indices, num_indices, size_indices)); 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 { pub inline fn renderReadPixels(renderer: *Renderer, rect: ?*const Rect) ?*Surface {
return c.SDL_RenderReadPixels(renderer, @ptrCast(rect)); return @ptrCast(c.SDL_RenderReadPixels(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderPresent(renderer)); return @bitCast(c.SDL_RenderPresent(@ptrCast(renderer)));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
return c.SDL_DestroyRenderer(renderer); return c.SDL_DestroyRenderer(@ptrCast(renderer));
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return @bitCast(c.SDL_FlushRenderer(renderer)); return @bitCast(c.SDL_FlushRenderer(@ptrCast(renderer)));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalLayer(renderer); return c.SDL_GetRenderMetalLayer(@ptrCast(renderer));
} }
pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalCommandEncoder(renderer); return c.SDL_GetRenderMetalCommandEncoder(@ptrCast(renderer));
} }
pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool { pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool {
return @bitCast(c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore)); return @bitCast(c.SDL_AddVulkanRenderSemaphores(@ptrCast(renderer), wait_stage_mask, wait_semaphore, signal_semaphore));
} }
pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool { pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool {
return @bitCast(c.SDL_SetRenderVSync(renderer, vsync)); return @bitCast(c.SDL_SetRenderVSync(@ptrCast(renderer), vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return @bitCast(c.SDL_GetRenderVSync(renderer, @ptrCast(vsync))); return @bitCast(c.SDL_GetRenderVSync(@ptrCast(renderer), @ptrCast(vsync)));
} }
pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool { pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool {
return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str)); return @bitCast(c.SDL_RenderDebugText(@ptrCast(renderer), x, y, str));
} }
}; };
pub const Texture = opaque { pub const Texture = opaque {
pub inline fn getTextureProperties(texture: *Texture) PropertiesID { pub inline fn getTextureProperties(texture: *Texture) PropertiesID {
return c.SDL_GetTextureProperties(texture); return c.SDL_GetTextureProperties(@ptrCast(texture));
} }
pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer { pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer {
return c.SDL_GetRendererFromTexture(texture); return @ptrCast(c.SDL_GetRendererFromTexture(@ptrCast(texture)));
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return @bitCast(c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetTextureSize(@ptrCast(texture), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool { pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_SetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool { pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool {
return @bitCast(c.SDL_SetTextureColorModFloat(texture, r, g, b)); 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 { pub inline fn getTextureColorMod(texture: *Texture, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_GetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool { pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool {
return @bitCast(c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b))); return @bitCast(c.SDL_GetTextureColorModFloat(@ptrCast(texture), @ptrCast(r), @ptrCast(g), @ptrCast(b)));
} }
pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool { pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool {
return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaModFloat(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_GetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha))); return @bitCast(c.SDL_GetTextureAlphaModFloat(@ptrCast(texture), @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetTextureBlendMode(@ptrCast(texture), @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetTextureBlendMode(@ptrCast(texture), @ptrCast(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode))); return @bitCast(c.SDL_SetTextureScaleMode(@ptrCast(texture), @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode))); 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 { pub inline fn updateTexture(texture: *Texture, rect: ?*const Rect, pixels: ?*const anyopaque, pitch: c_int) bool {
return @bitCast(c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch)); 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 { pub inline fn lockTexture(texture: *Texture, rect: ?*const Rect, pixels: [*c]?*anyopaque, pitch: *c_int) bool {
return @bitCast(c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch))); return @bitCast(c.SDL_LockTexture(@ptrCast(texture), @ptrCast(rect), pixels, @ptrCast(pitch)));
} }
pub inline fn lockTextureToSurface(texture: *Texture, rect: *const Rect, surface: [*c][*c]Surface) bool { pub inline fn lockTextureToSurface(texture: *Texture, rect: ?*const Rect, surface: [*c]?*Surface) bool {
return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface)); return @bitCast(c.SDL_LockTextureToSurface(@ptrCast(texture), @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
return c.SDL_UnlockTexture(texture); return c.SDL_UnlockTexture(@ptrCast(texture));
} }
pub inline fn destroyTexture(texture: *Texture) void { pub inline fn destroyTexture(texture: *Texture) void {
return c.SDL_DestroyTexture(texture); return c.SDL_DestroyTexture(@ptrCast(texture));
} }
}; };
@ -1136,10 +1149,10 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
return c.SDL_GetRenderDriver(index); return c.SDL_GetRenderDriver(index);
} }
pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: c_int, window_flags: WindowFlags, window: [*c][*c]Window, renderer: [*c][*c]Renderer) bool { 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)); return @bitCast(c.SDL_CreateWindowAndRenderer(title, width, height, @bitCast(window_flags), window, renderer));
} }
pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer { pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer {
return c.SDL_CreateRendererWithProperties(props); return @ptrCast(c.SDL_CreateRendererWithProperties(props));
} }

View File

@ -5,31 +5,31 @@ pub const PropertiesID = u32;
pub const Sensor = opaque { pub const Sensor = opaque {
pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID { pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID {
return c.SDL_GetSensorProperties(sensor); return c.SDL_GetSensorProperties(@ptrCast(sensor));
} }
pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 { pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 {
return c.SDL_GetSensorName(sensor); return c.SDL_GetSensorName(@ptrCast(sensor));
} }
pub inline fn getSensorType(sensor: *Sensor) SensorType { pub inline fn getSensorType(sensor: *Sensor) SensorType {
return @intFromEnum(c.SDL_GetSensorType(sensor)); return @intFromEnum(c.SDL_GetSensorType(@ptrCast(sensor)));
} }
pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int { pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int {
return c.SDL_GetSensorNonPortableType(sensor); return c.SDL_GetSensorNonPortableType(@ptrCast(sensor));
} }
pub inline fn getSensorID(sensor: *Sensor) SensorID { pub inline fn getSensorID(sensor: *Sensor) SensorID {
return c.SDL_GetSensorID(sensor); return c.SDL_GetSensorID(@ptrCast(sensor));
} }
pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool { pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values)); return @bitCast(c.SDL_GetSensorData(@ptrCast(sensor), @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {
return c.SDL_CloseSensor(sensor); return c.SDL_CloseSensor(@ptrCast(sensor));
} }
}; };
@ -47,7 +47,7 @@ pub const SensorType = enum(c_int) {
}; };
pub inline fn getSensors(count: *c_int) ?*SensorID { pub inline fn getSensors(count: *c_int) ?*SensorID {
return c.SDL_GetSensors(@ptrCast(count)); return @ptrCast(c.SDL_GetSensors(@ptrCast(count)));
} }
pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 { pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 {
@ -63,11 +63,11 @@ pub inline fn getSensorNonPortableTypeForID(instance_id: SensorID) c_int {
} }
pub inline fn openSensor(instance_id: SensorID) ?*Sensor { pub inline fn openSensor(instance_id: SensorID) ?*Sensor {
return c.SDL_OpenSensor(instance_id); return @ptrCast(c.SDL_OpenSensor(instance_id));
} }
pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor { pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor {
return c.SDL_GetSensorFromID(instance_id); return @ptrCast(c.SDL_GetSensorFromID(instance_id));
} }
pub inline fn updateSensors() void { pub inline fn updateSensors() void {

View File

@ -22,6 +22,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
@ -45,70 +47,70 @@ pub const StorageInterface = extern struct {
pub const Storage = opaque { pub const Storage = opaque {
pub inline fn closeStorage(storage: *Storage) bool { pub inline fn closeStorage(storage: *Storage) bool {
return @bitCast(c.SDL_CloseStorage(storage)); return @bitCast(c.SDL_CloseStorage(@ptrCast(storage)));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return @bitCast(c.SDL_StorageReady(storage)); return @bitCast(c.SDL_StorageReady(@ptrCast(storage)));
} }
pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool { pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool {
return @bitCast(c.SDL_GetStorageFileSize(storage, path, @ptrCast(length))); return @bitCast(c.SDL_GetStorageFileSize(@ptrCast(storage), path, @ptrCast(length)));
} }
pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool { pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool {
return @bitCast(c.SDL_ReadStorageFile(storage, path, destination, length)); return @bitCast(c.SDL_ReadStorageFile(@ptrCast(storage), path, destination, length));
} }
pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool { pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool {
return @bitCast(c.SDL_WriteStorageFile(storage, path, source, length)); return @bitCast(c.SDL_WriteStorageFile(@ptrCast(storage), path, source, length));
} }
pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool { pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_CreateStorageDirectory(storage, path)); return @bitCast(c.SDL_CreateStorageDirectory(@ptrCast(storage), path));
} }
pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata)); return @bitCast(c.SDL_EnumerateStorageDirectory(@ptrCast(storage), path, callback, userdata));
} }
pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool { pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_RemoveStoragePath(storage, path)); return @bitCast(c.SDL_RemoveStoragePath(@ptrCast(storage), path));
} }
pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_RenameStoragePath(storage, oldpath, newpath)); return @bitCast(c.SDL_RenameStoragePath(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_CopyStorageFile(storage, oldpath, newpath)); return @bitCast(c.SDL_CopyStorageFile(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info)); return @bitCast(c.SDL_GetStoragePathInfo(@ptrCast(storage), path, @ptrCast(info)));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {
return c.SDL_GetStorageSpaceRemaining(storage); return c.SDL_GetStorageSpaceRemaining(@ptrCast(storage));
} }
pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {
return c.SDL_GlobStorageDirectory(storage, path, pattern, @bitCast(flags), @ptrCast(count)); return c.SDL_GlobStorageDirectory(@ptrCast(storage), path, pattern, @bitCast(flags), @ptrCast(count));
} }
}; };
pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenTitleStorage(override, props); return @ptrCast(c.SDL_OpenTitleStorage(override, props));
} }
pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenUserStorage(org, app, props); return @ptrCast(c.SDL_OpenUserStorage(org, app, props));
} }
pub inline fn openFileStorage(path: [*c]const u8) ?*Storage { pub inline fn openFileStorage(path: [*c]const u8) ?*Storage {
return c.SDL_OpenFileStorage(path); return @ptrCast(c.SDL_OpenFileStorage(path));
} }
pub inline fn openStorage(iface: *const StorageInterface, userdata: ?*anyopaque) ?*Storage { pub inline fn openStorage(iface: ?*const StorageInterface, userdata: ?*anyopaque) ?*Storage {
return c.SDL_OpenStorage(@ptrCast(iface), userdata); return @ptrCast(c.SDL_OpenStorage(@ptrCast(iface), userdata));
} }

View File

@ -17,7 +17,7 @@ pub const BlendMode = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface { pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio)); return @ptrCast(c.SDL_LoadBMP_IO(@ptrCast(iostream), @bitCast(closeio)));
} }
}; };
@ -81,6 +81,8 @@ pub const SurfaceFlags = packed struct(u32) {
surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc() surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc()
pad0: u27 = 0, pad0: u27 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = SurfaceFlags{};
}; };
pub const ScaleMode = enum(c_int) { pub const ScaleMode = enum(c_int) {
@ -96,216 +98,216 @@ pub const FlipMode = enum(c_int) {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn destroySurface(surface: *Surface) void { pub inline fn destroySurface(surface: *Surface) void {
return c.SDL_DestroySurface(surface); return c.SDL_DestroySurface(@ptrCast(surface));
} }
pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID { pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID {
return c.SDL_GetSurfaceProperties(surface); return c.SDL_GetSurfaceProperties(@ptrCast(surface));
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace)); return @bitCast(c.SDL_SetSurfaceColorspace(@ptrCast(surface), colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
return c.SDL_GetSurfaceColorspace(surface); return c.SDL_GetSurfaceColorspace(@ptrCast(surface));
} }
pub inline fn createSurfacePalette(surface: *Surface) ?*Palette { pub inline fn createSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_CreateSurfacePalette(surface); return @ptrCast(c.SDL_CreateSurfacePalette(@ptrCast(surface)));
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return @bitCast(c.SDL_SetSurfacePalette(surface, palette)); return @bitCast(c.SDL_SetSurfacePalette(@ptrCast(surface), @ptrCast(palette)));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_GetSurfacePalette(surface); return @ptrCast(c.SDL_GetSurfacePalette(@ptrCast(surface)));
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image)); return @bitCast(c.SDL_AddSurfaceAlternateImage(@ptrCast(surface), @ptrCast(image)));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasAlternateImages(surface)); return @bitCast(c.SDL_SurfaceHasAlternateImages(@ptrCast(surface)));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c]?*Surface {
return c.SDL_GetSurfaceImages(surface, @ptrCast(count)); return c.SDL_GetSurfaceImages(@ptrCast(surface), @ptrCast(count));
} }
pub inline fn removeSurfaceAlternateImages(surface: *Surface) void { pub inline fn removeSurfaceAlternateImages(surface: *Surface) void {
return c.SDL_RemoveSurfaceAlternateImages(surface); return c.SDL_RemoveSurfaceAlternateImages(@ptrCast(surface));
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return @bitCast(c.SDL_LockSurface(surface)); return @bitCast(c.SDL_LockSurface(@ptrCast(surface)));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
return c.SDL_UnlockSurface(surface); return c.SDL_UnlockSurface(@ptrCast(surface));
} }
pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool { pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool {
return @bitCast(c.SDL_SaveBMP_IO(surface, dst, @bitCast(closeio))); return @bitCast(c.SDL_SaveBMP_IO(@ptrCast(surface), @ptrCast(dst), @bitCast(closeio)));
} }
pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool { pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool {
return @bitCast(c.SDL_SaveBMP(surface, file)); return @bitCast(c.SDL_SaveBMP(@ptrCast(surface), file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled))); return @bitCast(c.SDL_SetSurfaceRLE(@ptrCast(surface), @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasRLE(surface)); return @bitCast(c.SDL_SurfaceHasRLE(@ptrCast(surface)));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key)); return @bitCast(c.SDL_SetSurfaceColorKey(@ptrCast(surface), @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasColorKey(surface)); return @bitCast(c.SDL_SurfaceHasColorKey(@ptrCast(surface)));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return @bitCast(c.SDL_GetSurfaceColorKey(surface, @ptrCast(key))); return @bitCast(c.SDL_GetSurfaceColorKey(@ptrCast(surface), @ptrCast(key)));
} }
pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool { pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_SetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool { pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_GetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_SetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_GetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetSurfaceBlendMode(@ptrCast(surface), @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetSurfaceBlendMode(@ptrCast(surface), @ptrCast(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect))); return @bitCast(c.SDL_SetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect)); return @bitCast(c.SDL_GetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip))); return @bitCast(c.SDL_FlipSurface(@ptrCast(surface), @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
return c.SDL_DuplicateSurface(surface); return @ptrCast(c.SDL_DuplicateSurface(@ptrCast(surface)));
} }
pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface { pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface {
return c.SDL_ScaleSurface(surface, width, height, @intFromEnum(scaleMode)); return @ptrCast(c.SDL_ScaleSurface(@ptrCast(surface), width, height, @intFromEnum(scaleMode)));
} }
pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface { pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface {
return c.SDL_ConvertSurface(surface, @bitCast(format)); return @ptrCast(c.SDL_ConvertSurface(@ptrCast(surface), @bitCast(format)));
} }
pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface { pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface {
return c.SDL_ConvertSurfaceAndColorspace(surface, @bitCast(format), palette, colorspace, props); return @ptrCast(c.SDL_ConvertSurfaceAndColorspace(@ptrCast(surface), @bitCast(format), @ptrCast(palette), colorspace, props));
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return @bitCast(c.SDL_PremultiplySurfaceAlpha(surface, @bitCast(linear))); return @bitCast(c.SDL_PremultiplySurfaceAlpha(@ptrCast(surface), @bitCast(linear)));
} }
pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_ClearSurface(surface, r, g, b, a)); return @bitCast(c.SDL_ClearSurface(@ptrCast(surface), r, g, b, a));
} }
pub inline fn fillSurfaceRect(surface: *Surface, rect: *const Rect, color: u32) bool { pub inline fn fillSurfaceRect(surface: *Surface, rect: ?*const Rect, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color)); return @bitCast(c.SDL_FillSurfaceRect(@ptrCast(surface), @ptrCast(rect), color));
} }
pub inline fn fillSurfaceRects(surface: *Surface, rects: *const Rect, count: c_int, color: u32) bool { pub inline fn fillSurfaceRects(surface: *Surface, rects: ?*const Rect, count: c_int, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color)); return @bitCast(c.SDL_FillSurfaceRects(@ptrCast(surface), @ptrCast(rects), count, color));
} }
pub inline fn blitSurface(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceUnchecked(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: *const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: ?*const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(@ptrCast(surface), @ptrCast(srcrect), scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurface9Grid(surface: *Surface, srcrect: *const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface9Grid(surface: *Surface, srcrect: ?*const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface9Grid(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface9Grid(@ptrCast(surface), @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 { pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapSurfaceRGB(surface, r, g, b); return c.SDL_MapSurfaceRGB(@ptrCast(surface), r, g, b);
} }
pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapSurfaceRGBA(surface, r, g, b, a); return c.SDL_MapSurfaceRGBA(@ptrCast(surface), r, g, b, a);
} }
pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool { pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_ReadSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool { pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_ReadSurfacePixelFloat(@ptrCast(surface), x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool { pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixelFloat(@ptrCast(surface), x, y, r, g, b, a));
} }
}; };
pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface { pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface {
return c.SDL_CreateSurface(width, height, @bitCast(format)); return @ptrCast(c.SDL_CreateSurface(width, height, @bitCast(format)));
} }
pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface { pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface {
return c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch); return @ptrCast(c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch));
} }
pub inline fn loadBMP(file: [*c]const u8) ?*Surface { pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
return c.SDL_LoadBMP(file); return @ptrCast(c.SDL_LoadBMP(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 { 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 {

View File

@ -5,7 +5,7 @@ pub const DisplayID = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool { pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool {
return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam)); return @bitCast(c.SDL_SetiOSAnimationCallback(@ptrCast(window), interval, callback, callbackParam));
} }
}; };

View File

@ -27,19 +27,19 @@ pub const TimeFormat = enum(c_int) {
}; };
pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool { pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool {
return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat))); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@ptrCast(dateFormat), @ptrCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return @bitCast(c.SDL_GetCurrentTime(ticks)); return @bitCast(c.SDL_GetCurrentTime(@ptrCast(ticks)));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime))); return @bitCast(c.SDL_TimeToDateTime(ticks, @ptrCast(dt), @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: ?*const DateTime, ticks: ?*Time) bool {
return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), ticks)); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), @ptrCast(ticks)));
} }
pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void { pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void {

View File

@ -19,7 +19,7 @@ pub const Finger = extern struct {
}; };
pub inline fn getTouchDevices(count: *c_int) ?*TouchID { pub inline fn getTouchDevices(count: *c_int) ?*TouchID {
return c.SDL_GetTouchDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetTouchDevices(@ptrCast(count)));
} }
pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 { pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 {
@ -30,6 +30,6 @@ pub inline fn getTouchDeviceType(touchID: TouchID) TouchDeviceType {
return @intFromEnum(c.SDL_GetTouchDeviceType(touchID)); return @intFromEnum(c.SDL_GetTouchDeviceType(touchID));
} }
pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c][*c]Finger { pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c]?*Finger {
return c.SDL_GetTouchFingers(touchID, @ptrCast(count)); return c.SDL_GetTouchFingers(touchID, @ptrCast(count));
} }

View File

@ -65,267 +65,267 @@ pub const DisplayOrientation = enum(c_int) {
pub const Window = opaque { pub const Window = opaque {
pub inline fn getDisplayForWindow(window: *Window) DisplayID { pub inline fn getDisplayForWindow(window: *Window) DisplayID {
return c.SDL_GetDisplayForWindow(window); return c.SDL_GetDisplayForWindow(@ptrCast(window));
} }
pub inline fn getWindowPixelDensity(window: *Window) f32 { pub inline fn getWindowPixelDensity(window: *Window) f32 {
return c.SDL_GetWindowPixelDensity(window); return c.SDL_GetWindowPixelDensity(@ptrCast(window));
} }
pub inline fn getWindowDisplayScale(window: *Window) f32 { pub inline fn getWindowDisplayScale(window: *Window) f32 {
return c.SDL_GetWindowDisplayScale(window); return c.SDL_GetWindowDisplayScale(@ptrCast(window));
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: ?*const DisplayMode) bool {
return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode))); return @bitCast(c.SDL_SetWindowFullscreenMode(@ptrCast(window), @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) ?*const DisplayMode {
return @ptrCast(c.SDL_GetWindowFullscreenMode(window)); return @ptrCast(c.SDL_GetWindowFullscreenMode(@ptrCast(window)));
} }
pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque { pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque {
return c.SDL_GetWindowICCProfile(window, @ptrCast(size)); return c.SDL_GetWindowICCProfile(@ptrCast(window), @ptrCast(size));
} }
pub inline fn getWindowPixelFormat(window: *Window) PixelFormat { pub inline fn getWindowPixelFormat(window: *Window) PixelFormat {
return @bitCast(c.SDL_GetWindowPixelFormat(window)); return @bitCast(c.SDL_GetWindowPixelFormat(@ptrCast(window)));
} }
pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreatePopupWindow(window, offset_x, offset_y, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreatePopupWindow(@ptrCast(window), offset_x, offset_y, w, h, @bitCast(flags)));
} }
pub inline fn getWindowID(window: *Window) WindowID { pub inline fn getWindowID(window: *Window) WindowID {
return c.SDL_GetWindowID(window); return c.SDL_GetWindowID(@ptrCast(window));
} }
pub inline fn getWindowParent(window: *Window) ?*Window { pub inline fn getWindowParent(window: *Window) ?*Window {
return c.SDL_GetWindowParent(window); return @ptrCast(c.SDL_GetWindowParent(@ptrCast(window)));
} }
pub inline fn getWindowProperties(window: *Window) PropertiesID { pub inline fn getWindowProperties(window: *Window) PropertiesID {
return c.SDL_GetWindowProperties(window); return c.SDL_GetWindowProperties(@ptrCast(window));
} }
pub inline fn getWindowFlags(window: *Window) WindowFlags { pub inline fn getWindowFlags(window: *Window) WindowFlags {
return @bitCast(c.SDL_GetWindowFlags(window)); return @bitCast(c.SDL_GetWindowFlags(@ptrCast(window)));
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return @bitCast(c.SDL_SetWindowTitle(window, title)); return @bitCast(c.SDL_SetWindowTitle(@ptrCast(window), title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
return c.SDL_GetWindowTitle(window); return c.SDL_GetWindowTitle(@ptrCast(window));
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowIcon(window, icon)); return @bitCast(c.SDL_SetWindowIcon(@ptrCast(window), @ptrCast(icon)));
} }
pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool { pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_SetWindowPosition(window, x, y)); return @bitCast(c.SDL_SetWindowPosition(@ptrCast(window), x, y));
} }
pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool { pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool {
return @bitCast(c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y))); return @bitCast(c.SDL_GetWindowPosition(@ptrCast(window), @ptrCast(x), @ptrCast(y)));
} }
pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool { pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool {
return @bitCast(c.SDL_SetWindowSize(window, w, h)); return @bitCast(c.SDL_SetWindowSize(@ptrCast(window), w, h));
} }
pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetWindowSafeArea(window, rect)); return @bitCast(c.SDL_GetWindowSafeArea(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool { pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool {
return @bitCast(c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect)); return @bitCast(c.SDL_SetWindowAspectRatio(@ptrCast(window), min_aspect, max_aspect));
} }
pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool { pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool {
return @bitCast(c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect))); return @bitCast(c.SDL_GetWindowAspectRatio(@ptrCast(window), @ptrCast(min_aspect), @ptrCast(max_aspect)));
} }
pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool { pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool {
return @bitCast(c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right))); return @bitCast(c.SDL_GetWindowBordersSize(@ptrCast(window), @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)));
} }
pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSizeInPixels(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool { pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMinimumSize(window, min_w, min_h)); return @bitCast(c.SDL_SetWindowMinimumSize(@ptrCast(window), min_w, min_h));
} }
pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMinimumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool { pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMaximumSize(window, max_w, max_h)); return @bitCast(c.SDL_SetWindowMaximumSize(@ptrCast(window), max_w, max_h));
} }
pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMaximumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered))); return @bitCast(c.SDL_SetWindowBordered(@ptrCast(window), @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable))); return @bitCast(c.SDL_SetWindowResizable(@ptrCast(window), @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top))); return @bitCast(c.SDL_SetWindowAlwaysOnTop(@ptrCast(window), @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return @bitCast(c.SDL_ShowWindow(window)); return @bitCast(c.SDL_ShowWindow(@ptrCast(window)));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return @bitCast(c.SDL_HideWindow(window)); return @bitCast(c.SDL_HideWindow(@ptrCast(window)));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return @bitCast(c.SDL_RaiseWindow(window)); return @bitCast(c.SDL_RaiseWindow(@ptrCast(window)));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MaximizeWindow(window)); return @bitCast(c.SDL_MaximizeWindow(@ptrCast(window)));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MinimizeWindow(window)); return @bitCast(c.SDL_MinimizeWindow(@ptrCast(window)));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return @bitCast(c.SDL_RestoreWindow(window)); return @bitCast(c.SDL_RestoreWindow(@ptrCast(window)));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen))); return @bitCast(c.SDL_SetWindowFullscreen(@ptrCast(window), @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return @bitCast(c.SDL_SyncWindow(window)); return @bitCast(c.SDL_SyncWindow(@ptrCast(window)));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return @bitCast(c.SDL_WindowHasSurface(window)); return @bitCast(c.SDL_WindowHasSurface(@ptrCast(window)));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
return c.SDL_GetWindowSurface(window); return @ptrCast(c.SDL_GetWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync)); return @bitCast(c.SDL_SetWindowSurfaceVSync(@ptrCast(window), vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync))); return @bitCast(c.SDL_GetWindowSurfaceVSync(@ptrCast(window), @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_UpdateWindowSurface(window)); return @bitCast(c.SDL_UpdateWindowSurface(@ptrCast(window)));
} }
pub inline fn updateWindowSurfaceRects(window: *Window, rects: *const Rect, numrects: c_int) bool { pub inline fn updateWindowSurfaceRects(window: *Window, rects: ?*const Rect, numrects: c_int) bool {
return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects)); return @bitCast(c.SDL_UpdateWindowSurfaceRects(@ptrCast(window), @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_DestroyWindowSurface(window)); return @bitCast(c.SDL_DestroyWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowKeyboardGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowMouseGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowKeyboardGrab(window)); return @bitCast(c.SDL_GetWindowKeyboardGrab(@ptrCast(window)));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowMouseGrab(window)); return @bitCast(c.SDL_GetWindowMouseGrab(@ptrCast(window)));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect))); return @bitCast(c.SDL_SetWindowMouseRect(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) ?*const Rect {
return @ptrCast(c.SDL_GetWindowMouseRect(window)); return @ptrCast(c.SDL_GetWindowMouseRect(@ptrCast(window)));
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return @bitCast(c.SDL_SetWindowOpacity(window, opacity)); return @bitCast(c.SDL_SetWindowOpacity(@ptrCast(window), opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
return c.SDL_GetWindowOpacity(window); return c.SDL_GetWindowOpacity(@ptrCast(window));
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return @bitCast(c.SDL_SetWindowParent(window, parent)); return @bitCast(c.SDL_SetWindowParent(@ptrCast(window), @ptrCast(parent)));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal))); return @bitCast(c.SDL_SetWindowModal(@ptrCast(window), @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return @bitCast(c.SDL_SetWindowFocusable(window, @bitCast(focusable))); return @bitCast(c.SDL_SetWindowFocusable(@ptrCast(window), @bitCast(focusable)));
} }
pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool { pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_ShowWindowSystemMenu(window, x, y)); return @bitCast(c.SDL_ShowWindowSystemMenu(@ptrCast(window), x, y));
} }
pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool { pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool {
return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data)); return @bitCast(c.SDL_SetWindowHitTest(@ptrCast(window), callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowShape(window, shape)); return @bitCast(c.SDL_SetWindowShape(@ptrCast(window), @ptrCast(shape)));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation))); return @bitCast(c.SDL_FlashWindow(@ptrCast(window), @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
return c.SDL_DestroyWindow(window); return c.SDL_DestroyWindow(@ptrCast(window));
} }
pub inline fn gl_CreateContext(window: *Window) GLContext { pub inline fn gl_CreateContext(window: *Window) GLContext {
return c.SDL_GL_CreateContext(window); return c.SDL_GL_CreateContext(@ptrCast(window));
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return @bitCast(c.SDL_GL_MakeCurrent(window, context)); return @bitCast(c.SDL_GL_MakeCurrent(@ptrCast(window), context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
return c.SDL_EGL_GetWindowSurface(window); return c.SDL_EGL_GetWindowSurface(@ptrCast(window));
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return @bitCast(c.SDL_GL_SwapWindow(window)); return @bitCast(c.SDL_GL_SwapWindow(@ptrCast(window)));
} }
}; };
@ -357,6 +357,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const FlashOperation = enum(c_int) { pub const FlashOperation = enum(c_int) {
@ -437,7 +439,7 @@ pub inline fn getSystemTheme() SystemTheme {
} }
pub inline fn getDisplays(count: *c_int) ?*DisplayID { pub inline fn getDisplays(count: *c_int) ?*DisplayID {
return c.SDL_GetDisplays(@ptrCast(count)); return @ptrCast(c.SDL_GetDisplays(@ptrCast(count)));
} }
pub inline fn getPrimaryDisplay() DisplayID { pub inline fn getPrimaryDisplay() DisplayID {
@ -453,11 +455,11 @@ pub inline fn getDisplayName(displayID: DisplayID) [*c]const u8 {
} }
pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -472,48 +474,48 @@ pub inline fn getDisplayContentScale(displayID: DisplayID) f32 {
return c.SDL_GetDisplayContentScale(displayID); return c.SDL_GetDisplayContentScale(displayID);
} }
pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c][*c]DisplayMode { pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c]?*DisplayMode {
return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count))); return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count)));
} }
pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, closest: ?*DisplayMode) bool { pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, closest: ?*DisplayMode) bool {
return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(closest))); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @ptrCast(closest)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID)); return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID));
} }
pub inline fn getCurrentDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getCurrentDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID)); return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID));
} }
pub inline fn getDisplayForPoint(point: *const Point) DisplayID { pub inline fn getDisplayForPoint(point: ?*const Point) DisplayID {
return c.SDL_GetDisplayForPoint(@ptrCast(point)); return c.SDL_GetDisplayForPoint(@ptrCast(point));
} }
pub inline fn getDisplayForRect(rect: *const Rect) DisplayID { pub inline fn getDisplayForRect(rect: ?*const Rect) DisplayID {
return c.SDL_GetDisplayForRect(@ptrCast(rect)); return c.SDL_GetDisplayForRect(@ptrCast(rect));
} }
pub inline fn getWindows(count: *c_int) [*c][*c]Window { pub inline fn getWindows(count: *c_int) [*c]?*Window {
return c.SDL_GetWindows(@ptrCast(count)); return c.SDL_GetWindows(@ptrCast(count));
} }
pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreateWindow(title, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreateWindow(title, w, h, @bitCast(flags)));
} }
pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window { pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window {
return c.SDL_CreateWindowWithProperties(props); return @ptrCast(c.SDL_CreateWindowWithProperties(props));
} }
pub inline fn getWindowFromID(id: WindowID) ?*Window { pub inline fn getWindowFromID(id: WindowID) ?*Window {
return c.SDL_GetWindowFromID(id); return @ptrCast(c.SDL_GetWindowFromID(id));
} }
pub inline fn getGrabbedWindow() ?*Window { pub inline fn getGrabbedWindow() ?*Window {
return c.SDL_GetGrabbedWindow(); return @ptrCast(c.SDL_GetGrabbedWindow());
} }
pub const HitTestResult = enum(c_int) { pub const HitTestResult = enum(c_int) {
@ -576,7 +578,7 @@ pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
return c.SDL_GL_GetCurrentWindow(); return @ptrCast(c.SDL_GL_GetCurrentWindow());
} }
pub inline fn gl_GetCurrentContext() GLContext { pub inline fn gl_GetCurrentContext() GLContext {

View File

@ -41,12 +41,7 @@
"name": "SDL_GPUFence" "name": "SDL_GPUFence"
} }
], ],
"typedefs": [ "typedefs": [],
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32"
}
],
"function_pointers": [], "function_pointers": [],
"c_type_aliases": [], "c_type_aliases": [],
"enums": [ "enums": [
@ -2295,6 +2290,42 @@
} }
] ]
}, },
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_GPU_SHADERFORMAT_PRIVATE",
"value": "(1u << 0)",
"comment": "Shaders for NDA'd platforms."
},
{
"name": "SDL_GPU_SHADERFORMAT_SPIRV",
"value": "(1u << 1)",
"comment": "SPIR-V shaders for Vulkan."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXBC",
"value": "(1u << 2)",
"comment": "DXBC SM5_1 shaders for D3D12."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXIL",
"value": "(1u << 3)",
"comment": "DXIL SM6_0 shaders for D3D12."
},
{
"name": "SDL_GPU_SHADERFORMAT_MSL",
"value": "(1u << 4)",
"comment": "MSL shaders for Metal."
},
{
"name": "SDL_GPU_SHADERFORMAT_METALLIB",
"value": "(1u << 5)",
"comment": "Precompiled metallib shaders for Metal."
}
]
},
{ {
"name": "SDL_GPUColorComponentFlags", "name": "SDL_GPUColorComponentFlags",
"underlying_type": "Uint8", "underlying_type": "Uint8",

View File

@ -48,40 +48,40 @@
"values": [ "values": [
{ {
"name": "SDL_INIT_AUDIO", "name": "SDL_INIT_AUDIO",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_VIDEO", "name": "SDL_INIT_VIDEO",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread" "comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread"
}, },
{ {
"name": "SDL_INIT_JOYSTICK", "name": "SDL_INIT_JOYSTICK",
"value": "0x00000200u", "value": "(1u << 9)",
"comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD" "comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD"
}, },
{ {
"name": "SDL_INIT_HAPTIC", "name": "SDL_INIT_HAPTIC",
"value": "0x00001000u" "value": "(1u << 12)"
}, },
{ {
"name": "SDL_INIT_GAMEPAD", "name": "SDL_INIT_GAMEPAD",
"value": "0x00002000u", "value": "(1u << 13)",
"comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`" "comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`"
}, },
{ {
"name": "SDL_INIT_EVENTS", "name": "SDL_INIT_EVENTS",
"value": "0x00004000u" "value": "(1u << 14)"
}, },
{ {
"name": "SDL_INIT_SENSOR", "name": "SDL_INIT_SENSOR",
"value": "0x00008000u", "value": "(1u << 15)",
"comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_CAMERA", "name": "SDL_INIT_CAMERA",
"value": "0x00010000u", "value": "(1u << 16)",
"comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`"
} }
] ]

View File

@ -122,27 +122,27 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_ERROR", "name": "SDL_MESSAGEBOX_ERROR",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "error dialog" "comment": "error dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_WARNING", "name": "SDL_MESSAGEBOX_WARNING",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "warning dialog" "comment": "warning dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_INFORMATION", "name": "SDL_MESSAGEBOX_INFORMATION",
"value": "0x00000040u", "value": "(1u << 6)",
"comment": "informational dialog" "comment": "informational dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT", "name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT",
"value": "0x00000080u", "value": "(1u << 7)",
"comment": "buttons placed left to right" "comment": "buttons placed left to right"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT", "name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT",
"value": "0x00000100u", "value": "(1u << 8)",
"comment": "buttons placed right to left" "comment": "buttons placed right to left"
} }
] ]
@ -153,12 +153,12 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Marks the default button when return is hit" "comment": "Marks the default button when return is hit"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Marks the default button when escape is hit" "comment": "Marks the default button when escape is hit"
} }
] ]

View File

@ -125,23 +125,15 @@
"values": [ "values": [
{ {
"name": "SDL_BUTTON_LEFT", "name": "SDL_BUTTON_LEFT",
"value": "1" "value": "(1u << 0)"
}, },
{ {
"name": "SDL_BUTTON_MIDDLE", "name": "SDL_BUTTON_MIDDLE",
"value": "2" "value": "(1u << 1)"
},
{
"name": "SDL_BUTTON_RIGHT",
"value": "3"
}, },
{ {
"name": "SDL_BUTTON_X1", "name": "SDL_BUTTON_X1",
"value": "4" "value": "(1u << 2)"
},
{
"name": "SDL_BUTTON_X2",
"value": "5"
} }
] ]
} }

View File

@ -49,22 +49,22 @@
"values": [ "values": [
{ {
"name": "SDL_SURFACE_PREALLOCATED", "name": "SDL_SURFACE_PREALLOCATED",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Surface uses preallocated pixel memory" "comment": "Surface uses preallocated pixel memory"
}, },
{ {
"name": "SDL_SURFACE_LOCK_NEEDED", "name": "SDL_SURFACE_LOCK_NEEDED",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Surface needs to be locked to access pixels" "comment": "Surface needs to be locked to access pixels"
}, },
{ {
"name": "SDL_SURFACE_LOCKED", "name": "SDL_SURFACE_LOCKED",
"value": "0x00000004u", "value": "(1u << 2)",
"comment": "Surface is currently locked" "comment": "Surface is currently locked"
}, },
{ {
"name": "SDL_SURFACE_SIMD_ALIGNED", "name": "SDL_SURFACE_SIMD_ALIGNED",
"value": "0x00000008u", "value": "(1u << 3)",
"comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()" "comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()"
} }
] ]

View File

@ -349,127 +349,127 @@
"values": [ "values": [
{ {
"name": "SDL_WINDOW_FULLSCREEN", "name": "SDL_WINDOW_FULLSCREEN",
"value": "SDL_UINT64_C(0x0000000000000001)", "value": "(1u << 0)",
"comment": "window is in fullscreen mode" "comment": "window is in fullscreen mode"
}, },
{ {
"name": "SDL_WINDOW_OPENGL", "name": "SDL_WINDOW_OPENGL",
"value": "SDL_UINT64_C(0x0000000000000002)", "value": "(1u << 1)",
"comment": "window usable with OpenGL context" "comment": "window usable with OpenGL context"
}, },
{ {
"name": "SDL_WINDOW_OCCLUDED", "name": "SDL_WINDOW_OCCLUDED",
"value": "SDL_UINT64_C(0x0000000000000004)", "value": "(1u << 2)",
"comment": "window is occluded" "comment": "window is occluded"
}, },
{ {
"name": "SDL_WINDOW_HIDDEN", "name": "SDL_WINDOW_HIDDEN",
"value": "SDL_UINT64_C(0x0000000000000008)", "value": "(1u << 3)",
"comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible" "comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible"
}, },
{ {
"name": "SDL_WINDOW_BORDERLESS", "name": "SDL_WINDOW_BORDERLESS",
"value": "SDL_UINT64_C(0x0000000000000010)", "value": "(1u << 4)",
"comment": "no window decoration" "comment": "no window decoration"
}, },
{ {
"name": "SDL_WINDOW_RESIZABLE", "name": "SDL_WINDOW_RESIZABLE",
"value": "SDL_UINT64_C(0x0000000000000020)", "value": "(1u << 5)",
"comment": "window can be resized" "comment": "window can be resized"
}, },
{ {
"name": "SDL_WINDOW_MINIMIZED", "name": "SDL_WINDOW_MINIMIZED",
"value": "SDL_UINT64_C(0x0000000000000040)", "value": "(1u << 6)",
"comment": "window is minimized" "comment": "window is minimized"
}, },
{ {
"name": "SDL_WINDOW_MAXIMIZED", "name": "SDL_WINDOW_MAXIMIZED",
"value": "SDL_UINT64_C(0x0000000000000080)", "value": "(1u << 7)",
"comment": "window is maximized" "comment": "window is maximized"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_GRABBED", "name": "SDL_WINDOW_MOUSE_GRABBED",
"value": "SDL_UINT64_C(0x0000000000000100)", "value": "(1u << 8)",
"comment": "window has grabbed mouse input" "comment": "window has grabbed mouse input"
}, },
{ {
"name": "SDL_WINDOW_INPUT_FOCUS", "name": "SDL_WINDOW_INPUT_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000200)", "value": "(1u << 9)",
"comment": "window has input focus" "comment": "window has input focus"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_FOCUS", "name": "SDL_WINDOW_MOUSE_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000400)", "value": "(1u << 10)",
"comment": "window has mouse focus" "comment": "window has mouse focus"
}, },
{ {
"name": "SDL_WINDOW_EXTERNAL", "name": "SDL_WINDOW_EXTERNAL",
"value": "SDL_UINT64_C(0x0000000000000800)", "value": "(1u << 11)",
"comment": "window not created by SDL" "comment": "window not created by SDL"
}, },
{ {
"name": "SDL_WINDOW_MODAL", "name": "SDL_WINDOW_MODAL",
"value": "SDL_UINT64_C(0x0000000000001000)", "value": "(1u << 12)",
"comment": "window is modal" "comment": "window is modal"
}, },
{ {
"name": "SDL_WINDOW_HIGH_PIXEL_DENSITY", "name": "SDL_WINDOW_HIGH_PIXEL_DENSITY",
"value": "SDL_UINT64_C(0x0000000000002000)", "value": "(1u << 13)",
"comment": "window uses high pixel density back buffer if possible" "comment": "window uses high pixel density back buffer if possible"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_CAPTURE", "name": "SDL_WINDOW_MOUSE_CAPTURE",
"value": "SDL_UINT64_C(0x0000000000004000)", "value": "(1u << 14)",
"comment": "window has mouse captured (unrelated to MOUSE_GRABBED)" "comment": "window has mouse captured (unrelated to MOUSE_GRABBED)"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_RELATIVE_MODE", "name": "SDL_WINDOW_MOUSE_RELATIVE_MODE",
"value": "SDL_UINT64_C(0x0000000000008000)", "value": "(1u << 15)",
"comment": "window has relative mode enabled" "comment": "window has relative mode enabled"
}, },
{ {
"name": "SDL_WINDOW_ALWAYS_ON_TOP", "name": "SDL_WINDOW_ALWAYS_ON_TOP",
"value": "SDL_UINT64_C(0x0000000000010000)", "value": "(1u << 16)",
"comment": "window should always be above others" "comment": "window should always be above others"
}, },
{ {
"name": "SDL_WINDOW_UTILITY", "name": "SDL_WINDOW_UTILITY",
"value": "SDL_UINT64_C(0x0000000000020000)", "value": "(1u << 17)",
"comment": "window should be treated as a utility window, not showing in the task bar and window list" "comment": "window should be treated as a utility window, not showing in the task bar and window list"
}, },
{ {
"name": "SDL_WINDOW_TOOLTIP", "name": "SDL_WINDOW_TOOLTIP",
"value": "SDL_UINT64_C(0x0000000000040000)", "value": "(1u << 18)",
"comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window" "comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_POPUP_MENU", "name": "SDL_WINDOW_POPUP_MENU",
"value": "SDL_UINT64_C(0x0000000000080000)", "value": "(1u << 19)",
"comment": "window should be treated as a popup menu, requires a parent window" "comment": "window should be treated as a popup menu, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_KEYBOARD_GRABBED", "name": "SDL_WINDOW_KEYBOARD_GRABBED",
"value": "SDL_UINT64_C(0x0000000000100000)", "value": "(1u << 20)",
"comment": "window has grabbed keyboard input" "comment": "window has grabbed keyboard input"
}, },
{ {
"name": "SDL_WINDOW_VULKAN", "name": "SDL_WINDOW_VULKAN",
"value": "SDL_UINT64_C(0x0000000010000000)", "value": "(1u << 28)",
"comment": "window usable for Vulkan surface" "comment": "window usable for Vulkan surface"
}, },
{ {
"name": "SDL_WINDOW_METAL", "name": "SDL_WINDOW_METAL",
"value": "SDL_UINT64_C(0x0000000020000000)", "value": "(1u << 29)",
"comment": "window usable for Metal view" "comment": "window usable for Metal view"
}, },
{ {
"name": "SDL_WINDOW_TRANSPARENT", "name": "SDL_WINDOW_TRANSPARENT",
"value": "SDL_UINT64_C(0x0000000040000000)", "value": "(1u << 30)",
"comment": "window with transparent buffer" "comment": "window with transparent buffer"
}, },
{ {
"name": "SDL_WINDOW_NOT_FOCUSABLE", "name": "SDL_WINDOW_NOT_FOCUSABLE",
"value": "SDL_UINT64_C(0x0000000080000000)", "value": "(1u << 31)",
"comment": "window should not be focusable" "comment": "window should not be focusable"
} }
] ]

View File

@ -5,7 +5,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, 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 @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV_IO(@ptrCast(iostream), @bitCast(closeio), @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -31,111 +31,111 @@ pub const AudioSpec = extern struct {
pub const AudioStream = opaque { pub const AudioStream = opaque {
pub inline fn unbindAudioStream(audiostream: *AudioStream) void { pub inline fn unbindAudioStream(audiostream: *AudioStream) void {
return c.SDL_UnbindAudioStream(audiostream); return c.SDL_UnbindAudioStream(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID { pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID {
return c.SDL_GetAudioStreamDevice(audiostream); return c.SDL_GetAudioStreamDevice(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID { pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID {
return c.SDL_GetAudioStreamProperties(audiostream); return c.SDL_GetAudioStreamProperties(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool { pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool {
return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec)); return @bitCast(c.SDL_GetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: *const AudioSpec, dst_spec: *const AudioSpec) bool { pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) bool {
return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec))); return @bitCast(c.SDL_SetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamFrequencyRatio(audiostream); return c.SDL_GetAudioStreamFrequencyRatio(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio)); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(@ptrCast(audiostream), ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamGain(audiostream); return c.SDL_GetAudioStreamGain(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain)); return @bitCast(c.SDL_SetAudioStreamGain(@ptrCast(audiostream), gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool { pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool {
return @bitCast(c.SDL_PutAudioStreamData(audiostream, buf, len)); return @bitCast(c.SDL_PutAudioStreamData(@ptrCast(audiostream), buf, len));
} }
pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int { pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int {
return c.SDL_GetAudioStreamData(audiostream, buf, len); return c.SDL_GetAudioStreamData(@ptrCast(audiostream), buf, len);
} }
pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamAvailable(audiostream); return c.SDL_GetAudioStreamAvailable(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamQueued(audiostream); return c.SDL_GetAudioStreamQueued(@ptrCast(audiostream));
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_FlushAudioStream(audiostream)); return @bitCast(c.SDL_FlushAudioStream(@ptrCast(audiostream)));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ClearAudioStream(audiostream)); return @bitCast(c.SDL_ClearAudioStream(@ptrCast(audiostream)));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream)); return @bitCast(c.SDL_PauseAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream)); return @bitCast(c.SDL_ResumeAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool { pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_AudioStreamDevicePaused(audiostream)); return @bitCast(c.SDL_AudioStreamDevicePaused(@ptrCast(audiostream)));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_LockAudioStream(audiostream)); return @bitCast(c.SDL_LockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_UnlockAudioStream(audiostream)); return @bitCast(c.SDL_UnlockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamGetCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamPutCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
return c.SDL_DestroyAudioStream(audiostream); return c.SDL_DestroyAudioStream(@ptrCast(audiostream));
} }
}; };
@ -152,11 +152,11 @@ pub inline fn getCurrentAudioDriver() [*c]const u8 {
} }
pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioPlaybackDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioPlaybackDevices(@ptrCast(count)));
} }
pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioRecordingDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioRecordingDevices(@ptrCast(count)));
} }
pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 { pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
@ -164,14 +164,14 @@ pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
} }
pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool { pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool {
return @bitCast(c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames))); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, @ptrCast(spec), @ptrCast(sample_frames)));
} }
pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int { pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count)));
} }
pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) AudioDeviceID { pub inline fn openAudioDevice(devid: AudioDeviceID, spec: ?*const AudioSpec) AudioDeviceID {
return c.SDL_OpenAudioDevice(devid, @ptrCast(spec)); return c.SDL_OpenAudioDevice(devid, @ptrCast(spec));
} }
@ -207,26 +207,26 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
return c.SDL_CloseAudioDevice(devid); return c.SDL_CloseAudioDevice(devid);
} }
pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]*const AudioStream, num_streams: c_int) bool { pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]?*const AudioStream, num_streams: c_int) bool {
return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams)); return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams));
} }
pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool { pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool {
return @bitCast(c.SDL_BindAudioStream(devid, stream)); return @bitCast(c.SDL_BindAudioStream(devid, @ptrCast(stream)));
} }
pub inline fn unbindAudioStreams(streams: [*c]*const AudioStream, num_streams: c_int) void { pub inline fn unbindAudioStreams(streams: [*c]?*const AudioStream, num_streams: c_int) void {
return c.SDL_UnbindAudioStreams(streams, num_streams); return c.SDL_UnbindAudioStreams(streams, num_streams);
} }
pub inline fn createAudioStream(src_spec: *const AudioSpec, dst_spec: *const AudioSpec) ?*AudioStream { pub inline fn createAudioStream(src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) ?*AudioStream {
return c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)); return @ptrCast(c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub const AudioStreamCallback = c.SDL_AudioStreamCallback; pub const AudioStreamCallback = c.SDL_AudioStreamCallback;
pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream { pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: ?*const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream {
return c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata); return @ptrCast(c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata));
} }
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
@ -236,14 +236,14 @@ pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostm
} }
pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool {
return @bitCast(c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV(path, @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool { pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool {
return @bitCast(c.SDL_MixAudio(dst, src, @bitCast(format), len, volume)); return @bitCast(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: [*c][*c]u8, 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 @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len))); return @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len)));
} }

View File

@ -51,31 +51,31 @@ pub const CameraID = u32;
pub const Camera = opaque { pub const Camera = opaque {
pub inline fn getCameraPermissionState(camera: *Camera) c_int { pub inline fn getCameraPermissionState(camera: *Camera) c_int {
return c.SDL_GetCameraPermissionState(camera); return c.SDL_GetCameraPermissionState(@ptrCast(camera));
} }
pub inline fn getCameraID(camera: *Camera) CameraID { pub inline fn getCameraID(camera: *Camera) CameraID {
return c.SDL_GetCameraID(camera); return c.SDL_GetCameraID(@ptrCast(camera));
} }
pub inline fn getCameraProperties(camera: *Camera) PropertiesID { pub inline fn getCameraProperties(camera: *Camera) PropertiesID {
return c.SDL_GetCameraProperties(camera); return c.SDL_GetCameraProperties(@ptrCast(camera));
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return @bitCast(c.SDL_GetCameraFormat(camera, spec)); return @bitCast(c.SDL_GetCameraFormat(@ptrCast(camera), @ptrCast(spec)));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {
return c.SDL_AcquireCameraFrame(camera, @ptrCast(timestampNS)); return @ptrCast(c.SDL_AcquireCameraFrame(@ptrCast(camera), @ptrCast(timestampNS)));
} }
pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void { pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void {
return c.SDL_ReleaseCameraFrame(camera, frame); return c.SDL_ReleaseCameraFrame(@ptrCast(camera), @ptrCast(frame));
} }
pub inline fn closeCamera(camera: *Camera) void { pub inline fn closeCamera(camera: *Camera) void {
return c.SDL_CloseCamera(camera); return c.SDL_CloseCamera(@ptrCast(camera));
} }
}; };
@ -107,10 +107,10 @@ pub inline fn getCurrentCameraDriver() [*c]const u8 {
} }
pub inline fn getCameras(count: *c_int) ?*CameraID { pub inline fn getCameras(count: *c_int) ?*CameraID {
return c.SDL_GetCameras(@ptrCast(count)); return @ptrCast(c.SDL_GetCameras(@ptrCast(count)));
} }
pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c][*c]CameraSpec { pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c]?*CameraSpec {
return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count)); return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count));
} }
@ -122,6 +122,6 @@ pub inline fn getCameraPosition(instance_id: CameraID) CameraPosition {
return c.SDL_GetCameraPosition(instance_id); return c.SDL_GetCameraPosition(instance_id);
} }
pub inline fn openCamera(instance_id: CameraID, spec: *const CameraSpec) ?*Camera { pub inline fn openCamera(instance_id: CameraID, spec: ?*const CameraSpec) ?*Camera {
return c.SDL_OpenCamera(instance_id, @ptrCast(spec)); return @ptrCast(c.SDL_OpenCamera(instance_id, @ptrCast(spec)));
} }

View File

@ -12,16 +12,16 @@ pub const DialogFileFilter = extern struct {
pub const DialogFileCallback = c.SDL_DialogFileCallback; pub const DialogFileCallback = c.SDL_DialogFileCallback;
pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location, @bitCast(allow_many));
} }
pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void { pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void {
return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location); return c.SDL_ShowSaveFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location);
} }
pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFolderDialog(callback, userdata, @ptrCast(window), default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -21,6 +21,8 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const MouseButtonFlags = packed struct(u32) { pub const MouseButtonFlags = packed struct(u32) {
@ -29,6 +31,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const Scancode = enum(c_int) {
@ -694,7 +700,7 @@ pub const EventAction = enum(c_int) {
}; };
pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int { pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int {
return c.SDL_PeepEvents(events, numevents, action, minType, maxType); return c.SDL_PeepEvents(@ptrCast(events), numevents, action, minType, maxType);
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
@ -714,19 +720,19 @@ pub inline fn flushEvents(minType: u32, maxType: u32) void {
} }
pub inline fn pollEvent(event: ?*Event) bool { pub inline fn pollEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PollEvent(event)); return @bitCast(c.SDL_PollEvent(@ptrCast(event)));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return @bitCast(c.SDL_WaitEvent(event)); return @bitCast(c.SDL_WaitEvent(@ptrCast(event)));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS)); return @bitCast(c.SDL_WaitEventTimeout(@ptrCast(event), timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PushEvent(event)); return @bitCast(c.SDL_PushEvent(@ptrCast(event)));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,7 +742,7 @@ pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool { pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool {
return @bitCast(c.SDL_GetEventFilter(filter, userdata)); return @bitCast(c.SDL_GetEventFilter(@ptrCast(filter), userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
@ -763,6 +769,6 @@ pub inline fn registerEvents(numevents: c_int) u32 {
return c.SDL_RegisterEvents(numevents); return c.SDL_RegisterEvents(numevents);
} }
pub inline fn getWindowFromEvent(event: *const Event) ?*Window { pub inline fn getWindowFromEvent(event: ?*const Event) ?*Window {
return c.SDL_GetWindowFromEvent(@ptrCast(event)); return @ptrCast(c.SDL_GetWindowFromEvent(@ptrCast(event)));
} }

View File

@ -49,6 +49,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
@ -80,7 +82,7 @@ pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetPathInfo(path, info)); return @bitCast(c.SDL_GetPathInfo(path, @ptrCast(info)));
} }
pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {

View File

@ -15,7 +15,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int { pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int {
return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio)); return c.SDL_AddGamepadMappingsFromIO(@ptrCast(iostream), @bitCast(closeio));
} }
}; };
@ -45,163 +45,163 @@ pub const Joystick = opaque {};
pub const Gamepad = opaque { pub const Gamepad = opaque {
pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 { pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 {
return c.SDL_GetGamepadMapping(gamepad); return c.SDL_GetGamepadMapping(@ptrCast(gamepad));
} }
pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID { pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID {
return c.SDL_GetGamepadProperties(gamepad); return c.SDL_GetGamepadProperties(@ptrCast(gamepad));
} }
pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID { pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID {
return c.SDL_GetGamepadID(gamepad); return c.SDL_GetGamepadID(@ptrCast(gamepad));
} }
pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadName(gamepad); return c.SDL_GetGamepadName(@ptrCast(gamepad));
} }
pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadPath(gamepad); return c.SDL_GetGamepadPath(@ptrCast(gamepad));
} }
pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetGamepadType(gamepad)); return @intFromEnum(c.SDL_GetGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetRealGamepadType(gamepad)); return @intFromEnum(c.SDL_GetRealGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int { pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int {
return c.SDL_GetGamepadPlayerIndex(gamepad); return c.SDL_GetGamepadPlayerIndex(@ptrCast(gamepad));
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index)); return @bitCast(c.SDL_SetGamepadPlayerIndex(@ptrCast(gamepad), player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadVendor(gamepad); return c.SDL_GetGamepadVendor(@ptrCast(gamepad));
} }
pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 { pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProduct(gamepad); return c.SDL_GetGamepadProduct(@ptrCast(gamepad));
} }
pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProductVersion(gamepad); return c.SDL_GetGamepadProductVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadFirmwareVersion(gamepad); return c.SDL_GetGamepadFirmwareVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadSerial(gamepad); return c.SDL_GetGamepadSerial(@ptrCast(gamepad));
} }
pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 { pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 {
return c.SDL_GetGamepadSteamHandle(gamepad); return c.SDL_GetGamepadSteamHandle(@ptrCast(gamepad));
} }
pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState { pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState {
return c.SDL_GetGamepadConnectionState(gamepad); return c.SDL_GetGamepadConnectionState(@ptrCast(gamepad));
} }
pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState { pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState {
return c.SDL_GetGamepadPowerInfo(gamepad, @ptrCast(percent)); return c.SDL_GetGamepadPowerInfo(@ptrCast(gamepad), @ptrCast(percent));
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return @bitCast(c.SDL_GamepadConnected(gamepad)); return @bitCast(c.SDL_GamepadConnected(@ptrCast(gamepad)));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
return c.SDL_GetGamepadJoystick(gamepad); return @ptrCast(c.SDL_GetGamepadJoystick(@ptrCast(gamepad)));
} }
pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c][*c]GamepadBinding { pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c]?*GamepadBinding {
return c.SDL_GetGamepadBindings(gamepad, @ptrCast(count)); return c.SDL_GetGamepadBindings(@ptrCast(gamepad), @ptrCast(count));
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis)); return @bitCast(c.SDL_GamepadHasAxis(@ptrCast(gamepad), axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
return c.SDL_GetGamepadAxis(gamepad, axis); return c.SDL_GetGamepadAxis(@ptrCast(gamepad), axis);
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GamepadHasButton(gamepad, button)); return @bitCast(c.SDL_GamepadHasButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GetGamepadButton(gamepad, button)); return @bitCast(c.SDL_GetGamepadButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
return c.SDL_GetGamepadButtonLabel(gamepad, button); return c.SDL_GetGamepadButtonLabel(@ptrCast(gamepad), button);
} }
pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int { pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int {
return c.SDL_GetNumGamepadTouchpads(gamepad); return c.SDL_GetNumGamepadTouchpads(@ptrCast(gamepad));
} }
pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int { pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int {
return c.SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad); return c.SDL_GetNumGamepadTouchpadFingers(@ptrCast(gamepad), touchpad);
} }
pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool { pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool {
return @bitCast(c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure))); return @bitCast(c.SDL_GetGamepadTouchpadFinger(@ptrCast(gamepad), touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)));
} }
pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadHasSensor(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool { pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool {
return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled))); return @bitCast(c.SDL_SetGamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(_type)); return c.SDL_GetGamepadSensorDataRate(@ptrCast(gamepad), @intFromEnum(_type));
} }
pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool { pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values)); return @bitCast(c.SDL_GetGamepadSensorData(@ptrCast(gamepad), @intFromEnum(_type), @ptrCast(data), num_values));
} }
pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepad(@ptrCast(gamepad), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepadTriggers(@ptrCast(gamepad), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool { pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetGamepadLED(gamepad, red, green, blue)); return @bitCast(c.SDL_SetGamepadLED(@ptrCast(gamepad), red, green, blue));
} }
pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size)); return @bitCast(c.SDL_SendGamepadEffect(@ptrCast(gamepad), data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
return c.SDL_CloseGamepad(gamepad); return c.SDL_CloseGamepad(@ptrCast(gamepad));
} }
pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button); return c.SDL_GetGamepadAppleSFSymbolsNameForButton(@ptrCast(gamepad), button);
} }
pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis); return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(@ptrCast(gamepad), axis);
} }
}; };
@ -308,7 +308,7 @@ pub inline fn hasGamepad() bool {
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
return c.SDL_GetGamepads(@ptrCast(count)); return @ptrCast(c.SDL_GetGamepads(@ptrCast(count)));
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
@ -356,15 +356,15 @@ pub inline fn getGamepadMappingForID(instance_id: JoystickID) [*c]u8 {
} }
pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad { pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad {
return c.SDL_OpenGamepad(instance_id); return @ptrCast(c.SDL_OpenGamepad(instance_id));
} }
pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad { pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad {
return c.SDL_GetGamepadFromID(instance_id); return @ptrCast(c.SDL_GetGamepadFromID(instance_id));
} }
pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad { pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
return c.SDL_GetGamepadFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetGamepadFromPlayerIndex(player_index));
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {

View File

@ -27,155 +27,155 @@ pub const FlipMode = enum(c_int) {
pub const GPUDevice = opaque { pub const GPUDevice = opaque {
pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void {
return c.SDL_DestroyGPUDevice(gpudevice); return c.SDL_DestroyGPUDevice(@ptrCast(gpudevice));
} }
pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 { pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 {
return c.SDL_GetGPUDeviceDriver(gpudevice); return c.SDL_GetGPUDeviceDriver(@ptrCast(gpudevice));
} }
pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat { pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat {
return @bitCast(c.SDL_GetGPUShaderFormats(gpudevice)); return @bitCast(c.SDL_GetGPUShaderFormats(@ptrCast(gpudevice)));
} }
pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: *const GPUComputePipelineCreateInfo) ?*GPUComputePipeline { pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUComputePipelineCreateInfo) ?*GPUComputePipeline {
return c.SDL_CreateGPUComputePipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: *const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline { pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline {
return c.SDL_CreateGPUGraphicsPipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: *const GPUSamplerCreateInfo) ?*GPUSampler { pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: ?*const GPUSamplerCreateInfo) ?*GPUSampler {
return c.SDL_CreateGPUSampler(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUSampler(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: *const GPUShaderCreateInfo) ?*GPUShader { pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: ?*const GPUShaderCreateInfo) ?*GPUShader {
return c.SDL_CreateGPUShader(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUShader(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: *const GPUTextureCreateInfo) ?*GPUTexture { pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: ?*const GPUTextureCreateInfo) ?*GPUTexture {
return c.SDL_CreateGPUTexture(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTexture(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: *const GPUBufferCreateInfo) ?*GPUBuffer { pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUBufferCreateInfo) ?*GPUBuffer {
return c.SDL_CreateGPUBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: *const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer { pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer {
return c.SDL_CreateGPUTransferBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void { pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void {
return c.SDL_SetGPUBufferName(gpudevice, buffer, text); return c.SDL_SetGPUBufferName(@ptrCast(gpudevice), @ptrCast(buffer), text);
} }
pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void { pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void {
return c.SDL_SetGPUTextureName(gpudevice, texture, text); return c.SDL_SetGPUTextureName(@ptrCast(gpudevice), @ptrCast(texture), text);
} }
pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void { pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void {
return c.SDL_ReleaseGPUTexture(gpudevice, texture); return c.SDL_ReleaseGPUTexture(@ptrCast(gpudevice), @ptrCast(texture));
} }
pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void { pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void {
return c.SDL_ReleaseGPUSampler(gpudevice, sampler); return c.SDL_ReleaseGPUSampler(@ptrCast(gpudevice), @ptrCast(sampler));
} }
pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void { pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void {
return c.SDL_ReleaseGPUBuffer(gpudevice, buffer); return c.SDL_ReleaseGPUBuffer(@ptrCast(gpudevice), @ptrCast(buffer));
} }
pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_ReleaseGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_ReleaseGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_ReleaseGPUComputePipeline(gpudevice, compute_pipeline); return c.SDL_ReleaseGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(compute_pipeline));
} }
pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void { pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void {
return c.SDL_ReleaseGPUShader(gpudevice, shader); return c.SDL_ReleaseGPUShader(@ptrCast(gpudevice), @ptrCast(shader));
} }
pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_ReleaseGPUGraphicsPipeline(gpudevice, graphics_pipeline); return c.SDL_ReleaseGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(graphics_pipeline));
} }
pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer { pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer {
return c.SDL_AcquireGPUCommandBuffer(gpudevice); return @ptrCast(c.SDL_AcquireGPUCommandBuffer(@ptrCast(gpudevice)));
} }
pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque { pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque {
return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle)); return c.SDL_MapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer), @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_UnmapGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_UnmapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool { pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool {
return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition)); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition));
} }
pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool { pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode))); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(@ptrCast(gpudevice), @ptrCast(window), @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window)); return @bitCast(c.SDL_ClaimWindowForGPUDevice(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
return c.SDL_ReleaseWindowFromGPUDevice(gpudevice, window); return c.SDL_ReleaseWindowFromGPUDevice(@ptrCast(gpudevice), @ptrCast(window));
} }
pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool { pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode))); return @bitCast(c.SDL_SetGPUSwapchainParameters(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition, @intFromEnum(present_mode)));
} }
pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool { pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool {
return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight)); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(@ptrCast(gpudevice), allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(gpudevice, window)); return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window)); return @bitCast(c.SDL_WaitForGPUSwapchain(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return @bitCast(c.SDL_WaitForGPUIdle(gpudevice)); return @bitCast(c.SDL_WaitForGPUIdle(@ptrCast(gpudevice)));
} }
pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]*const GPUFence, num_fences: u32) bool { pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]?*const GPUFence, num_fences: u32) bool {
return @bitCast(c.SDL_WaitForGPUFences(gpudevice, @bitCast(wait_all), fences, num_fences)); return @bitCast(c.SDL_WaitForGPUFences(@ptrCast(gpudevice), @bitCast(wait_all), fences, num_fences));
} }
pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool { pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool {
return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence)); return @bitCast(c.SDL_QueryGPUFence(@ptrCast(gpudevice), @ptrCast(fence)));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
return c.SDL_ReleaseGPUFence(gpudevice, fence); return c.SDL_ReleaseGPUFence(@ptrCast(gpudevice), @ptrCast(fence));
} }
pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool { pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool {
return @bitCast(c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage))); return @bitCast(c.SDL_GPUTextureSupportsFormat(@ptrCast(gpudevice), @bitCast(format), @intFromEnum(_type), @bitCast(usage)));
} }
pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool { pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool {
return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count)); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(@ptrCast(gpudevice), @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKSuspendGPU(gpudevice); return c.SDL_GDKSuspendGPU(@ptrCast(gpudevice));
} }
pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void { pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKResumeGPU(gpudevice); return c.SDL_GDKResumeGPU(@ptrCast(gpudevice));
} }
}; };
@ -195,201 +195,201 @@ pub const GPUGraphicsPipeline = opaque {};
pub const GPUCommandBuffer = opaque { pub const GPUCommandBuffer = opaque {
pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void { pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void {
return c.SDL_InsertGPUDebugLabel(gpucommandbuffer, text); return c.SDL_InsertGPUDebugLabel(@ptrCast(gpucommandbuffer), text);
} }
pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void { pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void {
return c.SDL_PushGPUDebugGroup(gpucommandbuffer, name); return c.SDL_PushGPUDebugGroup(@ptrCast(gpucommandbuffer), name);
} }
pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void { pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void {
return c.SDL_PopGPUDebugGroup(gpucommandbuffer); return c.SDL_PopGPUDebugGroup(@ptrCast(gpucommandbuffer));
} }
pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUVertexUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUVertexUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUFragmentUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUFragmentUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUComputeUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUComputeUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: *const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: *const GPUDepthStencilTargetInfo) ?*GPURenderPass { pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: ?*const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: ?*const GPUDepthStencilTargetInfo) ?*GPURenderPass {
return c.SDL_BeginGPURenderPass(gpucommandbuffer, @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)); return @ptrCast(c.SDL_BeginGPURenderPass(@ptrCast(gpucommandbuffer), @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)));
} }
pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: *const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: *const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass { pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: ?*const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: ?*const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass {
return c.SDL_BeginGPUComputePass(gpucommandbuffer, @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings); return @ptrCast(c.SDL_BeginGPUComputePass(@ptrCast(gpucommandbuffer), @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings));
} }
pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass { pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass {
return c.SDL_BeginGPUCopyPass(gpucommandbuffer); return @ptrCast(c.SDL_BeginGPUCopyPass(@ptrCast(gpucommandbuffer)));
} }
pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void { pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void {
return c.SDL_GenerateMipmapsForGPUTexture(gpucommandbuffer, texture); return c.SDL_GenerateMipmapsForGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(texture));
} }
pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: *const GPUBlitInfo) void { pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: ?*const GPUBlitInfo) void {
return c.SDL_BlitGPUTexture(gpucommandbuffer, @ptrCast(info)); return c.SDL_BlitGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(info));
} }
pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_SubmitGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
return c.SDL_SubmitGPUCommandBufferAndAcquireFence(gpucommandbuffer); return @ptrCast(c.SDL_SubmitGPUCommandBufferAndAcquireFence(@ptrCast(gpucommandbuffer)));
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_CancelGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
}; };
pub const GPURenderPass = opaque { pub const GPURenderPass = opaque {
pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_BindGPUGraphicsPipeline(gpurenderpass, graphics_pipeline); return c.SDL_BindGPUGraphicsPipeline(@ptrCast(gpurenderpass), @ptrCast(graphics_pipeline));
} }
pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: *const GPUViewport) void { pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: ?*const GPUViewport) void {
return c.SDL_SetGPUViewport(gpurenderpass, @ptrCast(viewport)); return c.SDL_SetGPUViewport(@ptrCast(gpurenderpass), @ptrCast(viewport));
} }
pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: *const Rect) void { pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: ?*const Rect) void {
return c.SDL_SetGPUScissor(gpurenderpass, @ptrCast(scissor)); return c.SDL_SetGPUScissor(@ptrCast(gpurenderpass), @ptrCast(scissor));
} }
pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void { pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void {
return c.SDL_SetGPUBlendConstants(gpurenderpass, blend_constants); return c.SDL_SetGPUBlendConstants(@ptrCast(gpurenderpass), blend_constants);
} }
pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void { pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void {
return c.SDL_SetGPUStencilReference(gpurenderpass, reference); return c.SDL_SetGPUStencilReference(@ptrCast(gpurenderpass), reference);
} }
pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: *const GPUBufferBinding, num_bindings: u32) void { pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: ?*const GPUBufferBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexBuffers(gpurenderpass, first_slot, @ptrCast(bindings), num_bindings); return c.SDL_BindGPUVertexBuffers(@ptrCast(gpurenderpass), first_slot, @ptrCast(bindings), num_bindings);
} }
pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: *const GPUBufferBinding, index_element_size: GPUIndexElementSize) void { pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: ?*const GPUBufferBinding, index_element_size: GPUIndexElementSize) void {
return c.SDL_BindGPUIndexBuffer(gpurenderpass, @ptrCast(binding), index_element_size); return c.SDL_BindGPUIndexBuffer(@ptrCast(gpurenderpass), @ptrCast(binding), index_element_size);
} }
pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUVertexSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUVertexStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUVertexStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUFragmentSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUFragmentSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUFragmentStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUFragmentStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void { pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void {
return c.SDL_DrawGPUIndexedPrimitives(gpurenderpass, num_indices, num_instances, first_index, vertex_offset, first_instance); return c.SDL_DrawGPUIndexedPrimitives(@ptrCast(gpurenderpass), num_indices, num_instances, first_index, vertex_offset, first_instance);
} }
pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void { pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void {
return c.SDL_DrawGPUPrimitives(gpurenderpass, num_vertices, num_instances, first_vertex, first_instance); return c.SDL_DrawGPUPrimitives(@ptrCast(gpurenderpass), num_vertices, num_instances, first_vertex, first_instance);
} }
pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUIndexedPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUIndexedPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void { pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void {
return c.SDL_EndGPURenderPass(gpurenderpass); return c.SDL_EndGPURenderPass(@ptrCast(gpurenderpass));
} }
}; };
pub const GPUComputePass = opaque { pub const GPUComputePass = opaque {
pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_BindGPUComputePipeline(gpucomputepass, compute_pipeline); return c.SDL_BindGPUComputePipeline(@ptrCast(gpucomputepass), @ptrCast(compute_pipeline));
} }
pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUComputeSamplers(gpucomputepass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUComputeSamplers(@ptrCast(gpucomputepass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageTextures(gpucomputepass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUComputeStorageTextures(@ptrCast(gpucomputepass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageBuffers(gpucomputepass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUComputeStorageBuffers(@ptrCast(gpucomputepass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void { pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void {
return c.SDL_DispatchGPUCompute(gpucomputepass, groupcount_x, groupcount_y, groupcount_z); return c.SDL_DispatchGPUCompute(@ptrCast(gpucomputepass), groupcount_x, groupcount_y, groupcount_z);
} }
pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void { pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void {
return c.SDL_DispatchGPUComputeIndirect(gpucomputepass, buffer, offset); return c.SDL_DispatchGPUComputeIndirect(@ptrCast(gpucomputepass), @ptrCast(buffer), offset);
} }
pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void { pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void {
return c.SDL_EndGPUComputePass(gpucomputepass); return c.SDL_EndGPUComputePass(@ptrCast(gpucomputepass));
} }
}; };
pub const GPUCopyPass = opaque { pub const GPUCopyPass = opaque {
pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureTransferInfo, destination: *const GPUTextureRegion, cycle: bool) void { pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureTransferInfo, destination: ?*const GPUTextureRegion, cycle: bool) void {
return c.SDL_UploadToGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUTransferBufferLocation, destination: *const GPUBufferRegion, cycle: bool) void { pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUTransferBufferLocation, destination: ?*const GPUBufferRegion, cycle: bool) void {
return c.SDL_UploadToGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureLocation, destination: *const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void { pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureLocation, destination: ?*const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void {
return c.SDL_CopyGPUTextureToTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle)); return c.SDL_CopyGPUTextureToTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle));
} }
pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferLocation, destination: *const GPUBufferLocation, size: u32, cycle: bool) void { pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferLocation, destination: ?*const GPUBufferLocation, size: u32, cycle: bool) void {
return c.SDL_CopyGPUBufferToBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle)); return c.SDL_CopyGPUBufferToBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle));
} }
pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureRegion, destination: *const GPUTextureTransferInfo) void { pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureRegion, destination: ?*const GPUTextureTransferInfo) void {
return c.SDL_DownloadFromGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferRegion, destination: *const GPUTransferBufferLocation) void { pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferRegion, destination: ?*const GPUTransferBufferLocation) void {
return c.SDL_DownloadFromGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void { pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void {
return c.SDL_EndGPUCopyPass(gpucopypass); return c.SDL_EndGPUCopyPass(@ptrCast(gpucopypass));
} }
}; };
@ -539,6 +539,8 @@ pub const GPUTextureUsageFlags = packed struct(u32) {
textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUTextureUsageFlags{};
}; };
pub const GPUTextureType = enum(c_int) { pub const GPUTextureType = enum(c_int) {
@ -574,6 +576,8 @@ pub const GPUBufferUsageFlags = packed struct(u32) {
bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage. bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage.
pad0: u25 = 0, pad0: u25 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUBufferUsageFlags{};
}; };
pub const GPUTransferBufferUsage = enum(c_int) { pub const GPUTransferBufferUsage = enum(c_int) {
@ -586,7 +590,18 @@ pub const GPUShaderStage = enum(c_int) {
shaderstageFragment, shaderstageFragment,
}; };
pub const GPUShaderFormat = u32; pub const GPUShaderFormat = packed struct(u32) {
shaderformatPrivate: bool = false, // Shaders for NDA'd platforms.
shaderformatSpirv: bool = false, // SPIR-V shaders for Vulkan.
shaderformatDxbc: bool = false, // DXBC SM5_1 shaders for D3D12.
shaderformatDxil: bool = false, // DXIL SM6_0 shaders for D3D12.
shaderformatMsl: bool = false, // MSL shaders for Metal.
shaderformatMetallib: bool = false, // Precompiled metallib shaders for Metal.
pad0: u25 = 0,
rsvd: bool = false,
pub const None = GPUShaderFormat{};
};
pub const GPUVertexElementFormat = enum(c_int) { pub const GPUVertexElementFormat = enum(c_int) {
vertexelementformatInvalid, vertexelementformatInvalid,
@ -700,6 +715,8 @@ pub const GPUColorComponentFlags = packed struct(u8) {
colorcomponentA: bool = false, // the alpha component colorcomponentA: bool = false, // the alpha component
pad0: u3 = 0, pad0: u3 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUColorComponentFlags{};
}; };
pub const GPUFilter = enum(c_int) { pub const GPUFilter = enum(c_int) {
@ -849,9 +866,9 @@ pub const GPUVertexAttribute = extern struct {
}; };
pub const GPUVertexInputState = extern struct { pub const GPUVertexInputState = extern struct {
vertex_buffer_descriptions: *const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions. vertex_buffer_descriptions: ?*const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions.
num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array. num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array.
vertex_attributes: *const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions. vertex_attributes: ?*const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions.
num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array. num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array.
}; };
@ -955,7 +972,7 @@ pub const GPUColorTargetDescription = extern struct {
}; };
pub const GPUGraphicsPipelineTargetInfo = extern struct { pub const GPUGraphicsPipelineTargetInfo = extern struct {
color_target_descriptions: *const GPUColorTargetDescription, // A pointer to an array of color target descriptions. color_target_descriptions: ?*const GPUColorTargetDescription, // A pointer to an array of color target descriptions.
num_color_targets: u32, // The number of color target descriptions in the above array. num_color_targets: u32, // The number of color target descriptions in the above array.
depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target. has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target.
@ -1072,11 +1089,11 @@ pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
} }
pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice { pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice {
return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name); return @ptrCast(c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name));
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {
return c.SDL_CreateGPUDeviceWithProperties(props); return @ptrCast(c.SDL_CreateGPUDeviceWithProperties(props));
} }
pub inline fn getNumGPUDrivers() c_int { pub inline fn getNumGPUDrivers() c_int {

View File

@ -3,105 +3,105 @@ pub const c = @import("c.zig").c;
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn isJoystickHaptic(joystick: *Joystick) bool { pub inline fn isJoystickHaptic(joystick: *Joystick) bool {
return @bitCast(c.SDL_IsJoystickHaptic(joystick)); return @bitCast(c.SDL_IsJoystickHaptic(@ptrCast(joystick)));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
return c.SDL_OpenHapticFromJoystick(joystick); return @ptrCast(c.SDL_OpenHapticFromJoystick(@ptrCast(joystick)));
} }
}; };
pub const Haptic = opaque { pub const Haptic = opaque {
pub inline fn getHapticID(haptic: *Haptic) HapticID { pub inline fn getHapticID(haptic: *Haptic) HapticID {
return c.SDL_GetHapticID(haptic); return c.SDL_GetHapticID(@ptrCast(haptic));
} }
pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 { pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 {
return c.SDL_GetHapticName(haptic); return c.SDL_GetHapticName(@ptrCast(haptic));
} }
pub inline fn closeHaptic(haptic: *Haptic) void { pub inline fn closeHaptic(haptic: *Haptic) void {
return c.SDL_CloseHaptic(haptic); return c.SDL_CloseHaptic(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffects(haptic); return c.SDL_GetMaxHapticEffects(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffectsPlaying(haptic); return c.SDL_GetMaxHapticEffectsPlaying(@ptrCast(haptic));
} }
pub inline fn getHapticFeatures(haptic: *Haptic) u32 { pub inline fn getHapticFeatures(haptic: *Haptic) u32 {
return c.SDL_GetHapticFeatures(haptic); return c.SDL_GetHapticFeatures(@ptrCast(haptic));
} }
pub inline fn getNumHapticAxes(haptic: *Haptic) c_int { pub inline fn getNumHapticAxes(haptic: *Haptic) c_int {
return c.SDL_GetNumHapticAxes(haptic); return c.SDL_GetNumHapticAxes(@ptrCast(haptic));
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: ?*const HapticEffect) bool {
return @bitCast(c.SDL_HapticEffectSupported(haptic, @ptrCast(effect))); return @bitCast(c.SDL_HapticEffectSupported(@ptrCast(haptic), @ptrCast(effect)));
} }
pub inline fn createHapticEffect(haptic: *Haptic, effect: *const HapticEffect) c_int { pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) c_int {
return c.SDL_CreateHapticEffect(haptic, @ptrCast(effect)); return c.SDL_CreateHapticEffect(@ptrCast(haptic), @ptrCast(effect));
} }
pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: *const HapticEffect) bool { pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: ?*const HapticEffect) bool {
return @bitCast(c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data))); return @bitCast(c.SDL_UpdateHapticEffect(@ptrCast(haptic), effect, @ptrCast(data)));
} }
pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool { pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool {
return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations)); return @bitCast(c.SDL_RunHapticEffect(@ptrCast(haptic), effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_StopHapticEffect(haptic, effect)); return @bitCast(c.SDL_StopHapticEffect(@ptrCast(haptic), effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
return c.SDL_DestroyHapticEffect(haptic, effect); return c.SDL_DestroyHapticEffect(@ptrCast(haptic), effect);
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect)); return @bitCast(c.SDL_GetHapticEffectStatus(@ptrCast(haptic), effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return @bitCast(c.SDL_SetHapticGain(haptic, gain)); return @bitCast(c.SDL_SetHapticGain(@ptrCast(haptic), gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter)); return @bitCast(c.SDL_SetHapticAutocenter(@ptrCast(haptic), autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_PauseHaptic(haptic)); return @bitCast(c.SDL_PauseHaptic(@ptrCast(haptic)));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_ResumeHaptic(haptic)); return @bitCast(c.SDL_ResumeHaptic(@ptrCast(haptic)));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticEffects(haptic)); return @bitCast(c.SDL_StopHapticEffects(@ptrCast(haptic)));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return @bitCast(c.SDL_HapticRumbleSupported(haptic)); return @bitCast(c.SDL_HapticRumbleSupported(@ptrCast(haptic)));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_InitHapticRumble(haptic)); return @bitCast(c.SDL_InitHapticRumble(@ptrCast(haptic)));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length)); return @bitCast(c.SDL_PlayHapticRumble(@ptrCast(haptic), strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticRumble(haptic)); return @bitCast(c.SDL_StopHapticRumble(@ptrCast(haptic)));
} }
}; };
@ -206,7 +206,7 @@ pub const HapticEffect = extern union {
pub const HapticID = u32; pub const HapticID = u32;
pub inline fn getHaptics(count: *c_int) ?*HapticID { pub inline fn getHaptics(count: *c_int) ?*HapticID {
return c.SDL_GetHaptics(@ptrCast(count)); return @ptrCast(c.SDL_GetHaptics(@ptrCast(count)));
} }
pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 { pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
@ -214,11 +214,11 @@ pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
} }
pub inline fn openHaptic(instance_id: HapticID) ?*Haptic { pub inline fn openHaptic(instance_id: HapticID) ?*Haptic {
return c.SDL_OpenHaptic(instance_id); return @ptrCast(c.SDL_OpenHaptic(instance_id));
} }
pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic { pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
return c.SDL_GetHapticFromID(instance_id); return @ptrCast(c.SDL_GetHapticFromID(instance_id));
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
@ -226,5 +226,5 @@ pub inline fn isMouseHaptic() bool {
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {
return c.SDL_OpenHapticFromMouse(); return @ptrCast(c.SDL_OpenHapticFromMouse());
} }

View File

@ -12,6 +12,8 @@ pub const InitFlags = packed struct(u32) {
initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`
pad0: u23 = 0, pad0: u23 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = InitFlags{};
}; };
pub const AppResult = enum(c_int) { pub const AppResult = enum(c_int) {

View File

@ -29,147 +29,147 @@ pub const PowerState = enum(c_int) {
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool { pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualAxis(joystick, axis, value)); return @bitCast(c.SDL_SetJoystickVirtualAxis(@ptrCast(joystick), axis, value));
} }
pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool { pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel)); return @bitCast(c.SDL_SetJoystickVirtualBall(@ptrCast(joystick), ball, xrel, yrel));
} }
pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool { pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool {
return @bitCast(c.SDL_SetJoystickVirtualButton(joystick, button, @bitCast(down))); return @bitCast(c.SDL_SetJoystickVirtualButton(@ptrCast(joystick), button, @bitCast(down)));
} }
pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool { pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool {
return @bitCast(c.SDL_SetJoystickVirtualHat(joystick, hat, value)); return @bitCast(c.SDL_SetJoystickVirtualHat(@ptrCast(joystick), hat, value));
} }
pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool { pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool {
return @bitCast(c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, @bitCast(down), x, y, pressure)); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(@ptrCast(joystick), touchpad, finger, @bitCast(down), x, y, pressure));
} }
pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool { pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool {
return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values)); return @bitCast(c.SDL_SendJoystickVirtualSensorData(@ptrCast(joystick), @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
return c.SDL_GetJoystickProperties(joystick); return c.SDL_GetJoystickProperties(@ptrCast(joystick));
} }
pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickName(joystick); return c.SDL_GetJoystickName(@ptrCast(joystick));
} }
pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickPath(joystick); return c.SDL_GetJoystickPath(@ptrCast(joystick));
} }
pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int { pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int {
return c.SDL_GetJoystickPlayerIndex(joystick); return c.SDL_GetJoystickPlayerIndex(@ptrCast(joystick));
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index)); return @bitCast(c.SDL_SetJoystickPlayerIndex(@ptrCast(joystick), player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
return c.SDL_GetJoystickGUID(joystick); return c.SDL_GetJoystickGUID(@ptrCast(joystick));
} }
pub inline fn getJoystickVendor(joystick: *Joystick) u16 { pub inline fn getJoystickVendor(joystick: *Joystick) u16 {
return c.SDL_GetJoystickVendor(joystick); return c.SDL_GetJoystickVendor(@ptrCast(joystick));
} }
pub inline fn getJoystickProduct(joystick: *Joystick) u16 { pub inline fn getJoystickProduct(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProduct(joystick); return c.SDL_GetJoystickProduct(@ptrCast(joystick));
} }
pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 { pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProductVersion(joystick); return c.SDL_GetJoystickProductVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 { pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickFirmwareVersion(joystick); return c.SDL_GetJoystickFirmwareVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickSerial(joystick); return c.SDL_GetJoystickSerial(@ptrCast(joystick));
} }
pub inline fn getJoystickType(joystick: *Joystick) JoystickType { pub inline fn getJoystickType(joystick: *Joystick) JoystickType {
return @intFromEnum(c.SDL_GetJoystickType(joystick)); return @intFromEnum(c.SDL_GetJoystickType(@ptrCast(joystick)));
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return @bitCast(c.SDL_JoystickConnected(joystick)); return @bitCast(c.SDL_JoystickConnected(@ptrCast(joystick)));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
return c.SDL_GetJoystickID(joystick); return c.SDL_GetJoystickID(@ptrCast(joystick));
} }
pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int { pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickAxes(joystick); return c.SDL_GetNumJoystickAxes(@ptrCast(joystick));
} }
pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int { pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickBalls(joystick); return c.SDL_GetNumJoystickBalls(@ptrCast(joystick));
} }
pub inline fn getNumJoystickHats(joystick: *Joystick) c_int { pub inline fn getNumJoystickHats(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickHats(joystick); return c.SDL_GetNumJoystickHats(@ptrCast(joystick));
} }
pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int { pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickButtons(joystick); return c.SDL_GetNumJoystickButtons(@ptrCast(joystick));
} }
pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 { pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 {
return c.SDL_GetJoystickAxis(joystick, axis); return c.SDL_GetJoystickAxis(@ptrCast(joystick), axis);
} }
pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool { pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool {
return @bitCast(c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state))); return @bitCast(c.SDL_GetJoystickAxisInitialState(@ptrCast(joystick), axis, @ptrCast(state)));
} }
pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool { pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool {
return @bitCast(c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy))); return @bitCast(c.SDL_GetJoystickBall(@ptrCast(joystick), ball, @ptrCast(dx), @ptrCast(dy)));
} }
pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 { pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 {
return c.SDL_GetJoystickHat(joystick, hat); return c.SDL_GetJoystickHat(@ptrCast(joystick), hat);
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return @bitCast(c.SDL_GetJoystickButton(joystick, button)); return @bitCast(c.SDL_GetJoystickButton(@ptrCast(joystick), button));
} }
pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystick(@ptrCast(joystick), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystickTriggers(@ptrCast(joystick), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool { pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetJoystickLED(joystick, red, green, blue)); return @bitCast(c.SDL_SetJoystickLED(@ptrCast(joystick), red, green, blue));
} }
pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size)); return @bitCast(c.SDL_SendJoystickEffect(@ptrCast(joystick), data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
return c.SDL_CloseJoystick(joystick); return c.SDL_CloseJoystick(@ptrCast(joystick));
} }
pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState { pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState {
return c.SDL_GetJoystickConnectionState(joystick); return c.SDL_GetJoystickConnectionState(@ptrCast(joystick));
} }
pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState { pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState {
return c.SDL_GetJoystickPowerInfo(joystick, @ptrCast(percent)); return c.SDL_GetJoystickPowerInfo(@ptrCast(joystick), @ptrCast(percent));
} }
}; };
@ -208,7 +208,7 @@ pub inline fn hasJoystick() bool {
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
return c.SDL_GetJoysticks(@ptrCast(count)); return @ptrCast(c.SDL_GetJoysticks(@ptrCast(count)));
} }
pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 {
@ -244,15 +244,15 @@ pub inline fn getJoystickTypeForID(instance_id: JoystickID) JoystickType {
} }
pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick { pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick {
return c.SDL_OpenJoystick(instance_id); return @ptrCast(c.SDL_OpenJoystick(instance_id));
} }
pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick { pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick {
return c.SDL_GetJoystickFromID(instance_id); return @ptrCast(c.SDL_GetJoystickFromID(instance_id));
} }
pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick { pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick {
return c.SDL_GetJoystickFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetJoystickFromPlayerIndex(player_index));
} }
pub const VirtualJoystickTouchpadDesc = extern struct { pub const VirtualJoystickTouchpadDesc = extern struct {
@ -279,8 +279,8 @@ pub const VirtualJoystickDesc = extern struct {
nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions
padding2: [2]u16, // unused padding2: [2]u16, // unused
name: [*c]const u8, // the name of the joystick name: [*c]const u8, // the name of the joystick
touchpads: *const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 touchpads: ?*const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0
sensors: *const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0 sensors: ?*const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0
userdata: ?*anyopaque, // User data pointer passed to callbacks userdata: ?*anyopaque, // User data pointer passed to callbacks
Update: ?*const anyopaque, // Called when the joystick state should be updated Update: ?*const anyopaque, // Called when the joystick state should be updated
SetPlayerIndex: ?*const anyopaque, // Called when the player index is set SetPlayerIndex: ?*const anyopaque, // Called when the player index is set
@ -292,7 +292,7 @@ pub const VirtualJoystickDesc = extern struct {
Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached
}; };
pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID { pub inline fn attachVirtualJoystick(desc: ?*const VirtualJoystickDesc) JoystickID {
return c.SDL_AttachVirtualJoystick(@ptrCast(desc)); return c.SDL_AttachVirtualJoystick(@ptrCast(desc));
} }

View File

@ -5,14 +5,14 @@ pub const FunctionPointer = c.SDL_FunctionPointer;
pub const SharedObject = opaque { pub const SharedObject = opaque {
pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer { pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer {
return c.SDL_LoadFunction(sharedobject, name); return c.SDL_LoadFunction(@ptrCast(sharedobject), name);
} }
pub inline fn unloadObject(sharedobject: *SharedObject) void { pub inline fn unloadObject(sharedobject: *SharedObject) void {
return c.SDL_UnloadObject(sharedobject); return c.SDL_UnloadObject(@ptrCast(sharedobject));
} }
}; };
pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject { pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject {
return c.SDL_LoadObject(sofile); return @ptrCast(c.SDL_LoadObject(sofile));
} }

View File

@ -11,6 +11,8 @@ pub const MessageBoxFlags = packed struct(u32) {
messageboxButtonsRightToLeft: bool = false, // buttons placed right to left messageboxButtonsRightToLeft: bool = false, // buttons placed right to left
pad0: u26 = 0, pad0: u26 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxFlags{};
}; };
pub const MessageBoxButtonFlags = packed struct(u32) { pub const MessageBoxButtonFlags = packed struct(u32) {
@ -18,6 +20,8 @@ pub const MessageBoxButtonFlags = packed struct(u32) {
messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit
pad0: u29 = 0, pad0: u29 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxButtonFlags{};
}; };
pub const MessageBoxButtonData = extern struct { pub const MessageBoxButtonData = extern struct {
@ -51,14 +55,14 @@ pub const MessageBoxData = extern struct {
title: [*c]const u8, // UTF-8 title title: [*c]const u8, // UTF-8 title
message: [*c]const u8, // UTF-8 message text message: [*c]const u8, // UTF-8 message text
numbuttons: c_int, numbuttons: c_int,
buttons: *const MessageBoxButtonData, buttons: ?*const MessageBoxButtonData,
colorScheme: *const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings colorScheme: ?*const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: ?*const MessageBoxData, buttonid: *c_int) bool {
return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid))); return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid)));
} }
pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool { pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool {
return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window)); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, @ptrCast(window)));
} }

View File

@ -3,21 +3,21 @@ pub const c = @import("c.zig").c;
pub const Window = opaque { pub const Window = opaque {
pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void { pub inline fn warpMouseInWindow(window: *Window, x: f32, y: f32) void {
return c.SDL_WarpMouseInWindow(window, x, y); return c.SDL_WarpMouseInWindow(@ptrCast(window), x, y);
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled))); return @bitCast(c.SDL_SetWindowRelativeMouseMode(@ptrCast(window), @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return @bitCast(c.SDL_GetWindowRelativeMouseMode(window)); return @bitCast(c.SDL_GetWindowRelativeMouseMode(@ptrCast(window)));
} }
}; };
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createColorCursor(surface: *Surface, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateColorCursor(surface, hot_x, hot_y); return @ptrCast(c.SDL_CreateColorCursor(@ptrCast(surface), hot_x, hot_y));
} }
}; };
@ -25,11 +25,11 @@ pub const MouseID = u32;
pub const Cursor = opaque { pub const Cursor = opaque {
pub inline fn setCursor(cursor: *Cursor) bool { pub inline fn setCursor(cursor: *Cursor) bool {
return @bitCast(c.SDL_SetCursor(cursor)); return @bitCast(c.SDL_SetCursor(@ptrCast(cursor)));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
return c.SDL_DestroyCursor(cursor); return c.SDL_DestroyCursor(@ptrCast(cursor));
} }
}; };
@ -68,6 +68,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MouseButtonFlags{};
pub const ButtonRight: MouseButtonFlags = @bitCast(@as(u32, 3));
pub const ButtonX2: MouseButtonFlags = @bitCast(@as(u32, 5));
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
@ -75,7 +79,7 @@ pub inline fn hasMouse() bool {
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
return c.SDL_GetMice(@ptrCast(count)); return @ptrCast(c.SDL_GetMice(@ptrCast(count)));
} }
pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 { pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
@ -83,7 +87,7 @@ pub inline fn getMouseNameForID(instance_id: MouseID) [*c]const u8 {
} }
pub inline fn getMouseFocus() ?*Window { pub inline fn getMouseFocus() ?*Window {
return c.SDL_GetMouseFocus(); return @ptrCast(c.SDL_GetMouseFocus());
} }
pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags { pub inline fn getMouseState(x: *f32, y: *f32) MouseButtonFlags {
@ -107,19 +111,19 @@ pub inline fn captureMouse(enabled: bool) bool {
} }
pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor { pub inline fn createCursor(data: [*c]const u8, mask: [*c]const u8, w: c_int, h: c_int, hot_x: c_int, hot_y: c_int) ?*Cursor {
return c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y); return @ptrCast(c.SDL_CreateCursor(data, mask, w, h, hot_x, hot_y));
} }
pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor { pub inline fn createSystemCursor(id: SystemCursor) ?*Cursor {
return c.SDL_CreateSystemCursor(id); return @ptrCast(c.SDL_CreateSystemCursor(id));
} }
pub inline fn getCursor() ?*Cursor { pub inline fn getCursor() ?*Cursor {
return c.SDL_GetCursor(); return @ptrCast(c.SDL_GetCursor());
} }
pub inline fn getDefaultCursor() ?*Cursor { pub inline fn getDefaultCursor() ?*Cursor {
return c.SDL_GetDefaultCursor(); return @ptrCast(c.SDL_GetDefaultCursor());
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {

View File

@ -205,34 +205,34 @@ pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask:
return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask)); return @bitCast(c.SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask));
} }
pub inline fn getPixelFormatDetails(format: PixelFormat) *const PixelFormatDetails { pub inline fn getPixelFormatDetails(format: PixelFormat) ?*const PixelFormatDetails {
return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format))); return @ptrCast(c.SDL_GetPixelFormatDetails(@bitCast(format)));
} }
pub inline fn createPalette(ncolors: c_int) ?*Palette { pub inline fn createPalette(ncolors: c_int) ?*Palette {
return c.SDL_CreatePalette(ncolors); return @ptrCast(c.SDL_CreatePalette(ncolors));
} }
pub inline fn setPaletteColors(palette: ?*Palette, colors: *const Color, firstcolor: c_int, ncolors: c_int) bool { pub inline fn setPaletteColors(palette: ?*Palette, colors: ?*const Color, firstcolor: c_int, ncolors: c_int) bool {
return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors)); return @bitCast(c.SDL_SetPaletteColors(@ptrCast(palette), @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {
return c.SDL_DestroyPalette(palette); return c.SDL_DestroyPalette(@ptrCast(palette));
} }
pub inline fn mapRGB(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8) u32 { pub inline fn mapRGB(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b); return c.SDL_MapRGB(@ptrCast(format), @ptrCast(palette), r, g, b);
} }
pub inline fn mapRGBA(format: *const PixelFormatDetails, palette: *const Palette, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapRGBA(format: ?*const PixelFormatDetails, palette: ?*const Palette, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a); return c.SDL_MapRGBA(@ptrCast(format), @ptrCast(palette), r, g, b, a);
} }
pub inline fn getRGB(pixel: u32, format: *const PixelFormatDetails, palette: *const Palette, r: [*c]u8, g: [*c]u8, b: [*c]u8) void { 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); return c.SDL_GetRGB(pixel, @ptrCast(format), @ptrCast(palette), r, g, b);
} }
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 { 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); return c.SDL_GetRGBA(pixel, @ptrCast(format), @ptrCast(palette), r, g, b, a);
} }

View File

@ -25,42 +25,42 @@ pub const FRect = extern struct {
h: f32, h: f32,
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: ?*const Rect, B: ?*const Rect) bool {
return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersection(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersection(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectIntersection(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnion(A: *const Rect, B: *const Rect, result: ?*Rect) bool { pub inline fn getRectUnion(A: ?*const Rect, B: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPoints(points: *const Point, count: c_int, clip: *const Rect, result: ?*Rect) bool { pub inline fn getRectEnclosingPoints(points: ?*const Point, count: c_int, clip: ?*const Rect, result: ?*Rect) bool {
return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersection(rect: *const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool { pub inline fn getRectAndLineIntersection(rect: ?*const Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) bool {
return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersection(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }
pub inline fn hasRectIntersectionFloat(A: *const FRect, B: *const FRect) bool { pub inline fn hasRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect) bool {
return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B))); return @bitCast(c.SDL_HasRectIntersectionFloat(@ptrCast(A), @ptrCast(B)));
} }
pub inline fn getRectIntersectionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectIntersectionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectUnionFloat(A: *const FRect, B: *const FRect, result: ?*FRect) bool { pub inline fn getRectUnionFloat(A: ?*const FRect, B: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result)); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), @ptrCast(result)));
} }
pub inline fn getRectEnclosingPointsFloat(points: *const FPoint, count: c_int, clip: *const FRect, result: ?*FRect) bool { pub inline fn getRectEnclosingPointsFloat(points: ?*const FPoint, count: c_int, clip: ?*const FRect, result: ?*FRect) bool {
return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result)); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), @ptrCast(result)));
} }
pub inline fn getRectAndLineIntersectionFloat(rect: *const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool { pub inline fn getRectAndLineIntersectionFloat(rect: ?*const FRect, X1: *f32, Y1: *f32, X2: *f32, Y2: *f32) bool {
return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2))); return @bitCast(c.SDL_GetRectAndLineIntersectionFloat(@ptrCast(rect), @ptrCast(X1), @ptrCast(Y1), @ptrCast(X2), @ptrCast(Y2)));
} }

View File

@ -27,7 +27,7 @@ pub const FColor = extern struct {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer { pub inline fn createSoftwareRenderer(surface: *Surface) ?*Renderer {
return c.SDL_CreateSoftwareRenderer(surface); return @ptrCast(c.SDL_CreateSoftwareRenderer(@ptrCast(surface)));
} }
}; };
@ -42,11 +42,11 @@ pub const BlendMode = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer { pub inline fn createRenderer(window: *Window, name: [*c]const u8) ?*Renderer {
return c.SDL_CreateRenderer(window, name); return @ptrCast(c.SDL_CreateRenderer(@ptrCast(window), name));
} }
pub inline fn getRenderer(window: *Window) ?*Renderer { pub inline fn getRenderer(window: *Window) ?*Renderer {
return c.SDL_GetRenderer(window); return @ptrCast(c.SDL_GetRenderer(@ptrCast(window)));
} }
}; };
@ -605,6 +605,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const PenInputFlags = packed struct(u32) {
@ -617,6 +621,8 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const PenID = u32; pub const PenID = u32;
@ -778,6 +784,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const Vertex = extern struct { pub const Vertex = extern struct {
@ -802,329 +810,329 @@ pub const RendererLogicalPresentation = enum(c_int) {
pub const Renderer = opaque { pub const Renderer = opaque {
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window { pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
return c.SDL_GetRenderWindow(renderer); return @ptrCast(c.SDL_GetRenderWindow(@ptrCast(renderer)));
} }
pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 { pub inline fn getRendererName(renderer: *Renderer) [*c]const u8 {
return c.SDL_GetRendererName(renderer); return c.SDL_GetRendererName(@ptrCast(renderer));
} }
pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID { pub inline fn getRendererProperties(renderer: *Renderer) PropertiesID {
return c.SDL_GetRendererProperties(renderer); return c.SDL_GetRendererProperties(@ptrCast(renderer));
} }
pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetRenderOutputSize(@ptrCast(renderer), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool { pub inline fn getCurrentRenderOutputSize(renderer: *Renderer, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h))); 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 { pub inline fn createTexture(renderer: *Renderer, format: PixelFormat, access: TextureAccess, w: c_int, h: c_int) ?*Texture {
return c.SDL_CreateTexture(renderer, @bitCast(format), access, w, h); return @ptrCast(c.SDL_CreateTexture(@ptrCast(renderer), @bitCast(format), access, w, h));
} }
pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture { pub inline fn createTextureFromSurface(renderer: *Renderer, surface: ?*Surface) ?*Texture {
return c.SDL_CreateTextureFromSurface(renderer, surface); return @ptrCast(c.SDL_CreateTextureFromSurface(@ptrCast(renderer), @ptrCast(surface)));
} }
pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture { pub inline fn createTextureWithProperties(renderer: *Renderer, props: PropertiesID) ?*Texture {
return c.SDL_CreateTextureWithProperties(renderer, props); return @ptrCast(c.SDL_CreateTextureWithProperties(@ptrCast(renderer), props));
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return @bitCast(c.SDL_SetRenderTarget(renderer, texture)); return @bitCast(c.SDL_SetRenderTarget(@ptrCast(renderer), @ptrCast(texture)));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
return c.SDL_GetRenderTarget(renderer); return @ptrCast(c.SDL_GetRenderTarget(@ptrCast(renderer)));
} }
pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool { pub inline fn setRenderLogicalPresentation(renderer: *Renderer, w: c_int, h: c_int, mode: RendererLogicalPresentation) bool {
return @bitCast(c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode)); 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 { pub inline fn getRenderLogicalPresentation(renderer: *Renderer, w: *c_int, h: *c_int, mode: ?*RendererLogicalPresentation) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode)); return @bitCast(c.SDL_GetRenderLogicalPresentation(@ptrCast(renderer), @ptrCast(w), @ptrCast(h), @ptrCast(mode)));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, rect)); 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 { pub inline fn renderCoordinatesFromWindow(renderer: *Renderer, window_x: f32, window_y: f32, x: *f32, y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y))); 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 { pub inline fn renderCoordinatesToWindow(renderer: *Renderer, x: f32, y: f32, window_x: *f32, window_y: *f32) bool {
return @bitCast(c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y))); return @bitCast(c.SDL_RenderCoordinatesToWindow(@ptrCast(renderer), x, y, @ptrCast(window_x), @ptrCast(window_y)));
} }
pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool { pub inline fn convertEventToRenderCoordinates(renderer: *Renderer, event: ?*Event) bool {
return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event)); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(@ptrCast(renderer), @ptrCast(event)));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderViewport(renderer, rect)); return @bitCast(c.SDL_GetRenderViewport(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderViewportSet(renderer)); return @bitCast(c.SDL_RenderViewportSet(@ptrCast(renderer)));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect)); return @bitCast(c.SDL_GetRenderSafeArea(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_SetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetRenderClipRect(renderer, rect)); return @bitCast(c.SDL_GetRenderClipRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClipEnabled(renderer)); return @bitCast(c.SDL_RenderClipEnabled(@ptrCast(renderer)));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return @bitCast(c.SDL_SetRenderScale(renderer, scaleX, scaleY)); return @bitCast(c.SDL_SetRenderScale(@ptrCast(renderer), scaleX, scaleY));
} }
pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool { pub inline fn getRenderScale(renderer: *Renderer, scaleX: *f32, scaleY: *f32) bool {
return @bitCast(c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY))); 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 { pub inline fn setRenderDrawColor(renderer: *Renderer, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_SetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn setRenderDrawColorFloat(renderer: *Renderer, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColor(renderer: *Renderer, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_GetRenderDrawColor(renderer, r, g, b, a)); 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 { pub inline fn getRenderDrawColorFloat(renderer: *Renderer, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_GetRenderDrawColorFloat(@ptrCast(renderer), @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool { pub inline fn setRenderColorScale(renderer: *Renderer, scale: f32) bool {
return @bitCast(c.SDL_SetRenderColorScale(renderer, scale)); return @bitCast(c.SDL_SetRenderColorScale(@ptrCast(renderer), scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale))); return @bitCast(c.SDL_GetRenderColorScale(@ptrCast(renderer), @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetRenderDrawBlendMode(@ptrCast(renderer), @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetRenderDrawBlendMode(@ptrCast(renderer), @ptrCast(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderClear(renderer)); return @bitCast(c.SDL_RenderClear(@ptrCast(renderer)));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return @bitCast(c.SDL_RenderPoint(renderer, x, y)); return @bitCast(c.SDL_RenderPoint(@ptrCast(renderer), x, y));
} }
pub inline fn renderPoints(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderPoints(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderPoints(renderer, @ptrCast(points), count)); 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 { pub inline fn renderLine(renderer: *Renderer, x1: f32, y1: f32, x2: f32, y2: f32) bool {
return @bitCast(c.SDL_RenderLine(renderer, x1, y1, x2, y2)); return @bitCast(c.SDL_RenderLine(@ptrCast(renderer), x1, y1, x2, y2));
} }
pub inline fn renderLines(renderer: *Renderer, points: *const FPoint, count: c_int) bool { pub inline fn renderLines(renderer: *Renderer, points: ?*const FPoint, count: c_int) bool {
return @bitCast(c.SDL_RenderLines(renderer, @ptrCast(points), count)); return @bitCast(c.SDL_RenderLines(@ptrCast(renderer), @ptrCast(points), count));
} }
pub inline fn renderRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderRects(renderer, @ptrCast(rects), count)); return @bitCast(c.SDL_RenderRects(@ptrCast(renderer), @ptrCast(rects), count));
} }
pub inline fn renderFillRect(renderer: *Renderer, rect: *const FRect) bool { pub inline fn renderFillRect(renderer: *Renderer, rect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderFillRect(renderer, @ptrCast(rect))); return @bitCast(c.SDL_RenderFillRect(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderFillRects(renderer: *Renderer, rects: *const FRect, count: c_int) bool { pub inline fn renderFillRects(renderer: *Renderer, rects: ?*const FRect, count: c_int) bool {
return @bitCast(c.SDL_RenderFillRects(renderer, @ptrCast(rects), count)); 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 { pub inline fn renderTexture(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip))); 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 { 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(renderer, texture, @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down))); 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 { pub inline fn renderTextureTiled(renderer: *Renderer, texture: ?*Texture, srcrect: ?*const FRect, scale: f32, dstrect: ?*const FRect) bool {
return @bitCast(c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect))); 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 { 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(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices)); 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 { 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(renderer, texture, @ptrCast(xy), xy_stride, @ptrCast(color), color_stride, @ptrCast(uv), uv_stride, num_vertices, indices, num_indices, size_indices)); 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 { pub inline fn renderReadPixels(renderer: *Renderer, rect: ?*const Rect) ?*Surface {
return c.SDL_RenderReadPixels(renderer, @ptrCast(rect)); return @ptrCast(c.SDL_RenderReadPixels(@ptrCast(renderer), @ptrCast(rect)));
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return @bitCast(c.SDL_RenderPresent(renderer)); return @bitCast(c.SDL_RenderPresent(@ptrCast(renderer)));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
return c.SDL_DestroyRenderer(renderer); return c.SDL_DestroyRenderer(@ptrCast(renderer));
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return @bitCast(c.SDL_FlushRenderer(renderer)); return @bitCast(c.SDL_FlushRenderer(@ptrCast(renderer)));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalLayer(renderer); return c.SDL_GetRenderMetalLayer(@ptrCast(renderer));
} }
pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalCommandEncoder(renderer: *Renderer) ?*anyopaque {
return c.SDL_GetRenderMetalCommandEncoder(renderer); return c.SDL_GetRenderMetalCommandEncoder(@ptrCast(renderer));
} }
pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool { pub inline fn addVulkanRenderSemaphores(renderer: *Renderer, wait_stage_mask: u32, wait_semaphore: i64, signal_semaphore: i64) bool {
return @bitCast(c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore)); return @bitCast(c.SDL_AddVulkanRenderSemaphores(@ptrCast(renderer), wait_stage_mask, wait_semaphore, signal_semaphore));
} }
pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool { pub inline fn setRenderVSync(renderer: *Renderer, vsync: c_int) bool {
return @bitCast(c.SDL_SetRenderVSync(renderer, vsync)); return @bitCast(c.SDL_SetRenderVSync(@ptrCast(renderer), vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return @bitCast(c.SDL_GetRenderVSync(renderer, @ptrCast(vsync))); return @bitCast(c.SDL_GetRenderVSync(@ptrCast(renderer), @ptrCast(vsync)));
} }
pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool { pub inline fn renderDebugText(renderer: *Renderer, x: f32, y: f32, str: [*c]const u8) bool {
return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str)); return @bitCast(c.SDL_RenderDebugText(@ptrCast(renderer), x, y, str));
} }
}; };
pub const Texture = opaque { pub const Texture = opaque {
pub inline fn getTextureProperties(texture: *Texture) PropertiesID { pub inline fn getTextureProperties(texture: *Texture) PropertiesID {
return c.SDL_GetTextureProperties(texture); return c.SDL_GetTextureProperties(@ptrCast(texture));
} }
pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer { pub inline fn getRendererFromTexture(texture: *Texture) ?*Renderer {
return c.SDL_GetRendererFromTexture(texture); return @ptrCast(c.SDL_GetRendererFromTexture(@ptrCast(texture)));
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return @bitCast(c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetTextureSize(@ptrCast(texture), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool { pub inline fn setTextureColorMod(texture: *Texture, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_SetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool { pub inline fn setTextureColorModFloat(texture: *Texture, r: f32, g: f32, b: f32) bool {
return @bitCast(c.SDL_SetTextureColorModFloat(texture, r, g, b)); 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 { pub inline fn getTextureColorMod(texture: *Texture, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureColorMod(texture, r, g, b)); return @bitCast(c.SDL_GetTextureColorMod(@ptrCast(texture), r, g, b));
} }
pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool { pub inline fn getTextureColorModFloat(texture: *Texture, r: *f32, g: *f32, b: *f32) bool {
return @bitCast(c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b))); return @bitCast(c.SDL_GetTextureColorModFloat(@ptrCast(texture), @ptrCast(r), @ptrCast(g), @ptrCast(b)));
} }
pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool { pub inline fn setTextureAlphaMod(texture: *Texture, alpha: u8) bool {
return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha)); return @bitCast(c.SDL_SetTextureAlphaModFloat(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha)); return @bitCast(c.SDL_GetTextureAlphaMod(@ptrCast(texture), alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha))); return @bitCast(c.SDL_GetTextureAlphaModFloat(@ptrCast(texture), @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetTextureBlendMode(@ptrCast(texture), @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetTextureBlendMode(@ptrCast(texture), @ptrCast(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode))); return @bitCast(c.SDL_SetTextureScaleMode(@ptrCast(texture), @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode))); 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 { pub inline fn updateTexture(texture: *Texture, rect: ?*const Rect, pixels: ?*const anyopaque, pitch: c_int) bool {
return @bitCast(c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch)); 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 { 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(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch)); 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 { pub inline fn lockTexture(texture: *Texture, rect: ?*const Rect, pixels: [*c]?*anyopaque, pitch: *c_int) bool {
return @bitCast(c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch))); return @bitCast(c.SDL_LockTexture(@ptrCast(texture), @ptrCast(rect), pixels, @ptrCast(pitch)));
} }
pub inline fn lockTextureToSurface(texture: *Texture, rect: *const Rect, surface: [*c][*c]Surface) bool { pub inline fn lockTextureToSurface(texture: *Texture, rect: ?*const Rect, surface: [*c]?*Surface) bool {
return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface)); return @bitCast(c.SDL_LockTextureToSurface(@ptrCast(texture), @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
return c.SDL_UnlockTexture(texture); return c.SDL_UnlockTexture(@ptrCast(texture));
} }
pub inline fn destroyTexture(texture: *Texture) void { pub inline fn destroyTexture(texture: *Texture) void {
return c.SDL_DestroyTexture(texture); return c.SDL_DestroyTexture(@ptrCast(texture));
} }
}; };
@ -1136,10 +1144,10 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
return c.SDL_GetRenderDriver(index); return c.SDL_GetRenderDriver(index);
} }
pub inline fn createWindowAndRenderer(title: [*c]const u8, width: c_int, height: c_int, window_flags: WindowFlags, window: [*c][*c]Window, renderer: [*c][*c]Renderer) bool { 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)); return @bitCast(c.SDL_CreateWindowAndRenderer(title, width, height, @bitCast(window_flags), window, renderer));
} }
pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer { pub inline fn createRendererWithProperties(props: PropertiesID) ?*Renderer {
return c.SDL_CreateRendererWithProperties(props); return @ptrCast(c.SDL_CreateRendererWithProperties(props));
} }

View File

@ -5,31 +5,31 @@ pub const PropertiesID = u32;
pub const Sensor = opaque { pub const Sensor = opaque {
pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID { pub inline fn getSensorProperties(sensor: *Sensor) PropertiesID {
return c.SDL_GetSensorProperties(sensor); return c.SDL_GetSensorProperties(@ptrCast(sensor));
} }
pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 { pub inline fn getSensorName(sensor: *Sensor) [*c]const u8 {
return c.SDL_GetSensorName(sensor); return c.SDL_GetSensorName(@ptrCast(sensor));
} }
pub inline fn getSensorType(sensor: *Sensor) SensorType { pub inline fn getSensorType(sensor: *Sensor) SensorType {
return @intFromEnum(c.SDL_GetSensorType(sensor)); return @intFromEnum(c.SDL_GetSensorType(@ptrCast(sensor)));
} }
pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int { pub inline fn getSensorNonPortableType(sensor: *Sensor) c_int {
return c.SDL_GetSensorNonPortableType(sensor); return c.SDL_GetSensorNonPortableType(@ptrCast(sensor));
} }
pub inline fn getSensorID(sensor: *Sensor) SensorID { pub inline fn getSensorID(sensor: *Sensor) SensorID {
return c.SDL_GetSensorID(sensor); return c.SDL_GetSensorID(@ptrCast(sensor));
} }
pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool { pub inline fn getSensorData(sensor: *Sensor, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values)); return @bitCast(c.SDL_GetSensorData(@ptrCast(sensor), @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {
return c.SDL_CloseSensor(sensor); return c.SDL_CloseSensor(@ptrCast(sensor));
} }
}; };
@ -47,7 +47,7 @@ pub const SensorType = enum(c_int) {
}; };
pub inline fn getSensors(count: *c_int) ?*SensorID { pub inline fn getSensors(count: *c_int) ?*SensorID {
return c.SDL_GetSensors(@ptrCast(count)); return @ptrCast(c.SDL_GetSensors(@ptrCast(count)));
} }
pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 { pub inline fn getSensorNameForID(instance_id: SensorID) [*c]const u8 {
@ -63,11 +63,11 @@ pub inline fn getSensorNonPortableTypeForID(instance_id: SensorID) c_int {
} }
pub inline fn openSensor(instance_id: SensorID) ?*Sensor { pub inline fn openSensor(instance_id: SensorID) ?*Sensor {
return c.SDL_OpenSensor(instance_id); return @ptrCast(c.SDL_OpenSensor(instance_id));
} }
pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor { pub inline fn getSensorFromID(instance_id: SensorID) ?*Sensor {
return c.SDL_GetSensorFromID(instance_id); return @ptrCast(c.SDL_GetSensorFromID(instance_id));
} }
pub inline fn updateSensors() void { pub inline fn updateSensors() void {

View File

@ -22,6 +22,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
@ -45,70 +47,70 @@ pub const StorageInterface = extern struct {
pub const Storage = opaque { pub const Storage = opaque {
pub inline fn closeStorage(storage: *Storage) bool { pub inline fn closeStorage(storage: *Storage) bool {
return @bitCast(c.SDL_CloseStorage(storage)); return @bitCast(c.SDL_CloseStorage(@ptrCast(storage)));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return @bitCast(c.SDL_StorageReady(storage)); return @bitCast(c.SDL_StorageReady(@ptrCast(storage)));
} }
pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool { pub inline fn getStorageFileSize(storage: *Storage, path: [*c]const u8, length: *u64) bool {
return @bitCast(c.SDL_GetStorageFileSize(storage, path, @ptrCast(length))); return @bitCast(c.SDL_GetStorageFileSize(@ptrCast(storage), path, @ptrCast(length)));
} }
pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool { pub inline fn readStorageFile(storage: *Storage, path: [*c]const u8, destination: ?*anyopaque, length: u64) bool {
return @bitCast(c.SDL_ReadStorageFile(storage, path, destination, length)); return @bitCast(c.SDL_ReadStorageFile(@ptrCast(storage), path, destination, length));
} }
pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool { pub inline fn writeStorageFile(storage: *Storage, path: [*c]const u8, source: ?*const anyopaque, length: u64) bool {
return @bitCast(c.SDL_WriteStorageFile(storage, path, source, length)); return @bitCast(c.SDL_WriteStorageFile(@ptrCast(storage), path, source, length));
} }
pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool { pub inline fn createStorageDirectory(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_CreateStorageDirectory(storage, path)); return @bitCast(c.SDL_CreateStorageDirectory(@ptrCast(storage), path));
} }
pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateStorageDirectory(storage: *Storage, path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata)); return @bitCast(c.SDL_EnumerateStorageDirectory(@ptrCast(storage), path, callback, userdata));
} }
pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool { pub inline fn removeStoragePath(storage: *Storage, path: [*c]const u8) bool {
return @bitCast(c.SDL_RemoveStoragePath(storage, path)); return @bitCast(c.SDL_RemoveStoragePath(@ptrCast(storage), path));
} }
pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renameStoragePath(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_RenameStoragePath(storage, oldpath, newpath)); return @bitCast(c.SDL_RenameStoragePath(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyStorageFile(storage: *Storage, oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return @bitCast(c.SDL_CopyStorageFile(storage, oldpath, newpath)); return @bitCast(c.SDL_CopyStorageFile(@ptrCast(storage), oldpath, newpath));
} }
pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getStoragePathInfo(storage: *Storage, path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info)); return @bitCast(c.SDL_GetStoragePathInfo(@ptrCast(storage), path, @ptrCast(info)));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {
return c.SDL_GetStorageSpaceRemaining(storage); return c.SDL_GetStorageSpaceRemaining(@ptrCast(storage));
} }
pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globStorageDirectory(storage: *Storage, path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {
return c.SDL_GlobStorageDirectory(storage, path, pattern, @bitCast(flags), @ptrCast(count)); return c.SDL_GlobStorageDirectory(@ptrCast(storage), path, pattern, @bitCast(flags), @ptrCast(count));
} }
}; };
pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openTitleStorage(override: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenTitleStorage(override, props); return @ptrCast(c.SDL_OpenTitleStorage(override, props));
} }
pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage { pub inline fn openUserStorage(org: [*c]const u8, app: [*c]const u8, props: PropertiesID) ?*Storage {
return c.SDL_OpenUserStorage(org, app, props); return @ptrCast(c.SDL_OpenUserStorage(org, app, props));
} }
pub inline fn openFileStorage(path: [*c]const u8) ?*Storage { pub inline fn openFileStorage(path: [*c]const u8) ?*Storage {
return c.SDL_OpenFileStorage(path); return @ptrCast(c.SDL_OpenFileStorage(path));
} }
pub inline fn openStorage(iface: *const StorageInterface, userdata: ?*anyopaque) ?*Storage { pub inline fn openStorage(iface: ?*const StorageInterface, userdata: ?*anyopaque) ?*Storage {
return c.SDL_OpenStorage(@ptrCast(iface), userdata); return @ptrCast(c.SDL_OpenStorage(@ptrCast(iface), userdata));
} }

View File

@ -17,7 +17,7 @@ pub const BlendMode = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface { pub inline fn loadBMP_IO(iostream: *IOStream, closeio: bool) ?*Surface {
return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio)); return @ptrCast(c.SDL_LoadBMP_IO(@ptrCast(iostream), @bitCast(closeio)));
} }
}; };
@ -81,6 +81,8 @@ pub const SurfaceFlags = packed struct(u32) {
surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc() surfaceSimdAligned: bool = false, // Surface uses pixel memory allocated with SDL_aligned_alloc()
pad0: u27 = 0, pad0: u27 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = SurfaceFlags{};
}; };
pub const ScaleMode = enum(c_int) { pub const ScaleMode = enum(c_int) {
@ -96,216 +98,216 @@ pub const FlipMode = enum(c_int) {
pub const Surface = opaque { pub const Surface = opaque {
pub inline fn destroySurface(surface: *Surface) void { pub inline fn destroySurface(surface: *Surface) void {
return c.SDL_DestroySurface(surface); return c.SDL_DestroySurface(@ptrCast(surface));
} }
pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID { pub inline fn getSurfaceProperties(surface: *Surface) PropertiesID {
return c.SDL_GetSurfaceProperties(surface); return c.SDL_GetSurfaceProperties(@ptrCast(surface));
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace)); return @bitCast(c.SDL_SetSurfaceColorspace(@ptrCast(surface), colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
return c.SDL_GetSurfaceColorspace(surface); return c.SDL_GetSurfaceColorspace(@ptrCast(surface));
} }
pub inline fn createSurfacePalette(surface: *Surface) ?*Palette { pub inline fn createSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_CreateSurfacePalette(surface); return @ptrCast(c.SDL_CreateSurfacePalette(@ptrCast(surface)));
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return @bitCast(c.SDL_SetSurfacePalette(surface, palette)); return @bitCast(c.SDL_SetSurfacePalette(@ptrCast(surface), @ptrCast(palette)));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
return c.SDL_GetSurfacePalette(surface); return @ptrCast(c.SDL_GetSurfacePalette(@ptrCast(surface)));
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image)); return @bitCast(c.SDL_AddSurfaceAlternateImage(@ptrCast(surface), @ptrCast(image)));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasAlternateImages(surface)); return @bitCast(c.SDL_SurfaceHasAlternateImages(@ptrCast(surface)));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c]?*Surface {
return c.SDL_GetSurfaceImages(surface, @ptrCast(count)); return c.SDL_GetSurfaceImages(@ptrCast(surface), @ptrCast(count));
} }
pub inline fn removeSurfaceAlternateImages(surface: *Surface) void { pub inline fn removeSurfaceAlternateImages(surface: *Surface) void {
return c.SDL_RemoveSurfaceAlternateImages(surface); return c.SDL_RemoveSurfaceAlternateImages(@ptrCast(surface));
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return @bitCast(c.SDL_LockSurface(surface)); return @bitCast(c.SDL_LockSurface(@ptrCast(surface)));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
return c.SDL_UnlockSurface(surface); return c.SDL_UnlockSurface(@ptrCast(surface));
} }
pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool { pub inline fn saveBMP_IO(surface: *Surface, dst: ?*IOStream, closeio: bool) bool {
return @bitCast(c.SDL_SaveBMP_IO(surface, dst, @bitCast(closeio))); return @bitCast(c.SDL_SaveBMP_IO(@ptrCast(surface), @ptrCast(dst), @bitCast(closeio)));
} }
pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool { pub inline fn saveBMP(surface: *Surface, file: [*c]const u8) bool {
return @bitCast(c.SDL_SaveBMP(surface, file)); return @bitCast(c.SDL_SaveBMP(@ptrCast(surface), file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled))); return @bitCast(c.SDL_SetSurfaceRLE(@ptrCast(surface), @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasRLE(surface)); return @bitCast(c.SDL_SurfaceHasRLE(@ptrCast(surface)));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key)); return @bitCast(c.SDL_SetSurfaceColorKey(@ptrCast(surface), @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return @bitCast(c.SDL_SurfaceHasColorKey(surface)); return @bitCast(c.SDL_SurfaceHasColorKey(@ptrCast(surface)));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return @bitCast(c.SDL_GetSurfaceColorKey(surface, @ptrCast(key))); return @bitCast(c.SDL_GetSurfaceColorKey(@ptrCast(surface), @ptrCast(key)));
} }
pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool { pub inline fn setSurfaceColorMod(surface: *Surface, r: u8, g: u8, b: u8) bool {
return @bitCast(c.SDL_SetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_SetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool { pub inline fn getSurfaceColorMod(surface: *Surface, r: [*c]u8, g: [*c]u8, b: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b)); return @bitCast(c.SDL_GetSurfaceColorMod(@ptrCast(surface), r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_SetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha)); return @bitCast(c.SDL_GetSurfaceAlphaMod(@ptrCast(surface), alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_SetSurfaceBlendMode(@ptrCast(surface), @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode))); return @bitCast(c.SDL_GetSurfaceBlendMode(@ptrCast(surface), @ptrCast(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect))); return @bitCast(c.SDL_SetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect)); return @bitCast(c.SDL_GetSurfaceClipRect(@ptrCast(surface), @ptrCast(rect)));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip))); return @bitCast(c.SDL_FlipSurface(@ptrCast(surface), @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
return c.SDL_DuplicateSurface(surface); return @ptrCast(c.SDL_DuplicateSurface(@ptrCast(surface)));
} }
pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface { pub inline fn scaleSurface(surface: *Surface, width: c_int, height: c_int, scaleMode: ScaleMode) ?*Surface {
return c.SDL_ScaleSurface(surface, width, height, @intFromEnum(scaleMode)); return @ptrCast(c.SDL_ScaleSurface(@ptrCast(surface), width, height, @intFromEnum(scaleMode)));
} }
pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface { pub inline fn convertSurface(surface: *Surface, format: PixelFormat) ?*Surface {
return c.SDL_ConvertSurface(surface, @bitCast(format)); return @ptrCast(c.SDL_ConvertSurface(@ptrCast(surface), @bitCast(format)));
} }
pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface { pub inline fn convertSurfaceAndColorspace(surface: *Surface, format: PixelFormat, palette: ?*Palette, colorspace: Colorspace, props: PropertiesID) ?*Surface {
return c.SDL_ConvertSurfaceAndColorspace(surface, @bitCast(format), palette, colorspace, props); return @ptrCast(c.SDL_ConvertSurfaceAndColorspace(@ptrCast(surface), @bitCast(format), @ptrCast(palette), colorspace, props));
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return @bitCast(c.SDL_PremultiplySurfaceAlpha(surface, @bitCast(linear))); return @bitCast(c.SDL_PremultiplySurfaceAlpha(@ptrCast(surface), @bitCast(linear)));
} }
pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn clearSurface(surface: *Surface, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_ClearSurface(surface, r, g, b, a)); return @bitCast(c.SDL_ClearSurface(@ptrCast(surface), r, g, b, a));
} }
pub inline fn fillSurfaceRect(surface: *Surface, rect: *const Rect, color: u32) bool { pub inline fn fillSurfaceRect(surface: *Surface, rect: ?*const Rect, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color)); return @bitCast(c.SDL_FillSurfaceRect(@ptrCast(surface), @ptrCast(rect), color));
} }
pub inline fn fillSurfaceRects(surface: *Surface, rects: *const Rect, count: c_int, color: u32) bool { pub inline fn fillSurfaceRects(surface: *Surface, rects: ?*const Rect, count: c_int, color: u32) bool {
return @bitCast(c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color)); return @bitCast(c.SDL_FillSurfaceRects(@ptrCast(surface), @ptrCast(rects), count, color));
} }
pub inline fn blitSurface(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceUnchecked(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceUnchecked(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect, scaleMode: ScaleMode) bool { pub inline fn blitSurfaceUncheckedScaled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect, scaleMode: ScaleMode) bool {
return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode))); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect), @intFromEnum(scaleMode)));
} }
pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: *const Rect, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiled(surface: *Surface, srcrect: ?*const Rect, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiled(@ptrCast(surface), @ptrCast(srcrect), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: *const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurfaceTiledWithScale(surface: *Surface, srcrect: ?*const Rect, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(@ptrCast(surface), @ptrCast(srcrect), scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn blitSurface9Grid(surface: *Surface, srcrect: *const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: *const Rect) bool { pub inline fn blitSurface9Grid(surface: *Surface, srcrect: ?*const Rect, left_width: c_int, right_width: c_int, top_height: c_int, bottom_height: c_int, scale: f32, scaleMode: ScaleMode, dst: ?*Surface, dstrect: ?*const Rect) bool {
return @bitCast(c.SDL_BlitSurface9Grid(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect))); return @bitCast(c.SDL_BlitSurface9Grid(@ptrCast(surface), @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), @ptrCast(dst), @ptrCast(dstrect)));
} }
pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 { pub inline fn mapSurfaceRGB(surface: *Surface, r: u8, g: u8, b: u8) u32 {
return c.SDL_MapSurfaceRGB(surface, r, g, b); return c.SDL_MapSurfaceRGB(@ptrCast(surface), r, g, b);
} }
pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 { pub inline fn mapSurfaceRGBA(surface: *Surface, r: u8, g: u8, b: u8, a: u8) u32 {
return c.SDL_MapSurfaceRGBA(surface, r, g, b, a); return c.SDL_MapSurfaceRGBA(@ptrCast(surface), r, g, b, a);
} }
pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool { pub inline fn readSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: [*c]u8, g: [*c]u8, b: [*c]u8, a: [*c]u8) bool {
return @bitCast(c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_ReadSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool { pub inline fn readSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: *f32, g: *f32, b: *f32, a: *f32) bool {
return @bitCast(c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a))); return @bitCast(c.SDL_ReadSurfacePixelFloat(@ptrCast(surface), x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)));
} }
pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool { pub inline fn writeSurfacePixel(surface: *Surface, x: c_int, y: c_int, r: u8, g: u8, b: u8, a: u8) bool {
return @bitCast(c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixel(@ptrCast(surface), x, y, r, g, b, a));
} }
pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool { pub inline fn writeSurfacePixelFloat(surface: *Surface, x: c_int, y: c_int, r: f32, g: f32, b: f32, a: f32) bool {
return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a)); return @bitCast(c.SDL_WriteSurfacePixelFloat(@ptrCast(surface), x, y, r, g, b, a));
} }
}; };
pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface { pub inline fn createSurface(width: c_int, height: c_int, format: PixelFormat) ?*Surface {
return c.SDL_CreateSurface(width, height, @bitCast(format)); return @ptrCast(c.SDL_CreateSurface(width, height, @bitCast(format)));
} }
pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface { pub inline fn createSurfaceFrom(width: c_int, height: c_int, format: PixelFormat, pixels: ?*anyopaque, pitch: c_int) ?*Surface {
return c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch); return @ptrCast(c.SDL_CreateSurfaceFrom(width, height, @bitCast(format), pixels, pitch));
} }
pub inline fn loadBMP(file: [*c]const u8) ?*Surface { pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
return c.SDL_LoadBMP(file); return @ptrCast(c.SDL_LoadBMP(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 { 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 {

View File

@ -5,7 +5,7 @@ pub const DisplayID = u32;
pub const Window = opaque { pub const Window = opaque {
pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool { pub inline fn setiOSAnimationCallback(window: *Window, interval: c_int, callback: iOSAnimationCallback, callbackParam: ?*anyopaque) bool {
return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam)); return @bitCast(c.SDL_SetiOSAnimationCallback(@ptrCast(window), interval, callback, callbackParam));
} }
}; };

View File

@ -27,19 +27,19 @@ pub const TimeFormat = enum(c_int) {
}; };
pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool { pub inline fn getDateTimeLocalePreferences(dateFormat: ?*DateFormat, timeFormat: ?*TimeFormat) bool {
return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat))); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@ptrCast(dateFormat), @ptrCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return @bitCast(c.SDL_GetCurrentTime(ticks)); return @bitCast(c.SDL_GetCurrentTime(@ptrCast(ticks)));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime))); return @bitCast(c.SDL_TimeToDateTime(ticks, @ptrCast(dt), @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: ?*const DateTime, ticks: ?*Time) bool {
return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), ticks)); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), @ptrCast(ticks)));
} }
pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void { pub inline fn timeToWindows(ticks: Time, dwLowDateTime: *u32, dwHighDateTime: *u32) void {

View File

@ -19,7 +19,7 @@ pub const Finger = extern struct {
}; };
pub inline fn getTouchDevices(count: *c_int) ?*TouchID { pub inline fn getTouchDevices(count: *c_int) ?*TouchID {
return c.SDL_GetTouchDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetTouchDevices(@ptrCast(count)));
} }
pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 { pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 {
@ -30,6 +30,6 @@ pub inline fn getTouchDeviceType(touchID: TouchID) TouchDeviceType {
return @intFromEnum(c.SDL_GetTouchDeviceType(touchID)); return @intFromEnum(c.SDL_GetTouchDeviceType(touchID));
} }
pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c][*c]Finger { pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c]?*Finger {
return c.SDL_GetTouchFingers(touchID, @ptrCast(count)); return c.SDL_GetTouchFingers(touchID, @ptrCast(count));
} }

View File

@ -65,267 +65,267 @@ pub const DisplayOrientation = enum(c_int) {
pub const Window = opaque { pub const Window = opaque {
pub inline fn getDisplayForWindow(window: *Window) DisplayID { pub inline fn getDisplayForWindow(window: *Window) DisplayID {
return c.SDL_GetDisplayForWindow(window); return c.SDL_GetDisplayForWindow(@ptrCast(window));
} }
pub inline fn getWindowPixelDensity(window: *Window) f32 { pub inline fn getWindowPixelDensity(window: *Window) f32 {
return c.SDL_GetWindowPixelDensity(window); return c.SDL_GetWindowPixelDensity(@ptrCast(window));
} }
pub inline fn getWindowDisplayScale(window: *Window) f32 { pub inline fn getWindowDisplayScale(window: *Window) f32 {
return c.SDL_GetWindowDisplayScale(window); return c.SDL_GetWindowDisplayScale(@ptrCast(window));
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: ?*const DisplayMode) bool {
return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode))); return @bitCast(c.SDL_SetWindowFullscreenMode(@ptrCast(window), @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) ?*const DisplayMode {
return @ptrCast(c.SDL_GetWindowFullscreenMode(window)); return @ptrCast(c.SDL_GetWindowFullscreenMode(@ptrCast(window)));
} }
pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque { pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque {
return c.SDL_GetWindowICCProfile(window, @ptrCast(size)); return c.SDL_GetWindowICCProfile(@ptrCast(window), @ptrCast(size));
} }
pub inline fn getWindowPixelFormat(window: *Window) PixelFormat { pub inline fn getWindowPixelFormat(window: *Window) PixelFormat {
return @bitCast(c.SDL_GetWindowPixelFormat(window)); return @bitCast(c.SDL_GetWindowPixelFormat(@ptrCast(window)));
} }
pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreatePopupWindow(window, offset_x, offset_y, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreatePopupWindow(@ptrCast(window), offset_x, offset_y, w, h, @bitCast(flags)));
} }
pub inline fn getWindowID(window: *Window) WindowID { pub inline fn getWindowID(window: *Window) WindowID {
return c.SDL_GetWindowID(window); return c.SDL_GetWindowID(@ptrCast(window));
} }
pub inline fn getWindowParent(window: *Window) ?*Window { pub inline fn getWindowParent(window: *Window) ?*Window {
return c.SDL_GetWindowParent(window); return @ptrCast(c.SDL_GetWindowParent(@ptrCast(window)));
} }
pub inline fn getWindowProperties(window: *Window) PropertiesID { pub inline fn getWindowProperties(window: *Window) PropertiesID {
return c.SDL_GetWindowProperties(window); return c.SDL_GetWindowProperties(@ptrCast(window));
} }
pub inline fn getWindowFlags(window: *Window) WindowFlags { pub inline fn getWindowFlags(window: *Window) WindowFlags {
return @bitCast(c.SDL_GetWindowFlags(window)); return @bitCast(c.SDL_GetWindowFlags(@ptrCast(window)));
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return @bitCast(c.SDL_SetWindowTitle(window, title)); return @bitCast(c.SDL_SetWindowTitle(@ptrCast(window), title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
return c.SDL_GetWindowTitle(window); return c.SDL_GetWindowTitle(@ptrCast(window));
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowIcon(window, icon)); return @bitCast(c.SDL_SetWindowIcon(@ptrCast(window), @ptrCast(icon)));
} }
pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool { pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_SetWindowPosition(window, x, y)); return @bitCast(c.SDL_SetWindowPosition(@ptrCast(window), x, y));
} }
pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool { pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool {
return @bitCast(c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y))); return @bitCast(c.SDL_GetWindowPosition(@ptrCast(window), @ptrCast(x), @ptrCast(y)));
} }
pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool { pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool {
return @bitCast(c.SDL_SetWindowSize(window, w, h)); return @bitCast(c.SDL_SetWindowSize(@ptrCast(window), w, h));
} }
pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetWindowSafeArea(window, rect)); return @bitCast(c.SDL_GetWindowSafeArea(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool { pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool {
return @bitCast(c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect)); return @bitCast(c.SDL_SetWindowAspectRatio(@ptrCast(window), min_aspect, max_aspect));
} }
pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool { pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool {
return @bitCast(c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect))); return @bitCast(c.SDL_GetWindowAspectRatio(@ptrCast(window), @ptrCast(min_aspect), @ptrCast(max_aspect)));
} }
pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool { pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool {
return @bitCast(c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right))); return @bitCast(c.SDL_GetWindowBordersSize(@ptrCast(window), @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)));
} }
pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowSizeInPixels(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool { pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMinimumSize(window, min_w, min_h)); return @bitCast(c.SDL_SetWindowMinimumSize(@ptrCast(window), min_w, min_h));
} }
pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMinimumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool { pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool {
return @bitCast(c.SDL_SetWindowMaximumSize(window, max_w, max_h)); return @bitCast(c.SDL_SetWindowMaximumSize(@ptrCast(window), max_w, max_h));
} }
pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool { pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool {
return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h))); return @bitCast(c.SDL_GetWindowMaximumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered))); return @bitCast(c.SDL_SetWindowBordered(@ptrCast(window), @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable))); return @bitCast(c.SDL_SetWindowResizable(@ptrCast(window), @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top))); return @bitCast(c.SDL_SetWindowAlwaysOnTop(@ptrCast(window), @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return @bitCast(c.SDL_ShowWindow(window)); return @bitCast(c.SDL_ShowWindow(@ptrCast(window)));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return @bitCast(c.SDL_HideWindow(window)); return @bitCast(c.SDL_HideWindow(@ptrCast(window)));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return @bitCast(c.SDL_RaiseWindow(window)); return @bitCast(c.SDL_RaiseWindow(@ptrCast(window)));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MaximizeWindow(window)); return @bitCast(c.SDL_MaximizeWindow(@ptrCast(window)));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return @bitCast(c.SDL_MinimizeWindow(window)); return @bitCast(c.SDL_MinimizeWindow(@ptrCast(window)));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return @bitCast(c.SDL_RestoreWindow(window)); return @bitCast(c.SDL_RestoreWindow(@ptrCast(window)));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen))); return @bitCast(c.SDL_SetWindowFullscreen(@ptrCast(window), @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return @bitCast(c.SDL_SyncWindow(window)); return @bitCast(c.SDL_SyncWindow(@ptrCast(window)));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return @bitCast(c.SDL_WindowHasSurface(window)); return @bitCast(c.SDL_WindowHasSurface(@ptrCast(window)));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
return c.SDL_GetWindowSurface(window); return @ptrCast(c.SDL_GetWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync)); return @bitCast(c.SDL_SetWindowSurfaceVSync(@ptrCast(window), vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync))); return @bitCast(c.SDL_GetWindowSurfaceVSync(@ptrCast(window), @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_UpdateWindowSurface(window)); return @bitCast(c.SDL_UpdateWindowSurface(@ptrCast(window)));
} }
pub inline fn updateWindowSurfaceRects(window: *Window, rects: *const Rect, numrects: c_int) bool { pub inline fn updateWindowSurfaceRects(window: *Window, rects: ?*const Rect, numrects: c_int) bool {
return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects)); return @bitCast(c.SDL_UpdateWindowSurfaceRects(@ptrCast(window), @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return @bitCast(c.SDL_DestroyWindowSurface(window)); return @bitCast(c.SDL_DestroyWindowSurface(@ptrCast(window)));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowKeyboardGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed))); return @bitCast(c.SDL_SetWindowMouseGrab(@ptrCast(window), @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowKeyboardGrab(window)); return @bitCast(c.SDL_GetWindowKeyboardGrab(@ptrCast(window)));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return @bitCast(c.SDL_GetWindowMouseGrab(window)); return @bitCast(c.SDL_GetWindowMouseGrab(@ptrCast(window)));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: ?*const Rect) bool {
return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect))); return @bitCast(c.SDL_SetWindowMouseRect(@ptrCast(window), @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) ?*const Rect {
return @ptrCast(c.SDL_GetWindowMouseRect(window)); return @ptrCast(c.SDL_GetWindowMouseRect(@ptrCast(window)));
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return @bitCast(c.SDL_SetWindowOpacity(window, opacity)); return @bitCast(c.SDL_SetWindowOpacity(@ptrCast(window), opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
return c.SDL_GetWindowOpacity(window); return c.SDL_GetWindowOpacity(@ptrCast(window));
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return @bitCast(c.SDL_SetWindowParent(window, parent)); return @bitCast(c.SDL_SetWindowParent(@ptrCast(window), @ptrCast(parent)));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal))); return @bitCast(c.SDL_SetWindowModal(@ptrCast(window), @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return @bitCast(c.SDL_SetWindowFocusable(window, @bitCast(focusable))); return @bitCast(c.SDL_SetWindowFocusable(@ptrCast(window), @bitCast(focusable)));
} }
pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool { pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool {
return @bitCast(c.SDL_ShowWindowSystemMenu(window, x, y)); return @bitCast(c.SDL_ShowWindowSystemMenu(@ptrCast(window), x, y));
} }
pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool { pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool {
return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data)); return @bitCast(c.SDL_SetWindowHitTest(@ptrCast(window), callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return @bitCast(c.SDL_SetWindowShape(window, shape)); return @bitCast(c.SDL_SetWindowShape(@ptrCast(window), @ptrCast(shape)));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation))); return @bitCast(c.SDL_FlashWindow(@ptrCast(window), @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
return c.SDL_DestroyWindow(window); return c.SDL_DestroyWindow(@ptrCast(window));
} }
pub inline fn gl_CreateContext(window: *Window) GLContext { pub inline fn gl_CreateContext(window: *Window) GLContext {
return c.SDL_GL_CreateContext(window); return c.SDL_GL_CreateContext(@ptrCast(window));
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return @bitCast(c.SDL_GL_MakeCurrent(window, context)); return @bitCast(c.SDL_GL_MakeCurrent(@ptrCast(window), context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
return c.SDL_EGL_GetWindowSurface(window); return c.SDL_EGL_GetWindowSurface(@ptrCast(window));
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return @bitCast(c.SDL_GL_SwapWindow(window)); return @bitCast(c.SDL_GL_SwapWindow(@ptrCast(window)));
} }
}; };
@ -357,6 +357,8 @@ pub const WindowFlags = packed struct(u64) {
windowNotFocusable: bool = false, // window should not be focusable windowNotFocusable: bool = false, // window should not be focusable
pad0: u38 = 0, pad0: u38 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = WindowFlags{};
}; };
pub const FlashOperation = enum(c_int) { pub const FlashOperation = enum(c_int) {
@ -437,7 +439,7 @@ pub inline fn getSystemTheme() SystemTheme {
} }
pub inline fn getDisplays(count: *c_int) ?*DisplayID { pub inline fn getDisplays(count: *c_int) ?*DisplayID {
return c.SDL_GetDisplays(@ptrCast(count)); return @ptrCast(c.SDL_GetDisplays(@ptrCast(count)));
} }
pub inline fn getPrimaryDisplay() DisplayID { pub inline fn getPrimaryDisplay() DisplayID {
@ -453,11 +455,11 @@ pub inline fn getDisplayName(displayID: DisplayID) [*c]const u8 {
} }
pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect)); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, @ptrCast(rect)));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -472,48 +474,48 @@ pub inline fn getDisplayContentScale(displayID: DisplayID) f32 {
return c.SDL_GetDisplayContentScale(displayID); return c.SDL_GetDisplayContentScale(displayID);
} }
pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c][*c]DisplayMode { pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c]?*DisplayMode {
return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count))); return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count)));
} }
pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, closest: ?*DisplayMode) bool { pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, closest: ?*DisplayMode) bool {
return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(closest))); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @ptrCast(closest)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID)); return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID));
} }
pub inline fn getCurrentDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getCurrentDisplayMode(displayID: DisplayID) ?*const DisplayMode {
return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID)); return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID));
} }
pub inline fn getDisplayForPoint(point: *const Point) DisplayID { pub inline fn getDisplayForPoint(point: ?*const Point) DisplayID {
return c.SDL_GetDisplayForPoint(@ptrCast(point)); return c.SDL_GetDisplayForPoint(@ptrCast(point));
} }
pub inline fn getDisplayForRect(rect: *const Rect) DisplayID { pub inline fn getDisplayForRect(rect: ?*const Rect) DisplayID {
return c.SDL_GetDisplayForRect(@ptrCast(rect)); return c.SDL_GetDisplayForRect(@ptrCast(rect));
} }
pub inline fn getWindows(count: *c_int) [*c][*c]Window { pub inline fn getWindows(count: *c_int) [*c]?*Window {
return c.SDL_GetWindows(@ptrCast(count)); return c.SDL_GetWindows(@ptrCast(count));
} }
pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window { pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window {
return c.SDL_CreateWindow(title, w, h, @bitCast(flags)); return @ptrCast(c.SDL_CreateWindow(title, w, h, @bitCast(flags)));
} }
pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window { pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window {
return c.SDL_CreateWindowWithProperties(props); return @ptrCast(c.SDL_CreateWindowWithProperties(props));
} }
pub inline fn getWindowFromID(id: WindowID) ?*Window { pub inline fn getWindowFromID(id: WindowID) ?*Window {
return c.SDL_GetWindowFromID(id); return @ptrCast(c.SDL_GetWindowFromID(id));
} }
pub inline fn getGrabbedWindow() ?*Window { pub inline fn getGrabbedWindow() ?*Window {
return c.SDL_GetGrabbedWindow(); return @ptrCast(c.SDL_GetGrabbedWindow());
} }
pub const HitTestResult = enum(c_int) { pub const HitTestResult = enum(c_int) {
@ -576,7 +578,7 @@ pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
return c.SDL_GL_GetCurrentWindow(); return @ptrCast(c.SDL_GL_GetCurrentWindow());
} }
pub inline fn gl_GetCurrentContext() GLContext { pub inline fn gl_GetCurrentContext() GLContext {

View File

@ -41,12 +41,7 @@
"name": "SDL_GPUFence" "name": "SDL_GPUFence"
} }
], ],
"typedefs": [ "typedefs": [],
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32"
}
],
"function_pointers": [], "function_pointers": [],
"c_type_aliases": [], "c_type_aliases": [],
"enums": [ "enums": [
@ -2295,6 +2290,42 @@
} }
] ]
}, },
{
"name": "SDL_GPUShaderFormat",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_GPU_SHADERFORMAT_PRIVATE",
"value": "(1u << 0)",
"comment": "Shaders for NDA'd platforms."
},
{
"name": "SDL_GPU_SHADERFORMAT_SPIRV",
"value": "(1u << 1)",
"comment": "SPIR-V shaders for Vulkan."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXBC",
"value": "(1u << 2)",
"comment": "DXBC SM5_1 shaders for D3D12."
},
{
"name": "SDL_GPU_SHADERFORMAT_DXIL",
"value": "(1u << 3)",
"comment": "DXIL SM6_0 shaders for D3D12."
},
{
"name": "SDL_GPU_SHADERFORMAT_MSL",
"value": "(1u << 4)",
"comment": "MSL shaders for Metal."
},
{
"name": "SDL_GPU_SHADERFORMAT_METALLIB",
"value": "(1u << 5)",
"comment": "Precompiled metallib shaders for Metal."
}
]
},
{ {
"name": "SDL_GPUColorComponentFlags", "name": "SDL_GPUColorComponentFlags",
"underlying_type": "Uint8", "underlying_type": "Uint8",

View File

@ -48,40 +48,40 @@
"values": [ "values": [
{ {
"name": "SDL_INIT_AUDIO", "name": "SDL_INIT_AUDIO",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_VIDEO", "name": "SDL_INIT_VIDEO",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread" "comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread"
}, },
{ {
"name": "SDL_INIT_JOYSTICK", "name": "SDL_INIT_JOYSTICK",
"value": "0x00000200u", "value": "(1u << 9)",
"comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD" "comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD"
}, },
{ {
"name": "SDL_INIT_HAPTIC", "name": "SDL_INIT_HAPTIC",
"value": "0x00001000u" "value": "(1u << 12)"
}, },
{ {
"name": "SDL_INIT_GAMEPAD", "name": "SDL_INIT_GAMEPAD",
"value": "0x00002000u", "value": "(1u << 13)",
"comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`" "comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`"
}, },
{ {
"name": "SDL_INIT_EVENTS", "name": "SDL_INIT_EVENTS",
"value": "0x00004000u" "value": "(1u << 14)"
}, },
{ {
"name": "SDL_INIT_SENSOR", "name": "SDL_INIT_SENSOR",
"value": "0x00008000u", "value": "(1u << 15)",
"comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`"
}, },
{ {
"name": "SDL_INIT_CAMERA", "name": "SDL_INIT_CAMERA",
"value": "0x00010000u", "value": "(1u << 16)",
"comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`" "comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`"
} }
] ]

View File

@ -122,27 +122,27 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_ERROR", "name": "SDL_MESSAGEBOX_ERROR",
"value": "0x00000010u", "value": "(1u << 4)",
"comment": "error dialog" "comment": "error dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_WARNING", "name": "SDL_MESSAGEBOX_WARNING",
"value": "0x00000020u", "value": "(1u << 5)",
"comment": "warning dialog" "comment": "warning dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_INFORMATION", "name": "SDL_MESSAGEBOX_INFORMATION",
"value": "0x00000040u", "value": "(1u << 6)",
"comment": "informational dialog" "comment": "informational dialog"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT", "name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT",
"value": "0x00000080u", "value": "(1u << 7)",
"comment": "buttons placed left to right" "comment": "buttons placed left to right"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT", "name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT",
"value": "0x00000100u", "value": "(1u << 8)",
"comment": "buttons placed right to left" "comment": "buttons placed right to left"
} }
] ]
@ -153,12 +153,12 @@
"values": [ "values": [
{ {
"name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Marks the default button when return is hit" "comment": "Marks the default button when return is hit"
}, },
{ {
"name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT", "name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Marks the default button when escape is hit" "comment": "Marks the default button when escape is hit"
} }
] ]

View File

@ -125,23 +125,15 @@
"values": [ "values": [
{ {
"name": "SDL_BUTTON_LEFT", "name": "SDL_BUTTON_LEFT",
"value": "1" "value": "(1u << 0)"
}, },
{ {
"name": "SDL_BUTTON_MIDDLE", "name": "SDL_BUTTON_MIDDLE",
"value": "2" "value": "(1u << 1)"
},
{
"name": "SDL_BUTTON_RIGHT",
"value": "3"
}, },
{ {
"name": "SDL_BUTTON_X1", "name": "SDL_BUTTON_X1",
"value": "4" "value": "(1u << 2)"
},
{
"name": "SDL_BUTTON_X2",
"value": "5"
} }
] ]
} }

View File

@ -49,22 +49,22 @@
"values": [ "values": [
{ {
"name": "SDL_SURFACE_PREALLOCATED", "name": "SDL_SURFACE_PREALLOCATED",
"value": "0x00000001u", "value": "(1u << 0)",
"comment": "Surface uses preallocated pixel memory" "comment": "Surface uses preallocated pixel memory"
}, },
{ {
"name": "SDL_SURFACE_LOCK_NEEDED", "name": "SDL_SURFACE_LOCK_NEEDED",
"value": "0x00000002u", "value": "(1u << 1)",
"comment": "Surface needs to be locked to access pixels" "comment": "Surface needs to be locked to access pixels"
}, },
{ {
"name": "SDL_SURFACE_LOCKED", "name": "SDL_SURFACE_LOCKED",
"value": "0x00000004u", "value": "(1u << 2)",
"comment": "Surface is currently locked" "comment": "Surface is currently locked"
}, },
{ {
"name": "SDL_SURFACE_SIMD_ALIGNED", "name": "SDL_SURFACE_SIMD_ALIGNED",
"value": "0x00000008u", "value": "(1u << 3)",
"comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()" "comment": "Surface uses pixel memory allocated with SDL_aligned_alloc()"
} }
] ]

View File

@ -349,127 +349,127 @@
"values": [ "values": [
{ {
"name": "SDL_WINDOW_FULLSCREEN", "name": "SDL_WINDOW_FULLSCREEN",
"value": "SDL_UINT64_C(0x0000000000000001)", "value": "(1u << 0)",
"comment": "window is in fullscreen mode" "comment": "window is in fullscreen mode"
}, },
{ {
"name": "SDL_WINDOW_OPENGL", "name": "SDL_WINDOW_OPENGL",
"value": "SDL_UINT64_C(0x0000000000000002)", "value": "(1u << 1)",
"comment": "window usable with OpenGL context" "comment": "window usable with OpenGL context"
}, },
{ {
"name": "SDL_WINDOW_OCCLUDED", "name": "SDL_WINDOW_OCCLUDED",
"value": "SDL_UINT64_C(0x0000000000000004)", "value": "(1u << 2)",
"comment": "window is occluded" "comment": "window is occluded"
}, },
{ {
"name": "SDL_WINDOW_HIDDEN", "name": "SDL_WINDOW_HIDDEN",
"value": "SDL_UINT64_C(0x0000000000000008)", "value": "(1u << 3)",
"comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible" "comment": "window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible"
}, },
{ {
"name": "SDL_WINDOW_BORDERLESS", "name": "SDL_WINDOW_BORDERLESS",
"value": "SDL_UINT64_C(0x0000000000000010)", "value": "(1u << 4)",
"comment": "no window decoration" "comment": "no window decoration"
}, },
{ {
"name": "SDL_WINDOW_RESIZABLE", "name": "SDL_WINDOW_RESIZABLE",
"value": "SDL_UINT64_C(0x0000000000000020)", "value": "(1u << 5)",
"comment": "window can be resized" "comment": "window can be resized"
}, },
{ {
"name": "SDL_WINDOW_MINIMIZED", "name": "SDL_WINDOW_MINIMIZED",
"value": "SDL_UINT64_C(0x0000000000000040)", "value": "(1u << 6)",
"comment": "window is minimized" "comment": "window is minimized"
}, },
{ {
"name": "SDL_WINDOW_MAXIMIZED", "name": "SDL_WINDOW_MAXIMIZED",
"value": "SDL_UINT64_C(0x0000000000000080)", "value": "(1u << 7)",
"comment": "window is maximized" "comment": "window is maximized"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_GRABBED", "name": "SDL_WINDOW_MOUSE_GRABBED",
"value": "SDL_UINT64_C(0x0000000000000100)", "value": "(1u << 8)",
"comment": "window has grabbed mouse input" "comment": "window has grabbed mouse input"
}, },
{ {
"name": "SDL_WINDOW_INPUT_FOCUS", "name": "SDL_WINDOW_INPUT_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000200)", "value": "(1u << 9)",
"comment": "window has input focus" "comment": "window has input focus"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_FOCUS", "name": "SDL_WINDOW_MOUSE_FOCUS",
"value": "SDL_UINT64_C(0x0000000000000400)", "value": "(1u << 10)",
"comment": "window has mouse focus" "comment": "window has mouse focus"
}, },
{ {
"name": "SDL_WINDOW_EXTERNAL", "name": "SDL_WINDOW_EXTERNAL",
"value": "SDL_UINT64_C(0x0000000000000800)", "value": "(1u << 11)",
"comment": "window not created by SDL" "comment": "window not created by SDL"
}, },
{ {
"name": "SDL_WINDOW_MODAL", "name": "SDL_WINDOW_MODAL",
"value": "SDL_UINT64_C(0x0000000000001000)", "value": "(1u << 12)",
"comment": "window is modal" "comment": "window is modal"
}, },
{ {
"name": "SDL_WINDOW_HIGH_PIXEL_DENSITY", "name": "SDL_WINDOW_HIGH_PIXEL_DENSITY",
"value": "SDL_UINT64_C(0x0000000000002000)", "value": "(1u << 13)",
"comment": "window uses high pixel density back buffer if possible" "comment": "window uses high pixel density back buffer if possible"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_CAPTURE", "name": "SDL_WINDOW_MOUSE_CAPTURE",
"value": "SDL_UINT64_C(0x0000000000004000)", "value": "(1u << 14)",
"comment": "window has mouse captured (unrelated to MOUSE_GRABBED)" "comment": "window has mouse captured (unrelated to MOUSE_GRABBED)"
}, },
{ {
"name": "SDL_WINDOW_MOUSE_RELATIVE_MODE", "name": "SDL_WINDOW_MOUSE_RELATIVE_MODE",
"value": "SDL_UINT64_C(0x0000000000008000)", "value": "(1u << 15)",
"comment": "window has relative mode enabled" "comment": "window has relative mode enabled"
}, },
{ {
"name": "SDL_WINDOW_ALWAYS_ON_TOP", "name": "SDL_WINDOW_ALWAYS_ON_TOP",
"value": "SDL_UINT64_C(0x0000000000010000)", "value": "(1u << 16)",
"comment": "window should always be above others" "comment": "window should always be above others"
}, },
{ {
"name": "SDL_WINDOW_UTILITY", "name": "SDL_WINDOW_UTILITY",
"value": "SDL_UINT64_C(0x0000000000020000)", "value": "(1u << 17)",
"comment": "window should be treated as a utility window, not showing in the task bar and window list" "comment": "window should be treated as a utility window, not showing in the task bar and window list"
}, },
{ {
"name": "SDL_WINDOW_TOOLTIP", "name": "SDL_WINDOW_TOOLTIP",
"value": "SDL_UINT64_C(0x0000000000040000)", "value": "(1u << 18)",
"comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window" "comment": "window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_POPUP_MENU", "name": "SDL_WINDOW_POPUP_MENU",
"value": "SDL_UINT64_C(0x0000000000080000)", "value": "(1u << 19)",
"comment": "window should be treated as a popup menu, requires a parent window" "comment": "window should be treated as a popup menu, requires a parent window"
}, },
{ {
"name": "SDL_WINDOW_KEYBOARD_GRABBED", "name": "SDL_WINDOW_KEYBOARD_GRABBED",
"value": "SDL_UINT64_C(0x0000000000100000)", "value": "(1u << 20)",
"comment": "window has grabbed keyboard input" "comment": "window has grabbed keyboard input"
}, },
{ {
"name": "SDL_WINDOW_VULKAN", "name": "SDL_WINDOW_VULKAN",
"value": "SDL_UINT64_C(0x0000000010000000)", "value": "(1u << 28)",
"comment": "window usable for Vulkan surface" "comment": "window usable for Vulkan surface"
}, },
{ {
"name": "SDL_WINDOW_METAL", "name": "SDL_WINDOW_METAL",
"value": "SDL_UINT64_C(0x0000000020000000)", "value": "(1u << 29)",
"comment": "window usable for Metal view" "comment": "window usable for Metal view"
}, },
{ {
"name": "SDL_WINDOW_TRANSPARENT", "name": "SDL_WINDOW_TRANSPARENT",
"value": "SDL_UINT64_C(0x0000000040000000)", "value": "(1u << 30)",
"comment": "window with transparent buffer" "comment": "window with transparent buffer"
}, },
{ {
"name": "SDL_WINDOW_NOT_FOCUSABLE", "name": "SDL_WINDOW_NOT_FOCUSABLE",
"value": "SDL_UINT64_C(0x0000000080000000)", "value": "(1u << 31)",
"comment": "window should not be focusable" "comment": "window should not be focusable"
} }
] ]

View File

@ -5,7 +5,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn loadWAV_IO(iostream: *IOStream, closeio: bool, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, 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 @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV_IO(@ptrCast(iostream), @bitCast(closeio), @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -31,111 +31,111 @@ pub const AudioSpec = extern struct {
pub const AudioStream = opaque { pub const AudioStream = opaque {
pub inline fn unbindAudioStream(audiostream: *AudioStream) void { pub inline fn unbindAudioStream(audiostream: *AudioStream) void {
return c.SDL_UnbindAudioStream(audiostream); return c.SDL_UnbindAudioStream(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID { pub inline fn getAudioStreamDevice(audiostream: *AudioStream) AudioDeviceID {
return c.SDL_GetAudioStreamDevice(audiostream); return c.SDL_GetAudioStreamDevice(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID { pub inline fn getAudioStreamProperties(audiostream: *AudioStream) PropertiesID {
return c.SDL_GetAudioStreamProperties(audiostream); return c.SDL_GetAudioStreamProperties(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool { pub inline fn getAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*AudioSpec, dst_spec: ?*AudioSpec) bool {
return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec)); return @bitCast(c.SDL_GetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: *const AudioSpec, dst_spec: *const AudioSpec) bool { pub inline fn setAudioStreamFormat(audiostream: *AudioStream, src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) bool {
return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec))); return @bitCast(c.SDL_SetAudioStreamFormat(@ptrCast(audiostream), @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamFrequencyRatio(audiostream); return c.SDL_GetAudioStreamFrequencyRatio(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio)); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(@ptrCast(audiostream), ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
return c.SDL_GetAudioStreamGain(audiostream); return c.SDL_GetAudioStreamGain(@ptrCast(audiostream));
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain)); return @bitCast(c.SDL_SetAudioStreamGain(@ptrCast(audiostream), gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamInputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamOutputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(audiostream, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioStreamOutputChannelMap(@ptrCast(audiostream), @ptrCast(count)));
} }
pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamInputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool { pub inline fn setAudioStreamOutputChannelMap(audiostream: *AudioStream, chmap: [*c]const c_int, count: c_int) bool {
return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count)); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(@ptrCast(audiostream), chmap, count));
} }
pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool { pub inline fn putAudioStreamData(audiostream: *AudioStream, buf: ?*const anyopaque, len: c_int) bool {
return @bitCast(c.SDL_PutAudioStreamData(audiostream, buf, len)); return @bitCast(c.SDL_PutAudioStreamData(@ptrCast(audiostream), buf, len));
} }
pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int { pub inline fn getAudioStreamData(audiostream: *AudioStream, buf: ?*anyopaque, len: c_int) c_int {
return c.SDL_GetAudioStreamData(audiostream, buf, len); return c.SDL_GetAudioStreamData(@ptrCast(audiostream), buf, len);
} }
pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamAvailable(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamAvailable(audiostream); return c.SDL_GetAudioStreamAvailable(@ptrCast(audiostream));
} }
pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int { pub inline fn getAudioStreamQueued(audiostream: *AudioStream) c_int {
return c.SDL_GetAudioStreamQueued(audiostream); return c.SDL_GetAudioStreamQueued(@ptrCast(audiostream));
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_FlushAudioStream(audiostream)); return @bitCast(c.SDL_FlushAudioStream(@ptrCast(audiostream)));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ClearAudioStream(audiostream)); return @bitCast(c.SDL_ClearAudioStream(@ptrCast(audiostream)));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream)); return @bitCast(c.SDL_PauseAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream)); return @bitCast(c.SDL_ResumeAudioStreamDevice(@ptrCast(audiostream)));
} }
pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool { pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_AudioStreamDevicePaused(audiostream)); return @bitCast(c.SDL_AudioStreamDevicePaused(@ptrCast(audiostream)));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_LockAudioStream(audiostream)); return @bitCast(c.SDL_LockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return @bitCast(c.SDL_UnlockAudioStream(audiostream)); return @bitCast(c.SDL_UnlockAudioStream(@ptrCast(audiostream)));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamGetCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamPutCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata)); return @bitCast(c.SDL_SetAudioStreamPutCallback(@ptrCast(audiostream), callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
return c.SDL_DestroyAudioStream(audiostream); return c.SDL_DestroyAudioStream(@ptrCast(audiostream));
} }
}; };
@ -152,11 +152,11 @@ pub inline fn getCurrentAudioDriver() [*c]const u8 {
} }
pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioPlaybackDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioPlaybackDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioPlaybackDevices(@ptrCast(count)));
} }
pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID { pub inline fn getAudioRecordingDevices(count: *c_int) ?*AudioDeviceID {
return c.SDL_GetAudioRecordingDevices(@ptrCast(count)); return @ptrCast(c.SDL_GetAudioRecordingDevices(@ptrCast(count)));
} }
pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 { pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
@ -164,14 +164,14 @@ pub inline fn getAudioDeviceName(devid: AudioDeviceID) [*c]const u8 {
} }
pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool { pub inline fn getAudioDeviceFormat(devid: AudioDeviceID, spec: ?*AudioSpec, sample_frames: *c_int) bool {
return @bitCast(c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames))); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, @ptrCast(spec), @ptrCast(sample_frames)));
} }
pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int { pub inline fn getAudioDeviceChannelMap(devid: AudioDeviceID, count: *c_int) *c_int {
return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count))); return @ptrCast(c.SDL_GetAudioDeviceChannelMap(devid, @ptrCast(count)));
} }
pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) AudioDeviceID { pub inline fn openAudioDevice(devid: AudioDeviceID, spec: ?*const AudioSpec) AudioDeviceID {
return c.SDL_OpenAudioDevice(devid, @ptrCast(spec)); return c.SDL_OpenAudioDevice(devid, @ptrCast(spec));
} }
@ -207,26 +207,26 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
return c.SDL_CloseAudioDevice(devid); return c.SDL_CloseAudioDevice(devid);
} }
pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]*const AudioStream, num_streams: c_int) bool { pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c]?*const AudioStream, num_streams: c_int) bool {
return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams)); return @bitCast(c.SDL_BindAudioStreams(devid, streams, num_streams));
} }
pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool { pub inline fn bindAudioStream(devid: AudioDeviceID, stream: ?*AudioStream) bool {
return @bitCast(c.SDL_BindAudioStream(devid, stream)); return @bitCast(c.SDL_BindAudioStream(devid, @ptrCast(stream)));
} }
pub inline fn unbindAudioStreams(streams: [*c]*const AudioStream, num_streams: c_int) void { pub inline fn unbindAudioStreams(streams: [*c]?*const AudioStream, num_streams: c_int) void {
return c.SDL_UnbindAudioStreams(streams, num_streams); return c.SDL_UnbindAudioStreams(streams, num_streams);
} }
pub inline fn createAudioStream(src_spec: *const AudioSpec, dst_spec: *const AudioSpec) ?*AudioStream { pub inline fn createAudioStream(src_spec: ?*const AudioSpec, dst_spec: ?*const AudioSpec) ?*AudioStream {
return c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)); return @ptrCast(c.SDL_CreateAudioStream(@ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub const AudioStreamCallback = c.SDL_AudioStreamCallback; pub const AudioStreamCallback = c.SDL_AudioStreamCallback;
pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream { pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: ?*const AudioSpec, callback: AudioStreamCallback, userdata: ?*anyopaque) ?*AudioStream {
return c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata); return @ptrCast(c.SDL_OpenAudioDeviceStream(devid, @ptrCast(spec), callback, userdata));
} }
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
@ -236,14 +236,14 @@ pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostm
} }
pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool { pub inline fn loadWAV(path: [*c]const u8, spec: ?*AudioSpec, audio_buf: [*c][*c]u8, audio_len: *u32) bool {
return @bitCast(c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len))); return @bitCast(c.SDL_LoadWAV(path, @ptrCast(spec), audio_buf, @ptrCast(audio_len)));
} }
pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool { pub inline fn mixAudio(dst: [*c]u8, src: [*c]const u8, format: AudioFormat, len: u32, volume: f32) bool {
return @bitCast(c.SDL_MixAudio(dst, src, @bitCast(format), len, volume)); return @bitCast(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: [*c][*c]u8, 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 @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len))); return @bitCast(c.SDL_ConvertAudioSamples(@ptrCast(src_spec), src_data, src_len, @ptrCast(dst_spec), dst_data, @ptrCast(dst_len)));
} }

View File

@ -51,31 +51,31 @@ pub const CameraID = u32;
pub const Camera = opaque { pub const Camera = opaque {
pub inline fn getCameraPermissionState(camera: *Camera) c_int { pub inline fn getCameraPermissionState(camera: *Camera) c_int {
return c.SDL_GetCameraPermissionState(camera); return c.SDL_GetCameraPermissionState(@ptrCast(camera));
} }
pub inline fn getCameraID(camera: *Camera) CameraID { pub inline fn getCameraID(camera: *Camera) CameraID {
return c.SDL_GetCameraID(camera); return c.SDL_GetCameraID(@ptrCast(camera));
} }
pub inline fn getCameraProperties(camera: *Camera) PropertiesID { pub inline fn getCameraProperties(camera: *Camera) PropertiesID {
return c.SDL_GetCameraProperties(camera); return c.SDL_GetCameraProperties(@ptrCast(camera));
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return @bitCast(c.SDL_GetCameraFormat(camera, spec)); return @bitCast(c.SDL_GetCameraFormat(@ptrCast(camera), @ptrCast(spec)));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {
return c.SDL_AcquireCameraFrame(camera, @ptrCast(timestampNS)); return @ptrCast(c.SDL_AcquireCameraFrame(@ptrCast(camera), @ptrCast(timestampNS)));
} }
pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void { pub inline fn releaseCameraFrame(camera: *Camera, frame: ?*Surface) void {
return c.SDL_ReleaseCameraFrame(camera, frame); return c.SDL_ReleaseCameraFrame(@ptrCast(camera), @ptrCast(frame));
} }
pub inline fn closeCamera(camera: *Camera) void { pub inline fn closeCamera(camera: *Camera) void {
return c.SDL_CloseCamera(camera); return c.SDL_CloseCamera(@ptrCast(camera));
} }
}; };
@ -107,10 +107,10 @@ pub inline fn getCurrentCameraDriver() [*c]const u8 {
} }
pub inline fn getCameras(count: *c_int) ?*CameraID { pub inline fn getCameras(count: *c_int) ?*CameraID {
return c.SDL_GetCameras(@ptrCast(count)); return @ptrCast(c.SDL_GetCameras(@ptrCast(count)));
} }
pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c][*c]CameraSpec { pub inline fn getCameraSupportedFormats(devid: CameraID, count: *c_int) [*c]?*CameraSpec {
return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count)); return c.SDL_GetCameraSupportedFormats(devid, @ptrCast(count));
} }
@ -122,6 +122,6 @@ pub inline fn getCameraPosition(instance_id: CameraID) CameraPosition {
return c.SDL_GetCameraPosition(instance_id); return c.SDL_GetCameraPosition(instance_id);
} }
pub inline fn openCamera(instance_id: CameraID, spec: *const CameraSpec) ?*Camera { pub inline fn openCamera(instance_id: CameraID, spec: ?*const CameraSpec) ?*Camera {
return c.SDL_OpenCamera(instance_id, @ptrCast(spec)); return @ptrCast(c.SDL_OpenCamera(instance_id, @ptrCast(spec)));
} }

View File

@ -12,16 +12,16 @@ pub const DialogFileFilter = extern struct {
pub const DialogFileCallback = c.SDL_DialogFileCallback; pub const DialogFileCallback = c.SDL_DialogFileCallback;
pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location, @bitCast(allow_many));
} }
pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void { pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: ?*const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void {
return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location); return c.SDL_ShowSaveFileDialog(callback, userdata, @ptrCast(window), @ptrCast(filters), nfilters, default_location);
} }
pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void { pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void {
return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many)); return c.SDL_ShowOpenFolderDialog(callback, userdata, @ptrCast(window), default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -21,6 +21,8 @@ pub const PenInputFlags = packed struct(u32) {
penInputEraserTip: bool = false, // eraser tip is used penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = PenInputFlags{};
}; };
pub const MouseButtonFlags = packed struct(u32) { pub const MouseButtonFlags = packed struct(u32) {
@ -29,6 +31,10 @@ pub const MouseButtonFlags = packed struct(u32) {
buttonX1: bool = false, buttonX1: bool = false,
pad0: u28 = 0, pad0: u28 = 0,
rsvd: bool = false, 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) { pub const Scancode = enum(c_int) {
@ -694,7 +700,7 @@ pub const EventAction = enum(c_int) {
}; };
pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int { pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int {
return c.SDL_PeepEvents(events, numevents, action, minType, maxType); return c.SDL_PeepEvents(@ptrCast(events), numevents, action, minType, maxType);
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
@ -714,19 +720,19 @@ pub inline fn flushEvents(minType: u32, maxType: u32) void {
} }
pub inline fn pollEvent(event: ?*Event) bool { pub inline fn pollEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PollEvent(event)); return @bitCast(c.SDL_PollEvent(@ptrCast(event)));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return @bitCast(c.SDL_WaitEvent(event)); return @bitCast(c.SDL_WaitEvent(@ptrCast(event)));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS)); return @bitCast(c.SDL_WaitEventTimeout(@ptrCast(event), timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return @bitCast(c.SDL_PushEvent(event)); return @bitCast(c.SDL_PushEvent(@ptrCast(event)));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,7 +742,7 @@ pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool { pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool {
return @bitCast(c.SDL_GetEventFilter(filter, userdata)); return @bitCast(c.SDL_GetEventFilter(@ptrCast(filter), userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
@ -763,6 +769,6 @@ pub inline fn registerEvents(numevents: c_int) u32 {
return c.SDL_RegisterEvents(numevents); return c.SDL_RegisterEvents(numevents);
} }
pub inline fn getWindowFromEvent(event: *const Event) ?*Window { pub inline fn getWindowFromEvent(event: ?*const Event) ?*Window {
return c.SDL_GetWindowFromEvent(@ptrCast(event)); return @ptrCast(c.SDL_GetWindowFromEvent(@ptrCast(event)));
} }

View File

@ -49,6 +49,8 @@ pub const GlobFlags = packed struct(u32) {
globCaseinsensitive: bool = false, globCaseinsensitive: bool = false,
pad0: u30 = 0, pad0: u30 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GlobFlags{};
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
@ -80,7 +82,7 @@ pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return @bitCast(c.SDL_GetPathInfo(path, info)); return @bitCast(c.SDL_GetPathInfo(path, @ptrCast(info)));
} }
pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 { pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {

View File

@ -15,7 +15,7 @@ pub const PropertiesID = u32;
pub const IOStream = opaque { pub const IOStream = opaque {
pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int { pub inline fn addGamepadMappingsFromIO(iostream: *IOStream, closeio: bool) c_int {
return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio)); return c.SDL_AddGamepadMappingsFromIO(@ptrCast(iostream), @bitCast(closeio));
} }
}; };
@ -45,163 +45,163 @@ pub const Joystick = opaque {};
pub const Gamepad = opaque { pub const Gamepad = opaque {
pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 { pub inline fn getGamepadMapping(gamepad: *Gamepad) [*c]u8 {
return c.SDL_GetGamepadMapping(gamepad); return c.SDL_GetGamepadMapping(@ptrCast(gamepad));
} }
pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID { pub inline fn getGamepadProperties(gamepad: *Gamepad) PropertiesID {
return c.SDL_GetGamepadProperties(gamepad); return c.SDL_GetGamepadProperties(@ptrCast(gamepad));
} }
pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID { pub inline fn getGamepadID(gamepad: *Gamepad) JoystickID {
return c.SDL_GetGamepadID(gamepad); return c.SDL_GetGamepadID(@ptrCast(gamepad));
} }
pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadName(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadName(gamepad); return c.SDL_GetGamepadName(@ptrCast(gamepad));
} }
pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadPath(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadPath(gamepad); return c.SDL_GetGamepadPath(@ptrCast(gamepad));
} }
pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetGamepadType(gamepad)); return @intFromEnum(c.SDL_GetGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType { pub inline fn getRealGamepadType(gamepad: *Gamepad) GamepadType {
return @intFromEnum(c.SDL_GetRealGamepadType(gamepad)); return @intFromEnum(c.SDL_GetRealGamepadType(@ptrCast(gamepad)));
} }
pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int { pub inline fn getGamepadPlayerIndex(gamepad: *Gamepad) c_int {
return c.SDL_GetGamepadPlayerIndex(gamepad); return c.SDL_GetGamepadPlayerIndex(@ptrCast(gamepad));
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index)); return @bitCast(c.SDL_SetGamepadPlayerIndex(@ptrCast(gamepad), player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadVendor(gamepad); return c.SDL_GetGamepadVendor(@ptrCast(gamepad));
} }
pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 { pub inline fn getGamepadProduct(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProduct(gamepad); return c.SDL_GetGamepadProduct(@ptrCast(gamepad));
} }
pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadProductVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadProductVersion(gamepad); return c.SDL_GetGamepadProductVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 { pub inline fn getGamepadFirmwareVersion(gamepad: *Gamepad) u16 {
return c.SDL_GetGamepadFirmwareVersion(gamepad); return c.SDL_GetGamepadFirmwareVersion(@ptrCast(gamepad));
} }
pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 { pub inline fn getGamepadSerial(gamepad: *Gamepad) [*c]const u8 {
return c.SDL_GetGamepadSerial(gamepad); return c.SDL_GetGamepadSerial(@ptrCast(gamepad));
} }
pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 { pub inline fn getGamepadSteamHandle(gamepad: *Gamepad) u64 {
return c.SDL_GetGamepadSteamHandle(gamepad); return c.SDL_GetGamepadSteamHandle(@ptrCast(gamepad));
} }
pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState { pub inline fn getGamepadConnectionState(gamepad: *Gamepad) JoystickConnectionState {
return c.SDL_GetGamepadConnectionState(gamepad); return c.SDL_GetGamepadConnectionState(@ptrCast(gamepad));
} }
pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState { pub inline fn getGamepadPowerInfo(gamepad: *Gamepad, percent: *c_int) PowerState {
return c.SDL_GetGamepadPowerInfo(gamepad, @ptrCast(percent)); return c.SDL_GetGamepadPowerInfo(@ptrCast(gamepad), @ptrCast(percent));
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return @bitCast(c.SDL_GamepadConnected(gamepad)); return @bitCast(c.SDL_GamepadConnected(@ptrCast(gamepad)));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
return c.SDL_GetGamepadJoystick(gamepad); return @ptrCast(c.SDL_GetGamepadJoystick(@ptrCast(gamepad)));
} }
pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c][*c]GamepadBinding { pub inline fn getGamepadBindings(gamepad: *Gamepad, count: *c_int) [*c]?*GamepadBinding {
return c.SDL_GetGamepadBindings(gamepad, @ptrCast(count)); return c.SDL_GetGamepadBindings(@ptrCast(gamepad), @ptrCast(count));
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis)); return @bitCast(c.SDL_GamepadHasAxis(@ptrCast(gamepad), axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
return c.SDL_GetGamepadAxis(gamepad, axis); return c.SDL_GetGamepadAxis(@ptrCast(gamepad), axis);
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GamepadHasButton(gamepad, button)); return @bitCast(c.SDL_GamepadHasButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return @bitCast(c.SDL_GetGamepadButton(gamepad, button)); return @bitCast(c.SDL_GetGamepadButton(@ptrCast(gamepad), button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
return c.SDL_GetGamepadButtonLabel(gamepad, button); return c.SDL_GetGamepadButtonLabel(@ptrCast(gamepad), button);
} }
pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int { pub inline fn getNumGamepadTouchpads(gamepad: *Gamepad) c_int {
return c.SDL_GetNumGamepadTouchpads(gamepad); return c.SDL_GetNumGamepadTouchpads(@ptrCast(gamepad));
} }
pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int { pub inline fn getNumGamepadTouchpadFingers(gamepad: *Gamepad, touchpad: c_int) c_int {
return c.SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad); return c.SDL_GetNumGamepadTouchpadFingers(@ptrCast(gamepad), touchpad);
} }
pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool { pub inline fn getGamepadTouchpadFinger(gamepad: *Gamepad, touchpad: c_int, finger: c_int, down: *bool, x: *f32, y: *f32, pressure: *f32) bool {
return @bitCast(c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure))); return @bitCast(c.SDL_GetGamepadTouchpadFinger(@ptrCast(gamepad), touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)));
} }
pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadHasSensor(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadHasSensor(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool { pub inline fn setGamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType, enabled: bool) bool {
return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled))); return @bitCast(c.SDL_SetGamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type))); return @bitCast(c.SDL_GamepadSensorEnabled(@ptrCast(gamepad), @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(_type)); return c.SDL_GetGamepadSensorDataRate(@ptrCast(gamepad), @intFromEnum(_type));
} }
pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool { pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool {
return @bitCast(c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values)); return @bitCast(c.SDL_GetGamepadSensorData(@ptrCast(gamepad), @intFromEnum(_type), @ptrCast(data), num_values));
} }
pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepad(gamepad: *Gamepad, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepad(@ptrCast(gamepad), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleGamepadTriggers(gamepad: *Gamepad, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleGamepadTriggers(@ptrCast(gamepad), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool { pub inline fn setGamepadLED(gamepad: *Gamepad, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetGamepadLED(gamepad, red, green, blue)); return @bitCast(c.SDL_SetGamepadLED(@ptrCast(gamepad), red, green, blue));
} }
pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendGamepadEffect(gamepad: *Gamepad, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size)); return @bitCast(c.SDL_SendGamepadEffect(@ptrCast(gamepad), data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
return c.SDL_CloseGamepad(gamepad); return c.SDL_CloseGamepad(@ptrCast(gamepad));
} }
pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForButton(gamepad: *Gamepad, button: GamepadButton) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button); return c.SDL_GetGamepadAppleSFSymbolsNameForButton(@ptrCast(gamepad), button);
} }
pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 { pub inline fn getGamepadAppleSFSymbolsNameForAxis(gamepad: *Gamepad, axis: GamepadAxis) [*c]const u8 {
return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis); return c.SDL_GetGamepadAppleSFSymbolsNameForAxis(@ptrCast(gamepad), axis);
} }
}; };
@ -308,7 +308,7 @@ pub inline fn hasGamepad() bool {
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
return c.SDL_GetGamepads(@ptrCast(count)); return @ptrCast(c.SDL_GetGamepads(@ptrCast(count)));
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
@ -356,15 +356,15 @@ pub inline fn getGamepadMappingForID(instance_id: JoystickID) [*c]u8 {
} }
pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad { pub inline fn openGamepad(instance_id: JoystickID) ?*Gamepad {
return c.SDL_OpenGamepad(instance_id); return @ptrCast(c.SDL_OpenGamepad(instance_id));
} }
pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad { pub inline fn getGamepadFromID(instance_id: JoystickID) ?*Gamepad {
return c.SDL_GetGamepadFromID(instance_id); return @ptrCast(c.SDL_GetGamepadFromID(instance_id));
} }
pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad { pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
return c.SDL_GetGamepadFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetGamepadFromPlayerIndex(player_index));
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {

View File

@ -27,155 +27,155 @@ pub const FlipMode = enum(c_int) {
pub const GPUDevice = opaque { pub const GPUDevice = opaque {
pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void {
return c.SDL_DestroyGPUDevice(gpudevice); return c.SDL_DestroyGPUDevice(@ptrCast(gpudevice));
} }
pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 { pub inline fn getGPUDeviceDriver(gpudevice: *GPUDevice) [*c]const u8 {
return c.SDL_GetGPUDeviceDriver(gpudevice); return c.SDL_GetGPUDeviceDriver(@ptrCast(gpudevice));
} }
pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat { pub inline fn getGPUShaderFormats(gpudevice: *GPUDevice) GPUShaderFormat {
return @bitCast(c.SDL_GetGPUShaderFormats(gpudevice)); return @bitCast(c.SDL_GetGPUShaderFormats(@ptrCast(gpudevice)));
} }
pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: *const GPUComputePipelineCreateInfo) ?*GPUComputePipeline { pub inline fn createGPUComputePipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUComputePipelineCreateInfo) ?*GPUComputePipeline {
return c.SDL_CreateGPUComputePipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: *const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline { pub inline fn createGPUGraphicsPipeline(gpudevice: *GPUDevice, createinfo: ?*const GPUGraphicsPipelineCreateInfo) ?*GPUGraphicsPipeline {
return c.SDL_CreateGPUGraphicsPipeline(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: *const GPUSamplerCreateInfo) ?*GPUSampler { pub inline fn createGPUSampler(gpudevice: *GPUDevice, createinfo: ?*const GPUSamplerCreateInfo) ?*GPUSampler {
return c.SDL_CreateGPUSampler(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUSampler(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: *const GPUShaderCreateInfo) ?*GPUShader { pub inline fn createGPUShader(gpudevice: *GPUDevice, createinfo: ?*const GPUShaderCreateInfo) ?*GPUShader {
return c.SDL_CreateGPUShader(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUShader(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: *const GPUTextureCreateInfo) ?*GPUTexture { pub inline fn createGPUTexture(gpudevice: *GPUDevice, createinfo: ?*const GPUTextureCreateInfo) ?*GPUTexture {
return c.SDL_CreateGPUTexture(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTexture(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: *const GPUBufferCreateInfo) ?*GPUBuffer { pub inline fn createGPUBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUBufferCreateInfo) ?*GPUBuffer {
return c.SDL_CreateGPUBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: *const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer { pub inline fn createGPUTransferBuffer(gpudevice: *GPUDevice, createinfo: ?*const GPUTransferBufferCreateInfo) ?*GPUTransferBuffer {
return c.SDL_CreateGPUTransferBuffer(gpudevice, @ptrCast(createinfo)); return @ptrCast(c.SDL_CreateGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(createinfo)));
} }
pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void { pub inline fn setGPUBufferName(gpudevice: *GPUDevice, buffer: ?*GPUBuffer, text: [*c]const u8) void {
return c.SDL_SetGPUBufferName(gpudevice, buffer, text); return c.SDL_SetGPUBufferName(@ptrCast(gpudevice), @ptrCast(buffer), text);
} }
pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void { pub inline fn setGPUTextureName(gpudevice: *GPUDevice, texture: ?*GPUTexture, text: [*c]const u8) void {
return c.SDL_SetGPUTextureName(gpudevice, texture, text); return c.SDL_SetGPUTextureName(@ptrCast(gpudevice), @ptrCast(texture), text);
} }
pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void { pub inline fn releaseGPUTexture(gpudevice: *GPUDevice, texture: ?*GPUTexture) void {
return c.SDL_ReleaseGPUTexture(gpudevice, texture); return c.SDL_ReleaseGPUTexture(@ptrCast(gpudevice), @ptrCast(texture));
} }
pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void { pub inline fn releaseGPUSampler(gpudevice: *GPUDevice, sampler: ?*GPUSampler) void {
return c.SDL_ReleaseGPUSampler(gpudevice, sampler); return c.SDL_ReleaseGPUSampler(@ptrCast(gpudevice), @ptrCast(sampler));
} }
pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void { pub inline fn releaseGPUBuffer(gpudevice: *GPUDevice, buffer: ?*GPUBuffer) void {
return c.SDL_ReleaseGPUBuffer(gpudevice, buffer); return c.SDL_ReleaseGPUBuffer(@ptrCast(gpudevice), @ptrCast(buffer));
} }
pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn releaseGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_ReleaseGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_ReleaseGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn releaseGPUComputePipeline(gpudevice: *GPUDevice, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_ReleaseGPUComputePipeline(gpudevice, compute_pipeline); return c.SDL_ReleaseGPUComputePipeline(@ptrCast(gpudevice), @ptrCast(compute_pipeline));
} }
pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void { pub inline fn releaseGPUShader(gpudevice: *GPUDevice, shader: ?*GPUShader) void {
return c.SDL_ReleaseGPUShader(gpudevice, shader); return c.SDL_ReleaseGPUShader(@ptrCast(gpudevice), @ptrCast(shader));
} }
pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn releaseGPUGraphicsPipeline(gpudevice: *GPUDevice, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_ReleaseGPUGraphicsPipeline(gpudevice, graphics_pipeline); return c.SDL_ReleaseGPUGraphicsPipeline(@ptrCast(gpudevice), @ptrCast(graphics_pipeline));
} }
pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer { pub inline fn acquireGPUCommandBuffer(gpudevice: *GPUDevice) ?*GPUCommandBuffer {
return c.SDL_AcquireGPUCommandBuffer(gpudevice); return @ptrCast(c.SDL_AcquireGPUCommandBuffer(@ptrCast(gpudevice)));
} }
pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque { pub inline fn mapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer, cycle: bool) ?*anyopaque {
return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle)); return c.SDL_MapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer), @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
return c.SDL_UnmapGPUTransferBuffer(gpudevice, transfer_buffer); return c.SDL_UnmapGPUTransferBuffer(@ptrCast(gpudevice), @ptrCast(transfer_buffer));
} }
pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool { pub inline fn windowSupportsGPUSwapchainComposition(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition) bool {
return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition)); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition));
} }
pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool { pub inline fn windowSupportsGPUPresentMode(gpudevice: *GPUDevice, window: ?*Window, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode))); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(@ptrCast(gpudevice), @ptrCast(window), @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window)); return @bitCast(c.SDL_ClaimWindowForGPUDevice(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
return c.SDL_ReleaseWindowFromGPUDevice(gpudevice, window); return c.SDL_ReleaseWindowFromGPUDevice(@ptrCast(gpudevice), @ptrCast(window));
} }
pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool { pub inline fn setGPUSwapchainParameters(gpudevice: *GPUDevice, window: ?*Window, swapchain_composition: GPUSwapchainComposition, present_mode: GPUPresentMode) bool {
return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode))); return @bitCast(c.SDL_SetGPUSwapchainParameters(@ptrCast(gpudevice), @ptrCast(window), swapchain_composition, @intFromEnum(present_mode)));
} }
pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool { pub inline fn setGPUAllowedFramesInFlight(gpudevice: *GPUDevice, allowed_frames_in_flight: u32) bool {
return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight)); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(@ptrCast(gpudevice), allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(gpudevice, window)); return @bitCast(c.SDL_GetGPUSwapchainTextureFormat(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window)); return @bitCast(c.SDL_WaitForGPUSwapchain(@ptrCast(gpudevice), @ptrCast(window)));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return @bitCast(c.SDL_WaitForGPUIdle(gpudevice)); return @bitCast(c.SDL_WaitForGPUIdle(@ptrCast(gpudevice)));
} }
pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]*const GPUFence, num_fences: u32) bool { pub inline fn waitForGPUFences(gpudevice: *GPUDevice, wait_all: bool, fences: [*c]?*const GPUFence, num_fences: u32) bool {
return @bitCast(c.SDL_WaitForGPUFences(gpudevice, @bitCast(wait_all), fences, num_fences)); return @bitCast(c.SDL_WaitForGPUFences(@ptrCast(gpudevice), @bitCast(wait_all), fences, num_fences));
} }
pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool { pub inline fn queryGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) bool {
return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence)); return @bitCast(c.SDL_QueryGPUFence(@ptrCast(gpudevice), @ptrCast(fence)));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
return c.SDL_ReleaseGPUFence(gpudevice, fence); return c.SDL_ReleaseGPUFence(@ptrCast(gpudevice), @ptrCast(fence));
} }
pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool { pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool {
return @bitCast(c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage))); return @bitCast(c.SDL_GPUTextureSupportsFormat(@ptrCast(gpudevice), @bitCast(format), @intFromEnum(_type), @bitCast(usage)));
} }
pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool { pub inline fn gpuTextureSupportsSampleCount(gpudevice: *GPUDevice, format: GPUTextureFormat, sample_count: GPUSampleCount) bool {
return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count)); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(@ptrCast(gpudevice), @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKSuspendGPU(gpudevice); return c.SDL_GDKSuspendGPU(@ptrCast(gpudevice));
} }
pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void { pub inline fn gdkResumeGPU(gpudevice: *GPUDevice) void {
return c.SDL_GDKResumeGPU(gpudevice); return c.SDL_GDKResumeGPU(@ptrCast(gpudevice));
} }
}; };
@ -195,201 +195,201 @@ pub const GPUGraphicsPipeline = opaque {};
pub const GPUCommandBuffer = opaque { pub const GPUCommandBuffer = opaque {
pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void { pub inline fn insertGPUDebugLabel(gpucommandbuffer: *GPUCommandBuffer, text: [*c]const u8) void {
return c.SDL_InsertGPUDebugLabel(gpucommandbuffer, text); return c.SDL_InsertGPUDebugLabel(@ptrCast(gpucommandbuffer), text);
} }
pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void { pub inline fn pushGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer, name: [*c]const u8) void {
return c.SDL_PushGPUDebugGroup(gpucommandbuffer, name); return c.SDL_PushGPUDebugGroup(@ptrCast(gpucommandbuffer), name);
} }
pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void { pub inline fn popGPUDebugGroup(gpucommandbuffer: *GPUCommandBuffer) void {
return c.SDL_PopGPUDebugGroup(gpucommandbuffer); return c.SDL_PopGPUDebugGroup(@ptrCast(gpucommandbuffer));
} }
pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUVertexUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUVertexUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUVertexUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUFragmentUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUFragmentUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUFragmentUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void { pub inline fn pushGPUComputeUniformData(gpucommandbuffer: *GPUCommandBuffer, slot_index: u32, data: ?*const anyopaque, length: u32) void {
return c.SDL_PushGPUComputeUniformData(gpucommandbuffer, slot_index, data, length); return c.SDL_PushGPUComputeUniformData(@ptrCast(gpucommandbuffer), slot_index, data, length);
} }
pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: *const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: *const GPUDepthStencilTargetInfo) ?*GPURenderPass { pub inline fn beginGPURenderPass(gpucommandbuffer: *GPUCommandBuffer, color_target_infos: ?*const GPUColorTargetInfo, num_color_targets: u32, depth_stencil_target_info: ?*const GPUDepthStencilTargetInfo) ?*GPURenderPass {
return c.SDL_BeginGPURenderPass(gpucommandbuffer, @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)); return @ptrCast(c.SDL_BeginGPURenderPass(@ptrCast(gpucommandbuffer), @ptrCast(color_target_infos), num_color_targets, @ptrCast(depth_stencil_target_info)));
} }
pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: *const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: *const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass { pub inline fn beginGPUComputePass(gpucommandbuffer: *GPUCommandBuffer, storage_texture_bindings: ?*const GPUStorageTextureReadWriteBinding, num_storage_texture_bindings: u32, storage_buffer_bindings: ?*const GPUStorageBufferReadWriteBinding, num_storage_buffer_bindings: u32) ?*GPUComputePass {
return c.SDL_BeginGPUComputePass(gpucommandbuffer, @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings); return @ptrCast(c.SDL_BeginGPUComputePass(@ptrCast(gpucommandbuffer), @ptrCast(storage_texture_bindings), num_storage_texture_bindings, @ptrCast(storage_buffer_bindings), num_storage_buffer_bindings));
} }
pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass { pub inline fn beginGPUCopyPass(gpucommandbuffer: *GPUCommandBuffer) ?*GPUCopyPass {
return c.SDL_BeginGPUCopyPass(gpucommandbuffer); return @ptrCast(c.SDL_BeginGPUCopyPass(@ptrCast(gpucommandbuffer)));
} }
pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void { pub inline fn generateMipmapsForGPUTexture(gpucommandbuffer: *GPUCommandBuffer, texture: ?*GPUTexture) void {
return c.SDL_GenerateMipmapsForGPUTexture(gpucommandbuffer, texture); return c.SDL_GenerateMipmapsForGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(texture));
} }
pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: *const GPUBlitInfo) void { pub inline fn blitGPUTexture(gpucommandbuffer: *GPUCommandBuffer, info: ?*const GPUBlitInfo) void {
return c.SDL_BlitGPUTexture(gpucommandbuffer, @ptrCast(info)); return c.SDL_BlitGPUTexture(@ptrCast(gpucommandbuffer), @ptrCast(info));
} }
pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn acquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool { pub inline fn waitAndAcquireGPUSwapchainTexture(gpucommandbuffer: *GPUCommandBuffer, window: ?*Window, swapchain_texture: [*c]?*GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height))); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(@ptrCast(gpucommandbuffer), @ptrCast(window), swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)));
} }
pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn submitGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_SubmitGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
return c.SDL_SubmitGPUCommandBufferAndAcquireFence(gpucommandbuffer); return @ptrCast(c.SDL_SubmitGPUCommandBufferAndAcquireFence(@ptrCast(gpucommandbuffer)));
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer)); return @bitCast(c.SDL_CancelGPUCommandBuffer(@ptrCast(gpucommandbuffer)));
} }
}; };
pub const GPURenderPass = opaque { pub const GPURenderPass = opaque {
pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void { pub inline fn bindGPUGraphicsPipeline(gpurenderpass: *GPURenderPass, graphics_pipeline: ?*GPUGraphicsPipeline) void {
return c.SDL_BindGPUGraphicsPipeline(gpurenderpass, graphics_pipeline); return c.SDL_BindGPUGraphicsPipeline(@ptrCast(gpurenderpass), @ptrCast(graphics_pipeline));
} }
pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: *const GPUViewport) void { pub inline fn setGPUViewport(gpurenderpass: *GPURenderPass, viewport: ?*const GPUViewport) void {
return c.SDL_SetGPUViewport(gpurenderpass, @ptrCast(viewport)); return c.SDL_SetGPUViewport(@ptrCast(gpurenderpass), @ptrCast(viewport));
} }
pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: *const Rect) void { pub inline fn setGPUScissor(gpurenderpass: *GPURenderPass, scissor: ?*const Rect) void {
return c.SDL_SetGPUScissor(gpurenderpass, @ptrCast(scissor)); return c.SDL_SetGPUScissor(@ptrCast(gpurenderpass), @ptrCast(scissor));
} }
pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void { pub inline fn setGPUBlendConstants(gpurenderpass: *GPURenderPass, blend_constants: FColor) void {
return c.SDL_SetGPUBlendConstants(gpurenderpass, blend_constants); return c.SDL_SetGPUBlendConstants(@ptrCast(gpurenderpass), blend_constants);
} }
pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void { pub inline fn setGPUStencilReference(gpurenderpass: *GPURenderPass, reference: u8) void {
return c.SDL_SetGPUStencilReference(gpurenderpass, reference); return c.SDL_SetGPUStencilReference(@ptrCast(gpurenderpass), reference);
} }
pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: *const GPUBufferBinding, num_bindings: u32) void { pub inline fn bindGPUVertexBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, bindings: ?*const GPUBufferBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexBuffers(gpurenderpass, first_slot, @ptrCast(bindings), num_bindings); return c.SDL_BindGPUVertexBuffers(@ptrCast(gpurenderpass), first_slot, @ptrCast(bindings), num_bindings);
} }
pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: *const GPUBufferBinding, index_element_size: GPUIndexElementSize) void { pub inline fn bindGPUIndexBuffer(gpurenderpass: *GPURenderPass, binding: ?*const GPUBufferBinding, index_element_size: GPUIndexElementSize) void {
return c.SDL_BindGPUIndexBuffer(gpurenderpass, @ptrCast(binding), index_element_size); return c.SDL_BindGPUIndexBuffer(@ptrCast(gpurenderpass), @ptrCast(binding), index_element_size);
} }
pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUVertexSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUVertexSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUVertexSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUVertexStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUVertexStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUVertexStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUVertexStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUVertexStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUFragmentSamplers(gpurenderpass: *GPURenderPass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUFragmentSamplers(gpurenderpass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUFragmentSamplers(@ptrCast(gpurenderpass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageTextures(gpurenderpass: *GPURenderPass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageTextures(gpurenderpass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUFragmentStorageTextures(@ptrCast(gpurenderpass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUFragmentStorageBuffers(gpurenderpass: *GPURenderPass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUFragmentStorageBuffers(gpurenderpass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUFragmentStorageBuffers(@ptrCast(gpurenderpass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void { pub inline fn drawGPUIndexedPrimitives(gpurenderpass: *GPURenderPass, num_indices: u32, num_instances: u32, first_index: u32, vertex_offset: i32, first_instance: u32) void {
return c.SDL_DrawGPUIndexedPrimitives(gpurenderpass, num_indices, num_instances, first_index, vertex_offset, first_instance); return c.SDL_DrawGPUIndexedPrimitives(@ptrCast(gpurenderpass), num_indices, num_instances, first_index, vertex_offset, first_instance);
} }
pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void { pub inline fn drawGPUPrimitives(gpurenderpass: *GPURenderPass, num_vertices: u32, num_instances: u32, first_vertex: u32, first_instance: u32) void {
return c.SDL_DrawGPUPrimitives(gpurenderpass, num_vertices, num_instances, first_vertex, first_instance); return c.SDL_DrawGPUPrimitives(@ptrCast(gpurenderpass), num_vertices, num_instances, first_vertex, first_instance);
} }
pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void { pub inline fn drawGPUIndexedPrimitivesIndirect(gpurenderpass: *GPURenderPass, buffer: ?*GPUBuffer, offset: u32, draw_count: u32) void {
return c.SDL_DrawGPUIndexedPrimitivesIndirect(gpurenderpass, buffer, offset, draw_count); return c.SDL_DrawGPUIndexedPrimitivesIndirect(@ptrCast(gpurenderpass), @ptrCast(buffer), offset, draw_count);
} }
pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void { pub inline fn endGPURenderPass(gpurenderpass: *GPURenderPass) void {
return c.SDL_EndGPURenderPass(gpurenderpass); return c.SDL_EndGPURenderPass(@ptrCast(gpurenderpass));
} }
}; };
pub const GPUComputePass = opaque { pub const GPUComputePass = opaque {
pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void { pub inline fn bindGPUComputePipeline(gpucomputepass: *GPUComputePass, compute_pipeline: ?*GPUComputePipeline) void {
return c.SDL_BindGPUComputePipeline(gpucomputepass, compute_pipeline); return c.SDL_BindGPUComputePipeline(@ptrCast(gpucomputepass), @ptrCast(compute_pipeline));
} }
pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: *const GPUTextureSamplerBinding, num_bindings: u32) void { pub inline fn bindGPUComputeSamplers(gpucomputepass: *GPUComputePass, first_slot: u32, texture_sampler_bindings: ?*const GPUTextureSamplerBinding, num_bindings: u32) void {
return c.SDL_BindGPUComputeSamplers(gpucomputepass, first_slot, @ptrCast(texture_sampler_bindings), num_bindings); return c.SDL_BindGPUComputeSamplers(@ptrCast(gpucomputepass), first_slot, @ptrCast(texture_sampler_bindings), num_bindings);
} }
pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]*const GPUTexture, num_bindings: u32) void { pub inline fn bindGPUComputeStorageTextures(gpucomputepass: *GPUComputePass, first_slot: u32, storage_textures: [*c]?*const GPUTexture, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageTextures(gpucomputepass, first_slot, storage_textures, num_bindings); return c.SDL_BindGPUComputeStorageTextures(@ptrCast(gpucomputepass), first_slot, storage_textures, num_bindings);
} }
pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]*const GPUBuffer, num_bindings: u32) void { pub inline fn bindGPUComputeStorageBuffers(gpucomputepass: *GPUComputePass, first_slot: u32, storage_buffers: [*c]?*const GPUBuffer, num_bindings: u32) void {
return c.SDL_BindGPUComputeStorageBuffers(gpucomputepass, first_slot, storage_buffers, num_bindings); return c.SDL_BindGPUComputeStorageBuffers(@ptrCast(gpucomputepass), first_slot, storage_buffers, num_bindings);
} }
pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void { pub inline fn dispatchGPUCompute(gpucomputepass: *GPUComputePass, groupcount_x: u32, groupcount_y: u32, groupcount_z: u32) void {
return c.SDL_DispatchGPUCompute(gpucomputepass, groupcount_x, groupcount_y, groupcount_z); return c.SDL_DispatchGPUCompute(@ptrCast(gpucomputepass), groupcount_x, groupcount_y, groupcount_z);
} }
pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void { pub inline fn dispatchGPUComputeIndirect(gpucomputepass: *GPUComputePass, buffer: ?*GPUBuffer, offset: u32) void {
return c.SDL_DispatchGPUComputeIndirect(gpucomputepass, buffer, offset); return c.SDL_DispatchGPUComputeIndirect(@ptrCast(gpucomputepass), @ptrCast(buffer), offset);
} }
pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void { pub inline fn endGPUComputePass(gpucomputepass: *GPUComputePass) void {
return c.SDL_EndGPUComputePass(gpucomputepass); return c.SDL_EndGPUComputePass(@ptrCast(gpucomputepass));
} }
}; };
pub const GPUCopyPass = opaque { pub const GPUCopyPass = opaque {
pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureTransferInfo, destination: *const GPUTextureRegion, cycle: bool) void { pub inline fn uploadToGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureTransferInfo, destination: ?*const GPUTextureRegion, cycle: bool) void {
return c.SDL_UploadToGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUTransferBufferLocation, destination: *const GPUBufferRegion, cycle: bool) void { pub inline fn uploadToGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUTransferBufferLocation, destination: ?*const GPUBufferRegion, cycle: bool) void {
return c.SDL_UploadToGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), @bitCast(cycle)); return c.SDL_UploadToGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), @bitCast(cycle));
} }
pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureLocation, destination: *const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void { pub inline fn copyGPUTextureToTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureLocation, destination: ?*const GPUTextureLocation, w: u32, h: u32, d: u32, cycle: bool) void {
return c.SDL_CopyGPUTextureToTexture(gpucopypass, @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle)); return c.SDL_CopyGPUTextureToTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), w, h, d, @bitCast(cycle));
} }
pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferLocation, destination: *const GPUBufferLocation, size: u32, cycle: bool) void { pub inline fn copyGPUBufferToBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferLocation, destination: ?*const GPUBufferLocation, size: u32, cycle: bool) void {
return c.SDL_CopyGPUBufferToBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle)); return c.SDL_CopyGPUBufferToBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination), size, @bitCast(cycle));
} }
pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: *const GPUTextureRegion, destination: *const GPUTextureTransferInfo) void { pub inline fn downloadFromGPUTexture(gpucopypass: *GPUCopyPass, source: ?*const GPUTextureRegion, destination: ?*const GPUTextureTransferInfo) void {
return c.SDL_DownloadFromGPUTexture(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUTexture(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: *const GPUBufferRegion, destination: *const GPUTransferBufferLocation) void { pub inline fn downloadFromGPUBuffer(gpucopypass: *GPUCopyPass, source: ?*const GPUBufferRegion, destination: ?*const GPUTransferBufferLocation) void {
return c.SDL_DownloadFromGPUBuffer(gpucopypass, @ptrCast(source), @ptrCast(destination)); return c.SDL_DownloadFromGPUBuffer(@ptrCast(gpucopypass), @ptrCast(source), @ptrCast(destination));
} }
pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void { pub inline fn endGPUCopyPass(gpucopypass: *GPUCopyPass) void {
return c.SDL_EndGPUCopyPass(gpucopypass); return c.SDL_EndGPUCopyPass(@ptrCast(gpucopypass));
} }
}; };
@ -539,6 +539,8 @@ pub const GPUTextureUsageFlags = packed struct(u32) {
textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. textureusageComputeStorageSimultaneousReadWrite: bool = false, // Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
pad0: u24 = 0, pad0: u24 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUTextureUsageFlags{};
}; };
pub const GPUTextureType = enum(c_int) { pub const GPUTextureType = enum(c_int) {
@ -574,6 +576,8 @@ pub const GPUBufferUsageFlags = packed struct(u32) {
bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage. bufferusageComputeStorageWrite: bool = false, // Buffer supports storage writes in the compute stage.
pad0: u25 = 0, pad0: u25 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUBufferUsageFlags{};
}; };
pub const GPUTransferBufferUsage = enum(c_int) { pub const GPUTransferBufferUsage = enum(c_int) {
@ -586,7 +590,18 @@ pub const GPUShaderStage = enum(c_int) {
shaderstageFragment, shaderstageFragment,
}; };
pub const GPUShaderFormat = u32; pub const GPUShaderFormat = packed struct(u32) {
shaderformatPrivate: bool = false, // Shaders for NDA'd platforms.
shaderformatSpirv: bool = false, // SPIR-V shaders for Vulkan.
shaderformatDxbc: bool = false, // DXBC SM5_1 shaders for D3D12.
shaderformatDxil: bool = false, // DXIL SM6_0 shaders for D3D12.
shaderformatMsl: bool = false, // MSL shaders for Metal.
shaderformatMetallib: bool = false, // Precompiled metallib shaders for Metal.
pad0: u25 = 0,
rsvd: bool = false,
pub const None = GPUShaderFormat{};
};
pub const GPUVertexElementFormat = enum(c_int) { pub const GPUVertexElementFormat = enum(c_int) {
vertexelementformatInvalid, vertexelementformatInvalid,
@ -700,6 +715,8 @@ pub const GPUColorComponentFlags = packed struct(u8) {
colorcomponentA: bool = false, // the alpha component colorcomponentA: bool = false, // the alpha component
pad0: u3 = 0, pad0: u3 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = GPUColorComponentFlags{};
}; };
pub const GPUFilter = enum(c_int) { pub const GPUFilter = enum(c_int) {
@ -849,9 +866,9 @@ pub const GPUVertexAttribute = extern struct {
}; };
pub const GPUVertexInputState = extern struct { pub const GPUVertexInputState = extern struct {
vertex_buffer_descriptions: *const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions. vertex_buffer_descriptions: ?*const GPUVertexBufferDescription, // A pointer to an array of vertex buffer descriptions.
num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array. num_vertex_buffers: u32, // The number of vertex buffer descriptions in the above array.
vertex_attributes: *const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions. vertex_attributes: ?*const GPUVertexAttribute, // A pointer to an array of vertex attribute descriptions.
num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array. num_vertex_attributes: u32, // The number of vertex attribute descriptions in the above array.
}; };
@ -955,7 +972,7 @@ pub const GPUColorTargetDescription = extern struct {
}; };
pub const GPUGraphicsPipelineTargetInfo = extern struct { pub const GPUGraphicsPipelineTargetInfo = extern struct {
color_target_descriptions: *const GPUColorTargetDescription, // A pointer to an array of color target descriptions. color_target_descriptions: ?*const GPUColorTargetDescription, // A pointer to an array of color target descriptions.
num_color_targets: u32, // The number of color target descriptions in the above array. num_color_targets: u32, // The number of color target descriptions in the above array.
depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. depth_stencil_format: GPUTextureFormat, // The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target. has_depth_stencil_target: bool, // true specifies that the pipeline uses a depth-stencil target.
@ -1072,11 +1089,11 @@ pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
} }
pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice { pub inline fn createGPUDevice(format_flags: GPUShaderFormat, debug_mode: bool, name: [*c]const u8) ?*GPUDevice {
return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name); return @ptrCast(c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name));
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {
return c.SDL_CreateGPUDeviceWithProperties(props); return @ptrCast(c.SDL_CreateGPUDeviceWithProperties(props));
} }
pub inline fn getNumGPUDrivers() c_int { pub inline fn getNumGPUDrivers() c_int {

View File

@ -3,105 +3,105 @@ pub const c = @import("c.zig").c;
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn isJoystickHaptic(joystick: *Joystick) bool { pub inline fn isJoystickHaptic(joystick: *Joystick) bool {
return @bitCast(c.SDL_IsJoystickHaptic(joystick)); return @bitCast(c.SDL_IsJoystickHaptic(@ptrCast(joystick)));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
return c.SDL_OpenHapticFromJoystick(joystick); return @ptrCast(c.SDL_OpenHapticFromJoystick(@ptrCast(joystick)));
} }
}; };
pub const Haptic = opaque { pub const Haptic = opaque {
pub inline fn getHapticID(haptic: *Haptic) HapticID { pub inline fn getHapticID(haptic: *Haptic) HapticID {
return c.SDL_GetHapticID(haptic); return c.SDL_GetHapticID(@ptrCast(haptic));
} }
pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 { pub inline fn getHapticName(haptic: *Haptic) [*c]const u8 {
return c.SDL_GetHapticName(haptic); return c.SDL_GetHapticName(@ptrCast(haptic));
} }
pub inline fn closeHaptic(haptic: *Haptic) void { pub inline fn closeHaptic(haptic: *Haptic) void {
return c.SDL_CloseHaptic(haptic); return c.SDL_CloseHaptic(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffects(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffects(haptic); return c.SDL_GetMaxHapticEffects(@ptrCast(haptic));
} }
pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int { pub inline fn getMaxHapticEffectsPlaying(haptic: *Haptic) c_int {
return c.SDL_GetMaxHapticEffectsPlaying(haptic); return c.SDL_GetMaxHapticEffectsPlaying(@ptrCast(haptic));
} }
pub inline fn getHapticFeatures(haptic: *Haptic) u32 { pub inline fn getHapticFeatures(haptic: *Haptic) u32 {
return c.SDL_GetHapticFeatures(haptic); return c.SDL_GetHapticFeatures(@ptrCast(haptic));
} }
pub inline fn getNumHapticAxes(haptic: *Haptic) c_int { pub inline fn getNumHapticAxes(haptic: *Haptic) c_int {
return c.SDL_GetNumHapticAxes(haptic); return c.SDL_GetNumHapticAxes(@ptrCast(haptic));
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: ?*const HapticEffect) bool {
return @bitCast(c.SDL_HapticEffectSupported(haptic, @ptrCast(effect))); return @bitCast(c.SDL_HapticEffectSupported(@ptrCast(haptic), @ptrCast(effect)));
} }
pub inline fn createHapticEffect(haptic: *Haptic, effect: *const HapticEffect) c_int { pub inline fn createHapticEffect(haptic: *Haptic, effect: ?*const HapticEffect) c_int {
return c.SDL_CreateHapticEffect(haptic, @ptrCast(effect)); return c.SDL_CreateHapticEffect(@ptrCast(haptic), @ptrCast(effect));
} }
pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: *const HapticEffect) bool { pub inline fn updateHapticEffect(haptic: *Haptic, effect: c_int, data: ?*const HapticEffect) bool {
return @bitCast(c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data))); return @bitCast(c.SDL_UpdateHapticEffect(@ptrCast(haptic), effect, @ptrCast(data)));
} }
pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool { pub inline fn runHapticEffect(haptic: *Haptic, effect: c_int, iterations: u32) bool {
return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations)); return @bitCast(c.SDL_RunHapticEffect(@ptrCast(haptic), effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_StopHapticEffect(haptic, effect)); return @bitCast(c.SDL_StopHapticEffect(@ptrCast(haptic), effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
return c.SDL_DestroyHapticEffect(haptic, effect); return c.SDL_DestroyHapticEffect(@ptrCast(haptic), effect);
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect)); return @bitCast(c.SDL_GetHapticEffectStatus(@ptrCast(haptic), effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return @bitCast(c.SDL_SetHapticGain(haptic, gain)); return @bitCast(c.SDL_SetHapticGain(@ptrCast(haptic), gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter)); return @bitCast(c.SDL_SetHapticAutocenter(@ptrCast(haptic), autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_PauseHaptic(haptic)); return @bitCast(c.SDL_PauseHaptic(@ptrCast(haptic)));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return @bitCast(c.SDL_ResumeHaptic(haptic)); return @bitCast(c.SDL_ResumeHaptic(@ptrCast(haptic)));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticEffects(haptic)); return @bitCast(c.SDL_StopHapticEffects(@ptrCast(haptic)));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return @bitCast(c.SDL_HapticRumbleSupported(haptic)); return @bitCast(c.SDL_HapticRumbleSupported(@ptrCast(haptic)));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_InitHapticRumble(haptic)); return @bitCast(c.SDL_InitHapticRumble(@ptrCast(haptic)));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length)); return @bitCast(c.SDL_PlayHapticRumble(@ptrCast(haptic), strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return @bitCast(c.SDL_StopHapticRumble(haptic)); return @bitCast(c.SDL_StopHapticRumble(@ptrCast(haptic)));
} }
}; };
@ -206,7 +206,7 @@ pub const HapticEffect = extern union {
pub const HapticID = u32; pub const HapticID = u32;
pub inline fn getHaptics(count: *c_int) ?*HapticID { pub inline fn getHaptics(count: *c_int) ?*HapticID {
return c.SDL_GetHaptics(@ptrCast(count)); return @ptrCast(c.SDL_GetHaptics(@ptrCast(count)));
} }
pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 { pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
@ -214,11 +214,11 @@ pub inline fn getHapticNameForID(instance_id: HapticID) [*c]const u8 {
} }
pub inline fn openHaptic(instance_id: HapticID) ?*Haptic { pub inline fn openHaptic(instance_id: HapticID) ?*Haptic {
return c.SDL_OpenHaptic(instance_id); return @ptrCast(c.SDL_OpenHaptic(instance_id));
} }
pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic { pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
return c.SDL_GetHapticFromID(instance_id); return @ptrCast(c.SDL_GetHapticFromID(instance_id));
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
@ -226,5 +226,5 @@ pub inline fn isMouseHaptic() bool {
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {
return c.SDL_OpenHapticFromMouse(); return @ptrCast(c.SDL_OpenHapticFromMouse());
} }

View File

@ -12,6 +12,8 @@ pub const InitFlags = packed struct(u32) {
initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` initCamera: bool = false, // `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`
pad0: u23 = 0, pad0: u23 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = InitFlags{};
}; };
pub const AppResult = enum(c_int) { pub const AppResult = enum(c_int) {

View File

@ -29,147 +29,147 @@ pub const PowerState = enum(c_int) {
pub const Joystick = opaque { pub const Joystick = opaque {
pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool { pub inline fn setJoystickVirtualAxis(joystick: *Joystick, axis: c_int, value: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualAxis(joystick, axis, value)); return @bitCast(c.SDL_SetJoystickVirtualAxis(@ptrCast(joystick), axis, value));
} }
pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool { pub inline fn setJoystickVirtualBall(joystick: *Joystick, ball: c_int, xrel: i16, yrel: i16) bool {
return @bitCast(c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel)); return @bitCast(c.SDL_SetJoystickVirtualBall(@ptrCast(joystick), ball, xrel, yrel));
} }
pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool { pub inline fn setJoystickVirtualButton(joystick: *Joystick, button: c_int, down: bool) bool {
return @bitCast(c.SDL_SetJoystickVirtualButton(joystick, button, @bitCast(down))); return @bitCast(c.SDL_SetJoystickVirtualButton(@ptrCast(joystick), button, @bitCast(down)));
} }
pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool { pub inline fn setJoystickVirtualHat(joystick: *Joystick, hat: c_int, value: u8) bool {
return @bitCast(c.SDL_SetJoystickVirtualHat(joystick, hat, value)); return @bitCast(c.SDL_SetJoystickVirtualHat(@ptrCast(joystick), hat, value));
} }
pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool { pub inline fn setJoystickVirtualTouchpad(joystick: *Joystick, touchpad: c_int, finger: c_int, down: bool, x: f32, y: f32, pressure: f32) bool {
return @bitCast(c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, @bitCast(down), x, y, pressure)); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(@ptrCast(joystick), touchpad, finger, @bitCast(down), x, y, pressure));
} }
pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool { pub inline fn sendJoystickVirtualSensorData(joystick: *Joystick, _type: SensorType, sensor_timestamp: u64, data: *const f32, num_values: c_int) bool {
return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values)); return @bitCast(c.SDL_SendJoystickVirtualSensorData(@ptrCast(joystick), @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
return c.SDL_GetJoystickProperties(joystick); return c.SDL_GetJoystickProperties(@ptrCast(joystick));
} }
pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickName(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickName(joystick); return c.SDL_GetJoystickName(@ptrCast(joystick));
} }
pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickPath(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickPath(joystick); return c.SDL_GetJoystickPath(@ptrCast(joystick));
} }
pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int { pub inline fn getJoystickPlayerIndex(joystick: *Joystick) c_int {
return c.SDL_GetJoystickPlayerIndex(joystick); return c.SDL_GetJoystickPlayerIndex(@ptrCast(joystick));
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index)); return @bitCast(c.SDL_SetJoystickPlayerIndex(@ptrCast(joystick), player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
return c.SDL_GetJoystickGUID(joystick); return c.SDL_GetJoystickGUID(@ptrCast(joystick));
} }
pub inline fn getJoystickVendor(joystick: *Joystick) u16 { pub inline fn getJoystickVendor(joystick: *Joystick) u16 {
return c.SDL_GetJoystickVendor(joystick); return c.SDL_GetJoystickVendor(@ptrCast(joystick));
} }
pub inline fn getJoystickProduct(joystick: *Joystick) u16 { pub inline fn getJoystickProduct(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProduct(joystick); return c.SDL_GetJoystickProduct(@ptrCast(joystick));
} }
pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 { pub inline fn getJoystickProductVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickProductVersion(joystick); return c.SDL_GetJoystickProductVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 { pub inline fn getJoystickFirmwareVersion(joystick: *Joystick) u16 {
return c.SDL_GetJoystickFirmwareVersion(joystick); return c.SDL_GetJoystickFirmwareVersion(@ptrCast(joystick));
} }
pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 { pub inline fn getJoystickSerial(joystick: *Joystick) [*c]const u8 {
return c.SDL_GetJoystickSerial(joystick); return c.SDL_GetJoystickSerial(@ptrCast(joystick));
} }
pub inline fn getJoystickType(joystick: *Joystick) JoystickType { pub inline fn getJoystickType(joystick: *Joystick) JoystickType {
return @intFromEnum(c.SDL_GetJoystickType(joystick)); return @intFromEnum(c.SDL_GetJoystickType(@ptrCast(joystick)));
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return @bitCast(c.SDL_JoystickConnected(joystick)); return @bitCast(c.SDL_JoystickConnected(@ptrCast(joystick)));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
return c.SDL_GetJoystickID(joystick); return c.SDL_GetJoystickID(@ptrCast(joystick));
} }
pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int { pub inline fn getNumJoystickAxes(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickAxes(joystick); return c.SDL_GetNumJoystickAxes(@ptrCast(joystick));
} }
pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int { pub inline fn getNumJoystickBalls(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickBalls(joystick); return c.SDL_GetNumJoystickBalls(@ptrCast(joystick));
} }
pub inline fn getNumJoystickHats(joystick: *Joystick) c_int { pub inline fn getNumJoystickHats(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickHats(joystick); return c.SDL_GetNumJoystickHats(@ptrCast(joystick));
} }
pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int { pub inline fn getNumJoystickButtons(joystick: *Joystick) c_int {
return c.SDL_GetNumJoystickButtons(joystick); return c.SDL_GetNumJoystickButtons(@ptrCast(joystick));
} }
pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 { pub inline fn getJoystickAxis(joystick: *Joystick, axis: c_int) i16 {
return c.SDL_GetJoystickAxis(joystick, axis); return c.SDL_GetJoystickAxis(@ptrCast(joystick), axis);
} }
pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool { pub inline fn getJoystickAxisInitialState(joystick: *Joystick, axis: c_int, state: *i16) bool {
return @bitCast(c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state))); return @bitCast(c.SDL_GetJoystickAxisInitialState(@ptrCast(joystick), axis, @ptrCast(state)));
} }
pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool { pub inline fn getJoystickBall(joystick: *Joystick, ball: c_int, dx: *c_int, dy: *c_int) bool {
return @bitCast(c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy))); return @bitCast(c.SDL_GetJoystickBall(@ptrCast(joystick), ball, @ptrCast(dx), @ptrCast(dy)));
} }
pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 { pub inline fn getJoystickHat(joystick: *Joystick, hat: c_int) u8 {
return c.SDL_GetJoystickHat(joystick, hat); return c.SDL_GetJoystickHat(@ptrCast(joystick), hat);
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return @bitCast(c.SDL_GetJoystickButton(joystick, button)); return @bitCast(c.SDL_GetJoystickButton(@ptrCast(joystick), button));
} }
pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystick(joystick: *Joystick, low_frequency_rumble: u16, high_frequency_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystick(@ptrCast(joystick), low_frequency_rumble, high_frequency_rumble, duration_ms));
} }
pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool { pub inline fn rumbleJoystickTriggers(joystick: *Joystick, left_rumble: u16, right_rumble: u16, duration_ms: u32) bool {
return @bitCast(c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms)); return @bitCast(c.SDL_RumbleJoystickTriggers(@ptrCast(joystick), left_rumble, right_rumble, duration_ms));
} }
pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool { pub inline fn setJoystickLED(joystick: *Joystick, red: u8, green: u8, blue: u8) bool {
return @bitCast(c.SDL_SetJoystickLED(joystick, red, green, blue)); return @bitCast(c.SDL_SetJoystickLED(@ptrCast(joystick), red, green, blue));
} }
pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool { pub inline fn sendJoystickEffect(joystick: *Joystick, data: ?*const anyopaque, size: c_int) bool {
return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size)); return @bitCast(c.SDL_SendJoystickEffect(@ptrCast(joystick), data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
return c.SDL_CloseJoystick(joystick); return c.SDL_CloseJoystick(@ptrCast(joystick));
} }
pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState { pub inline fn getJoystickConnectionState(joystick: *Joystick) JoystickConnectionState {
return c.SDL_GetJoystickConnectionState(joystick); return c.SDL_GetJoystickConnectionState(@ptrCast(joystick));
} }
pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState { pub inline fn getJoystickPowerInfo(joystick: *Joystick, percent: *c_int) PowerState {
return c.SDL_GetJoystickPowerInfo(joystick, @ptrCast(percent)); return c.SDL_GetJoystickPowerInfo(@ptrCast(joystick), @ptrCast(percent));
} }
}; };
@ -208,7 +208,7 @@ pub inline fn hasJoystick() bool {
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
return c.SDL_GetJoysticks(@ptrCast(count)); return @ptrCast(c.SDL_GetJoysticks(@ptrCast(count)));
} }
pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getJoystickNameForID(instance_id: JoystickID) [*c]const u8 {
@ -244,15 +244,15 @@ pub inline fn getJoystickTypeForID(instance_id: JoystickID) JoystickType {
} }
pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick { pub inline fn openJoystick(instance_id: JoystickID) ?*Joystick {
return c.SDL_OpenJoystick(instance_id); return @ptrCast(c.SDL_OpenJoystick(instance_id));
} }
pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick { pub inline fn getJoystickFromID(instance_id: JoystickID) ?*Joystick {
return c.SDL_GetJoystickFromID(instance_id); return @ptrCast(c.SDL_GetJoystickFromID(instance_id));
} }
pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick { pub inline fn getJoystickFromPlayerIndex(player_index: c_int) ?*Joystick {
return c.SDL_GetJoystickFromPlayerIndex(player_index); return @ptrCast(c.SDL_GetJoystickFromPlayerIndex(player_index));
} }
pub const VirtualJoystickTouchpadDesc = extern struct { pub const VirtualJoystickTouchpadDesc = extern struct {
@ -279,8 +279,8 @@ pub const VirtualJoystickDesc = extern struct {
nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions nsensors: u16, // the number of sensors on this joystick, requires `sensors` to point at valid descriptions
padding2: [2]u16, // unused padding2: [2]u16, // unused
name: [*c]const u8, // the name of the joystick name: [*c]const u8, // the name of the joystick
touchpads: *const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 touchpads: ?*const VirtualJoystickTouchpadDesc, // A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0
sensors: *const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0 sensors: ?*const VirtualJoystickSensorDesc, // A pointer to an array of sensor descriptions, required if `nsensors` is > 0
userdata: ?*anyopaque, // User data pointer passed to callbacks userdata: ?*anyopaque, // User data pointer passed to callbacks
Update: ?*const anyopaque, // Called when the joystick state should be updated Update: ?*const anyopaque, // Called when the joystick state should be updated
SetPlayerIndex: ?*const anyopaque, // Called when the player index is set SetPlayerIndex: ?*const anyopaque, // Called when the player index is set
@ -292,7 +292,7 @@ pub const VirtualJoystickDesc = extern struct {
Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached Cleanup: ?*const anyopaque, // Cleans up the userdata when the joystick is detached
}; };
pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID { pub inline fn attachVirtualJoystick(desc: ?*const VirtualJoystickDesc) JoystickID {
return c.SDL_AttachVirtualJoystick(@ptrCast(desc)); return c.SDL_AttachVirtualJoystick(@ptrCast(desc));
} }

View File

@ -5,14 +5,14 @@ pub const FunctionPointer = c.SDL_FunctionPointer;
pub const SharedObject = opaque { pub const SharedObject = opaque {
pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer { pub inline fn loadFunction(sharedobject: *SharedObject, name: [*c]const u8) FunctionPointer {
return c.SDL_LoadFunction(sharedobject, name); return c.SDL_LoadFunction(@ptrCast(sharedobject), name);
} }
pub inline fn unloadObject(sharedobject: *SharedObject) void { pub inline fn unloadObject(sharedobject: *SharedObject) void {
return c.SDL_UnloadObject(sharedobject); return c.SDL_UnloadObject(@ptrCast(sharedobject));
} }
}; };
pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject { pub inline fn loadObject(sofile: [*c]const u8) ?*SharedObject {
return c.SDL_LoadObject(sofile); return @ptrCast(c.SDL_LoadObject(sofile));
} }

View File

@ -11,6 +11,8 @@ pub const MessageBoxFlags = packed struct(u32) {
messageboxButtonsRightToLeft: bool = false, // buttons placed right to left messageboxButtonsRightToLeft: bool = false, // buttons placed right to left
pad0: u26 = 0, pad0: u26 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxFlags{};
}; };
pub const MessageBoxButtonFlags = packed struct(u32) { pub const MessageBoxButtonFlags = packed struct(u32) {
@ -18,6 +20,8 @@ pub const MessageBoxButtonFlags = packed struct(u32) {
messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit messageboxButtonEscapekeyDefault: bool = false, // Marks the default button when escape is hit
pad0: u29 = 0, pad0: u29 = 0,
rsvd: bool = false, rsvd: bool = false,
pub const None = MessageBoxButtonFlags{};
}; };
pub const MessageBoxButtonData = extern struct { pub const MessageBoxButtonData = extern struct {
@ -51,14 +55,14 @@ pub const MessageBoxData = extern struct {
title: [*c]const u8, // UTF-8 title title: [*c]const u8, // UTF-8 title
message: [*c]const u8, // UTF-8 message text message: [*c]const u8, // UTF-8 message text
numbuttons: c_int, numbuttons: c_int,
buttons: *const MessageBoxButtonData, buttons: ?*const MessageBoxButtonData,
colorScheme: *const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings colorScheme: ?*const MessageBoxColorScheme, // SDL_MessageBoxColorScheme, can be NULL to use system settings
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: ?*const MessageBoxData, buttonid: *c_int) bool {
return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid))); return @bitCast(c.SDL_ShowMessageBox(@ptrCast(messageboxdata), @ptrCast(buttonid)));
} }
pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool { pub inline fn showSimpleMessageBox(flags: MessageBoxFlags, title: [*c]const u8, message: [*c]const u8, window: ?*Window) bool {
return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window)); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, @ptrCast(window)));
} }

Some files were not shown because too many files have changed in this diff Show More