Sdl3 Bindings for crystal

Hi everyone! I started a project for crystal SDL3 bindings as a part of my simple pixel based game engine and I wanted to share it with the crystal community. Let me know if you it useful, see any bugs, or want to submit improvements / additions / or docs.

4 Likes

I actually also built SDL3 bindings a while ago (though only the pure bindings, no wrappers):

Your syntax is a bit different than mine (and a bit better documented than mine) and I’ve excluded some structs and functions which are somewhat obsolete or potentially problematic in Crystal (like the time or thread routines), but in turn I’ve included some more macros, examples and also bindings for the mixer library (once it actually gets a proper release).

Out of curiosity, how did you generate your bindings?

Just an idea, but maybe we could join efforts a bit (though I’d still keep the raw bindings somewhat separate from the wrappers, since both have different use cases).

In my opinion Crystal could benefit of having more resources for game development and I think you developing your own game engine is absolutely a cool thing that’s worth pursuing further. I just think that two (or potentially even more) libraries doing nearly exactly the same thing isn’t really helpful in that ecosystem and might lead to some confusion, especially considering our differences in the syntax. Would you be interested (no need to rush, though :smiley: )?

1 Like

Ah, that’s great. I didn’t see any other bindings out there when I initially created mine. I know that crystal bindings generators exist out there, but I admit that I haven’t looked very deeply. I just wrote a (somewhat hacky) ruby script specific to the SDL3 source code to generate them in crystal style and then did (and am still doing) some manual fix ups. I didn’t check the script into source control though because of how terrible it is.

2 Likes

No worries, my script (included in the repo) is not the most beautiful code either :smiley:

BTW, I’ve been using your bindings (latest version), @Hadeweka, for an ongoing project these past few months and they’ve been perfect for my needs. Thanks for that.

1 Like