{"id":45690331,"url":"https://github.com/felixuxx/zsdl3","last_synced_at":"2026-03-09T23:00:51.374Z","repository":{"id":334461202,"uuid":"1140653093","full_name":"felixuxx/zsdl3","owner":"felixuxx","description":"high quality zig bindings for low-level access to sdl3's multimedia capabilities for game and application development. ","archived":false,"fork":false,"pushed_at":"2026-02-09T09:41:08.000Z","size":175,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-09T13:29:26.715Z","etag":null,"topics":["gamedev","sdl3","zig","zig-library","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felixuxx.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-23T15:22:29.000Z","updated_at":"2026-02-09T09:41:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/felixuxx/zsdl3","commit_stats":null,"previous_names":["felixuxx/zsdl3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/felixuxx/zsdl3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixuxx%2Fzsdl3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixuxx%2Fzsdl3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixuxx%2Fzsdl3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixuxx%2Fzsdl3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felixuxx","download_url":"https://codeload.github.com/felixuxx/zsdl3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felixuxx%2Fzsdl3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30315943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gamedev","sdl3","zig","zig-library","zig-package"],"created_at":"2026-02-24T17:00:17.819Z","updated_at":"2026-03-09T23:00:51.367Z","avatar_url":"https://github.com/felixuxx.png","language":"Zig","funding_links":[],"categories":["Multimedia \u0026 Graphics"],"sub_categories":["Graphics Library"],"readme":"# ZSDL3 - Zig Bindings for SDL3\n\n[![Zig](https://img.shields.io/badge/Zig-0.15.2+-blue.svg)](https://ziglang.org)\n[![SDL3](https://img.shields.io/badge/SDL-3.2.0+-green.svg)](https://www.libsdl.org/)\n\nHigh Quality Zig bindings for SDL3 without `@cImport`. Provides comprehensive,\nlow-level access to SDL3's multimedia capabilities for game and application\ndevelopment. Designed for performance and ease of use in modern Zig projects.\n\n---\n\n\u003e **Note**\nThis bindings project also includes SDL3_image and SDL3_ttf bindings for image\nand text rendering.\n\n---\n\n## Features\n\n### Core Subsystems\n\n- **Initialization**: SDL setup, subsystem management, app metadata\n- **Error Handling**: Cross-platform error reporting\n- **Events**: Complete event system with polling, filtering, and watching\n- **Time**: High-precision timing, timers, and delays\n- **Threads**: Multithreading with mutexes, conditions, and semaphores\n- **Filesystem**: File I/O, async operations, path management\n- **Hints**: Runtime configuration system\n\n### Multimedia\n\n- **Video**: Window creation, display management, fullscreen support\n- **Render**: 2D accelerated rendering with textures and geometry\n- **GPU**: 3D graphics with Vulkan, Metal, and D3D12 interop\n- **Audio**: Device enumeration, playback, recording, and mixing\n- **Input**: Keyboard, mouse, joystick, gamepad, touch, and sensor support\n\n### Advanced Utilities\n\n- **Atomic**: Lock-free operations and memory barriers\n- **Bits**: Bit manipulation utilities\n- **CPU Info**: Processor feature detection\n- **Dialog**: Native file and message dialogs\n- **Endian**: Byte order conversion\n- **GUID**: Unique identifier generation\n- **Intrinsics**: SIMD capability detection\n- **Clipboard**: System clipboard access\n- **Locale**: Internationalization support\n- **Messagebox**: System message boxes\n- **Platform**: Platform-specific utilities\n- **Power**: Battery and power management\n- **Process**: External process spawning\n- **Rect**: Rectangle math utilities\n- **Shared Object**: Dynamic library loading\n- **Stdinc**: Standard library helpers (strings, memory, math)\n- **Storage**: User data persistence\n- **System**: System information queries\n- **Tray**: System tray icons\n- **Assert**: Custom assertion handling\n- **Haptic**: Force feedback controllers\n- **HIDAPI**: Raw HID device access\n- **Vulkan**: Vulkan graphics integration\n- **Metal**: Metal graphics integration\n\n## Installation\n\n### Prerequisites\n\n- **Zig 0.15.2+**: [Download here](https://ziglang.org/download/)\n- **SDL3**: Install from your package manager or build from source\n\n#### Linux (Ubuntu/Debian)\n\n```bash\nsudo apt update\nsudo apt install libsdl3-dev\n```\n\n#### Linux (Arch)\n\n```bash\nsudo pacman -S sdl3\n```\n\n#### Linux (Fedora)\n\n```bash\nsudo dnf install SDL3-devel\n```\n\n#### macOS (Homebrew)\n\n```bash\nbrew install sdl3\n```\n\n#### Windows\n\nDownload SDL3 development libraries from\n[SDL releases](https://github.com/libsdl-org/SDL/releases) and place in your PATH.\n\n## Using as Library\n\n```bash\nzig fetch --save git+https://github.com/felixuxx/zsdl3.git\n```\n\n### Inside `build.zig`\n\n```zig\nconst std = @import(\"std\");\n\npub fn build(b: *std.Build) void {\n\n    const target = b.standardTargetOptions(.{});\n\n    const optimize = b.standardOptimizeOption(.{});\n\n    const mod = b.addModule(\"your-project-name\", .{\n\n        .root_source_file = b.path(\"src/root.zig\"),\n\n        .target = target,\n\n        // Add these\n        .link_libc = true,\n        .imports = \u0026.{\n            .{ .name = \"zsdl3\", .module = b.dependency(\"zsdl3\", .{}).module(\"zsdl3\") },\n        },\n        //\n\n    });\n    \n    // Add this\n    mod.linkSystemLibrary(\"SDL3\", .{});\n    //\n\n    const exe = b.addExecutable(.{\n        .name = \"your-project-name\",\n        .root_module = b.createModule(.{\n            .root_source_file = b.path(\"src/main.zig\"),\n            .target = target,\n            .optimize = optimize,\n            .imports = \u0026.{\n                .{ .name = \"your-project-name\", .module = mod },\n\n                // Add this\n                .{ .name = \"zsdl3\", .module = b.dependency(\"zsdl3\", .{}).module(\"zsdl3\") },\n                //\n\n            },\n        }),\n    });\n    \n    b.installArtifact(exe);\n// Rest of the build.zig code\n\n```\n\n### Building ZSDL3\n\n```bash\ngit clone https://github.com/felixuxx/zsdl3.git\ncd zsdl3\nzig build\n```\n\n## Usage\n\n### Basic 2D Rendering\n\n```zig\nconst std = @import(\"std\");\n\nconst zsdl3 = @import(\"zsdl3\");\n\npub fn main() void {\n    // Initialize SDL with video subsystem\n    if (!zsdl3.init(zsdl3.SDL_INIT_VIDEO)) {\n        const err = zsdl3.getError() orelse \"Unknown error\";\n        std.debug.print(\"Failed to initialize SDL: {s}\\n\", .{err});\n        return;\n    }\n    defer zsdl3.quit();\n\n    // Create a window\n    const window = zsdl3.createWindow(\"Basic 2D Example\", 800, 600, zsdl3.SDL_WINDOW_RESIZABLE);\n    if (window == null) {\n        const err = zsdl3.getError() orelse \"Unknown error\";\n        std.debug.print(\"Failed to create window: {s}\\n\", .{err});\n        return;\n    }\n    defer zsdl3.destroyWindow(window);\n\n    // Create a renderer\n    const renderer = zsdl3.createRenderer(window, null);\n    if (renderer == null) {\n        const err = zsdl3.getError() orelse \"Unknown error\";\n        std.debug.print(\"Failed to create renderer: {s}\\n\", .{err});\n        return;\n    }\n    defer zsdl3.destroyRenderer(renderer);\n\n    // Main loop\n    var running = true;\n    while (running) {\n        // Handle events\n        var event: zsdl3.SDL_Event = undefined;\n        while (zsdl3.pollEvent(\u0026event)) {\n            switch (event.type) {\n                zsdl3.SDL_EVENT_QUIT =\u003e running = false,\n                zsdl3.SDL_EVENT_KEY_DOWN =\u003e {\n                    if (event.key.scancode == zsdl3.SDL_SCANCODE_ESCAPE) {\n                        running = false;\n                    }\n                },\n                else =\u003e {},\n            }\n        }\n\n        // Clear screen with a color (dark blue)\n        _ = zsdl3.setRenderDrawColor(renderer, 30, 60, 90, 255);\n        _ = zsdl3.renderClear(renderer);\n\n        // Draw a simple rectangle (yellow)\n        _ = zsdl3.setRenderDrawColor(renderer, 255, 255, 0, 255);\n        const rect = zsdl3.SDL_FRect{\n            .x = 300,\n            .y = 200,\n            .w = 200,\n            .h = 200,\n        };\n        _ = zsdl3.renderFillRect(renderer, \u0026rect);\n\n        // Present the rendered frame\n        zsdl3.renderPresent(renderer);\n\n        // Small delay to prevent 100% CPU usage\n        zsdl3.delay(16); // ~60 FPS\n    }\n}\n\n```\n\n## API Reference\n\nAll SDL3 functions are available with Zig-friendly naming conventions:\n\n- `SDL_Init` → `init`\n- `SDL_CreateWindow` → `createWindow`\n- `SDL_RenderClear` → `renderClear`\n\n### Subsystem Organization\n\n- **Core**: `init`, `quit`, `getError`, `getVersion`\n- **Video**: `createWindow`, `destroyWindow`, `getWindowSize`\n- **Events**: `pollEvent`, `pushEvent`, `filterEvents`\n- **Input**: `getKeyboardState`, `getMouseState`, `openJoystick`\n- **Render**: `createRenderer`, `renderClear`, `renderPresent`\n- **GPU**: `createGPUDevice`, `acquireGPUCommandBuffer`\n- **Audio**: `openAudioDevice`, `pauseAudioDevice`\n- **Time**: `getTicks`, `delay`, `addTimer`\n- **Threads**: `createThread`, `createMutex`, `lockMutex`\n- **Filesystem**: `ioFromFile`, `loadFile`, `saveFile`\n- **And 25+ more subsystems**\n\nFor complete API details, see the [SDL3 Wiki](https://wiki.libsdl.org/SDL3/APIByCategory).\n\n## Building and Running\n\n### Basic Build\n\n```bash\nzig build\n```\n\n### Run Examples\n\n```bash\n# Main 2D example\nzig build run\n\n# GPU example\nzig build run -- gpu_example\n\n# Audio example\nzig build run -- audio_example\n\n# 3D example (GPU + fallback 2D)\nzig build run -- 3d_example\n```\n\n### Release Build\n\n```bash\nzig build -Doptimize=ReleaseFast\n```\n\n### Testing\n\n```bash\nzig build test\n```\n\n## Project Structure\n\n```bash\nsrc/\n├── core.zig          # Core SDL functionality\n├── pixels.zig        # Pixel formats and geometry\n├── video.zig         # Window and display management\n├── surface.zig       # Software surfaces\n├── events.zig        # Event system\n├── input.zig         # Input devices\n├── render.zig        # 2D rendering\n├── gpu.zig           # 3D GPU operations\n├── audio.zig         # Audio system\n├── time.zig          # Timing utilities\n├── threads.zig       # Multithreading\n├── filesystem.zig    # File I/O\n├── hints.zig         # Configuration\n├── properties.zig    # Key-value storage\n├── log.zig           # Logging system\n├── clipboard.zig     # Clipboard access\n├── platform.zig      # Platform utilities\n├── power.zig         # Power management\n├── system.zig        # System information\n├── keycode.zig       # Key mappings\n├── locale.zig        # Internationalization\n├── messagebox.zig    # Message dialogs\n├── misc.zig          # Miscellaneous utilities\n├── stdinc.zig        # Standard library helpers\n├── vulkan.zig        # Vulkan interop\n├── tray.zig          # System tray\n├── hidapi.zig        # HID devices\n├── storage.zig       # User storage\n├── assert.zig        # Assertions\n├── sharedobject.zig  # Dynamic libraries\n├── haptic.zig        # Force feedback\n├── sensor.zig        # Motion sensors\n├── pen.zig           # Stylus input\n├── touch.zig         # Touch input\n├── asyncio.zig       # Async I/O\n├── atomic.zig        # Atomic operations\n├── bits.zig          # Bit utilities\n├── cpuinfo.zig       # CPU detection\n├── dialog.zig        # File dialogs\n├── endian.zig        # Byte order\n├── guid.zig          # GUIDs\n├── intrinsics.zig    # SIMD detection\n├── metal.zig         # Metal interop\n├── process.zig       # Process management\n└── root.zig          # Main module exports\n└── main.zig          # Basic 2D example\nexamples/\n├── gpu_example.zig   # GPU device testing\n├── audio_example.zig # Audio enumeration example\n├── basic_2d.zig      # Basic 2D rendering\n└── 3d_example.zig    # 3D GPU rendering with fallback\n```\n\n## Contributing\n\nContributions welcome! Please:\n\n1. Follow Zig coding standards\n2. Add tests for new functionality\n3. Update documentation\n4. Ensure cross-platform compatibility\n\n## License\n\nSame as SDL3: zlib license. See [LICENSE](LICENSE) for details.\n\n## Acknowledgments\n\n- [SDL3](https://www.libsdl.org/) - The amazing multimedia library\n- [Zig](https://ziglang.org/) - The systems programming language\n- SDL community for comprehensive documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixuxx%2Fzsdl3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixuxx%2Fzsdl3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixuxx%2Fzsdl3/lists"}