fixed enums and bitcasts

This commit is contained in:
peterino2 2026-01-26 21:51:53 -08:00
parent 460e012847
commit 9b02a95231
891 changed files with 12688 additions and 12688 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 c.SDL_LoadWAV_IO(iostream, closeio, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -43,11 +43,11 @@ pub const AudioStream = opaque {
} }
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 c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec); return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, 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 c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)); return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
@ -55,7 +55,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
@ -63,7 +63,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return c.SDL_SetAudioStreamGain(audiostream, gain); return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
@ -75,15 +75,15 @@ pub const AudioStream = opaque {
} }
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 c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(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 c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(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 c.SDL_PutAudioStreamData(audiostream, buf, len); return @bitCast(c.SDL_PutAudioStreamData(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 {
@ -99,35 +99,35 @@ pub const AudioStream = opaque {
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return c.SDL_FlushAudioStream(audiostream); return @bitCast(c.SDL_FlushAudioStream(audiostream));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return c.SDL_ClearAudioStream(audiostream); return @bitCast(c.SDL_ClearAudioStream(audiostream));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_PauseAudioStreamDevice(audiostream); return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_ResumeAudioStreamDevice(audiostream); return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_LockAudioStream(audiostream); return @bitCast(c.SDL_LockAudioStream(audiostream));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_UnlockAudioStream(audiostream); return @bitCast(c.SDL_UnlockAudioStream(audiostream));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamGetCallback(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 c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
@ -160,7 +160,7 @@ 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 c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames)); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, 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 {
@ -172,15 +172,15 @@ pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) Audi
} }
pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool { pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_PauseAudioDevice(dev); return @bitCast(c.SDL_PauseAudioDevice(dev));
} }
pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool { pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_ResumeAudioDevice(dev); return @bitCast(c.SDL_ResumeAudioDevice(dev));
} }
pub inline fn audioDevicePaused(dev: AudioDeviceID) bool { pub inline fn audioDevicePaused(dev: AudioDeviceID) bool {
return c.SDL_AudioDevicePaused(dev); return @bitCast(c.SDL_AudioDevicePaused(dev));
} }
pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 { pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
@ -188,7 +188,7 @@ pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
} }
pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool { pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool {
return c.SDL_SetAudioDeviceGain(devid, gain); return @bitCast(c.SDL_SetAudioDeviceGain(devid, gain));
} }
pub inline fn closeAudioDevice(devid: AudioDeviceID) void { pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
@ -196,11 +196,11 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
} }
pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c][*c]AudioStream, num_streams: c_int) bool { pub inline fn bindAudioStreams(devid: AudioDeviceID, streams: [*c][*c]AudioStream, num_streams: c_int) bool {
return 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 c.SDL_BindAudioStream(devid, stream); return @bitCast(c.SDL_BindAudioStream(devid, stream));
} }
pub inline fn unbindAudioStreams(streams: [*c][*c]AudioStream, num_streams: c_int) void { pub inline fn unbindAudioStreams(streams: [*c][*c]AudioStream, num_streams: c_int) void {
@ -220,19 +220,19 @@ pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioPostmixCallback(devid, callback, userdata); return @bitCast(c.SDL_SetAudioPostmixCallback(devid, callback, userdata));
} }
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 c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV(path, 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 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 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)));
} }
pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 { pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 {

View File

@ -63,7 +63,7 @@ pub const Camera = opaque {
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return c.SDL_GetCameraFormat(camera, spec); return @bitCast(c.SDL_GetCameraFormat(camera, spec));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn setClipboardText(text: [*c]const u8) bool { pub inline fn setClipboardText(text: [*c]const u8) bool {
return c.SDL_SetClipboardText(text); return @bitCast(c.SDL_SetClipboardText(text));
} }
pub inline fn getClipboardText() [*c]u8 { pub inline fn getClipboardText() [*c]u8 {
@ -10,11 +10,11 @@ pub inline fn getClipboardText() [*c]u8 {
} }
pub inline fn hasClipboardText() bool { pub inline fn hasClipboardText() bool {
return c.SDL_HasClipboardText(); return @bitCast(c.SDL_HasClipboardText());
} }
pub inline fn setPrimarySelectionText(text: [*c]const u8) bool { pub inline fn setPrimarySelectionText(text: [*c]const u8) bool {
return c.SDL_SetPrimarySelectionText(text); return @bitCast(c.SDL_SetPrimarySelectionText(text));
} }
pub inline fn getPrimarySelectionText() [*c]u8 { pub inline fn getPrimarySelectionText() [*c]u8 {
@ -22,7 +22,7 @@ pub inline fn getPrimarySelectionText() [*c]u8 {
} }
pub inline fn hasPrimarySelectionText() bool { pub inline fn hasPrimarySelectionText() bool {
return c.SDL_HasPrimarySelectionText(); return @bitCast(c.SDL_HasPrimarySelectionText());
} }
pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback; pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
@ -30,11 +30,11 @@ pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback; pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback;
pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool { pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool {
return c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types); return @bitCast(c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types));
} }
pub inline fn clearClipboardData() bool { pub inline fn clearClipboardData() bool {
return c.SDL_ClearClipboardData(); return @bitCast(c.SDL_ClearClipboardData());
} }
pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque { pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque {
@ -42,7 +42,7 @@ pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaqu
} }
pub inline fn hasClipboardData(mime_type: [*c]const u8) bool { pub inline fn hasClipboardData(mime_type: [*c]const u8) bool {
return c.SDL_HasClipboardData(mime_type); return @bitCast(c.SDL_HasClipboardData(mime_type));
} }
pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 { pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 {

View File

@ -11,7 +11,7 @@ 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, allow_many); return c.SDL_ShowOpenFileDialog(callback, userdata, 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 {
@ -19,5 +19,5 @@ pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyop
} }
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, allow_many); return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many));
} }

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn outOfMemory() bool { pub inline fn outOfMemory() bool {
return c.SDL_OutOfMemory(); return @bitCast(c.SDL_OutOfMemory());
} }
pub inline fn getError() [*c]const u8 { pub inline fn getError() [*c]const u8 {
@ -10,5 +10,5 @@ pub inline fn getError() [*c]const u8 {
} }
pub inline fn clearError() bool { pub inline fn clearError() bool {
return c.SDL_ClearError(); return @bitCast(c.SDL_ClearError());
} }

View File

@ -689,11 +689,11 @@ pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction,
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
return c.SDL_HasEvent(_type); return @bitCast(c.SDL_HasEvent(_type));
} }
pub inline fn hasEvents(minType: u32, maxType: u32) bool { pub inline fn hasEvents(minType: u32, maxType: u32) bool {
return c.SDL_HasEvents(minType, maxType); return @bitCast(c.SDL_HasEvents(minType, maxType));
} }
pub inline fn flushEvent(_type: u32) void { pub inline fn flushEvent(_type: u32) void {
@ -705,19 +705,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 c.SDL_PollEvent(event); return @bitCast(c.SDL_PollEvent(event));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return c.SDL_WaitEvent(event); return @bitCast(c.SDL_WaitEvent(event));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return c.SDL_WaitEventTimeout(event, timeoutMS); return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return c.SDL_PushEvent(event); return @bitCast(c.SDL_PushEvent(event));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -727,11 +727,11 @@ 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 c.SDL_GetEventFilter(filter, userdata); return @bitCast(c.SDL_GetEventFilter(filter, userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
return c.SDL_AddEventWatch(filter, userdata); return @bitCast(c.SDL_AddEventWatch(filter, userdata));
} }
pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void { pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void {
@ -743,11 +743,11 @@ pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn setEventEnabled(_type: u32, enabled: bool) void { pub inline fn setEventEnabled(_type: u32, enabled: bool) void {
return c.SDL_SetEventEnabled(_type, enabled); return c.SDL_SetEventEnabled(_type, @bitCast(enabled));
} }
pub inline fn eventEnabled(_type: u32) bool { pub inline fn eventEnabled(_type: u32) bool {
return c.SDL_EventEnabled(_type); return @bitCast(c.SDL_EventEnabled(_type));
} }
pub inline fn registerEvents(numevents: c_int) u32 { pub inline fn registerEvents(numevents: c_int) u32 {

View File

@ -52,7 +52,7 @@ pub const GlobFlags = packed struct(u32) {
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
return c.SDL_CreateDirectory(path); return @bitCast(c.SDL_CreateDirectory(path));
} }
pub const EnumerationResult = enum(c_int) { pub const EnumerationResult = enum(c_int) {
@ -64,23 +64,23 @@ pub const EnumerationResult = enum(c_int) {
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateDirectory(path, callback, userdata); return @bitCast(c.SDL_EnumerateDirectory(path, callback, userdata));
} }
pub inline fn removePath(path: [*c]const u8) bool { pub inline fn removePath(path: [*c]const u8) bool {
return c.SDL_RemovePath(path); return @bitCast(c.SDL_RemovePath(path));
} }
pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_RenamePath(oldpath, newpath); return @bitCast(c.SDL_RenamePath(oldpath, newpath));
} }
pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_CopyFile(oldpath, newpath); return @bitCast(c.SDL_CopyFile(oldpath, newpath));
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return c.SDL_GetPathInfo(path, info); return @bitCast(c.SDL_GetPathInfo(path, 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, closeio); return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio));
} }
}; };
@ -77,7 +77,7 @@ pub const Gamepad = opaque {
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return c.SDL_SetGamepadPlayerIndex(gamepad, player_index); return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
@ -113,7 +113,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return c.SDL_GamepadConnected(gamepad); return @bitCast(c.SDL_GamepadConnected(gamepad));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
@ -125,7 +125,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return c.SDL_GamepadHasAxis(gamepad, axis); return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
@ -133,11 +133,11 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GamepadHasButton(gamepad, button); return @bitCast(c.SDL_GamepadHasButton(gamepad, button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GetGamepadButton(gamepad, button); return @bitCast(c.SDL_GetGamepadButton(gamepad, button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
@ -153,19 +153,19 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)); return @bitCast(c.SDL_GetGamepadTouchpadFinger(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 c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadHasSensor(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 c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), enabled); return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
@ -173,23 +173,23 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values); return @bitCast(c.SDL_GetGamepadSensorData(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 c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepad(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 c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepadTriggers(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 c.SDL_SetGamepadLED(gamepad, red, green, blue); return @bitCast(c.SDL_SetGamepadLED(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 c.SDL_SendGamepadEffect(gamepad, data, size); return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
@ -288,7 +288,7 @@ pub inline fn addGamepadMappingsFromFile(file: [*c]const u8) c_int {
} }
pub inline fn reloadGamepadMappings() bool { pub inline fn reloadGamepadMappings() bool {
return c.SDL_ReloadGamepadMappings(); return @bitCast(c.SDL_ReloadGamepadMappings());
} }
pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 { pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 {
@ -300,11 +300,11 @@ pub inline fn getGamepadMappingForGUID(guid: GUID) [*c]u8 {
} }
pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool { pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool {
return c.SDL_SetGamepadMapping(instance_id, mapping); return @bitCast(c.SDL_SetGamepadMapping(instance_id, mapping));
} }
pub inline fn hasGamepad() bool { pub inline fn hasGamepad() bool {
return c.SDL_HasGamepad(); return @bitCast(c.SDL_HasGamepad());
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
@ -312,7 +312,7 @@ pub inline fn getGamepads(count: *c_int) ?*JoystickID {
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
return c.SDL_IsGamepad(instance_id); return @bitCast(c.SDL_IsGamepad(instance_id));
} }
pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 {
@ -368,11 +368,11 @@ pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {
return c.SDL_SetGamepadEventsEnabled(enabled); return c.SDL_SetGamepadEventsEnabled(@bitCast(enabled));
} }
pub inline fn gamepadEventsEnabled() bool { pub inline fn gamepadEventsEnabled() bool {
return c.SDL_GamepadEventsEnabled(); return @bitCast(c.SDL_GamepadEventsEnabled());
} }
pub inline fn updateGamepads() void { pub inline fn updateGamepads() void {

View File

@ -107,7 +107,7 @@ pub const GPUDevice = opaque {
} }
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, cycle); return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
@ -115,15 +115,15 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, 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 c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_ClaimWindowForGPUDevice(gpudevice, window); return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
@ -131,7 +131,7 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)); return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
@ -139,15 +139,15 @@ pub const GPUDevice = opaque {
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return c.SDL_WaitForGPUIdle(gpudevice); return @bitCast(c.SDL_WaitForGPUIdle(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 c.SDL_WaitForGPUFences(gpudevice, wait_all, fences, num_fences); return @bitCast(c.SDL_WaitForGPUFences(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 c.SDL_QueryGPUFence(gpudevice, fence); return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
@ -155,11 +155,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage)); return @bitCast(c.SDL_GPUTextureSupportsFormat(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 c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
@ -231,11 +231,11 @@ pub const GPUCommandBuffer = opaque {
} }
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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, 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 c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
@ -243,7 +243,7 @@ pub const GPUCommandBuffer = opaque {
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return c.SDL_CancelGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer));
} }
}; };
@ -353,19 +353,19 @@ pub const GPUComputePass = opaque {
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), cycle); return c.SDL_UploadToGPUTexture(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), cycle); return c.SDL_UploadToGPUBuffer(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, cycle); return c.SDL_CopyGPUTextureToTexture(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, cycle); return c.SDL_CopyGPUBufferToBuffer(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 {
@ -1052,15 +1052,15 @@ pub const GPUStorageTextureReadWriteBinding = extern struct {
}; };
pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool { pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool {
return c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name); return @bitCast(c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name));
} }
pub inline fn gpuSupportsProperties(props: PropertiesID) bool { pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
return c.SDL_GPUSupportsProperties(props); return @bitCast(c.SDL_GPUSupportsProperties(props));
} }
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), debug_mode, name); return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name);
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {

View File

@ -3,7 +3,7 @@ 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 c.SDL_IsJoystickHaptic(joystick); return @bitCast(c.SDL_IsJoystickHaptic(joystick));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
@ -41,7 +41,7 @@ pub const Haptic = opaque {
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool {
return c.SDL_HapticEffectSupported(haptic, @ptrCast(effect)); return @bitCast(c.SDL_HapticEffectSupported(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 {
@ -49,15 +49,15 @@ pub const Haptic = opaque {
} }
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 c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data)); return @bitCast(c.SDL_UpdateHapticEffect(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 c.SDL_RunHapticEffect(haptic, effect, iterations); return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return c.SDL_StopHapticEffect(haptic, effect); return @bitCast(c.SDL_StopHapticEffect(haptic, effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
@ -65,43 +65,43 @@ pub const Haptic = opaque {
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return c.SDL_GetHapticEffectStatus(haptic, effect); return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return c.SDL_SetHapticGain(haptic, gain); return @bitCast(c.SDL_SetHapticGain(haptic, gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return c.SDL_SetHapticAutocenter(haptic, autocenter); return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return c.SDL_PauseHaptic(haptic); return @bitCast(c.SDL_PauseHaptic(haptic));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return c.SDL_ResumeHaptic(haptic); return @bitCast(c.SDL_ResumeHaptic(haptic));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return c.SDL_StopHapticEffects(haptic); return @bitCast(c.SDL_StopHapticEffects(haptic));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return c.SDL_HapticRumbleSupported(haptic); return @bitCast(c.SDL_HapticRumbleSupported(haptic));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return c.SDL_InitHapticRumble(haptic); return @bitCast(c.SDL_InitHapticRumble(haptic));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return c.SDL_PlayHapticRumble(haptic, strength, length); return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return c.SDL_StopHapticRumble(haptic); return @bitCast(c.SDL_StopHapticRumble(haptic));
} }
}; };
@ -222,7 +222,7 @@ pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
return c.SDL_IsMouseHaptic(); return @bitCast(c.SDL_IsMouseHaptic());
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {

View File

@ -8,15 +8,15 @@ pub const HintPriority = enum(c_int) {
}; };
pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool { pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool {
return c.SDL_SetHintWithPriority(name, value, priority); return @bitCast(c.SDL_SetHintWithPriority(name, value, priority));
} }
pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetHint(name, value); return @bitCast(c.SDL_SetHint(name, value));
} }
pub inline fn resetHint(name: [*c]const u8) bool { pub inline fn resetHint(name: [*c]const u8) bool {
return c.SDL_ResetHint(name); return @bitCast(c.SDL_ResetHint(name));
} }
pub inline fn resetHints() void { pub inline fn resetHints() void {
@ -28,13 +28,13 @@ pub inline fn getHint(name: [*c]const u8) [*c]const u8 {
} }
pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool { pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetHintBoolean(name, default_value); return @bitCast(c.SDL_GetHintBoolean(name, @bitCast(default_value)));
} }
pub const HintCallback = c.SDL_HintCallback; pub const HintCallback = c.SDL_HintCallback;
pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool { pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool {
return c.SDL_AddHintCallback(name, callback, userdata); return @bitCast(c.SDL_AddHintCallback(name, callback, userdata));
} }
pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void { pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void {

View File

@ -29,11 +29,11 @@ pub const AppEvent_func = c.SDL_AppEvent_func;
pub const AppQuit_func = c.SDL_AppQuit_func; pub const AppQuit_func = c.SDL_AppQuit_func;
pub inline fn init(flags: InitFlags) bool { pub inline fn init(flags: InitFlags) bool {
return c.SDL_Init(@bitCast(flags)); return @bitCast(c.SDL_Init(@bitCast(flags)));
} }
pub inline fn initSubSystem(flags: InitFlags) bool { pub inline fn initSubSystem(flags: InitFlags) bool {
return c.SDL_InitSubSystem(@bitCast(flags)); return @bitCast(c.SDL_InitSubSystem(@bitCast(flags)));
} }
pub inline fn quitSubSystem(flags: InitFlags) void { pub inline fn quitSubSystem(flags: InitFlags) void {
@ -49,11 +49,11 @@ pub inline fn quit() void {
} }
pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool { pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool {
return c.SDL_SetAppMetadata(appname, appversion, appidentifier); return @bitCast(c.SDL_SetAppMetadata(appname, appversion, appidentifier));
} }
pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetAppMetadataProperty(name, value); return @bitCast(c.SDL_SetAppMetadataProperty(name, value));
} }
pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 { pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 {

View File

@ -29,27 +29,27 @@ 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 c.SDL_SetJoystickVirtualAxis(joystick, axis, value); return @bitCast(c.SDL_SetJoystickVirtualAxis(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 c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel); return @bitCast(c.SDL_SetJoystickVirtualBall(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 c.SDL_SetJoystickVirtualButton(joystick, button, down); return @bitCast(c.SDL_SetJoystickVirtualButton(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 c.SDL_SetJoystickVirtualHat(joystick, hat, value); return @bitCast(c.SDL_SetJoystickVirtualHat(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 c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, down, x, y, pressure); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(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 c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values); return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
@ -69,7 +69,7 @@ pub const Joystick = opaque {
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return c.SDL_SetJoystickPlayerIndex(joystick, player_index); return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
@ -101,7 +101,7 @@ pub const Joystick = opaque {
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return c.SDL_JoystickConnected(joystick); return @bitCast(c.SDL_JoystickConnected(joystick));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
@ -129,11 +129,11 @@ pub const Joystick = opaque {
} }
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 c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state)); return @bitCast(c.SDL_GetJoystickAxisInitialState(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 c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy)); return @bitCast(c.SDL_GetJoystickBall(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 {
@ -141,23 +141,23 @@ pub const Joystick = opaque {
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return c.SDL_GetJoystickButton(joystick, button); return @bitCast(c.SDL_GetJoystickButton(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 c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystick(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 c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystickTriggers(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 c.SDL_SetJoystickLED(joystick, red, green, blue); return @bitCast(c.SDL_SetJoystickLED(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 c.SDL_SendJoystickEffect(joystick, data, size); return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
@ -204,7 +204,7 @@ pub inline fn unlockJoysticks() void {
} }
pub inline fn hasJoystick() bool { pub inline fn hasJoystick() bool {
return c.SDL_HasJoystick(); return @bitCast(c.SDL_HasJoystick());
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
@ -297,11 +297,11 @@ pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID
} }
pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool { pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool {
return c.SDL_DetachVirtualJoystick(instance_id); return @bitCast(c.SDL_DetachVirtualJoystick(instance_id));
} }
pub inline fn isJoystickVirtual(instance_id: JoystickID) bool { pub inline fn isJoystickVirtual(instance_id: JoystickID) bool {
return c.SDL_IsJoystickVirtual(instance_id); return @bitCast(c.SDL_IsJoystickVirtual(instance_id));
} }
pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void { pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void {
@ -309,11 +309,11 @@ pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, versi
} }
pub inline fn setJoystickEventsEnabled(enabled: bool) void { pub inline fn setJoystickEventsEnabled(enabled: bool) void {
return c.SDL_SetJoystickEventsEnabled(enabled); return c.SDL_SetJoystickEventsEnabled(@bitCast(enabled));
} }
pub inline fn joystickEventsEnabled() bool { pub inline fn joystickEventsEnabled() bool {
return c.SDL_JoystickEventsEnabled(); return @bitCast(c.SDL_JoystickEventsEnabled());
} }
pub inline fn updateJoysticks() void { pub inline fn updateJoysticks() void {

View File

@ -56,9 +56,9 @@ pub const MessageBoxData = extern struct {
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool {
return 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 c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window));
} }

View File

@ -2,5 +2,5 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn openURL(url: [*c]const u8) bool { pub inline fn openURL(url: [*c]const u8) bool {
return c.SDL_OpenURL(url); return @bitCast(c.SDL_OpenURL(url));
} }

View File

@ -7,11 +7,11 @@ pub const Window = opaque {
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return c.SDL_SetWindowRelativeMouseMode(window, enabled); return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return c.SDL_GetWindowRelativeMouseMode(window); return @bitCast(c.SDL_GetWindowRelativeMouseMode(window));
} }
}; };
@ -25,7 +25,7 @@ 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 c.SDL_SetCursor(cursor); return @bitCast(c.SDL_SetCursor(cursor));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
@ -71,7 +71,7 @@ pub const MouseButtonFlags = packed struct(u32) {
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
return c.SDL_HasMouse(); return @bitCast(c.SDL_HasMouse());
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
@ -99,11 +99,11 @@ pub inline fn getRelativeMouseState(x: *f32, y: *f32) MouseButtonFlags {
} }
pub inline fn warpMouseGlobal(x: f32, y: f32) bool { pub inline fn warpMouseGlobal(x: f32, y: f32) bool {
return c.SDL_WarpMouseGlobal(x, y); return @bitCast(c.SDL_WarpMouseGlobal(x, y));
} }
pub inline fn captureMouse(enabled: bool) bool { pub inline fn captureMouse(enabled: bool) bool {
return c.SDL_CaptureMouse(enabled); return @bitCast(c.SDL_CaptureMouse(@bitCast(enabled)));
} }
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 {
@ -123,13 +123,13 @@ pub inline fn getDefaultCursor() ?*Cursor {
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {
return c.SDL_ShowCursor(); return @bitCast(c.SDL_ShowCursor());
} }
pub inline fn hideCursor() bool { pub inline fn hideCursor() bool {
return c.SDL_HideCursor(); return @bitCast(c.SDL_HideCursor());
} }
pub inline fn cursorVisible() bool { pub inline fn cursorVisible() bool {
return c.SDL_CursorVisible(); return @bitCast(c.SDL_CursorVisible());
} }

View File

@ -198,7 +198,7 @@ pub inline fn getPixelFormatName(format: PixelFormat) [*c]const u8 {
} }
pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool { pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool {
return c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)); return @bitCast(c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)));
} }
pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat { pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat {
@ -214,7 +214,7 @@ pub inline fn createPalette(ncolors: c_int) ?*Palette {
} }
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 c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors); return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {

View File

@ -21,11 +21,11 @@ pub inline fn createProperties() PropertiesID {
} }
pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool { pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool {
return c.SDL_CopyProperties(src, dst); return @bitCast(c.SDL_CopyProperties(src, dst));
} }
pub inline fn lockProperties(props: PropertiesID) bool { pub inline fn lockProperties(props: PropertiesID) bool {
return c.SDL_LockProperties(props); return @bitCast(c.SDL_LockProperties(props));
} }
pub inline fn unlockProperties(props: PropertiesID) void { pub inline fn unlockProperties(props: PropertiesID) void {
@ -35,31 +35,31 @@ pub inline fn unlockProperties(props: PropertiesID) void {
pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback; pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback;
pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool { pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata); return @bitCast(c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata));
} }
pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool { pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool {
return c.SDL_SetPointerProperty(props, name, value); return @bitCast(c.SDL_SetPointerProperty(props, name, value));
} }
pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetStringProperty(props, name, value); return @bitCast(c.SDL_SetStringProperty(props, name, value));
} }
pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool { pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool {
return c.SDL_SetNumberProperty(props, name, value); return @bitCast(c.SDL_SetNumberProperty(props, name, value));
} }
pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool { pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool {
return c.SDL_SetFloatProperty(props, name, value); return @bitCast(c.SDL_SetFloatProperty(props, name, value));
} }
pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool { pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool {
return c.SDL_SetBooleanProperty(props, name, value); return @bitCast(c.SDL_SetBooleanProperty(props, name, @bitCast(value)));
} }
pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_HasProperty(props, name); return @bitCast(c.SDL_HasProperty(props, name));
} }
pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType { pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType {
@ -83,17 +83,17 @@ pub inline fn getFloatProperty(props: PropertiesID, name: [*c]const u8, default_
} }
pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool { pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetBooleanProperty(props, name, default_value); return @bitCast(c.SDL_GetBooleanProperty(props, name, @bitCast(default_value)));
} }
pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_ClearProperty(props, name); return @bitCast(c.SDL_ClearProperty(props, name));
} }
pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback; pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback;
pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateProperties(props, callback, userdata); return @bitCast(c.SDL_EnumerateProperties(props, callback, userdata));
} }
pub inline fn destroyProperties(props: PropertiesID) void { pub inline fn destroyProperties(props: PropertiesID) void {

View File

@ -26,41 +26,41 @@ pub const FRect = extern struct {
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool {
return 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 c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), 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 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 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 c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), 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 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

@ -805,11 +805,11 @@ pub const Renderer = opaque {
} }
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 c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetRenderOutputSize(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 c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetCurrentRenderOutputSize(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 {
@ -825,7 +825,7 @@ pub const Renderer = opaque {
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return c.SDL_SetRenderTarget(renderer, texture); return @bitCast(c.SDL_SetRenderTarget(renderer, texture));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
@ -833,155 +833,155 @@ pub const Renderer = opaque {
} }
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 c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode); return @bitCast(c.SDL_SetRenderLogicalPresentation(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 c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode); return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return c.SDL_GetRenderLogicalPresentationRect(renderer, rect); return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, 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 c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_RenderCoordinatesFromWindow(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 c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y)); return @bitCast(c.SDL_RenderCoordinatesToWindow(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 c.SDL_ConvertEventToRenderCoordinates(renderer, event); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderViewport(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderViewport(renderer, rect); return @bitCast(c.SDL_GetRenderViewport(renderer, rect));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return c.SDL_RenderViewportSet(renderer); return @bitCast(c.SDL_RenderViewportSet(renderer));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderSafeArea(renderer, rect); return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderClipRect(renderer, rect); return @bitCast(c.SDL_GetRenderClipRect(renderer, rect));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return c.SDL_RenderClipEnabled(renderer); return @bitCast(c.SDL_RenderClipEnabled(renderer));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return c.SDL_SetRenderScale(renderer, scaleX, scaleY); return @bitCast(c.SDL_SetRenderScale(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 c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY)); return @bitCast(c.SDL_GetRenderScale(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 c.SDL_SetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColor(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 c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColorFloat(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 c.SDL_GetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_GetRenderDrawColor(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 c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_GetRenderDrawColorFloat(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 c.SDL_SetRenderColorScale(renderer, scale); return @bitCast(c.SDL_SetRenderColorScale(renderer, scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)); return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return c.SDL_RenderClear(renderer); return @bitCast(c.SDL_RenderClear(renderer));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return c.SDL_RenderPoint(renderer, x, y); return @bitCast(c.SDL_RenderPoint(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 c.SDL_RenderPoints(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderPoints(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 c.SDL_RenderLine(renderer, x1, y1, x2, y2); return @bitCast(c.SDL_RenderLine(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 c.SDL_RenderLines(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderLines(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 c.SDL_RenderRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderRect(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 c.SDL_RenderRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderRects(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 c.SDL_RenderFillRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderFillRect(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 c.SDL_RenderFillRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderFillRects(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 c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture(renderer, 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 c.SDL_RenderTextureRotated(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip)); return @bitCast(c.SDL_RenderTextureRotated(renderer, 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 c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTextureTiled(renderer, 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 c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)));
} }
pub inline fn renderGeometry(renderer: *Renderer, texture: ?*Texture, vertices: *const Vertex, num_vertices: c_int, indices: [*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 c.SDL_RenderGeometry(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices); return @bitCast(c.SDL_RenderGeometry(renderer, 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 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(renderer, 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 {
@ -989,7 +989,7 @@ pub const Renderer = opaque {
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return c.SDL_RenderPresent(renderer); return @bitCast(c.SDL_RenderPresent(renderer));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
@ -997,7 +997,7 @@ pub const Renderer = opaque {
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return c.SDL_FlushRenderer(renderer); return @bitCast(c.SDL_FlushRenderer(renderer));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
@ -1009,19 +1009,19 @@ pub const Renderer = opaque {
} }
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 c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore); return @bitCast(c.SDL_AddVulkanRenderSemaphores(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 c.SDL_SetRenderVSync(renderer, vsync); return @bitCast(c.SDL_SetRenderVSync(renderer, vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return c.SDL_GetRenderVSync(renderer, @ptrCast(vsync)); return @bitCast(c.SDL_GetRenderVSync(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 c.SDL_RenderDebugText(renderer, x, y, str); return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str));
} }
}; };
@ -1035,75 +1035,75 @@ pub const Texture = opaque {
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetTextureSize(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 c.SDL_SetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorMod(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 c.SDL_SetTextureColorModFloat(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorModFloat(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 c.SDL_GetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_GetTextureColorMod(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 c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b)); return @bitCast(c.SDL_GetTextureColorModFloat(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 c.SDL_SetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return c.SDL_SetTextureAlphaModFloat(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return c.SDL_GetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)); return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(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 c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch); return @bitCast(c.SDL_UpdateTexture(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 c.SDL_UpdateYUVTexture(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); return @bitCast(c.SDL_UpdateYUVTexture(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 c.SDL_UpdateNVTexture(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch); return @bitCast(c.SDL_UpdateNVTexture(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 c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch)); return @bitCast(c.SDL_LockTexture(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][*c]Surface) bool {
return c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface); return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
@ -1124,7 +1124,7 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
} }
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][*c]Window, renderer: [*c][*c]Renderer) bool {
return 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 {

View File

@ -25,7 +25,7 @@ pub const Sensor = opaque {
} }
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 c.SDL_GetSensorData(sensor, @ptrCast(data), num_values); return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {

View File

@ -45,47 +45,47 @@ 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 c.SDL_CloseStorage(storage); return @bitCast(c.SDL_CloseStorage(storage));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return c.SDL_StorageReady(storage); return @bitCast(c.SDL_StorageReady(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 c.SDL_GetStorageFileSize(storage, path, @ptrCast(length)); return @bitCast(c.SDL_GetStorageFileSize(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 c.SDL_ReadStorageFile(storage, path, destination, length); return @bitCast(c.SDL_ReadStorageFile(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 c.SDL_WriteStorageFile(storage, path, source, length); return @bitCast(c.SDL_WriteStorageFile(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 c.SDL_CreateStorageDirectory(storage, path); return @bitCast(c.SDL_CreateStorageDirectory(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 c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata); return @bitCast(c.SDL_EnumerateStorageDirectory(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 c.SDL_RemoveStoragePath(storage, path); return @bitCast(c.SDL_RemoveStoragePath(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 c.SDL_RenameStoragePath(storage, oldpath, newpath); return @bitCast(c.SDL_RenameStoragePath(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 c.SDL_CopyStorageFile(storage, oldpath, newpath); return @bitCast(c.SDL_CopyStorageFile(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 c.SDL_GetStoragePathInfo(storage, path, info); return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {

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, closeio); return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio));
} }
}; };
@ -104,7 +104,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return c.SDL_SetSurfaceColorspace(surface, colorspace); return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
@ -116,7 +116,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return c.SDL_SetSurfacePalette(surface, palette); return @bitCast(c.SDL_SetSurfacePalette(surface, palette));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
@ -124,11 +124,11 @@ pub const Surface = opaque {
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return c.SDL_AddSurfaceAlternateImage(surface, image); return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return c.SDL_SurfaceHasAlternateImages(surface); return @bitCast(c.SDL_SurfaceHasAlternateImages(surface));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface {
@ -140,7 +140,7 @@ pub const Surface = opaque {
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return c.SDL_LockSurface(surface); return @bitCast(c.SDL_LockSurface(surface));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
@ -148,67 +148,67 @@ pub const Surface = opaque {
} }
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 c.SDL_SaveBMP_IO(surface, dst, closeio); return @bitCast(c.SDL_SaveBMP_IO(surface, 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 c.SDL_SaveBMP(surface, file); return @bitCast(c.SDL_SaveBMP(surface, file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return c.SDL_SetSurfaceRLE(surface, enabled); return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return c.SDL_SurfaceHasRLE(surface); return @bitCast(c.SDL_SurfaceHasRLE(surface));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return c.SDL_SetSurfaceColorKey(surface, enabled, key); return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return c.SDL_SurfaceHasColorKey(surface); return @bitCast(c.SDL_SurfaceHasColorKey(surface));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return c.SDL_GetSurfaceColorKey(surface, @ptrCast(key)); return @bitCast(c.SDL_GetSurfaceColorKey(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 c.SDL_SetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_SetSurfaceColorMod(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 c.SDL_GetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return c.SDL_SetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return c.SDL_GetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool {
return c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)); return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return c.SDL_GetSurfaceClipRect(surface, rect); return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return c.SDL_FlipSurface(surface, @intFromEnum(flip)); return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
@ -228,47 +228,47 @@ pub const Surface = opaque {
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return c.SDL_PremultiplySurfaceAlpha(surface, linear); return @bitCast(c.SDL_PremultiplySurfaceAlpha(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 c.SDL_ClearSurface(surface, r, g, b, a); return @bitCast(c.SDL_ClearSurface(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 c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color); return @bitCast(c.SDL_FillSurfaceRect(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 c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color); return @bitCast(c.SDL_FillSurfaceRects(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 c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), 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 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(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), 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 {
@ -280,19 +280,19 @@ pub const Surface = opaque {
} }
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 c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_ReadSurfacePixel(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 c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_ReadSurfacePixelFloat(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 c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixel(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 c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a));
} }
}; };
@ -309,13 +309,13 @@ pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
} }
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 {
return c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch); return @bitCast(c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch));
} }
pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool { pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool {
return c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch); return @bitCast(c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch));
} }
pub inline fn premultiplyAlpha(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, linear: bool) bool { pub inline fn premultiplyAlpha(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, linear: bool) bool {
return c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, linear); return @bitCast(c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, @bitCast(linear)));
} }

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 c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam); return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam));
} }
}; };
@ -22,7 +22,7 @@ pub inline fn getDirect3D9AdapterIndex(displayID: DisplayID) c_int {
} }
pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool { pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool {
return c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)); return @bitCast(c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)));
} }
pub const X11EventHook = c.SDL_X11EventHook; pub const X11EventHook = c.SDL_X11EventHook;
@ -32,17 +32,17 @@ pub inline fn setX11EventHook(callback: X11EventHook, userdata: ?*anyopaque) voi
} }
pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool { pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool {
return c.SDL_SetLinuxThreadPriority(threadID, priority); return @bitCast(c.SDL_SetLinuxThreadPriority(threadID, priority));
} }
pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool { pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool {
return c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy); return @bitCast(c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy));
} }
pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback; pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback;
pub inline fn setiOSEventPump(enabled: bool) void { pub inline fn setiOSEventPump(enabled: bool) void {
return c.SDL_SetiOSEventPump(enabled); return c.SDL_SetiOSEventPump(@bitCast(enabled));
} }
pub inline fn getAndroidJNIEnv() ?*anyopaque { pub inline fn getAndroidJNIEnv() ?*anyopaque {
@ -58,11 +58,11 @@ pub inline fn getAndroidSDKVersion() c_int {
} }
pub inline fn isChromebook() bool { pub inline fn isChromebook() bool {
return c.SDL_IsChromebook(); return @bitCast(c.SDL_IsChromebook());
} }
pub inline fn isDeXMode() bool { pub inline fn isDeXMode() bool {
return c.SDL_IsDeXMode(); return @bitCast(c.SDL_IsDeXMode());
} }
pub inline fn sendAndroidBackButton() void { pub inline fn sendAndroidBackButton() void {
@ -88,23 +88,23 @@ pub inline fn getAndroidCachePath() [*c]const u8 {
pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback; pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback;
pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool { pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool {
return c.SDL_RequestAndroidPermission(permission, cb, userdata); return @bitCast(c.SDL_RequestAndroidPermission(permission, cb, userdata));
} }
pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool { pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool {
return c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset); return @bitCast(c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset));
} }
pub inline fn sendAndroidMessage(command: u32, param: c_int) bool { pub inline fn sendAndroidMessage(command: u32, param: c_int) bool {
return c.SDL_SendAndroidMessage(command, param); return @bitCast(c.SDL_SendAndroidMessage(command, param));
} }
pub inline fn isTablet() bool { pub inline fn isTablet() bool {
return c.SDL_IsTablet(); return @bitCast(c.SDL_IsTablet());
} }
pub inline fn isTV() bool { pub inline fn isTV() bool {
return c.SDL_IsTV(); return @bitCast(c.SDL_IsTV());
} }
pub const Sandbox = enum(c_int) { pub const Sandbox = enum(c_int) {
@ -151,9 +151,9 @@ pub const XTaskQueueHandle = *anyopaque;
pub const XUserHandle = *anyopaque; pub const XUserHandle = *anyopaque;
pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool { pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool {
return c.SDL_GetGDKTaskQueue(outTaskQueue); return @bitCast(c.SDL_GetGDKTaskQueue(outTaskQueue));
} }
pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool { pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool {
return c.SDL_GetGDKDefaultUser(outUserHandle); return @bitCast(c.SDL_GetGDKDefaultUser(outUserHandle));
} }

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 c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return c.SDL_GetCurrentTime(ticks); return @bitCast(c.SDL_GetCurrentTime(ticks));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return c.SDL_TimeToDateTime(ticks, dt, localTime); return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool {
return c.SDL_DateTimeToTime(@ptrCast(dt), ticks); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), 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

@ -44,5 +44,5 @@ pub inline fn addTimerNS(interval: u64, callback: NSTimerCallback, userdata: ?*a
} }
pub inline fn removeTimer(id: TimerID) bool { pub inline fn removeTimer(id: TimerID) bool {
return c.SDL_RemoveTimer(id); return @bitCast(c.SDL_RemoveTimer(id));
} }

View File

@ -77,7 +77,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool {
return c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)); return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode {
@ -113,7 +113,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return c.SDL_SetWindowTitle(window, title); return @bitCast(c.SDL_SetWindowTitle(window, title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
@ -121,107 +121,107 @@ pub const Window = opaque {
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return c.SDL_SetWindowIcon(window, icon); return @bitCast(c.SDL_SetWindowIcon(window, 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 c.SDL_SetWindowPosition(window, x, y); return @bitCast(c.SDL_SetWindowPosition(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 c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_GetWindowPosition(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 c.SDL_SetWindowSize(window, w, h); return @bitCast(c.SDL_SetWindowSize(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 c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return c.SDL_GetWindowSafeArea(window, rect); return @bitCast(c.SDL_GetWindowSafeArea(window, 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 c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect); return @bitCast(c.SDL_SetWindowAspectRatio(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 c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect)); return @bitCast(c.SDL_GetWindowAspectRatio(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 c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)); return @bitCast(c.SDL_GetWindowBordersSize(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 c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSizeInPixels(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 c.SDL_SetWindowMinimumSize(window, min_w, min_h); return @bitCast(c.SDL_SetWindowMinimumSize(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 c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMinimumSize(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 c.SDL_SetWindowMaximumSize(window, max_w, max_h); return @bitCast(c.SDL_SetWindowMaximumSize(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 c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return c.SDL_SetWindowBordered(window, bordered); return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return c.SDL_SetWindowResizable(window, resizable); return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return c.SDL_SetWindowAlwaysOnTop(window, on_top); return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return c.SDL_ShowWindow(window); return @bitCast(c.SDL_ShowWindow(window));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return c.SDL_HideWindow(window); return @bitCast(c.SDL_HideWindow(window));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return c.SDL_RaiseWindow(window); return @bitCast(c.SDL_RaiseWindow(window));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return c.SDL_MaximizeWindow(window); return @bitCast(c.SDL_MaximizeWindow(window));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return c.SDL_MinimizeWindow(window); return @bitCast(c.SDL_MinimizeWindow(window));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return c.SDL_RestoreWindow(window); return @bitCast(c.SDL_RestoreWindow(window));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return c.SDL_SetWindowFullscreen(window, fullscreen); return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return c.SDL_SyncWindow(window); return @bitCast(c.SDL_SyncWindow(window));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return c.SDL_WindowHasSurface(window); return @bitCast(c.SDL_WindowHasSurface(window));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
@ -229,43 +229,43 @@ pub const Window = opaque {
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return c.SDL_SetWindowSurfaceVSync(window, vsync); return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)); return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return c.SDL_UpdateWindowSurface(window); return @bitCast(c.SDL_UpdateWindowSurface(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 c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects); return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return c.SDL_DestroyWindowSurface(window); return @bitCast(c.SDL_DestroyWindowSurface(window));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowKeyboardGrab(window, grabbed); return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowMouseGrab(window, grabbed); return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return c.SDL_GetWindowKeyboardGrab(window); return @bitCast(c.SDL_GetWindowKeyboardGrab(window));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return c.SDL_GetWindowMouseGrab(window); return @bitCast(c.SDL_GetWindowMouseGrab(window));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool {
return c.SDL_SetWindowMouseRect(window, @ptrCast(rect)); return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) *const Rect {
@ -273,7 +273,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return c.SDL_SetWindowOpacity(window, opacity); return @bitCast(c.SDL_SetWindowOpacity(window, opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
@ -281,31 +281,31 @@ pub const Window = opaque {
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return c.SDL_SetWindowParent(window, parent); return @bitCast(c.SDL_SetWindowParent(window, parent));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return c.SDL_SetWindowModal(window, modal); return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return c.SDL_SetWindowFocusable(window, focusable); return @bitCast(c.SDL_SetWindowFocusable(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 c.SDL_ShowWindowSystemMenu(window, x, y); return @bitCast(c.SDL_ShowWindowSystemMenu(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 c.SDL_SetWindowHitTest(window, callback, callback_data); return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return c.SDL_SetWindowShape(window, shape); return @bitCast(c.SDL_SetWindowShape(window, shape));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return c.SDL_FlashWindow(window, @intFromEnum(operation)); return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
@ -317,7 +317,7 @@ pub const Window = opaque {
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return c.SDL_GL_MakeCurrent(window, context); return @bitCast(c.SDL_GL_MakeCurrent(window, context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
@ -325,7 +325,7 @@ pub const Window = opaque {
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return c.SDL_GL_SwapWindow(window); return @bitCast(c.SDL_GL_SwapWindow(window));
} }
}; };
@ -453,11 +453,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 c.SDL_GetDisplayBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayBounds(displayID, rect));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return c.SDL_GetDisplayUsableBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -477,7 +477,7 @@ pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c
} }
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 c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, include_high_density_modes, @intFromEnum(mode)); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(mode)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode {
@ -532,19 +532,19 @@ pub const HitTestResult = enum(c_int) {
pub const HitTest = c.SDL_HitTest; pub const HitTest = c.SDL_HitTest;
pub inline fn screenSaverEnabled() bool { pub inline fn screenSaverEnabled() bool {
return c.SDL_ScreenSaverEnabled(); return @bitCast(c.SDL_ScreenSaverEnabled());
} }
pub inline fn enableScreenSaver() bool { pub inline fn enableScreenSaver() bool {
return c.SDL_EnableScreenSaver(); return @bitCast(c.SDL_EnableScreenSaver());
} }
pub inline fn disableScreenSaver() bool { pub inline fn disableScreenSaver() bool {
return c.SDL_DisableScreenSaver(); return @bitCast(c.SDL_DisableScreenSaver());
} }
pub inline fn gl_LoadLibrary(path: [*c]const u8) bool { pub inline fn gl_LoadLibrary(path: [*c]const u8) bool {
return c.SDL_GL_LoadLibrary(path); return @bitCast(c.SDL_GL_LoadLibrary(path));
} }
pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer { pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer {
@ -560,7 +560,7 @@ pub inline fn gl_UnloadLibrary() void {
} }
pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool { pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool {
return c.SDL_GL_ExtensionSupported(extension); return @bitCast(c.SDL_GL_ExtensionSupported(extension));
} }
pub inline fn gl_ResetAttributes() void { pub inline fn gl_ResetAttributes() void {
@ -568,11 +568,11 @@ pub inline fn gl_ResetAttributes() void {
} }
pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool { pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool {
return c.SDL_GL_SetAttribute(attr, value); return @bitCast(c.SDL_GL_SetAttribute(attr, value));
} }
pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool { pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
return c.SDL_GL_GetAttribute(attr, @ptrCast(value)); return @bitCast(c.SDL_GL_GetAttribute(attr, @ptrCast(value)));
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
@ -596,13 +596,13 @@ pub inline fn egl_SetAttributeCallbacks(platformAttribCallback: EGLAttribArrayCa
} }
pub inline fn gl_SetSwapInterval(interval: c_int) bool { pub inline fn gl_SetSwapInterval(interval: c_int) bool {
return c.SDL_GL_SetSwapInterval(interval); return @bitCast(c.SDL_GL_SetSwapInterval(interval));
} }
pub inline fn gl_GetSwapInterval(interval: *c_int) bool { pub inline fn gl_GetSwapInterval(interval: *c_int) bool {
return c.SDL_GL_GetSwapInterval(@ptrCast(interval)); return @bitCast(c.SDL_GL_GetSwapInterval(@ptrCast(interval)));
} }
pub inline fn gl_DestroyContext(context: GLContext) bool { pub inline fn gl_DestroyContext(context: GLContext) bool {
return c.SDL_GL_DestroyContext(context); return @bitCast(c.SDL_GL_DestroyContext(context));
} }

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 c.SDL_LoadWAV_IO(iostream, closeio, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -43,11 +43,11 @@ pub const AudioStream = opaque {
} }
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 c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec); return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, 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 c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)); return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
@ -55,7 +55,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
@ -63,7 +63,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return c.SDL_SetAudioStreamGain(audiostream, gain); return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
@ -75,15 +75,15 @@ pub const AudioStream = opaque {
} }
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 c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(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 c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(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 c.SDL_PutAudioStreamData(audiostream, buf, len); return @bitCast(c.SDL_PutAudioStreamData(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 {
@ -99,35 +99,35 @@ pub const AudioStream = opaque {
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return c.SDL_FlushAudioStream(audiostream); return @bitCast(c.SDL_FlushAudioStream(audiostream));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return c.SDL_ClearAudioStream(audiostream); return @bitCast(c.SDL_ClearAudioStream(audiostream));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_PauseAudioStreamDevice(audiostream); return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_ResumeAudioStreamDevice(audiostream); return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_LockAudioStream(audiostream); return @bitCast(c.SDL_LockAudioStream(audiostream));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_UnlockAudioStream(audiostream); return @bitCast(c.SDL_UnlockAudioStream(audiostream));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamGetCallback(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 c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
@ -160,7 +160,7 @@ 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 c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames)); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, 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 {
@ -172,23 +172,23 @@ pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) Audi
} }
pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePhysical(devid); return @bitCast(c.SDL_IsAudioDevicePhysical(devid));
} }
pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePlayback(devid); return @bitCast(c.SDL_IsAudioDevicePlayback(devid));
} }
pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool { pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_PauseAudioDevice(dev); return @bitCast(c.SDL_PauseAudioDevice(dev));
} }
pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool { pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_ResumeAudioDevice(dev); return @bitCast(c.SDL_ResumeAudioDevice(dev));
} }
pub inline fn audioDevicePaused(dev: AudioDeviceID) bool { pub inline fn audioDevicePaused(dev: AudioDeviceID) bool {
return c.SDL_AudioDevicePaused(dev); return @bitCast(c.SDL_AudioDevicePaused(dev));
} }
pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 { pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
@ -196,7 +196,7 @@ pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
} }
pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool { pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool {
return c.SDL_SetAudioDeviceGain(devid, gain); return @bitCast(c.SDL_SetAudioDeviceGain(devid, gain));
} }
pub inline fn closeAudioDevice(devid: AudioDeviceID) void { pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
@ -204,11 +204,11 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
} }
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 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 c.SDL_BindAudioStream(devid, stream); return @bitCast(c.SDL_BindAudioStream(devid, 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 {
@ -228,19 +228,19 @@ pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioPostmixCallback(devid, callback, userdata); return @bitCast(c.SDL_SetAudioPostmixCallback(devid, callback, userdata));
} }
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 c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV(path, 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 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 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)));
} }
pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 { pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 {

View File

@ -63,7 +63,7 @@ pub const Camera = opaque {
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return c.SDL_GetCameraFormat(camera, spec); return @bitCast(c.SDL_GetCameraFormat(camera, spec));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn setClipboardText(text: [*c]const u8) bool { pub inline fn setClipboardText(text: [*c]const u8) bool {
return c.SDL_SetClipboardText(text); return @bitCast(c.SDL_SetClipboardText(text));
} }
pub inline fn getClipboardText() [*c]u8 { pub inline fn getClipboardText() [*c]u8 {
@ -10,11 +10,11 @@ pub inline fn getClipboardText() [*c]u8 {
} }
pub inline fn hasClipboardText() bool { pub inline fn hasClipboardText() bool {
return c.SDL_HasClipboardText(); return @bitCast(c.SDL_HasClipboardText());
} }
pub inline fn setPrimarySelectionText(text: [*c]const u8) bool { pub inline fn setPrimarySelectionText(text: [*c]const u8) bool {
return c.SDL_SetPrimarySelectionText(text); return @bitCast(c.SDL_SetPrimarySelectionText(text));
} }
pub inline fn getPrimarySelectionText() [*c]u8 { pub inline fn getPrimarySelectionText() [*c]u8 {
@ -22,7 +22,7 @@ pub inline fn getPrimarySelectionText() [*c]u8 {
} }
pub inline fn hasPrimarySelectionText() bool { pub inline fn hasPrimarySelectionText() bool {
return c.SDL_HasPrimarySelectionText(); return @bitCast(c.SDL_HasPrimarySelectionText());
} }
pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback; pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
@ -30,11 +30,11 @@ pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback; pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback;
pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool { pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool {
return c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types); return @bitCast(c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types));
} }
pub inline fn clearClipboardData() bool { pub inline fn clearClipboardData() bool {
return c.SDL_ClearClipboardData(); return @bitCast(c.SDL_ClearClipboardData());
} }
pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque { pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque {
@ -42,7 +42,7 @@ pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaqu
} }
pub inline fn hasClipboardData(mime_type: [*c]const u8) bool { pub inline fn hasClipboardData(mime_type: [*c]const u8) bool {
return c.SDL_HasClipboardData(mime_type); return @bitCast(c.SDL_HasClipboardData(mime_type));
} }
pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 { pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 {

View File

@ -13,7 +13,7 @@ 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, allow_many); return c.SDL_ShowOpenFileDialog(callback, userdata, 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 {
@ -21,7 +21,7 @@ pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyop
} }
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, allow_many); return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn outOfMemory() bool { pub inline fn outOfMemory() bool {
return c.SDL_OutOfMemory(); return @bitCast(c.SDL_OutOfMemory());
} }
pub inline fn getError() [*c]const u8 { pub inline fn getError() [*c]const u8 {
@ -10,5 +10,5 @@ pub inline fn getError() [*c]const u8 {
} }
pub inline fn clearError() bool { pub inline fn clearError() bool {
return c.SDL_ClearError(); return @bitCast(c.SDL_ClearError());
} }

View File

@ -698,11 +698,11 @@ pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction,
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
return c.SDL_HasEvent(_type); return @bitCast(c.SDL_HasEvent(_type));
} }
pub inline fn hasEvents(minType: u32, maxType: u32) bool { pub inline fn hasEvents(minType: u32, maxType: u32) bool {
return c.SDL_HasEvents(minType, maxType); return @bitCast(c.SDL_HasEvents(minType, maxType));
} }
pub inline fn flushEvent(_type: u32) void { pub inline fn flushEvent(_type: u32) void {
@ -714,19 +714,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 c.SDL_PollEvent(event); return @bitCast(c.SDL_PollEvent(event));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return c.SDL_WaitEvent(event); return @bitCast(c.SDL_WaitEvent(event));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return c.SDL_WaitEventTimeout(event, timeoutMS); return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return c.SDL_PushEvent(event); return @bitCast(c.SDL_PushEvent(event));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,11 +736,11 @@ 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 c.SDL_GetEventFilter(filter, userdata); return @bitCast(c.SDL_GetEventFilter(filter, userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
return c.SDL_AddEventWatch(filter, userdata); return @bitCast(c.SDL_AddEventWatch(filter, userdata));
} }
pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void { pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void {
@ -752,11 +752,11 @@ pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn setEventEnabled(_type: u32, enabled: bool) void { pub inline fn setEventEnabled(_type: u32, enabled: bool) void {
return c.SDL_SetEventEnabled(_type, enabled); return c.SDL_SetEventEnabled(_type, @bitCast(enabled));
} }
pub inline fn eventEnabled(_type: u32) bool { pub inline fn eventEnabled(_type: u32) bool {
return c.SDL_EventEnabled(_type); return @bitCast(c.SDL_EventEnabled(_type));
} }
pub inline fn registerEvents(numevents: c_int) u32 { pub inline fn registerEvents(numevents: c_int) u32 {

View File

@ -52,7 +52,7 @@ pub const GlobFlags = packed struct(u32) {
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
return c.SDL_CreateDirectory(path); return @bitCast(c.SDL_CreateDirectory(path));
} }
pub const EnumerationResult = enum(c_int) { pub const EnumerationResult = enum(c_int) {
@ -64,23 +64,23 @@ pub const EnumerationResult = enum(c_int) {
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateDirectory(path, callback, userdata); return @bitCast(c.SDL_EnumerateDirectory(path, callback, userdata));
} }
pub inline fn removePath(path: [*c]const u8) bool { pub inline fn removePath(path: [*c]const u8) bool {
return c.SDL_RemovePath(path); return @bitCast(c.SDL_RemovePath(path));
} }
pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_RenamePath(oldpath, newpath); return @bitCast(c.SDL_RenamePath(oldpath, newpath));
} }
pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_CopyFile(oldpath, newpath); return @bitCast(c.SDL_CopyFile(oldpath, newpath));
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return c.SDL_GetPathInfo(path, info); return @bitCast(c.SDL_GetPathInfo(path, 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, closeio); return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio));
} }
}; };
@ -77,7 +77,7 @@ pub const Gamepad = opaque {
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return c.SDL_SetGamepadPlayerIndex(gamepad, player_index); return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
@ -113,7 +113,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return c.SDL_GamepadConnected(gamepad); return @bitCast(c.SDL_GamepadConnected(gamepad));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
@ -125,7 +125,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return c.SDL_GamepadHasAxis(gamepad, axis); return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
@ -133,11 +133,11 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GamepadHasButton(gamepad, button); return @bitCast(c.SDL_GamepadHasButton(gamepad, button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GetGamepadButton(gamepad, button); return @bitCast(c.SDL_GetGamepadButton(gamepad, button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
@ -153,19 +153,19 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)); return @bitCast(c.SDL_GetGamepadTouchpadFinger(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 c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadHasSensor(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 c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), enabled); return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
@ -173,23 +173,23 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values); return @bitCast(c.SDL_GetGamepadSensorData(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 c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepad(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 c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepadTriggers(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 c.SDL_SetGamepadLED(gamepad, red, green, blue); return @bitCast(c.SDL_SetGamepadLED(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 c.SDL_SendGamepadEffect(gamepad, data, size); return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
@ -288,7 +288,7 @@ pub inline fn addGamepadMappingsFromFile(file: [*c]const u8) c_int {
} }
pub inline fn reloadGamepadMappings() bool { pub inline fn reloadGamepadMappings() bool {
return c.SDL_ReloadGamepadMappings(); return @bitCast(c.SDL_ReloadGamepadMappings());
} }
pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 { pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 {
@ -300,11 +300,11 @@ pub inline fn getGamepadMappingForGUID(guid: GUID) [*c]u8 {
} }
pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool { pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool {
return c.SDL_SetGamepadMapping(instance_id, mapping); return @bitCast(c.SDL_SetGamepadMapping(instance_id, mapping));
} }
pub inline fn hasGamepad() bool { pub inline fn hasGamepad() bool {
return c.SDL_HasGamepad(); return @bitCast(c.SDL_HasGamepad());
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
@ -312,7 +312,7 @@ pub inline fn getGamepads(count: *c_int) ?*JoystickID {
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
return c.SDL_IsGamepad(instance_id); return @bitCast(c.SDL_IsGamepad(instance_id));
} }
pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 {
@ -368,11 +368,11 @@ pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {
return c.SDL_SetGamepadEventsEnabled(enabled); return c.SDL_SetGamepadEventsEnabled(@bitCast(enabled));
} }
pub inline fn gamepadEventsEnabled() bool { pub inline fn gamepadEventsEnabled() bool {
return c.SDL_GamepadEventsEnabled(); return @bitCast(c.SDL_GamepadEventsEnabled());
} }
pub inline fn updateGamepads() void { pub inline fn updateGamepads() void {

View File

@ -107,7 +107,7 @@ pub const GPUDevice = opaque {
} }
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, cycle); return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
@ -115,15 +115,15 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, 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 c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_ClaimWindowForGPUDevice(gpudevice, window); return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
@ -131,11 +131,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)); return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, 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 c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
@ -143,19 +143,19 @@ pub const GPUDevice = opaque {
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_WaitForGPUSwapchain(gpudevice, window); return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return c.SDL_WaitForGPUIdle(gpudevice); return @bitCast(c.SDL_WaitForGPUIdle(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 c.SDL_WaitForGPUFences(gpudevice, wait_all, fences, num_fences); return @bitCast(c.SDL_WaitForGPUFences(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 c.SDL_QueryGPUFence(gpudevice, fence); return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
@ -163,11 +163,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage)); return @bitCast(c.SDL_GPUTextureSupportsFormat(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 c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
@ -239,15 +239,15 @@ pub const GPUCommandBuffer = opaque {
} }
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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, 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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, 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 c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
@ -255,7 +255,7 @@ pub const GPUCommandBuffer = opaque {
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return c.SDL_CancelGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer));
} }
}; };
@ -365,19 +365,19 @@ pub const GPUComputePass = opaque {
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), cycle); return c.SDL_UploadToGPUTexture(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), cycle); return c.SDL_UploadToGPUBuffer(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, cycle); return c.SDL_CopyGPUTextureToTexture(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, cycle); return c.SDL_CopyGPUBufferToBuffer(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 {
@ -1064,15 +1064,15 @@ pub const GPUStorageTextureReadWriteBinding = extern struct {
}; };
pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool { pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool {
return c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name); return @bitCast(c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name));
} }
pub inline fn gpuSupportsProperties(props: PropertiesID) bool { pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
return c.SDL_GPUSupportsProperties(props); return @bitCast(c.SDL_GPUSupportsProperties(props));
} }
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), debug_mode, name); return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name);
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {

View File

@ -3,7 +3,7 @@ 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 c.SDL_IsJoystickHaptic(joystick); return @bitCast(c.SDL_IsJoystickHaptic(joystick));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
@ -41,7 +41,7 @@ pub const Haptic = opaque {
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool {
return c.SDL_HapticEffectSupported(haptic, @ptrCast(effect)); return @bitCast(c.SDL_HapticEffectSupported(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 {
@ -49,15 +49,15 @@ pub const Haptic = opaque {
} }
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 c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data)); return @bitCast(c.SDL_UpdateHapticEffect(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 c.SDL_RunHapticEffect(haptic, effect, iterations); return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return c.SDL_StopHapticEffect(haptic, effect); return @bitCast(c.SDL_StopHapticEffect(haptic, effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
@ -65,43 +65,43 @@ pub const Haptic = opaque {
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return c.SDL_GetHapticEffectStatus(haptic, effect); return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return c.SDL_SetHapticGain(haptic, gain); return @bitCast(c.SDL_SetHapticGain(haptic, gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return c.SDL_SetHapticAutocenter(haptic, autocenter); return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return c.SDL_PauseHaptic(haptic); return @bitCast(c.SDL_PauseHaptic(haptic));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return c.SDL_ResumeHaptic(haptic); return @bitCast(c.SDL_ResumeHaptic(haptic));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return c.SDL_StopHapticEffects(haptic); return @bitCast(c.SDL_StopHapticEffects(haptic));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return c.SDL_HapticRumbleSupported(haptic); return @bitCast(c.SDL_HapticRumbleSupported(haptic));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return c.SDL_InitHapticRumble(haptic); return @bitCast(c.SDL_InitHapticRumble(haptic));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return c.SDL_PlayHapticRumble(haptic, strength, length); return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return c.SDL_StopHapticRumble(haptic); return @bitCast(c.SDL_StopHapticRumble(haptic));
} }
}; };
@ -222,7 +222,7 @@ pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
return c.SDL_IsMouseHaptic(); return @bitCast(c.SDL_IsMouseHaptic());
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {

View File

@ -8,15 +8,15 @@ pub const HintPriority = enum(c_int) {
}; };
pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool { pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool {
return c.SDL_SetHintWithPriority(name, value, priority); return @bitCast(c.SDL_SetHintWithPriority(name, value, priority));
} }
pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetHint(name, value); return @bitCast(c.SDL_SetHint(name, value));
} }
pub inline fn resetHint(name: [*c]const u8) bool { pub inline fn resetHint(name: [*c]const u8) bool {
return c.SDL_ResetHint(name); return @bitCast(c.SDL_ResetHint(name));
} }
pub inline fn resetHints() void { pub inline fn resetHints() void {
@ -28,13 +28,13 @@ pub inline fn getHint(name: [*c]const u8) [*c]const u8 {
} }
pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool { pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetHintBoolean(name, default_value); return @bitCast(c.SDL_GetHintBoolean(name, @bitCast(default_value)));
} }
pub const HintCallback = c.SDL_HintCallback; pub const HintCallback = c.SDL_HintCallback;
pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool { pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool {
return c.SDL_AddHintCallback(name, callback, userdata); return @bitCast(c.SDL_AddHintCallback(name, callback, userdata));
} }
pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void { pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void {

View File

@ -29,11 +29,11 @@ pub const AppEvent_func = c.SDL_AppEvent_func;
pub const AppQuit_func = c.SDL_AppQuit_func; pub const AppQuit_func = c.SDL_AppQuit_func;
pub inline fn init(flags: InitFlags) bool { pub inline fn init(flags: InitFlags) bool {
return c.SDL_Init(@bitCast(flags)); return @bitCast(c.SDL_Init(@bitCast(flags)));
} }
pub inline fn initSubSystem(flags: InitFlags) bool { pub inline fn initSubSystem(flags: InitFlags) bool {
return c.SDL_InitSubSystem(@bitCast(flags)); return @bitCast(c.SDL_InitSubSystem(@bitCast(flags)));
} }
pub inline fn quitSubSystem(flags: InitFlags) void { pub inline fn quitSubSystem(flags: InitFlags) void {
@ -49,21 +49,21 @@ pub inline fn quit() void {
} }
pub inline fn isMainThread() bool { pub inline fn isMainThread() bool {
return c.SDL_IsMainThread(); return @bitCast(c.SDL_IsMainThread());
} }
pub const MainThreadCallback = c.SDL_MainThreadCallback; pub const MainThreadCallback = c.SDL_MainThreadCallback;
pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool { pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool {
return c.SDL_RunOnMainThread(callback, userdata, wait_complete); return @bitCast(c.SDL_RunOnMainThread(callback, userdata, @bitCast(wait_complete)));
} }
pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool { pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool {
return c.SDL_SetAppMetadata(appname, appversion, appidentifier); return @bitCast(c.SDL_SetAppMetadata(appname, appversion, appidentifier));
} }
pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetAppMetadataProperty(name, value); return @bitCast(c.SDL_SetAppMetadataProperty(name, value));
} }
pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 { pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 {

View File

@ -29,27 +29,27 @@ 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 c.SDL_SetJoystickVirtualAxis(joystick, axis, value); return @bitCast(c.SDL_SetJoystickVirtualAxis(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 c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel); return @bitCast(c.SDL_SetJoystickVirtualBall(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 c.SDL_SetJoystickVirtualButton(joystick, button, down); return @bitCast(c.SDL_SetJoystickVirtualButton(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 c.SDL_SetJoystickVirtualHat(joystick, hat, value); return @bitCast(c.SDL_SetJoystickVirtualHat(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 c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, down, x, y, pressure); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(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 c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values); return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
@ -69,7 +69,7 @@ pub const Joystick = opaque {
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return c.SDL_SetJoystickPlayerIndex(joystick, player_index); return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
@ -101,7 +101,7 @@ pub const Joystick = opaque {
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return c.SDL_JoystickConnected(joystick); return @bitCast(c.SDL_JoystickConnected(joystick));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
@ -129,11 +129,11 @@ pub const Joystick = opaque {
} }
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 c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state)); return @bitCast(c.SDL_GetJoystickAxisInitialState(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 c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy)); return @bitCast(c.SDL_GetJoystickBall(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 {
@ -141,23 +141,23 @@ pub const Joystick = opaque {
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return c.SDL_GetJoystickButton(joystick, button); return @bitCast(c.SDL_GetJoystickButton(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 c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystick(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 c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystickTriggers(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 c.SDL_SetJoystickLED(joystick, red, green, blue); return @bitCast(c.SDL_SetJoystickLED(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 c.SDL_SendJoystickEffect(joystick, data, size); return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
@ -204,7 +204,7 @@ pub inline fn unlockJoysticks() void {
} }
pub inline fn hasJoystick() bool { pub inline fn hasJoystick() bool {
return c.SDL_HasJoystick(); return @bitCast(c.SDL_HasJoystick());
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
@ -297,11 +297,11 @@ pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID
} }
pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool { pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool {
return c.SDL_DetachVirtualJoystick(instance_id); return @bitCast(c.SDL_DetachVirtualJoystick(instance_id));
} }
pub inline fn isJoystickVirtual(instance_id: JoystickID) bool { pub inline fn isJoystickVirtual(instance_id: JoystickID) bool {
return c.SDL_IsJoystickVirtual(instance_id); return @bitCast(c.SDL_IsJoystickVirtual(instance_id));
} }
pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void { pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void {
@ -309,11 +309,11 @@ pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, versi
} }
pub inline fn setJoystickEventsEnabled(enabled: bool) void { pub inline fn setJoystickEventsEnabled(enabled: bool) void {
return c.SDL_SetJoystickEventsEnabled(enabled); return c.SDL_SetJoystickEventsEnabled(@bitCast(enabled));
} }
pub inline fn joystickEventsEnabled() bool { pub inline fn joystickEventsEnabled() bool {
return c.SDL_JoystickEventsEnabled(); return @bitCast(c.SDL_JoystickEventsEnabled());
} }
pub inline fn updateJoysticks() void { pub inline fn updateJoysticks() void {

View File

@ -56,9 +56,9 @@ pub const MessageBoxData = extern struct {
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool {
return 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 c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window));
} }

View File

@ -2,5 +2,5 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn openURL(url: [*c]const u8) bool { pub inline fn openURL(url: [*c]const u8) bool {
return c.SDL_OpenURL(url); return @bitCast(c.SDL_OpenURL(url));
} }

View File

@ -7,11 +7,11 @@ pub const Window = opaque {
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return c.SDL_SetWindowRelativeMouseMode(window, enabled); return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return c.SDL_GetWindowRelativeMouseMode(window); return @bitCast(c.SDL_GetWindowRelativeMouseMode(window));
} }
}; };
@ -25,7 +25,7 @@ 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 c.SDL_SetCursor(cursor); return @bitCast(c.SDL_SetCursor(cursor));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
@ -71,7 +71,7 @@ pub const MouseButtonFlags = packed struct(u32) {
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
return c.SDL_HasMouse(); return @bitCast(c.SDL_HasMouse());
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
@ -99,11 +99,11 @@ pub inline fn getRelativeMouseState(x: *f32, y: *f32) MouseButtonFlags {
} }
pub inline fn warpMouseGlobal(x: f32, y: f32) bool { pub inline fn warpMouseGlobal(x: f32, y: f32) bool {
return c.SDL_WarpMouseGlobal(x, y); return @bitCast(c.SDL_WarpMouseGlobal(x, y));
} }
pub inline fn captureMouse(enabled: bool) bool { pub inline fn captureMouse(enabled: bool) bool {
return c.SDL_CaptureMouse(enabled); return @bitCast(c.SDL_CaptureMouse(@bitCast(enabled)));
} }
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 {
@ -123,13 +123,13 @@ pub inline fn getDefaultCursor() ?*Cursor {
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {
return c.SDL_ShowCursor(); return @bitCast(c.SDL_ShowCursor());
} }
pub inline fn hideCursor() bool { pub inline fn hideCursor() bool {
return c.SDL_HideCursor(); return @bitCast(c.SDL_HideCursor());
} }
pub inline fn cursorVisible() bool { pub inline fn cursorVisible() bool {
return c.SDL_CursorVisible(); return @bitCast(c.SDL_CursorVisible());
} }

View File

@ -198,7 +198,7 @@ pub inline fn getPixelFormatName(format: PixelFormat) [*c]const u8 {
} }
pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool { pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool {
return c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)); return @bitCast(c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)));
} }
pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat { pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat {
@ -214,7 +214,7 @@ pub inline fn createPalette(ncolors: c_int) ?*Palette {
} }
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 c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors); return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {

View File

@ -21,11 +21,11 @@ pub inline fn createProperties() PropertiesID {
} }
pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool { pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool {
return c.SDL_CopyProperties(src, dst); return @bitCast(c.SDL_CopyProperties(src, dst));
} }
pub inline fn lockProperties(props: PropertiesID) bool { pub inline fn lockProperties(props: PropertiesID) bool {
return c.SDL_LockProperties(props); return @bitCast(c.SDL_LockProperties(props));
} }
pub inline fn unlockProperties(props: PropertiesID) void { pub inline fn unlockProperties(props: PropertiesID) void {
@ -35,31 +35,31 @@ pub inline fn unlockProperties(props: PropertiesID) void {
pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback; pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback;
pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool { pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata); return @bitCast(c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata));
} }
pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool { pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool {
return c.SDL_SetPointerProperty(props, name, value); return @bitCast(c.SDL_SetPointerProperty(props, name, value));
} }
pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetStringProperty(props, name, value); return @bitCast(c.SDL_SetStringProperty(props, name, value));
} }
pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool { pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool {
return c.SDL_SetNumberProperty(props, name, value); return @bitCast(c.SDL_SetNumberProperty(props, name, value));
} }
pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool { pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool {
return c.SDL_SetFloatProperty(props, name, value); return @bitCast(c.SDL_SetFloatProperty(props, name, value));
} }
pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool { pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool {
return c.SDL_SetBooleanProperty(props, name, value); return @bitCast(c.SDL_SetBooleanProperty(props, name, @bitCast(value)));
} }
pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_HasProperty(props, name); return @bitCast(c.SDL_HasProperty(props, name));
} }
pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType { pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType {
@ -83,17 +83,17 @@ pub inline fn getFloatProperty(props: PropertiesID, name: [*c]const u8, default_
} }
pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool { pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetBooleanProperty(props, name, default_value); return @bitCast(c.SDL_GetBooleanProperty(props, name, @bitCast(default_value)));
} }
pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_ClearProperty(props, name); return @bitCast(c.SDL_ClearProperty(props, name));
} }
pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback; pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback;
pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateProperties(props, callback, userdata); return @bitCast(c.SDL_EnumerateProperties(props, callback, userdata));
} }
pub inline fn destroyProperties(props: PropertiesID) void { pub inline fn destroyProperties(props: PropertiesID) void {

View File

@ -26,41 +26,41 @@ pub const FRect = extern struct {
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool {
return 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 c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), 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 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 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 c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), 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 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

@ -814,11 +814,11 @@ pub const Renderer = opaque {
} }
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 c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetRenderOutputSize(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 c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetCurrentRenderOutputSize(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 {
@ -834,7 +834,7 @@ pub const Renderer = opaque {
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return c.SDL_SetRenderTarget(renderer, texture); return @bitCast(c.SDL_SetRenderTarget(renderer, texture));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
@ -842,159 +842,159 @@ pub const Renderer = opaque {
} }
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 c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode); return @bitCast(c.SDL_SetRenderLogicalPresentation(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 c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode); return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return c.SDL_GetRenderLogicalPresentationRect(renderer, rect); return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, 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 c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_RenderCoordinatesFromWindow(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 c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y)); return @bitCast(c.SDL_RenderCoordinatesToWindow(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 c.SDL_ConvertEventToRenderCoordinates(renderer, event); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderViewport(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderViewport(renderer, rect); return @bitCast(c.SDL_GetRenderViewport(renderer, rect));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return c.SDL_RenderViewportSet(renderer); return @bitCast(c.SDL_RenderViewportSet(renderer));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderSafeArea(renderer, rect); return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderClipRect(renderer, rect); return @bitCast(c.SDL_GetRenderClipRect(renderer, rect));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return c.SDL_RenderClipEnabled(renderer); return @bitCast(c.SDL_RenderClipEnabled(renderer));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return c.SDL_SetRenderScale(renderer, scaleX, scaleY); return @bitCast(c.SDL_SetRenderScale(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 c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY)); return @bitCast(c.SDL_GetRenderScale(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 c.SDL_SetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColor(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 c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColorFloat(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 c.SDL_GetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_GetRenderDrawColor(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 c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_GetRenderDrawColorFloat(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 c.SDL_SetRenderColorScale(renderer, scale); return @bitCast(c.SDL_SetRenderColorScale(renderer, scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)); return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return c.SDL_RenderClear(renderer); return @bitCast(c.SDL_RenderClear(renderer));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return c.SDL_RenderPoint(renderer, x, y); return @bitCast(c.SDL_RenderPoint(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 c.SDL_RenderPoints(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderPoints(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 c.SDL_RenderLine(renderer, x1, y1, x2, y2); return @bitCast(c.SDL_RenderLine(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 c.SDL_RenderLines(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderLines(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 c.SDL_RenderRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderRect(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 c.SDL_RenderRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderRects(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 c.SDL_RenderFillRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderFillRect(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 c.SDL_RenderFillRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderFillRects(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 c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture(renderer, 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 c.SDL_RenderTextureRotated(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip)); return @bitCast(c.SDL_RenderTextureRotated(renderer, 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 c.SDL_RenderTextureAffine(renderer, texture, @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down)); return @bitCast(c.SDL_RenderTextureAffine(renderer, 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 c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTextureTiled(renderer, 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 c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)));
} }
pub inline fn renderGeometry(renderer: *Renderer, texture: ?*Texture, vertices: *const Vertex, num_vertices: c_int, indices: [*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 c.SDL_RenderGeometry(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices); return @bitCast(c.SDL_RenderGeometry(renderer, 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 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(renderer, 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 {
@ -1002,7 +1002,7 @@ pub const Renderer = opaque {
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return c.SDL_RenderPresent(renderer); return @bitCast(c.SDL_RenderPresent(renderer));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
@ -1010,7 +1010,7 @@ pub const Renderer = opaque {
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return c.SDL_FlushRenderer(renderer); return @bitCast(c.SDL_FlushRenderer(renderer));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
@ -1022,19 +1022,19 @@ pub const Renderer = opaque {
} }
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 c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore); return @bitCast(c.SDL_AddVulkanRenderSemaphores(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 c.SDL_SetRenderVSync(renderer, vsync); return @bitCast(c.SDL_SetRenderVSync(renderer, vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return c.SDL_GetRenderVSync(renderer, @ptrCast(vsync)); return @bitCast(c.SDL_GetRenderVSync(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 c.SDL_RenderDebugText(renderer, x, y, str); return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str));
} }
}; };
@ -1048,75 +1048,75 @@ pub const Texture = opaque {
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetTextureSize(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 c.SDL_SetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorMod(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 c.SDL_SetTextureColorModFloat(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorModFloat(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 c.SDL_GetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_GetTextureColorMod(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 c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b)); return @bitCast(c.SDL_GetTextureColorModFloat(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 c.SDL_SetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return c.SDL_SetTextureAlphaModFloat(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return c.SDL_GetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)); return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(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 c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch); return @bitCast(c.SDL_UpdateTexture(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 c.SDL_UpdateYUVTexture(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); return @bitCast(c.SDL_UpdateYUVTexture(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 c.SDL_UpdateNVTexture(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch); return @bitCast(c.SDL_UpdateNVTexture(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 c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch)); return @bitCast(c.SDL_LockTexture(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][*c]Surface) bool {
return c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface); return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
@ -1137,7 +1137,7 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
} }
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][*c]Window, renderer: [*c][*c]Renderer) bool {
return 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 {

View File

@ -25,7 +25,7 @@ pub const Sensor = opaque {
} }
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 c.SDL_GetSensorData(sensor, @ptrCast(data), num_values); return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {

View File

@ -45,47 +45,47 @@ 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 c.SDL_CloseStorage(storage); return @bitCast(c.SDL_CloseStorage(storage));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return c.SDL_StorageReady(storage); return @bitCast(c.SDL_StorageReady(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 c.SDL_GetStorageFileSize(storage, path, @ptrCast(length)); return @bitCast(c.SDL_GetStorageFileSize(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 c.SDL_ReadStorageFile(storage, path, destination, length); return @bitCast(c.SDL_ReadStorageFile(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 c.SDL_WriteStorageFile(storage, path, source, length); return @bitCast(c.SDL_WriteStorageFile(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 c.SDL_CreateStorageDirectory(storage, path); return @bitCast(c.SDL_CreateStorageDirectory(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 c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata); return @bitCast(c.SDL_EnumerateStorageDirectory(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 c.SDL_RemoveStoragePath(storage, path); return @bitCast(c.SDL_RemoveStoragePath(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 c.SDL_RenameStoragePath(storage, oldpath, newpath); return @bitCast(c.SDL_RenameStoragePath(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 c.SDL_CopyStorageFile(storage, oldpath, newpath); return @bitCast(c.SDL_CopyStorageFile(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 c.SDL_GetStoragePathInfo(storage, path, info); return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {

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, closeio); return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio));
} }
}; };
@ -104,7 +104,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return c.SDL_SetSurfaceColorspace(surface, colorspace); return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
@ -116,7 +116,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return c.SDL_SetSurfacePalette(surface, palette); return @bitCast(c.SDL_SetSurfacePalette(surface, palette));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
@ -124,11 +124,11 @@ pub const Surface = opaque {
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return c.SDL_AddSurfaceAlternateImage(surface, image); return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return c.SDL_SurfaceHasAlternateImages(surface); return @bitCast(c.SDL_SurfaceHasAlternateImages(surface));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface {
@ -140,7 +140,7 @@ pub const Surface = opaque {
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return c.SDL_LockSurface(surface); return @bitCast(c.SDL_LockSurface(surface));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
@ -148,67 +148,67 @@ pub const Surface = opaque {
} }
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 c.SDL_SaveBMP_IO(surface, dst, closeio); return @bitCast(c.SDL_SaveBMP_IO(surface, 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 c.SDL_SaveBMP(surface, file); return @bitCast(c.SDL_SaveBMP(surface, file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return c.SDL_SetSurfaceRLE(surface, enabled); return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return c.SDL_SurfaceHasRLE(surface); return @bitCast(c.SDL_SurfaceHasRLE(surface));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return c.SDL_SetSurfaceColorKey(surface, enabled, key); return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return c.SDL_SurfaceHasColorKey(surface); return @bitCast(c.SDL_SurfaceHasColorKey(surface));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return c.SDL_GetSurfaceColorKey(surface, @ptrCast(key)); return @bitCast(c.SDL_GetSurfaceColorKey(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 c.SDL_SetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_SetSurfaceColorMod(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 c.SDL_GetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return c.SDL_SetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return c.SDL_GetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool {
return c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)); return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return c.SDL_GetSurfaceClipRect(surface, rect); return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return c.SDL_FlipSurface(surface, @intFromEnum(flip)); return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
@ -228,47 +228,47 @@ pub const Surface = opaque {
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return c.SDL_PremultiplySurfaceAlpha(surface, linear); return @bitCast(c.SDL_PremultiplySurfaceAlpha(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 c.SDL_ClearSurface(surface, r, g, b, a); return @bitCast(c.SDL_ClearSurface(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 c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color); return @bitCast(c.SDL_FillSurfaceRect(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 c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color); return @bitCast(c.SDL_FillSurfaceRects(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 c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), 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 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(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), 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 {
@ -280,19 +280,19 @@ pub const Surface = opaque {
} }
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 c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_ReadSurfacePixel(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 c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_ReadSurfacePixelFloat(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 c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixel(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 c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a));
} }
}; };
@ -309,13 +309,13 @@ pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
} }
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 {
return c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch); return @bitCast(c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch));
} }
pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool { pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool {
return c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch); return @bitCast(c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch));
} }
pub inline fn premultiplyAlpha(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, linear: bool) bool { pub inline fn premultiplyAlpha(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, linear: bool) bool {
return c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, linear); return @bitCast(c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, @bitCast(linear)));
} }

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 c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam); return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam));
} }
}; };
@ -22,7 +22,7 @@ pub inline fn getDirect3D9AdapterIndex(displayID: DisplayID) c_int {
} }
pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool { pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool {
return c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)); return @bitCast(c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)));
} }
pub const X11EventHook = c.SDL_X11EventHook; pub const X11EventHook = c.SDL_X11EventHook;
@ -32,17 +32,17 @@ pub inline fn setX11EventHook(callback: X11EventHook, userdata: ?*anyopaque) voi
} }
pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool { pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool {
return c.SDL_SetLinuxThreadPriority(threadID, priority); return @bitCast(c.SDL_SetLinuxThreadPriority(threadID, priority));
} }
pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool { pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool {
return c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy); return @bitCast(c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy));
} }
pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback; pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback;
pub inline fn setiOSEventPump(enabled: bool) void { pub inline fn setiOSEventPump(enabled: bool) void {
return c.SDL_SetiOSEventPump(enabled); return c.SDL_SetiOSEventPump(@bitCast(enabled));
} }
pub inline fn getAndroidJNIEnv() ?*anyopaque { pub inline fn getAndroidJNIEnv() ?*anyopaque {
@ -58,11 +58,11 @@ pub inline fn getAndroidSDKVersion() c_int {
} }
pub inline fn isChromebook() bool { pub inline fn isChromebook() bool {
return c.SDL_IsChromebook(); return @bitCast(c.SDL_IsChromebook());
} }
pub inline fn isDeXMode() bool { pub inline fn isDeXMode() bool {
return c.SDL_IsDeXMode(); return @bitCast(c.SDL_IsDeXMode());
} }
pub inline fn sendAndroidBackButton() void { pub inline fn sendAndroidBackButton() void {
@ -88,23 +88,23 @@ pub inline fn getAndroidCachePath() [*c]const u8 {
pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback; pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback;
pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool { pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool {
return c.SDL_RequestAndroidPermission(permission, cb, userdata); return @bitCast(c.SDL_RequestAndroidPermission(permission, cb, userdata));
} }
pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool { pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool {
return c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset); return @bitCast(c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset));
} }
pub inline fn sendAndroidMessage(command: u32, param: c_int) bool { pub inline fn sendAndroidMessage(command: u32, param: c_int) bool {
return c.SDL_SendAndroidMessage(command, param); return @bitCast(c.SDL_SendAndroidMessage(command, param));
} }
pub inline fn isTablet() bool { pub inline fn isTablet() bool {
return c.SDL_IsTablet(); return @bitCast(c.SDL_IsTablet());
} }
pub inline fn isTV() bool { pub inline fn isTV() bool {
return c.SDL_IsTV(); return @bitCast(c.SDL_IsTV());
} }
pub const Sandbox = enum(c_int) { pub const Sandbox = enum(c_int) {
@ -151,9 +151,9 @@ pub const XTaskQueueHandle = *anyopaque;
pub const XUserHandle = *anyopaque; pub const XUserHandle = *anyopaque;
pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool { pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool {
return c.SDL_GetGDKTaskQueue(outTaskQueue); return @bitCast(c.SDL_GetGDKTaskQueue(outTaskQueue));
} }
pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool { pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool {
return c.SDL_GetGDKDefaultUser(outUserHandle); return @bitCast(c.SDL_GetGDKDefaultUser(outUserHandle));
} }

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 c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return c.SDL_GetCurrentTime(ticks); return @bitCast(c.SDL_GetCurrentTime(ticks));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return c.SDL_TimeToDateTime(ticks, dt, localTime); return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool {
return c.SDL_DateTimeToTime(@ptrCast(dt), ticks); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), 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

@ -44,5 +44,5 @@ pub inline fn addTimerNS(interval: u64, callback: NSTimerCallback, userdata: ?*a
} }
pub inline fn removeTimer(id: TimerID) bool { pub inline fn removeTimer(id: TimerID) bool {
return c.SDL_RemoveTimer(id); return @bitCast(c.SDL_RemoveTimer(id));
} }

View File

@ -77,7 +77,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool {
return c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)); return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode {
@ -113,7 +113,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return c.SDL_SetWindowTitle(window, title); return @bitCast(c.SDL_SetWindowTitle(window, title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
@ -121,107 +121,107 @@ pub const Window = opaque {
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return c.SDL_SetWindowIcon(window, icon); return @bitCast(c.SDL_SetWindowIcon(window, 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 c.SDL_SetWindowPosition(window, x, y); return @bitCast(c.SDL_SetWindowPosition(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 c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_GetWindowPosition(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 c.SDL_SetWindowSize(window, w, h); return @bitCast(c.SDL_SetWindowSize(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 c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return c.SDL_GetWindowSafeArea(window, rect); return @bitCast(c.SDL_GetWindowSafeArea(window, 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 c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect); return @bitCast(c.SDL_SetWindowAspectRatio(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 c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect)); return @bitCast(c.SDL_GetWindowAspectRatio(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 c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)); return @bitCast(c.SDL_GetWindowBordersSize(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 c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSizeInPixels(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 c.SDL_SetWindowMinimumSize(window, min_w, min_h); return @bitCast(c.SDL_SetWindowMinimumSize(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 c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMinimumSize(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 c.SDL_SetWindowMaximumSize(window, max_w, max_h); return @bitCast(c.SDL_SetWindowMaximumSize(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 c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return c.SDL_SetWindowBordered(window, bordered); return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return c.SDL_SetWindowResizable(window, resizable); return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return c.SDL_SetWindowAlwaysOnTop(window, on_top); return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return c.SDL_ShowWindow(window); return @bitCast(c.SDL_ShowWindow(window));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return c.SDL_HideWindow(window); return @bitCast(c.SDL_HideWindow(window));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return c.SDL_RaiseWindow(window); return @bitCast(c.SDL_RaiseWindow(window));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return c.SDL_MaximizeWindow(window); return @bitCast(c.SDL_MaximizeWindow(window));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return c.SDL_MinimizeWindow(window); return @bitCast(c.SDL_MinimizeWindow(window));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return c.SDL_RestoreWindow(window); return @bitCast(c.SDL_RestoreWindow(window));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return c.SDL_SetWindowFullscreen(window, fullscreen); return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return c.SDL_SyncWindow(window); return @bitCast(c.SDL_SyncWindow(window));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return c.SDL_WindowHasSurface(window); return @bitCast(c.SDL_WindowHasSurface(window));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
@ -229,43 +229,43 @@ pub const Window = opaque {
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return c.SDL_SetWindowSurfaceVSync(window, vsync); return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)); return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return c.SDL_UpdateWindowSurface(window); return @bitCast(c.SDL_UpdateWindowSurface(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 c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects); return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return c.SDL_DestroyWindowSurface(window); return @bitCast(c.SDL_DestroyWindowSurface(window));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowKeyboardGrab(window, grabbed); return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowMouseGrab(window, grabbed); return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return c.SDL_GetWindowKeyboardGrab(window); return @bitCast(c.SDL_GetWindowKeyboardGrab(window));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return c.SDL_GetWindowMouseGrab(window); return @bitCast(c.SDL_GetWindowMouseGrab(window));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool {
return c.SDL_SetWindowMouseRect(window, @ptrCast(rect)); return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) *const Rect {
@ -273,7 +273,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return c.SDL_SetWindowOpacity(window, opacity); return @bitCast(c.SDL_SetWindowOpacity(window, opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
@ -281,31 +281,31 @@ pub const Window = opaque {
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return c.SDL_SetWindowParent(window, parent); return @bitCast(c.SDL_SetWindowParent(window, parent));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return c.SDL_SetWindowModal(window, modal); return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return c.SDL_SetWindowFocusable(window, focusable); return @bitCast(c.SDL_SetWindowFocusable(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 c.SDL_ShowWindowSystemMenu(window, x, y); return @bitCast(c.SDL_ShowWindowSystemMenu(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 c.SDL_SetWindowHitTest(window, callback, callback_data); return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return c.SDL_SetWindowShape(window, shape); return @bitCast(c.SDL_SetWindowShape(window, shape));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return c.SDL_FlashWindow(window, @intFromEnum(operation)); return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
@ -317,7 +317,7 @@ pub const Window = opaque {
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return c.SDL_GL_MakeCurrent(window, context); return @bitCast(c.SDL_GL_MakeCurrent(window, context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
@ -325,7 +325,7 @@ pub const Window = opaque {
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return c.SDL_GL_SwapWindow(window); return @bitCast(c.SDL_GL_SwapWindow(window));
} }
}; };
@ -453,11 +453,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 c.SDL_GetDisplayBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayBounds(displayID, rect));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return c.SDL_GetDisplayUsableBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -477,7 +477,7 @@ pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c
} }
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 c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, include_high_density_modes, @intFromEnum(closest)); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(closest)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode {
@ -532,19 +532,19 @@ pub const HitTestResult = enum(c_int) {
pub const HitTest = c.SDL_HitTest; pub const HitTest = c.SDL_HitTest;
pub inline fn screenSaverEnabled() bool { pub inline fn screenSaverEnabled() bool {
return c.SDL_ScreenSaverEnabled(); return @bitCast(c.SDL_ScreenSaverEnabled());
} }
pub inline fn enableScreenSaver() bool { pub inline fn enableScreenSaver() bool {
return c.SDL_EnableScreenSaver(); return @bitCast(c.SDL_EnableScreenSaver());
} }
pub inline fn disableScreenSaver() bool { pub inline fn disableScreenSaver() bool {
return c.SDL_DisableScreenSaver(); return @bitCast(c.SDL_DisableScreenSaver());
} }
pub inline fn gl_LoadLibrary(path: [*c]const u8) bool { pub inline fn gl_LoadLibrary(path: [*c]const u8) bool {
return c.SDL_GL_LoadLibrary(path); return @bitCast(c.SDL_GL_LoadLibrary(path));
} }
pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer { pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer {
@ -560,7 +560,7 @@ pub inline fn gl_UnloadLibrary() void {
} }
pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool { pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool {
return c.SDL_GL_ExtensionSupported(extension); return @bitCast(c.SDL_GL_ExtensionSupported(extension));
} }
pub inline fn gl_ResetAttributes() void { pub inline fn gl_ResetAttributes() void {
@ -568,11 +568,11 @@ pub inline fn gl_ResetAttributes() void {
} }
pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool { pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool {
return c.SDL_GL_SetAttribute(attr, value); return @bitCast(c.SDL_GL_SetAttribute(attr, value));
} }
pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool { pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
return c.SDL_GL_GetAttribute(attr, @ptrCast(value)); return @bitCast(c.SDL_GL_GetAttribute(attr, @ptrCast(value)));
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
@ -596,13 +596,13 @@ pub inline fn egl_SetAttributeCallbacks(platformAttribCallback: EGLAttribArrayCa
} }
pub inline fn gl_SetSwapInterval(interval: c_int) bool { pub inline fn gl_SetSwapInterval(interval: c_int) bool {
return c.SDL_GL_SetSwapInterval(interval); return @bitCast(c.SDL_GL_SetSwapInterval(interval));
} }
pub inline fn gl_GetSwapInterval(interval: *c_int) bool { pub inline fn gl_GetSwapInterval(interval: *c_int) bool {
return c.SDL_GL_GetSwapInterval(@ptrCast(interval)); return @bitCast(c.SDL_GL_GetSwapInterval(@ptrCast(interval)));
} }
pub inline fn gl_DestroyContext(context: GLContext) bool { pub inline fn gl_DestroyContext(context: GLContext) bool {
return c.SDL_GL_DestroyContext(context); return @bitCast(c.SDL_GL_DestroyContext(context));
} }

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 c.SDL_LoadWAV_IO(iostream, closeio, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -43,11 +43,11 @@ pub const AudioStream = opaque {
} }
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 c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec); return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, 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 c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)); return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
@ -55,7 +55,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
@ -63,7 +63,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return c.SDL_SetAudioStreamGain(audiostream, gain); return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
@ -75,15 +75,15 @@ pub const AudioStream = opaque {
} }
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 c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(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 c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(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 c.SDL_PutAudioStreamData(audiostream, buf, len); return @bitCast(c.SDL_PutAudioStreamData(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 {
@ -99,39 +99,39 @@ pub const AudioStream = opaque {
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return c.SDL_FlushAudioStream(audiostream); return @bitCast(c.SDL_FlushAudioStream(audiostream));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return c.SDL_ClearAudioStream(audiostream); return @bitCast(c.SDL_ClearAudioStream(audiostream));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_PauseAudioStreamDevice(audiostream); return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_ResumeAudioStreamDevice(audiostream); return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream));
} }
pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool { pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool {
return c.SDL_AudioStreamDevicePaused(audiostream); return @bitCast(c.SDL_AudioStreamDevicePaused(audiostream));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_LockAudioStream(audiostream); return @bitCast(c.SDL_LockAudioStream(audiostream));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_UnlockAudioStream(audiostream); return @bitCast(c.SDL_UnlockAudioStream(audiostream));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamGetCallback(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 c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
@ -164,7 +164,7 @@ 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 c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames)); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, 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 {
@ -176,23 +176,23 @@ pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) Audi
} }
pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePhysical(devid); return @bitCast(c.SDL_IsAudioDevicePhysical(devid));
} }
pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePlayback(devid); return @bitCast(c.SDL_IsAudioDevicePlayback(devid));
} }
pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool { pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_PauseAudioDevice(dev); return @bitCast(c.SDL_PauseAudioDevice(dev));
} }
pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool { pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_ResumeAudioDevice(dev); return @bitCast(c.SDL_ResumeAudioDevice(dev));
} }
pub inline fn audioDevicePaused(dev: AudioDeviceID) bool { pub inline fn audioDevicePaused(dev: AudioDeviceID) bool {
return c.SDL_AudioDevicePaused(dev); return @bitCast(c.SDL_AudioDevicePaused(dev));
} }
pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 { pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
@ -200,7 +200,7 @@ pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
} }
pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool { pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool {
return c.SDL_SetAudioDeviceGain(devid, gain); return @bitCast(c.SDL_SetAudioDeviceGain(devid, gain));
} }
pub inline fn closeAudioDevice(devid: AudioDeviceID) void { pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
@ -208,11 +208,11 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
} }
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 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 c.SDL_BindAudioStream(devid, stream); return @bitCast(c.SDL_BindAudioStream(devid, 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 {
@ -232,19 +232,19 @@ pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioPostmixCallback(devid, callback, userdata); return @bitCast(c.SDL_SetAudioPostmixCallback(devid, callback, userdata));
} }
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 c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV(path, 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 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 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)));
} }
pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 { pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 {

View File

@ -63,7 +63,7 @@ pub const Camera = opaque {
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return c.SDL_GetCameraFormat(camera, spec); return @bitCast(c.SDL_GetCameraFormat(camera, spec));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn setClipboardText(text: [*c]const u8) bool { pub inline fn setClipboardText(text: [*c]const u8) bool {
return c.SDL_SetClipboardText(text); return @bitCast(c.SDL_SetClipboardText(text));
} }
pub inline fn getClipboardText() [*c]u8 { pub inline fn getClipboardText() [*c]u8 {
@ -10,11 +10,11 @@ pub inline fn getClipboardText() [*c]u8 {
} }
pub inline fn hasClipboardText() bool { pub inline fn hasClipboardText() bool {
return c.SDL_HasClipboardText(); return @bitCast(c.SDL_HasClipboardText());
} }
pub inline fn setPrimarySelectionText(text: [*c]const u8) bool { pub inline fn setPrimarySelectionText(text: [*c]const u8) bool {
return c.SDL_SetPrimarySelectionText(text); return @bitCast(c.SDL_SetPrimarySelectionText(text));
} }
pub inline fn getPrimarySelectionText() [*c]u8 { pub inline fn getPrimarySelectionText() [*c]u8 {
@ -22,7 +22,7 @@ pub inline fn getPrimarySelectionText() [*c]u8 {
} }
pub inline fn hasPrimarySelectionText() bool { pub inline fn hasPrimarySelectionText() bool {
return c.SDL_HasPrimarySelectionText(); return @bitCast(c.SDL_HasPrimarySelectionText());
} }
pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback; pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
@ -30,11 +30,11 @@ pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback; pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback;
pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool { pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool {
return c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types); return @bitCast(c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types));
} }
pub inline fn clearClipboardData() bool { pub inline fn clearClipboardData() bool {
return c.SDL_ClearClipboardData(); return @bitCast(c.SDL_ClearClipboardData());
} }
pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque { pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque {
@ -42,7 +42,7 @@ pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaqu
} }
pub inline fn hasClipboardData(mime_type: [*c]const u8) bool { pub inline fn hasClipboardData(mime_type: [*c]const u8) bool {
return c.SDL_HasClipboardData(mime_type); return @bitCast(c.SDL_HasClipboardData(mime_type));
} }
pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 { pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 {

View File

@ -13,7 +13,7 @@ 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, allow_many); return c.SDL_ShowOpenFileDialog(callback, userdata, 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 {
@ -21,7 +21,7 @@ pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyop
} }
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, allow_many); return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn outOfMemory() bool { pub inline fn outOfMemory() bool {
return c.SDL_OutOfMemory(); return @bitCast(c.SDL_OutOfMemory());
} }
pub inline fn getError() [*c]const u8 { pub inline fn getError() [*c]const u8 {
@ -10,5 +10,5 @@ pub inline fn getError() [*c]const u8 {
} }
pub inline fn clearError() bool { pub inline fn clearError() bool {
return c.SDL_ClearError(); return @bitCast(c.SDL_ClearError());
} }

View File

@ -698,11 +698,11 @@ pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction,
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
return c.SDL_HasEvent(_type); return @bitCast(c.SDL_HasEvent(_type));
} }
pub inline fn hasEvents(minType: u32, maxType: u32) bool { pub inline fn hasEvents(minType: u32, maxType: u32) bool {
return c.SDL_HasEvents(minType, maxType); return @bitCast(c.SDL_HasEvents(minType, maxType));
} }
pub inline fn flushEvent(_type: u32) void { pub inline fn flushEvent(_type: u32) void {
@ -714,19 +714,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 c.SDL_PollEvent(event); return @bitCast(c.SDL_PollEvent(event));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return c.SDL_WaitEvent(event); return @bitCast(c.SDL_WaitEvent(event));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return c.SDL_WaitEventTimeout(event, timeoutMS); return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return c.SDL_PushEvent(event); return @bitCast(c.SDL_PushEvent(event));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,11 +736,11 @@ 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 c.SDL_GetEventFilter(filter, userdata); return @bitCast(c.SDL_GetEventFilter(filter, userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
return c.SDL_AddEventWatch(filter, userdata); return @bitCast(c.SDL_AddEventWatch(filter, userdata));
} }
pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void { pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void {
@ -752,11 +752,11 @@ pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn setEventEnabled(_type: u32, enabled: bool) void { pub inline fn setEventEnabled(_type: u32, enabled: bool) void {
return c.SDL_SetEventEnabled(_type, enabled); return c.SDL_SetEventEnabled(_type, @bitCast(enabled));
} }
pub inline fn eventEnabled(_type: u32) bool { pub inline fn eventEnabled(_type: u32) bool {
return c.SDL_EventEnabled(_type); return @bitCast(c.SDL_EventEnabled(_type));
} }
pub inline fn registerEvents(numevents: c_int) u32 { pub inline fn registerEvents(numevents: c_int) u32 {

View File

@ -52,7 +52,7 @@ pub const GlobFlags = packed struct(u32) {
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
return c.SDL_CreateDirectory(path); return @bitCast(c.SDL_CreateDirectory(path));
} }
pub const EnumerationResult = enum(c_int) { pub const EnumerationResult = enum(c_int) {
@ -64,23 +64,23 @@ pub const EnumerationResult = enum(c_int) {
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateDirectory(path, callback, userdata); return @bitCast(c.SDL_EnumerateDirectory(path, callback, userdata));
} }
pub inline fn removePath(path: [*c]const u8) bool { pub inline fn removePath(path: [*c]const u8) bool {
return c.SDL_RemovePath(path); return @bitCast(c.SDL_RemovePath(path));
} }
pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_RenamePath(oldpath, newpath); return @bitCast(c.SDL_RenamePath(oldpath, newpath));
} }
pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_CopyFile(oldpath, newpath); return @bitCast(c.SDL_CopyFile(oldpath, newpath));
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return c.SDL_GetPathInfo(path, info); return @bitCast(c.SDL_GetPathInfo(path, 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, closeio); return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio));
} }
}; };
@ -77,7 +77,7 @@ pub const Gamepad = opaque {
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return c.SDL_SetGamepadPlayerIndex(gamepad, player_index); return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
@ -113,7 +113,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return c.SDL_GamepadConnected(gamepad); return @bitCast(c.SDL_GamepadConnected(gamepad));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
@ -125,7 +125,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return c.SDL_GamepadHasAxis(gamepad, axis); return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
@ -133,11 +133,11 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GamepadHasButton(gamepad, button); return @bitCast(c.SDL_GamepadHasButton(gamepad, button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GetGamepadButton(gamepad, button); return @bitCast(c.SDL_GetGamepadButton(gamepad, button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
@ -153,19 +153,19 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)); return @bitCast(c.SDL_GetGamepadTouchpadFinger(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 c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadHasSensor(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 c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), enabled); return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
@ -173,23 +173,23 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values); return @bitCast(c.SDL_GetGamepadSensorData(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 c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepad(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 c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepadTriggers(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 c.SDL_SetGamepadLED(gamepad, red, green, blue); return @bitCast(c.SDL_SetGamepadLED(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 c.SDL_SendGamepadEffect(gamepad, data, size); return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
@ -288,7 +288,7 @@ pub inline fn addGamepadMappingsFromFile(file: [*c]const u8) c_int {
} }
pub inline fn reloadGamepadMappings() bool { pub inline fn reloadGamepadMappings() bool {
return c.SDL_ReloadGamepadMappings(); return @bitCast(c.SDL_ReloadGamepadMappings());
} }
pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 { pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 {
@ -300,11 +300,11 @@ pub inline fn getGamepadMappingForGUID(guid: GUID) [*c]u8 {
} }
pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool { pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool {
return c.SDL_SetGamepadMapping(instance_id, mapping); return @bitCast(c.SDL_SetGamepadMapping(instance_id, mapping));
} }
pub inline fn hasGamepad() bool { pub inline fn hasGamepad() bool {
return c.SDL_HasGamepad(); return @bitCast(c.SDL_HasGamepad());
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
@ -312,7 +312,7 @@ pub inline fn getGamepads(count: *c_int) ?*JoystickID {
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
return c.SDL_IsGamepad(instance_id); return @bitCast(c.SDL_IsGamepad(instance_id));
} }
pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 {
@ -368,11 +368,11 @@ pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {
return c.SDL_SetGamepadEventsEnabled(enabled); return c.SDL_SetGamepadEventsEnabled(@bitCast(enabled));
} }
pub inline fn gamepadEventsEnabled() bool { pub inline fn gamepadEventsEnabled() bool {
return c.SDL_GamepadEventsEnabled(); return @bitCast(c.SDL_GamepadEventsEnabled());
} }
pub inline fn updateGamepads() void { pub inline fn updateGamepads() void {

View File

@ -107,7 +107,7 @@ pub const GPUDevice = opaque {
} }
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, cycle); return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
@ -115,15 +115,15 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, 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 c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_ClaimWindowForGPUDevice(gpudevice, window); return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
@ -131,11 +131,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)); return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, 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 c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
@ -143,19 +143,19 @@ pub const GPUDevice = opaque {
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_WaitForGPUSwapchain(gpudevice, window); return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return c.SDL_WaitForGPUIdle(gpudevice); return @bitCast(c.SDL_WaitForGPUIdle(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 c.SDL_WaitForGPUFences(gpudevice, wait_all, fences, num_fences); return @bitCast(c.SDL_WaitForGPUFences(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 c.SDL_QueryGPUFence(gpudevice, fence); return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
@ -163,11 +163,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage)); return @bitCast(c.SDL_GPUTextureSupportsFormat(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 c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
@ -239,15 +239,15 @@ pub const GPUCommandBuffer = opaque {
} }
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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, 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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, 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 c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
@ -255,7 +255,7 @@ pub const GPUCommandBuffer = opaque {
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return c.SDL_CancelGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer));
} }
}; };
@ -365,19 +365,19 @@ pub const GPUComputePass = opaque {
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), cycle); return c.SDL_UploadToGPUTexture(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), cycle); return c.SDL_UploadToGPUBuffer(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, cycle); return c.SDL_CopyGPUTextureToTexture(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, cycle); return c.SDL_CopyGPUBufferToBuffer(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 {
@ -1064,15 +1064,15 @@ pub const GPUStorageTextureReadWriteBinding = extern struct {
}; };
pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool { pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool {
return c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name); return @bitCast(c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name));
} }
pub inline fn gpuSupportsProperties(props: PropertiesID) bool { pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
return c.SDL_GPUSupportsProperties(props); return @bitCast(c.SDL_GPUSupportsProperties(props));
} }
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), debug_mode, name); return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name);
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {

View File

@ -3,7 +3,7 @@ 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 c.SDL_IsJoystickHaptic(joystick); return @bitCast(c.SDL_IsJoystickHaptic(joystick));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
@ -41,7 +41,7 @@ pub const Haptic = opaque {
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool {
return c.SDL_HapticEffectSupported(haptic, @ptrCast(effect)); return @bitCast(c.SDL_HapticEffectSupported(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 {
@ -49,15 +49,15 @@ pub const Haptic = opaque {
} }
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 c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data)); return @bitCast(c.SDL_UpdateHapticEffect(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 c.SDL_RunHapticEffect(haptic, effect, iterations); return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return c.SDL_StopHapticEffect(haptic, effect); return @bitCast(c.SDL_StopHapticEffect(haptic, effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
@ -65,43 +65,43 @@ pub const Haptic = opaque {
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return c.SDL_GetHapticEffectStatus(haptic, effect); return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return c.SDL_SetHapticGain(haptic, gain); return @bitCast(c.SDL_SetHapticGain(haptic, gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return c.SDL_SetHapticAutocenter(haptic, autocenter); return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return c.SDL_PauseHaptic(haptic); return @bitCast(c.SDL_PauseHaptic(haptic));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return c.SDL_ResumeHaptic(haptic); return @bitCast(c.SDL_ResumeHaptic(haptic));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return c.SDL_StopHapticEffects(haptic); return @bitCast(c.SDL_StopHapticEffects(haptic));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return c.SDL_HapticRumbleSupported(haptic); return @bitCast(c.SDL_HapticRumbleSupported(haptic));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return c.SDL_InitHapticRumble(haptic); return @bitCast(c.SDL_InitHapticRumble(haptic));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return c.SDL_PlayHapticRumble(haptic, strength, length); return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return c.SDL_StopHapticRumble(haptic); return @bitCast(c.SDL_StopHapticRumble(haptic));
} }
}; };
@ -222,7 +222,7 @@ pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
return c.SDL_IsMouseHaptic(); return @bitCast(c.SDL_IsMouseHaptic());
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {

View File

@ -8,15 +8,15 @@ pub const HintPriority = enum(c_int) {
}; };
pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool { pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool {
return c.SDL_SetHintWithPriority(name, value, priority); return @bitCast(c.SDL_SetHintWithPriority(name, value, priority));
} }
pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetHint(name, value); return @bitCast(c.SDL_SetHint(name, value));
} }
pub inline fn resetHint(name: [*c]const u8) bool { pub inline fn resetHint(name: [*c]const u8) bool {
return c.SDL_ResetHint(name); return @bitCast(c.SDL_ResetHint(name));
} }
pub inline fn resetHints() void { pub inline fn resetHints() void {
@ -28,13 +28,13 @@ pub inline fn getHint(name: [*c]const u8) [*c]const u8 {
} }
pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool { pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetHintBoolean(name, default_value); return @bitCast(c.SDL_GetHintBoolean(name, @bitCast(default_value)));
} }
pub const HintCallback = c.SDL_HintCallback; pub const HintCallback = c.SDL_HintCallback;
pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool { pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool {
return c.SDL_AddHintCallback(name, callback, userdata); return @bitCast(c.SDL_AddHintCallback(name, callback, userdata));
} }
pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void { pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void {

View File

@ -29,11 +29,11 @@ pub const AppEvent_func = c.SDL_AppEvent_func;
pub const AppQuit_func = c.SDL_AppQuit_func; pub const AppQuit_func = c.SDL_AppQuit_func;
pub inline fn init(flags: InitFlags) bool { pub inline fn init(flags: InitFlags) bool {
return c.SDL_Init(@bitCast(flags)); return @bitCast(c.SDL_Init(@bitCast(flags)));
} }
pub inline fn initSubSystem(flags: InitFlags) bool { pub inline fn initSubSystem(flags: InitFlags) bool {
return c.SDL_InitSubSystem(@bitCast(flags)); return @bitCast(c.SDL_InitSubSystem(@bitCast(flags)));
} }
pub inline fn quitSubSystem(flags: InitFlags) void { pub inline fn quitSubSystem(flags: InitFlags) void {
@ -49,21 +49,21 @@ pub inline fn quit() void {
} }
pub inline fn isMainThread() bool { pub inline fn isMainThread() bool {
return c.SDL_IsMainThread(); return @bitCast(c.SDL_IsMainThread());
} }
pub const MainThreadCallback = c.SDL_MainThreadCallback; pub const MainThreadCallback = c.SDL_MainThreadCallback;
pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool { pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool {
return c.SDL_RunOnMainThread(callback, userdata, wait_complete); return @bitCast(c.SDL_RunOnMainThread(callback, userdata, @bitCast(wait_complete)));
} }
pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool { pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool {
return c.SDL_SetAppMetadata(appname, appversion, appidentifier); return @bitCast(c.SDL_SetAppMetadata(appname, appversion, appidentifier));
} }
pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetAppMetadataProperty(name, value); return @bitCast(c.SDL_SetAppMetadataProperty(name, value));
} }
pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 { pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 {

View File

@ -29,27 +29,27 @@ 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 c.SDL_SetJoystickVirtualAxis(joystick, axis, value); return @bitCast(c.SDL_SetJoystickVirtualAxis(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 c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel); return @bitCast(c.SDL_SetJoystickVirtualBall(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 c.SDL_SetJoystickVirtualButton(joystick, button, down); return @bitCast(c.SDL_SetJoystickVirtualButton(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 c.SDL_SetJoystickVirtualHat(joystick, hat, value); return @bitCast(c.SDL_SetJoystickVirtualHat(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 c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, down, x, y, pressure); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(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 c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values); return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
@ -69,7 +69,7 @@ pub const Joystick = opaque {
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return c.SDL_SetJoystickPlayerIndex(joystick, player_index); return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
@ -101,7 +101,7 @@ pub const Joystick = opaque {
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return c.SDL_JoystickConnected(joystick); return @bitCast(c.SDL_JoystickConnected(joystick));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
@ -129,11 +129,11 @@ pub const Joystick = opaque {
} }
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 c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state)); return @bitCast(c.SDL_GetJoystickAxisInitialState(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 c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy)); return @bitCast(c.SDL_GetJoystickBall(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 {
@ -141,23 +141,23 @@ pub const Joystick = opaque {
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return c.SDL_GetJoystickButton(joystick, button); return @bitCast(c.SDL_GetJoystickButton(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 c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystick(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 c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystickTriggers(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 c.SDL_SetJoystickLED(joystick, red, green, blue); return @bitCast(c.SDL_SetJoystickLED(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 c.SDL_SendJoystickEffect(joystick, data, size); return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
@ -204,7 +204,7 @@ pub inline fn unlockJoysticks() void {
} }
pub inline fn hasJoystick() bool { pub inline fn hasJoystick() bool {
return c.SDL_HasJoystick(); return @bitCast(c.SDL_HasJoystick());
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
@ -297,11 +297,11 @@ pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID
} }
pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool { pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool {
return c.SDL_DetachVirtualJoystick(instance_id); return @bitCast(c.SDL_DetachVirtualJoystick(instance_id));
} }
pub inline fn isJoystickVirtual(instance_id: JoystickID) bool { pub inline fn isJoystickVirtual(instance_id: JoystickID) bool {
return c.SDL_IsJoystickVirtual(instance_id); return @bitCast(c.SDL_IsJoystickVirtual(instance_id));
} }
pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void { pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void {
@ -309,11 +309,11 @@ pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, versi
} }
pub inline fn setJoystickEventsEnabled(enabled: bool) void { pub inline fn setJoystickEventsEnabled(enabled: bool) void {
return c.SDL_SetJoystickEventsEnabled(enabled); return c.SDL_SetJoystickEventsEnabled(@bitCast(enabled));
} }
pub inline fn joystickEventsEnabled() bool { pub inline fn joystickEventsEnabled() bool {
return c.SDL_JoystickEventsEnabled(); return @bitCast(c.SDL_JoystickEventsEnabled());
} }
pub inline fn updateJoysticks() void { pub inline fn updateJoysticks() void {

View File

@ -56,9 +56,9 @@ pub const MessageBoxData = extern struct {
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool {
return 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 c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window));
} }

View File

@ -2,5 +2,5 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn openURL(url: [*c]const u8) bool { pub inline fn openURL(url: [*c]const u8) bool {
return c.SDL_OpenURL(url); return @bitCast(c.SDL_OpenURL(url));
} }

View File

@ -7,11 +7,11 @@ pub const Window = opaque {
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return c.SDL_SetWindowRelativeMouseMode(window, enabled); return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return c.SDL_GetWindowRelativeMouseMode(window); return @bitCast(c.SDL_GetWindowRelativeMouseMode(window));
} }
}; };
@ -25,7 +25,7 @@ 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 c.SDL_SetCursor(cursor); return @bitCast(c.SDL_SetCursor(cursor));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
@ -71,7 +71,7 @@ pub const MouseButtonFlags = packed struct(u32) {
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
return c.SDL_HasMouse(); return @bitCast(c.SDL_HasMouse());
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
@ -99,11 +99,11 @@ pub inline fn getRelativeMouseState(x: *f32, y: *f32) MouseButtonFlags {
} }
pub inline fn warpMouseGlobal(x: f32, y: f32) bool { pub inline fn warpMouseGlobal(x: f32, y: f32) bool {
return c.SDL_WarpMouseGlobal(x, y); return @bitCast(c.SDL_WarpMouseGlobal(x, y));
} }
pub inline fn captureMouse(enabled: bool) bool { pub inline fn captureMouse(enabled: bool) bool {
return c.SDL_CaptureMouse(enabled); return @bitCast(c.SDL_CaptureMouse(@bitCast(enabled)));
} }
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 {
@ -123,13 +123,13 @@ pub inline fn getDefaultCursor() ?*Cursor {
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {
return c.SDL_ShowCursor(); return @bitCast(c.SDL_ShowCursor());
} }
pub inline fn hideCursor() bool { pub inline fn hideCursor() bool {
return c.SDL_HideCursor(); return @bitCast(c.SDL_HideCursor());
} }
pub inline fn cursorVisible() bool { pub inline fn cursorVisible() bool {
return c.SDL_CursorVisible(); return @bitCast(c.SDL_CursorVisible());
} }

View File

@ -198,7 +198,7 @@ pub inline fn getPixelFormatName(format: PixelFormat) [*c]const u8 {
} }
pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool { pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool {
return c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)); return @bitCast(c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)));
} }
pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat { pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat {
@ -214,7 +214,7 @@ pub inline fn createPalette(ncolors: c_int) ?*Palette {
} }
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 c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors); return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {

View File

@ -21,11 +21,11 @@ pub inline fn createProperties() PropertiesID {
} }
pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool { pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool {
return c.SDL_CopyProperties(src, dst); return @bitCast(c.SDL_CopyProperties(src, dst));
} }
pub inline fn lockProperties(props: PropertiesID) bool { pub inline fn lockProperties(props: PropertiesID) bool {
return c.SDL_LockProperties(props); return @bitCast(c.SDL_LockProperties(props));
} }
pub inline fn unlockProperties(props: PropertiesID) void { pub inline fn unlockProperties(props: PropertiesID) void {
@ -35,31 +35,31 @@ pub inline fn unlockProperties(props: PropertiesID) void {
pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback; pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback;
pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool { pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata); return @bitCast(c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata));
} }
pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool { pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool {
return c.SDL_SetPointerProperty(props, name, value); return @bitCast(c.SDL_SetPointerProperty(props, name, value));
} }
pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetStringProperty(props, name, value); return @bitCast(c.SDL_SetStringProperty(props, name, value));
} }
pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool { pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool {
return c.SDL_SetNumberProperty(props, name, value); return @bitCast(c.SDL_SetNumberProperty(props, name, value));
} }
pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool { pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool {
return c.SDL_SetFloatProperty(props, name, value); return @bitCast(c.SDL_SetFloatProperty(props, name, value));
} }
pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool { pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool {
return c.SDL_SetBooleanProperty(props, name, value); return @bitCast(c.SDL_SetBooleanProperty(props, name, @bitCast(value)));
} }
pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_HasProperty(props, name); return @bitCast(c.SDL_HasProperty(props, name));
} }
pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType { pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType {
@ -83,17 +83,17 @@ pub inline fn getFloatProperty(props: PropertiesID, name: [*c]const u8, default_
} }
pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool { pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetBooleanProperty(props, name, default_value); return @bitCast(c.SDL_GetBooleanProperty(props, name, @bitCast(default_value)));
} }
pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_ClearProperty(props, name); return @bitCast(c.SDL_ClearProperty(props, name));
} }
pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback; pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback;
pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateProperties(props, callback, userdata); return @bitCast(c.SDL_EnumerateProperties(props, callback, userdata));
} }
pub inline fn destroyProperties(props: PropertiesID) void { pub inline fn destroyProperties(props: PropertiesID) void {

View File

@ -26,41 +26,41 @@ pub const FRect = extern struct {
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool {
return 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 c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), 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 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 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 c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), 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 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

@ -814,11 +814,11 @@ pub const Renderer = opaque {
} }
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 c.SDL_GetRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetRenderOutputSize(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 c.SDL_GetCurrentRenderOutputSize(renderer, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetCurrentRenderOutputSize(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 {
@ -834,7 +834,7 @@ pub const Renderer = opaque {
} }
pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool { pub inline fn setRenderTarget(renderer: *Renderer, texture: ?*Texture) bool {
return c.SDL_SetRenderTarget(renderer, texture); return @bitCast(c.SDL_SetRenderTarget(renderer, texture));
} }
pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture { pub inline fn getRenderTarget(renderer: *Renderer) ?*Texture {
@ -842,159 +842,159 @@ pub const Renderer = opaque {
} }
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 c.SDL_SetRenderLogicalPresentation(renderer, w, h, mode); return @bitCast(c.SDL_SetRenderLogicalPresentation(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 c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode); return @bitCast(c.SDL_GetRenderLogicalPresentation(renderer, @ptrCast(w), @ptrCast(h), mode));
} }
pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool { pub inline fn getRenderLogicalPresentationRect(renderer: *Renderer, rect: ?*FRect) bool {
return c.SDL_GetRenderLogicalPresentationRect(renderer, rect); return @bitCast(c.SDL_GetRenderLogicalPresentationRect(renderer, 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 c.SDL_RenderCoordinatesFromWindow(renderer, window_x, window_y, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_RenderCoordinatesFromWindow(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 c.SDL_RenderCoordinatesToWindow(renderer, x, y, @ptrCast(window_x), @ptrCast(window_y)); return @bitCast(c.SDL_RenderCoordinatesToWindow(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 c.SDL_ConvertEventToRenderCoordinates(renderer, event); return @bitCast(c.SDL_ConvertEventToRenderCoordinates(renderer, event));
} }
pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderViewport(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderViewport(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderViewport(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderViewport(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderViewport(renderer, rect); return @bitCast(c.SDL_GetRenderViewport(renderer, rect));
} }
pub inline fn renderViewportSet(renderer: *Renderer) bool { pub inline fn renderViewportSet(renderer: *Renderer) bool {
return c.SDL_RenderViewportSet(renderer); return @bitCast(c.SDL_RenderViewportSet(renderer));
} }
pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderSafeArea(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderSafeArea(renderer, rect); return @bitCast(c.SDL_GetRenderSafeArea(renderer, rect));
} }
pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool { pub inline fn setRenderClipRect(renderer: *Renderer, rect: *const Rect) bool {
return c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_SetRenderClipRect(renderer, @ptrCast(rect)));
} }
pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool { pub inline fn getRenderClipRect(renderer: *Renderer, rect: ?*Rect) bool {
return c.SDL_GetRenderClipRect(renderer, rect); return @bitCast(c.SDL_GetRenderClipRect(renderer, rect));
} }
pub inline fn renderClipEnabled(renderer: *Renderer) bool { pub inline fn renderClipEnabled(renderer: *Renderer) bool {
return c.SDL_RenderClipEnabled(renderer); return @bitCast(c.SDL_RenderClipEnabled(renderer));
} }
pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool { pub inline fn setRenderScale(renderer: *Renderer, scaleX: f32, scaleY: f32) bool {
return c.SDL_SetRenderScale(renderer, scaleX, scaleY); return @bitCast(c.SDL_SetRenderScale(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 c.SDL_GetRenderScale(renderer, @ptrCast(scaleX), @ptrCast(scaleY)); return @bitCast(c.SDL_GetRenderScale(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 c.SDL_SetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColor(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 c.SDL_SetRenderDrawColorFloat(renderer, r, g, b, a); return @bitCast(c.SDL_SetRenderDrawColorFloat(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 c.SDL_GetRenderDrawColor(renderer, r, g, b, a); return @bitCast(c.SDL_GetRenderDrawColor(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 c.SDL_GetRenderDrawColorFloat(renderer, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_GetRenderDrawColorFloat(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 c.SDL_SetRenderColorScale(renderer, scale); return @bitCast(c.SDL_SetRenderColorScale(renderer, scale));
} }
pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool { pub inline fn getRenderColorScale(renderer: *Renderer, scale: *f32) bool {
return c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)); return @bitCast(c.SDL_GetRenderColorScale(renderer, @ptrCast(scale)));
} }
pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool { pub inline fn setRenderDrawBlendMode(renderer: *Renderer, blendMode: BlendMode) bool {
return c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool { pub inline fn getRenderDrawBlendMode(renderer: *Renderer, blendMode: ?*BlendMode) bool {
return c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetRenderDrawBlendMode(renderer, @intFromEnum(blendMode)));
} }
pub inline fn renderClear(renderer: *Renderer) bool { pub inline fn renderClear(renderer: *Renderer) bool {
return c.SDL_RenderClear(renderer); return @bitCast(c.SDL_RenderClear(renderer));
} }
pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool { pub inline fn renderPoint(renderer: *Renderer, x: f32, y: f32) bool {
return c.SDL_RenderPoint(renderer, x, y); return @bitCast(c.SDL_RenderPoint(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 c.SDL_RenderPoints(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderPoints(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 c.SDL_RenderLine(renderer, x1, y1, x2, y2); return @bitCast(c.SDL_RenderLine(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 c.SDL_RenderLines(renderer, @ptrCast(points), count); return @bitCast(c.SDL_RenderLines(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 c.SDL_RenderRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderRect(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 c.SDL_RenderRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderRects(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 c.SDL_RenderFillRect(renderer, @ptrCast(rect)); return @bitCast(c.SDL_RenderFillRect(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 c.SDL_RenderFillRects(renderer, @ptrCast(rects), count); return @bitCast(c.SDL_RenderFillRects(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 c.SDL_RenderTexture(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture(renderer, 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 c.SDL_RenderTextureRotated(renderer, texture, @ptrCast(srcrect), @ptrCast(dstrect), angle, @ptrCast(center), @intFromEnum(flip)); return @bitCast(c.SDL_RenderTextureRotated(renderer, 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 c.SDL_RenderTextureAffine(renderer, texture, @ptrCast(srcrect), @ptrCast(origin), @ptrCast(right), @ptrCast(down)); return @bitCast(c.SDL_RenderTextureAffine(renderer, 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 c.SDL_RenderTextureTiled(renderer, texture, @ptrCast(srcrect), scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTextureTiled(renderer, 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 c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)); return @bitCast(c.SDL_RenderTexture9Grid(renderer, texture, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @ptrCast(dstrect)));
} }
pub inline fn renderGeometry(renderer: *Renderer, texture: ?*Texture, vertices: *const Vertex, num_vertices: c_int, indices: [*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 c.SDL_RenderGeometry(renderer, texture, @ptrCast(vertices), num_vertices, indices, num_indices); return @bitCast(c.SDL_RenderGeometry(renderer, 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 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(renderer, 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 {
@ -1002,7 +1002,7 @@ pub const Renderer = opaque {
} }
pub inline fn renderPresent(renderer: *Renderer) bool { pub inline fn renderPresent(renderer: *Renderer) bool {
return c.SDL_RenderPresent(renderer); return @bitCast(c.SDL_RenderPresent(renderer));
} }
pub inline fn destroyRenderer(renderer: *Renderer) void { pub inline fn destroyRenderer(renderer: *Renderer) void {
@ -1010,7 +1010,7 @@ pub const Renderer = opaque {
} }
pub inline fn flushRenderer(renderer: *Renderer) bool { pub inline fn flushRenderer(renderer: *Renderer) bool {
return c.SDL_FlushRenderer(renderer); return @bitCast(c.SDL_FlushRenderer(renderer));
} }
pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque { pub inline fn getRenderMetalLayer(renderer: *Renderer) ?*anyopaque {
@ -1022,19 +1022,19 @@ pub const Renderer = opaque {
} }
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 c.SDL_AddVulkanRenderSemaphores(renderer, wait_stage_mask, wait_semaphore, signal_semaphore); return @bitCast(c.SDL_AddVulkanRenderSemaphores(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 c.SDL_SetRenderVSync(renderer, vsync); return @bitCast(c.SDL_SetRenderVSync(renderer, vsync));
} }
pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool { pub inline fn getRenderVSync(renderer: *Renderer, vsync: *c_int) bool {
return c.SDL_GetRenderVSync(renderer, @ptrCast(vsync)); return @bitCast(c.SDL_GetRenderVSync(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 c.SDL_RenderDebugText(renderer, x, y, str); return @bitCast(c.SDL_RenderDebugText(renderer, x, y, str));
} }
}; };
@ -1048,75 +1048,75 @@ pub const Texture = opaque {
} }
pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool { pub inline fn getTextureSize(texture: *Texture, w: *f32, h: *f32) bool {
return c.SDL_GetTextureSize(texture, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetTextureSize(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 c.SDL_SetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorMod(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 c.SDL_SetTextureColorModFloat(texture, r, g, b); return @bitCast(c.SDL_SetTextureColorModFloat(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 c.SDL_GetTextureColorMod(texture, r, g, b); return @bitCast(c.SDL_GetTextureColorMod(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 c.SDL_GetTextureColorModFloat(texture, @ptrCast(r), @ptrCast(g), @ptrCast(b)); return @bitCast(c.SDL_GetTextureColorModFloat(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 c.SDL_SetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaMod(texture, alpha));
} }
pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool { pub inline fn setTextureAlphaModFloat(texture: *Texture, alpha: f32) bool {
return c.SDL_SetTextureAlphaModFloat(texture, alpha); return @bitCast(c.SDL_SetTextureAlphaModFloat(texture, alpha));
} }
pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool { pub inline fn getTextureAlphaMod(texture: *Texture, alpha: [*c]u8) bool {
return c.SDL_GetTextureAlphaMod(texture, alpha); return @bitCast(c.SDL_GetTextureAlphaMod(texture, alpha));
} }
pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool { pub inline fn getTextureAlphaModFloat(texture: *Texture, alpha: *f32) bool {
return c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)); return @bitCast(c.SDL_GetTextureAlphaModFloat(texture, @ptrCast(alpha)));
} }
pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool { pub inline fn setTextureBlendMode(texture: *Texture, blendMode: BlendMode) bool {
return c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool { pub inline fn getTextureBlendMode(texture: *Texture, blendMode: ?*BlendMode) bool {
return c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetTextureBlendMode(texture, @intFromEnum(blendMode)));
} }
pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool { pub inline fn setTextureScaleMode(texture: *Texture, scaleMode: ScaleMode) bool {
return c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_SetTextureScaleMode(texture, @intFromEnum(scaleMode)));
} }
pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool { pub inline fn getTextureScaleMode(texture: *Texture, scaleMode: ?*ScaleMode) bool {
return c.SDL_GetTextureScaleMode(texture, @intFromEnum(scaleMode)); return @bitCast(c.SDL_GetTextureScaleMode(texture, @intFromEnum(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 c.SDL_UpdateTexture(texture, @ptrCast(rect), pixels, pitch); return @bitCast(c.SDL_UpdateTexture(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 c.SDL_UpdateYUVTexture(texture, @ptrCast(rect), Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); return @bitCast(c.SDL_UpdateYUVTexture(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 c.SDL_UpdateNVTexture(texture, @ptrCast(rect), Yplane, Ypitch, UVplane, UVpitch); return @bitCast(c.SDL_UpdateNVTexture(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 c.SDL_LockTexture(texture, @ptrCast(rect), pixels, @ptrCast(pitch)); return @bitCast(c.SDL_LockTexture(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][*c]Surface) bool {
return c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface); return @bitCast(c.SDL_LockTextureToSurface(texture, @ptrCast(rect), surface));
} }
pub inline fn unlockTexture(texture: *Texture) void { pub inline fn unlockTexture(texture: *Texture) void {
@ -1137,7 +1137,7 @@ pub inline fn getRenderDriver(index: c_int) [*c]const u8 {
} }
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][*c]Window, renderer: [*c][*c]Renderer) bool {
return 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 {

View File

@ -25,7 +25,7 @@ pub const Sensor = opaque {
} }
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 c.SDL_GetSensorData(sensor, @ptrCast(data), num_values); return @bitCast(c.SDL_GetSensorData(sensor, @ptrCast(data), num_values));
} }
pub inline fn closeSensor(sensor: *Sensor) void { pub inline fn closeSensor(sensor: *Sensor) void {

View File

@ -45,47 +45,47 @@ 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 c.SDL_CloseStorage(storage); return @bitCast(c.SDL_CloseStorage(storage));
} }
pub inline fn storageReady(storage: *Storage) bool { pub inline fn storageReady(storage: *Storage) bool {
return c.SDL_StorageReady(storage); return @bitCast(c.SDL_StorageReady(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 c.SDL_GetStorageFileSize(storage, path, @ptrCast(length)); return @bitCast(c.SDL_GetStorageFileSize(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 c.SDL_ReadStorageFile(storage, path, destination, length); return @bitCast(c.SDL_ReadStorageFile(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 c.SDL_WriteStorageFile(storage, path, source, length); return @bitCast(c.SDL_WriteStorageFile(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 c.SDL_CreateStorageDirectory(storage, path); return @bitCast(c.SDL_CreateStorageDirectory(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 c.SDL_EnumerateStorageDirectory(storage, path, callback, userdata); return @bitCast(c.SDL_EnumerateStorageDirectory(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 c.SDL_RemoveStoragePath(storage, path); return @bitCast(c.SDL_RemoveStoragePath(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 c.SDL_RenameStoragePath(storage, oldpath, newpath); return @bitCast(c.SDL_RenameStoragePath(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 c.SDL_CopyStorageFile(storage, oldpath, newpath); return @bitCast(c.SDL_CopyStorageFile(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 c.SDL_GetStoragePathInfo(storage, path, info); return @bitCast(c.SDL_GetStoragePathInfo(storage, path, info));
} }
pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 { pub inline fn getStorageSpaceRemaining(storage: *Storage) u64 {

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, closeio); return c.SDL_LoadBMP_IO(iostream, @bitCast(closeio));
} }
}; };
@ -104,7 +104,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool { pub inline fn setSurfaceColorspace(surface: *Surface, colorspace: Colorspace) bool {
return c.SDL_SetSurfaceColorspace(surface, colorspace); return @bitCast(c.SDL_SetSurfaceColorspace(surface, colorspace));
} }
pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace { pub inline fn getSurfaceColorspace(surface: *Surface) Colorspace {
@ -116,7 +116,7 @@ pub const Surface = opaque {
} }
pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool { pub inline fn setSurfacePalette(surface: *Surface, palette: ?*Palette) bool {
return c.SDL_SetSurfacePalette(surface, palette); return @bitCast(c.SDL_SetSurfacePalette(surface, palette));
} }
pub inline fn getSurfacePalette(surface: *Surface) ?*Palette { pub inline fn getSurfacePalette(surface: *Surface) ?*Palette {
@ -124,11 +124,11 @@ pub const Surface = opaque {
} }
pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool { pub inline fn addSurfaceAlternateImage(surface: *Surface, image: ?*Surface) bool {
return c.SDL_AddSurfaceAlternateImage(surface, image); return @bitCast(c.SDL_AddSurfaceAlternateImage(surface, image));
} }
pub inline fn surfaceHasAlternateImages(surface: *Surface) bool { pub inline fn surfaceHasAlternateImages(surface: *Surface) bool {
return c.SDL_SurfaceHasAlternateImages(surface); return @bitCast(c.SDL_SurfaceHasAlternateImages(surface));
} }
pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface { pub inline fn getSurfaceImages(surface: *Surface, count: *c_int) [*c][*c]Surface {
@ -140,7 +140,7 @@ pub const Surface = opaque {
} }
pub inline fn lockSurface(surface: *Surface) bool { pub inline fn lockSurface(surface: *Surface) bool {
return c.SDL_LockSurface(surface); return @bitCast(c.SDL_LockSurface(surface));
} }
pub inline fn unlockSurface(surface: *Surface) void { pub inline fn unlockSurface(surface: *Surface) void {
@ -148,67 +148,67 @@ pub const Surface = opaque {
} }
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 c.SDL_SaveBMP_IO(surface, dst, closeio); return @bitCast(c.SDL_SaveBMP_IO(surface, 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 c.SDL_SaveBMP(surface, file); return @bitCast(c.SDL_SaveBMP(surface, file));
} }
pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool { pub inline fn setSurfaceRLE(surface: *Surface, enabled: bool) bool {
return c.SDL_SetSurfaceRLE(surface, enabled); return @bitCast(c.SDL_SetSurfaceRLE(surface, @bitCast(enabled)));
} }
pub inline fn surfaceHasRLE(surface: *Surface) bool { pub inline fn surfaceHasRLE(surface: *Surface) bool {
return c.SDL_SurfaceHasRLE(surface); return @bitCast(c.SDL_SurfaceHasRLE(surface));
} }
pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool { pub inline fn setSurfaceColorKey(surface: *Surface, enabled: bool, key: u32) bool {
return c.SDL_SetSurfaceColorKey(surface, enabled, key); return @bitCast(c.SDL_SetSurfaceColorKey(surface, @bitCast(enabled), key));
} }
pub inline fn surfaceHasColorKey(surface: *Surface) bool { pub inline fn surfaceHasColorKey(surface: *Surface) bool {
return c.SDL_SurfaceHasColorKey(surface); return @bitCast(c.SDL_SurfaceHasColorKey(surface));
} }
pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool { pub inline fn getSurfaceColorKey(surface: *Surface, key: *u32) bool {
return c.SDL_GetSurfaceColorKey(surface, @ptrCast(key)); return @bitCast(c.SDL_GetSurfaceColorKey(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 c.SDL_SetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_SetSurfaceColorMod(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 c.SDL_GetSurfaceColorMod(surface, r, g, b); return @bitCast(c.SDL_GetSurfaceColorMod(surface, r, g, b));
} }
pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool { pub inline fn setSurfaceAlphaMod(surface: *Surface, alpha: u8) bool {
return c.SDL_SetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_SetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool { pub inline fn getSurfaceAlphaMod(surface: *Surface, alpha: [*c]u8) bool {
return c.SDL_GetSurfaceAlphaMod(surface, alpha); return @bitCast(c.SDL_GetSurfaceAlphaMod(surface, alpha));
} }
pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool { pub inline fn setSurfaceBlendMode(surface: *Surface, blendMode: BlendMode) bool {
return c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_SetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool { pub inline fn getSurfaceBlendMode(surface: *Surface, blendMode: ?*BlendMode) bool {
return c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)); return @bitCast(c.SDL_GetSurfaceBlendMode(surface, @intFromEnum(blendMode)));
} }
pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool { pub inline fn setSurfaceClipRect(surface: *Surface, rect: *const Rect) bool {
return c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)); return @bitCast(c.SDL_SetSurfaceClipRect(surface, @ptrCast(rect)));
} }
pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool { pub inline fn getSurfaceClipRect(surface: *Surface, rect: ?*Rect) bool {
return c.SDL_GetSurfaceClipRect(surface, rect); return @bitCast(c.SDL_GetSurfaceClipRect(surface, rect));
} }
pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool { pub inline fn flipSurface(surface: *Surface, flip: FlipMode) bool {
return c.SDL_FlipSurface(surface, @intFromEnum(flip)); return @bitCast(c.SDL_FlipSurface(surface, @intFromEnum(flip)));
} }
pub inline fn duplicateSurface(surface: *Surface) ?*Surface { pub inline fn duplicateSurface(surface: *Surface) ?*Surface {
@ -228,47 +228,47 @@ pub const Surface = opaque {
} }
pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool { pub inline fn premultiplySurfaceAlpha(surface: *Surface, linear: bool) bool {
return c.SDL_PremultiplySurfaceAlpha(surface, linear); return @bitCast(c.SDL_PremultiplySurfaceAlpha(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 c.SDL_ClearSurface(surface, r, g, b, a); return @bitCast(c.SDL_ClearSurface(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 c.SDL_FillSurfaceRect(surface, @ptrCast(rect), color); return @bitCast(c.SDL_FillSurfaceRect(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 c.SDL_FillSurfaceRects(surface, @ptrCast(rects), count, color); return @bitCast(c.SDL_FillSurfaceRects(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 c.SDL_BlitSurface(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurface(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceUnchecked(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect), @intFromEnum(scaleMode)); return @bitCast(c.SDL_BlitSurfaceUncheckedScaled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiled(surface, @ptrCast(srcrect), 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 c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), dst, @ptrCast(dstrect)); return @bitCast(c.SDL_BlitSurfaceTiledWithScale(surface, @ptrCast(srcrect), scale, @intFromEnum(scaleMode), 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 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(surface, @ptrCast(srcrect), left_width, right_width, top_height, bottom_height, scale, @intFromEnum(scaleMode), 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 {
@ -280,19 +280,19 @@ pub const Surface = opaque {
} }
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 c.SDL_ReadSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_ReadSurfacePixel(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 c.SDL_ReadSurfacePixelFloat(surface, x, y, @ptrCast(r), @ptrCast(g), @ptrCast(b), @ptrCast(a)); return @bitCast(c.SDL_ReadSurfacePixelFloat(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 c.SDL_WriteSurfacePixel(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixel(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 c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a); return @bitCast(c.SDL_WriteSurfacePixelFloat(surface, x, y, r, g, b, a));
} }
}; };
@ -309,13 +309,13 @@ pub inline fn loadBMP(file: [*c]const u8) ?*Surface {
} }
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 {
return c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch); return @bitCast(c.SDL_ConvertPixels(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch));
} }
pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool { pub inline fn convertPixelsAndColorspace(width: c_int, height: c_int, src_format: PixelFormat, src_colorspace: Colorspace, src_properties: PropertiesID, src: ?*const anyopaque, src_pitch: c_int, dst_format: PixelFormat, dst_colorspace: Colorspace, dst_properties: PropertiesID, dst: ?*anyopaque, dst_pitch: c_int) bool {
return c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch); return @bitCast(c.SDL_ConvertPixelsAndColorspace(width, height, @bitCast(src_format), src_colorspace, src_properties, src, src_pitch, @bitCast(dst_format), dst_colorspace, dst_properties, dst, dst_pitch));
} }
pub inline fn premultiplyAlpha(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, linear: bool) bool { pub inline fn premultiplyAlpha(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, linear: bool) bool {
return c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, linear); return @bitCast(c.SDL_PremultiplyAlpha(width, height, @bitCast(src_format), src, src_pitch, @bitCast(dst_format), dst, dst_pitch, @bitCast(linear)));
} }

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 c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam); return @bitCast(c.SDL_SetiOSAnimationCallback(window, interval, callback, callbackParam));
} }
}; };
@ -22,7 +22,7 @@ pub inline fn getDirect3D9AdapterIndex(displayID: DisplayID) c_int {
} }
pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool { pub inline fn getDXGIOutputInfo(displayID: DisplayID, adapterIndex: *c_int, outputIndex: *c_int) bool {
return c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)); return @bitCast(c.SDL_GetDXGIOutputInfo(displayID, @ptrCast(adapterIndex), @ptrCast(outputIndex)));
} }
pub const X11EventHook = c.SDL_X11EventHook; pub const X11EventHook = c.SDL_X11EventHook;
@ -32,17 +32,17 @@ pub inline fn setX11EventHook(callback: X11EventHook, userdata: ?*anyopaque) voi
} }
pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool { pub inline fn setLinuxThreadPriority(threadID: i64, priority: c_int) bool {
return c.SDL_SetLinuxThreadPriority(threadID, priority); return @bitCast(c.SDL_SetLinuxThreadPriority(threadID, priority));
} }
pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool { pub inline fn setLinuxThreadPriorityAndPolicy(threadID: i64, sdlPriority: c_int, schedPolicy: c_int) bool {
return c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy); return @bitCast(c.SDL_SetLinuxThreadPriorityAndPolicy(threadID, sdlPriority, schedPolicy));
} }
pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback; pub const iOSAnimationCallback = c.SDL_iOSAnimationCallback;
pub inline fn setiOSEventPump(enabled: bool) void { pub inline fn setiOSEventPump(enabled: bool) void {
return c.SDL_SetiOSEventPump(enabled); return c.SDL_SetiOSEventPump(@bitCast(enabled));
} }
pub inline fn getAndroidJNIEnv() ?*anyopaque { pub inline fn getAndroidJNIEnv() ?*anyopaque {
@ -58,11 +58,11 @@ pub inline fn getAndroidSDKVersion() c_int {
} }
pub inline fn isChromebook() bool { pub inline fn isChromebook() bool {
return c.SDL_IsChromebook(); return @bitCast(c.SDL_IsChromebook());
} }
pub inline fn isDeXMode() bool { pub inline fn isDeXMode() bool {
return c.SDL_IsDeXMode(); return @bitCast(c.SDL_IsDeXMode());
} }
pub inline fn sendAndroidBackButton() void { pub inline fn sendAndroidBackButton() void {
@ -88,23 +88,23 @@ pub inline fn getAndroidCachePath() [*c]const u8 {
pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback; pub const RequestAndroidPermissionCallback = c.SDL_RequestAndroidPermissionCallback;
pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool { pub inline fn requestAndroidPermission(permission: [*c]const u8, cb: RequestAndroidPermissionCallback, userdata: ?*anyopaque) bool {
return c.SDL_RequestAndroidPermission(permission, cb, userdata); return @bitCast(c.SDL_RequestAndroidPermission(permission, cb, userdata));
} }
pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool { pub inline fn showAndroidToast(message: [*c]const u8, duration: c_int, gravity: c_int, xoffset: c_int, yoffset: c_int) bool {
return c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset); return @bitCast(c.SDL_ShowAndroidToast(message, duration, gravity, xoffset, yoffset));
} }
pub inline fn sendAndroidMessage(command: u32, param: c_int) bool { pub inline fn sendAndroidMessage(command: u32, param: c_int) bool {
return c.SDL_SendAndroidMessage(command, param); return @bitCast(c.SDL_SendAndroidMessage(command, param));
} }
pub inline fn isTablet() bool { pub inline fn isTablet() bool {
return c.SDL_IsTablet(); return @bitCast(c.SDL_IsTablet());
} }
pub inline fn isTV() bool { pub inline fn isTV() bool {
return c.SDL_IsTV(); return @bitCast(c.SDL_IsTV());
} }
pub const Sandbox = enum(c_int) { pub const Sandbox = enum(c_int) {
@ -151,9 +151,9 @@ pub const XTaskQueueHandle = *anyopaque;
pub const XUserHandle = *anyopaque; pub const XUserHandle = *anyopaque;
pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool { pub inline fn getGDKTaskQueue(outTaskQueue: [*c]XTaskQueueHandle) bool {
return c.SDL_GetGDKTaskQueue(outTaskQueue); return @bitCast(c.SDL_GetGDKTaskQueue(outTaskQueue));
} }
pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool { pub inline fn getGDKDefaultUser(outUserHandle: [*c]XUserHandle) bool {
return c.SDL_GetGDKDefaultUser(outUserHandle); return @bitCast(c.SDL_GetGDKDefaultUser(outUserHandle));
} }

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 c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)); return @bitCast(c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat)));
} }
pub inline fn getCurrentTime(ticks: ?*Time) bool { pub inline fn getCurrentTime(ticks: ?*Time) bool {
return c.SDL_GetCurrentTime(ticks); return @bitCast(c.SDL_GetCurrentTime(ticks));
} }
pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool { pub inline fn timeToDateTime(ticks: Time, dt: ?*DateTime, localTime: bool) bool {
return c.SDL_TimeToDateTime(ticks, dt, localTime); return @bitCast(c.SDL_TimeToDateTime(ticks, dt, @bitCast(localTime)));
} }
pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool { pub inline fn dateTimeToTime(dt: *const DateTime, ticks: ?*Time) bool {
return c.SDL_DateTimeToTime(@ptrCast(dt), ticks); return @bitCast(c.SDL_DateTimeToTime(@ptrCast(dt), 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

@ -44,5 +44,5 @@ pub inline fn addTimerNS(interval: u64, callback: NSTimerCallback, userdata: ?*a
} }
pub inline fn removeTimer(id: TimerID) bool { pub inline fn removeTimer(id: TimerID) bool {
return c.SDL_RemoveTimer(id); return @bitCast(c.SDL_RemoveTimer(id));
} }

View File

@ -77,7 +77,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool {
return c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)); return @bitCast(c.SDL_SetWindowFullscreenMode(window, @ptrCast(mode)));
} }
pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode {
@ -113,7 +113,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool {
return c.SDL_SetWindowTitle(window, title); return @bitCast(c.SDL_SetWindowTitle(window, title));
} }
pub inline fn getWindowTitle(window: *Window) [*c]const u8 { pub inline fn getWindowTitle(window: *Window) [*c]const u8 {
@ -121,107 +121,107 @@ pub const Window = opaque {
} }
pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool {
return c.SDL_SetWindowIcon(window, icon); return @bitCast(c.SDL_SetWindowIcon(window, 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 c.SDL_SetWindowPosition(window, x, y); return @bitCast(c.SDL_SetWindowPosition(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 c.SDL_GetWindowPosition(window, @ptrCast(x), @ptrCast(y)); return @bitCast(c.SDL_GetWindowPosition(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 c.SDL_SetWindowSize(window, w, h); return @bitCast(c.SDL_SetWindowSize(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 c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool {
return c.SDL_GetWindowSafeArea(window, rect); return @bitCast(c.SDL_GetWindowSafeArea(window, 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 c.SDL_SetWindowAspectRatio(window, min_aspect, max_aspect); return @bitCast(c.SDL_SetWindowAspectRatio(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 c.SDL_GetWindowAspectRatio(window, @ptrCast(min_aspect), @ptrCast(max_aspect)); return @bitCast(c.SDL_GetWindowAspectRatio(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 c.SDL_GetWindowBordersSize(window, @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right)); return @bitCast(c.SDL_GetWindowBordersSize(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 c.SDL_GetWindowSizeInPixels(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowSizeInPixels(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 c.SDL_SetWindowMinimumSize(window, min_w, min_h); return @bitCast(c.SDL_SetWindowMinimumSize(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 c.SDL_GetWindowMinimumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMinimumSize(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 c.SDL_SetWindowMaximumSize(window, max_w, max_h); return @bitCast(c.SDL_SetWindowMaximumSize(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 c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)); return @bitCast(c.SDL_GetWindowMaximumSize(window, @ptrCast(w), @ptrCast(h)));
} }
pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { pub inline fn setWindowBordered(window: *Window, bordered: bool) bool {
return c.SDL_SetWindowBordered(window, bordered); return @bitCast(c.SDL_SetWindowBordered(window, @bitCast(bordered)));
} }
pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { pub inline fn setWindowResizable(window: *Window, resizable: bool) bool {
return c.SDL_SetWindowResizable(window, resizable); return @bitCast(c.SDL_SetWindowResizable(window, @bitCast(resizable)));
} }
pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool {
return c.SDL_SetWindowAlwaysOnTop(window, on_top); return @bitCast(c.SDL_SetWindowAlwaysOnTop(window, @bitCast(on_top)));
} }
pub inline fn showWindow(window: *Window) bool { pub inline fn showWindow(window: *Window) bool {
return c.SDL_ShowWindow(window); return @bitCast(c.SDL_ShowWindow(window));
} }
pub inline fn hideWindow(window: *Window) bool { pub inline fn hideWindow(window: *Window) bool {
return c.SDL_HideWindow(window); return @bitCast(c.SDL_HideWindow(window));
} }
pub inline fn raiseWindow(window: *Window) bool { pub inline fn raiseWindow(window: *Window) bool {
return c.SDL_RaiseWindow(window); return @bitCast(c.SDL_RaiseWindow(window));
} }
pub inline fn maximizeWindow(window: *Window) bool { pub inline fn maximizeWindow(window: *Window) bool {
return c.SDL_MaximizeWindow(window); return @bitCast(c.SDL_MaximizeWindow(window));
} }
pub inline fn minimizeWindow(window: *Window) bool { pub inline fn minimizeWindow(window: *Window) bool {
return c.SDL_MinimizeWindow(window); return @bitCast(c.SDL_MinimizeWindow(window));
} }
pub inline fn restoreWindow(window: *Window) bool { pub inline fn restoreWindow(window: *Window) bool {
return c.SDL_RestoreWindow(window); return @bitCast(c.SDL_RestoreWindow(window));
} }
pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool {
return c.SDL_SetWindowFullscreen(window, fullscreen); return @bitCast(c.SDL_SetWindowFullscreen(window, @bitCast(fullscreen)));
} }
pub inline fn syncWindow(window: *Window) bool { pub inline fn syncWindow(window: *Window) bool {
return c.SDL_SyncWindow(window); return @bitCast(c.SDL_SyncWindow(window));
} }
pub inline fn windowHasSurface(window: *Window) bool { pub inline fn windowHasSurface(window: *Window) bool {
return c.SDL_WindowHasSurface(window); return @bitCast(c.SDL_WindowHasSurface(window));
} }
pub inline fn getWindowSurface(window: *Window) ?*Surface { pub inline fn getWindowSurface(window: *Window) ?*Surface {
@ -229,43 +229,43 @@ pub const Window = opaque {
} }
pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool {
return c.SDL_SetWindowSurfaceVSync(window, vsync); return @bitCast(c.SDL_SetWindowSurfaceVSync(window, vsync));
} }
pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool {
return c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)); return @bitCast(c.SDL_GetWindowSurfaceVSync(window, @ptrCast(vsync)));
} }
pub inline fn updateWindowSurface(window: *Window) bool { pub inline fn updateWindowSurface(window: *Window) bool {
return c.SDL_UpdateWindowSurface(window); return @bitCast(c.SDL_UpdateWindowSurface(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 c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects); return @bitCast(c.SDL_UpdateWindowSurfaceRects(window, @ptrCast(rects), numrects));
} }
pub inline fn destroyWindowSurface(window: *Window) bool { pub inline fn destroyWindowSurface(window: *Window) bool {
return c.SDL_DestroyWindowSurface(window); return @bitCast(c.SDL_DestroyWindowSurface(window));
} }
pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowKeyboardGrab(window, grabbed); return @bitCast(c.SDL_SetWindowKeyboardGrab(window, @bitCast(grabbed)));
} }
pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool {
return c.SDL_SetWindowMouseGrab(window, grabbed); return @bitCast(c.SDL_SetWindowMouseGrab(window, @bitCast(grabbed)));
} }
pub inline fn getWindowKeyboardGrab(window: *Window) bool { pub inline fn getWindowKeyboardGrab(window: *Window) bool {
return c.SDL_GetWindowKeyboardGrab(window); return @bitCast(c.SDL_GetWindowKeyboardGrab(window));
} }
pub inline fn getWindowMouseGrab(window: *Window) bool { pub inline fn getWindowMouseGrab(window: *Window) bool {
return c.SDL_GetWindowMouseGrab(window); return @bitCast(c.SDL_GetWindowMouseGrab(window));
} }
pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool {
return c.SDL_SetWindowMouseRect(window, @ptrCast(rect)); return @bitCast(c.SDL_SetWindowMouseRect(window, @ptrCast(rect)));
} }
pub inline fn getWindowMouseRect(window: *Window) *const Rect { pub inline fn getWindowMouseRect(window: *Window) *const Rect {
@ -273,7 +273,7 @@ pub const Window = opaque {
} }
pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool {
return c.SDL_SetWindowOpacity(window, opacity); return @bitCast(c.SDL_SetWindowOpacity(window, opacity));
} }
pub inline fn getWindowOpacity(window: *Window) f32 { pub inline fn getWindowOpacity(window: *Window) f32 {
@ -281,31 +281,31 @@ pub const Window = opaque {
} }
pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool {
return c.SDL_SetWindowParent(window, parent); return @bitCast(c.SDL_SetWindowParent(window, parent));
} }
pub inline fn setWindowModal(window: *Window, modal: bool) bool { pub inline fn setWindowModal(window: *Window, modal: bool) bool {
return c.SDL_SetWindowModal(window, modal); return @bitCast(c.SDL_SetWindowModal(window, @bitCast(modal)));
} }
pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool {
return c.SDL_SetWindowFocusable(window, focusable); return @bitCast(c.SDL_SetWindowFocusable(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 c.SDL_ShowWindowSystemMenu(window, x, y); return @bitCast(c.SDL_ShowWindowSystemMenu(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 c.SDL_SetWindowHitTest(window, callback, callback_data); return @bitCast(c.SDL_SetWindowHitTest(window, callback, callback_data));
} }
pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool {
return c.SDL_SetWindowShape(window, shape); return @bitCast(c.SDL_SetWindowShape(window, shape));
} }
pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool {
return c.SDL_FlashWindow(window, @intFromEnum(operation)); return @bitCast(c.SDL_FlashWindow(window, @intFromEnum(operation)));
} }
pub inline fn destroyWindow(window: *Window) void { pub inline fn destroyWindow(window: *Window) void {
@ -317,7 +317,7 @@ pub const Window = opaque {
} }
pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool {
return c.SDL_GL_MakeCurrent(window, context); return @bitCast(c.SDL_GL_MakeCurrent(window, context));
} }
pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface {
@ -325,7 +325,7 @@ pub const Window = opaque {
} }
pub inline fn gl_SwapWindow(window: *Window) bool { pub inline fn gl_SwapWindow(window: *Window) bool {
return c.SDL_GL_SwapWindow(window); return @bitCast(c.SDL_GL_SwapWindow(window));
} }
}; };
@ -453,11 +453,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 c.SDL_GetDisplayBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayBounds(displayID, rect));
} }
pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool {
return c.SDL_GetDisplayUsableBounds(displayID, rect); return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, rect));
} }
pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation {
@ -477,7 +477,7 @@ pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c
} }
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 c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, include_high_density_modes, @intFromEnum(closest)); return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @intFromEnum(closest)));
} }
pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode {
@ -532,19 +532,19 @@ pub const HitTestResult = enum(c_int) {
pub const HitTest = c.SDL_HitTest; pub const HitTest = c.SDL_HitTest;
pub inline fn screenSaverEnabled() bool { pub inline fn screenSaverEnabled() bool {
return c.SDL_ScreenSaverEnabled(); return @bitCast(c.SDL_ScreenSaverEnabled());
} }
pub inline fn enableScreenSaver() bool { pub inline fn enableScreenSaver() bool {
return c.SDL_EnableScreenSaver(); return @bitCast(c.SDL_EnableScreenSaver());
} }
pub inline fn disableScreenSaver() bool { pub inline fn disableScreenSaver() bool {
return c.SDL_DisableScreenSaver(); return @bitCast(c.SDL_DisableScreenSaver());
} }
pub inline fn gl_LoadLibrary(path: [*c]const u8) bool { pub inline fn gl_LoadLibrary(path: [*c]const u8) bool {
return c.SDL_GL_LoadLibrary(path); return @bitCast(c.SDL_GL_LoadLibrary(path));
} }
pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer { pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer {
@ -560,7 +560,7 @@ pub inline fn gl_UnloadLibrary() void {
} }
pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool { pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool {
return c.SDL_GL_ExtensionSupported(extension); return @bitCast(c.SDL_GL_ExtensionSupported(extension));
} }
pub inline fn gl_ResetAttributes() void { pub inline fn gl_ResetAttributes() void {
@ -568,11 +568,11 @@ pub inline fn gl_ResetAttributes() void {
} }
pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool { pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool {
return c.SDL_GL_SetAttribute(attr, value); return @bitCast(c.SDL_GL_SetAttribute(attr, value));
} }
pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool { pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool {
return c.SDL_GL_GetAttribute(attr, @ptrCast(value)); return @bitCast(c.SDL_GL_GetAttribute(attr, @ptrCast(value)));
} }
pub inline fn gl_GetCurrentWindow() ?*Window { pub inline fn gl_GetCurrentWindow() ?*Window {
@ -596,13 +596,13 @@ pub inline fn egl_SetAttributeCallbacks(platformAttribCallback: EGLAttribArrayCa
} }
pub inline fn gl_SetSwapInterval(interval: c_int) bool { pub inline fn gl_SetSwapInterval(interval: c_int) bool {
return c.SDL_GL_SetSwapInterval(interval); return @bitCast(c.SDL_GL_SetSwapInterval(interval));
} }
pub inline fn gl_GetSwapInterval(interval: *c_int) bool { pub inline fn gl_GetSwapInterval(interval: *c_int) bool {
return c.SDL_GL_GetSwapInterval(@ptrCast(interval)); return @bitCast(c.SDL_GL_GetSwapInterval(@ptrCast(interval)));
} }
pub inline fn gl_DestroyContext(context: GLContext) bool { pub inline fn gl_DestroyContext(context: GLContext) bool {
return c.SDL_GL_DestroyContext(context); return @bitCast(c.SDL_GL_DestroyContext(context));
} }

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 c.SDL_LoadWAV_IO(iostream, closeio, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV_IO(iostream, @bitCast(closeio), spec, audio_buf, @ptrCast(audio_len)));
} }
}; };
@ -43,11 +43,11 @@ pub const AudioStream = opaque {
} }
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 c.SDL_GetAudioStreamFormat(audiostream, src_spec, dst_spec); return @bitCast(c.SDL_GetAudioStreamFormat(audiostream, src_spec, 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 c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)); return @bitCast(c.SDL_SetAudioStreamFormat(audiostream, @ptrCast(src_spec), @ptrCast(dst_spec)));
} }
pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamFrequencyRatio(audiostream: *AudioStream) f32 {
@ -55,7 +55,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool { pub inline fn setAudioStreamFrequencyRatio(audiostream: *AudioStream, ratio: f32) bool {
return c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio); return @bitCast(c.SDL_SetAudioStreamFrequencyRatio(audiostream, ratio));
} }
pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 { pub inline fn getAudioStreamGain(audiostream: *AudioStream) f32 {
@ -63,7 +63,7 @@ pub const AudioStream = opaque {
} }
pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool { pub inline fn setAudioStreamGain(audiostream: *AudioStream, gain: f32) bool {
return c.SDL_SetAudioStreamGain(audiostream, gain); return @bitCast(c.SDL_SetAudioStreamGain(audiostream, gain));
} }
pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int { pub inline fn getAudioStreamInputChannelMap(audiostream: *AudioStream, count: *c_int) *c_int {
@ -75,15 +75,15 @@ pub const AudioStream = opaque {
} }
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 c.SDL_SetAudioStreamInputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamInputChannelMap(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 c.SDL_SetAudioStreamOutputChannelMap(audiostream, chmap, count); return @bitCast(c.SDL_SetAudioStreamOutputChannelMap(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 c.SDL_PutAudioStreamData(audiostream, buf, len); return @bitCast(c.SDL_PutAudioStreamData(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 {
@ -99,39 +99,39 @@ pub const AudioStream = opaque {
} }
pub inline fn flushAudioStream(audiostream: *AudioStream) bool { pub inline fn flushAudioStream(audiostream: *AudioStream) bool {
return c.SDL_FlushAudioStream(audiostream); return @bitCast(c.SDL_FlushAudioStream(audiostream));
} }
pub inline fn clearAudioStream(audiostream: *AudioStream) bool { pub inline fn clearAudioStream(audiostream: *AudioStream) bool {
return c.SDL_ClearAudioStream(audiostream); return @bitCast(c.SDL_ClearAudioStream(audiostream));
} }
pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn pauseAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_PauseAudioStreamDevice(audiostream); return @bitCast(c.SDL_PauseAudioStreamDevice(audiostream));
} }
pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool { pub inline fn resumeAudioStreamDevice(audiostream: *AudioStream) bool {
return c.SDL_ResumeAudioStreamDevice(audiostream); return @bitCast(c.SDL_ResumeAudioStreamDevice(audiostream));
} }
pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool { pub inline fn audioStreamDevicePaused(audiostream: *AudioStream) bool {
return c.SDL_AudioStreamDevicePaused(audiostream); return @bitCast(c.SDL_AudioStreamDevicePaused(audiostream));
} }
pub inline fn lockAudioStream(audiostream: *AudioStream) bool { pub inline fn lockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_LockAudioStream(audiostream); return @bitCast(c.SDL_LockAudioStream(audiostream));
} }
pub inline fn unlockAudioStream(audiostream: *AudioStream) bool { pub inline fn unlockAudioStream(audiostream: *AudioStream) bool {
return c.SDL_UnlockAudioStream(audiostream); return @bitCast(c.SDL_UnlockAudioStream(audiostream));
} }
pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioStreamGetCallback(audiostream: *AudioStream, callback: AudioStreamCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioStreamGetCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamGetCallback(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 c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata); return @bitCast(c.SDL_SetAudioStreamPutCallback(audiostream, callback, userdata));
} }
pub inline fn destroyAudioStream(audiostream: *AudioStream) void { pub inline fn destroyAudioStream(audiostream: *AudioStream) void {
@ -164,7 +164,7 @@ 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 c.SDL_GetAudioDeviceFormat(devid, spec, @ptrCast(sample_frames)); return @bitCast(c.SDL_GetAudioDeviceFormat(devid, 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 {
@ -176,23 +176,23 @@ pub inline fn openAudioDevice(devid: AudioDeviceID, spec: *const AudioSpec) Audi
} }
pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePhysical(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePhysical(devid); return @bitCast(c.SDL_IsAudioDevicePhysical(devid));
} }
pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool { pub inline fn isAudioDevicePlayback(devid: AudioDeviceID) bool {
return c.SDL_IsAudioDevicePlayback(devid); return @bitCast(c.SDL_IsAudioDevicePlayback(devid));
} }
pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool { pub inline fn pauseAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_PauseAudioDevice(dev); return @bitCast(c.SDL_PauseAudioDevice(dev));
} }
pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool { pub inline fn resumeAudioDevice(dev: AudioDeviceID) bool {
return c.SDL_ResumeAudioDevice(dev); return @bitCast(c.SDL_ResumeAudioDevice(dev));
} }
pub inline fn audioDevicePaused(dev: AudioDeviceID) bool { pub inline fn audioDevicePaused(dev: AudioDeviceID) bool {
return c.SDL_AudioDevicePaused(dev); return @bitCast(c.SDL_AudioDevicePaused(dev));
} }
pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 { pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
@ -200,7 +200,7 @@ pub inline fn getAudioDeviceGain(devid: AudioDeviceID) f32 {
} }
pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool { pub inline fn setAudioDeviceGain(devid: AudioDeviceID, gain: f32) bool {
return c.SDL_SetAudioDeviceGain(devid, gain); return @bitCast(c.SDL_SetAudioDeviceGain(devid, gain));
} }
pub inline fn closeAudioDevice(devid: AudioDeviceID) void { pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
@ -208,11 +208,11 @@ pub inline fn closeAudioDevice(devid: AudioDeviceID) void {
} }
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 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 c.SDL_BindAudioStream(devid, stream); return @bitCast(c.SDL_BindAudioStream(devid, 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 {
@ -232,19 +232,19 @@ pub inline fn openAudioDeviceStream(devid: AudioDeviceID, spec: *const AudioSpec
pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback; pub const AudioPostmixCallback = c.SDL_AudioPostmixCallback;
pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool { pub inline fn setAudioPostmixCallback(devid: AudioDeviceID, callback: AudioPostmixCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetAudioPostmixCallback(devid, callback, userdata); return @bitCast(c.SDL_SetAudioPostmixCallback(devid, callback, userdata));
} }
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 c.SDL_LoadWAV(path, spec, audio_buf, @ptrCast(audio_len)); return @bitCast(c.SDL_LoadWAV(path, 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 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 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)));
} }
pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 { pub inline fn getAudioFormatName(format: AudioFormat) [*c]const u8 {

View File

@ -63,7 +63,7 @@ pub const Camera = opaque {
} }
pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool { pub inline fn getCameraFormat(camera: *Camera, spec: ?*CameraSpec) bool {
return c.SDL_GetCameraFormat(camera, spec); return @bitCast(c.SDL_GetCameraFormat(camera, spec));
} }
pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface { pub inline fn acquireCameraFrame(camera: *Camera, timestampNS: *u64) ?*Surface {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn setClipboardText(text: [*c]const u8) bool { pub inline fn setClipboardText(text: [*c]const u8) bool {
return c.SDL_SetClipboardText(text); return @bitCast(c.SDL_SetClipboardText(text));
} }
pub inline fn getClipboardText() [*c]u8 { pub inline fn getClipboardText() [*c]u8 {
@ -10,11 +10,11 @@ pub inline fn getClipboardText() [*c]u8 {
} }
pub inline fn hasClipboardText() bool { pub inline fn hasClipboardText() bool {
return c.SDL_HasClipboardText(); return @bitCast(c.SDL_HasClipboardText());
} }
pub inline fn setPrimarySelectionText(text: [*c]const u8) bool { pub inline fn setPrimarySelectionText(text: [*c]const u8) bool {
return c.SDL_SetPrimarySelectionText(text); return @bitCast(c.SDL_SetPrimarySelectionText(text));
} }
pub inline fn getPrimarySelectionText() [*c]u8 { pub inline fn getPrimarySelectionText() [*c]u8 {
@ -22,7 +22,7 @@ pub inline fn getPrimarySelectionText() [*c]u8 {
} }
pub inline fn hasPrimarySelectionText() bool { pub inline fn hasPrimarySelectionText() bool {
return c.SDL_HasPrimarySelectionText(); return @bitCast(c.SDL_HasPrimarySelectionText());
} }
pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback; pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
@ -30,11 +30,11 @@ pub const ClipboardDataCallback = c.SDL_ClipboardDataCallback;
pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback; pub const ClipboardCleanupCallback = c.SDL_ClipboardCleanupCallback;
pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool { pub inline fn setClipboardData(callback: ClipboardDataCallback, cleanup: ClipboardCleanupCallback, userdata: ?*anyopaque, mime_types: [*c][*c]const u8, num_mime_types: usize) bool {
return c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types); return @bitCast(c.SDL_SetClipboardData(callback, cleanup, userdata, mime_types, num_mime_types));
} }
pub inline fn clearClipboardData() bool { pub inline fn clearClipboardData() bool {
return c.SDL_ClearClipboardData(); return @bitCast(c.SDL_ClearClipboardData());
} }
pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque { pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaque {
@ -42,7 +42,7 @@ pub inline fn getClipboardData(mime_type: [*c]const u8, size: *usize) ?*anyopaqu
} }
pub inline fn hasClipboardData(mime_type: [*c]const u8) bool { pub inline fn hasClipboardData(mime_type: [*c]const u8) bool {
return c.SDL_HasClipboardData(mime_type); return @bitCast(c.SDL_HasClipboardData(mime_type));
} }
pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 { pub inline fn getClipboardMimeTypes(num_mime_types: *usize) [*c][*c]u8 {

View File

@ -13,7 +13,7 @@ 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, allow_many); return c.SDL_ShowOpenFileDialog(callback, userdata, 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 {
@ -21,7 +21,7 @@ pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyop
} }
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, allow_many); return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, @bitCast(allow_many));
} }
pub const FileDialogType = enum(c_int) { pub const FileDialogType = enum(c_int) {

View File

@ -2,7 +2,7 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn outOfMemory() bool { pub inline fn outOfMemory() bool {
return c.SDL_OutOfMemory(); return @bitCast(c.SDL_OutOfMemory());
} }
pub inline fn getError() [*c]const u8 { pub inline fn getError() [*c]const u8 {
@ -10,5 +10,5 @@ pub inline fn getError() [*c]const u8 {
} }
pub inline fn clearError() bool { pub inline fn clearError() bool {
return c.SDL_ClearError(); return @bitCast(c.SDL_ClearError());
} }

View File

@ -698,11 +698,11 @@ pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction,
} }
pub inline fn hasEvent(_type: u32) bool { pub inline fn hasEvent(_type: u32) bool {
return c.SDL_HasEvent(_type); return @bitCast(c.SDL_HasEvent(_type));
} }
pub inline fn hasEvents(minType: u32, maxType: u32) bool { pub inline fn hasEvents(minType: u32, maxType: u32) bool {
return c.SDL_HasEvents(minType, maxType); return @bitCast(c.SDL_HasEvents(minType, maxType));
} }
pub inline fn flushEvent(_type: u32) void { pub inline fn flushEvent(_type: u32) void {
@ -714,19 +714,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 c.SDL_PollEvent(event); return @bitCast(c.SDL_PollEvent(event));
} }
pub inline fn waitEvent(event: ?*Event) bool { pub inline fn waitEvent(event: ?*Event) bool {
return c.SDL_WaitEvent(event); return @bitCast(c.SDL_WaitEvent(event));
} }
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool { pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return c.SDL_WaitEventTimeout(event, timeoutMS); return @bitCast(c.SDL_WaitEventTimeout(event, timeoutMS));
} }
pub inline fn pushEvent(event: ?*Event) bool { pub inline fn pushEvent(event: ?*Event) bool {
return c.SDL_PushEvent(event); return @bitCast(c.SDL_PushEvent(event));
} }
pub const EventFilter = c.SDL_EventFilter; pub const EventFilter = c.SDL_EventFilter;
@ -736,11 +736,11 @@ 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 c.SDL_GetEventFilter(filter, userdata); return @bitCast(c.SDL_GetEventFilter(filter, userdata));
} }
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool { pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
return c.SDL_AddEventWatch(filter, userdata); return @bitCast(c.SDL_AddEventWatch(filter, userdata));
} }
pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void { pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void {
@ -752,11 +752,11 @@ pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void {
} }
pub inline fn setEventEnabled(_type: u32, enabled: bool) void { pub inline fn setEventEnabled(_type: u32, enabled: bool) void {
return c.SDL_SetEventEnabled(_type, enabled); return c.SDL_SetEventEnabled(_type, @bitCast(enabled));
} }
pub inline fn eventEnabled(_type: u32) bool { pub inline fn eventEnabled(_type: u32) bool {
return c.SDL_EventEnabled(_type); return @bitCast(c.SDL_EventEnabled(_type));
} }
pub inline fn registerEvents(numevents: c_int) u32 { pub inline fn registerEvents(numevents: c_int) u32 {

View File

@ -52,7 +52,7 @@ pub const GlobFlags = packed struct(u32) {
}; };
pub inline fn createDirectory(path: [*c]const u8) bool { pub inline fn createDirectory(path: [*c]const u8) bool {
return c.SDL_CreateDirectory(path); return @bitCast(c.SDL_CreateDirectory(path));
} }
pub const EnumerationResult = enum(c_int) { pub const EnumerationResult = enum(c_int) {
@ -64,23 +64,23 @@ pub const EnumerationResult = enum(c_int) {
pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback; pub const EnumerateDirectoryCallback = c.SDL_EnumerateDirectoryCallback;
pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateDirectory(path, callback, userdata); return @bitCast(c.SDL_EnumerateDirectory(path, callback, userdata));
} }
pub inline fn removePath(path: [*c]const u8) bool { pub inline fn removePath(path: [*c]const u8) bool {
return c.SDL_RemovePath(path); return @bitCast(c.SDL_RemovePath(path));
} }
pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_RenamePath(oldpath, newpath); return @bitCast(c.SDL_RenamePath(oldpath, newpath));
} }
pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool { pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
return c.SDL_CopyFile(oldpath, newpath); return @bitCast(c.SDL_CopyFile(oldpath, newpath));
} }
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool { pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
return c.SDL_GetPathInfo(path, info); return @bitCast(c.SDL_GetPathInfo(path, 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, closeio); return c.SDL_AddGamepadMappingsFromIO(iostream, @bitCast(closeio));
} }
}; };
@ -77,7 +77,7 @@ pub const Gamepad = opaque {
} }
pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool { pub inline fn setGamepadPlayerIndex(gamepad: *Gamepad, player_index: c_int) bool {
return c.SDL_SetGamepadPlayerIndex(gamepad, player_index); return @bitCast(c.SDL_SetGamepadPlayerIndex(gamepad, player_index));
} }
pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 { pub inline fn getGamepadVendor(gamepad: *Gamepad) u16 {
@ -113,7 +113,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadConnected(gamepad: *Gamepad) bool { pub inline fn gamepadConnected(gamepad: *Gamepad) bool {
return c.SDL_GamepadConnected(gamepad); return @bitCast(c.SDL_GamepadConnected(gamepad));
} }
pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick { pub inline fn getGamepadJoystick(gamepad: *Gamepad) ?*Joystick {
@ -125,7 +125,7 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool { pub inline fn gamepadHasAxis(gamepad: *Gamepad, axis: GamepadAxis) bool {
return c.SDL_GamepadHasAxis(gamepad, axis); return @bitCast(c.SDL_GamepadHasAxis(gamepad, axis));
} }
pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 { pub inline fn getGamepadAxis(gamepad: *Gamepad, axis: GamepadAxis) i16 {
@ -133,11 +133,11 @@ pub const Gamepad = opaque {
} }
pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn gamepadHasButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GamepadHasButton(gamepad, button); return @bitCast(c.SDL_GamepadHasButton(gamepad, button));
} }
pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool { pub inline fn getGamepadButton(gamepad: *Gamepad, button: GamepadButton) bool {
return c.SDL_GetGamepadButton(gamepad, button); return @bitCast(c.SDL_GetGamepadButton(gamepad, button));
} }
pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabel(gamepad: *Gamepad, button: GamepadButton) GamepadButtonLabel {
@ -153,19 +153,19 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)); return @bitCast(c.SDL_GetGamepadTouchpadFinger(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 c.SDL_GamepadHasSensor(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadHasSensor(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 c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), enabled); return @bitCast(c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), @bitCast(enabled)));
} }
pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool { pub inline fn gamepadSensorEnabled(gamepad: *Gamepad, _type: SensorType) bool {
return c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)); return @bitCast(c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type)));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
@ -173,23 +173,23 @@ pub const Gamepad = opaque {
} }
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 c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(_type), @ptrCast(data), num_values); return @bitCast(c.SDL_GetGamepadSensorData(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 c.SDL_RumbleGamepad(gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepad(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 c.SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleGamepadTriggers(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 c.SDL_SetGamepadLED(gamepad, red, green, blue); return @bitCast(c.SDL_SetGamepadLED(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 c.SDL_SendGamepadEffect(gamepad, data, size); return @bitCast(c.SDL_SendGamepadEffect(gamepad, data, size));
} }
pub inline fn closeGamepad(gamepad: *Gamepad) void { pub inline fn closeGamepad(gamepad: *Gamepad) void {
@ -288,7 +288,7 @@ pub inline fn addGamepadMappingsFromFile(file: [*c]const u8) c_int {
} }
pub inline fn reloadGamepadMappings() bool { pub inline fn reloadGamepadMappings() bool {
return c.SDL_ReloadGamepadMappings(); return @bitCast(c.SDL_ReloadGamepadMappings());
} }
pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 { pub inline fn getGamepadMappings(count: *c_int) [*c][*c]u8 {
@ -300,11 +300,11 @@ pub inline fn getGamepadMappingForGUID(guid: GUID) [*c]u8 {
} }
pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool { pub inline fn setGamepadMapping(instance_id: JoystickID, mapping: [*c]const u8) bool {
return c.SDL_SetGamepadMapping(instance_id, mapping); return @bitCast(c.SDL_SetGamepadMapping(instance_id, mapping));
} }
pub inline fn hasGamepad() bool { pub inline fn hasGamepad() bool {
return c.SDL_HasGamepad(); return @bitCast(c.SDL_HasGamepad());
} }
pub inline fn getGamepads(count: *c_int) ?*JoystickID { pub inline fn getGamepads(count: *c_int) ?*JoystickID {
@ -312,7 +312,7 @@ pub inline fn getGamepads(count: *c_int) ?*JoystickID {
} }
pub inline fn isGamepad(instance_id: JoystickID) bool { pub inline fn isGamepad(instance_id: JoystickID) bool {
return c.SDL_IsGamepad(instance_id); return @bitCast(c.SDL_IsGamepad(instance_id));
} }
pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 { pub inline fn getGamepadNameForID(instance_id: JoystickID) [*c]const u8 {
@ -368,11 +368,11 @@ pub inline fn getGamepadFromPlayerIndex(player_index: c_int) ?*Gamepad {
} }
pub inline fn setGamepadEventsEnabled(enabled: bool) void { pub inline fn setGamepadEventsEnabled(enabled: bool) void {
return c.SDL_SetGamepadEventsEnabled(enabled); return c.SDL_SetGamepadEventsEnabled(@bitCast(enabled));
} }
pub inline fn gamepadEventsEnabled() bool { pub inline fn gamepadEventsEnabled() bool {
return c.SDL_GamepadEventsEnabled(); return @bitCast(c.SDL_GamepadEventsEnabled());
} }
pub inline fn updateGamepads() void { pub inline fn updateGamepads() void {

View File

@ -107,7 +107,7 @@ pub const GPUDevice = opaque {
} }
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, cycle); return c.SDL_MapGPUTransferBuffer(gpudevice, transfer_buffer, @bitCast(cycle));
} }
pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void { pub inline fn unmapGPUTransferBuffer(gpudevice: *GPUDevice, transfer_buffer: ?*GPUTransferBuffer) void {
@ -115,15 +115,15 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, window, swapchain_composition); return @bitCast(c.SDL_WindowSupportsGPUSwapchainComposition(gpudevice, 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 c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)); return @bitCast(c.SDL_WindowSupportsGPUPresentMode(gpudevice, window, @intFromEnum(present_mode)));
} }
pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn claimWindowForGPUDevice(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_ClaimWindowForGPUDevice(gpudevice, window); return @bitCast(c.SDL_ClaimWindowForGPUDevice(gpudevice, window));
} }
pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void { pub inline fn releaseWindowFromGPUDevice(gpudevice: *GPUDevice, window: ?*Window) void {
@ -131,11 +131,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_SetGPUSwapchainParameters(gpudevice, window, swapchain_composition, @intFromEnum(present_mode)); return @bitCast(c.SDL_SetGPUSwapchainParameters(gpudevice, 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 c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight); return @bitCast(c.SDL_SetGPUAllowedFramesInFlight(gpudevice, allowed_frames_in_flight));
} }
pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat { pub inline fn getGPUSwapchainTextureFormat(gpudevice: *GPUDevice, window: ?*Window) GPUTextureFormat {
@ -143,19 +143,19 @@ pub const GPUDevice = opaque {
} }
pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool { pub inline fn waitForGPUSwapchain(gpudevice: *GPUDevice, window: ?*Window) bool {
return c.SDL_WaitForGPUSwapchain(gpudevice, window); return @bitCast(c.SDL_WaitForGPUSwapchain(gpudevice, window));
} }
pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool { pub inline fn waitForGPUIdle(gpudevice: *GPUDevice) bool {
return c.SDL_WaitForGPUIdle(gpudevice); return @bitCast(c.SDL_WaitForGPUIdle(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 c.SDL_WaitForGPUFences(gpudevice, wait_all, fences, num_fences); return @bitCast(c.SDL_WaitForGPUFences(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 c.SDL_QueryGPUFence(gpudevice, fence); return @bitCast(c.SDL_QueryGPUFence(gpudevice, fence));
} }
pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void { pub inline fn releaseGPUFence(gpudevice: *GPUDevice, fence: ?*GPUFence) void {
@ -163,11 +163,11 @@ pub const GPUDevice = opaque {
} }
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 c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(_type), @bitCast(usage)); return @bitCast(c.SDL_GPUTextureSupportsFormat(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 c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count); return @bitCast(c.SDL_GPUTextureSupportsSampleCount(gpudevice, @bitCast(format), sample_count));
} }
pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void { pub inline fn gdkSuspendGPU(gpudevice: *GPUDevice) void {
@ -239,15 +239,15 @@ pub const GPUCommandBuffer = opaque {
} }
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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_AcquireGPUSwapchainTexture(gpucommandbuffer, 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][*c]GPUTexture, swapchain_texture_width: *u32, swapchain_texture_height: *u32) bool {
return c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, window, swapchain_texture, @ptrCast(swapchain_texture_width), @ptrCast(swapchain_texture_height)); return @bitCast(c.SDL_WaitAndAcquireGPUSwapchainTexture(gpucommandbuffer, 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 c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_SubmitGPUCommandBuffer(gpucommandbuffer));
} }
pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence { pub inline fn submitGPUCommandBufferAndAcquireFence(gpucommandbuffer: *GPUCommandBuffer) ?*GPUFence {
@ -255,7 +255,7 @@ pub const GPUCommandBuffer = opaque {
} }
pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool { pub inline fn cancelGPUCommandBuffer(gpucommandbuffer: *GPUCommandBuffer) bool {
return c.SDL_CancelGPUCommandBuffer(gpucommandbuffer); return @bitCast(c.SDL_CancelGPUCommandBuffer(gpucommandbuffer));
} }
}; };
@ -365,19 +365,19 @@ pub const GPUComputePass = opaque {
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), cycle); return c.SDL_UploadToGPUTexture(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), cycle); return c.SDL_UploadToGPUBuffer(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, cycle); return c.SDL_CopyGPUTextureToTexture(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, cycle); return c.SDL_CopyGPUBufferToBuffer(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 {
@ -1064,15 +1064,15 @@ pub const GPUStorageTextureReadWriteBinding = extern struct {
}; };
pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool { pub inline fn gpuSupportsShaderFormats(format_flags: GPUShaderFormat, name: [*c]const u8) bool {
return c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name); return @bitCast(c.SDL_GPUSupportsShaderFormats(@bitCast(format_flags), name));
} }
pub inline fn gpuSupportsProperties(props: PropertiesID) bool { pub inline fn gpuSupportsProperties(props: PropertiesID) bool {
return c.SDL_GPUSupportsProperties(props); return @bitCast(c.SDL_GPUSupportsProperties(props));
} }
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), debug_mode, name); return c.SDL_CreateGPUDevice(@bitCast(format_flags), @bitCast(debug_mode), name);
} }
pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice { pub inline fn createGPUDeviceWithProperties(props: PropertiesID) ?*GPUDevice {

View File

@ -3,7 +3,7 @@ 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 c.SDL_IsJoystickHaptic(joystick); return @bitCast(c.SDL_IsJoystickHaptic(joystick));
} }
pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic { pub inline fn openHapticFromJoystick(joystick: *Joystick) ?*Haptic {
@ -41,7 +41,7 @@ pub const Haptic = opaque {
} }
pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool { pub inline fn hapticEffectSupported(haptic: *Haptic, effect: *const HapticEffect) bool {
return c.SDL_HapticEffectSupported(haptic, @ptrCast(effect)); return @bitCast(c.SDL_HapticEffectSupported(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 {
@ -49,15 +49,15 @@ pub const Haptic = opaque {
} }
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 c.SDL_UpdateHapticEffect(haptic, effect, @ptrCast(data)); return @bitCast(c.SDL_UpdateHapticEffect(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 c.SDL_RunHapticEffect(haptic, effect, iterations); return @bitCast(c.SDL_RunHapticEffect(haptic, effect, iterations));
} }
pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool { pub inline fn stopHapticEffect(haptic: *Haptic, effect: c_int) bool {
return c.SDL_StopHapticEffect(haptic, effect); return @bitCast(c.SDL_StopHapticEffect(haptic, effect));
} }
pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void { pub inline fn destroyHapticEffect(haptic: *Haptic, effect: c_int) void {
@ -65,43 +65,43 @@ pub const Haptic = opaque {
} }
pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool { pub inline fn getHapticEffectStatus(haptic: *Haptic, effect: c_int) bool {
return c.SDL_GetHapticEffectStatus(haptic, effect); return @bitCast(c.SDL_GetHapticEffectStatus(haptic, effect));
} }
pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool { pub inline fn setHapticGain(haptic: *Haptic, gain: c_int) bool {
return c.SDL_SetHapticGain(haptic, gain); return @bitCast(c.SDL_SetHapticGain(haptic, gain));
} }
pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool { pub inline fn setHapticAutocenter(haptic: *Haptic, autocenter: c_int) bool {
return c.SDL_SetHapticAutocenter(haptic, autocenter); return @bitCast(c.SDL_SetHapticAutocenter(haptic, autocenter));
} }
pub inline fn pauseHaptic(haptic: *Haptic) bool { pub inline fn pauseHaptic(haptic: *Haptic) bool {
return c.SDL_PauseHaptic(haptic); return @bitCast(c.SDL_PauseHaptic(haptic));
} }
pub inline fn resumeHaptic(haptic: *Haptic) bool { pub inline fn resumeHaptic(haptic: *Haptic) bool {
return c.SDL_ResumeHaptic(haptic); return @bitCast(c.SDL_ResumeHaptic(haptic));
} }
pub inline fn stopHapticEffects(haptic: *Haptic) bool { pub inline fn stopHapticEffects(haptic: *Haptic) bool {
return c.SDL_StopHapticEffects(haptic); return @bitCast(c.SDL_StopHapticEffects(haptic));
} }
pub inline fn hapticRumbleSupported(haptic: *Haptic) bool { pub inline fn hapticRumbleSupported(haptic: *Haptic) bool {
return c.SDL_HapticRumbleSupported(haptic); return @bitCast(c.SDL_HapticRumbleSupported(haptic));
} }
pub inline fn initHapticRumble(haptic: *Haptic) bool { pub inline fn initHapticRumble(haptic: *Haptic) bool {
return c.SDL_InitHapticRumble(haptic); return @bitCast(c.SDL_InitHapticRumble(haptic));
} }
pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool { pub inline fn playHapticRumble(haptic: *Haptic, strength: f32, length: u32) bool {
return c.SDL_PlayHapticRumble(haptic, strength, length); return @bitCast(c.SDL_PlayHapticRumble(haptic, strength, length));
} }
pub inline fn stopHapticRumble(haptic: *Haptic) bool { pub inline fn stopHapticRumble(haptic: *Haptic) bool {
return c.SDL_StopHapticRumble(haptic); return @bitCast(c.SDL_StopHapticRumble(haptic));
} }
}; };
@ -222,7 +222,7 @@ pub inline fn getHapticFromID(instance_id: HapticID) ?*Haptic {
} }
pub inline fn isMouseHaptic() bool { pub inline fn isMouseHaptic() bool {
return c.SDL_IsMouseHaptic(); return @bitCast(c.SDL_IsMouseHaptic());
} }
pub inline fn openHapticFromMouse() ?*Haptic { pub inline fn openHapticFromMouse() ?*Haptic {

View File

@ -8,15 +8,15 @@ pub const HintPriority = enum(c_int) {
}; };
pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool { pub inline fn setHintWithPriority(name: [*c]const u8, value: [*c]const u8, priority: HintPriority) bool {
return c.SDL_SetHintWithPriority(name, value, priority); return @bitCast(c.SDL_SetHintWithPriority(name, value, priority));
} }
pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setHint(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetHint(name, value); return @bitCast(c.SDL_SetHint(name, value));
} }
pub inline fn resetHint(name: [*c]const u8) bool { pub inline fn resetHint(name: [*c]const u8) bool {
return c.SDL_ResetHint(name); return @bitCast(c.SDL_ResetHint(name));
} }
pub inline fn resetHints() void { pub inline fn resetHints() void {
@ -28,13 +28,13 @@ pub inline fn getHint(name: [*c]const u8) [*c]const u8 {
} }
pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool { pub inline fn getHintBoolean(name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetHintBoolean(name, default_value); return @bitCast(c.SDL_GetHintBoolean(name, @bitCast(default_value)));
} }
pub const HintCallback = c.SDL_HintCallback; pub const HintCallback = c.SDL_HintCallback;
pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool { pub inline fn addHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) bool {
return c.SDL_AddHintCallback(name, callback, userdata); return @bitCast(c.SDL_AddHintCallback(name, callback, userdata));
} }
pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void { pub inline fn removeHintCallback(name: [*c]const u8, callback: HintCallback, userdata: ?*anyopaque) void {

View File

@ -29,11 +29,11 @@ pub const AppEvent_func = c.SDL_AppEvent_func;
pub const AppQuit_func = c.SDL_AppQuit_func; pub const AppQuit_func = c.SDL_AppQuit_func;
pub inline fn init(flags: InitFlags) bool { pub inline fn init(flags: InitFlags) bool {
return c.SDL_Init(@bitCast(flags)); return @bitCast(c.SDL_Init(@bitCast(flags)));
} }
pub inline fn initSubSystem(flags: InitFlags) bool { pub inline fn initSubSystem(flags: InitFlags) bool {
return c.SDL_InitSubSystem(@bitCast(flags)); return @bitCast(c.SDL_InitSubSystem(@bitCast(flags)));
} }
pub inline fn quitSubSystem(flags: InitFlags) void { pub inline fn quitSubSystem(flags: InitFlags) void {
@ -49,21 +49,21 @@ pub inline fn quit() void {
} }
pub inline fn isMainThread() bool { pub inline fn isMainThread() bool {
return c.SDL_IsMainThread(); return @bitCast(c.SDL_IsMainThread());
} }
pub const MainThreadCallback = c.SDL_MainThreadCallback; pub const MainThreadCallback = c.SDL_MainThreadCallback;
pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool { pub inline fn runOnMainThread(callback: MainThreadCallback, userdata: ?*anyopaque, wait_complete: bool) bool {
return c.SDL_RunOnMainThread(callback, userdata, wait_complete); return @bitCast(c.SDL_RunOnMainThread(callback, userdata, @bitCast(wait_complete)));
} }
pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool { pub inline fn setAppMetadata(appname: [*c]const u8, appversion: [*c]const u8, appidentifier: [*c]const u8) bool {
return c.SDL_SetAppMetadata(appname, appversion, appidentifier); return @bitCast(c.SDL_SetAppMetadata(appname, appversion, appidentifier));
} }
pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setAppMetadataProperty(name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetAppMetadataProperty(name, value); return @bitCast(c.SDL_SetAppMetadataProperty(name, value));
} }
pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 { pub inline fn getAppMetadataProperty(name: [*c]const u8) [*c]const u8 {

View File

@ -29,27 +29,27 @@ 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 c.SDL_SetJoystickVirtualAxis(joystick, axis, value); return @bitCast(c.SDL_SetJoystickVirtualAxis(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 c.SDL_SetJoystickVirtualBall(joystick, ball, xrel, yrel); return @bitCast(c.SDL_SetJoystickVirtualBall(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 c.SDL_SetJoystickVirtualButton(joystick, button, down); return @bitCast(c.SDL_SetJoystickVirtualButton(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 c.SDL_SetJoystickVirtualHat(joystick, hat, value); return @bitCast(c.SDL_SetJoystickVirtualHat(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 c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, down, x, y, pressure); return @bitCast(c.SDL_SetJoystickVirtualTouchpad(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 c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values); return @bitCast(c.SDL_SendJoystickVirtualSensorData(joystick, @intFromEnum(_type), sensor_timestamp, @ptrCast(data), num_values));
} }
pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID { pub inline fn getJoystickProperties(joystick: *Joystick) PropertiesID {
@ -69,7 +69,7 @@ pub const Joystick = opaque {
} }
pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool { pub inline fn setJoystickPlayerIndex(joystick: *Joystick, player_index: c_int) bool {
return c.SDL_SetJoystickPlayerIndex(joystick, player_index); return @bitCast(c.SDL_SetJoystickPlayerIndex(joystick, player_index));
} }
pub inline fn getJoystickGUID(joystick: *Joystick) GUID { pub inline fn getJoystickGUID(joystick: *Joystick) GUID {
@ -101,7 +101,7 @@ pub const Joystick = opaque {
} }
pub inline fn joystickConnected(joystick: *Joystick) bool { pub inline fn joystickConnected(joystick: *Joystick) bool {
return c.SDL_JoystickConnected(joystick); return @bitCast(c.SDL_JoystickConnected(joystick));
} }
pub inline fn getJoystickID(joystick: *Joystick) JoystickID { pub inline fn getJoystickID(joystick: *Joystick) JoystickID {
@ -129,11 +129,11 @@ pub const Joystick = opaque {
} }
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 c.SDL_GetJoystickAxisInitialState(joystick, axis, @ptrCast(state)); return @bitCast(c.SDL_GetJoystickAxisInitialState(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 c.SDL_GetJoystickBall(joystick, ball, @ptrCast(dx), @ptrCast(dy)); return @bitCast(c.SDL_GetJoystickBall(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 {
@ -141,23 +141,23 @@ pub const Joystick = opaque {
} }
pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool { pub inline fn getJoystickButton(joystick: *Joystick, button: c_int) bool {
return c.SDL_GetJoystickButton(joystick, button); return @bitCast(c.SDL_GetJoystickButton(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 c.SDL_RumbleJoystick(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystick(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 c.SDL_RumbleJoystickTriggers(joystick, left_rumble, right_rumble, duration_ms); return @bitCast(c.SDL_RumbleJoystickTriggers(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 c.SDL_SetJoystickLED(joystick, red, green, blue); return @bitCast(c.SDL_SetJoystickLED(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 c.SDL_SendJoystickEffect(joystick, data, size); return @bitCast(c.SDL_SendJoystickEffect(joystick, data, size));
} }
pub inline fn closeJoystick(joystick: *Joystick) void { pub inline fn closeJoystick(joystick: *Joystick) void {
@ -204,7 +204,7 @@ pub inline fn unlockJoysticks() void {
} }
pub inline fn hasJoystick() bool { pub inline fn hasJoystick() bool {
return c.SDL_HasJoystick(); return @bitCast(c.SDL_HasJoystick());
} }
pub inline fn getJoysticks(count: *c_int) ?*JoystickID { pub inline fn getJoysticks(count: *c_int) ?*JoystickID {
@ -297,11 +297,11 @@ pub inline fn attachVirtualJoystick(desc: *const VirtualJoystickDesc) JoystickID
} }
pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool { pub inline fn detachVirtualJoystick(instance_id: JoystickID) bool {
return c.SDL_DetachVirtualJoystick(instance_id); return @bitCast(c.SDL_DetachVirtualJoystick(instance_id));
} }
pub inline fn isJoystickVirtual(instance_id: JoystickID) bool { pub inline fn isJoystickVirtual(instance_id: JoystickID) bool {
return c.SDL_IsJoystickVirtual(instance_id); return @bitCast(c.SDL_IsJoystickVirtual(instance_id));
} }
pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void { pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, version: *u16, crc16: *u16) void {
@ -309,11 +309,11 @@ pub inline fn getJoystickGUIDInfo(guid: GUID, vendor: *u16, product: *u16, versi
} }
pub inline fn setJoystickEventsEnabled(enabled: bool) void { pub inline fn setJoystickEventsEnabled(enabled: bool) void {
return c.SDL_SetJoystickEventsEnabled(enabled); return c.SDL_SetJoystickEventsEnabled(@bitCast(enabled));
} }
pub inline fn joystickEventsEnabled() bool { pub inline fn joystickEventsEnabled() bool {
return c.SDL_JoystickEventsEnabled(); return @bitCast(c.SDL_JoystickEventsEnabled());
} }
pub inline fn updateJoysticks() void { pub inline fn updateJoysticks() void {

View File

@ -56,9 +56,9 @@ pub const MessageBoxData = extern struct {
}; };
pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool { pub inline fn showMessageBox(messageboxdata: *const MessageBoxData, buttonid: *c_int) bool {
return 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 c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window); return @bitCast(c.SDL_ShowSimpleMessageBox(@bitCast(flags), title, message, window));
} }

View File

@ -2,5 +2,5 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub inline fn openURL(url: [*c]const u8) bool { pub inline fn openURL(url: [*c]const u8) bool {
return c.SDL_OpenURL(url); return @bitCast(c.SDL_OpenURL(url));
} }

View File

@ -7,11 +7,11 @@ pub const Window = opaque {
} }
pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool { pub inline fn setWindowRelativeMouseMode(window: *Window, enabled: bool) bool {
return c.SDL_SetWindowRelativeMouseMode(window, enabled); return @bitCast(c.SDL_SetWindowRelativeMouseMode(window, @bitCast(enabled)));
} }
pub inline fn getWindowRelativeMouseMode(window: *Window) bool { pub inline fn getWindowRelativeMouseMode(window: *Window) bool {
return c.SDL_GetWindowRelativeMouseMode(window); return @bitCast(c.SDL_GetWindowRelativeMouseMode(window));
} }
}; };
@ -25,7 +25,7 @@ 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 c.SDL_SetCursor(cursor); return @bitCast(c.SDL_SetCursor(cursor));
} }
pub inline fn destroyCursor(cursor: *Cursor) void { pub inline fn destroyCursor(cursor: *Cursor) void {
@ -71,7 +71,7 @@ pub const MouseButtonFlags = packed struct(u32) {
}; };
pub inline fn hasMouse() bool { pub inline fn hasMouse() bool {
return c.SDL_HasMouse(); return @bitCast(c.SDL_HasMouse());
} }
pub inline fn getMice(count: *c_int) ?*MouseID { pub inline fn getMice(count: *c_int) ?*MouseID {
@ -99,11 +99,11 @@ pub inline fn getRelativeMouseState(x: *f32, y: *f32) MouseButtonFlags {
} }
pub inline fn warpMouseGlobal(x: f32, y: f32) bool { pub inline fn warpMouseGlobal(x: f32, y: f32) bool {
return c.SDL_WarpMouseGlobal(x, y); return @bitCast(c.SDL_WarpMouseGlobal(x, y));
} }
pub inline fn captureMouse(enabled: bool) bool { pub inline fn captureMouse(enabled: bool) bool {
return c.SDL_CaptureMouse(enabled); return @bitCast(c.SDL_CaptureMouse(@bitCast(enabled)));
} }
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 {
@ -123,13 +123,13 @@ pub inline fn getDefaultCursor() ?*Cursor {
} }
pub inline fn showCursor() bool { pub inline fn showCursor() bool {
return c.SDL_ShowCursor(); return @bitCast(c.SDL_ShowCursor());
} }
pub inline fn hideCursor() bool { pub inline fn hideCursor() bool {
return c.SDL_HideCursor(); return @bitCast(c.SDL_HideCursor());
} }
pub inline fn cursorVisible() bool { pub inline fn cursorVisible() bool {
return c.SDL_CursorVisible(); return @bitCast(c.SDL_CursorVisible());
} }

View File

@ -198,7 +198,7 @@ pub inline fn getPixelFormatName(format: PixelFormat) [*c]const u8 {
} }
pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool { pub inline fn getMasksForPixelFormat(format: PixelFormat, bpp: *c_int, Rmask: *u32, Gmask: *u32, Bmask: *u32, Amask: *u32) bool {
return c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)); return @bitCast(c.SDL_GetMasksForPixelFormat(@bitCast(format), @ptrCast(bpp), @ptrCast(Rmask), @ptrCast(Gmask), @ptrCast(Bmask), @ptrCast(Amask)));
} }
pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat { pub inline fn getPixelFormatForMasks(bpp: c_int, Rmask: u32, Gmask: u32, Bmask: u32, Amask: u32) PixelFormat {
@ -214,7 +214,7 @@ pub inline fn createPalette(ncolors: c_int) ?*Palette {
} }
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 c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors); return @bitCast(c.SDL_SetPaletteColors(palette, @ptrCast(colors), firstcolor, ncolors));
} }
pub inline fn destroyPalette(palette: ?*Palette) void { pub inline fn destroyPalette(palette: ?*Palette) void {

View File

@ -21,11 +21,11 @@ pub inline fn createProperties() PropertiesID {
} }
pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool { pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool {
return c.SDL_CopyProperties(src, dst); return @bitCast(c.SDL_CopyProperties(src, dst));
} }
pub inline fn lockProperties(props: PropertiesID) bool { pub inline fn lockProperties(props: PropertiesID) bool {
return c.SDL_LockProperties(props); return @bitCast(c.SDL_LockProperties(props));
} }
pub inline fn unlockProperties(props: PropertiesID) void { pub inline fn unlockProperties(props: PropertiesID) void {
@ -35,31 +35,31 @@ pub inline fn unlockProperties(props: PropertiesID) void {
pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback; pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback;
pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool { pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool {
return c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata); return @bitCast(c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata));
} }
pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool { pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool {
return c.SDL_SetPointerProperty(props, name, value); return @bitCast(c.SDL_SetPointerProperty(props, name, value));
} }
pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool { pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool {
return c.SDL_SetStringProperty(props, name, value); return @bitCast(c.SDL_SetStringProperty(props, name, value));
} }
pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool { pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool {
return c.SDL_SetNumberProperty(props, name, value); return @bitCast(c.SDL_SetNumberProperty(props, name, value));
} }
pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool { pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool {
return c.SDL_SetFloatProperty(props, name, value); return @bitCast(c.SDL_SetFloatProperty(props, name, value));
} }
pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool { pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool {
return c.SDL_SetBooleanProperty(props, name, value); return @bitCast(c.SDL_SetBooleanProperty(props, name, @bitCast(value)));
} }
pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_HasProperty(props, name); return @bitCast(c.SDL_HasProperty(props, name));
} }
pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType { pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType {
@ -83,17 +83,17 @@ pub inline fn getFloatProperty(props: PropertiesID, name: [*c]const u8, default_
} }
pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool { pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool {
return c.SDL_GetBooleanProperty(props, name, default_value); return @bitCast(c.SDL_GetBooleanProperty(props, name, @bitCast(default_value)));
} }
pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool { pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool {
return c.SDL_ClearProperty(props, name); return @bitCast(c.SDL_ClearProperty(props, name));
} }
pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback; pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback;
pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool { pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool {
return c.SDL_EnumerateProperties(props, callback, userdata); return @bitCast(c.SDL_EnumerateProperties(props, callback, userdata));
} }
pub inline fn destroyProperties(props: PropertiesID) void { pub inline fn destroyProperties(props: PropertiesID) void {

View File

@ -26,41 +26,41 @@ pub const FRect = extern struct {
}; };
pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool { pub inline fn hasRectIntersection(A: *const Rect, B: *const Rect) bool {
return 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 c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersection(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnion(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPoints(@ptrCast(points), count, @ptrCast(clip), 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 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 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 c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectIntersectionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), result); return @bitCast(c.SDL_GetRectUnionFloat(@ptrCast(A), @ptrCast(B), 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 c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), result); return @bitCast(c.SDL_GetRectEnclosingPointsFloat(@ptrCast(points), count, @ptrCast(clip), 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 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)));
} }

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