Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 963 Bytes

README.md

File metadata and controls

39 lines (25 loc) · 963 Bytes

SDL2 WebAssembly Builder

Screenshot

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!

Usage

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!

Credits

Many thanks to Michał Kalbarczyk's blog post which taught me how to compile SDL2 into WebAssembly.