So the past couple week or so I have been working on a small implementation of Pong in C. Basically using SDL2 as my base. Obviously it is an incredibly simple game and I was focusing on creating a few subsystems such as wrapping inputs, drawing text, custom random generators and a whole host of niceties such that the next game would be simple.
The place was to do a build targeting wasm and sling it on my site. Should be fairly simple you say! Well it turns out I used SDL 2.11 to develop the game and made use of the new FRect. That’s an axis aligned envelope who’s components are floats. The emscripten ports version of SDL2 doesn’t yet have them. Well actually it looks like it has not been updated for a while.
This made me sad.
Obviously long term emscripten is going to die as wasm support has been mainlined in Clang. So I was more sad about the SDL2 part of it. I was looking forward to actually putting something on my site that wasn’t a post.
Well the most obvious one is to just rewrite the drawing part in openGL (webGL). I know GL is old but it is all the web has for now. It’s been a while since I have done any Open GL so I will a bit of learning curve.
The alternative is I investigate Rust. As always my reservations are compile times. I like the language. The presents two learning curves neither of which should be too hard.
It really comes down to whether the library situation in Rust has improved since I last took a look, about 6 months ago. I am thinking I will at least spend an evening investigating.
Of course if I do hand down the Rust route, once I have a triangle displayed I will be sure to compile it to rust.