This is a container to build SDL2 programs into WebAssembly so it can be displayed in a website. It's still very much in-progress and I'm no expert so any improvement is appreciated!
The image can be built by running:
docker build -t emscripten-sdl2 .
Then you can make changes to src/main.c
(and src/Makefile
if needed).
After that, the WebAssembly can be generated by running:
./build.sh
Finally, you can view the result by running:
cd dist
python -m http.server
NOTE: if you have Python 2, use python -m SimpleHTTPServer
instead.
and go to http://localhost:8000
in the browser!
Many thanks to Michał Kalbarczyk's blog post which taught me how to compile SDL2 into WebAssembly.