4 ms·
284 lines! I'm impressed by the brevity. Were the SDL bindings as straightforward to use as they appear?
by sevensor 9y ago
284 lines! I'm impressed by the brevity. Were the SDL bindings as straightforward to use as they appear?
- Jach 9y agoI've worked with Nim's sdl2 interface too, it is indeed pretty straightforward, and it was easy for me to tell vim to know how to jump to the nim wrapper's source. The main pain points for me were 1) sdl2 is harder than sdl1 and 2) I thought some type conversion behavior (or lack thereof) was odd, especially when working with 'cints' (which is what the wrapper api expects everywhere). For a more flushed out example there's: https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/ https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-...
- JHonaker 9y agoI actually used a few snippets of this tutorial to figure out how to use the SDL bindings. I'd never used SDL before.
- JHonaker 9y agoIt was pretty straightforward. I had never had any experience with SDL before, and I figured it out pretty quickly just from comments and the function names. I did use a tiny bit of code from the tutorial on 2D platformers linked by someone else. I'm surprised it was that brief actually. I didn't even try for brevity. And I'm sure if I had a better handle on some of the other features like macros and templates it could have been much more elegant in the display/SDL code. The actual implementation of the automaton is only about 70 lines of code if I remember correctly.