# SDL3 in pure zig

**URL:** <https://ziggit.dev/t/sdl3-in-pure-zig/14110>\
**Category:** Showcase\
**Tags:** tools, zig-0-15-2\
**Created:** [January 29, 2026, 11:20am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110 "2026-01-29T11:20:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 29, 2026, 11:20am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/1 "2026-01-29T11:20:19Z")

</div>

I just wanted to showcase one of my side projects

i basically wanted to use zig to work with sdl3 without having to talk to c code.

which lead to me building this project.

the project is here:

> **[GitHub - felixuxx/zsdl3: zig bindings for low-level access to sdl3's...](https://github.com/felixuxx/zsdl3)**
>
> zig bindings for low-level access to sdl3's multimedia capabilities for game and application development.

note: will probably move the repo to codeberg soon

---

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [January 29, 2026, 11:24am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/2 "2026-01-29T11:24:37Z")

</div>

I have no experience at all with SDL, but what I saw until now was an incredible mess of importing c-code, consts etc.  
So I must say: I love this extremely clean approach!

---

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 29, 2026, 11:28am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/3 "2026-01-29T11:28:29Z")

</div>

i appreciate you. this means alot to me.  
im also working on vulkan bindings without the c mess, it’s not done but its getting there

---

<div class="post-metadata">

**Author:** ![knightpp](https://ziggit.dev/user_avatar/ziggit.dev/knightpp/32/2423_2.png) [@knightpp](https://ziggit.dev/u/knightpp)\
**Post date:** [January 29, 2026, 8:54pm UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/5 "2026-01-29T20:54:34Z")

</div>

> Pure Zig bindings for SDL3 without `@cImport`

Are there downsides to `@cImport`?

There’s also [https://github.com/zig-gamedev/zsdl](https://github.com/zig-gamedev/zsdl), but they wrapped sdl’s api to be more Zig aligned. Your approach is interesting. When I was using C SDL in Zig, creating thin C wrappers made sense. But I would not want to copy-paste or even write again and again those wrappers in my next SDL project.

If you already listing all possible enums, does it make sense to wrap them into Zig enum?

---

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 29, 2026, 9:15pm UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/6 "2026-01-29T21:15:50Z")

</div>

i dont think there’s a clear downside. its more of a prefernce.

to be honest i was just experimenting to see how far this approach would take me, i wanted to know if taking c out of the equation will get me the same results.

yeah it doesnt really make sense to wrap them in zig enums but i just wanted to try out this approach

---

<div class="post-metadata">

**Author:** ![Cloudef](https://ziggit.dev/user_avatar/ziggit.dev/cloudef/32/1370_2.png) [@Cloudef](https://ziggit.dev/u/Cloudef)\
**Post date:** [January 30, 2026, 3:24am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/7 "2026-01-30T03:24:02Z")

</div>

The downsides of cImport / translate-c is that it does not understand enough context like what’s nullable pointer and what isn’t. The new external translate-c is better in regards that it can strip away `SDL_` namespace, put functions as methods inside `opaque`’s and `struct`’s! I also expect it to understand pointer nullability in future, but that requires the C codebase to actually use those attributes.

---

<div class="post-metadata">

**Author:** ![gustafla](https://ziggit.dev/user_avatar/ziggit.dev/gustafla/32/351_2.png) [@gustafla](https://ziggit.dev/u/gustafla)\
**Post date:** [January 30, 2026, 8:10am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/8 "2026-01-30T08:10:37Z")

</div>

I’ve been working on a demo engine/realtime renderer using SDL3 (thanks @castholm for maintaining the build system package), and it has been a joy compared to my problems with the (then immature) sdl3-crate in the Rust ecosystem, and it’s escape hatch, sdl3-sys. Not to cast any shade on those projects, making good high level Rust binding takes time, but my point is that using the C library directly in Zig is very easy compared to what I had to do when my project was still Rust-based!

---

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 30, 2026, 8:13am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/9 "2026-01-30T08:13:30Z")

</div>

thank you for the info. the only downsides i knew about `cImports` were header complexity and the pointer context like you said which i didnt think were clear downsides because they were easy to fix. these were the main reasons i didnt like having to set it up every time.

---

<div class="post-metadata">

**Author:** ![harryh](https://ziggit.dev/user_avatar/ziggit.dev/harryh/32/6782_2.png) [@harryh](https://ziggit.dev/u/harryh)\
**Post date:** [January 30, 2026, 8:59am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/10 "2026-01-30T08:59:32Z")

</div>

Just from a glance it feels like this is mostly AI generated code, which is a shame (afaik posting it is against the Ziggit AI policy too). Your other repositories would back this up, quite a few sus markdown files to guide AI.

Luckily there is no shortage of well maintained SDL3 bindings, like as previously mentioned [GitHub - castholm/SDL: SDL ported to the Zig build system](https://github.com/castholm/SDL).

I’ve also seen [7Games/zig-sdl3: Zig wrapper for SDL3. - Codeberg.org](https://codeberg.org/7Games/zig-sdl3) which looks very promising, a lot of thought and love going into zigifying the codebase.

---

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 30, 2026, 9:10am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/11 "2026-01-30T09:10:09Z")

</div>

the doccumentation is ai. the commit messages ai. the comments ai. most of code(~75%) is not ai generated

---

<div class="post-metadata">

**Author:** ![andrewrk](https://ziggit.dev/user_avatar/ziggit.dev/andrewrk/32/7011_2.png) [@andrewrk](https://ziggit.dev/u/andrewrk)\
**Post date:** [January 30, 2026, 10:16am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/12 "2026-01-30T10:16:30Z")

</div>

Welcome, felixuxx. I had a knee-jerk reaction to your post which I will share below, but don’t take it the wrong way. Thanks for sharing your work with us.

> pure zig

It’s a bit weird to see “pure zig” and then it’s just bindings to some C code. IMO you should say “high quality Zig bindings to SDL3”. On the other hand, “pure zig” sounds like you created a _competitor_ to SDL3 in Zig.

[Definition of **pure**](https://www.merriam-webster.com/dictionary/pure):

> unmixed with any other matter

You’ve mixed C and Zig. Impure! Words have meanings. Pure Zig means no C in the executable.

---

<div class="post-metadata">

**Author:** ![felixuxx](https://ziggit.dev/user_avatar/ziggit.dev/felixuxx/32/7652_2.png) [@felixuxx](https://ziggit.dev/u/felixuxx)\
**Post date:** [January 30, 2026, 11:41am UTC](https://ziggit.dev/t/sdl3-in-pure-zig/14110/13 "2026-01-30T11:41:18Z")

</div>

noted. ill keep that in mind. thank you for correcting me.
