|
|
||
|---|---|---|
| sdl3-zig | ||
| src | ||
| .gitignore | ||
| README.md | ||
| build.zig | ||
| build.zig.zon | ||
README.md
SDL3 Sample Project with Zig Bindings
A sample SDL3 application using Zig-native bindings instead of C imports.
Features
- SDL3 window initialization and management
- Zig-native API bindings vendored from sdl3bind
- Event loop with keyboard input handling
- Exits on pressing Escape key
- Basic rendering with color clear
Structure
src/main.zig- Main application using Zig SDL3 bindingssdl3-zig/- Vendored Zig bindings for SDL3sdl3.zig- Main module that re-exports all SDL3 APIssdl3/- Individual API modules (init, video, events, render, etc.)sdl3/c.zig- C import wrapper for SDL3 headers
build.zig- Build configurationbuild.zig.zon- Package manifest
Dependencies
- SDL3 (castholm's Zig port) - v0.4.0+3.4.0
- SDL3 Zig bindings - official/release-3.4.0
Building
zig build
Running
zig build run
Press Escape to exit the application.
Notes
- Uses Zig 0.15.2 API
- The Zig bindings provide type-safe, Zig-friendly wrappers around SDL3's C API
- Opaque pointer types require
@ptrCastwhen crossing between binding and C types - All SDL3 functions are accessed through the
sdlimport (e.g.,sdl.init_fn(),sdl.video.createWindow())