3 hours of vibe coding or just having a real programmer step in for 20 minutes...

This commit is contained in:
Peterino2 2026-01-22 21:19:21 -08:00
parent 0725bcdd2a
commit fbc49f1596
79 changed files with 18429 additions and 3173 deletions

111
lib/sdl3/build.zig vendored
View File

@ -146,58 +146,58 @@ pub fn build(b: *std.Build) void {
// All public SDL3 API headers (53 total) // All public SDL3 API headers (53 total)
// Skipped: assert, thread, hidapi, mutex, tray (not core APIs or problematic) // Skipped: assert, thread, hidapi, mutex, tray (not core APIs or problematic)
const headers_to_generate = [_]struct { header: []const u8, output: []const u8 }{ const headers_to_generate = [_]struct { header: []const u8, output: []const u8 }{
.{ .header = "SDL/include/SDL3/SDL_asyncio.h", .output = "v2/asyncio.zig" }, // .{ .header = "SDL/include/SDL3/SDL_asyncio.h", .output = "asyncio" },
.{ .header = "SDL/include/SDL3/SDL_atomic.h", .output = "v2/atomic.zig" }, // .{ .header = "SDL/include/SDL3/SDL_atomic.h", .output = "atomic" },
.{ .header = "SDL/include/SDL3/SDL_audio.h", .output = "v2/audio.zig" }, .{ .header = "SDL/include/SDL3/SDL_audio.h", .output = "audio" },
.{ .header = "SDL/include/SDL3/SDL_blendmode.h", .output = "v2/blendmode.zig" }, .{ .header = "SDL/include/SDL3/SDL_blendmode.h", .output = "blendmode" },
.{ .header = "SDL/include/SDL3/SDL_camera.h", .output = "v2/camera.zig" }, .{ .header = "SDL/include/SDL3/SDL_camera.h", .output = "camera" },
.{ .header = "SDL/include/SDL3/SDL_clipboard.h", .output = "v2/clipboard.zig" }, .{ .header = "SDL/include/SDL3/SDL_clipboard.h", .output = "clipboard" },
.{ .header = "SDL/include/SDL3/SDL_cpuinfo.h", .output = "v2/cpuinfo.zig" }, // .{ .header = "SDL/include/SDL3/SDL_cpuinfo.h", .output = "cpuinfo" },
.{ .header = "SDL/include/SDL3/SDL_dialog.h", .output = "v2/dialog.zig" }, .{ .header = "SDL/include/SDL3/SDL_dialog.h", .output = "dialog" },
.{ .header = "SDL/include/SDL3/SDL_endian.h", .output = "v2/endian.zig" }, .{ .header = "SDL/include/SDL3/SDL_endian.h", .output = "endian" },
.{ .header = "SDL/include/SDL3/SDL_error.h", .output = "v2/error.zig" }, .{ .header = "SDL/include/SDL3/SDL_error.h", .output = "error" },
.{ .header = "SDL/include/SDL3/SDL_events.h", .output = "v2/events.zig" }, // .{ .header = "SDL/include/SDL3/SDL_events.h", .output = "events" },
.{ .header = "SDL/include/SDL3/SDL_filesystem.h", .output = "v2/filesystem.zig" }, .{ .header = "SDL/include/SDL3/SDL_filesystem.h", .output = "filesystem" },
.{ .header = "SDL/include/SDL3/SDL_gamepad.h", .output = "v2/gamepad.zig" }, .{ .header = "SDL/include/SDL3/SDL_gamepad.h", .output = "gamepad" },
.{ .header = "SDL/include/SDL3/SDL_gpu.h", .output = "v2/gpu.zig" }, .{ .header = "SDL/include/SDL3/SDL_gpu.h", .output = "gpu" },
.{ .header = "SDL/include/SDL3/SDL_guid.h", .output = "v2/guid.zig" }, // .{ .header = "SDL/include/SDL3/SDL_guid.h", .output = "guid" },
.{ .header = "SDL/include/SDL3/SDL_haptic.h", .output = "v2/haptic.zig" }, .{ .header = "SDL/include/SDL3/SDL_haptic.h", .output = "haptic" },
// .{ .header = "SDL/include/SDL3/SDL_hidapi.h", .output = "v2/hidapi.zig" }, // Skipped: not core API // .{ .header = "SDL/include/SDL3/SDL_hidapi.h", .output = "hidapi" }, // Skipped: not core API
.{ .header = "SDL/include/SDL3/SDL_hints.h", .output = "v2/hints.zig" }, .{ .header = "SDL/include/SDL3/SDL_hints.h", .output = "hints" },
.{ .header = "SDL/include/SDL3/SDL_init.h", .output = "v2/init.zig" }, .{ .header = "SDL/include/SDL3/SDL_init.h", .output = "init" },
// .{ .header = "SDL/include/SDL3/SDL_iostream.h", .output = "v2/iostream.zig" }, // Skipped: complex I/O API // .{ .header = "SDL/include/SDL3/SDL_iostream.h", .output = "iostream" }, // Skipped: complex I/O API
.{ .header = "SDL/include/SDL3/SDL_joystick.h", .output = "v2/joystick.zig" }, .{ .header = "SDL/include/SDL3/SDL_joystick.h", .output = "joystick" },
.{ .header = "SDL/include/SDL3/SDL_keyboard.h", .output = "v2/keyboard.zig" }, // .{ .header = "SDL/include/SDL3/SDL_keyboard.h", .output = "keyboard" },
.{ .header = "SDL/include/SDL3/SDL_keycode.h", .output = "v2/keycode.zig" }, .{ .header = "SDL/include/SDL3/SDL_keycode.h", .output = "keycode" },
.{ .header = "SDL/include/SDL3/SDL_loadso.h", .output = "v2/loadso.zig" }, .{ .header = "SDL/include/SDL3/SDL_loadso.h", .output = "loadso" },
.{ .header = "SDL/include/SDL3/SDL_locale.h", .output = "v2/locale.zig" }, // .{ .header = "SDL/include/SDL3/SDL_locale.h", .output = "locale" },
.{ .header = "SDL/include/SDL3/SDL_log.h", .output = "v2/log.zig" }, // .{ .header = "SDL/include/SDL3/SDL_log.h", .output = "log" },
.{ .header = "SDL/include/SDL3/SDL_messagebox.h", .output = "v2/messagebox.zig" }, .{ .header = "SDL/include/SDL3/SDL_messagebox.h", .output = "messagebox" },
.{ .header = "SDL/include/SDL3/SDL_metal.h", .output = "v2/metal.zig" }, // .{ .header = "SDL/include/SDL3/SDL_metal.h", .output = "metal" },
.{ .header = "SDL/include/SDL3/SDL_misc.h", .output = "v2/misc.zig" }, .{ .header = "SDL/include/SDL3/SDL_misc.h", .output = "misc" },
.{ .header = "SDL/include/SDL3/SDL_mouse.h", .output = "v2/mouse.zig" }, .{ .header = "SDL/include/SDL3/SDL_mouse.h", .output = "mouse" },
// .{ .header = "SDL/include/SDL3/SDL_mutex.h", .output = "v2/mutex.zig" }, // Skipped: not core API // .{ .header = "SDL/include/SDL3/SDL_mutex.h", .output = "mutex" }, // Skipped: not core API
.{ .header = "SDL/include/SDL3/SDL_opengl.h", .output = "v2/opengl.zig" }, // .{ .header = "SDL/include/SDL3/SDL_opengl.h", .output = "opengl" },
.{ .header = "SDL/include/SDL3/SDL_pen.h", .output = "v2/pen.zig" }, // .{ .header = "SDL/include/SDL3/SDL_pen.h", .output = "pen" },
.{ .header = "SDL/include/SDL3/SDL_pixels.h", .output = "v2/pixels.zig" }, .{ .header = "SDL/include/SDL3/SDL_pixels.h", .output = "pixels" },
.{ .header = "SDL/include/SDL3/SDL_power.h", .output = "v2/power.zig" }, // .{ .header = "SDL/include/SDL3/SDL_power.h", .output = "power" },
.{ .header = "SDL/include/SDL3/SDL_process.h", .output = "v2/process.zig" }, // .{ .header = "SDL/include/SDL3/SDL_process.h", .output = "process" },
.{ .header = "SDL/include/SDL3/SDL_properties.h", .output = "v2/properties.zig" }, .{ .header = "SDL/include/SDL3/SDL_properties.h", .output = "properties" },
.{ .header = "SDL/include/SDL3/SDL_rect.h", .output = "v2/rect.zig" }, .{ .header = "SDL/include/SDL3/SDL_rect.h", .output = "rect" },
.{ .header = "SDL/include/SDL3/SDL_render.h", .output = "v2/render.zig" }, .{ .header = "SDL/include/SDL3/SDL_render.h", .output = "render" },
.{ .header = "SDL/include/SDL3/SDL_scancode.h", .output = "v2/scancode.zig" }, // .{ .header = "SDL/include/SDL3/SDL_scancode.h", .output = "scancode" },
.{ .header = "SDL/include/SDL3/SDL_sensor.h", .output = "v2/sensor.zig" }, .{ .header = "SDL/include/SDL3/SDL_sensor.h", .output = "sensor" },
.{ .header = "SDL/include/SDL3/SDL_storage.h", .output = "v2/storage.zig" }, .{ .header = "SDL/include/SDL3/SDL_storage.h", .output = "storage" },
.{ .header = "SDL/include/SDL3/SDL_surface.h", .output = "v2/surface.zig" }, .{ .header = "SDL/include/SDL3/SDL_surface.h", .output = "surface" },
.{ .header = "SDL/include/SDL3/SDL_system.h", .output = "v2/system.zig" }, .{ .header = "SDL/include/SDL3/SDL_system.h", .output = "system" },
// .{ .header = "SDL/include/SDL3/SDL_thread.h", .output = "v2/thread.zig" }, // Skipped: not core API // .{ .header = "SDL/include/SDL3/SDL_thread.h", .output = "thread" }, // Skipped: not core API
.{ .header = "SDL/include/SDL3/SDL_time.h", .output = "v2/time.zig" }, .{ .header = "SDL/include/SDL3/SDL_time.h", .output = "time" },
.{ .header = "SDL/include/SDL3/SDL_timer.h", .output = "v2/timer.zig" }, .{ .header = "SDL/include/SDL3/SDL_timer.h", .output = "timer" },
.{ .header = "SDL/include/SDL3/SDL_touch.h", .output = "v2/touch.zig" }, .{ .header = "SDL/include/SDL3/SDL_touch.h", .output = "touch" },
// .{ .header = "SDL/include/SDL3/SDL_tray.h", .output = "v2/tray.zig" }, // Skipped: not core API // .{ .header = "SDL/include/SDL3/SDL_tray.h", .output = "tray" }, // Skipped: not core API
.{ .header = "SDL/include/SDL3/SDL_version.h", .output = "v2/version.zig" }, .{ .header = "SDL/include/SDL3/SDL_version.h", .output = "version" },
.{ .header = "SDL/include/SDL3/SDL_video.h", .output = "v2/video.zig" }, .{ .header = "SDL/include/SDL3/SDL_video.h", .output = "video" },
// .{ .header = "SDL/include/SDL3/SDL_vulkan.h", .output = "v2/vulkan.zig" }, // Skipped: Vulkan interop // .{ .header = "SDL/include/SDL3/SDL_vulkan.h", .output = "vulkan" }, // Skipped: Vulkan interop
}; };
const regenerate_step = b.step("regenerate-zig", "Regenerate bindings from SDL headers"); const regenerate_step = b.step("regenerate-zig", "Regenerate bindings from SDL headers");
@ -205,8 +205,13 @@ pub fn build(b: *std.Build) void {
for (headers_to_generate) |header_info| { for (headers_to_generate) |header_info| {
const regenerate = b.addRunArtifact(parser_exe); const regenerate = b.addRunArtifact(parser_exe);
regenerate.addFileArg(b.path(header_info.header)); regenerate.addFileArg(b.path(header_info.header));
regenerate.addArg(b.fmt("--output={s}", .{header_info.output})); regenerate.addArg(b.fmt("--output=v2/{s}.zig", .{header_info.output}));
regenerate_step.dependOn(&regenerate.step); regenerate_step.dependOn(&regenerate.step);
const regenerateJson = b.addRunArtifact(parser_exe);
regenerateJson.addFileArg(b.path(header_info.header));
regenerateJson.addArg(b.fmt("--generate-json=json/{s}.json", .{header_info.output}));
regenerate_step.dependOn(&regenerateJson.step);
} }
// Regenerate test mocks step - using SDL_gpu.h for comprehensive testing // Regenerate test mocks step - using SDL_gpu.h for comprehensive testing

892
lib/sdl3/json/audio.json vendored Normal file
View File

@ -0,0 +1,892 @@
{
"header": "SDL_audio.h",
"opaque_types": [
{
"name": "SDL_AudioStream"
}
],
"typedefs": [
{
"name": "SDL_AudioDeviceID",
"underlying_type": "Uint32"
}
],
"function_pointers": [
{
"name": "SDL_AudioStreamCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "additional_amount",
"type": "int"
},
{
"name": "total_amount",
"type": "int"
}
]
},
{
"name": "SDL_AudioPostmixCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "buffer",
"type": "float *"
},
{
"name": "buflen",
"type": "int"
}
]
}
],
"enums": [
{
"name": "SDL_AudioFormat",
"values": [
{
"name": "SDL_AUDIO_UNKNOWN",
"value": "0x0000u",
"comment": "Unspecified audio format"
},
{
"name": "SDL_AUDIO_U8",
"value": "0x0008u",
"comment": "Unsigned 8-bit samples"
},
{
"name": "SDL_AUDIO_S8",
"value": "0x8008u",
"comment": "Signed 8-bit samples"
},
{
"name": "SDL_AUDIO_S16LE",
"value": "0x8010u",
"comment": "Signed 16-bit samples"
},
{
"name": "SDL_AUDIO_S16BE",
"value": "0x9010u",
"comment": "As above, but big-endian byte order"
},
{
"name": "SDL_AUDIO_S32LE",
"value": "0x8020u",
"comment": "32-bit integer samples"
},
{
"name": "SDL_AUDIO_S32BE",
"value": "0x9020u",
"comment": "As above, but big-endian byte order"
},
{
"name": "SDL_AUDIO_F32LE",
"value": "0x8120u",
"comment": "32-bit floating point samples"
},
{
"name": "SDL_AUDIO_F32BE",
"value": "0x9120u",
"comment": "As above, but big-endian byte order"
}
]
}
],
"structs": [
{
"name": "SDL_AudioSpec",
"fields": [
{
"name": "format",
"type": "SDL_AudioFormat",
"comment": "Audio data format"
},
{
"name": "channels",
"type": "int",
"comment": "Number of channels: 1 mono, 2 stereo, etc"
},
{
"name": "freq",
"type": "int",
"comment": "sample rate: sample frames per second"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetNumAudioDrivers",
"return_type": "int",
"parameters": []
},
{
"name": "SDL_GetAudioDriver",
"return_type": "const char *",
"parameters": [
{
"name": "index",
"type": "int"
}
]
},
{
"name": "SDL_GetCurrentAudioDriver",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_GetAudioPlaybackDevices",
"return_type": "SDL_AudioDeviceID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetAudioRecordingDevices",
"return_type": "SDL_AudioDeviceID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetAudioDeviceName",
"return_type": "const char *",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_GetAudioDeviceFormat",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "spec",
"type": "SDL_AudioSpec *"
},
{
"name": "sample_frames",
"type": "int *"
}
]
},
{
"name": "SDL_GetAudioDeviceChannelMap",
"return_type": "int *",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_OpenAudioDevice",
"return_type": "SDL_AudioDeviceID",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "spec",
"type": "const SDL_AudioSpec *"
}
]
},
{
"name": "SDL_IsAudioDevicePhysical",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_IsAudioDevicePlayback",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_PauseAudioDevice",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_ResumeAudioDevice",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_AudioDevicePaused",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_GetAudioDeviceGain",
"return_type": "float",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_SetAudioDeviceGain",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "gain",
"type": "float"
}
]
},
{
"name": "SDL_CloseAudioDevice",
"return_type": "void",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
}
]
},
{
"name": "SDL_BindAudioStreams",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "streams",
"type": "SDL_AudioStream * const *"
},
{
"name": "num_streams",
"type": "int"
}
]
},
{
"name": "SDL_BindAudioStream",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_UnbindAudioStreams",
"return_type": "void",
"parameters": [
{
"name": "streams",
"type": "SDL_AudioStream * const *"
},
{
"name": "num_streams",
"type": "int"
}
]
},
{
"name": "SDL_UnbindAudioStream",
"return_type": "void",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_GetAudioStreamDevice",
"return_type": "SDL_AudioDeviceID",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_CreateAudioStream",
"return_type": "SDL_AudioStream *",
"parameters": [
{
"name": "src_spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "dst_spec",
"type": "const SDL_AudioSpec *"
}
]
},
{
"name": "SDL_GetAudioStreamProperties",
"return_type": "SDL_PropertiesID",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_GetAudioStreamFormat",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "src_spec",
"type": "SDL_AudioSpec *"
},
{
"name": "dst_spec",
"type": "SDL_AudioSpec *"
}
]
},
{
"name": "SDL_SetAudioStreamFormat",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "src_spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "dst_spec",
"type": "const SDL_AudioSpec *"
}
]
},
{
"name": "SDL_GetAudioStreamFrequencyRatio",
"return_type": "float",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_SetAudioStreamFrequencyRatio",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "ratio",
"type": "float"
}
]
},
{
"name": "SDL_GetAudioStreamGain",
"return_type": "float",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_SetAudioStreamGain",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "gain",
"type": "float"
}
]
},
{
"name": "SDL_GetAudioStreamInputChannelMap",
"return_type": "int *",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetAudioStreamOutputChannelMap",
"return_type": "int *",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_SetAudioStreamInputChannelMap",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "chmap",
"type": "const int *"
},
{
"name": "count",
"type": "int"
}
]
},
{
"name": "SDL_SetAudioStreamOutputChannelMap",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "chmap",
"type": "const int *"
},
{
"name": "count",
"type": "int"
}
]
},
{
"name": "SDL_PutAudioStreamData",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "buf",
"type": "const void *"
},
{
"name": "len",
"type": "int"
}
]
},
{
"name": "SDL_GetAudioStreamData",
"return_type": "int",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "buf",
"type": "void *"
},
{
"name": "len",
"type": "int"
}
]
},
{
"name": "SDL_GetAudioStreamAvailable",
"return_type": "int",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_GetAudioStreamQueued",
"return_type": "int",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_FlushAudioStream",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_ClearAudioStream",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_PauseAudioStreamDevice",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_ResumeAudioStreamDevice",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_AudioStreamDevicePaused",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_LockAudioStream",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_UnlockAudioStream",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_SetAudioStreamGetCallback",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "callback",
"type": "SDL_AudioStreamCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_SetAudioStreamPutCallback",
"return_type": "bool",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
},
{
"name": "callback",
"type": "SDL_AudioStreamCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_DestroyAudioStream",
"return_type": "void",
"parameters": [
{
"name": "stream",
"type": "SDL_AudioStream *"
}
]
},
{
"name": "SDL_OpenAudioDeviceStream",
"return_type": "SDL_AudioStream *",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "callback",
"type": "SDL_AudioStreamCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_SetAudioPostmixCallback",
"return_type": "bool",
"parameters": [
{
"name": "devid",
"type": "SDL_AudioDeviceID"
},
{
"name": "callback",
"type": "SDL_AudioPostmixCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_LoadWAV_IO",
"return_type": "bool",
"parameters": [
{
"name": "src",
"type": "SDL_IOStream *"
},
{
"name": "closeio",
"type": "bool"
},
{
"name": "spec",
"type": "SDL_AudioSpec *"
},
{
"name": "audio_buf",
"type": "Uint8 **"
},
{
"name": "audio_len",
"type": "Uint32 *"
}
]
},
{
"name": "SDL_LoadWAV",
"return_type": "bool",
"parameters": [
{
"name": "path",
"type": "const char *"
},
{
"name": "spec",
"type": "SDL_AudioSpec *"
},
{
"name": "audio_buf",
"type": "Uint8 **"
},
{
"name": "audio_len",
"type": "Uint32 *"
}
]
},
{
"name": "SDL_MixAudio",
"return_type": "bool",
"parameters": [
{
"name": "dst",
"type": "Uint8 *"
},
{
"name": "src",
"type": "const Uint8 *"
},
{
"name": "format",
"type": "SDL_AudioFormat"
},
{
"name": "len",
"type": "Uint32"
},
{
"name": "volume",
"type": "float"
}
]
},
{
"name": "SDL_ConvertAudioSamples",
"return_type": "bool",
"parameters": [
{
"name": "src_spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "src_data",
"type": "const Uint8 *"
},
{
"name": "src_len",
"type": "int"
},
{
"name": "dst_spec",
"type": "const SDL_AudioSpec *"
},
{
"name": "dst_data",
"type": "Uint8 **"
},
{
"name": "dst_len",
"type": "int *"
}
]
},
{
"name": "SDL_GetAudioFormatName",
"return_type": "const char *",
"parameters": [
{
"name": "format",
"type": "SDL_AudioFormat"
}
]
},
{
"name": "SDL_GetSilenceValueForFormat",
"return_type": "int",
"parameters": [
{
"name": "format",
"type": "SDL_AudioFormat"
}
]
}
]
}

131
lib/sdl3/json/blendmode.json vendored Normal file
View File

@ -0,0 +1,131 @@
{
"header": "SDL_blendmode.h",
"opaque_types": [],
"typedefs": [
{
"name": "SDL_BlendMode",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_BlendOperation",
"values": [
{
"name": "SDL_BLENDOPERATION_ADD",
"value": "0x1",
"comment": "dst + src: supported by all renderers"
},
{
"name": "SDL_BLENDOPERATION_SUBTRACT",
"value": "0x2",
"comment": "src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan"
},
{
"name": "SDL_BLENDOPERATION_REV_SUBTRACT",
"value": "0x3",
"comment": "dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan"
},
{
"name": "SDL_BLENDOPERATION_MINIMUM",
"value": "0x4",
"comment": "min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan"
},
{
"name": "SDL_BLENDOPERATION_MAXIMUM",
"value": "0x5"
}
]
},
{
"name": "SDL_BlendFactor",
"values": [
{
"name": "SDL_BLENDFACTOR_ZERO",
"value": "0x1",
"comment": "0, 0, 0, 0"
},
{
"name": "SDL_BLENDFACTOR_ONE",
"value": "0x2",
"comment": "1, 1, 1, 1"
},
{
"name": "SDL_BLENDFACTOR_SRC_COLOR",
"value": "0x3",
"comment": "srcR, srcG, srcB, srcA"
},
{
"name": "SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR",
"value": "0x4",
"comment": "1-srcR, 1-srcG, 1-srcB, 1-srcA"
},
{
"name": "SDL_BLENDFACTOR_SRC_ALPHA",
"value": "0x5",
"comment": "srcA, srcA, srcA, srcA"
},
{
"name": "SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA",
"value": "0x6",
"comment": "1-srcA, 1-srcA, 1-srcA, 1-srcA"
},
{
"name": "SDL_BLENDFACTOR_DST_COLOR",
"value": "0x7",
"comment": "dstR, dstG, dstB, dstA"
},
{
"name": "SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR",
"value": "0x8",
"comment": "1-dstR, 1-dstG, 1-dstB, 1-dstA"
},
{
"name": "SDL_BLENDFACTOR_DST_ALPHA",
"value": "0x9",
"comment": "dstA, dstA, dstA, dstA"
},
{
"name": "SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA",
"value": "0xA"
}
]
}
],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_ComposeCustomBlendMode",
"return_type": "SDL_BlendMode",
"parameters": [
{
"name": "srcColorFactor",
"type": "SDL_BlendFactor"
},
{
"name": "dstColorFactor",
"type": "SDL_BlendFactor"
},
{
"name": "colorOperation",
"type": "SDL_BlendOperation"
},
{
"name": "srcAlphaFactor",
"type": "SDL_BlendFactor"
},
{
"name": "dstAlphaFactor",
"type": "SDL_BlendFactor"
},
{
"name": "alphaOperation",
"type": "SDL_BlendOperation"
}
]
}
]
}

232
lib/sdl3/json/camera.json vendored Normal file
View File

@ -0,0 +1,232 @@
{
"header": "SDL_camera.h",
"opaque_types": [
{
"name": "SDL_Camera"
}
],
"typedefs": [
{
"name": "SDL_CameraID",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_CameraPosition",
"values": [
{
"name": "SDL_CAMERA_POSITION_UNKNOWN"
},
{
"name": "SDL_CAMERA_POSITION_FRONT_FACING"
},
{
"name": "SDL_CAMERA_POSITION_BACK_FACING"
}
]
}
],
"structs": [
{
"name": "SDL_CameraSpec",
"fields": [
{
"name": "format",
"type": "SDL_PixelFormat",
"comment": "Frame format"
},
{
"name": "colorspace",
"type": "SDL_Colorspace",
"comment": "Frame colorspace"
},
{
"name": "width",
"type": "int",
"comment": "Frame width"
},
{
"name": "height",
"type": "int",
"comment": "Frame height"
},
{
"name": "framerate_numerator",
"type": "int",
"comment": "Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds)"
},
{
"name": "framerate_denominator",
"type": "int",
"comment": "Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds)"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetNumCameraDrivers",
"return_type": "int",
"parameters": []
},
{
"name": "SDL_GetCameraDriver",
"return_type": "const char *",
"parameters": [
{
"name": "index",
"type": "int"
}
]
},
{
"name": "SDL_GetCurrentCameraDriver",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_GetCameras",
"return_type": "SDL_CameraID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetCameraSupportedFormats",
"return_type": "SDL_CameraSpec **",
"parameters": [
{
"name": "instance_id",
"type": "SDL_CameraID"
},
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetCameraName",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_CameraID"
}
]
},
{
"name": "SDL_GetCameraPosition",
"return_type": "SDL_CameraPosition",
"parameters": [
{
"name": "instance_id",
"type": "SDL_CameraID"
}
]
},
{
"name": "SDL_OpenCamera",
"return_type": "SDL_Camera *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_CameraID"
},
{
"name": "spec",
"type": "const SDL_CameraSpec *"
}
]
},
{
"name": "SDL_GetCameraPermissionState",
"return_type": "int",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
}
]
},
{
"name": "SDL_GetCameraID",
"return_type": "SDL_CameraID",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
}
]
},
{
"name": "SDL_GetCameraProperties",
"return_type": "SDL_PropertiesID",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
}
]
},
{
"name": "SDL_GetCameraFormat",
"return_type": "bool",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
},
{
"name": "spec",
"type": "SDL_CameraSpec *"
}
]
},
{
"name": "SDL_AcquireCameraFrame",
"return_type": "SDL_Surface *",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
},
{
"name": "timestampNS",
"type": "Uint64 *"
}
]
},
{
"name": "SDL_ReleaseCameraFrame",
"return_type": "void",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
},
{
"name": "frame",
"type": "SDL_Surface *"
}
]
},
{
"name": "SDL_CloseCamera",
"return_type": "void",
"parameters": [
{
"name": "camera",
"type": "SDL_Camera *"
}
]
}
]
}

146
lib/sdl3/json/clipboard.json vendored Normal file
View File

@ -0,0 +1,146 @@
{
"header": "SDL_clipboard.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [
{
"name": "SDL_ClipboardDataCallback",
"return_type": "const void *",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "mime_type",
"type": "const char *"
},
{
"name": "size",
"type": "size_t *"
}
]
},
{
"name": "SDL_ClipboardCleanupCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
}
]
}
],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_SetClipboardText",
"return_type": "bool",
"parameters": [
{
"name": "text",
"type": "const char *"
}
]
},
{
"name": "SDL_GetClipboardText",
"return_type": "char *",
"parameters": []
},
{
"name": "SDL_HasClipboardText",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_SetPrimarySelectionText",
"return_type": "bool",
"parameters": [
{
"name": "text",
"type": "const char *"
}
]
},
{
"name": "SDL_GetPrimarySelectionText",
"return_type": "char *",
"parameters": []
},
{
"name": "SDL_HasPrimarySelectionText",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_SetClipboardData",
"return_type": "bool",
"parameters": [
{
"name": "callback",
"type": "SDL_ClipboardDataCallback"
},
{
"name": "cleanup",
"type": "SDL_ClipboardCleanupCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "mime_types",
"type": "const char **"
},
{
"name": "num_mime_types",
"type": "size_t"
}
]
},
{
"name": "SDL_ClearClipboardData",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_GetClipboardData",
"return_type": "void *",
"parameters": [
{
"name": "mime_type",
"type": "const char *"
},
{
"name": "size",
"type": "size_t *"
}
]
},
{
"name": "SDL_HasClipboardData",
"return_type": "bool",
"parameters": [
{
"name": "mime_type",
"type": "const char *"
}
]
},
{
"name": "SDL_GetClipboardMimeTypes",
"return_type": "char **",
"parameters": [
{
"name": "num_mime_types",
"type": "size_t *"
}
]
}
]
}

172
lib/sdl3/json/dialog.json vendored Normal file
View File

@ -0,0 +1,172 @@
{
"header": "SDL_dialog.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [
{
"name": "SDL_DialogFileCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "filelist",
"type": "const char * const *"
},
{
"name": "filter",
"type": "int"
}
]
}
],
"enums": [
{
"name": "SDL_FileDialogType",
"values": [
{
"name": "SDL_FILEDIALOG_OPENFILE"
},
{
"name": "SDL_FILEDIALOG_SAVEFILE"
},
{
"name": "SDL_FILEDIALOG_OPENFOLDER"
}
]
}
],
"structs": [
{
"name": "SDL_DialogFileFilter",
"fields": [
{
"name": "name",
"type": "const char *"
},
{
"name": "pattern",
"type": "const char *"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_ShowOpenFileDialog",
"return_type": "void",
"parameters": [
{
"name": "callback",
"type": "SDL_DialogFileCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "filters",
"type": "const SDL_DialogFileFilter *"
},
{
"name": "nfilters",
"type": "int"
},
{
"name": "default_location",
"type": "const char *"
},
{
"name": "allow_many",
"type": "bool"
}
]
},
{
"name": "SDL_ShowSaveFileDialog",
"return_type": "void",
"parameters": [
{
"name": "callback",
"type": "SDL_DialogFileCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "filters",
"type": "const SDL_DialogFileFilter *"
},
{
"name": "nfilters",
"type": "int"
},
{
"name": "default_location",
"type": "const char *"
}
]
},
{
"name": "SDL_ShowOpenFolderDialog",
"return_type": "void",
"parameters": [
{
"name": "callback",
"type": "SDL_DialogFileCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "default_location",
"type": "const char *"
},
{
"name": "allow_many",
"type": "bool"
}
]
},
{
"name": "SDL_ShowFileDialogWithProperties",
"return_type": "void",
"parameters": [
{
"name": "_type",
"type": "SDL_FileDialogType"
},
{
"name": "callback",
"type": "SDL_DialogFileCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
}
]
}

11
lib/sdl3/json/endian.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"header": "SDL_endian.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": []
}

55
lib/sdl3/json/error.json vendored Normal file
View File

@ -0,0 +1,55 @@
{
"header": "SDL_error.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_SetError",
"return_type": "bool",
"parameters": [
{
"name": "fmt",
"type": "const char *"
},
{
"name": "",
"type": "..."
}
]
},
{
"name": "SDL_SetErrorV",
"return_type": "bool",
"parameters": [
{
"name": "fmt",
"type": "const char *"
},
{
"name": "ap",
"type": "va_list"
}
]
},
{
"name": "SDL_OutOfMemory",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_GetError",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_ClearError",
"return_type": "bool",
"parameters": []
}
]
}

298
lib/sdl3/json/filesystem.json vendored Normal file
View File

@ -0,0 +1,298 @@
{
"header": "SDL_filesystem.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [
{
"name": "SDL_EnumerateDirectoryCallback",
"return_type": "SDL_EnumerationResult",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "dirname",
"type": "const char *"
},
{
"name": "fname",
"type": "const char *"
}
]
}
],
"enums": [
{
"name": "SDL_Folder",
"values": [
{
"name": "SDL_FOLDER_HOME",
"comment": "The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents."
},
{
"name": "SDL_FOLDER_DESKTOP",
"comment": "The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons."
},
{
"name": "SDL_FOLDER_DOCUMENTS",
"comment": "User document files, possibly application-specific. This is a good place to save a user's projects."
},
{
"name": "SDL_FOLDER_DOWNLOADS",
"comment": "Standard folder for user files downloaded from the internet."
},
{
"name": "SDL_FOLDER_MUSIC",
"comment": "Music files that can be played using a standard music player (mp3, ogg...)."
},
{
"name": "SDL_FOLDER_PICTURES",
"comment": "Image files that can be displayed using a standard viewer (png, jpg...)."
},
{
"name": "SDL_FOLDER_PUBLICSHARE",
"comment": "Files that are meant to be shared with other users on the same computer."
},
{
"name": "SDL_FOLDER_SAVEDGAMES",
"comment": "Save files for games."
},
{
"name": "SDL_FOLDER_SCREENSHOTS",
"comment": "Application screenshots."
},
{
"name": "SDL_FOLDER_TEMPLATES",
"comment": "Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as \"New Text File.txt\". Any file in the Templates folder can be used as a starting point for a new file."
},
{
"name": "SDL_FOLDER_VIDEOS",
"comment": "Video files that can be played using a standard video player (mp4, webm...)."
},
{
"name": "SDL_FOLDER_COUNT"
}
]
},
{
"name": "SDL_PathType",
"values": [
{
"name": "SDL_PATHTYPE_NONE",
"comment": "path does not exist"
},
{
"name": "SDL_PATHTYPE_FILE",
"comment": "a normal file"
},
{
"name": "SDL_PATHTYPE_DIRECTORY",
"comment": "a directory"
},
{
"name": "SDL_PATHTYPE_OTHER"
}
]
},
{
"name": "SDL_EnumerationResult",
"values": [
{
"name": "SDL_ENUM_CONTINUE",
"comment": "Value that requests that enumeration continue."
},
{
"name": "SDL_ENUM_SUCCESS",
"comment": "Value that requests that enumeration stop, successfully."
},
{
"name": "SDL_ENUM_FAILURE"
}
]
}
],
"structs": [
{
"name": "SDL_PathInfo",
"fields": [
{
"name": "_type",
"type": "SDL_PathType",
"comment": "the path type"
},
{
"name": "size",
"type": "Uint64",
"comment": "the file size in bytes"
},
{
"name": "create_time",
"type": "SDL_Time",
"comment": "the time when the path was created"
},
{
"name": "modify_time",
"type": "SDL_Time",
"comment": "the last time the path was modified"
},
{
"name": "access_time",
"type": "SDL_Time",
"comment": "the last time the path was read"
}
]
}
],
"unions": [],
"flags": [
{
"name": "SDL_GlobFlags",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_GLOB_CASEINSENSITIVE",
"value": "(1u << 0)"
}
]
}
],
"functions": [
{
"name": "SDL_GetBasePath",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_GetPrefPath",
"return_type": "char *",
"parameters": [
{
"name": "org",
"type": "const char *"
},
{
"name": "app",
"type": "const char *"
}
]
},
{
"name": "SDL_GetUserFolder",
"return_type": "const char *",
"parameters": [
{
"name": "folder",
"type": "SDL_Folder"
}
]
},
{
"name": "SDL_CreateDirectory",
"return_type": "bool",
"parameters": [
{
"name": "path",
"type": "const char *"
}
]
},
{
"name": "SDL_EnumerateDirectory",
"return_type": "bool",
"parameters": [
{
"name": "path",
"type": "const char *"
},
{
"name": "callback",
"type": "SDL_EnumerateDirectoryCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_RemovePath",
"return_type": "bool",
"parameters": [
{
"name": "path",
"type": "const char *"
}
]
},
{
"name": "SDL_RenamePath",
"return_type": "bool",
"parameters": [
{
"name": "oldpath",
"type": "const char *"
},
{
"name": "newpath",
"type": "const char *"
}
]
},
{
"name": "SDL_CopyFile",
"return_type": "bool",
"parameters": [
{
"name": "oldpath",
"type": "const char *"
},
{
"name": "newpath",
"type": "const char *"
}
]
},
{
"name": "SDL_GetPathInfo",
"return_type": "bool",
"parameters": [
{
"name": "path",
"type": "const char *"
},
{
"name": "info",
"type": "SDL_PathInfo *"
}
]
},
{
"name": "SDL_GlobDirectory",
"return_type": "char **",
"parameters": [
{
"name": "path",
"type": "const char *"
},
{
"name": "pattern",
"type": "const char *"
},
{
"name": "flags",
"type": "SDL_GlobFlags"
},
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetCurrentDirectory",
"return_type": "char *",
"parameters": []
}
]
}

1148
lib/sdl3/json/gamepad.json vendored Normal file

File diff suppressed because it is too large Load Diff

3881
lib/sdl3/json/gpu.json vendored Normal file

File diff suppressed because it is too large Load Diff

785
lib/sdl3/json/haptic.json vendored Normal file
View File

@ -0,0 +1,785 @@
{
"header": "SDL_haptic.h",
"opaque_types": [
{
"name": "SDL_Haptic"
}
],
"typedefs": [
{
"name": "SDL_HapticID",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [],
"structs": [
{
"name": "SDL_HapticDirection",
"fields": [
{
"name": "_type",
"type": "Uint8",
"comment": "The type of encoding."
},
{
"name": "dir",
"type": "Sint32[3]",
"comment": "The encoded direction."
}
]
},
{
"name": "SDL_HapticConstant",
"fields": [
{
"name": "_type",
"type": "Uint16",
"comment": "SDL_HAPTIC_CONSTANT"
},
{
"name": "direction",
"type": "SDL_HapticDirection",
"comment": "Direction of the effect."
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect."
},
{
"name": "delay",
"type": "Uint16",
"comment": "Delay before starting the effect."
},
{
"name": "button",
"type": "Uint16",
"comment": "Button that triggers the effect."
},
{
"name": "interval",
"type": "Uint16",
"comment": "How soon it can be triggered again after button."
},
{
"name": "level",
"type": "Sint16",
"comment": "Strength of the constant effect."
},
{
"name": "attack_length",
"type": "Uint16",
"comment": "Duration of the attack."
},
{
"name": "attack_level",
"type": "Uint16",
"comment": "Level at the start of the attack."
},
{
"name": "fade_length",
"type": "Uint16",
"comment": "Duration of the fade."
},
{
"name": "fade_level",
"type": "Uint16",
"comment": "Level at the end of the fade."
}
]
},
{
"name": "SDL_HapticPeriodic",
"fields": [
{
"name": "direction",
"type": "SDL_HapticDirection",
"comment": "Direction of the effect."
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect."
},
{
"name": "delay",
"type": "Uint16",
"comment": "Delay before starting the effect."
},
{
"name": "button",
"type": "Uint16",
"comment": "Button that triggers the effect."
},
{
"name": "interval",
"type": "Uint16",
"comment": "How soon it can be triggered again after button."
},
{
"name": "period",
"type": "Uint16",
"comment": "Period of the wave."
},
{
"name": "magnitude",
"type": "Sint16",
"comment": "Peak value; if negative, equivalent to 180 degrees extra phase shift."
},
{
"name": "offset",
"type": "Sint16",
"comment": "Mean value of the wave."
},
{
"name": "phase",
"type": "Uint16",
"comment": "Positive phase shift given by hundredth of a degree."
},
{
"name": "attack_length",
"type": "Uint16",
"comment": "Duration of the attack."
},
{
"name": "attack_level",
"type": "Uint16",
"comment": "Level at the start of the attack."
},
{
"name": "fade_length",
"type": "Uint16",
"comment": "Duration of the fade."
},
{
"name": "fade_level",
"type": "Uint16",
"comment": "Level at the end of the fade."
}
]
},
{
"name": "SDL_HapticCondition",
"fields": [
{
"name": "direction",
"type": "SDL_HapticDirection",
"comment": "Direction of the effect."
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect."
},
{
"name": "delay",
"type": "Uint16",
"comment": "Delay before starting the effect."
},
{
"name": "button",
"type": "Uint16",
"comment": "Button that triggers the effect."
},
{
"name": "interval",
"type": "Uint16",
"comment": "How soon it can be triggered again after button."
},
{
"name": "right_sat",
"type": "Uint16[3]",
"comment": "Level when joystick is to the positive side; max 0xFFFF."
},
{
"name": "left_sat",
"type": "Uint16[3]",
"comment": "Level when joystick is to the negative side; max 0xFFFF."
},
{
"name": "right_coeff",
"type": "Sint16[3]",
"comment": "How fast to increase the force towards the positive side."
},
{
"name": "left_coeff",
"type": "Sint16[3]",
"comment": "How fast to increase the force towards the negative side."
},
{
"name": "deadband",
"type": "Uint16[3]",
"comment": "Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered."
},
{
"name": "center",
"type": "Sint16[3]",
"comment": "Position of the dead zone."
}
]
},
{
"name": "SDL_HapticRamp",
"fields": [
{
"name": "_type",
"type": "Uint16",
"comment": "SDL_HAPTIC_RAMP"
},
{
"name": "direction",
"type": "SDL_HapticDirection",
"comment": "Direction of the effect."
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect."
},
{
"name": "delay",
"type": "Uint16",
"comment": "Delay before starting the effect."
},
{
"name": "button",
"type": "Uint16",
"comment": "Button that triggers the effect."
},
{
"name": "interval",
"type": "Uint16",
"comment": "How soon it can be triggered again after button."
},
{
"name": "start",
"type": "Sint16",
"comment": "Beginning strength level."
},
{
"name": "end",
"type": "Sint16",
"comment": "Ending strength level."
},
{
"name": "attack_length",
"type": "Uint16",
"comment": "Duration of the attack."
},
{
"name": "attack_level",
"type": "Uint16",
"comment": "Level at the start of the attack."
},
{
"name": "fade_length",
"type": "Uint16",
"comment": "Duration of the fade."
},
{
"name": "fade_level",
"type": "Uint16",
"comment": "Level at the end of the fade."
}
]
},
{
"name": "SDL_HapticLeftRight",
"fields": [
{
"name": "_type",
"type": "Uint16",
"comment": "SDL_HAPTIC_LEFTRIGHT"
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect in milliseconds."
},
{
"name": "large_magnitude",
"type": "Uint16",
"comment": "Control of the large controller motor."
},
{
"name": "small_magnitude",
"type": "Uint16",
"comment": "Control of the small controller motor."
}
]
},
{
"name": "SDL_HapticCustom",
"fields": [
{
"name": "_type",
"type": "Uint16",
"comment": "SDL_HAPTIC_CUSTOM"
},
{
"name": "direction",
"type": "SDL_HapticDirection",
"comment": "Direction of the effect."
},
{
"name": "length",
"type": "Uint32",
"comment": "Duration of the effect."
},
{
"name": "delay",
"type": "Uint16",
"comment": "Delay before starting the effect."
},
{
"name": "button",
"type": "Uint16",
"comment": "Button that triggers the effect."
},
{
"name": "interval",
"type": "Uint16",
"comment": "How soon it can be triggered again after button."
},
{
"name": "channels",
"type": "Uint8",
"comment": "Axes to use, minimum of one."
},
{
"name": "period",
"type": "Uint16",
"comment": "Sample periods."
},
{
"name": "samples",
"type": "Uint16",
"comment": "Amount of samples."
},
{
"name": "data",
"type": "Uint16 *",
"comment": "Should contain channels*samples items."
},
{
"name": "attack_length",
"type": "Uint16",
"comment": "Duration of the attack."
},
{
"name": "attack_level",
"type": "Uint16",
"comment": "Level at the start of the attack."
},
{
"name": "fade_length",
"type": "Uint16",
"comment": "Duration of the fade."
},
{
"name": "fade_level",
"type": "Uint16",
"comment": "Level at the end of the fade."
}
]
}
],
"unions": [
{
"name": "SDL_HapticEffect",
"fields": [
{
"name": "_type",
"type": "Uint16",
"comment": "Effect type."
},
{
"name": "constant",
"type": "SDL_HapticConstant",
"comment": "Constant effect."
},
{
"name": "periodic",
"type": "SDL_HapticPeriodic",
"comment": "Periodic effect."
},
{
"name": "condition",
"type": "SDL_HapticCondition",
"comment": "Condition effect."
},
{
"name": "ramp",
"type": "SDL_HapticRamp",
"comment": "Ramp effect."
},
{
"name": "leftright",
"type": "SDL_HapticLeftRight",
"comment": "Left/Right effect."
},
{
"name": "custom",
"type": "SDL_HapticCustom",
"comment": "Custom effect."
}
]
}
],
"flags": [],
"functions": [
{
"name": "SDL_GetHaptics",
"return_type": "SDL_HapticID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetHapticNameForID",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_HapticID"
}
]
},
{
"name": "SDL_OpenHaptic",
"return_type": "SDL_Haptic *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_HapticID"
}
]
},
{
"name": "SDL_GetHapticFromID",
"return_type": "SDL_Haptic *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_HapticID"
}
]
},
{
"name": "SDL_GetHapticID",
"return_type": "SDL_HapticID",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_GetHapticName",
"return_type": "const char *",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_IsMouseHaptic",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_OpenHapticFromMouse",
"return_type": "SDL_Haptic *",
"parameters": []
},
{
"name": "SDL_IsJoystickHaptic",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_OpenHapticFromJoystick",
"return_type": "SDL_Haptic *",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_CloseHaptic",
"return_type": "void",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_GetMaxHapticEffects",
"return_type": "int",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_GetMaxHapticEffectsPlaying",
"return_type": "int",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_GetHapticFeatures",
"return_type": "Uint32",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_GetNumHapticAxes",
"return_type": "int",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_HapticEffectSupported",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "const SDL_HapticEffect *"
}
]
},
{
"name": "SDL_CreateHapticEffect",
"return_type": "int",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "const SDL_HapticEffect *"
}
]
},
{
"name": "SDL_UpdateHapticEffect",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "int"
},
{
"name": "data",
"type": "const SDL_HapticEffect *"
}
]
},
{
"name": "SDL_RunHapticEffect",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "int"
},
{
"name": "iterations",
"type": "Uint32"
}
]
},
{
"name": "SDL_StopHapticEffect",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "int"
}
]
},
{
"name": "SDL_DestroyHapticEffect",
"return_type": "void",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "int"
}
]
},
{
"name": "SDL_GetHapticEffectStatus",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "effect",
"type": "int"
}
]
},
{
"name": "SDL_SetHapticGain",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "gain",
"type": "int"
}
]
},
{
"name": "SDL_SetHapticAutocenter",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "autocenter",
"type": "int"
}
]
},
{
"name": "SDL_PauseHaptic",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_ResumeHaptic",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_StopHapticEffects",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_HapticRumbleSupported",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_InitHapticRumble",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
},
{
"name": "SDL_PlayHapticRumble",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
},
{
"name": "strength",
"type": "float"
},
{
"name": "length",
"type": "Uint32"
}
]
},
{
"name": "SDL_StopHapticRumble",
"return_type": "bool",
"parameters": [
{
"name": "haptic",
"type": "SDL_Haptic *"
}
]
}
]
}

157
lib/sdl3/json/hints.json vendored Normal file
View File

@ -0,0 +1,157 @@
{
"header": "SDL_hints.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [
{
"name": "SDL_HintCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "oldValue",
"type": "const char *"
},
{
"name": "newValue",
"type": "const char *"
}
]
}
],
"enums": [
{
"name": "SDL_HintPriority",
"values": [
{
"name": "SDL_HINT_DEFAULT"
},
{
"name": "SDL_HINT_NORMAL"
},
{
"name": "SDL_HINT_OVERRIDE"
}
]
}
],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_SetHintWithPriority",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "const char *"
},
{
"name": "priority",
"type": "SDL_HintPriority"
}
]
},
{
"name": "SDL_SetHint",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "const char *"
}
]
},
{
"name": "SDL_ResetHint",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_ResetHints",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_GetHint",
"return_type": "const char *",
"parameters": [
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_GetHintBoolean",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "bool"
}
]
},
{
"name": "SDL_AddHintCallback",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "callback",
"type": "SDL_HintCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_RemoveHintCallback",
"return_type": "void",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "callback",
"type": "SDL_HintCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
}
]
}

252
lib/sdl3/json/init.json vendored Normal file
View File

@ -0,0 +1,252 @@
{
"header": "SDL_init.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [
{
"name": "SDL_AppInit_func",
"return_type": "SDL_AppResult",
"parameters": [
{
"name": "appstate",
"type": "void **"
},
{
"name": "argc",
"type": "int"
},
{
"name": "argv",
"type": "char **"
}
]
},
{
"name": "SDL_AppIterate_func",
"return_type": "SDL_AppResult",
"parameters": [
{
"name": "appstate",
"type": "void *"
}
]
},
{
"name": "SDL_AppEvent_func",
"return_type": "SDL_AppResult",
"parameters": [
{
"name": "appstate",
"type": "void *"
},
{
"name": "event",
"type": "SDL_Event *"
}
]
},
{
"name": "SDL_AppQuit_func",
"return_type": "void",
"parameters": [
{
"name": "appstate",
"type": "void *"
},
{
"name": "result",
"type": "SDL_AppResult"
}
]
},
{
"name": "SDL_MainThreadCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
}
]
}
],
"enums": [
{
"name": "SDL_AppResult",
"values": [
{
"name": "SDL_APP_CONTINUE",
"comment": "Value that requests that the app continue from the main callbacks."
},
{
"name": "SDL_APP_SUCCESS",
"comment": "Value that requests termination with success from the main callbacks."
},
{
"name": "SDL_APP_FAILURE",
"comment": "Value that requests termination with error from the main callbacks."
}
]
}
],
"structs": [],
"unions": [],
"flags": [
{
"name": "SDL_InitFlags",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_INIT_AUDIO",
"value": "0x00000010u",
"comment": "`SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS`"
},
{
"name": "SDL_INIT_VIDEO",
"value": "0x00000020u",
"comment": "`SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS`, should be initialized on the main thread"
},
{
"name": "SDL_INIT_JOYSTICK",
"value": "0x00000200u",
"comment": "`SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD"
},
{
"name": "SDL_INIT_HAPTIC",
"value": "0x00001000u"
},
{
"name": "SDL_INIT_GAMEPAD",
"value": "0x00002000u",
"comment": "`SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK`"
},
{
"name": "SDL_INIT_EVENTS",
"value": "0x00004000u"
},
{
"name": "SDL_INIT_SENSOR",
"value": "0x00008000u",
"comment": "`SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS`"
},
{
"name": "SDL_INIT_CAMERA",
"value": "0x00010000u",
"comment": "`SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS`"
}
]
}
],
"functions": [
{
"name": "SDL_Init",
"return_type": "bool",
"parameters": [
{
"name": "flags",
"type": "SDL_InitFlags"
}
]
},
{
"name": "SDL_InitSubSystem",
"return_type": "bool",
"parameters": [
{
"name": "flags",
"type": "SDL_InitFlags"
}
]
},
{
"name": "SDL_QuitSubSystem",
"return_type": "void",
"parameters": [
{
"name": "flags",
"type": "SDL_InitFlags"
}
]
},
{
"name": "SDL_WasInit",
"return_type": "SDL_InitFlags",
"parameters": [
{
"name": "flags",
"type": "SDL_InitFlags"
}
]
},
{
"name": "SDL_Quit",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_IsMainThread",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_RunOnMainThread",
"return_type": "bool",
"parameters": [
{
"name": "callback",
"type": "SDL_MainThreadCallback"
},
{
"name": "userdata",
"type": "void *"
},
{
"name": "wait_complete",
"type": "bool"
}
]
},
{
"name": "SDL_SetAppMetadata",
"return_type": "bool",
"parameters": [
{
"name": "appname",
"type": "const char *"
},
{
"name": "appversion",
"type": "const char *"
},
{
"name": "appidentifier",
"type": "const char *"
}
]
},
{
"name": "SDL_SetAppMetadataProperty",
"return_type": "bool",
"parameters": [
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "const char *"
}
]
},
{
"name": "SDL_GetAppMetadataProperty",
"return_type": "const char *",
"parameters": [
{
"name": "name",
"type": "const char *"
}
]
}
]
}

960
lib/sdl3/json/joystick.json vendored Normal file
View File

@ -0,0 +1,960 @@
{
"header": "SDL_joystick.h",
"opaque_types": [
{
"name": "SDL_Joystick"
}
],
"typedefs": [
{
"name": "SDL_JoystickID",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_JoystickType",
"values": [
{
"name": "SDL_JOYSTICK_TYPE_UNKNOWN"
},
{
"name": "SDL_JOYSTICK_TYPE_GAMEPAD"
},
{
"name": "SDL_JOYSTICK_TYPE_WHEEL"
},
{
"name": "SDL_JOYSTICK_TYPE_ARCADE_STICK"
},
{
"name": "SDL_JOYSTICK_TYPE_FLIGHT_STICK"
},
{
"name": "SDL_JOYSTICK_TYPE_DANCE_PAD"
},
{
"name": "SDL_JOYSTICK_TYPE_GUITAR"
},
{
"name": "SDL_JOYSTICK_TYPE_DRUM_KIT"
},
{
"name": "SDL_JOYSTICK_TYPE_ARCADE_PAD"
},
{
"name": "SDL_JOYSTICK_TYPE_THROTTLE"
},
{
"name": "SDL_JOYSTICK_TYPE_COUNT"
}
]
},
{
"name": "SDL_JoystickConnectionState",
"values": [
{
"name": "SDL_JOYSTICK_CONNECTION_UNKNOWN"
},
{
"name": "SDL_JOYSTICK_CONNECTION_WIRED"
},
{
"name": "SDL_JOYSTICK_CONNECTION_WIRELESS"
}
]
}
],
"structs": [
{
"name": "SDL_VirtualJoystickTouchpadDesc",
"fields": [
{
"name": "nfingers",
"type": "Uint16",
"comment": "the number of simultaneous fingers on this touchpad"
},
{
"name": "padding",
"type": "Uint16[3]"
}
]
},
{
"name": "SDL_VirtualJoystickSensorDesc",
"fields": [
{
"name": "_type",
"type": "SDL_SensorType",
"comment": "the type of this sensor"
},
{
"name": "rate",
"type": "float",
"comment": "the update frequency of this sensor, may be 0.0f"
}
]
},
{
"name": "SDL_VirtualJoystickDesc",
"fields": [
{
"name": "version",
"type": "Uint32",
"comment": "the version of this interface"
},
{
"name": "_type",
"type": "Uint16",
"comment": "`SDL_JoystickType`"
},
{
"name": "padding",
"type": "Uint16",
"comment": "unused"
},
{
"name": "vendor_id",
"type": "Uint16",
"comment": "the USB vendor ID of this joystick"
},
{
"name": "product_id",
"type": "Uint16",
"comment": "the USB product ID of this joystick"
},
{
"name": "naxes",
"type": "Uint16",
"comment": "the number of axes on this joystick"
},
{
"name": "nbuttons",
"type": "Uint16",
"comment": "the number of buttons on this joystick"
},
{
"name": "nballs",
"type": "Uint16",
"comment": "the number of balls on this joystick"
},
{
"name": "nhats",
"type": "Uint16",
"comment": "the number of hats on this joystick"
},
{
"name": "ntouchpads",
"type": "Uint16",
"comment": "the number of touchpads on this joystick, requires `touchpads` to point at valid descriptions"
},
{
"name": "nsensors",
"type": "Uint16",
"comment": "the number of sensors on this joystick, requires `sensors` to point at valid descriptions"
},
{
"name": "padding2",
"type": "Uint16[2]",
"comment": "unused"
},
{
"name": "name",
"type": "const char *",
"comment": "the name of the joystick"
},
{
"name": "touchpads",
"type": "const SDL_VirtualJoystickTouchpadDesc *",
"comment": "A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0"
},
{
"name": "sensors",
"type": "const SDL_VirtualJoystickSensorDesc *",
"comment": "A pointer to an array of sensor descriptions, required if `nsensors` is > 0"
},
{
"name": "userdata",
"type": "void *",
"comment": "User data pointer passed to callbacks"
},
{
"name": "Update",
"type": "void (SDLCALL *Update)(void *userdata)",
"comment": "Called when the joystick state should be updated"
},
{
"name": "SetPlayerIndex",
"type": "void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index)",
"comment": "Called when the player index is set"
},
{
"name": "Rumble",
"type": "bool (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)",
"comment": "Implements SDL_RumbleJoystick()"
},
{
"name": "RumbleTriggers",
"type": "bool (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble)",
"comment": "Implements SDL_RumbleJoystickTriggers()"
},
{
"name": "SetLED",
"type": "bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue)",
"comment": "Implements SDL_SetJoystickLED()"
},
{
"name": "SendEffect",
"type": "bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size)",
"comment": "Implements SDL_SendJoystickEffect()"
},
{
"name": "SetSensorsEnabled",
"type": "bool (SDLCALL *SetSensorsEnabled)(void *userdata, bool enabled)",
"comment": "Implements SDL_SetGamepadSensorEnabled()"
},
{
"name": "Cleanup",
"type": "void (SDLCALL *Cleanup)(void *userdata)",
"comment": "Cleans up the userdata when the joystick is detached"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_LockJoysticks",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_UnlockJoysticks",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_HasJoystick",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_GetJoysticks",
"return_type": "SDL_JoystickID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetJoystickNameForID",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickPathForID",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickPlayerIndexForID",
"return_type": "int",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickGUIDForID",
"return_type": "SDL_GUID",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickVendorForID",
"return_type": "Uint16",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickProductForID",
"return_type": "Uint16",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickProductVersionForID",
"return_type": "Uint16",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickTypeForID",
"return_type": "SDL_JoystickType",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_OpenJoystick",
"return_type": "SDL_Joystick *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickFromID",
"return_type": "SDL_Joystick *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_GetJoystickFromPlayerIndex",
"return_type": "SDL_Joystick *",
"parameters": [
{
"name": "player_index",
"type": "int"
}
]
},
{
"name": "SDL_AttachVirtualJoystick",
"return_type": "SDL_JoystickID",
"parameters": [
{
"name": "desc",
"type": "const SDL_VirtualJoystickDesc *"
}
]
},
{
"name": "SDL_DetachVirtualJoystick",
"return_type": "bool",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_IsJoystickVirtual",
"return_type": "bool",
"parameters": [
{
"name": "instance_id",
"type": "SDL_JoystickID"
}
]
},
{
"name": "SDL_SetJoystickVirtualAxis",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "axis",
"type": "int"
},
{
"name": "value",
"type": "Sint16"
}
]
},
{
"name": "SDL_SetJoystickVirtualBall",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "ball",
"type": "int"
},
{
"name": "xrel",
"type": "Sint16"
},
{
"name": "yrel",
"type": "Sint16"
}
]
},
{
"name": "SDL_SetJoystickVirtualButton",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "button",
"type": "int"
},
{
"name": "down",
"type": "bool"
}
]
},
{
"name": "SDL_SetJoystickVirtualHat",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "hat",
"type": "int"
},
{
"name": "value",
"type": "Uint8"
}
]
},
{
"name": "SDL_SetJoystickVirtualTouchpad",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "touchpad",
"type": "int"
},
{
"name": "finger",
"type": "int"
},
{
"name": "down",
"type": "bool"
},
{
"name": "x",
"type": "float"
},
{
"name": "y",
"type": "float"
},
{
"name": "pressure",
"type": "float"
}
]
},
{
"name": "SDL_SendJoystickVirtualSensorData",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "_type",
"type": "SDL_SensorType"
},
{
"name": "sensor_timestamp",
"type": "Uint64"
},
{
"name": "data",
"type": "const float *"
},
{
"name": "num_values",
"type": "int"
}
]
},
{
"name": "SDL_GetJoystickProperties",
"return_type": "SDL_PropertiesID",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickName",
"return_type": "const char *",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickPath",
"return_type": "const char *",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickPlayerIndex",
"return_type": "int",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_SetJoystickPlayerIndex",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "player_index",
"type": "int"
}
]
},
{
"name": "SDL_GetJoystickGUID",
"return_type": "SDL_GUID",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickVendor",
"return_type": "Uint16",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickProduct",
"return_type": "Uint16",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickProductVersion",
"return_type": "Uint16",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickFirmwareVersion",
"return_type": "Uint16",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickSerial",
"return_type": "const char *",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickType",
"return_type": "SDL_JoystickType",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickGUIDInfo",
"return_type": "void",
"parameters": [
{
"name": "guid",
"type": "SDL_GUID"
},
{
"name": "vendor",
"type": "Uint16 *"
},
{
"name": "product",
"type": "Uint16 *"
},
{
"name": "version",
"type": "Uint16 *"
},
{
"name": "crc16",
"type": "Uint16 *"
}
]
},
{
"name": "SDL_JoystickConnected",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickID",
"return_type": "SDL_JoystickID",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetNumJoystickAxes",
"return_type": "int",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetNumJoystickBalls",
"return_type": "int",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetNumJoystickHats",
"return_type": "int",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetNumJoystickButtons",
"return_type": "int",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_SetJoystickEventsEnabled",
"return_type": "void",
"parameters": [
{
"name": "enabled",
"type": "bool"
}
]
},
{
"name": "SDL_JoystickEventsEnabled",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_UpdateJoysticks",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_GetJoystickAxis",
"return_type": "Sint16",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "axis",
"type": "int"
}
]
},
{
"name": "SDL_GetJoystickAxisInitialState",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "axis",
"type": "int"
},
{
"name": "state",
"type": "Sint16 *"
}
]
},
{
"name": "SDL_GetJoystickBall",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "ball",
"type": "int"
},
{
"name": "dx",
"type": "int *"
},
{
"name": "dy",
"type": "int *"
}
]
},
{
"name": "SDL_GetJoystickHat",
"return_type": "Uint8",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "hat",
"type": "int"
}
]
},
{
"name": "SDL_GetJoystickButton",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "button",
"type": "int"
}
]
},
{
"name": "SDL_RumbleJoystick",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "low_frequency_rumble",
"type": "Uint16"
},
{
"name": "high_frequency_rumble",
"type": "Uint16"
},
{
"name": "duration_ms",
"type": "Uint32"
}
]
},
{
"name": "SDL_RumbleJoystickTriggers",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "left_rumble",
"type": "Uint16"
},
{
"name": "right_rumble",
"type": "Uint16"
},
{
"name": "duration_ms",
"type": "Uint32"
}
]
},
{
"name": "SDL_SetJoystickLED",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "red",
"type": "Uint8"
},
{
"name": "green",
"type": "Uint8"
},
{
"name": "blue",
"type": "Uint8"
}
]
},
{
"name": "SDL_SendJoystickEffect",
"return_type": "bool",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "data",
"type": "const void *"
},
{
"name": "size",
"type": "int"
}
]
},
{
"name": "SDL_CloseJoystick",
"return_type": "void",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickConnectionState",
"return_type": "SDL_JoystickConnectionState",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
}
]
},
{
"name": "SDL_GetJoystickPowerInfo",
"return_type": "SDL_PowerState",
"parameters": [
{
"name": "joystick",
"type": "SDL_Joystick *"
},
{
"name": "percent",
"type": "int *"
}
]
}
]
}

20
lib/sdl3/json/keycode.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"header": "SDL_keycode.h",
"opaque_types": [],
"typedefs": [
{
"name": "SDL_Keycode",
"underlying_type": "Uint32"
},
{
"name": "SDL_Keymod",
"underlying_type": "Uint16"
}
],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": []
}

50
lib/sdl3/json/loadso.json vendored Normal file
View File

@ -0,0 +1,50 @@
{
"header": "SDL_loadso.h",
"opaque_types": [
{
"name": "SDL_SharedObject"
}
],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_LoadObject",
"return_type": "SDL_SharedObject *",
"parameters": [
{
"name": "sofile",
"type": "const char *"
}
]
},
{
"name": "SDL_LoadFunction",
"return_type": "SDL_FunctionPointer",
"parameters": [
{
"name": "handle",
"type": "SDL_SharedObject *"
},
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_UnloadObject",
"return_type": "void",
"parameters": [
{
"name": "handle",
"type": "SDL_SharedObject *"
}
]
}
]
}

204
lib/sdl3/json/messagebox.json vendored Normal file
View File

@ -0,0 +1,204 @@
{
"header": "SDL_messagebox.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [
{
"name": "SDL_MessageBoxColorType",
"values": [
{
"name": "SDL_MESSAGEBOX_COLOR_BACKGROUND"
},
{
"name": "SDL_MESSAGEBOX_COLOR_TEXT"
},
{
"name": "SDL_MESSAGEBOX_COLOR_BUTTON_BORDER"
},
{
"name": "SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND"
},
{
"name": "SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED"
},
{
"name": "SDL_MESSAGEBOX_COLOR_COUNT",
"comment": "Size of the colors array of SDL_MessageBoxColorScheme."
}
]
}
],
"structs": [
{
"name": "SDL_MessageBoxButtonData",
"fields": [
{
"name": "flags",
"type": "SDL_MessageBoxButtonFlags"
},
{
"name": "buttonID",
"type": "int",
"comment": "User defined button id (value returned via SDL_ShowMessageBox)"
},
{
"name": "text",
"type": "const char *",
"comment": "The UTF-8 button text"
}
]
},
{
"name": "SDL_MessageBoxColor",
"fields": [
{
"name": "r",
"type": "Uint8"
},
{
"name": "g",
"type": "Uint8"
},
{
"name": "b",
"type": "Uint8"
}
]
},
{
"name": "SDL_MessageBoxColorScheme",
"fields": [
{
"name": "colors",
"type": "SDL_MessageBoxColor[SDL_MESSAGEBOX_COLOR_COUNT]"
}
]
},
{
"name": "SDL_MessageBoxData",
"fields": [
{
"name": "flags",
"type": "SDL_MessageBoxFlags"
},
{
"name": "window",
"type": "SDL_Window *",
"comment": "Parent window, can be NULL"
},
{
"name": "title",
"type": "const char *",
"comment": "UTF-8 title"
},
{
"name": "message",
"type": "const char *",
"comment": "UTF-8 message text"
},
{
"name": "numbuttons",
"type": "int"
},
{
"name": "buttons",
"type": "const SDL_MessageBoxButtonData *"
},
{
"name": "colorScheme",
"type": "const SDL_MessageBoxColorScheme *",
"comment": "SDL_MessageBoxColorScheme, can be NULL to use system settings"
}
]
}
],
"unions": [],
"flags": [
{
"name": "SDL_MessageBoxFlags",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_MESSAGEBOX_ERROR",
"value": "0x00000010u",
"comment": "error dialog"
},
{
"name": "SDL_MESSAGEBOX_WARNING",
"value": "0x00000020u",
"comment": "warning dialog"
},
{
"name": "SDL_MESSAGEBOX_INFORMATION",
"value": "0x00000040u",
"comment": "informational dialog"
},
{
"name": "SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT",
"value": "0x00000080u",
"comment": "buttons placed left to right"
},
{
"name": "SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT",
"value": "0x00000100u",
"comment": "buttons placed right to left"
}
]
},
{
"name": "SDL_MessageBoxButtonFlags",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT",
"value": "0x00000001u",
"comment": "Marks the default button when return is hit"
},
{
"name": "SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT",
"value": "0x00000002u",
"comment": "Marks the default button when escape is hit"
}
]
}
],
"functions": [
{
"name": "SDL_ShowMessageBox",
"return_type": "bool",
"parameters": [
{
"name": "messageboxdata",
"type": "const SDL_MessageBoxData *"
},
{
"name": "buttonid",
"type": "int *"
}
]
},
{
"name": "SDL_ShowSimpleMessageBox",
"return_type": "bool",
"parameters": [
{
"name": "flags",
"type": "SDL_MessageBoxFlags"
},
{
"name": "title",
"type": "const char *"
},
{
"name": "message",
"type": "const char *"
},
{
"name": "window",
"type": "SDL_Window *"
}
]
}
]
}

22
lib/sdl3/json/misc.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"header": "SDL_misc.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_OpenURL",
"return_type": "bool",
"parameters": [
{
"name": "url",
"type": "const char *"
}
]
}
]
}

391
lib/sdl3/json/mouse.json vendored Normal file
View File

@ -0,0 +1,391 @@
{
"header": "SDL_mouse.h",
"opaque_types": [
{
"name": "SDL_Cursor"
}
],
"typedefs": [
{
"name": "SDL_MouseID",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_SystemCursor",
"values": [
{
"name": "SDL_SYSTEM_CURSOR_DEFAULT",
"comment": "Default cursor. Usually an arrow."
},
{
"name": "SDL_SYSTEM_CURSOR_TEXT",
"comment": "Text selection. Usually an I-beam."
},
{
"name": "SDL_SYSTEM_CURSOR_WAIT",
"comment": "Wait. Usually an hourglass or watch or spinning ball."
},
{
"name": "SDL_SYSTEM_CURSOR_CROSSHAIR",
"comment": "Crosshair."
},
{
"name": "SDL_SYSTEM_CURSOR_PROGRESS",
"comment": "Program is busy but still interactive. Usually it's WAIT with an arrow."
},
{
"name": "SDL_SYSTEM_CURSOR_NWSE_RESIZE",
"comment": "Double arrow pointing northwest and southeast."
},
{
"name": "SDL_SYSTEM_CURSOR_NESW_RESIZE",
"comment": "Double arrow pointing northeast and southwest."
},
{
"name": "SDL_SYSTEM_CURSOR_EW_RESIZE",
"comment": "Double arrow pointing west and east."
},
{
"name": "SDL_SYSTEM_CURSOR_NS_RESIZE",
"comment": "Double arrow pointing north and south."
},
{
"name": "SDL_SYSTEM_CURSOR_MOVE",
"comment": "Four pointed arrow pointing north, south, east, and west."
},
{
"name": "SDL_SYSTEM_CURSOR_NOT_ALLOWED",
"comment": "Not permitted. Usually a slashed circle or crossbones."
},
{
"name": "SDL_SYSTEM_CURSOR_POINTER",
"comment": "Pointer that indicates a link. Usually a pointing hand."
},
{
"name": "SDL_SYSTEM_CURSOR_NW_RESIZE",
"comment": "Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_N_RESIZE",
"comment": "Window resize top. May be NS_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_NE_RESIZE",
"comment": "Window resize top-right. May be NESW_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_E_RESIZE",
"comment": "Window resize right. May be EW_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_SE_RESIZE",
"comment": "Window resize bottom-right. May be NWSE_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_S_RESIZE",
"comment": "Window resize bottom. May be NS_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_SW_RESIZE",
"comment": "Window resize bottom-left. May be NESW_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_W_RESIZE",
"comment": "Window resize left. May be EW_RESIZE."
},
{
"name": "SDL_SYSTEM_CURSOR_COUNT"
}
]
},
{
"name": "SDL_MouseWheelDirection",
"values": [
{
"name": "SDL_MOUSEWHEEL_NORMAL",
"comment": "The scroll direction is normal"
},
{
"name": "SDL_MOUSEWHEEL_FLIPPED",
"comment": "The scroll direction is flipped / natural"
}
]
}
],
"structs": [],
"unions": [],
"flags": [
{
"name": "SDL_MouseButtonFlags",
"underlying_type": "Uint32",
"values": [
{
"name": "SDL_BUTTON_LEFT",
"value": "1"
},
{
"name": "SDL_BUTTON_MIDDLE",
"value": "2"
},
{
"name": "SDL_BUTTON_RIGHT",
"value": "3"
},
{
"name": "SDL_BUTTON_X1",
"value": "4"
},
{
"name": "SDL_BUTTON_X2",
"value": "5"
}
]
}
],
"functions": [
{
"name": "SDL_HasMouse",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_GetMice",
"return_type": "SDL_MouseID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetMouseNameForID",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_MouseID"
}
]
},
{
"name": "SDL_GetMouseFocus",
"return_type": "SDL_Window *",
"parameters": []
},
{
"name": "SDL_GetMouseState",
"return_type": "SDL_MouseButtonFlags",
"parameters": [
{
"name": "x",
"type": "float *"
},
{
"name": "y",
"type": "float *"
}
]
},
{
"name": "SDL_GetGlobalMouseState",
"return_type": "SDL_MouseButtonFlags",
"parameters": [
{
"name": "x",
"type": "float *"
},
{
"name": "y",
"type": "float *"
}
]
},
{
"name": "SDL_GetRelativeMouseState",
"return_type": "SDL_MouseButtonFlags",
"parameters": [
{
"name": "x",
"type": "float *"
},
{
"name": "y",
"type": "float *"
}
]
},
{
"name": "SDL_WarpMouseInWindow",
"return_type": "void",
"parameters": [
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "x",
"type": "float"
},
{
"name": "y",
"type": "float"
}
]
},
{
"name": "SDL_WarpMouseGlobal",
"return_type": "bool",
"parameters": [
{
"name": "x",
"type": "float"
},
{
"name": "y",
"type": "float"
}
]
},
{
"name": "SDL_SetWindowRelativeMouseMode",
"return_type": "bool",
"parameters": [
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "enabled",
"type": "bool"
}
]
},
{
"name": "SDL_GetWindowRelativeMouseMode",
"return_type": "bool",
"parameters": [
{
"name": "window",
"type": "SDL_Window *"
}
]
},
{
"name": "SDL_CaptureMouse",
"return_type": "bool",
"parameters": [
{
"name": "enabled",
"type": "bool"
}
]
},
{
"name": "SDL_CreateCursor",
"return_type": "SDL_Cursor *",
"parameters": [
{
"name": "data",
"type": "const Uint8 *"
},
{
"name": "mask",
"type": "const Uint8 *"
},
{
"name": "w",
"type": "int"
},
{
"name": "h",
"type": "int"
},
{
"name": "hot_x",
"type": "int"
},
{
"name": "hot_y",
"type": "int"
}
]
},
{
"name": "SDL_CreateColorCursor",
"return_type": "SDL_Cursor *",
"parameters": [
{
"name": "surface",
"type": "SDL_Surface *"
},
{
"name": "hot_x",
"type": "int"
},
{
"name": "hot_y",
"type": "int"
}
]
},
{
"name": "SDL_CreateSystemCursor",
"return_type": "SDL_Cursor *",
"parameters": [
{
"name": "id",
"type": "SDL_SystemCursor"
}
]
},
{
"name": "SDL_SetCursor",
"return_type": "bool",
"parameters": [
{
"name": "cursor",
"type": "SDL_Cursor *"
}
]
},
{
"name": "SDL_GetCursor",
"return_type": "SDL_Cursor *",
"parameters": []
},
{
"name": "SDL_GetDefaultCursor",
"return_type": "SDL_Cursor *",
"parameters": []
},
{
"name": "SDL_DestroyCursor",
"return_type": "void",
"parameters": [
{
"name": "cursor",
"type": "SDL_Cursor *"
}
]
},
{
"name": "SDL_ShowCursor",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_HideCursor",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_CursorVisible",
"return_type": "bool",
"parameters": []
}
]
}

920
lib/sdl3/json/pixels.json vendored Normal file
View File

@ -0,0 +1,920 @@
{
"header": "SDL_pixels.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [
{
"name": "SDL_PixelType",
"values": [
{
"name": "SDL_PIXELTYPE_UNKNOWN"
},
{
"name": "SDL_PIXELTYPE_INDEX1"
},
{
"name": "SDL_PIXELTYPE_INDEX4"
},
{
"name": "SDL_PIXELTYPE_INDEX8"
},
{
"name": "SDL_PIXELTYPE_PACKED8"
},
{
"name": "SDL_PIXELTYPE_PACKED16"
},
{
"name": "SDL_PIXELTYPE_PACKED32"
},
{
"name": "SDL_PIXELTYPE_ARRAYU8"
},
{
"name": "SDL_PIXELTYPE_ARRAYU16"
},
{
"name": "SDL_PIXELTYPE_ARRAYU32"
},
{
"name": "SDL_PIXELTYPE_ARRAYF16"
},
{
"name": "SDL_PIXELTYPE_ARRAYF32"
},
{
"name": "SDL_PIXELTYPE_INDEX2"
}
]
},
{
"name": "SDL_BitmapOrder",
"values": [
{
"name": "SDL_BITMAPORDER_NONE"
},
{
"name": "SDL_BITMAPORDER_4321"
},
{
"name": "SDL_BITMAPORDER_1234"
}
]
},
{
"name": "SDL_PackedOrder",
"values": [
{
"name": "SDL_PACKEDORDER_NONE"
},
{
"name": "SDL_PACKEDORDER_XRGB"
},
{
"name": "SDL_PACKEDORDER_RGBX"
},
{
"name": "SDL_PACKEDORDER_ARGB"
},
{
"name": "SDL_PACKEDORDER_RGBA"
},
{
"name": "SDL_PACKEDORDER_XBGR"
},
{
"name": "SDL_PACKEDORDER_BGRX"
},
{
"name": "SDL_PACKEDORDER_ABGR"
},
{
"name": "SDL_PACKEDORDER_BGRA"
}
]
},
{
"name": "SDL_ArrayOrder",
"values": [
{
"name": "SDL_ARRAYORDER_NONE"
},
{
"name": "SDL_ARRAYORDER_RGB"
},
{
"name": "SDL_ARRAYORDER_RGBA"
},
{
"name": "SDL_ARRAYORDER_ARGB"
},
{
"name": "SDL_ARRAYORDER_BGR"
},
{
"name": "SDL_ARRAYORDER_BGRA"
},
{
"name": "SDL_ARRAYORDER_ABGR"
}
]
},
{
"name": "SDL_PackedLayout",
"values": [
{
"name": "SDL_PACKEDLAYOUT_NONE"
},
{
"name": "SDL_PACKEDLAYOUT_332"
},
{
"name": "SDL_PACKEDLAYOUT_4444"
},
{
"name": "SDL_PACKEDLAYOUT_1555"
},
{
"name": "SDL_PACKEDLAYOUT_5551"
},
{
"name": "SDL_PACKEDLAYOUT_565"
},
{
"name": "SDL_PACKEDLAYOUT_8888"
},
{
"name": "SDL_PACKEDLAYOUT_2101010"
},
{
"name": "SDL_PACKEDLAYOUT_1010102"
}
]
},
{
"name": "SDL_PixelFormat",
"values": [
{
"name": "SDL_PIXELFORMAT_YV12",
"value": "0x32315659u",
"comment": "Planar mode: Y + V + U (3 planes)"
},
{
"name": "SDL_PIXELFORMAT_IYUV",
"value": "0x56555949u",
"comment": "Planar mode: Y + U + V (3 planes)"
},
{
"name": "SDL_PIXELFORMAT_YUY2",
"value": "0x32595559u",
"comment": "Packed mode: Y0+U0+Y1+V0 (1 plane)"
},
{
"name": "SDL_PIXELFORMAT_UYVY",
"value": "0x59565955u",
"comment": "Packed mode: U0+Y0+V0+Y1 (1 plane)"
},
{
"name": "SDL_PIXELFORMAT_YVYU",
"value": "0x55595659u",
"comment": "Packed mode: Y0+V0+Y1+U0 (1 plane)"
},
{
"name": "SDL_PIXELFORMAT_NV12",
"value": "0x3231564eu",
"comment": "Planar mode: Y + U/V interleaved (2 planes)"
},
{
"name": "SDL_PIXELFORMAT_NV21",
"value": "0x3132564eu",
"comment": "Planar mode: Y + V/U interleaved (2 planes)"
},
{
"name": "SDL_PIXELFORMAT_P010",
"value": "0x30313050u",
"comment": "Planar mode: Y + U/V interleaved (2 planes)"
},
{
"name": "SDL_PIXELFORMAT_EXTERNAL_OES",
"value": "0x2053454fu",
"comment": "Android video texture format"
},
{
"name": "SDL_PIXELFORMAT_MJPG",
"value": "0x47504a4du",
"comment": "Motion JPEG"
}
]
},
{
"name": "SDL_ColorType",
"values": []
},
{
"name": "SDL_ColorRange",
"values": [
{
"name": "SDL_COLOR_RANGE_LIMITED",
"value": "1",
"comment": "Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma"
},
{
"name": "SDL_COLOR_RANGE_FULL",
"value": "2"
}
]
},
{
"name": "SDL_ColorPrimaries",
"values": [
{
"name": "SDL_COLOR_PRIMARIES_BT709",
"value": "1",
"comment": "ITU-R BT.709-6"
},
{
"name": "SDL_COLOR_PRIMARIES_BT470M",
"value": "4",
"comment": "ITU-R BT.470-6 System M"
},
{
"name": "SDL_COLOR_PRIMARIES_BT470BG",
"value": "5",
"comment": "ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625"
},
{
"name": "SDL_COLOR_PRIMARIES_BT601",
"value": "6",
"comment": "ITU-R BT.601-7 525, SMPTE 170M"
},
{
"name": "SDL_COLOR_PRIMARIES_SMPTE240",
"value": "7",
"comment": "SMPTE 240M, functionally the same as SDL_COLOR_PRIMARIES_BT601"
},
{
"name": "SDL_COLOR_PRIMARIES_GENERIC_FILM",
"value": "8",
"comment": "Generic film (color filters using Illuminant C)"
},
{
"name": "SDL_COLOR_PRIMARIES_BT2020",
"value": "9",
"comment": "ITU-R BT.2020-2 / ITU-R BT.2100-0"
},
{
"name": "SDL_COLOR_PRIMARIES_XYZ",
"value": "10",
"comment": "SMPTE ST 428-1"
},
{
"name": "SDL_COLOR_PRIMARIES_SMPTE431",
"value": "11",
"comment": "SMPTE RP 431-2"
},
{
"name": "SDL_COLOR_PRIMARIES_SMPTE432",
"value": "12",
"comment": "SMPTE EG 432-1 / DCI P3"
},
{
"name": "SDL_COLOR_PRIMARIES_EBU3213",
"value": "22",
"comment": "EBU Tech. 3213-E"
}
]
},
{
"name": "SDL_TransferCharacteristics",
"values": [
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT709",
"value": "1",
"comment": "Rec. ITU-R BT.709-6 / ITU-R BT1361"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_GAMMA22",
"value": "4",
"comment": "ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_GAMMA28",
"value": "5",
"comment": "ITU-R BT.470-6 System B, G"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT601",
"value": "6",
"comment": "SMPTE ST 170M / ITU-R BT.601-7 525 or 625"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_SMPTE240",
"value": "7",
"comment": "SMPTE ST 240M"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_IEC61966",
"value": "11",
"comment": "IEC 61966-2-4"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT1361",
"value": "12",
"comment": "ITU-R BT1361 Extended Colour Gamut"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_SRGB",
"value": "13",
"comment": "IEC 61966-2-1 (sRGB or sYCC)"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT",
"value": "14",
"comment": "ITU-R BT2020 for 10-bit system"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT",
"value": "15",
"comment": "ITU-R BT2020 for 12-bit system"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_PQ",
"value": "16",
"comment": "SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_SMPTE428",
"value": "17",
"comment": "SMPTE ST 428-1"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_HLG",
"value": "18",
"comment": "ARIB STD-B67, known as \"hybrid log-gamma\" (HLG)"
}
]
},
{
"name": "SDL_MatrixCoefficients",
"values": [
{
"name": "SDL_MATRIX_COEFFICIENTS_BT709",
"value": "1",
"comment": "ITU-R BT.709-6"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_FCC",
"value": "4",
"comment": "US FCC Title 47"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT470BG",
"value": "5",
"comment": "ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as SDL_MATRIX_COEFFICIENTS_BT601"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT601",
"value": "6",
"comment": "ITU-R BT.601-7 525"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_SMPTE240",
"value": "7",
"comment": "SMPTE 240M"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT2020_NCL",
"value": "9",
"comment": "ITU-R BT.2020-2 non-constant luminance"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT2020_CL",
"value": "10",
"comment": "ITU-R BT.2020-2 constant luminance"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_SMPTE2085",
"value": "11",
"comment": "SMPTE ST 2085"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_ICTCP",
"value": "14",
"comment": "ITU-R BT.2100-0 ICTCP"
}
]
},
{
"name": "SDL_ChromaLocation",
"values": [
{
"name": "SDL_CHROMA_LOCATION_NONE",
"value": "0",
"comment": "RGB, no chroma sampling"
},
{
"name": "SDL_CHROMA_LOCATION_LEFT",
"value": "1",
"comment": "In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically."
},
{
"name": "SDL_CHROMA_LOCATION_CENTER",
"value": "2",
"comment": "In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel."
},
{
"name": "SDL_CHROMA_LOCATION_TOPLEFT",
"value": "3"
}
]
},
{
"name": "SDL_Colorspace",
"values": [
{
"name": "SDL_COLORSPACE_SRGB",
"value": "0x120005a0u",
"comment": "Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709"
},
{
"name": "SDL_COLOR_RANGE_FULL"
},
{
"name": "SDL_COLOR_PRIMARIES_BT709"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_SRGB"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_IDENTITY"
},
{
"name": "SDL_COLORSPACE_SRGB_LINEAR",
"value": "0x12000500u",
"comment": "Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_LINEAR"
},
{
"name": "SDL_COLORSPACE_HDR10",
"value": "0x12002600u",
"comment": "Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020"
},
{
"name": "SDL_COLOR_PRIMARIES_BT2020"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_PQ"
},
{
"name": "SDL_COLORSPACE_JPEG",
"value": "0x220004c6u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT601"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT601"
},
{
"name": "SDL_COLORSPACE_BT601_LIMITED",
"value": "0x211018c6u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601"
},
{
"name": "SDL_COLOR_RANGE_LIMITED"
},
{
"name": "SDL_COLOR_PRIMARIES_BT601"
},
{
"name": "SDL_COLORSPACE_BT601_FULL",
"value": "0x221018c6u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601"
},
{
"name": "SDL_COLORSPACE_BT709_LIMITED",
"value": "0x21100421u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709"
},
{
"name": "SDL_TRANSFER_CHARACTERISTICS_BT709"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT709"
},
{
"name": "SDL_COLORSPACE_BT709_FULL",
"value": "0x22100421u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709"
},
{
"name": "SDL_COLORSPACE_BT2020_LIMITED",
"value": "0x21102609u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020"
},
{
"name": "SDL_MATRIX_COEFFICIENTS_BT2020_NCL"
},
{
"name": "SDL_COLORSPACE_BT2020_FULL",
"value": "0x22102609u",
"comment": "Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020"
},
{
"name": "SDL_COLORSPACE_RGB_DEFAULT",
"value": "SDL_COLORSPACE_SRGB",
"comment": "The default colorspace for RGB surfaces if no colorspace is specified"
},
{
"name": "SDL_COLORSPACE_YUV_DEFAULT",
"value": "SDL_COLORSPACE_JPEG",
"comment": "The default colorspace for YUV surfaces if no colorspace is specified"
}
]
}
],
"structs": [
{
"name": "SDL_Color",
"fields": [
{
"name": "r",
"type": "Uint8"
},
{
"name": "g",
"type": "Uint8"
},
{
"name": "b",
"type": "Uint8"
},
{
"name": "a",
"type": "Uint8"
}
]
},
{
"name": "SDL_FColor",
"fields": [
{
"name": "r",
"type": "float"
},
{
"name": "g",
"type": "float"
},
{
"name": "b",
"type": "float"
},
{
"name": "a",
"type": "float"
}
]
},
{
"name": "SDL_Palette",
"fields": [
{
"name": "ncolors",
"type": "int",
"comment": "number of elements in `colors`."
},
{
"name": "colors",
"type": "SDL_Color *",
"comment": "an array of colors, `ncolors` long."
},
{
"name": "version",
"type": "Uint32",
"comment": "internal use only, do not touch."
},
{
"name": "refcount",
"type": "int",
"comment": "internal use only, do not touch."
}
]
},
{
"name": "SDL_PixelFormatDetails",
"fields": [
{
"name": "format",
"type": "SDL_PixelFormat"
},
{
"name": "bits_per_pixel",
"type": "Uint8"
},
{
"name": "bytes_per_pixel",
"type": "Uint8"
},
{
"name": "padding",
"type": "Uint8[2]"
},
{
"name": "Rmask",
"type": "Uint32"
},
{
"name": "Gmask",
"type": "Uint32"
},
{
"name": "Bmask",
"type": "Uint32"
},
{
"name": "Amask",
"type": "Uint32"
},
{
"name": "Rbits",
"type": "Uint8"
},
{
"name": "Gbits",
"type": "Uint8"
},
{
"name": "Bbits",
"type": "Uint8"
},
{
"name": "Abits",
"type": "Uint8"
},
{
"name": "Rshift",
"type": "Uint8"
},
{
"name": "Gshift",
"type": "Uint8"
},
{
"name": "Bshift",
"type": "Uint8"
},
{
"name": "Ashift",
"type": "Uint8"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetPixelFormatName",
"return_type": "const char *",
"parameters": [
{
"name": "format",
"type": "SDL_PixelFormat"
}
]
},
{
"name": "SDL_GetMasksForPixelFormat",
"return_type": "bool",
"parameters": [
{
"name": "format",
"type": "SDL_PixelFormat"
},
{
"name": "bpp",
"type": "int *"
},
{
"name": "Rmask",
"type": "Uint32 *"
},
{
"name": "Gmask",
"type": "Uint32 *"
},
{
"name": "Bmask",
"type": "Uint32 *"
},
{
"name": "Amask",
"type": "Uint32 *"
}
]
},
{
"name": "SDL_GetPixelFormatForMasks",
"return_type": "SDL_PixelFormat",
"parameters": [
{
"name": "bpp",
"type": "int"
},
{
"name": "Rmask",
"type": "Uint32"
},
{
"name": "Gmask",
"type": "Uint32"
},
{
"name": "Bmask",
"type": "Uint32"
},
{
"name": "Amask",
"type": "Uint32"
}
]
},
{
"name": "SDL_GetPixelFormatDetails",
"return_type": "const SDL_PixelFormatDetails *",
"parameters": [
{
"name": "format",
"type": "SDL_PixelFormat"
}
]
},
{
"name": "SDL_CreatePalette",
"return_type": "SDL_Palette *",
"parameters": [
{
"name": "ncolors",
"type": "int"
}
]
},
{
"name": "SDL_SetPaletteColors",
"return_type": "bool",
"parameters": [
{
"name": "palette",
"type": "SDL_Palette *"
},
{
"name": "colors",
"type": "const SDL_Color *"
},
{
"name": "firstcolor",
"type": "int"
},
{
"name": "ncolors",
"type": "int"
}
]
},
{
"name": "SDL_DestroyPalette",
"return_type": "void",
"parameters": [
{
"name": "palette",
"type": "SDL_Palette *"
}
]
},
{
"name": "SDL_MapRGB",
"return_type": "Uint32",
"parameters": [
{
"name": "format",
"type": "const SDL_PixelFormatDetails *"
},
{
"name": "palette",
"type": "const SDL_Palette *"
},
{
"name": "r",
"type": "Uint8"
},
{
"name": "g",
"type": "Uint8"
},
{
"name": "b",
"type": "Uint8"
}
]
},
{
"name": "SDL_MapRGBA",
"return_type": "Uint32",
"parameters": [
{
"name": "format",
"type": "const SDL_PixelFormatDetails *"
},
{
"name": "palette",
"type": "const SDL_Palette *"
},
{
"name": "r",
"type": "Uint8"
},
{
"name": "g",
"type": "Uint8"
},
{
"name": "b",
"type": "Uint8"
},
{
"name": "a",
"type": "Uint8"
}
]
},
{
"name": "SDL_GetRGB",
"return_type": "void",
"parameters": [
{
"name": "pixel",
"type": "Uint32"
},
{
"name": "format",
"type": "const SDL_PixelFormatDetails *"
},
{
"name": "palette",
"type": "const SDL_Palette *"
},
{
"name": "r",
"type": "Uint8 *"
},
{
"name": "g",
"type": "Uint8 *"
},
{
"name": "b",
"type": "Uint8 *"
}
]
},
{
"name": "SDL_GetRGBA",
"return_type": "void",
"parameters": [
{
"name": "pixel",
"type": "Uint32"
},
{
"name": "format",
"type": "const SDL_PixelFormatDetails *"
},
{
"name": "palette",
"type": "const SDL_Palette *"
},
{
"name": "r",
"type": "Uint8 *"
},
{
"name": "g",
"type": "Uint8 *"
},
{
"name": "b",
"type": "Uint8 *"
},
{
"name": "a",
"type": "Uint8 *"
}
]
}
]
}

394
lib/sdl3/json/properties.json vendored Normal file
View File

@ -0,0 +1,394 @@
{
"header": "SDL_properties.h",
"opaque_types": [],
"typedefs": [
{
"name": "SDL_PropertiesID",
"underlying_type": "Uint32"
}
],
"function_pointers": [
{
"name": "SDL_CleanupPropertyCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "value",
"type": "void *"
}
]
},
{
"name": "SDL_EnumeratePropertiesCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
}
]
}
],
"enums": [
{
"name": "SDL_PropertyType",
"values": [
{
"name": "SDL_PROPERTY_TYPE_INVALID"
},
{
"name": "SDL_PROPERTY_TYPE_POINTER"
},
{
"name": "SDL_PROPERTY_TYPE_STRING"
},
{
"name": "SDL_PROPERTY_TYPE_NUMBER"
},
{
"name": "SDL_PROPERTY_TYPE_FLOAT"
},
{
"name": "SDL_PROPERTY_TYPE_BOOLEAN"
}
]
}
],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetGlobalProperties",
"return_type": "SDL_PropertiesID",
"parameters": []
},
{
"name": "SDL_CreateProperties",
"return_type": "SDL_PropertiesID",
"parameters": []
},
{
"name": "SDL_CopyProperties",
"return_type": "bool",
"parameters": [
{
"name": "src",
"type": "SDL_PropertiesID"
},
{
"name": "dst",
"type": "SDL_PropertiesID"
}
]
},
{
"name": "SDL_LockProperties",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
},
{
"name": "SDL_UnlockProperties",
"return_type": "void",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
},
{
"name": "SDL_SetPointerPropertyWithCleanup",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "void *"
},
{
"name": "cleanup",
"type": "SDL_CleanupPropertyCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_SetPointerProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "void *"
}
]
},
{
"name": "SDL_SetStringProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "const char *"
}
]
},
{
"name": "SDL_SetNumberProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "Sint64"
}
]
},
{
"name": "SDL_SetFloatProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "float"
}
]
},
{
"name": "SDL_SetBooleanProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "value",
"type": "bool"
}
]
},
{
"name": "SDL_HasProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_GetPropertyType",
"return_type": "SDL_PropertyType",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_GetPointerProperty",
"return_type": "void *",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "void *"
}
]
},
{
"name": "SDL_GetStringProperty",
"return_type": "const char *",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "const char *"
}
]
},
{
"name": "SDL_GetNumberProperty",
"return_type": "Sint64",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "Sint64"
}
]
},
{
"name": "SDL_GetFloatProperty",
"return_type": "float",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "float"
}
]
},
{
"name": "SDL_GetBooleanProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
},
{
"name": "default_value",
"type": "bool"
}
]
},
{
"name": "SDL_ClearProperty",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "name",
"type": "const char *"
}
]
},
{
"name": "SDL_EnumerateProperties",
"return_type": "bool",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
},
{
"name": "callback",
"type": "SDL_EnumeratePropertiesCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_DestroyProperties",
"return_type": "void",
"parameters": [
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
}
]
}

277
lib/sdl3/json/rect.json vendored Normal file
View File

@ -0,0 +1,277 @@
{
"header": "SDL_rect.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [
{
"name": "SDL_Point",
"fields": [
{
"name": "x",
"type": "int"
},
{
"name": "y",
"type": "int"
}
]
},
{
"name": "SDL_FPoint",
"fields": [
{
"name": "x",
"type": "float"
},
{
"name": "y",
"type": "float"
}
]
},
{
"name": "SDL_Rect",
"fields": [
{
"name": "x",
"type": "int"
},
{
"name": "y",
"type": "int"
},
{
"name": "w",
"type": "int"
},
{
"name": "h",
"type": "int"
}
]
},
{
"name": "SDL_FRect",
"fields": [
{
"name": "x",
"type": "float"
},
{
"name": "y",
"type": "float"
},
{
"name": "w",
"type": "float"
},
{
"name": "h",
"type": "float"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_HasRectIntersection",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_Rect *"
},
{
"name": "B",
"type": "const SDL_Rect *"
}
]
},
{
"name": "SDL_GetRectIntersection",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_Rect *"
},
{
"name": "B",
"type": "const SDL_Rect *"
},
{
"name": "result",
"type": "SDL_Rect *"
}
]
},
{
"name": "SDL_GetRectUnion",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_Rect *"
},
{
"name": "B",
"type": "const SDL_Rect *"
},
{
"name": "result",
"type": "SDL_Rect *"
}
]
},
{
"name": "SDL_GetRectEnclosingPoints",
"return_type": "bool",
"parameters": [
{
"name": "points",
"type": "const SDL_Point *"
},
{
"name": "count",
"type": "int"
},
{
"name": "clip",
"type": "const SDL_Rect *"
},
{
"name": "result",
"type": "SDL_Rect *"
}
]
},
{
"name": "SDL_GetRectAndLineIntersection",
"return_type": "bool",
"parameters": [
{
"name": "rect",
"type": "const SDL_Rect *"
},
{
"name": "X1",
"type": "int *"
},
{
"name": "Y1",
"type": "int *"
},
{
"name": "X2",
"type": "int *"
},
{
"name": "Y2",
"type": "int *"
}
]
},
{
"name": "SDL_HasRectIntersectionFloat",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_FRect *"
},
{
"name": "B",
"type": "const SDL_FRect *"
}
]
},
{
"name": "SDL_GetRectIntersectionFloat",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_FRect *"
},
{
"name": "B",
"type": "const SDL_FRect *"
},
{
"name": "result",
"type": "SDL_FRect *"
}
]
},
{
"name": "SDL_GetRectUnionFloat",
"return_type": "bool",
"parameters": [
{
"name": "A",
"type": "const SDL_FRect *"
},
{
"name": "B",
"type": "const SDL_FRect *"
},
{
"name": "result",
"type": "SDL_FRect *"
}
]
},
{
"name": "SDL_GetRectEnclosingPointsFloat",
"return_type": "bool",
"parameters": [
{
"name": "points",
"type": "const SDL_FPoint *"
},
{
"name": "count",
"type": "int"
},
{
"name": "clip",
"type": "const SDL_FRect *"
},
{
"name": "result",
"type": "SDL_FRect *"
}
]
},
{
"name": "SDL_GetRectAndLineIntersectionFloat",
"return_type": "bool",
"parameters": [
{
"name": "rect",
"type": "const SDL_FRect *"
},
{
"name": "X1",
"type": "float *"
},
{
"name": "Y1",
"type": "float *"
},
{
"name": "X2",
"type": "float *"
},
{
"name": "Y2",
"type": "float *"
}
]
}
]
}

1668
lib/sdl3/json/render.json vendored Normal file

File diff suppressed because it is too large Load Diff

203
lib/sdl3/json/sensor.json vendored Normal file
View File

@ -0,0 +1,203 @@
{
"header": "SDL_sensor.h",
"opaque_types": [
{
"name": "SDL_Sensor"
}
],
"typedefs": [
{
"name": "SDL_SensorID",
"underlying_type": "Uint32"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_SensorType",
"values": [
{
"name": "SDL_SENSOR_INVALID",
"value": "-1",
"comment": "Returned for an invalid sensor"
},
{
"name": "SDL_SENSOR_UNKNOWN",
"comment": "Unknown sensor type"
},
{
"name": "SDL_SENSOR_ACCEL",
"comment": "Accelerometer"
},
{
"name": "SDL_SENSOR_GYRO",
"comment": "Gyroscope"
},
{
"name": "SDL_SENSOR_ACCEL_L",
"comment": "Accelerometer for left Joy-Con controller and Wii nunchuk"
},
{
"name": "SDL_SENSOR_GYRO_L",
"comment": "Gyroscope for left Joy-Con controller"
},
{
"name": "SDL_SENSOR_ACCEL_R",
"comment": "Accelerometer for right Joy-Con controller"
},
{
"name": "SDL_SENSOR_GYRO_R",
"comment": "Gyroscope for right Joy-Con controller"
}
]
}
],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetSensors",
"return_type": "SDL_SensorID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetSensorNameForID",
"return_type": "const char *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_SensorID"
}
]
},
{
"name": "SDL_GetSensorTypeForID",
"return_type": "SDL_SensorType",
"parameters": [
{
"name": "instance_id",
"type": "SDL_SensorID"
}
]
},
{
"name": "SDL_GetSensorNonPortableTypeForID",
"return_type": "int",
"parameters": [
{
"name": "instance_id",
"type": "SDL_SensorID"
}
]
},
{
"name": "SDL_OpenSensor",
"return_type": "SDL_Sensor *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_SensorID"
}
]
},
{
"name": "SDL_GetSensorFromID",
"return_type": "SDL_Sensor *",
"parameters": [
{
"name": "instance_id",
"type": "SDL_SensorID"
}
]
},
{
"name": "SDL_GetSensorProperties",
"return_type": "SDL_PropertiesID",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_GetSensorName",
"return_type": "const char *",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_GetSensorType",
"return_type": "SDL_SensorType",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_GetSensorNonPortableType",
"return_type": "int",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_GetSensorID",
"return_type": "SDL_SensorID",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_GetSensorData",
"return_type": "bool",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
},
{
"name": "data",
"type": "float *"
},
{
"name": "num_values",
"type": "int"
}
]
},
{
"name": "SDL_CloseSensor",
"return_type": "void",
"parameters": [
{
"name": "sensor",
"type": "SDL_Sensor *"
}
]
},
{
"name": "SDL_UpdateSensors",
"return_type": "void",
"parameters": []
}
]
}

348
lib/sdl3/json/storage.json vendored Normal file
View File

@ -0,0 +1,348 @@
{
"header": "SDL_storage.h",
"opaque_types": [
{
"name": "SDL_Storage"
}
],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [
{
"name": "SDL_StorageInterface",
"fields": [
{
"name": "version",
"type": "Uint32"
},
{
"name": "close",
"type": "bool (SDLCALL *close)(void *userdata)"
},
{
"name": "ready",
"type": "bool (SDLCALL *ready)(void *userdata)"
},
{
"name": "enumerate",
"type": "bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata)"
},
{
"name": "info",
"type": "bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info)"
},
{
"name": "read_file",
"type": "bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length)"
},
{
"name": "write_file",
"type": "bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length)"
},
{
"name": "mkdir",
"type": "bool (SDLCALL *mkdir)(void *userdata, const char *path)"
},
{
"name": "remove",
"type": "bool (SDLCALL *remove)(void *userdata, const char *path)"
},
{
"name": "rename",
"type": "bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath)"
},
{
"name": "copy",
"type": "bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath)"
},
{
"name": "space_remaining",
"type": "Uint64 (SDLCALL *space_remaining)(void *userdata)"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_OpenTitleStorage",
"return_type": "SDL_Storage *",
"parameters": [
{
"name": "override",
"type": "const char *"
},
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
},
{
"name": "SDL_OpenUserStorage",
"return_type": "SDL_Storage *",
"parameters": [
{
"name": "org",
"type": "const char *"
},
{
"name": "app",
"type": "const char *"
},
{
"name": "props",
"type": "SDL_PropertiesID"
}
]
},
{
"name": "SDL_OpenFileStorage",
"return_type": "SDL_Storage *",
"parameters": [
{
"name": "path",
"type": "const char *"
}
]
},
{
"name": "SDL_OpenStorage",
"return_type": "SDL_Storage *",
"parameters": [
{
"name": "iface",
"type": "const SDL_StorageInterface *"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_CloseStorage",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
}
]
},
{
"name": "SDL_StorageReady",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
}
]
},
{
"name": "SDL_GetStorageFileSize",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "length",
"type": "Uint64 *"
}
]
},
{
"name": "SDL_ReadStorageFile",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "destination",
"type": "void *"
},
{
"name": "length",
"type": "Uint64"
}
]
},
{
"name": "SDL_WriteStorageFile",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "source",
"type": "const void *"
},
{
"name": "length",
"type": "Uint64"
}
]
},
{
"name": "SDL_CreateStorageDirectory",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
}
]
},
{
"name": "SDL_EnumerateStorageDirectory",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "callback",
"type": "SDL_EnumerateDirectoryCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_RemoveStoragePath",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
}
]
},
{
"name": "SDL_RenameStoragePath",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "oldpath",
"type": "const char *"
},
{
"name": "newpath",
"type": "const char *"
}
]
},
{
"name": "SDL_CopyStorageFile",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "oldpath",
"type": "const char *"
},
{
"name": "newpath",
"type": "const char *"
}
]
},
{
"name": "SDL_GetStoragePathInfo",
"return_type": "bool",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "info",
"type": "SDL_PathInfo *"
}
]
},
{
"name": "SDL_GetStorageSpaceRemaining",
"return_type": "Uint64",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
}
]
},
{
"name": "SDL_GlobStorageDirectory",
"return_type": "char **",
"parameters": [
{
"name": "storage",
"type": "SDL_Storage *"
},
{
"name": "path",
"type": "const char *"
},
{
"name": "pattern",
"type": "const char *"
},
{
"name": "flags",
"type": "SDL_GlobFlags"
},
{
"name": "count",
"type": "int *"
}
]
}
]
}

1218
lib/sdl3/json/surface.json vendored Normal file

File diff suppressed because it is too large Load Diff

398
lib/sdl3/json/system.json vendored Normal file
View File

@ -0,0 +1,398 @@
{
"header": "SDL_system.h",
"opaque_types": [
{
"name": "MSG"
}
],
"typedefs": [
{
"name": "XTaskQueueHandle",
"underlying_type": "struct XTaskQueueObject *"
},
{
"name": "XUserHandle",
"underlying_type": "struct XUser *"
}
],
"function_pointers": [
{
"name": "SDL_WindowsMessageHook",
"return_type": "bool",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "msg",
"type": "MSG *"
}
]
},
{
"name": "SDL_X11EventHook",
"return_type": "bool",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "xevent",
"type": "XEvent *"
}
]
},
{
"name": "SDL_iOSAnimationCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_RequestAndroidPermissionCallback",
"return_type": "void",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "permission",
"type": "const char *"
},
{
"name": "granted",
"type": "bool"
}
]
}
],
"enums": [
{
"name": "SDL_Sandbox",
"values": [
{
"name": "SDL_SANDBOX_UNKNOWN_CONTAINER"
},
{
"name": "SDL_SANDBOX_FLATPAK"
},
{
"name": "SDL_SANDBOX_SNAP"
},
{
"name": "SDL_SANDBOX_MACOS"
}
]
}
],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_SetWindowsMessageHook",
"return_type": "void",
"parameters": [
{
"name": "callback",
"type": "SDL_WindowsMessageHook"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_GetDirect3D9AdapterIndex",
"return_type": "int",
"parameters": [
{
"name": "displayID",
"type": "SDL_DisplayID"
}
]
},
{
"name": "SDL_GetDXGIOutputInfo",
"return_type": "bool",
"parameters": [
{
"name": "displayID",
"type": "SDL_DisplayID"
},
{
"name": "adapterIndex",
"type": "int *"
},
{
"name": "outputIndex",
"type": "int *"
}
]
},
{
"name": "SDL_SetX11EventHook",
"return_type": "void",
"parameters": [
{
"name": "callback",
"type": "SDL_X11EventHook"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_SetLinuxThreadPriority",
"return_type": "bool",
"parameters": [
{
"name": "threadID",
"type": "Sint64"
},
{
"name": "priority",
"type": "int"
}
]
},
{
"name": "SDL_SetLinuxThreadPriorityAndPolicy",
"return_type": "bool",
"parameters": [
{
"name": "threadID",
"type": "Sint64"
},
{
"name": "sdlPriority",
"type": "int"
},
{
"name": "schedPolicy",
"type": "int"
}
]
},
{
"name": "SDL_SetiOSAnimationCallback",
"return_type": "bool",
"parameters": [
{
"name": "window",
"type": "SDL_Window *"
},
{
"name": "interval",
"type": "int"
},
{
"name": "callback",
"type": "SDL_iOSAnimationCallback"
},
{
"name": "callbackParam",
"type": "void *"
}
]
},
{
"name": "SDL_SetiOSEventPump",
"return_type": "void",
"parameters": [
{
"name": "enabled",
"type": "bool"
}
]
},
{
"name": "SDL_GetAndroidJNIEnv",
"return_type": "void *",
"parameters": []
},
{
"name": "SDL_GetAndroidActivity",
"return_type": "void *",
"parameters": []
},
{
"name": "SDL_GetAndroidSDKVersion",
"return_type": "int",
"parameters": []
},
{
"name": "SDL_IsChromebook",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_IsDeXMode",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_SendAndroidBackButton",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_GetAndroidInternalStoragePath",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_GetAndroidExternalStorageState",
"return_type": "Uint32",
"parameters": []
},
{
"name": "SDL_GetAndroidExternalStoragePath",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_GetAndroidCachePath",
"return_type": "const char *",
"parameters": []
},
{
"name": "SDL_RequestAndroidPermission",
"return_type": "bool",
"parameters": [
{
"name": "permission",
"type": "const char *"
},
{
"name": "cb",
"type": "SDL_RequestAndroidPermissionCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_ShowAndroidToast",
"return_type": "bool",
"parameters": [
{
"name": "message",
"type": "const char *"
},
{
"name": "duration",
"type": "int"
},
{
"name": "gravity",
"type": "int"
},
{
"name": "xoffset",
"type": "int"
},
{
"name": "yoffset",
"type": "int"
}
]
},
{
"name": "SDL_SendAndroidMessage",
"return_type": "bool",
"parameters": [
{
"name": "command",
"type": "Uint32"
},
{
"name": "param",
"type": "int"
}
]
},
{
"name": "SDL_IsTablet",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_IsTV",
"return_type": "bool",
"parameters": []
},
{
"name": "SDL_GetSandbox",
"return_type": "SDL_Sandbox",
"parameters": []
},
{
"name": "SDL_OnApplicationWillTerminate",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationDidReceiveMemoryWarning",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationWillEnterBackground",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationDidEnterBackground",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationWillEnterForeground",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationDidEnterForeground",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_OnApplicationDidChangeStatusBarOrientation",
"return_type": "void",
"parameters": []
},
{
"name": "SDL_GetGDKTaskQueue",
"return_type": "bool",
"parameters": [
{
"name": "outTaskQueue",
"type": "XTaskQueueHandle *"
}
]
},
{
"name": "SDL_GetGDKDefaultUser",
"return_type": "bool",
"parameters": [
{
"name": "outUserHandle",
"type": "XUserHandle *"
}
]
}
]
}

237
lib/sdl3/json/time.json vendored Normal file
View File

@ -0,0 +1,237 @@
{
"header": "SDL_time.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [
{
"name": "SDL_DateFormat",
"values": [
{
"name": "SDL_DATE_FORMAT_YYYYMMDD",
"value": "0",
"comment": "Year/Month/Day"
},
{
"name": "SDL_DATE_FORMAT_DDMMYYYY",
"value": "1",
"comment": "Day/Month/Year"
},
{
"name": "SDL_DATE_FORMAT_MMDDYYYY",
"value": "2",
"comment": "Month/Day/Year"
}
]
},
{
"name": "SDL_TimeFormat",
"values": [
{
"name": "SDL_TIME_FORMAT_24HR",
"value": "0",
"comment": "24 hour time"
},
{
"name": "SDL_TIME_FORMAT_12HR",
"value": "1",
"comment": "12 hour time"
}
]
}
],
"structs": [
{
"name": "SDL_DateTime",
"fields": [
{
"name": "year",
"type": "int",
"comment": "Year"
},
{
"name": "month",
"type": "int",
"comment": "Month [01-12]"
},
{
"name": "day",
"type": "int",
"comment": "Day of the month [01-31]"
},
{
"name": "hour",
"type": "int",
"comment": "Hour [0-23]"
},
{
"name": "minute",
"type": "int",
"comment": "Minute [0-59]"
},
{
"name": "second",
"type": "int",
"comment": "Seconds [0-60]"
},
{
"name": "nanosecond",
"type": "int",
"comment": "Nanoseconds [0-999999999]"
},
{
"name": "day_of_week",
"type": "int",
"comment": "Day of the week [0-6] (0 being Sunday)"
},
{
"name": "utc_offset",
"type": "int",
"comment": "Seconds east of UTC"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetDateTimeLocalePreferences",
"return_type": "bool",
"parameters": [
{
"name": "dateFormat",
"type": "SDL_DateFormat *"
},
{
"name": "timeFormat",
"type": "SDL_TimeFormat *"
}
]
},
{
"name": "SDL_GetCurrentTime",
"return_type": "bool",
"parameters": [
{
"name": "ticks",
"type": "SDL_Time *"
}
]
},
{
"name": "SDL_TimeToDateTime",
"return_type": "bool",
"parameters": [
{
"name": "ticks",
"type": "SDL_Time"
},
{
"name": "dt",
"type": "SDL_DateTime *"
},
{
"name": "localTime",
"type": "bool"
}
]
},
{
"name": "SDL_DateTimeToTime",
"return_type": "bool",
"parameters": [
{
"name": "dt",
"type": "const SDL_DateTime *"
},
{
"name": "ticks",
"type": "SDL_Time *"
}
]
},
{
"name": "SDL_TimeToWindows",
"return_type": "void",
"parameters": [
{
"name": "ticks",
"type": "SDL_Time"
},
{
"name": "dwLowDateTime",
"type": "Uint32 *"
},
{
"name": "dwHighDateTime",
"type": "Uint32 *"
}
]
},
{
"name": "SDL_TimeFromWindows",
"return_type": "SDL_Time",
"parameters": [
{
"name": "dwLowDateTime",
"type": "Uint32"
},
{
"name": "dwHighDateTime",
"type": "Uint32"
}
]
},
{
"name": "SDL_GetDaysInMonth",
"return_type": "int",
"parameters": [
{
"name": "year",
"type": "int"
},
{
"name": "month",
"type": "int"
}
]
},
{
"name": "SDL_GetDayOfYear",
"return_type": "int",
"parameters": [
{
"name": "year",
"type": "int"
},
{
"name": "month",
"type": "int"
},
{
"name": "day",
"type": "int"
}
]
},
{
"name": "SDL_GetDayOfWeek",
"return_type": "int",
"parameters": [
{
"name": "year",
"type": "int"
},
{
"name": "month",
"type": "int"
},
{
"name": "day",
"type": "int"
}
]
}
]
}

150
lib/sdl3/json/timer.json vendored Normal file
View File

@ -0,0 +1,150 @@
{
"header": "SDL_timer.h",
"opaque_types": [],
"typedefs": [
{
"name": "SDL_TimerID",
"underlying_type": "Uint32"
}
],
"function_pointers": [
{
"name": "SDL_TimerCallback",
"return_type": "Uint32",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "timerID",
"type": "SDL_TimerID"
},
{
"name": "interval",
"type": "Uint32"
}
]
},
{
"name": "SDL_NSTimerCallback",
"return_type": "Uint64",
"parameters": [
{
"name": "userdata",
"type": "void *"
},
{
"name": "timerID",
"type": "SDL_TimerID"
},
{
"name": "interval",
"type": "Uint64"
}
]
}
],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetTicks",
"return_type": "Uint64",
"parameters": []
},
{
"name": "SDL_GetTicksNS",
"return_type": "Uint64",
"parameters": []
},
{
"name": "SDL_GetPerformanceCounter",
"return_type": "Uint64",
"parameters": []
},
{
"name": "SDL_GetPerformanceFrequency",
"return_type": "Uint64",
"parameters": []
},
{
"name": "SDL_Delay",
"return_type": "void",
"parameters": [
{
"name": "ms",
"type": "Uint32"
}
]
},
{
"name": "SDL_DelayNS",
"return_type": "void",
"parameters": [
{
"name": "ns",
"type": "Uint64"
}
]
},
{
"name": "SDL_DelayPrecise",
"return_type": "void",
"parameters": [
{
"name": "ns",
"type": "Uint64"
}
]
},
{
"name": "SDL_AddTimer",
"return_type": "SDL_TimerID",
"parameters": [
{
"name": "interval",
"type": "Uint32"
},
{
"name": "callback",
"type": "SDL_TimerCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_AddTimerNS",
"return_type": "SDL_TimerID",
"parameters": [
{
"name": "interval",
"type": "Uint64"
},
{
"name": "callback",
"type": "SDL_NSTimerCallback"
},
{
"name": "userdata",
"type": "void *"
}
]
},
{
"name": "SDL_RemoveTimer",
"return_type": "bool",
"parameters": [
{
"name": "id",
"type": "SDL_TimerID"
}
]
}
]
}

109
lib/sdl3/json/touch.json vendored Normal file
View File

@ -0,0 +1,109 @@
{
"header": "SDL_touch.h",
"opaque_types": [],
"typedefs": [
{
"name": "SDL_TouchID",
"underlying_type": "Uint64"
},
{
"name": "SDL_FingerID",
"underlying_type": "Uint64"
}
],
"function_pointers": [],
"enums": [
{
"name": "SDL_TouchDeviceType",
"values": [
{
"name": "SDL_TOUCH_DEVICE_DIRECT",
"comment": "touch screen with window-relative coordinates"
},
{
"name": "SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE",
"comment": "trackpad with absolute device coordinates"
},
{
"name": "SDL_TOUCH_DEVICE_INDIRECT_RELATIVE",
"comment": "trackpad with screen cursor-relative coordinates"
}
]
}
],
"structs": [
{
"name": "SDL_Finger",
"fields": [
{
"name": "id",
"type": "SDL_FingerID",
"comment": "the finger ID"
},
{
"name": "x",
"type": "float",
"comment": "the x-axis location of the touch event, normalized (0...1)"
},
{
"name": "y",
"type": "float",
"comment": "the y-axis location of the touch event, normalized (0...1)"
},
{
"name": "pressure",
"type": "float",
"comment": "the quantity of pressure applied, normalized (0...1)"
}
]
}
],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetTouchDevices",
"return_type": "SDL_TouchID *",
"parameters": [
{
"name": "count",
"type": "int *"
}
]
},
{
"name": "SDL_GetTouchDeviceName",
"return_type": "const char *",
"parameters": [
{
"name": "touchID",
"type": "SDL_TouchID"
}
]
},
{
"name": "SDL_GetTouchDeviceType",
"return_type": "SDL_TouchDeviceType",
"parameters": [
{
"name": "touchID",
"type": "SDL_TouchID"
}
]
},
{
"name": "SDL_GetTouchFingers",
"return_type": "SDL_Finger **",
"parameters": [
{
"name": "touchID",
"type": "SDL_TouchID"
},
{
"name": "count",
"type": "int *"
}
]
}
]
}

22
lib/sdl3/json/version.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"header": "SDL_version.h",
"opaque_types": [],
"typedefs": [],
"function_pointers": [],
"enums": [],
"structs": [],
"unions": [],
"flags": [],
"functions": [
{
"name": "SDL_GetVersion",
"return_type": "int",
"parameters": []
},
{
"name": "SDL_GetRevision",
"return_type": "const char *",
"parameters": []
}
]
}

1814
lib/sdl3/json/video.json vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -252,23 +252,6 @@ Analyzing dependencies...
Generated: output.zig Generated: output.zig
``` ```
### With Warnings
```
Resolving dependencies...
✓ Found SDL_Window in SDL_video.h
⚠ Warning: Could not find definition for type: SDL_Unknown
```
### With Errors
```
Error: 5 syntax errors detected in generated code
Line 10: expected_comma_after_field
Line 12: expected_type_expr
...
```
File is still written, but may need manual fixes. File is still written, but may need manual fixes.
## Type Conversion Reference ## Type Conversion Reference
@ -311,40 +294,8 @@ File is still written, but may need manual fixes.
## Examples ## Examples
### Example 1: Simple Header
**Input** (simple.h): ### Example
```c
typedef struct SDL_Thing SDL_Thing;
typedef Uint32 SDL_ThingID;
extern SDL_DECLSPEC SDL_ThingID SDLCALL SDL_CreateThing(void);
extern SDL_DECLSPEC void SDLCALL SDL_DestroyThing(SDL_Thing *thing);
```
**Command**:
```bash
zig build run -- simple.h --output=thing.zig
```
**Output** (thing.zig):
```zig
pub const c = @import("c.zig").c;
pub const ThingID = u32;
pub const Thing = opaque {
pub inline fn destroyThing(thing: *Thing) void {
return c.SDL_DestroyThing(thing);
}
};
pub inline fn createThing() ThingID {
return c.SDL_CreateThing();
}
```
### Example 2: With Dependencies
**Input** (depends.h): **Input** (depends.h):
```c ```c
@ -375,7 +326,7 @@ pub inline fn useRect(rect: *Rect) void {
} }
``` ```
### Example 3: With Mocks ### Mocks example
**Command**: **Command**:
```bash ```bash
@ -395,65 +346,3 @@ void SDL_DestroyThing(SDL_Thing *thing) {
} }
``` ```
## Performance Characteristics
### Timing
| Operation | Time (SDL_gpu.h) |
|-----------|------------------|
| Parse primary header | ~50ms |
| Analyze dependencies | ~10ms |
| Extract dependencies | ~300ms |
| Generate code | ~150ms |
| **Total** | **~520ms** |
### Memory
| Component | Memory |
|-----------|--------|
| Source files | ~150KB |
| Declarations | ~2MB |
| Output | ~53KB |
| **Peak Total** | **~2.2MB** |
### Scaling
- **Time**: O(n + h×d) where n=lines, h=headers, d=declarations
- **Memory**: O(d) where d=total declarations
- **Linear scaling** with input size
## Advanced Usage
### Batch Processing
```bash
for header in SDL/include/SDL3/SDL_*.h; do
name=$(basename "$header" .h)
zig build run -- "$header" --output="bindings/${name}.zig"
done
```
### CI/CD Integration
```yaml
- name: Generate SDL bindings
run: |
cd lib/sdl3
zig build regenerate-zig
git diff --exit-code v2/*.zig || echo "Bindings updated"
```
### Validation
```bash
# Generate and validate
zig build run -- header.h --output=test.zig
zig ast-check test.zig
```
---
**See Also**:
- [Getting Started](GETTING_STARTED.md) - Basic usage tutorial
- [Architecture](ARCHITECTURE.md) - How it works internally
- [Known Issues](KNOWN_ISSUES.md) - Current limitations

View File

@ -199,7 +199,7 @@ pub const CodeGen = struct {
const param_type = try types.convertType(param.type_name, self.allocator); const param_type = try types.convertType(param.type_name, self.allocator);
defer self.allocator.free(param_type); defer self.allocator.free(param_type);
try self.output.writer(self.allocator).print("{s}: {s}", .{param.name, param_type}); try self.output.writer(self.allocator).print("{s}: {s}", .{ param.name, param_type });
} }
// Close with calling convention and return type // Close with calling convention and return type
@ -207,6 +207,7 @@ pub const CodeGen = struct {
} }
fn writeEnum(self: *CodeGen, enum_decl: EnumDecl) !void { fn writeEnum(self: *CodeGen, enum_decl: EnumDecl) !void {
std.debug.print("enum {s} values.len = {d}\n", .{ enum_decl.name, enum_decl.values.len });
// Skip empty enums // Skip empty enums
if (enum_decl.values.len == 0) { if (enum_decl.values.len == 0) {
return; return;
@ -359,7 +360,7 @@ pub const CodeGen = struct {
// Parse bit position from value like "(1u << 0)" // Parse bit position from value like "(1u << 0)"
const bit_pos = self.parseBitPosition(flag.value) catch |err| { const bit_pos = self.parseBitPosition(flag.value) catch |err| {
// Skip flags we can't parse (like non-bitfield constants) // Skip flags we can't parse (like non-bitfield constants)
std.debug.print("Warning: Skipping flag {s} = {s} ({})\n", .{flag.name, flag.value, err}); std.debug.print("Warning: Skipping flag {s} = {s} ({})\n", .{ flag.name, flag.value, err });
continue; continue;
}; };
used_bits.set(bit_pos); used_bits.set(bit_pos);

View File

@ -239,22 +239,15 @@ pub fn main() !void {
for (missing_types) |missing_type| { for (missing_types) |missing_type| {
var found = false; var found = false;
for (includes) |include| { for (includes) |include| {
const dep_path = try std.fs.path.join( const dep_path = try std.fs.path.join(allocator, &[_][]const u8{ header_dir, include });
allocator,
&[_][]const u8{ header_dir, include }
);
defer allocator.free(dep_path); defer allocator.free(dep_path);
const dep_source = std.fs.cwd().readFileAlloc( const dep_source = std.fs.cwd().readFileAlloc(allocator, dep_path, 10 * 1024 * 1024) catch continue;
allocator,
dep_path,
10 * 1024 * 1024
) catch continue;
defer allocator.free(dep_source); defer allocator.free(dep_source);
if (try dependency_resolver.extractTypeFromHeader(allocator, dep_source, missing_type)) |dep_decl| { if (try dependency_resolver.extractTypeFromHeader(allocator, dep_source, missing_type)) |dep_decl| {
try dependency_decls.append(allocator, dep_decl); try dependency_decls.append(allocator, dep_decl);
std.debug.print(" ✓ Found {s} in {s}\n", .{missing_type, include}); std.debug.print(" ✓ Found {s} in {s}\n", .{ missing_type, include });
found = true; found = true;
break; break;
} }
@ -287,6 +280,7 @@ pub fn main() !void {
// Check for parse errors // Check for parse errors
if (ast.errors.len > 0) { if (ast.errors.len > 0) {
std.debug.print("{s}", .{output_z});
std.debug.print("\nError: {d} syntax errors detected in generated code\n", .{ast.errors.len}); std.debug.print("\nError: {d} syntax errors detected in generated code\n", .{ast.errors.len});
for (ast.errors) |err| { for (ast.errors) |err| {
const loc = ast.tokenLocation(0, err.token); const loc = ast.tokenLocation(0, err.token);

View File

@ -1,6 +1,15 @@
const std = @import("std"); const std = @import("std");
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
fn fixupZigName(name: []const u8) []u8 {
const allocator = std.heap.smp_allocator;
if (std.mem.eql(u8, name, "type")) {
return allocator.dupe(u8, "_type") catch unreachable;
}
return allocator.dupe(u8, name) catch unreachable;
}
// Simple data structures to hold extracted declarations // Simple data structures to hold extracted declarations
pub const Declaration = union(enum) { pub const Declaration = union(enum) {
opaque_type: OpaqueType, opaque_type: OpaqueType,
@ -265,7 +274,7 @@ pub const Scanner = struct {
const func_name = std.mem.trim(u8, after_star[0..name_end], " \t"); const func_name = std.mem.trim(u8, after_star[0..name_end], " \t");
// Find parameters (between the closing ) of name and final ) // Find parameters (between the closing ) of name and final )
const after_name = after_star[name_end + 1..]; // Skip ) const after_name = after_star[name_end + 1 ..]; // Skip )
const params_start = std.mem.indexOfScalar(u8, after_name, '(') orelse { const params_start = std.mem.indexOfScalar(u8, after_name, '(') orelse {
self.pos = start; self.pos = start;
return null; return null;
@ -274,7 +283,7 @@ pub const Scanner = struct {
self.pos = start; self.pos = start;
return null; return null;
}; };
const params_str = std.mem.trim(u8, after_name[params_start + 1..params_end], " \t"); const params_str = std.mem.trim(u8, after_name[params_start + 1 .. params_end], " \t");
// Parse parameters // Parse parameters
const params = try self.parseParams(params_str); const params = try self.parseParams(params_str);
@ -367,7 +376,7 @@ pub const Scanner = struct {
return null; return null;
}; };
defer type_buf.deinit(self.allocator); defer type_buf.deinit(self.allocator);
for (token_list.items[0..token_list.items.len - 1], 0..) |token, i| { for (token_list.items[0 .. token_list.items.len - 1], 0..) |token, i| {
if (i > 0) try type_buf.append(self.allocator, ' '); if (i > 0) try type_buf.append(self.allocator, ' ');
try type_buf.appendSlice(self.allocator, token); try type_buf.appendSlice(self.allocator, token);
} }
@ -381,7 +390,8 @@ pub const Scanner = struct {
// Make sure it's an SDL type or one of the known Windows types // Make sure it's an SDL type or one of the known Windows types
if (!std.mem.startsWith(u8, name, "SDL_") and if (!std.mem.startsWith(u8, name, "SDL_") and
!std.mem.eql(u8, name, "XTaskQueueHandle") and !std.mem.eql(u8, name, "XTaskQueueHandle") and
!std.mem.eql(u8, name, "XUserHandle")) { !std.mem.eql(u8, name, "XUserHandle"))
{
self.allocator.free(underlying_type); self.allocator.free(underlying_type);
self.pos = start; self.pos = start;
return null; return null;
@ -394,6 +404,16 @@ pub const Scanner = struct {
}; };
} }
fn countChar(need: u8, haystack: []const u8) u32 {
var i: u32 = 0;
for (haystack) |h| {
if (h == need) {
i += 1;
}
}
return i;
}
// Pattern: typedef enum SDL_Foo { ... } SDL_Foo; // Pattern: typedef enum SDL_Foo { ... } SDL_Foo;
fn scanEnum(self: *Scanner) !?EnumDecl { fn scanEnum(self: *Scanner) !?EnumDecl {
const start = self.pos; const start = self.pos;
@ -447,19 +467,40 @@ pub const Scanner = struct {
var in_multiline_comment = false; var in_multiline_comment = false;
while (lines.next()) |line| { while (lines.next()) |line| {
const trimmed = std.mem.trim(u8, line, " \t\r"); var trimmed = std.mem.trim(u8, line, " \t\r");
if (trimmed.len == 0) continue; if (trimmed.len == 0) continue;
if (in_multiline_comment) {
if (std.mem.indexOf(u8, trimmed, "*/")) |x| {
in_multiline_comment = false;
if (trimmed.len == 2)
continue;
trimmed = trimmed[x + 2 ..];
}
}
// Track multi-line comments (both /** and /* styles) // Track multi-line comments (both /** and /* styles)
if (std.mem.indexOf(u8, trimmed, "/*")) |_| { if (std.mem.indexOf(u8, trimmed, "/*")) |_| {
in_multiline_comment = true; in_multiline_comment = true;
} }
if (in_multiline_comment) { if (in_multiline_comment) {
if (std.mem.indexOf(u8, trimmed, "*/")) |_| { if (std.mem.indexOf(u8, trimmed, "*/")) |_| {
in_multiline_comment = false; in_multiline_comment = false;
} }
}
if (std.mem.indexOf(u8, trimmed, "/*")) |x| {
if (x == 0) {
continue; continue;
} }
}
// special case for those weirder multiline comments
if (std.mem.indexOf(u8, trimmed, "/*") == null and std.mem.indexOf(u8, trimmed, "*/") == null) {
if (countChar(' ', trimmed) > 0) {
continue;
}
}
// Skip various comment/bracket/preprocessor lines // Skip various comment/bracket/preprocessor lines
if (std.mem.startsWith(u8, trimmed, "//")) continue; if (std.mem.startsWith(u8, trimmed, "//")) continue;
@ -528,7 +569,7 @@ pub const Scanner = struct {
} }
return EnumValue{ return EnumValue{
.name = try self.allocator.dupe(u8, name), .name = fixupZigName(name),
.value = value, .value = value,
.comment = comment, .comment = comment,
}; };
@ -759,26 +800,26 @@ pub const Scanner = struct {
// Check for function pointer field: RetType (SDLCALL *field_name)(params) // Check for function pointer field: RetType (SDLCALL *field_name)(params)
if (std.mem.indexOf(u8, field_part, "(SDLCALL *")) |sdlcall_pos| { if (std.mem.indexOf(u8, field_part, "(SDLCALL *")) |sdlcall_pos| {
// Find the * after SDLCALL // Find the * after SDLCALL
const after_sdlcall = field_part[sdlcall_pos + 10..]; // Skip "(SDLCALL *" const after_sdlcall = field_part[sdlcall_pos + 10 ..]; // Skip "(SDLCALL *"
if (std.mem.indexOf(u8, after_sdlcall, ")")) |close_paren| { if (std.mem.indexOf(u8, after_sdlcall, ")")) |close_paren| {
const field_name = std.mem.trim(u8, after_sdlcall[0..close_paren], " \t"); const field_name = std.mem.trim(u8, after_sdlcall[0..close_paren], " \t");
// The entire thing is the type (we'll convert to Zig function pointer syntax later) // The entire thing is the type (we'll convert to Zig function pointer syntax later)
return FieldDecl{ return FieldDecl{
.name = try self.allocator.dupe(u8, field_name), .name = fixupZigName(field_name),
.type_name = try self.allocator.dupe(u8, std.mem.trim(u8, field_part, " \t")), .type_name = try self.allocator.dupe(u8, std.mem.trim(u8, field_part, " \t")),
.comment = comment, .comment = comment,
}; };
} }
} else if (std.mem.indexOf(u8, field_part, "(*")) |star_pos| { } else if (std.mem.indexOf(u8, field_part, "(*")) |star_pos| {
// Handle non-SDLCALL function pointers: RetType (*field_name)(params) // Handle non-SDLCALL function pointers: RetType (*field_name)(params)
const after_star = field_part[star_pos + 2..]; // Skip "(*" const after_star = field_part[star_pos + 2 ..]; // Skip "(*"
if (std.mem.indexOf(u8, after_star, ")")) |close_paren| { if (std.mem.indexOf(u8, after_star, ")")) |close_paren| {
const field_name = std.mem.trim(u8, after_star[0..close_paren], " \t"); const field_name = std.mem.trim(u8, after_star[0..close_paren], " \t");
// The entire thing is the type (we'll convert to Zig function pointer syntax later) // The entire thing is the type (we'll convert to Zig function pointer syntax later)
return FieldDecl{ return FieldDecl{
.name = try self.allocator.dupe(u8, field_name), .name = fixupZigName(field_name),
.type_name = try self.allocator.dupe(u8, std.mem.trim(u8, field_part, " \t")), .type_name = try self.allocator.dupe(u8, std.mem.trim(u8, field_part, " \t")),
.comment = comment, .comment = comment,
}; };
@ -836,7 +877,7 @@ pub const Scanner = struct {
} }
const name = parts_list[parts_count - 1]; const name = parts_list[parts_count - 1];
const type_parts = parts_list[0..parts_count - 1]; const type_parts = parts_list[0 .. parts_count - 1];
// Reconstruct type with array notation // Reconstruct type with array notation
var type_buf: [128]u8 = undefined; var type_buf: [128]u8 = undefined;
@ -860,7 +901,7 @@ pub const Scanner = struct {
const type_str = fbs.getWritten(); const type_str = fbs.getWritten();
return FieldDecl{ return FieldDecl{
.name = try self.allocator.dupe(u8, name), .name = fixupZigName(name),
.type_name = try self.allocator.dupe(u8, type_str), .type_name = try self.allocator.dupe(u8, type_str),
.comment = comment, .comment = comment,
}; };
@ -903,7 +944,7 @@ pub const Scanner = struct {
if (name.len > 0 and type_part.len > 0) { if (name.len > 0 and type_part.len > 0) {
return FieldDecl{ return FieldDecl{
.name = try self.allocator.dupe(u8, name), .name = fixupZigName(name),
.type_name = try self.allocator.dupe(u8, type_part), .type_name = try self.allocator.dupe(u8, type_part),
.comment = comment, .comment = comment,
}; };
@ -977,7 +1018,7 @@ pub const Scanner = struct {
const name = std.mem.trim(u8, name_raw, " \t*"); const name = std.mem.trim(u8, name_raw, " \t*");
if (name.len > 0) { if (name.len > 0) {
try field_list.append(self.allocator, FieldDecl{ try field_list.append(self.allocator, FieldDecl{
.name = try self.allocator.dupe(u8, name), .name = fixupZigName(name),
.type_name = try self.allocator.dupe(u8, type_part), .type_name = try self.allocator.dupe(u8, type_part),
.comment = if (comment) |c| try self.allocator.dupe(u8, c) else null, .comment = if (comment) |c| try self.allocator.dupe(u8, c) else null,
}); });
@ -1044,7 +1085,7 @@ pub const Scanner = struct {
const doc = self.consumePendingDocComment(); const doc = self.consumePendingDocComment();
return FlagDecl{ return FlagDecl{
.name = try self.allocator.dupe(u8, clean_name), .name = fixupZigName(clean_name),
.underlying_type = try self.allocator.dupe(u8, underlying), .underlying_type = try self.allocator.dupe(u8, underlying),
.flags = try flags.toOwnedSlice(self.allocator), .flags = try flags.toOwnedSlice(self.allocator),
.doc_comment = doc, .doc_comment = doc,
@ -1291,7 +1332,7 @@ pub const Scanner = struct {
} }
try params_list.append(self.allocator, ParamDecl{ try params_list.append(self.allocator, ParamDecl{
.name = try self.allocator.dupe(u8, param_name), .name = fixupZigName(param_name),
.type_name = try self.allocator.dupe(u8, param_type), .type_name = try self.allocator.dupe(u8, param_type),
}); });
} }

View File

@ -1,37 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const AssertData = extern struct {
always_ignore: bool, // true if app should always continue when assertion is triggered.
trigger_count: unsigned int, // Number of times this assertion has been triggered.
condition: [*c]const u8, // A string of this assert's test code.
filename: [*c]const u8, // The source file where this assert lives.
linenum: c_int, // The line in `filename` where this assert lives.
function: [*c]const u8, // The name of the function where this assert lives.
next: const struct SDL_AssertData *, // next item in the linked list.
};
pub inline fn reportAssertion(data: ?*AssertData, func: [*c]const u8, file: [*c]const u8, line: c_int) AssertState {
return c.SDL_ReportAssertion(data, func, file, line);
}
pub inline fn setAssertionHandler(handler: AssertionHandler, userdata: ?*anyopaque) void {
return c.SDL_SetAssertionHandler(handler, userdata);
}
pub inline fn getDefaultAssertionHandler() AssertionHandler {
return c.SDL_GetDefaultAssertionHandler();
}
pub inline fn getAssertionHandler(puserdata: [*c]?*anyopaque) AssertionHandler {
return c.SDL_GetAssertionHandler(puserdata);
}
pub inline fn getAssertionReport() *const AssertData {
return @ptrCast(c.SDL_GetAssertionReport());
}
pub inline fn resetAssertionReport() void {
return c.SDL_ResetAssertionReport();
}

View File

@ -1,61 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const AsyncIO = opaque {
pub inline fn getAsyncIOSize(asyncio: *AsyncIO) i64 {
return c.SDL_GetAsyncIOSize(asyncio);
}
pub inline fn readAsyncIO(asyncio: *AsyncIO, ptr: ?*anyopaque, offset: u64, size: u64, queue: ?*AsyncIOQueue, userdata: ?*anyopaque) bool {
return c.SDL_ReadAsyncIO(asyncio, ptr, offset, size, queue, userdata);
}
pub inline fn writeAsyncIO(asyncio: *AsyncIO, ptr: ?*anyopaque, offset: u64, size: u64, queue: ?*AsyncIOQueue, userdata: ?*anyopaque) bool {
return c.SDL_WriteAsyncIO(asyncio, ptr, offset, size, queue, userdata);
}
pub inline fn closeAsyncIO(asyncio: *AsyncIO, flush: bool, queue: ?*AsyncIOQueue, userdata: ?*anyopaque) bool {
return c.SDL_CloseAsyncIO(asyncio, flush, queue, userdata);
}
};
pub const AsyncIOOutcome = extern struct {
asyncio: ?*AsyncIO, // what generated this task. This pointer will be invalid if it was closed!
type: AsyncIOTaskType, // What sort of task was this? Read, write, etc?
result: AsyncIOResult, // the result of the work (success, failure, cancellation).
buffer: ?*anyopaque, // buffer where data was read/written.
offset: u64, // offset in the SDL_AsyncIO where data was read/written.
bytes_requested: u64, // number of bytes the task was to read/write.
bytes_transferred: u64, // actual number of bytes that were read/written.
userdata: ?*anyopaque, // pointer provided by the app when starting the task
};
pub const AsyncIOQueue = opaque {
pub inline fn destroyAsyncIOQueue(asyncioqueue: *AsyncIOQueue) void {
return c.SDL_DestroyAsyncIOQueue(asyncioqueue);
}
pub inline fn getAsyncIOResult(asyncioqueue: *AsyncIOQueue, outcome: ?*AsyncIOOutcome) bool {
return c.SDL_GetAsyncIOResult(asyncioqueue, outcome);
}
pub inline fn waitAsyncIOResult(asyncioqueue: *AsyncIOQueue, outcome: ?*AsyncIOOutcome, timeoutMS: i32) bool {
return c.SDL_WaitAsyncIOResult(asyncioqueue, outcome, timeoutMS);
}
pub inline fn signalAsyncIOQueue(asyncioqueue: *AsyncIOQueue) void {
return c.SDL_SignalAsyncIOQueue(asyncioqueue);
}
};
pub inline fn asyncIOFromFile(file: [*c]const u8, mode: [*c]const u8) ?*AsyncIO {
return c.SDL_AsyncIOFromFile(file, mode);
}
pub inline fn createAsyncIOQueue() ?*AsyncIOQueue {
return c.SDL_CreateAsyncIOQueue();
}
pub inline fn loadFileAsync(file: [*c]const u8, queue: ?*AsyncIOQueue, userdata: ?*anyopaque) bool {
return c.SDL_LoadFileAsync(file, queue, userdata);
}

View File

@ -1,70 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const SpinLock = c_int;
pub inline fn tryLockSpinlock(lock: ?*SpinLock) bool {
return c.SDL_TryLockSpinlock(lock);
}
pub inline fn lockSpinlock(lock: ?*SpinLock) void {
return c.SDL_LockSpinlock(lock);
}
pub inline fn unlockSpinlock(lock: ?*SpinLock) void {
return c.SDL_UnlockSpinlock(lock);
}
pub inline fn memoryBarrierReleaseFunction() void {
return c.SDL_MemoryBarrierReleaseFunction();
}
pub inline fn memoryBarrierAcquireFunction() void {
return c.SDL_MemoryBarrierAcquireFunction();
}
pub const KernelMemoryBarrierFunc = *const fn () callconv(.C) void;
pub const AtomicInt = extern struct {};
pub inline fn compareAndSwapAtomicInt(a: ?*AtomicInt, oldval: c_int, newval: c_int) bool {
return c.SDL_CompareAndSwapAtomicInt(a, oldval, newval);
}
pub inline fn setAtomicInt(a: ?*AtomicInt, v: c_int) c_int {
return c.SDL_SetAtomicInt(a, v);
}
pub inline fn getAtomicInt(a: ?*AtomicInt) c_int {
return c.SDL_GetAtomicInt(a);
}
pub inline fn addAtomicInt(a: ?*AtomicInt, v: c_int) c_int {
return c.SDL_AddAtomicInt(a, v);
}
pub const AtomicU32 = extern struct {};
pub inline fn compareAndSwapAtomicU32(a: ?*AtomicU32, oldval: u32, newval: u32) bool {
return c.SDL_CompareAndSwapAtomicU32(a, oldval, newval);
}
pub inline fn setAtomicU32(a: ?*AtomicU32, v: u32) u32 {
return c.SDL_SetAtomicU32(a, v);
}
pub inline fn getAtomicU32(a: ?*AtomicU32) u32 {
return c.SDL_GetAtomicU32(a);
}
pub inline fn compareAndSwapAtomicPointer(a: [*c]?*anyopaque, oldval: ?*anyopaque, newval: ?*anyopaque) bool {
return c.SDL_CompareAndSwapAtomicPointer(a, oldval, newval);
}
pub inline fn setAtomicPointer(a: [*c]?*anyopaque, v: ?*anyopaque) ?*anyopaque {
return c.SDL_SetAtomicPointer(a, v);
}
pub inline fn getAtomicPointer(a: [*c]?*anyopaque) ?*anyopaque {
return c.SDL_GetAtomicPointer(a);
}

12
lib/sdl3/v2/audio.zig vendored
View File

@ -10,9 +10,15 @@ pub const IOStream = opaque {
}; };
pub const AudioFormat = enum(c_int) { pub const AudioFormat = enum(c_int) {
audioS16, audioUnknown, //Unspecified audio format
audioS32, audioU8, //Unsigned 8-bit samples
audioF32, audioS8, //Signed 8-bit samples
audioS16le, //Signed 16-bit samples
audioS16be, //As above, but big-endian byte order
audioS32le, //32-bit integer samples
audioS32be, //As above, but big-endian byte order
audioF32le, //32-bit floating point samples
audioF32be, //As above, but big-endian byte order
}; };
pub const AudioDeviceID = u32; pub const AudioDeviceID = u32;

View File

@ -3,6 +3,27 @@ pub const c = @import("c.zig").c;
pub const BlendMode = u32; pub const BlendMode = u32;
pub const BlendOperation = enum(c_int) {
blendoperationAdd, //dst + src: supported by all renderers
blendoperationSubtract, //src - dst : supported by D3D, OpenGL, OpenGLES, and Vulkan
blendoperationRevSubtract, //dst - src : supported by D3D, OpenGL, OpenGLES, and Vulkan
blendoperationMinimum, //min(dst, src) : supported by D3D, OpenGL, OpenGLES, and Vulkan
blendoperationMaximum,
};
pub const BlendFactor = enum(c_int) {
blendfactorZero, //0, 0, 0, 0
blendfactorOne, //1, 1, 1, 1
blendfactorSrcColor, //srcR, srcG, srcB, srcA
blendfactorOneMinusSrcColor, //1-srcR, 1-srcG, 1-srcB, 1-srcA
blendfactorSrcAlpha, //srcA, srcA, srcA, srcA
blendfactorOneMinusSrcAlpha, //1-srcA, 1-srcA, 1-srcA, 1-srcA
blendfactorDstColor, //dstR, dstG, dstB, dstA
blendfactorOneMinusDstColor, //1-dstR, 1-dstG, 1-dstB, 1-dstA
blendfactorDstAlpha, //dstA, dstA, dstA, dstA
blendfactorOneMinusDstAlpha,
};
pub inline fn composeCustomBlendMode(srcColorFactor: BlendFactor, dstColorFactor: BlendFactor, colorOperation: BlendOperation, srcAlphaFactor: BlendFactor, dstAlphaFactor: BlendFactor, alphaOperation: BlendOperation) BlendMode { pub inline fn composeCustomBlendMode(srcColorFactor: BlendFactor, dstColorFactor: BlendFactor, colorOperation: BlendOperation, srcAlphaFactor: BlendFactor, dstAlphaFactor: BlendFactor, alphaOperation: BlendOperation) BlendMode {
return @intFromEnum(c.SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor, @intFromEnum(colorOperation), srcAlphaFactor, dstAlphaFactor, @intFromEnum(alphaOperation))); return @intFromEnum(c.SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor, @intFromEnum(colorOperation), srcAlphaFactor, dstAlphaFactor, @intFromEnum(alphaOperation)));
} }

100
lib/sdl3/v2/camera.zig vendored
View File

@ -2,75 +2,47 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const PixelFormat = enum(c_int) { pub const PixelFormat = enum(c_int) {
pixelformatUnknown, pixelformatYv12, //Planar mode: Y + V + U (3 planes)
pixelformatIndex1lsb, pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
pixelformatIndex1msb, pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
pixelformatIndex2lsb, pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
pixelformatIndex2msb, pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
pixelformatIndex4lsb, pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatIndex4msb, pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
pixelformatIndex8, pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatRgb332, pixelformatExternalOes, //Android video texture format
pixelformatXrgb4444, pixelformatMjpg, //Motion JPEG
pixelformatXbgr4444,
pixelformatXrgb1555,
pixelformatXbgr1555,
pixelformatArgb4444,
pixelformatRgba4444,
pixelformatAbgr4444,
pixelformatBgra4444,
pixelformatArgb1555,
pixelformatRgba5551,
pixelformatAbgr1555,
pixelformatBgra5551,
pixelformatRgb565,
pixelformatBgr565,
pixelformatRgb24,
pixelformatBgr24,
pixelformatXrgb8888,
pixelformatRgbx8888,
pixelformatXbgr8888,
pixelformatBgrx8888,
pixelformatArgb8888,
pixelformatRgba8888,
pixelformatAbgr8888,
pixelformatBgra8888,
pixelformatXrgb2101010,
pixelformatXbgr2101010,
pixelformatArgb2101010,
pixelformatAbgr2101010,
pixelformatRgb48,
pixelformatBgr48,
pixelformatRgba64,
pixelformatArgb64,
pixelformatBgra64,
pixelformatAbgr64,
pixelformatRgb48Float,
pixelformatBgr48Float,
pixelformatRgba64Float,
pixelformatArgb64Float,
pixelformatBgra64Float,
pixelformatAbgr64Float,
pixelformatRgb96Float,
pixelformatBgr96Float,
pixelformatRgba128Float,
pixelformatArgb128Float,
pixelformatBgra128Float,
pixelformatAbgr128Float,
pixelformatRgba32,
pixelformatArgb32,
pixelformatBgra32,
pixelformatAbgr32,
pixelformatRgbx32,
pixelformatXrgb32,
pixelformatBgrx32,
pixelformatXbgr32,
}; };
pub const Surface = opaque {}; pub const Surface = opaque {};
pub const Colorspace = enum(c_int) { pub const Colorspace = enum(c_int) {
colorspaceUnknown, colorspaceSrgb, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
colorRangeFull,
colorPrimariesBt709,
transferCharacteristicsSrgb,
matrixCoefficientsIdentity,
colorspaceSrgbLinear, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709
transferCharacteristicsLinear,
colorspaceHdr10, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
colorPrimariesBt2020,
transferCharacteristicsPq,
colorspaceJpeg, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601
transferCharacteristicsBt601,
matrixCoefficientsBt601,
colorspaceBt601Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorRangeLimited,
colorPrimariesBt601,
colorspaceBt601Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorspaceBt709Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
transferCharacteristicsBt709,
matrixCoefficientsBt709,
colorspaceBt709Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
colorspaceBt2020Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020
matrixCoefficientsBt2020Ncl,
colorspaceBt2020Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
colorspaceRgbDefault, //The default colorspace for RGB surfaces if no colorspace is specified
colorspaceYuvDefault, //The default colorspace for YUV surfaces if no colorspace is specified
}; };
pub const PropertiesID = u32; pub const PropertiesID = u32;

View File

@ -1,74 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub inline fn getNumLogicalCPUCores() c_int {
return c.SDL_GetNumLogicalCPUCores();
}
pub inline fn getCPUCacheLineSize() c_int {
return c.SDL_GetCPUCacheLineSize();
}
pub inline fn hasAltiVec() bool {
return c.SDL_HasAltiVec();
}
pub inline fn hasMMX() bool {
return c.SDL_HasMMX();
}
pub inline fn hasSSE() bool {
return c.SDL_HasSSE();
}
pub inline fn hasSSE2() bool {
return c.SDL_HasSSE2();
}
pub inline fn hasSSE3() bool {
return c.SDL_HasSSE3();
}
pub inline fn hasSSE41() bool {
return c.SDL_HasSSE41();
}
pub inline fn hasSSE42() bool {
return c.SDL_HasSSE42();
}
pub inline fn hasAVX() bool {
return c.SDL_HasAVX();
}
pub inline fn hasAVX2() bool {
return c.SDL_HasAVX2();
}
pub inline fn hasAVX512F() bool {
return c.SDL_HasAVX512F();
}
pub inline fn hasARMSIMD() bool {
return c.SDL_HasARMSIMD();
}
pub inline fn hasNEON() bool {
return c.SDL_HasNEON();
}
pub inline fn hasLSX() bool {
return c.SDL_HasLSX();
}
pub inline fn hasLASX() bool {
return c.SDL_HasLASX();
}
pub inline fn getSystemRAM() c_int {
return c.SDL_GetSystemRAM();
}
pub inline fn getSIMDAlignment() usize {
return c.SDL_GetSIMDAlignment();
}

View File

@ -30,6 +30,6 @@ pub const FileDialogType = enum(c_int) {
filedialogOpenfolder, filedialogOpenfolder,
}; };
pub inline fn showFileDialogWithProperties(type: FileDialogType, callback: DialogFileCallback, userdata: ?*anyopaque, props: PropertiesID) void { pub inline fn showFileDialogWithProperties(_type: FileDialogType, callback: DialogFileCallback, userdata: ?*anyopaque, props: PropertiesID) void {
return c.SDL_ShowFileDialogWithProperties(@intFromEnum(type), callback, userdata, props); return c.SDL_ShowFileDialogWithProperties(@intFromEnum(_type), callback, userdata, props);
} }

752
lib/sdl3/v2/events.zig vendored
View File

@ -1,752 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PenID = u32;
pub const WindowID = u32;
pub const AudioDeviceID = u32;
pub const DisplayID = u32;
pub const CameraID = u32;
pub const PenInputFlags = packed struct(u32) {
penInputDown: bool = false, // pen is pressed down
penInputButton1: bool = false, // button 1 is pressed
penInputButton2: bool = false, // button 2 is pressed
penInputButton3: bool = false, // button 3 is pressed
penInputButton4: bool = false, // button 4 is pressed
penInputButton5: bool = false, // button 5 is pressed
penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0,
rsvd: bool = false,
};
pub const MouseButtonFlags = packed struct(u32) {
buttonLeft: bool = false,
buttonMiddle: bool = false,
buttonX1: bool = false,
pad0: u28 = 0,
rsvd: bool = false,
};
pub const Scancode = enum(c_int) {
scancodeUnknown,
scancodeA,
scancodeB,
scancodeC,
scancodeD,
scancodeE,
scancodeF,
scancodeG,
scancodeH,
scancodeI,
scancodeJ,
scancodeK,
scancodeL,
scancodeM,
scancodeN,
scancodeO,
scancodeP,
scancodeQ,
scancodeR,
scancodeS,
scancodeT,
scancodeU,
scancodeV,
scancodeW,
scancodeX,
scancodeY,
scancodeZ,
scancode1,
scancode2,
scancode3,
scancode4,
scancode5,
scancode6,
scancode7,
scancode8,
scancode9,
scancode0,
scancodeReturn,
scancodeEscape,
scancodeBackspace,
scancodeTab,
scancodeSpace,
scancodeMinus,
scancodeEquals,
scancodeLeftbracket,
scancodeRightbracket,
scancodeSemicolon,
scancodeApostrophe,
scancodeComma,
scancodePeriod,
scancodeSlash,
scancodeCapslock,
scancodeF1,
scancodeF2,
scancodeF3,
scancodeF4,
scancodeF5,
scancodeF6,
scancodeF7,
scancodeF8,
scancodeF9,
scancodeF10,
scancodeF11,
scancodeF12,
scancodePrintscreen,
scancodeScrolllock,
scancodePause,
scancodeHome,
scancodePageup,
scancodeDelete,
scancodeEnd,
scancodePagedown,
scancodeRight,
scancodeLeft,
scancodeDown,
scancodeUp,
scancodeKpDivide,
scancodeKpMultiply,
scancodeKpMinus,
scancodeKpPlus,
scancodeKpEnter,
scancodeKp1,
scancodeKp2,
scancodeKp3,
scancodeKp4,
scancodeKp5,
scancodeKp6,
scancodeKp7,
scancodeKp8,
scancodeKp9,
scancodeKp0,
scancodeKpPeriod,
scancodeKpEquals,
scancodeF13,
scancodeF14,
scancodeF15,
scancodeF16,
scancodeF17,
scancodeF18,
scancodeF19,
scancodeF20,
scancodeF21,
scancodeF22,
scancodeF23,
scancodeF24,
scancodeExecute,
scancodeSelect,
scancodeMute,
scancodeVolumeup,
scancodeVolumedown,
scancodeKpComma,
scancodeKpEqualsas400,
scancodeInternational2,
scancodeInternational4,
scancodeInternational5,
scancodeInternational6,
scancodeInternational7,
scancodeInternational8,
scancodeInternational9,
scancodeSysreq,
scancodeClear,
scancodePrior,
scancodeReturn2,
scancodeSeparator,
scancodeOut,
scancodeOper,
scancodeClearagain,
scancodeCrsel,
scancodeExsel,
scancodeKp00,
scancodeKp000,
scancodeThousandsseparator,
scancodeDecimalseparator,
scancodeCurrencyunit,
scancodeCurrencysubunit,
scancodeKpLeftparen,
scancodeKpRightparen,
scancodeKpLeftbrace,
scancodeKpRightbrace,
scancodeKpTab,
scancodeKpBackspace,
scancodeKpA,
scancodeKpB,
scancodeKpC,
scancodeKpD,
scancodeKpE,
scancodeKpF,
scancodeKpXor,
scancodeKpPower,
scancodeKpPercent,
scancodeKpLess,
scancodeKpGreater,
scancodeKpAmpersand,
scancodeKpDblampersand,
scancodeKpVerticalbar,
scancodeKpDblverticalbar,
scancodeKpColon,
scancodeKpHash,
scancodeKpSpace,
scancodeKpAt,
scancodeKpExclam,
scancodeKpMemstore,
scancodeKpMemrecall,
scancodeKpMemclear,
scancodeKpMemadd,
scancodeKpMemsubtract,
scancodeKpMemmultiply,
scancodeKpMemdivide,
scancodeKpPlusminus,
scancodeKpClear,
scancodeKpClearentry,
scancodeKpBinary,
scancodeKpOctal,
scancodeKpDecimal,
scancodeKpHexadecimal,
scancodeLctrl,
scancodeLshift,
scancodeRctrl,
scancodeRshift,
};
pub const TouchID = u64;
pub const KeyboardID = u32;
pub const MouseID = u32;
pub const Window = opaque {};
pub const FingerID = u64;
pub const Keycode = u32;
pub const SensorID = u32;
pub const JoystickID = u32;
pub const Keymod = u16;
pub const EventType = enum(c_int) {
eventDisplayFirst,
eventDisplayLast,
eventWindowFirst,
eventWindowLast,
eventFingerDown,
eventFingerUp,
eventFingerMotion,
eventFingerCanceled,
eventPrivate0,
eventPrivate1,
eventPrivate2,
eventPrivate3,
eventUser,
eventLast,
eventEnumPadding,
};
pub const CommonEvent = extern struct {
type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
};
pub const DisplayEvent = extern struct {
type: EventType, // SDL_DISPLAYEVENT_*
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
displayID: DisplayID, // The associated display
data1: i32, // event dependent data
data2: i32, // event dependent data
};
pub const WindowEvent = extern struct {
type: EventType, // SDL_EVENT_WINDOW_*
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The associated window
data1: i32, // event dependent data
data2: i32, // event dependent data
};
pub const KeyboardDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_KEYBOARD_ADDED or SDL_EVENT_KEYBOARD_REMOVED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: KeyboardID, // The keyboard instance id
};
pub const KeyboardEvent = extern struct {
type: EventType, // SDL_EVENT_KEY_DOWN or SDL_EVENT_KEY_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with keyboard focus, if any
which: KeyboardID, // The keyboard instance id, or 0 if unknown or virtual
scancode: Scancode, // SDL physical key code
key: Keycode, // SDL virtual key code
mod: Keymod, // current key modifiers
raw: u16, // The platform dependent scancode for this event
down: bool, // true if the key is pressed
repeat: bool, // true if this is a key repeat
};
pub const TextEditingEvent = extern struct {
type: EventType, // SDL_EVENT_TEXT_EDITING
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with keyboard focus, if any
text: [*c]const u8, // The editing text
start: i32, // The start cursor of selected editing text, or -1 if not set
length: i32, // The length of selected editing text, or -1 if not set
};
pub const TextEditingCandidatesEvent = extern struct {
type: EventType, // SDL_EVENT_TEXT_EDITING_CANDIDATES
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with keyboard focus, if any
candidates: [*c]const [*c]const u8, // The list of candidates, or NULL if there are no candidates available
num_candidates: i32, // The number of strings in `candidates`
selected_candidate: i32, // The index of the selected candidate, or -1 if no candidate is selected
horizontal: bool, // true if the list is horizontal, false if it's vertical
padding1: u8,
padding2: u8,
padding3: u8,
};
pub const TextInputEvent = extern struct {
type: EventType, // SDL_EVENT_TEXT_INPUT
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with keyboard focus, if any
text: [*c]const u8, // The input text, UTF-8 encoded
};
pub const MouseDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_MOUSE_ADDED or SDL_EVENT_MOUSE_REMOVED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: MouseID, // The mouse instance id
};
pub const MouseMotionEvent = extern struct {
type: EventType, // SDL_EVENT_MOUSE_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with mouse focus, if any
which: MouseID, // The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0
state: MouseButtonFlags, // The current button state
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
xrel: f32, // The relative motion in the X direction
yrel: f32, // The relative motion in the Y direction
};
pub const MouseButtonEvent = extern struct {
type: EventType, // SDL_EVENT_MOUSE_BUTTON_DOWN or SDL_EVENT_MOUSE_BUTTON_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with mouse focus, if any
which: MouseID, // The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, or 0
button: u8, // The mouse button index
down: bool, // true if the button is pressed
clicks: u8, // 1 for single-click, 2 for double-click, etc.
padding: u8,
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
};
pub const MouseWheelEvent = extern struct {
type: EventType, // SDL_EVENT_MOUSE_WHEEL
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with mouse focus, if any
which: MouseID, // The mouse instance id in relative mode or 0
x: f32, // The amount scrolled horizontally, positive to the right and negative to the left
y: f32, // The amount scrolled vertically, positive away from the user and negative toward the user
direction: MouseWheelDirection, // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back
mouse_x: f32, // X coordinate, relative to window
mouse_y: f32, // Y coordinate, relative to window
};
pub const JoyAxisEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_AXIS_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
axis: u8, // The joystick axis index
padding1: u8,
padding2: u8,
padding3: u8,
value: i16, // The axis value (range: -32768 to 32767)
padding4: u16,
};
pub const JoyBallEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_BALL_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
ball: u8, // The joystick trackball index
padding1: u8,
padding2: u8,
padding3: u8,
xrel: i16, // The relative motion in the X direction
yrel: i16, // The relative motion in the Y direction
};
pub const JoyHatEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_HAT_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
hat: u8, // The joystick hat index
padding1: u8,
padding2: u8,
};
pub const JoyButtonEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
button: u8, // The joystick button index
down: bool, // true if the button is pressed
padding1: u8,
padding2: u8,
};
pub const JoyDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_ADDED or SDL_EVENT_JOYSTICK_REMOVED or SDL_EVENT_JOYSTICK_UPDATE_COMPLETE
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
};
pub const JoyBatteryEvent = extern struct {
type: EventType, // SDL_EVENT_JOYSTICK_BATTERY_UPDATED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
state: PowerState, // The joystick battery state
percent: c_int, // The joystick battery percent charge remaining
};
pub const GamepadAxisEvent = extern struct {
type: EventType, // SDL_EVENT_GAMEPAD_AXIS_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
axis: u8, // The gamepad axis (SDL_GamepadAxis)
padding1: u8,
padding2: u8,
padding3: u8,
value: i16, // The axis value (range: -32768 to 32767)
padding4: u16,
};
pub const GamepadButtonEvent = extern struct {
type: EventType, // SDL_EVENT_GAMEPAD_BUTTON_DOWN or SDL_EVENT_GAMEPAD_BUTTON_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
button: u8, // The gamepad button (SDL_GamepadButton)
down: bool, // true if the button is pressed
padding1: u8,
padding2: u8,
};
pub const GamepadDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_GAMEPAD_ADDED, SDL_EVENT_GAMEPAD_REMOVED, or SDL_EVENT_GAMEPAD_REMAPPED, SDL_EVENT_GAMEPAD_UPDATE_COMPLETE or SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
};
pub const GamepadTouchpadEvent = extern struct {
type: EventType, // SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN or SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION or SDL_EVENT_GAMEPAD_TOUCHPAD_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
touchpad: i32, // The index of the touchpad
finger: i32, // The index of the finger on the touchpad
x: f32, // Normalized in the range 0...1 with 0 being on the left
y: f32, // Normalized in the range 0...1 with 0 being at the top
pressure: f32, // Normalized in the range 0...1
};
pub const GamepadSensorEvent = extern struct {
type: EventType, // SDL_EVENT_GAMEPAD_SENSOR_UPDATE
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: JoystickID, // The joystick instance id
sensor: i32, // The type of the sensor, one of the values of SDL_SensorType
data: [3]f32, // Up to 3 values from the sensor, as defined in SDL_sensor.h
sensor_timestamp: u64, // The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock
};
pub const AudioDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_AUDIO_DEVICE_ADDED, or SDL_EVENT_AUDIO_DEVICE_REMOVED, or SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: AudioDeviceID, // SDL_AudioDeviceID for the device being added or removed or changing
recording: bool, // false if a playback device, true if a recording device.
padding1: u8,
padding2: u8,
padding3: u8,
};
pub const CameraDeviceEvent = extern struct {
type: EventType, // SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: CameraID, // SDL_CameraID for the device being added or removed or changing
};
pub const RenderEvent = extern struct {
type: EventType, // SDL_EVENT_RENDER_TARGETS_RESET, SDL_EVENT_RENDER_DEVICE_RESET, SDL_EVENT_RENDER_DEVICE_LOST
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window containing the renderer in question.
};
pub const TouchFingerEvent = extern struct {
type: EventType, // SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_UP, SDL_EVENT_FINGER_MOTION, or SDL_EVENT_FINGER_CANCELED
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
touchID: TouchID, // The touch device id
fingerID: FingerID,
x: f32, // Normalized in the range 0...1
y: f32, // Normalized in the range 0...1
dx: f32, // Normalized in the range -1...1
dy: f32, // Normalized in the range -1...1
pressure: f32, // Normalized in the range 0...1
windowID: WindowID, // The window underneath the finger, if any
};
pub const PenProximityEvent = extern struct {
type: EventType, // SDL_EVENT_PEN_PROXIMITY_IN or SDL_EVENT_PEN_PROXIMITY_OUT
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with pen focus, if any
which: PenID, // The pen instance id
};
pub const PenMotionEvent = extern struct {
type: EventType, // SDL_EVENT_PEN_MOTION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with pen focus, if any
which: PenID, // The pen instance id
pen_state: PenInputFlags, // Complete pen input state at time of event
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
};
pub const PenTouchEvent = extern struct {
type: EventType, // SDL_EVENT_PEN_DOWN or SDL_EVENT_PEN_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with pen focus, if any
which: PenID, // The pen instance id
pen_state: PenInputFlags, // Complete pen input state at time of event
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
eraser: bool, // true if eraser end is used (not all pens support this).
down: bool, // true if the pen is touching or false if the pen is lifted off
};
pub const PenButtonEvent = extern struct {
type: EventType, // SDL_EVENT_PEN_BUTTON_DOWN or SDL_EVENT_PEN_BUTTON_UP
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with mouse focus, if any
which: PenID, // The pen instance id
pen_state: PenInputFlags, // Complete pen input state at time of event
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
button: u8, // The pen button index (first button is 1).
down: bool, // true if the button is pressed
};
pub const PenAxisEvent = extern struct {
type: EventType, // SDL_EVENT_PEN_AXIS
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window with pen focus, if any
which: PenID, // The pen instance id
pen_state: PenInputFlags, // Complete pen input state at time of event
x: f32, // X coordinate, relative to window
y: f32, // Y coordinate, relative to window
axis: PenAxis, // Axis that has changed
value: f32, // New value of axis
};
pub const DropEvent = extern struct {
type: EventType, // SDL_EVENT_DROP_BEGIN or SDL_EVENT_DROP_FILE or SDL_EVENT_DROP_TEXT or SDL_EVENT_DROP_COMPLETE or SDL_EVENT_DROP_POSITION
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The window that was dropped on, if any
x: f32, // X coordinate, relative to window (not on begin)
y: f32, // Y coordinate, relative to window (not on begin)
source: [*c]const u8, // The source app that sent this drop event, or NULL if that isn't available
data: [*c]const u8, // The text for SDL_EVENT_DROP_TEXT and the file name for SDL_EVENT_DROP_FILE, NULL for other events
};
pub const ClipboardEvent = extern struct {
type: EventType, // SDL_EVENT_CLIPBOARD_UPDATE
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
owner: bool, // are we owning the clipboard (internal update)
num_mime_types: i32, // number of mime types
mime_types: [*c][*c]const u8, // current mime types
};
pub const SensorEvent = extern struct {
type: EventType, // SDL_EVENT_SENSOR_UPDATE
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
which: SensorID, // The instance ID of the sensor
data: [6]f32, // Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData()
sensor_timestamp: u64, // The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock
};
pub const QuitEvent = extern struct {
type: EventType, // SDL_EVENT_QUIT
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
};
pub const UserEvent = extern struct {
type: u32, // SDL_EVENT_USER through SDL_EVENT_LAST-1, Uint32 because these are not in the SDL_EventType enumeration
reserved: u32,
timestamp: u64, // In nanoseconds, populated using SDL_GetTicksNS()
windowID: WindowID, // The associated window if any
code: i32, // User defined event code
data1: ?*anyopaque, // User defined data pointer
data2: ?*anyopaque, // User defined data pointer
};
pub const Event = extern union {
type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration
common: CommonEvent, // Common event data
display: DisplayEvent, // Display event data
window: WindowEvent, // Window event data
kdevice: KeyboardDeviceEvent, // Keyboard device change event data
key: KeyboardEvent, // Keyboard event data
edit: TextEditingEvent, // Text editing event data
edit_candidates: TextEditingCandidatesEvent, // Text editing candidates event data
text: TextInputEvent, // Text input event data
mdevice: MouseDeviceEvent, // Mouse device change event data
motion: MouseMotionEvent, // Mouse motion event data
button: MouseButtonEvent, // Mouse button event data
wheel: MouseWheelEvent, // Mouse wheel event data
jdevice: JoyDeviceEvent, // Joystick device change event data
jaxis: JoyAxisEvent, // Joystick axis event data
jball: JoyBallEvent, // Joystick ball event data
jhat: JoyHatEvent, // Joystick hat event data
jbutton: JoyButtonEvent, // Joystick button event data
jbattery: JoyBatteryEvent, // Joystick battery event data
gdevice: GamepadDeviceEvent, // Gamepad device event data
gaxis: GamepadAxisEvent, // Gamepad axis event data
gbutton: GamepadButtonEvent, // Gamepad button event data
gtouchpad: GamepadTouchpadEvent, // Gamepad touchpad event data
gsensor: GamepadSensorEvent, // Gamepad sensor event data
adevice: AudioDeviceEvent, // Audio device event data
cdevice: CameraDeviceEvent, // Camera device event data
sensor: SensorEvent, // Sensor event data
quit: QuitEvent, // Quit request event data
user: UserEvent, // Custom event data
tfinger: TouchFingerEvent, // Touch finger event data
pproximity: PenProximityEvent, // Pen proximity event data
ptouch: PenTouchEvent, // Pen tip touching event data
pmotion: PenMotionEvent, // Pen motion event data
pbutton: PenButtonEvent, // Pen button event data
paxis: PenAxisEvent, // Pen axis event data
render: RenderEvent, // Render event data
drop: DropEvent, // Drag and drop event data
clipboard: ClipboardEvent, // Clipboard event data
padding: [128]u8,
};
pub inline fn pumpEvents() void {
return c.SDL_PumpEvents();
}
pub inline fn peepEvents(events: ?*Event, numevents: c_int, action: EventAction, minType: u32, maxType: u32) c_int {
return c.SDL_PeepEvents(events, numevents, action, minType, maxType);
}
pub inline fn hasEvent(type: u32) bool {
return c.SDL_HasEvent(type);
}
pub inline fn hasEvents(minType: u32, maxType: u32) bool {
return c.SDL_HasEvents(minType, maxType);
}
pub inline fn flushEvent(type: u32) void {
return c.SDL_FlushEvent(type);
}
pub inline fn flushEvents(minType: u32, maxType: u32) void {
return c.SDL_FlushEvents(minType, maxType);
}
pub inline fn pollEvent(event: ?*Event) bool {
return c.SDL_PollEvent(event);
}
pub inline fn waitEvent(event: ?*Event) bool {
return c.SDL_WaitEvent(event);
}
pub inline fn waitEventTimeout(event: ?*Event, timeoutMS: i32) bool {
return c.SDL_WaitEventTimeout(event, timeoutMS);
}
pub inline fn pushEvent(event: ?*Event) bool {
return c.SDL_PushEvent(event);
}
pub const EventFilter = *const fn (userdata: ?*anyopaque, event: ?*Event) callconv(.C) bool;
pub inline fn setEventFilter(filter: EventFilter, userdata: ?*anyopaque) void {
return c.SDL_SetEventFilter(filter, userdata);
}
pub inline fn getEventFilter(filter: ?*EventFilter, userdata: [*c]?*anyopaque) bool {
return c.SDL_GetEventFilter(filter, userdata);
}
pub inline fn addEventWatch(filter: EventFilter, userdata: ?*anyopaque) bool {
return c.SDL_AddEventWatch(filter, userdata);
}
pub inline fn removeEventWatch(filter: EventFilter, userdata: ?*anyopaque) void {
return c.SDL_RemoveEventWatch(filter, userdata);
}
pub inline fn filterEvents(filter: EventFilter, userdata: ?*anyopaque) void {
return c.SDL_FilterEvents(filter, userdata);
}
pub inline fn setEventEnabled(type: u32, enabled: bool) void {
return c.SDL_SetEventEnabled(type, enabled);
}
pub inline fn eventEnabled(type: u32) bool {
return c.SDL_EventEnabled(type);
}
pub inline fn registerEvents(numevents: c_int) u32 {
return c.SDL_RegisterEvents(numevents);
}
pub inline fn getWindowFromEvent(event: *const Event) ?*Window {
return c.SDL_GetWindowFromEvent(@ptrCast(event));
}

View File

@ -11,12 +11,34 @@ pub inline fn getPrefPath(org: [*c]const u8, app: [*c]const u8) [*c]u8 {
return c.SDL_GetPrefPath(org, app); return c.SDL_GetPrefPath(org, app);
} }
pub const Folder = enum(c_int) {
folderHome, //The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents.
folderDesktop, //The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons.
folderDocuments, //User document files, possibly application-specific. This is a good place to save a user's projects.
folderDownloads, //Standard folder for user files downloaded from the internet.
folderMusic, //Music files that can be played using a standard music player (mp3, ogg...).
folderPictures, //Image files that can be displayed using a standard viewer (png, jpg...).
folderPublicshare, //Files that are meant to be shared with other users on the same computer.
folderSavedgames, //Save files for games.
folderScreenshots, //Application screenshots.
folderTemplates, //Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file.
folderVideos, //Video files that can be played using a standard video player (mp4, webm...).
folderCount,
};
pub inline fn getUserFolder(folder: Folder) [*c]const u8 { pub inline fn getUserFolder(folder: Folder) [*c]const u8 {
return c.SDL_GetUserFolder(folder); return c.SDL_GetUserFolder(folder);
} }
pub const PathType = enum(c_int) {
pathtypeNone, //path does not exist
pathtypeFile, //a normal file
pathtypeDirectory, //a directory
pathtypeOther,
};
pub const PathInfo = extern struct { pub const PathInfo = extern struct {
type: PathType, // the path type _type: PathType, // the path type
size: u64, // the file size in bytes size: u64, // the file size in bytes
create_time: Time, // the time when the path was created create_time: Time, // the time when the path was created
modify_time: Time, // the last time the path was modified modify_time: Time, // the last time the path was modified
@ -33,6 +55,12 @@ pub inline fn createDirectory(path: [*c]const u8) bool {
return c.SDL_CreateDirectory(path); return c.SDL_CreateDirectory(path);
} }
pub const EnumerationResult = enum(c_int) {
enumContinue, //Value that requests that enumeration continue.
enumSuccess, //Value that requests that enumeration stop, successfully.
enumFailure,
};
pub const EnumerateDirectoryCallback = *const fn (userdata: ?*anyopaque, dirname: [*c]const u8, fname: [*c]const u8) callconv(.C) EnumerationResult; pub const EnumerateDirectoryCallback = *const fn (userdata: ?*anyopaque, dirname: [*c]const u8, fname: [*c]const u8) callconv(.C) EnumerationResult;
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 {

View File

@ -2,7 +2,6 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const JoystickConnectionState = enum(c_int) { pub const JoystickConnectionState = enum(c_int) {
joystickConnectionInvalid,
joystickConnectionUnknown, joystickConnectionUnknown,
joystickConnectionWired, joystickConnectionWired,
joystickConnectionWireless, joystickConnectionWireless,
@ -22,6 +21,26 @@ pub const IOStream = opaque {
pub const JoystickID = u32; pub const JoystickID = u32;
pub const SensorType = enum(c_int) {
sensorInvalid, //Returned for an invalid sensor
sensorUnknown, //Unknown sensor type
sensorAccel, //Accelerometer
sensorGyro, //Gyroscope
sensorAccelL, //Accelerometer for left Joy-Con controller and Wii nunchuk
sensorGyroL, //Gyroscope for left Joy-Con controller
sensorAccelR, //Accelerometer for right Joy-Con controller
sensorGyroR, //Gyroscope for right Joy-Con controller
};
pub const PowerState = enum(c_int) {
powerstateError, //error determining power status
powerstateUnknown, //cannot determine power status
powerstateOnBattery, //Not plugged in, running on the battery
powerstateNoBattery, //Plugged in, no battery available
powerstateCharging, //Plugged in, charging battery
powerstateCharged,
};
pub const Joystick = opaque {}; pub const Joystick = opaque {};
pub const Gamepad = opaque { pub const Gamepad = opaque {
@ -137,24 +156,24 @@ pub const Gamepad = opaque {
return c.SDL_GetGamepadTouchpadFinger(gamepad, touchpad, finger, @ptrCast(down), @ptrCast(x), @ptrCast(y), @ptrCast(pressure)); return 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 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 c.SDL_SetGamepadSensorEnabled(gamepad, @intFromEnum(_type), 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 c.SDL_GamepadSensorEnabled(gamepad, @intFromEnum(_type));
} }
pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, type: SensorType) f32 { pub inline fn getGamepadSensorDataRate(gamepad: *Gamepad, _type: SensorType) f32 {
return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(type)); return c.SDL_GetGamepadSensorDataRate(gamepad, @intFromEnum(_type));
} }
pub inline fn getGamepadSensorData(gamepad: *Gamepad, type: SensorType, data: *f32, num_values: c_int) bool { pub inline fn getGamepadSensorData(gamepad: *Gamepad, _type: SensorType, data: *f32, num_values: c_int) bool {
return c.SDL_GetGamepadSensorData(gamepad, @intFromEnum(type), @ptrCast(data), num_values); return 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 {
@ -187,7 +206,6 @@ pub const Gamepad = opaque {
}; };
pub const GamepadType = enum(c_int) { pub const GamepadType = enum(c_int) {
gamepadTypeUnknown,
gamepadTypeStandard, gamepadTypeStandard,
gamepadTypeXbox360, gamepadTypeXbox360,
gamepadTypeXboxone, gamepadTypeXboxone,
@ -202,7 +220,10 @@ pub const GamepadType = enum(c_int) {
}; };
pub const GamepadButton = enum(c_int) { pub const GamepadButton = enum(c_int) {
gamepadButtonInvalid, gamepadButtonSouth, //Bottom face button (e.g. Xbox A button)
gamepadButtonEast, //Right face button (e.g. Xbox B button)
gamepadButtonWest, //Left face button (e.g. Xbox X button)
gamepadButtonNorth, //Top face button (e.g. Xbox Y button)
gamepadButtonBack, gamepadButtonBack,
gamepadButtonGuide, gamepadButtonGuide,
gamepadButtonStart, gamepadButtonStart,
@ -214,6 +235,17 @@ pub const GamepadButton = enum(c_int) {
gamepadButtonDpadDown, gamepadButtonDpadDown,
gamepadButtonDpadLeft, gamepadButtonDpadLeft,
gamepadButtonDpadRight, gamepadButtonDpadRight,
gamepadButtonMisc1, //Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)
gamepadButtonRightPaddle1, //Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)
gamepadButtonLeftPaddle1, //Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)
gamepadButtonRightPaddle2, //Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)
gamepadButtonLeftPaddle2, //Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)
gamepadButtonTouchpad, //PS4/PS5 touchpad button
gamepadButtonMisc2, //Additional button
gamepadButtonMisc3, //Additional button
gamepadButtonMisc4, //Additional button
gamepadButtonMisc5, //Additional button
gamepadButtonMisc6, //Additional button
gamepadButtonCount, gamepadButtonCount,
}; };
@ -230,7 +262,6 @@ pub const GamepadButtonLabel = enum(c_int) {
}; };
pub const GamepadAxis = enum(c_int) { pub const GamepadAxis = enum(c_int) {
gamepadAxisInvalid,
gamepadAxisLeftx, gamepadAxisLeftx,
gamepadAxisLefty, gamepadAxisLefty,
gamepadAxisRightx, gamepadAxisRightx,
@ -241,7 +272,6 @@ pub const GamepadAxis = enum(c_int) {
}; };
pub const GamepadBindingType = enum(c_int) { pub const GamepadBindingType = enum(c_int) {
gamepadBindtypeNone,
gamepadBindtypeButton, gamepadBindtypeButton,
gamepadBindtypeAxis, gamepadBindtypeAxis,
gamepadBindtypeHat, gamepadBindtypeHat,
@ -366,8 +396,8 @@ pub inline fn getGamepadTypeFromString(str: [*c]const u8) GamepadType {
return @intFromEnum(c.SDL_GetGamepadTypeFromString(str)); return @intFromEnum(c.SDL_GetGamepadTypeFromString(str));
} }
pub inline fn getGamepadStringForType(type: GamepadType) [*c]const u8 { pub inline fn getGamepadStringForType(_type: GamepadType) [*c]const u8 {
return c.SDL_GetGamepadStringForType(@intFromEnum(type)); return c.SDL_GetGamepadStringForType(@intFromEnum(_type));
} }
pub inline fn getGamepadAxisFromString(str: [*c]const u8) GamepadAxis { pub inline fn getGamepadAxisFromString(str: [*c]const u8) GamepadAxis {
@ -386,6 +416,6 @@ pub inline fn getGamepadStringForButton(button: GamepadButton) [*c]const u8 {
return c.SDL_GetGamepadStringForButton(button); return c.SDL_GetGamepadStringForButton(button);
} }
pub inline fn getGamepadButtonLabelForType(type: GamepadType, button: GamepadButton) GamepadButtonLabel { pub inline fn getGamepadButtonLabelForType(_type: GamepadType, button: GamepadButton) GamepadButtonLabel {
return c.SDL_GetGamepadButtonLabelForType(@intFromEnum(type), button); return c.SDL_GetGamepadButtonLabelForType(@intFromEnum(_type), button);
} }

124
lib/sdl3/v2/gpu.zig vendored
View File

@ -19,6 +19,12 @@ pub const Rect = extern struct {
pub const Window = opaque {}; pub const Window = opaque {};
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
};
pub const GPUDevice = opaque { pub const GPUDevice = opaque {
pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void { pub inline fn destroyGPUDevice(gpudevice: *GPUDevice) void {
return c.SDL_DestroyGPUDevice(gpudevice); return c.SDL_DestroyGPUDevice(gpudevice);
@ -156,8 +162,8 @@ pub const GPUDevice = opaque {
return c.SDL_ReleaseGPUFence(gpudevice, fence); return c.SDL_ReleaseGPUFence(gpudevice, fence);
} }
pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, type: GPUTextureType, usage: GPUTextureUsageFlags) bool { pub inline fn gpuTextureSupportsFormat(gpudevice: *GPUDevice, format: GPUTextureFormat, _type: GPUTextureType, usage: GPUTextureUsageFlags) bool {
return c.SDL_GPUTextureSupportsFormat(gpudevice, @bitCast(format), @intFromEnum(type), @bitCast(usage)); return 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 {
@ -389,6 +395,32 @@ pub const GPUCopyPass = opaque {
pub const GPUFence = opaque {}; pub const GPUFence = opaque {};
pub const GPUPrimitiveType = enum(c_int) {
primitivetypeTrianglelist, //A series of separate triangles.
primitivetypeTrianglestrip, //A series of connected triangles.
primitivetypeLinelist, //A series of separate lines.
primitivetypeLinestrip, //A series of connected lines.
primitivetypePointlist, //A series of separate points.
};
pub const GPULoadOp = enum(c_int) {
loadopLoad, //The previous contents of the texture will be preserved.
loadopClear, //The contents of the texture will be cleared to a color.
loadopDontCare, //The previous contents of the texture need not be preserved. The contents will be undefined.
};
pub const GPUStoreOp = enum(c_int) {
storeopStore, //The contents generated during the render pass will be written to memory.
storeopDontCare, //The contents generated during the render pass are not needed and may be discarded. The contents will be undefined.
storeopResolve, //The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined.
storeopResolveAndStore, //The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory.
};
pub const GPUIndexElementSize = enum(c_int) {
indexelementsize16bit, //The index elements are 16-bit.
indexelementsize32bit, //The index elements are 32-bit.
};
pub const GPUTextureFormat = enum(c_int) { pub const GPUTextureFormat = enum(c_int) {
textureformatInvalid, textureformatInvalid,
textureformatA8Unorm, textureformatA8Unorm,
@ -509,6 +541,21 @@ pub const GPUTextureUsageFlags = packed struct(u32) {
rsvd: bool = false, rsvd: bool = false,
}; };
pub const GPUTextureType = enum(c_int) {
texturetype2d, //The texture is a 2-dimensional image.
texturetype2dArray, //The texture is a 2-dimensional array image.
texturetype3d, //The texture is a 3-dimensional image.
texturetypeCube, //The texture is a cube image.
texturetypeCubeArray, //The texture is a cube array image.
};
pub const GPUSampleCount = enum(c_int) {
samplecount1, //No multisampling.
samplecount2, //MSAA 2x
samplecount4, //MSAA 4x
samplecount8, //MSAA 8x
};
pub const GPUCubeMapFace = enum(c_int) { pub const GPUCubeMapFace = enum(c_int) {
cubemapfacePositivex, cubemapfacePositivex,
cubemapfaceNegativex, cubemapfaceNegativex,
@ -575,20 +622,75 @@ pub const GPUVertexElementFormat = enum(c_int) {
vertexelementformatHalf4, vertexelementformatHalf4,
}; };
pub const GPUVertexInputRate = enum(c_int) {
vertexinputrateVertex, //Attribute addressing is a function of the vertex index.
vertexinputrateInstance, //Attribute addressing is a function of the instance index.
};
pub const GPUFillMode = enum(c_int) {
fillmodeFill, //Polygons will be rendered via rasterization.
fillmodeLine, //Polygon edges will be drawn as line segments.
};
pub const GPUCullMode = enum(c_int) {
cullmodeNone, //No triangles are culled.
cullmodeFront, //Front-facing triangles are culled.
cullmodeBack, //Back-facing triangles are culled.
};
pub const GPUFrontFace = enum(c_int) {
frontfaceCounterClockwise, //A triangle with counter-clockwise vertex winding will be considered front-facing.
frontfaceClockwise, //A triangle with clockwise vertex winding will be considered front-facing.
};
pub const GPUCompareOp = enum(c_int) { pub const GPUCompareOp = enum(c_int) {
compareopInvalid, compareopInvalid,
compareopNever, //The comparison always evaluates false.
compareopLess, //The comparison evaluates reference < test.
compareopEqual, //The comparison evaluates reference == test.
compareopLessOrEqual, //The comparison evaluates reference <= test.
compareopGreater, //The comparison evaluates reference > test.
compareopNotEqual, //The comparison evaluates reference != test.
compareopGreaterOrEqual, //The comparison evalutes reference >= test.
compareopAlways, //The comparison always evaluates true.
}; };
pub const GPUStencilOp = enum(c_int) { pub const GPUStencilOp = enum(c_int) {
stencilopInvalid, stencilopInvalid,
stencilopKeep, //Keeps the current value.
stencilopZero, //Sets the value to 0.
stencilopReplace, //Sets the value to reference.
stencilopIncrementAndClamp, //Increments the current value and clamps to the maximum value.
stencilopDecrementAndClamp, //Decrements the current value and clamps to 0.
stencilopInvert, //Bitwise-inverts the current value.
stencilopIncrementAndWrap, //Increments the current value and wraps back to 0.
stencilopDecrementAndWrap, //Decrements the current value and wraps to the maximum value.
}; };
pub const GPUBlendOp = enum(c_int) { pub const GPUBlendOp = enum(c_int) {
blendopInvalid, blendopInvalid,
blendopAdd, //(source * source_factor) + (destination * destination_factor)
blendopSubtract, //(source * source_factor) - (destination * destination_factor)
blendopReverseSubtract, //(destination * destination_factor) - (source * source_factor)
blendopMin, //min(source, destination)
blendopMax,
}; };
pub const GPUBlendFactor = enum(c_int) { pub const GPUBlendFactor = enum(c_int) {
blendfactorInvalid, blendfactorInvalid,
blendfactorZero, //0
blendfactorOne, //1
blendfactorSrcColor, //source color
blendfactorOneMinusSrcColor, //1 - source color
blendfactorDstColor, //destination color
blendfactorOneMinusDstColor, //1 - destination color
blendfactorSrcAlpha, //source alpha
blendfactorOneMinusSrcAlpha, //1 - source alpha
blendfactorDstAlpha, //destination alpha
blendfactorOneMinusDstAlpha, //1 - destination alpha
blendfactorConstantColor, //blend constant
blendfactorOneMinusConstantColor, //1 - blend constant
blendfactorSrcAlphaSaturate,
}; };
pub const GPUColorComponentFlags = packed struct(u8) { pub const GPUColorComponentFlags = packed struct(u8) {
@ -600,6 +702,22 @@ pub const GPUColorComponentFlags = packed struct(u8) {
rsvd: bool = false, rsvd: bool = false,
}; };
pub const GPUFilter = enum(c_int) {
filterNearest, //Point filtering.
filterLinear, //Linear filtering.
};
pub const GPUSamplerMipmapMode = enum(c_int) {
samplermipmapmodeNearest, //Point filtering.
samplermipmapmodeLinear, //Linear filtering.
};
pub const GPUSamplerAddressMode = enum(c_int) {
sampleraddressmodeRepeat, //Specifies that the coordinates will wrap around.
sampleraddressmodeMirroredRepeat, //Specifies that the coordinates will wrap around mirrored.
sampleraddressmodeClampToEdge, //Specifies that the coordinates will clamp to the 0-1 range.
};
pub const GPUPresentMode = enum(c_int) { pub const GPUPresentMode = enum(c_int) {
presentmodeVsync, presentmodeVsync,
presentmodeImmediate, presentmodeImmediate,
@ -772,7 +890,7 @@ pub const GPUShaderCreateInfo = extern struct {
}; };
pub const GPUTextureCreateInfo = extern struct { pub const GPUTextureCreateInfo = extern struct {
type: GPUTextureType, // The base dimensionality of the texture. _type: GPUTextureType, // The base dimensionality of the texture.
format: GPUTextureFormat, // The pixel format of the texture. format: GPUTextureFormat, // The pixel format of the texture.
usage: GPUTextureUsageFlags, // How the texture is intended to be used by the client. usage: GPUTextureUsageFlags, // How the texture is intended to be used by the client.
width: u32, // The width of the texture. width: u32, // The width of the texture.

14
lib/sdl3/v2/guid.zig vendored
View File

@ -1,14 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const GUID = extern struct {
data: [16]u8,
};
pub inline fn guidToString(guid: GUID, pszGUID: [*c]u8, cbGUID: c_int) void {
return c.SDL_GUIDToString(guid, pszGUID, cbGUID);
}
pub inline fn stringToGUID(pchGUID: [*c]const u8) GUID {
return c.SDL_StringToGUID(pchGUID);
}

View File

@ -106,12 +106,12 @@ pub const Haptic = opaque {
}; };
pub const HapticDirection = extern struct { pub const HapticDirection = extern struct {
type: u8, // The type of encoding. _type: u8, // The type of encoding.
dir: [3]i32, // The encoded direction. dir: [3]i32, // The encoded direction.
}; };
pub const HapticConstant = extern struct { pub const HapticConstant = extern struct {
type: u16, // SDL_HAPTIC_CONSTANT _type: u16, // SDL_HAPTIC_CONSTANT
direction: HapticDirection, // Direction of the effect. direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect. length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect. delay: u16, // Delay before starting the effect.
@ -155,7 +155,7 @@ pub const HapticCondition = extern struct {
}; };
pub const HapticRamp = extern struct { pub const HapticRamp = extern struct {
type: u16, // SDL_HAPTIC_RAMP _type: u16, // SDL_HAPTIC_RAMP
direction: HapticDirection, // Direction of the effect. direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect. length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect. delay: u16, // Delay before starting the effect.
@ -170,14 +170,14 @@ pub const HapticRamp = extern struct {
}; };
pub const HapticLeftRight = extern struct { pub const HapticLeftRight = extern struct {
type: u16, // SDL_HAPTIC_LEFTRIGHT _type: u16, // SDL_HAPTIC_LEFTRIGHT
length: u32, // Duration of the effect in milliseconds. length: u32, // Duration of the effect in milliseconds.
large_magnitude: u16, // Control of the large controller motor. large_magnitude: u16, // Control of the large controller motor.
small_magnitude: u16, // Control of the small controller motor. small_magnitude: u16, // Control of the small controller motor.
}; };
pub const HapticCustom = extern struct { pub const HapticCustom = extern struct {
type: u16, // SDL_HAPTIC_CUSTOM _type: u16, // SDL_HAPTIC_CUSTOM
direction: HapticDirection, // Direction of the effect. direction: HapticDirection, // Direction of the effect.
length: u32, // Duration of the effect. length: u32, // Duration of the effect.
delay: u16, // Delay before starting the effect. delay: u16, // Delay before starting the effect.
@ -194,7 +194,7 @@ pub const HapticCustom = extern struct {
}; };
pub const HapticEffect = extern union { pub const HapticEffect = extern union {
type: u16, // Effect type. _type: u16, // Effect type.
constant: HapticConstant, // Constant effect. constant: HapticConstant, // Constant effect.
periodic: HapticPeriodic, // Periodic effect. periodic: HapticPeriodic, // Periodic effect.
condition: HapticCondition, // Condition effect. condition: HapticCondition, // Condition effect.

120
lib/sdl3/v2/hidapi.zig vendored
View File

@ -1,120 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const hid_device = opaque {
pub inline fn hid_write(hid_device: *hid_device, data: const unsigned char *, length: usize) c_int {
return c.SDL_hid_write(hid_device, data, length);
}
pub inline fn hid_read_timeout(hid_device: *hid_device, data: unsigned char *, length: usize, milliseconds: c_int) c_int {
return c.SDL_hid_read_timeout(hid_device, data, length, milliseconds);
}
pub inline fn hid_read(hid_device: *hid_device, data: unsigned char *, length: usize) c_int {
return c.SDL_hid_read(hid_device, data, length);
}
pub inline fn hid_set_nonblocking(hid_device: *hid_device, nonblock: c_int) c_int {
return c.SDL_hid_set_nonblocking(hid_device, nonblock);
}
pub inline fn hid_send_feature_report(hid_device: *hid_device, data: const unsigned char *, length: usize) c_int {
return c.SDL_hid_send_feature_report(hid_device, data, length);
}
pub inline fn hid_get_feature_report(hid_device: *hid_device, data: unsigned char *, length: usize) c_int {
return c.SDL_hid_get_feature_report(hid_device, data, length);
}
pub inline fn hid_get_input_report(hid_device: *hid_device, data: unsigned char *, length: usize) c_int {
return c.SDL_hid_get_input_report(hid_device, data, length);
}
pub inline fn hid_close(hid_device: *hid_device) c_int {
return c.SDL_hid_close(hid_device);
}
pub inline fn hid_get_manufacturer_string(hid_device: *hid_device, string: wchar_t *, maxlen: usize) c_int {
return c.SDL_hid_get_manufacturer_string(hid_device, string, maxlen);
}
pub inline fn hid_get_product_string(hid_device: *hid_device, string: wchar_t *, maxlen: usize) c_int {
return c.SDL_hid_get_product_string(hid_device, string, maxlen);
}
pub inline fn hid_get_serial_number_string(hid_device: *hid_device, string: wchar_t *, maxlen: usize) c_int {
return c.SDL_hid_get_serial_number_string(hid_device, string, maxlen);
}
pub inline fn hid_get_indexed_string(hid_device: *hid_device, string_index: c_int, string: wchar_t *, maxlen: usize) c_int {
return c.SDL_hid_get_indexed_string(hid_device, string_index, string, maxlen);
}
pub inline fn hid_get_device_info(hid_device: *hid_device) ?*hid_device_info {
return c.SDL_hid_get_device_info(hid_device);
}
pub inline fn hid_get_report_descriptor(hid_device: *hid_device, buf: unsigned char *, buf_size: usize) c_int {
return c.SDL_hid_get_report_descriptor(hid_device, buf, buf_size);
}
};
pub const hid_bus_type = enum(c_int) {
hidApiBusUnknown,
hidApiBusUsb,
hidApiBusBluetooth,
hidApiBusI2c,
hidApiBusSpi,
};
pub const hid_device_info = extern struct {
path: [*c]u8,
vendor_id: unsigned short,
product_id: unsigned short,
serial_number: wchar_t *,
release_number: unsigned short,
manufacturer_string: wchar_t *,
product_string: wchar_t *,
usage_page: unsigned short,
usage: unsigned short,
interface_number: c_int,
interface_class: c_int,
interface_subclass: c_int,
interface_protocol: c_int,
bus_type: hid_bus_type,
next: struct SDL_hid_device_info *,
};
pub inline fn hid_init() c_int {
return c.SDL_hid_init();
}
pub inline fn hid_exit() c_int {
return c.SDL_hid_exit();
}
pub inline fn hid_device_change_count() u32 {
return c.SDL_hid_device_change_count();
}
pub inline fn hid_enumerate(vendor_id: unsigned short, product_id: unsigned short) ?*hid_device_info {
return c.SDL_hid_enumerate(vendor_id, product_id);
}
pub inline fn hid_free_enumeration(devs: ?*hid_device_info) void {
return c.SDL_hid_free_enumeration(devs);
}
pub inline fn hid_open(vendor_id: unsigned short, product_id: unsigned short, serial_number: const wchar_t *) ?*hid_device {
return c.SDL_hid_open(vendor_id, product_id, serial_number);
}
pub inline fn hid_open_path(path: [*c]const u8) ?*hid_device {
return c.SDL_hid_open_path(path);
}
pub inline fn hid_ble_scan(active: bool) void {
return c.SDL_hid_ble_scan(active);
}

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 const Event = extern union { pub const Event = extern union {
type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration _type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration
common: CommonEvent, // Common event data common: CommonEvent, // Common event data
display: DisplayEvent, // Display event data display: DisplayEvent, // Display event data
window: WindowEvent, // Window event data window: WindowEvent, // Window event data
@ -56,6 +56,12 @@ pub const InitFlags = packed struct(u32) {
rsvd: bool = false, rsvd: bool = false,
}; };
pub const AppResult = enum(c_int) {
appContinue, //Value that requests that the app continue from the main callbacks.
appSuccess, //Value that requests termination with success from the main callbacks.
appFailure, //Value that requests termination with error from the main callbacks.
};
pub const AppInit_func = *const fn (appstate: [*c]?*anyopaque, argc: c_int, argv: [*c][*c]u8) callconv(.C) AppResult; pub const AppInit_func = *const fn (appstate: [*c]?*anyopaque, argc: c_int, argv: [*c][*c]u8) callconv(.C) AppResult;
pub const AppIterate_func = *const fn (appstate: ?*anyopaque) callconv(.C) AppResult; pub const AppIterate_func = *const fn (appstate: ?*anyopaque) callconv(.C) AppResult;

View File

@ -1,211 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PropertiesID = u32;
pub const IOStreamInterface = extern struct {
version: u32,
size: ?*const anyopaque,
seek: ?*const anyopaque,
read: ?*const anyopaque,
write: ?*const anyopaque,
flush: ?*const anyopaque,
close: ?*const anyopaque,
};
pub const IOStream = opaque {
pub inline fn closeIO(iostream: *IOStream) bool {
return c.SDL_CloseIO(iostream);
}
pub inline fn getIOProperties(iostream: *IOStream) PropertiesID {
return c.SDL_GetIOProperties(iostream);
}
pub inline fn getIOStatus(iostream: *IOStream) IOStatus {
return c.SDL_GetIOStatus(iostream);
}
pub inline fn getIOSize(iostream: *IOStream) i64 {
return c.SDL_GetIOSize(iostream);
}
pub inline fn seekIO(iostream: *IOStream, offset: i64, whence: IOWhence) i64 {
return c.SDL_SeekIO(iostream, offset, whence);
}
pub inline fn tellIO(iostream: *IOStream) i64 {
return c.SDL_TellIO(iostream);
}
pub inline fn readIO(iostream: *IOStream, ptr: ?*anyopaque, size: usize) usize {
return c.SDL_ReadIO(iostream, ptr, size);
}
pub inline fn writeIO(iostream: *IOStream, ptr: ?*const anyopaque, size: usize) usize {
return c.SDL_WriteIO(iostream, ptr, size);
}
pub inline fn iOprintf(iostream: *IOStream, fmt: [*c]const u8, ...) usize {
return c.SDL_IOprintf(
iostream,
fmt,
);
}
pub inline fn iOvprintf(iostream: *IOStream, fmt: [*c]const u8, ap: std.builtin.VaList) usize {
return c.SDL_IOvprintf(iostream, fmt, ap);
}
pub inline fn flushIO(iostream: *IOStream) bool {
return c.SDL_FlushIO(iostream);
}
pub inline fn loadFile_IO(iostream: *IOStream, datasize: *usize, closeio: bool) ?*anyopaque {
return c.SDL_LoadFile_IO(iostream, @ptrCast(datasize), closeio);
}
pub inline fn saveFile_IO(iostream: *IOStream, data: ?*const anyopaque, datasize: usize, closeio: bool) bool {
return c.SDL_SaveFile_IO(iostream, data, datasize, closeio);
}
pub inline fn readU8(iostream: *IOStream, value: [*c]u8) bool {
return c.SDL_ReadU8(iostream, value);
}
pub inline fn readS8(iostream: *IOStream, value: *i8) bool {
return c.SDL_ReadS8(iostream, @ptrCast(value));
}
pub inline fn readU16LE(iostream: *IOStream, value: *u16) bool {
return c.SDL_ReadU16LE(iostream, @ptrCast(value));
}
pub inline fn readS16LE(iostream: *IOStream, value: *i16) bool {
return c.SDL_ReadS16LE(iostream, @ptrCast(value));
}
pub inline fn readU16BE(iostream: *IOStream, value: *u16) bool {
return c.SDL_ReadU16BE(iostream, @ptrCast(value));
}
pub inline fn readS16BE(iostream: *IOStream, value: *i16) bool {
return c.SDL_ReadS16BE(iostream, @ptrCast(value));
}
pub inline fn readU32LE(iostream: *IOStream, value: *u32) bool {
return c.SDL_ReadU32LE(iostream, @ptrCast(value));
}
pub inline fn readS32LE(iostream: *IOStream, value: *i32) bool {
return c.SDL_ReadS32LE(iostream, @ptrCast(value));
}
pub inline fn readU32BE(iostream: *IOStream, value: *u32) bool {
return c.SDL_ReadU32BE(iostream, @ptrCast(value));
}
pub inline fn readS32BE(iostream: *IOStream, value: *i32) bool {
return c.SDL_ReadS32BE(iostream, @ptrCast(value));
}
pub inline fn readU64LE(iostream: *IOStream, value: *u64) bool {
return c.SDL_ReadU64LE(iostream, @ptrCast(value));
}
pub inline fn readS64LE(iostream: *IOStream, value: [*c]Sint64) bool {
return c.SDL_ReadS64LE(iostream, value);
}
pub inline fn readU64BE(iostream: *IOStream, value: *u64) bool {
return c.SDL_ReadU64BE(iostream, @ptrCast(value));
}
pub inline fn readS64BE(iostream: *IOStream, value: [*c]Sint64) bool {
return c.SDL_ReadS64BE(iostream, value);
}
pub inline fn writeU8(iostream: *IOStream, value: u8) bool {
return c.SDL_WriteU8(iostream, value);
}
pub inline fn writeS8(iostream: *IOStream, value: i8) bool {
return c.SDL_WriteS8(iostream, value);
}
pub inline fn writeU16LE(iostream: *IOStream, value: u16) bool {
return c.SDL_WriteU16LE(iostream, value);
}
pub inline fn writeS16LE(iostream: *IOStream, value: i16) bool {
return c.SDL_WriteS16LE(iostream, value);
}
pub inline fn writeU16BE(iostream: *IOStream, value: u16) bool {
return c.SDL_WriteU16BE(iostream, value);
}
pub inline fn writeS16BE(iostream: *IOStream, value: i16) bool {
return c.SDL_WriteS16BE(iostream, value);
}
pub inline fn writeU32LE(iostream: *IOStream, value: u32) bool {
return c.SDL_WriteU32LE(iostream, value);
}
pub inline fn writeS32LE(iostream: *IOStream, value: i32) bool {
return c.SDL_WriteS32LE(iostream, value);
}
pub inline fn writeU32BE(iostream: *IOStream, value: u32) bool {
return c.SDL_WriteU32BE(iostream, value);
}
pub inline fn writeS32BE(iostream: *IOStream, value: i32) bool {
return c.SDL_WriteS32BE(iostream, value);
}
pub inline fn writeU64LE(iostream: *IOStream, value: u64) bool {
return c.SDL_WriteU64LE(iostream, value);
}
pub inline fn writeS64LE(iostream: *IOStream, value: i64) bool {
return c.SDL_WriteS64LE(iostream, value);
}
pub inline fn writeU64BE(iostream: *IOStream, value: u64) bool {
return c.SDL_WriteU64BE(iostream, value);
}
pub inline fn writeS64BE(iostream: *IOStream, value: i64) bool {
return c.SDL_WriteS64BE(iostream, value);
}
};
pub inline fn ioFromFile(file: [*c]const u8, mode: [*c]const u8) ?*IOStream {
return c.SDL_IOFromFile(file, mode);
}
pub inline fn ioFromMem(mem: ?*anyopaque, size: usize) ?*IOStream {
return c.SDL_IOFromMem(mem, size);
}
pub inline fn ioFromConstMem(mem: ?*const anyopaque, size: usize) ?*IOStream {
return c.SDL_IOFromConstMem(mem, size);
}
pub inline fn ioFromDynamicMem() ?*IOStream {
return c.SDL_IOFromDynamicMem();
}
pub inline fn openIO(iface: *const IOStreamInterface, userdata: ?*anyopaque) ?*IOStream {
return c.SDL_OpenIO(@ptrCast(iface), userdata);
}
pub inline fn loadFile(file: [*c]const u8, datasize: *usize) ?*anyopaque {
return c.SDL_LoadFile(file, @ptrCast(datasize));
}
pub inline fn saveFile(file: [*c]const u8, data: ?*const anyopaque, datasize: usize) bool {
return c.SDL_SaveFile(file, data, datasize);
}

View File

@ -3,10 +3,30 @@ pub const c = @import("c.zig").c;
pub const PropertiesID = u32; pub const PropertiesID = u32;
pub const SensorType = enum(c_int) {
sensorInvalid, //Returned for an invalid sensor
sensorUnknown, //Unknown sensor type
sensorAccel, //Accelerometer
sensorGyro, //Gyroscope
sensorAccelL, //Accelerometer for left Joy-Con controller and Wii nunchuk
sensorGyroL, //Gyroscope for left Joy-Con controller
sensorAccelR, //Accelerometer for right Joy-Con controller
sensorGyroR, //Gyroscope for right Joy-Con controller
};
pub const GUID = extern struct { pub const GUID = extern struct {
data: [16]u8, data: [16]u8,
}; };
pub const PowerState = enum(c_int) {
powerstateError, //error determining power status
powerstateUnknown, //cannot determine power status
powerstateOnBattery, //Not plugged in, running on the battery
powerstateNoBattery, //Plugged in, no battery available
powerstateCharging, //Plugged in, charging battery
powerstateCharged,
};
pub const 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 c.SDL_SetJoystickVirtualAxis(joystick, axis, value);
@ -28,8 +48,8 @@ pub const Joystick = opaque {
return c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, down, x, y, pressure); return c.SDL_SetJoystickVirtualTouchpad(joystick, touchpad, finger, 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 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 {
@ -170,7 +190,6 @@ pub const JoystickType = enum(c_int) {
}; };
pub const JoystickConnectionState = enum(c_int) { pub const JoystickConnectionState = enum(c_int) {
joystickConnectionInvalid,
joystickConnectionUnknown, joystickConnectionUnknown,
joystickConnectionWired, joystickConnectionWired,
joystickConnectionWireless, joystickConnectionWireless,
@ -242,13 +261,13 @@ pub const VirtualJoystickTouchpadDesc = extern struct {
}; };
pub const VirtualJoystickSensorDesc = extern struct { pub const VirtualJoystickSensorDesc = extern struct {
type: SensorType, // the type of this sensor _type: SensorType, // the type of this sensor
rate: f32, // the update frequency of this sensor, may be 0.0f rate: f32, // the update frequency of this sensor, may be 0.0f
}; };
pub const VirtualJoystickDesc = extern struct { pub const VirtualJoystickDesc = extern struct {
version: u32, // the version of this interface version: u32, // the version of this interface
type: u16, // `SDL_JoystickType` _type: u16, // `SDL_JoystickType`
padding: u16, // unused padding: u16, // unused
vendor_id: u16, // the USB vendor ID of this joystick vendor_id: u16, // the USB vendor ID of this joystick
product_id: u16, // the USB product ID of this joystick product_id: u16, // the USB product ID of this joystick

View File

@ -1,297 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Scancode = enum(c_int) {
scancodeUnknown,
scancodeA,
scancodeB,
scancodeC,
scancodeD,
scancodeE,
scancodeF,
scancodeG,
scancodeH,
scancodeI,
scancodeJ,
scancodeK,
scancodeL,
scancodeM,
scancodeN,
scancodeO,
scancodeP,
scancodeQ,
scancodeR,
scancodeS,
scancodeT,
scancodeU,
scancodeV,
scancodeW,
scancodeX,
scancodeY,
scancodeZ,
scancode1,
scancode2,
scancode3,
scancode4,
scancode5,
scancode6,
scancode7,
scancode8,
scancode9,
scancode0,
scancodeReturn,
scancodeEscape,
scancodeBackspace,
scancodeTab,
scancodeSpace,
scancodeMinus,
scancodeEquals,
scancodeLeftbracket,
scancodeRightbracket,
scancodeSemicolon,
scancodeApostrophe,
scancodeComma,
scancodePeriod,
scancodeSlash,
scancodeCapslock,
scancodeF1,
scancodeF2,
scancodeF3,
scancodeF4,
scancodeF5,
scancodeF6,
scancodeF7,
scancodeF8,
scancodeF9,
scancodeF10,
scancodeF11,
scancodeF12,
scancodePrintscreen,
scancodeScrolllock,
scancodePause,
scancodeHome,
scancodePageup,
scancodeDelete,
scancodeEnd,
scancodePagedown,
scancodeRight,
scancodeLeft,
scancodeDown,
scancodeUp,
scancodeKpDivide,
scancodeKpMultiply,
scancodeKpMinus,
scancodeKpPlus,
scancodeKpEnter,
scancodeKp1,
scancodeKp2,
scancodeKp3,
scancodeKp4,
scancodeKp5,
scancodeKp6,
scancodeKp7,
scancodeKp8,
scancodeKp9,
scancodeKp0,
scancodeKpPeriod,
scancodeKpEquals,
scancodeF13,
scancodeF14,
scancodeF15,
scancodeF16,
scancodeF17,
scancodeF18,
scancodeF19,
scancodeF20,
scancodeF21,
scancodeF22,
scancodeF23,
scancodeF24,
scancodeExecute,
scancodeSelect,
scancodeMute,
scancodeVolumeup,
scancodeVolumedown,
scancodeKpComma,
scancodeKpEqualsas400,
scancodeInternational2,
scancodeInternational4,
scancodeInternational5,
scancodeInternational6,
scancodeInternational7,
scancodeInternational8,
scancodeInternational9,
scancodeSysreq,
scancodeClear,
scancodePrior,
scancodeReturn2,
scancodeSeparator,
scancodeOut,
scancodeOper,
scancodeClearagain,
scancodeCrsel,
scancodeExsel,
scancodeKp00,
scancodeKp000,
scancodeThousandsseparator,
scancodeDecimalseparator,
scancodeCurrencyunit,
scancodeCurrencysubunit,
scancodeKpLeftparen,
scancodeKpRightparen,
scancodeKpLeftbrace,
scancodeKpRightbrace,
scancodeKpTab,
scancodeKpBackspace,
scancodeKpA,
scancodeKpB,
scancodeKpC,
scancodeKpD,
scancodeKpE,
scancodeKpF,
scancodeKpXor,
scancodeKpPower,
scancodeKpPercent,
scancodeKpLess,
scancodeKpGreater,
scancodeKpAmpersand,
scancodeKpDblampersand,
scancodeKpVerticalbar,
scancodeKpDblverticalbar,
scancodeKpColon,
scancodeKpHash,
scancodeKpSpace,
scancodeKpAt,
scancodeKpExclam,
scancodeKpMemstore,
scancodeKpMemrecall,
scancodeKpMemclear,
scancodeKpMemadd,
scancodeKpMemsubtract,
scancodeKpMemmultiply,
scancodeKpMemdivide,
scancodeKpPlusminus,
scancodeKpClear,
scancodeKpClearentry,
scancodeKpBinary,
scancodeKpOctal,
scancodeKpDecimal,
scancodeKpHexadecimal,
scancodeLctrl,
scancodeLshift,
scancodeRctrl,
scancodeRshift,
};
pub const Window = opaque {
pub inline fn startTextInput(window: *Window) bool {
return c.SDL_StartTextInput(window);
}
pub inline fn startTextInputWithProperties(window: *Window, props: PropertiesID) bool {
return c.SDL_StartTextInputWithProperties(window, props);
}
pub inline fn textInputActive(window: *Window) bool {
return c.SDL_TextInputActive(window);
}
pub inline fn stopTextInput(window: *Window) bool {
return c.SDL_StopTextInput(window);
}
pub inline fn clearComposition(window: *Window) bool {
return c.SDL_ClearComposition(window);
}
pub inline fn setTextInputArea(window: *Window, rect: *const Rect, cursor: c_int) bool {
return c.SDL_SetTextInputArea(window, @ptrCast(rect), cursor);
}
pub inline fn getTextInputArea(window: *Window, rect: ?*Rect, cursor: *c_int) bool {
return c.SDL_GetTextInputArea(window, rect, @ptrCast(cursor));
}
pub inline fn screenKeyboardShown(window: *Window) bool {
return c.SDL_ScreenKeyboardShown(window);
}
};
pub const Keymod = u16;
pub const Rect = extern struct {
x: c_int,
y: c_int,
w: c_int,
h: c_int,
};
pub const Keycode = u32;
pub const PropertiesID = u32;
pub const KeyboardID = u32;
pub inline fn hasKeyboard() bool {
return c.SDL_HasKeyboard();
}
pub inline fn getKeyboards(count: *c_int) ?*KeyboardID {
return c.SDL_GetKeyboards(@ptrCast(count));
}
pub inline fn getKeyboardNameForID(instance_id: KeyboardID) [*c]const u8 {
return c.SDL_GetKeyboardNameForID(instance_id);
}
pub inline fn getKeyboardFocus() ?*Window {
return c.SDL_GetKeyboardFocus();
}
pub inline fn getKeyboardState(numkeys: *c_int) *const bool {
return @ptrCast(c.SDL_GetKeyboardState(@ptrCast(numkeys)));
}
pub inline fn resetKeyboard() void {
return c.SDL_ResetKeyboard();
}
pub inline fn getModState() Keymod {
return c.SDL_GetModState();
}
pub inline fn setModState(modstate: Keymod) void {
return c.SDL_SetModState(modstate);
}
pub inline fn getKeyFromScancode(scancode: Scancode, modstate: Keymod, key_event: bool) Keycode {
return c.SDL_GetKeyFromScancode(scancode, modstate, key_event);
}
pub inline fn getScancodeFromKey(key: Keycode, modstate: ?*Keymod) Scancode {
return c.SDL_GetScancodeFromKey(key, modstate);
}
pub inline fn setScancodeName(scancode: Scancode, name: [*c]const u8) bool {
return c.SDL_SetScancodeName(scancode, name);
}
pub inline fn getScancodeName(scancode: Scancode) [*c]const u8 {
return c.SDL_GetScancodeName(scancode);
}
pub inline fn getScancodeFromName(name: [*c]const u8) Scancode {
return c.SDL_GetScancodeFromName(name);
}
pub inline fn getKeyName(key: Keycode) [*c]const u8 {
return c.SDL_GetKeyName(key);
}
pub inline fn getKeyFromName(name: [*c]const u8) Keycode {
return c.SDL_GetKeyFromName(name);
}
pub inline fn hasScreenKeyboardSupport() bool {
return c.SDL_HasScreenKeyboardSupport();
}

View File

@ -1,11 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Locale = extern struct {
language: [*c]const u8, // A language name, like "en" for English.
country: [*c]const u8, // A country, like "US" for America. Can be NULL.
};
pub inline fn getPreferredLocales(count: *c_int) [*c][*c]Locale {
return c.SDL_GetPreferredLocales(@ptrCast(count));
}

138
lib/sdl3/v2/log.zig vendored
View File

@ -1,138 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const LogCategory = enum(c_int) {
logCategoryApplication,
logCategoryError,
logCategoryAssert,
logCategorySystem,
logCategoryAudio,
logCategoryVideo,
logCategoryRender,
logCategoryInput,
logCategoryTest,
logCategoryGpu,
logCategoryReserved2,
logCategoryReserved3,
logCategoryReserved4,
logCategoryReserved5,
logCategoryReserved6,
logCategoryReserved7,
logCategoryReserved8,
logCategoryReserved9,
logCategoryReserved10,
logCategoryCustom,
};
pub const LogPriority = enum(c_int) {
logPriorityInvalid,
logPriorityTrace,
logPriorityVerbose,
logPriorityDebug,
logPriorityInfo,
logPriorityWarn,
logPriorityError,
logPriorityCritical,
logPriorityCount,
};
pub inline fn setLogPriorities(priority: LogPriority) void {
return c.SDL_SetLogPriorities(priority);
}
pub inline fn setLogPriority(category: c_int, priority: LogPriority) void {
return c.SDL_SetLogPriority(category, priority);
}
pub inline fn getLogPriority(category: c_int) LogPriority {
return c.SDL_GetLogPriority(category);
}
pub inline fn resetLogPriorities() void {
return c.SDL_ResetLogPriorities();
}
pub inline fn setLogPriorityPrefix(priority: LogPriority, prefix: [*c]const u8) bool {
return c.SDL_SetLogPriorityPrefix(priority, prefix);
}
pub inline fn log(fmt: [*c]const u8, ...) void {
return c.SDL_Log(
fmt,
);
}
pub inline fn logTrace(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogTrace(
category,
fmt,
);
}
pub inline fn logVerbose(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogVerbose(
category,
fmt,
);
}
pub inline fn logDebug(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogDebug(
category,
fmt,
);
}
pub inline fn logInfo(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogInfo(
category,
fmt,
);
}
pub inline fn logWarn(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogWarn(
category,
fmt,
);
}
pub inline fn logError(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogError(
category,
fmt,
);
}
pub inline fn logCritical(category: c_int, fmt: [*c]const u8, ...) void {
return c.SDL_LogCritical(
category,
fmt,
);
}
pub inline fn logMessage(category: c_int, priority: LogPriority, fmt: [*c]const u8, ...) void {
return c.SDL_LogMessage(
category,
priority,
fmt,
);
}
pub inline fn logMessageV(category: c_int, priority: LogPriority, fmt: [*c]const u8, ap: std.builtin.VaList) void {
return c.SDL_LogMessageV(category, priority, fmt, ap);
}
pub const LogOutputFunction = *const fn (userdata: ?*anyopaque, category: c_int, priority: LogPriority, message: [*c]const u8) callconv(.C) void;
pub inline fn getDefaultLogOutputFunction() LogOutputFunction {
return c.SDL_GetDefaultLogOutputFunction();
}
pub inline fn getLogOutputFunction(callback: ?*LogOutputFunction, userdata: [*c]?*anyopaque) void {
return c.SDL_GetLogOutputFunction(callback, userdata);
}
pub inline fn setLogOutputFunction(callback: LogOutputFunction, userdata: ?*anyopaque) void {
return c.SDL_SetLogOutputFunction(callback, userdata);
}

View File

@ -38,6 +38,7 @@ pub const MessageBoxColorType = enum(c_int) {
messageboxColorButtonBorder, messageboxColorButtonBorder,
messageboxColorButtonBackground, messageboxColorButtonBackground,
messageboxColorButtonSelected, messageboxColorButtonSelected,
messageboxColorCount, //Size of the colors array of SDL_MessageBoxColorScheme.
}; };
pub const MessageBoxColorScheme = extern struct { pub const MessageBoxColorScheme = extern struct {

18
lib/sdl3/v2/metal.zig vendored
View File

@ -1,18 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Window = opaque {
pub inline fn metal_CreateView(window: *Window) MetalView {
return c.SDL_Metal_CreateView(window);
}
};
pub const MetalView = ?*anyopaque;
pub inline fn metal_DestroyView(view: MetalView) void {
return c.SDL_Metal_DestroyView(view);
}
pub inline fn metal_GetLayer(view: MetalView) ?*anyopaque {
return c.SDL_Metal_GetLayer(view);
}

25
lib/sdl3/v2/mouse.zig vendored
View File

@ -34,9 +34,34 @@ pub const Cursor = opaque {
}; };
pub const SystemCursor = enum(c_int) { pub const SystemCursor = enum(c_int) {
systemCursorDefault, //Default cursor. Usually an arrow.
systemCursorText, //Text selection. Usually an I-beam.
systemCursorWait, //Wait. Usually an hourglass or watch or spinning ball.
systemCursorCrosshair, //Crosshair.
systemCursorProgress, //Program is busy but still interactive. Usually it's WAIT with an arrow.
systemCursorNwseResize, //Double arrow pointing northwest and southeast.
systemCursorNeswResize, //Double arrow pointing northeast and southwest.
systemCursorEwResize, //Double arrow pointing west and east.
systemCursorNsResize, //Double arrow pointing north and south.
systemCursorMove, //Four pointed arrow pointing north, south, east, and west.
systemCursorNotAllowed, //Not permitted. Usually a slashed circle or crossbones.
systemCursorPointer, //Pointer that indicates a link. Usually a pointing hand.
systemCursorNwResize, //Window resize top-left. This may be a single arrow or a double arrow like NWSE_RESIZE.
systemCursorNResize, //Window resize top. May be NS_RESIZE.
systemCursorNeResize, //Window resize top-right. May be NESW_RESIZE.
systemCursorEResize, //Window resize right. May be EW_RESIZE.
systemCursorSeResize, //Window resize bottom-right. May be NWSE_RESIZE.
systemCursorSResize, //Window resize bottom. May be NS_RESIZE.
systemCursorSwResize, //Window resize bottom-left. May be NESW_RESIZE.
systemCursorWResize, //Window resize left. May be EW_RESIZE.
systemCursorCount, systemCursorCount,
}; };
pub const MouseWheelDirection = enum(c_int) {
mousewheelNormal, //The scroll direction is normal
mousewheelFlipped, //The scroll direction is flipped / natural
};
pub const MouseButtonFlags = packed struct(u32) { pub const MouseButtonFlags = packed struct(u32) {
buttonLeft: bool = false, buttonLeft: bool = false,
buttonMiddle: bool = false, buttonMiddle: bool = false,

145
lib/sdl3/v2/mutex.zig vendored
View File

@ -1,145 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const ThreadID = u64;
pub const AtomicInt = extern struct {
};
pub const Mutex = opaque {
pub inline fn lockMutex(mutex: *Mutex) void {
return c.SDL_LockMutex(mutex);
}
pub inline fn unlockMutex(mutex: *Mutex) void {
return c.SDL_UnlockMutex(mutex);
}
pub inline fn destroyMutex(mutex: *Mutex) void {
return c.SDL_DestroyMutex(mutex);
}
};
pub inline fn createMutex() ?*Mutex {
return c.SDL_CreateMutex();
}
pub inline fn tryLockMutex(SDL_TRY_ACQUIRE(0: Mutex *mutex), mutex) bool {
return c.SDL_TryLockMutex(SDL_TRY_ACQUIRE(0, );
}
pub const RWLock = opaque {
pub inline fn lockRWLockForReading(rwlock: *RWLock) void {
return c.SDL_LockRWLockForReading(rwlock);
}
pub inline fn lockRWLockForWriting(rwlock: *RWLock) void {
return c.SDL_LockRWLockForWriting(rwlock);
}
pub inline fn unlockRWLock(rwlock: *RWLock) void {
return c.SDL_UnlockRWLock(rwlock);
}
pub inline fn destroyRWLock(rwlock: *RWLock) void {
return c.SDL_DestroyRWLock(rwlock);
}
};
pub inline fn createRWLock() ?*RWLock {
return c.SDL_CreateRWLock();
}
pub inline fn tryLockRWLockForReading(SDL_TRY_ACQUIRE_SHARED(0: RWLock *rwlock), rwlock) bool {
return c.SDL_TryLockRWLockForReading(SDL_TRY_ACQUIRE_SHARED(0, );
}
pub inline fn tryLockRWLockForWriting(SDL_TRY_ACQUIRE(0: RWLock *rwlock), rwlock) bool {
return c.SDL_TryLockRWLockForWriting(SDL_TRY_ACQUIRE(0, );
}
pub const Semaphore = opaque {
pub inline fn destroySemaphore(semaphore: *Semaphore) void {
return c.SDL_DestroySemaphore(semaphore);
}
pub inline fn waitSemaphore(semaphore: *Semaphore) void {
return c.SDL_WaitSemaphore(semaphore);
}
pub inline fn tryWaitSemaphore(semaphore: *Semaphore) bool {
return c.SDL_TryWaitSemaphore(semaphore);
}
pub inline fn waitSemaphoreTimeout(semaphore: *Semaphore, timeoutMS: i32) bool {
return c.SDL_WaitSemaphoreTimeout(semaphore, timeoutMS);
}
pub inline fn signalSemaphore(semaphore: *Semaphore) void {
return c.SDL_SignalSemaphore(semaphore);
}
pub inline fn getSemaphoreValue(semaphore: *Semaphore) u32 {
return c.SDL_GetSemaphoreValue(semaphore);
}
};
pub inline fn createSemaphore(initial_value: u32) ?*Semaphore {
return c.SDL_CreateSemaphore(initial_value);
}
pub const Condition = opaque {
pub inline fn destroyCondition(condition: *Condition) void {
return c.SDL_DestroyCondition(condition);
}
pub inline fn signalCondition(condition: *Condition) void {
return c.SDL_SignalCondition(condition);
}
pub inline fn broadcastCondition(condition: *Condition) void {
return c.SDL_BroadcastCondition(condition);
}
pub inline fn waitCondition(condition: *Condition, mutex: ?*Mutex) void {
return c.SDL_WaitCondition(condition, mutex);
}
pub inline fn waitConditionTimeout(condition: *Condition, mutex: ?*Mutex, timeoutMS: i32) bool {
return c.SDL_WaitConditionTimeout(condition, mutex, timeoutMS);
}
};
pub inline fn createCondition() ?*Condition {
return c.SDL_CreateCondition();
}
pub const InitStatus = enum(c_int) {
initStatusUninitialized,
initStatusInitializing,
initStatusInitialized,
initStatusUninitializing,
};
pub const InitState = extern struct {
status: AtomicInt,
thread: ThreadID,
reserved: ?*anyopaque,
};
pub inline fn shouldInit(state: ?*InitState) bool {
return c.SDL_ShouldInit(state);
}
pub inline fn shouldQuit(state: ?*InitState) bool {
return c.SDL_ShouldQuit(state);
}
pub inline fn setInitialized(state: ?*InitState, initialized: bool) void {
return c.SDL_SetInitialized(state, initialized);
}

View File

@ -1,2 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;

16
lib/sdl3/v2/pen.zig vendored
View File

@ -1,16 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PenID = u32;
pub const PenInputFlags = packed struct(u32) {
penInputDown: bool = false, // pen is pressed down
penInputButton1: bool = false, // button 1 is pressed
penInputButton2: bool = false, // button 2 is pressed
penInputButton3: bool = false, // button 3 is pressed
penInputButton4: bool = false, // button 4 is pressed
penInputButton5: bool = false, // button 5 is pressed
penInputEraserTip: bool = false, // eraser tip is used
pad0: u24 = 0,
rsvd: bool = false,
};

164
lib/sdl3/v2/pixels.zig vendored
View File

@ -58,107 +58,99 @@ pub const PackedLayout = enum(c_int) {
}; };
pub const PixelFormat = enum(c_int) { pub const PixelFormat = enum(c_int) {
pixelformatUnknown, pixelformatYv12, //Planar mode: Y + V + U (3 planes)
pixelformatIndex1lsb, pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
pixelformatIndex1msb, pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
pixelformatIndex2lsb, pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
pixelformatIndex2msb, pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
pixelformatIndex4lsb, pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatIndex4msb, pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
pixelformatIndex8, pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatRgb332, pixelformatExternalOes, //Android video texture format
pixelformatXrgb4444, pixelformatMjpg, //Motion JPEG
pixelformatXbgr4444,
pixelformatXrgb1555,
pixelformatXbgr1555,
pixelformatArgb4444,
pixelformatRgba4444,
pixelformatAbgr4444,
pixelformatBgra4444,
pixelformatArgb1555,
pixelformatRgba5551,
pixelformatAbgr1555,
pixelformatBgra5551,
pixelformatRgb565,
pixelformatBgr565,
pixelformatRgb24,
pixelformatBgr24,
pixelformatXrgb8888,
pixelformatRgbx8888,
pixelformatXbgr8888,
pixelformatBgrx8888,
pixelformatArgb8888,
pixelformatRgba8888,
pixelformatAbgr8888,
pixelformatBgra8888,
pixelformatXrgb2101010,
pixelformatXbgr2101010,
pixelformatArgb2101010,
pixelformatAbgr2101010,
pixelformatRgb48,
pixelformatBgr48,
pixelformatRgba64,
pixelformatArgb64,
pixelformatBgra64,
pixelformatAbgr64,
pixelformatRgb48Float,
pixelformatBgr48Float,
pixelformatRgba64Float,
pixelformatArgb64Float,
pixelformatBgra64Float,
pixelformatAbgr64Float,
pixelformatRgb96Float,
pixelformatBgr96Float,
pixelformatRgba128Float,
pixelformatArgb128Float,
pixelformatBgra128Float,
pixelformatAbgr128Float,
pixelformatRgba32,
pixelformatArgb32,
pixelformatBgra32,
pixelformatAbgr32,
pixelformatRgbx32,
pixelformatXrgb32,
pixelformatBgrx32,
pixelformatXbgr32,
};
pub const ColorType = enum(c_int) {
colorTypeUnknown,
colorTypeRgb,
colorTypeYcbcr,
}; };
pub const ColorRange = enum(c_int) { pub const ColorRange = enum(c_int) {
colorRangeUnknown, colorRangeLimited, //Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma
colorRangeFull,
}; };
pub const ColorPrimaries = enum(c_int) { pub const ColorPrimaries = enum(c_int) {
colorPrimariesUnknown, colorPrimariesBt709, //ITU-R BT.709-6
colorPrimariesUnspecified, colorPrimariesBt470m, //ITU-R BT.470-6 System M
colorPrimariesCustom, colorPrimariesBt470bg, //ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625
colorPrimariesBt601, //ITU-R BT.601-7 525, SMPTE 170M
colorPrimariesSmpte240, //SMPTE 240M, functionally the same as SDL_COLOR_PRIMARIES_BT601
colorPrimariesGenericFilm, //Generic film (color filters using Illuminant C)
colorPrimariesBt2020, //ITU-R BT.2020-2 / ITU-R BT.2100-0
colorPrimariesXyz, //SMPTE ST 428-1
colorPrimariesSmpte431, //SMPTE RP 431-2
colorPrimariesSmpte432, //SMPTE EG 432-1 / DCI P3
colorPrimariesEbu3213, //EBU Tech. 3213-E
}; };
pub const TransferCharacteristics = enum(c_int) { pub const TransferCharacteristics = enum(c_int) {
transferCharacteristicsUnknown, transferCharacteristicsBt709, //Rec. ITU-R BT.709-6 / ITU-R BT1361
transferCharacteristicsUnspecified, transferCharacteristicsGamma22, //ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM
transferCharacteristicsLinear, transferCharacteristicsGamma28, //ITU-R BT.470-6 System B, G
transferCharacteristicsLog100, transferCharacteristicsBt601, //SMPTE ST 170M / ITU-R BT.601-7 525 or 625
transferCharacteristicsLog100Sqrt10, transferCharacteristicsSmpte240, //SMPTE ST 240M
transferCharacteristicsCustom, transferCharacteristicsIec61966, //IEC 61966-2-4
transferCharacteristicsBt1361, //ITU-R BT1361 Extended Colour Gamut
transferCharacteristicsSrgb, //IEC 61966-2-1 (sRGB or sYCC)
transferCharacteristicsBt202010bit, //ITU-R BT2020 for 10-bit system
transferCharacteristicsBt202012bit, //ITU-R BT2020 for 12-bit system
transferCharacteristicsPq, //SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
transferCharacteristicsSmpte428, //SMPTE ST 428-1
transferCharacteristicsHlg, //ARIB STD-B67, known as "hybrid log-gamma" (HLG)
}; };
pub const MatrixCoefficients = enum(c_int) { pub const MatrixCoefficients = enum(c_int) {
matrixCoefficientsIdentity, matrixCoefficientsBt709, //ITU-R BT.709-6
matrixCoefficientsUnspecified, matrixCoefficientsFcc, //US FCC Title 47
matrixCoefficientsYcgco, matrixCoefficientsBt470bg, //ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as SDL_MATRIX_COEFFICIENTS_BT601
matrixCoefficientsChromaDerivedNcl, matrixCoefficientsBt601, //ITU-R BT.601-7 525
matrixCoefficientsChromaDerivedCl, matrixCoefficientsSmpte240, //SMPTE 240M
matrixCoefficientsCustom, matrixCoefficientsBt2020Ncl, //ITU-R BT.2020-2 non-constant luminance
matrixCoefficientsBt2020Cl, //ITU-R BT.2020-2 constant luminance
matrixCoefficientsSmpte2085, //SMPTE ST 2085
matrixCoefficientsIctcp, //ITU-R BT.2100-0 ICTCP
};
pub const ChromaLocation = enum(c_int) {
chromaLocationNone, //RGB, no chroma sampling
chromaLocationLeft, //In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically.
chromaLocationCenter, //In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel.
chromaLocationTopleft,
}; };
pub const Colorspace = enum(c_int) { pub const Colorspace = enum(c_int) {
colorspaceUnknown, colorspaceSrgb, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
colorRangeFull,
colorPrimariesBt709,
transferCharacteristicsSrgb,
matrixCoefficientsIdentity,
colorspaceSrgbLinear, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709
transferCharacteristicsLinear,
colorspaceHdr10, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
colorPrimariesBt2020,
transferCharacteristicsPq,
colorspaceJpeg, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601
transferCharacteristicsBt601,
matrixCoefficientsBt601,
colorspaceBt601Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorRangeLimited,
colorPrimariesBt601,
colorspaceBt601Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorspaceBt709Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
transferCharacteristicsBt709,
matrixCoefficientsBt709,
colorspaceBt709Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
colorspaceBt2020Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020
matrixCoefficientsBt2020Ncl,
colorspaceBt2020Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
colorspaceRgbDefault, //The default colorspace for RGB surfaces if no colorspace is specified
colorspaceYuvDefault, //The default colorspace for YUV surfaces if no colorspace is specified
}; };
pub const Color = extern struct { pub const Color = extern struct {

View File

@ -1,6 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub inline fn getPowerInfo(seconds: *c_int, percent: *c_int) PowerState {
return c.SDL_GetPowerInfo(@ptrCast(seconds), @ptrCast(percent));
}

View File

@ -1,44 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PropertiesID = u32;
pub const IOStream = opaque {};
pub const Process = opaque {
pub inline fn getProcessProperties(process: *Process) PropertiesID {
return c.SDL_GetProcessProperties(process);
}
pub inline fn readProcess(process: *Process, datasize: *usize, exitcode: *c_int) ?*anyopaque {
return c.SDL_ReadProcess(process, @ptrCast(datasize), @ptrCast(exitcode));
}
pub inline fn getProcessInput(process: *Process) ?*IOStream {
return c.SDL_GetProcessInput(process);
}
pub inline fn getProcessOutput(process: *Process) ?*IOStream {
return c.SDL_GetProcessOutput(process);
}
pub inline fn killProcess(process: *Process, force: bool) bool {
return c.SDL_KillProcess(process, force);
}
pub inline fn waitProcess(process: *Process, block: bool, exitcode: *c_int) bool {
return c.SDL_WaitProcess(process, block, @ptrCast(exitcode));
}
pub inline fn destroyProcess(process: *Process) void {
return c.SDL_DestroyProcess(process);
}
};
pub inline fn createProcess(args: [*c]const [*c]const u8, pipe_stdio: bool) ?*Process {
return c.SDL_CreateProcess(args, pipe_stdio);
}
pub inline fn createProcessWithProperties(props: PropertiesID) ?*Process {
return c.SDL_CreateProcessWithProperties(props);
}

View File

@ -7,69 +7,16 @@ pub const FPoint = extern struct {
}; };
pub const PixelFormat = enum(c_int) { pub const PixelFormat = enum(c_int) {
pixelformatUnknown, pixelformatYv12, //Planar mode: Y + V + U (3 planes)
pixelformatIndex1lsb, pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
pixelformatIndex1msb, pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
pixelformatIndex2lsb, pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
pixelformatIndex2msb, pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
pixelformatIndex4lsb, pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatIndex4msb, pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
pixelformatIndex8, pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatRgb332, pixelformatExternalOes, //Android video texture format
pixelformatXrgb4444, pixelformatMjpg, //Motion JPEG
pixelformatXbgr4444,
pixelformatXrgb1555,
pixelformatXbgr1555,
pixelformatArgb4444,
pixelformatRgba4444,
pixelformatAbgr4444,
pixelformatBgra4444,
pixelformatArgb1555,
pixelformatRgba5551,
pixelformatAbgr1555,
pixelformatBgra5551,
pixelformatRgb565,
pixelformatBgr565,
pixelformatRgb24,
pixelformatBgr24,
pixelformatXrgb8888,
pixelformatRgbx8888,
pixelformatXbgr8888,
pixelformatBgrx8888,
pixelformatArgb8888,
pixelformatRgba8888,
pixelformatAbgr8888,
pixelformatBgra8888,
pixelformatXrgb2101010,
pixelformatXbgr2101010,
pixelformatArgb2101010,
pixelformatAbgr2101010,
pixelformatRgb48,
pixelformatBgr48,
pixelformatRgba64,
pixelformatArgb64,
pixelformatBgra64,
pixelformatAbgr64,
pixelformatRgb48Float,
pixelformatBgr48Float,
pixelformatRgba64Float,
pixelformatArgb64Float,
pixelformatBgra64Float,
pixelformatAbgr64Float,
pixelformatRgb96Float,
pixelformatBgr96Float,
pixelformatRgba128Float,
pixelformatArgb128Float,
pixelformatBgra128Float,
pixelformatAbgr128Float,
pixelformatRgba32,
pixelformatArgb32,
pixelformatBgra32,
pixelformatAbgr32,
pixelformatRgbx32,
pixelformatXrgb32,
pixelformatBgrx32,
pixelformatXbgr32,
}; };
pub const FColor = extern struct { pub const FColor = extern struct {
@ -86,7 +33,8 @@ pub const Surface = opaque {
}; };
pub const ScaleMode = enum(c_int) { pub const ScaleMode = enum(c_int) {
scalemodeInvalid, scalemodeNearest, //nearest pixel sampling
scalemodeLinear, //linear filtering
}; };
pub const PropertiesID = u32; pub const PropertiesID = u32;
@ -111,7 +59,7 @@ pub const FRect = extern struct {
}; };
pub const Event = extern union { pub const Event = extern union {
type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration _type: u32, // Event type, shared with all events, Uint32 to cover user events which are not in the SDL_EventType enumeration
common: CommonEvent, // Common event data common: CommonEvent, // Common event data
display: DisplayEvent, // Display event data display: DisplayEvent, // Display event data
window: WindowEvent, // Window event data window: WindowEvent, // Window event data
@ -152,6 +100,12 @@ pub const Event = extern union {
padding: [128]u8, padding: [128]u8,
}; };
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
};
pub const Rect = extern struct { pub const Rect = extern struct {
x: c_int, x: c_int,
y: c_int, y: c_int,
@ -195,6 +149,20 @@ pub const Vertex = extern struct {
tex_coord: FPoint, // Normalized texture coordinates, if needed tex_coord: FPoint, // Normalized texture coordinates, if needed
}; };
pub const TextureAccess = enum(c_int) {
textureaccessStatic, //Changes rarely, not lockable
textureaccessStreaming, //Changes frequently, lockable
textureaccessTarget, //Texture can be used as a render target
};
pub const RendererLogicalPresentation = enum(c_int) {
logicalPresentationDisabled, //There is no logical size in effect
logicalPresentationStretch, //The rendered content is stretched to the output resolution
logicalPresentationLetterbox, //The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars
logicalPresentationOverscan, //The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds
logicalPresentationIntegerScale, //The rendered content is scaled up by integer multiples to fit the output resolution
};
pub const Renderer = opaque { pub const Renderer = opaque {
pub inline fn getRenderWindow(renderer: *Renderer) ?*Window { pub inline fn getRenderWindow(renderer: *Renderer) ?*Window {
return c.SDL_GetRenderWindow(renderer); return c.SDL_GetRenderWindow(renderer);

View File

@ -1,184 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Scancode = enum(c_int) {
scancodeUnknown,
scancodeA,
scancodeB,
scancodeC,
scancodeD,
scancodeE,
scancodeF,
scancodeG,
scancodeH,
scancodeI,
scancodeJ,
scancodeK,
scancodeL,
scancodeM,
scancodeN,
scancodeO,
scancodeP,
scancodeQ,
scancodeR,
scancodeS,
scancodeT,
scancodeU,
scancodeV,
scancodeW,
scancodeX,
scancodeY,
scancodeZ,
scancode1,
scancode2,
scancode3,
scancode4,
scancode5,
scancode6,
scancode7,
scancode8,
scancode9,
scancode0,
scancodeReturn,
scancodeEscape,
scancodeBackspace,
scancodeTab,
scancodeSpace,
scancodeMinus,
scancodeEquals,
scancodeLeftbracket,
scancodeRightbracket,
scancodeSemicolon,
scancodeApostrophe,
scancodeComma,
scancodePeriod,
scancodeSlash,
scancodeCapslock,
scancodeF1,
scancodeF2,
scancodeF3,
scancodeF4,
scancodeF5,
scancodeF6,
scancodeF7,
scancodeF8,
scancodeF9,
scancodeF10,
scancodeF11,
scancodeF12,
scancodePrintscreen,
scancodeScrolllock,
scancodePause,
scancodeHome,
scancodePageup,
scancodeDelete,
scancodeEnd,
scancodePagedown,
scancodeRight,
scancodeLeft,
scancodeDown,
scancodeUp,
scancodeKpDivide,
scancodeKpMultiply,
scancodeKpMinus,
scancodeKpPlus,
scancodeKpEnter,
scancodeKp1,
scancodeKp2,
scancodeKp3,
scancodeKp4,
scancodeKp5,
scancodeKp6,
scancodeKp7,
scancodeKp8,
scancodeKp9,
scancodeKp0,
scancodeKpPeriod,
scancodeKpEquals,
scancodeF13,
scancodeF14,
scancodeF15,
scancodeF16,
scancodeF17,
scancodeF18,
scancodeF19,
scancodeF20,
scancodeF21,
scancodeF22,
scancodeF23,
scancodeF24,
scancodeExecute,
scancodeSelect,
scancodeMute,
scancodeVolumeup,
scancodeVolumedown,
scancodeKpComma,
scancodeKpEqualsas400,
scancodeInternational2,
scancodeInternational4,
scancodeInternational5,
scancodeInternational6,
scancodeInternational7,
scancodeInternational8,
scancodeInternational9,
scancodeSysreq,
scancodeClear,
scancodePrior,
scancodeReturn2,
scancodeSeparator,
scancodeOut,
scancodeOper,
scancodeClearagain,
scancodeCrsel,
scancodeExsel,
scancodeKp00,
scancodeKp000,
scancodeThousandsseparator,
scancodeDecimalseparator,
scancodeCurrencyunit,
scancodeCurrencysubunit,
scancodeKpLeftparen,
scancodeKpRightparen,
scancodeKpLeftbrace,
scancodeKpRightbrace,
scancodeKpTab,
scancodeKpBackspace,
scancodeKpA,
scancodeKpB,
scancodeKpC,
scancodeKpD,
scancodeKpE,
scancodeKpF,
scancodeKpXor,
scancodeKpPower,
scancodeKpPercent,
scancodeKpLess,
scancodeKpGreater,
scancodeKpAmpersand,
scancodeKpDblampersand,
scancodeKpVerticalbar,
scancodeKpDblverticalbar,
scancodeKpColon,
scancodeKpHash,
scancodeKpSpace,
scancodeKpAt,
scancodeKpExclam,
scancodeKpMemstore,
scancodeKpMemrecall,
scancodeKpMemclear,
scancodeKpMemadd,
scancodeKpMemsubtract,
scancodeKpMemmultiply,
scancodeKpMemdivide,
scancodeKpPlusminus,
scancodeKpClear,
scancodeKpClearentry,
scancodeKpBinary,
scancodeKpOctal,
scancodeKpDecimal,
scancodeKpHexadecimal,
scancodeLctrl,
scancodeLshift,
scancodeRctrl,
scancodeRshift,
};

View File

@ -35,6 +35,17 @@ pub const Sensor = opaque {
pub const SensorID = u32; pub const SensorID = u32;
pub const SensorType = enum(c_int) {
sensorInvalid, //Returned for an invalid sensor
sensorUnknown, //Unknown sensor type
sensorAccel, //Accelerometer
sensorGyro, //Gyroscope
sensorAccelL, //Accelerometer for left Joy-Con controller and Wii nunchuk
sensorGyroL, //Gyroscope for left Joy-Con controller
sensorAccelR, //Accelerometer for right Joy-Con controller
sensorGyroR, //Gyroscope for right Joy-Con controller
};
pub inline fn getSensors(count: *c_int) ?*SensorID { pub inline fn getSensors(count: *c_int) ?*SensorID {
return c.SDL_GetSensors(@ptrCast(count)); return c.SDL_GetSensors(@ptrCast(count));
} }

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 const PathInfo = extern struct { pub const PathInfo = extern struct {
type: PathType, // the path type _type: PathType, // the path type
size: u64, // the file size in bytes size: u64, // the file size in bytes
create_time: Time, // the time when the path was created create_time: Time, // the time when the path was created
modify_time: Time, // the last time the path was modified modify_time: Time, // the last time the path was modified

View File

@ -2,69 +2,16 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const PixelFormat = enum(c_int) { pub const PixelFormat = enum(c_int) {
pixelformatUnknown, pixelformatYv12, //Planar mode: Y + V + U (3 planes)
pixelformatIndex1lsb, pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
pixelformatIndex1msb, pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
pixelformatIndex2lsb, pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
pixelformatIndex2msb, pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
pixelformatIndex4lsb, pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatIndex4msb, pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
pixelformatIndex8, pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatRgb332, pixelformatExternalOes, //Android video texture format
pixelformatXrgb4444, pixelformatMjpg, //Motion JPEG
pixelformatXbgr4444,
pixelformatXrgb1555,
pixelformatXbgr1555,
pixelformatArgb4444,
pixelformatRgba4444,
pixelformatAbgr4444,
pixelformatBgra4444,
pixelformatArgb1555,
pixelformatRgba5551,
pixelformatAbgr1555,
pixelformatBgra5551,
pixelformatRgb565,
pixelformatBgr565,
pixelformatRgb24,
pixelformatBgr24,
pixelformatXrgb8888,
pixelformatRgbx8888,
pixelformatXbgr8888,
pixelformatBgrx8888,
pixelformatArgb8888,
pixelformatRgba8888,
pixelformatAbgr8888,
pixelformatBgra8888,
pixelformatXrgb2101010,
pixelformatXbgr2101010,
pixelformatArgb2101010,
pixelformatAbgr2101010,
pixelformatRgb48,
pixelformatBgr48,
pixelformatRgba64,
pixelformatArgb64,
pixelformatBgra64,
pixelformatAbgr64,
pixelformatRgb48Float,
pixelformatBgr48Float,
pixelformatRgba64Float,
pixelformatArgb64Float,
pixelformatBgra64Float,
pixelformatAbgr64Float,
pixelformatRgb96Float,
pixelformatBgr96Float,
pixelformatRgba128Float,
pixelformatArgb128Float,
pixelformatBgra128Float,
pixelformatAbgr128Float,
pixelformatRgba32,
pixelformatArgb32,
pixelformatBgra32,
pixelformatAbgr32,
pixelformatRgbx32,
pixelformatXrgb32,
pixelformatBgrx32,
pixelformatXbgr32,
}; };
pub const BlendMode = u32; pub const BlendMode = u32;
@ -90,7 +37,32 @@ pub const Palette = extern struct {
}; };
pub const Colorspace = enum(c_int) { pub const Colorspace = enum(c_int) {
colorspaceUnknown, colorspaceSrgb, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
colorRangeFull,
colorPrimariesBt709,
transferCharacteristicsSrgb,
matrixCoefficientsIdentity,
colorspaceSrgbLinear, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709
transferCharacteristicsLinear,
colorspaceHdr10, //Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
colorPrimariesBt2020,
transferCharacteristicsPq,
colorspaceJpeg, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601
transferCharacteristicsBt601,
matrixCoefficientsBt601,
colorspaceBt601Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorRangeLimited,
colorPrimariesBt601,
colorspaceBt601Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601
colorspaceBt709Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
transferCharacteristicsBt709,
matrixCoefficientsBt709,
colorspaceBt709Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709
colorspaceBt2020Limited, //Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020
matrixCoefficientsBt2020Ncl,
colorspaceBt2020Full, //Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020
colorspaceRgbDefault, //The default colorspace for RGB surfaces if no colorspace is specified
colorspaceYuvDefault, //The default colorspace for YUV surfaces if no colorspace is specified
}; };
pub const PropertiesID = u32; pub const PropertiesID = u32;
@ -105,7 +77,14 @@ pub const SurfaceFlags = packed struct(u32) {
}; };
pub const ScaleMode = enum(c_int) { pub const ScaleMode = enum(c_int) {
scalemodeInvalid, scalemodeNearest, //nearest pixel sampling
scalemodeLinear, //linear filtering
};
pub const FlipMode = enum(c_int) {
flipNone, //Do not flip
flipHorizontal, //flip horizontally
flipVertical, //flip vertically
}; };
pub const Surface = opaque { pub const Surface = opaque {

View File

@ -108,7 +108,6 @@ pub inline fn isTV() bool {
} }
pub const Sandbox = enum(c_int) { pub const Sandbox = enum(c_int) {
sandboxNone,
sandboxUnknownContainer, sandboxUnknownContainer,
sandboxFlatpak, sandboxFlatpak,
sandboxSnap, sandboxSnap,

View File

@ -1,79 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const PropertiesID = u32;
pub const Thread = opaque {
pub inline fn getThreadName(thread: *Thread) [*c]const u8 {
return c.SDL_GetThreadName(thread);
}
pub inline fn getThreadID(thread: *Thread) ThreadID {
return c.SDL_GetThreadID(thread);
}
pub inline fn waitThread(thread: *Thread, status: *c_int) void {
return c.SDL_WaitThread(thread, @ptrCast(status));
}
pub inline fn getThreadState(thread: *Thread) ThreadState {
return c.SDL_GetThreadState(thread);
}
pub inline fn detachThread(thread: *Thread) void {
return c.SDL_DetachThread(thread);
}
};
pub const ThreadID = u64;
pub const TLSID = AtomicInt;
pub const ThreadPriority = enum(c_int) {
threadPriorityLow,
threadPriorityNormal,
threadPriorityHigh,
threadPriorityTimeCritical,
};
pub const ThreadFunction = *const fn(data: ?*anyopaque) callconv(.C) c_int;
pub inline fn createThread(fn: ThreadFunction, name: [*c]const u8, data: ?*anyopaque) ?*Thread {
return c.SDL_CreateThread(fn, name, data);
}
pub inline fn createThreadWithProperties(props: PropertiesID) ?*Thread {
return c.SDL_CreateThreadWithProperties(props);
}
pub inline fn createThreadRuntime(fn: ThreadFunction, name: [*c]const u8, data: ?*anyopaque, pfnBeginThread: FunctionPointer, pfnEndThread: FunctionPointer) ?*Thread {
return c.SDL_CreateThreadRuntime(fn, name, data, pfnBeginThread, pfnEndThread);
}
pub inline fn createThreadWithPropertiesRuntime(props: PropertiesID, pfnBeginThread: FunctionPointer, pfnEndThread: FunctionPointer) ?*Thread {
return c.SDL_CreateThreadWithPropertiesRuntime(props, pfnBeginThread, pfnEndThread);
}
pub inline fn getCurrentThreadID() ThreadID {
return c.SDL_GetCurrentThreadID();
}
pub inline fn setCurrentThreadPriority(priority: ThreadPriority) bool {
return c.SDL_SetCurrentThreadPriority(priority);
}
pub inline fn getTLS(id: ?*TLSID) ?*anyopaque {
return c.SDL_GetTLS(id);
}
pub const TLSDestructorCallback = *const fn(value: ?*anyopaque) callconv(.C) void;
pub inline fn setTLS(id: ?*TLSID, value: ?*const anyopaque, destructor: TLSDestructorCallback) bool {
return c.SDL_SetTLS(id, value, destructor);
}
pub inline fn cleanupTLS() void {
return c.SDL_CleanupTLS();
}

11
lib/sdl3/v2/time.zig vendored
View File

@ -15,6 +15,17 @@ pub const DateTime = extern struct {
utc_offset: c_int, // Seconds east of UTC utc_offset: c_int, // Seconds east of UTC
}; };
pub const DateFormat = enum(c_int) {
dateFormatYyyymmdd, //Year/Month/Day
dateFormatDdmmyyyy, //Day/Month/Year
dateFormatMmddyyyy, //Month/Day/Year
};
pub const TimeFormat = enum(c_int) {
timeFormat24hr, //24 hour time
timeFormat12hr, //12 hour time
};
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 c.SDL_GetDateTimeLocalePreferences(@bitCast(dateFormat), @bitCast(timeFormat));
} }

View File

@ -6,7 +6,9 @@ pub const TouchID = u64;
pub const FingerID = u64; pub const FingerID = u64;
pub const TouchDeviceType = enum(c_int) { pub const TouchDeviceType = enum(c_int) {
touchDeviceInvalid, touchDeviceDirect, //touch screen with window-relative coordinates
touchDeviceIndirectAbsolute, //trackpad with absolute device coordinates
touchDeviceIndirectRelative, //trackpad with screen cursor-relative coordinates
}; };
pub const Finger = extern struct { pub const Finger = extern struct {

119
lib/sdl3/v2/tray.zig vendored
View File

@ -1,119 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Surface = opaque {
pub inline fn createTray(surface: *Surface, tooltip: [*c]const u8) ?*Tray {
return c.SDL_CreateTray(surface, tooltip);
}
};
pub const Tray = opaque {
pub inline fn setTrayIcon(tray: *Tray, icon: ?*Surface) void {
return c.SDL_SetTrayIcon(tray, icon);
}
pub inline fn setTrayTooltip(tray: *Tray, tooltip: [*c]const u8) void {
return c.SDL_SetTrayTooltip(tray, tooltip);
}
pub inline fn createTrayMenu(tray: *Tray) ?*TrayMenu {
return c.SDL_CreateTrayMenu(tray);
}
pub inline fn getTrayMenu(tray: *Tray) ?*TrayMenu {
return c.SDL_GetTrayMenu(tray);
}
pub inline fn destroyTray(tray: *Tray) void {
return c.SDL_DestroyTray(tray);
}
};
pub const TrayMenu = opaque {
pub inline fn getTrayEntries(traymenu: *TrayMenu, count: *c_int) *const TrayEntry * {
return @ptrCast(c.SDL_GetTrayEntries(traymenu, @ptrCast(count)));
}
pub inline fn insertTrayEntryAt(traymenu: *TrayMenu, pos: c_int, label: [*c]const u8, flags: TrayEntryFlags) ?*TrayEntry {
return c.SDL_InsertTrayEntryAt(traymenu, pos, label, @bitCast(flags));
}
pub inline fn getTrayMenuParentEntry(traymenu: *TrayMenu) ?*TrayEntry {
return c.SDL_GetTrayMenuParentEntry(traymenu);
}
pub inline fn getTrayMenuParentTray(traymenu: *TrayMenu) ?*Tray {
return c.SDL_GetTrayMenuParentTray(traymenu);
}
};
pub const TrayEntry = opaque {
pub inline fn createTraySubmenu(trayentry: *TrayEntry) ?*TrayMenu {
return c.SDL_CreateTraySubmenu(trayentry);
}
pub inline fn getTraySubmenu(trayentry: *TrayEntry) ?*TrayMenu {
return c.SDL_GetTraySubmenu(trayentry);
}
pub inline fn removeTrayEntry(trayentry: *TrayEntry) void {
return c.SDL_RemoveTrayEntry(trayentry);
}
pub inline fn setTrayEntryLabel(trayentry: *TrayEntry, label: [*c]const u8) void {
return c.SDL_SetTrayEntryLabel(trayentry, label);
}
pub inline fn getTrayEntryLabel(trayentry: *TrayEntry) [*c]const u8 {
return c.SDL_GetTrayEntryLabel(trayentry);
}
pub inline fn setTrayEntryChecked(trayentry: *TrayEntry, checked: bool) void {
return c.SDL_SetTrayEntryChecked(trayentry, checked);
}
pub inline fn getTrayEntryChecked(trayentry: *TrayEntry) bool {
return c.SDL_GetTrayEntryChecked(trayentry);
}
pub inline fn setTrayEntryEnabled(trayentry: *TrayEntry, enabled: bool) void {
return c.SDL_SetTrayEntryEnabled(trayentry, enabled);
}
pub inline fn getTrayEntryEnabled(trayentry: *TrayEntry) bool {
return c.SDL_GetTrayEntryEnabled(trayentry);
}
pub inline fn setTrayEntryCallback(trayentry: *TrayEntry, callback: TrayCallback, userdata: ?*anyopaque) void {
return c.SDL_SetTrayEntryCallback(trayentry, callback, userdata);
}
pub inline fn clickTrayEntry(trayentry: *TrayEntry) void {
return c.SDL_ClickTrayEntry(trayentry);
}
pub inline fn getTrayEntryParent(trayentry: *TrayEntry) ?*TrayMenu {
return c.SDL_GetTrayEntryParent(trayentry);
}
};
pub const TrayEntryFlags = packed struct(u32) {
trayentryButton: bool = false, // Make the entry a simple button. Required.
trayentryCheckbox: bool = false, // Make the entry a checkbox. Required.
trayentrySubmenu: bool = false, // Prepare the entry to have a submenu. Required
trayentryDisabled: bool = false, // Make the entry disabled. Optional.
trayentryChecked: bool = false, // Make the entry checked. This is valid only for checkboxes. Optional.
pad0: u26 = 0,
rsvd: bool = false,
};
pub const TrayCallback = *const fn(userdata: ?*anyopaque, entry: ?*TrayEntry) callconv(.C) void;
pub inline fn updateTrays() void {
return c.SDL_UpdateTrays();
}

131
lib/sdl3/v2/video.zig vendored
View File

@ -2,69 +2,16 @@ const std = @import("std");
pub const c = @import("c.zig").c; pub const c = @import("c.zig").c;
pub const PixelFormat = enum(c_int) { pub const PixelFormat = enum(c_int) {
pixelformatUnknown, pixelformatYv12, //Planar mode: Y + V + U (3 planes)
pixelformatIndex1lsb, pixelformatIyuv, //Planar mode: Y + U + V (3 planes)
pixelformatIndex1msb, pixelformatYuy2, //Packed mode: Y0+U0+Y1+V0 (1 plane)
pixelformatIndex2lsb, pixelformatUyvy, //Packed mode: U0+Y0+V0+Y1 (1 plane)
pixelformatIndex2msb, pixelformatYvyu, //Packed mode: Y0+V0+Y1+U0 (1 plane)
pixelformatIndex4lsb, pixelformatNv12, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatIndex4msb, pixelformatNv21, //Planar mode: Y + V/U interleaved (2 planes)
pixelformatIndex8, pixelformatP010, //Planar mode: Y + U/V interleaved (2 planes)
pixelformatRgb332, pixelformatExternalOes, //Android video texture format
pixelformatXrgb4444, pixelformatMjpg, //Motion JPEG
pixelformatXbgr4444,
pixelformatXrgb1555,
pixelformatXbgr1555,
pixelformatArgb4444,
pixelformatRgba4444,
pixelformatAbgr4444,
pixelformatBgra4444,
pixelformatArgb1555,
pixelformatRgba5551,
pixelformatAbgr1555,
pixelformatBgra5551,
pixelformatRgb565,
pixelformatBgr565,
pixelformatRgb24,
pixelformatBgr24,
pixelformatXrgb8888,
pixelformatRgbx8888,
pixelformatXbgr8888,
pixelformatBgrx8888,
pixelformatArgb8888,
pixelformatRgba8888,
pixelformatAbgr8888,
pixelformatBgra8888,
pixelformatXrgb2101010,
pixelformatXbgr2101010,
pixelformatArgb2101010,
pixelformatAbgr2101010,
pixelformatRgb48,
pixelformatBgr48,
pixelformatRgba64,
pixelformatArgb64,
pixelformatBgra64,
pixelformatAbgr64,
pixelformatRgb48Float,
pixelformatBgr48Float,
pixelformatRgba64Float,
pixelformatArgb64Float,
pixelformatBgra64Float,
pixelformatAbgr64Float,
pixelformatRgb96Float,
pixelformatBgr96Float,
pixelformatRgba128Float,
pixelformatArgb128Float,
pixelformatBgra128Float,
pixelformatAbgr128Float,
pixelformatRgba32,
pixelformatArgb32,
pixelformatBgra32,
pixelformatAbgr32,
pixelformatRgbx32,
pixelformatXrgb32,
pixelformatBgrx32,
pixelformatXbgr32,
}; };
pub const Point = extern struct { pub const Point = extern struct {
@ -89,6 +36,12 @@ pub const DisplayID = u32;
pub const WindowID = u32; pub const WindowID = u32;
pub const SystemTheme = enum(c_int) {
systemThemeUnknown, //Unknown system theme
systemThemeLight, //Light colored system theme
systemThemeDark, //Dark colored system theme
};
pub const DisplayModeData = opaque {}; pub const DisplayModeData = opaque {};
pub const DisplayMode = extern struct { pub const DisplayMode = extern struct {
@ -103,6 +56,14 @@ pub const DisplayMode = extern struct {
internal: ?*DisplayModeData, // Private internal: ?*DisplayModeData, // Private
}; };
pub const DisplayOrientation = enum(c_int) {
orientationUnknown, //The display orientation can't be determined
orientationLandscape, //The display is in landscape mode, with the right side up, relative to portrait mode
orientationLandscapeFlipped, //The display is in landscape mode, with the left side up, relative to portrait mode
orientationPortrait, //The display is in portrait mode
orientationPortraitFlipped,
};
pub const Window = opaque { pub const Window = opaque {
pub inline fn getDisplayForWindow(window: *Window) DisplayID { pub inline fn getDisplayForWindow(window: *Window) DisplayID {
return c.SDL_GetDisplayForWindow(window); return c.SDL_GetDisplayForWindow(window);
@ -399,6 +360,12 @@ pub const WindowFlags = packed struct(u64) {
rsvd: bool = false, rsvd: bool = false,
}; };
pub const FlashOperation = enum(c_int) {
flashCancel, //Cancel any window flash state
flashBriefly, //Flash the window briefly to get attention
flashUntilFocused, //Flash the window until it gets focus
};
pub const GLContext = *anyopaque; pub const GLContext = *anyopaque;
pub const EGLDisplay = ?*anyopaque; pub const EGLDisplay = ?*anyopaque;
@ -416,6 +383,31 @@ pub const EGLAttribArrayCallback = *const fn (userdata: ?*anyopaque) callconv(.C
pub const EGLIntArrayCallback = *const fn (userdata: ?*anyopaque, display: EGLDisplay, config: EGLConfig) callconv(.C) ?*EGLint; pub const EGLIntArrayCallback = *const fn (userdata: ?*anyopaque, display: EGLDisplay, config: EGLConfig) callconv(.C) ?*EGLint;
pub const GLAttr = enum(c_int) { pub const GLAttr = enum(c_int) {
glRedSize, //the minimum number of bits for the red channel of the color buffer; defaults to 3.
glGreenSize, //the minimum number of bits for the green channel of the color buffer; defaults to 3.
glBlueSize, //the minimum number of bits for the blue channel of the color buffer; defaults to 2.
glAlphaSize, //the minimum number of bits for the alpha channel of the color buffer; defaults to 0.
glBufferSize, //the minimum number of bits for frame buffer size; defaults to 0.
glDoublebuffer, //whether the output is single or double buffered; defaults to double buffering on.
glDepthSize, //the minimum number of bits in the depth buffer; defaults to 16.
glStencilSize, //the minimum number of bits in the stencil buffer; defaults to 0.
glAccumRedSize, //the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
glAccumGreenSize, //the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
glAccumBlueSize, //the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
glAccumAlphaSize, //the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
glStereo, //whether the output is stereo 3D; defaults to off.
glMultisamplebuffers, //the number of buffers used for multisample anti-aliasing; defaults to 0.
glMultisamplesamples, //the number of samples used around the current pixel used for multisample anti-aliasing.
glAcceleratedVisual, //set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.
glRetainedBacking, //not used (deprecated).
glContextMajorVersion, //OpenGL context major version.
glContextMinorVersion, //OpenGL context minor version.
glContextFlags, //some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0.
glContextProfileMask, //type of GL context (Core, Compatibility, ES). See SDL_GLProfile; default value depends on platform.
glShareWithCurrentContext, //OpenGL context sharing; defaults to 0.
glFramebufferSrgbCapable, //requests sRGB capable visual; defaults to 0.
glContextReleaseBehavior, //sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH.
glContextResetNotification, //set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION.
glContextNoError, glContextNoError,
glFloatbuffers, glFloatbuffers,
glEglPlatform, glEglPlatform,
@ -525,6 +517,19 @@ pub inline fn getGrabbedWindow() ?*Window {
return c.SDL_GetGrabbedWindow(); return c.SDL_GetGrabbedWindow();
} }
pub const HitTestResult = enum(c_int) {
hittestNormal, //Region is normal. No special properties.
hittestDraggable, //Region can drag entire window.
hittestResizeTopleft, //Region is the resizable top-left corner border.
hittestResizeTop, //Region is the resizable top border.
hittestResizeTopright, //Region is the resizable top-right corner border.
hittestResizeRight, //Region is the resizable right border.
hittestResizeBottomright, //Region is the resizable bottom-right corner border.
hittestResizeBottom, //Region is the resizable bottom border.
hittestResizeBottomleft, //Region is the resizable bottom-left corner border.
hittestResizeLeft, //Region is the resizable left border.
};
pub inline fn screenSaverEnabled() bool { pub inline fn screenSaverEnabled() bool {
return c.SDL_ScreenSaverEnabled(); return c.SDL_ScreenSaverEnabled();
} }

View File

@ -1,34 +0,0 @@
const std = @import("std");
pub const c = @import("c.zig").c;
pub const Window = opaque {
pub inline fn vulkan_CreateSurface(window: *Window, instance: VkInstance, allocator: *const VkAllocationCallbacks, surface: [*c]VkSurfaceKHR) bool {
return c.SDL_Vulkan_CreateSurface(window, instance, @ptrCast(allocator), surface);
}
};
pub inline fn vulkan_LoadLibrary(path: [*c]const u8) bool {
return c.SDL_Vulkan_LoadLibrary(path);
}
pub inline fn vulkan_GetVkGetInstanceProcAddr() FunctionPointer {
return c.SDL_Vulkan_GetVkGetInstanceProcAddr();
}
pub inline fn vulkan_UnloadLibrary() void {
return c.SDL_Vulkan_UnloadLibrary();
}
pub inline fn vulkan_GetInstanceExtensions(count: *u32) [*c]char const * const {
return c.SDL_Vulkan_GetInstanceExtensions(@ptrCast(count));
}
pub inline fn vulkan_DestroySurface(instance: VkInstance, surface: VkSurfaceKHR, allocator: *const VkAllocationCallbacks) void {
return c.SDL_Vulkan_DestroySurface(instance, surface, @ptrCast(allocator));
}
pub inline fn vulkan_GetPresentationSupport(instance: VkInstance, physicalDevice: VkPhysicalDevice, queueFamilyIndex: u32) bool {
return c.SDL_Vulkan_GetPresentationSupport(instance, physicalDevice, queueFamilyIndex);
}