{"id":18893213,"url":"https://github.com/zig-gamedev/zsdl","last_synced_at":"2025-04-15T00:31:40.791Z","repository":{"id":261299765,"uuid":"883380753","full_name":"zig-gamedev/zsdl","owner":"zig-gamedev","description":"Zig bindings for SDL libs.","archived":false,"fork":false,"pushed_at":"2025-03-25T22:48:33.000Z","size":1123,"stargazers_count":15,"open_issues_count":1,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T23:30:48.994Z","etag":null,"topics":["bindings","gamedev","sdl","sdl2","sdl2-image","sdl2-ttf","sdl3","zig"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zig-gamedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-04T21:35:24.000Z","updated_at":"2025-03-25T22:48:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d71dc55-a93c-4bc9-ae28-ef264b37aa98","html_url":"https://github.com/zig-gamedev/zsdl","commit_stats":null,"previous_names":["zig-gamedev/zsdl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zig-gamedev%2Fzsdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zig-gamedev%2Fzsdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zig-gamedev%2Fzsdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zig-gamedev%2Fzsdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zig-gamedev","download_url":"https://codeload.github.com/zig-gamedev/zsdl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248984311,"owners_count":21193721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","gamedev","sdl","sdl2","sdl2-image","sdl2-ttf","sdl3","zig"],"created_at":"2024-11-08T08:12:29.626Z","updated_at":"2025-04-15T00:31:40.785Z","avatar_url":"https://github.com/zig-gamedev.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [zsdl](https://github.com/zig-gamedev/zsdl)\n\nZigified bindings for SDL libs. Work in progress.\n\n## Getting started (SDL2)\n\nExample `build.zig`:\n\n```zig\npub fn build(b: *std.Build) !void {\n\n    const exe = b.addExecutable(.{ ... });\n    exe.linkLibC();\n\n    const zsdl = b.dependency(\"zsdl\", .{});\n    \n    exe.root_module.addImport(\"zsdl2\", zsdl.module(\"zsdl2\"));\n    @import(\"zsdl\").link_SDL2(exe);\n\n    exe.root_module.addImport(\"zsdl2_ttf\", zsdl.module(\"zsdl2_ttf\"));\n    @import(\"zsdl\").link_SDL2_ttf(exe);\n    \n    exe.root_module.addImport(\"zsdl2_image\", zsdl.module(\"zsdl2_image\"));\n    @import(\"zsdl\").link_SDL2_image(exe);\n\n    // Optionally use prebuilt libs instead of relying on system installed SDL...\n    @import(\"zsdl\").prebuilt_sdl2.addLibraryPathsTo(exe);\n    if (@import(\"zsdl\").prebuilt_sdl2.install(b, target.result, .bin), .{\n        .ttf = true,\n        .image = true,\n    }) |install_sdl2_step| {\n        b.getInstallStep().dependOn(install_sdl2_step);\n    }\n}\n```\n\nNOTE: If you want to use our prebuilt libraries also add the following to your `build.zig.zon`:\n```zig\n        .@\"sdl2-prebuilt-macos\" = .{\n            .url = \"https://github.com/zig-gamedev/sdl2-prebuilt-macos/archive/f14773fa3de719b3a399b854c31eb4139d63842f.tar.gz\",\n            .hash = \"12205cb2da6fb4a7fcf28b9cd27b60aaf12f4d4a55be0260b1ae36eaf93ca5a99f03\",\n            .lazy = true,\n        },\n        .@\"sdl2-prebuilt-x86_64-windows-gnu\" = .{\n            .url = \"https://github.com/zig-gamedev/sdl2-prebuilt-x86_64-windows-gnu/archive/8143e2a5c28dbace399cbff14c3e8749a1afd418.tar.gz\",\n            .hash = \"1220ade6b84d06d73bf83cef22c73ec4abc21a6d50b9f48875f348b7942c80dde11b\",\n            .lazy = true,\n        },\n        .@\"sdl2-prebuilt-x86_64-linux-gnu\" = .{\n            .url = \"https://github.com/zig-gamedev/sdl2-prebuilt-x86_64-linux-gnu/archive/2eccc574ad909b0d00b694b10c217a95145c47af.tar.gz\",\n            .hash = \"12200ecb91c0596d0356ff39d573af83abcd44fecb27943589f11c2cd172763fea39\",\n            .lazy = true,\n        },\n```\n\nNow in your code you may import and use `zsdl2`:\n\n```zig\nconst std = @import(\"std\");\nconst sdl = @import(\"zsdl2\");\n\npub fn main() !void {\n    ...\n    try sdl.init(.{ .audio = true, .video = true });\n    defer sdl.quit();\n\n    const window = try sdl.Window.create(\n        \"zig-gamedev-window\",\n        sdl.Window.pos_undefined,\n        sdl.Window.pos_undefined,\n        600,\n        600,\n        .{ .opengl = true, .allow_highdpi = true },\n    );\n    defer window.destroy();\n    ...\n}\n```\n\n## Getting started (SDL3)\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzig-gamedev%2Fzsdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzig-gamedev%2Fzsdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzig-gamedev%2Fzsdl/lists"}