Exploring Rust and SDL2 and Emscripten: A Showcase of SDL2 Extensions

by Xevionon 4/27/2024, 8:47 PMwith 1 comments

by Xevionon 4/27/2024, 8:47 PM

While working on an opinionated Pac-Man clone in Rust using SDL2 (plus the Image, Mixer, TTF, and GFX extensions), I was having trouble getting things to compile and work properly.

So I created this demo to ensure I had a working baseline example that compiled to all platforms, as well as used each of the major extensions.

I find it fascinating because:

- It utilizes all four SDL2 extensions supported by Rust's SDL2 bindings (Image, Mixer, TTF, GFX).

- There's seamless platform interoperability for data loading and saving (localStorage in the browser, files on native)

- It lays a solid foundation for implementing multi-platform HTTP calls atop this framework.

- Thanks to GitHub Actions, it offers automated builds for major platforms (Windows, Linux, MacOS).

- My project is not 'amazing', but it is somewhat rare; I could not find another open-source project like mine.