4 ms·
Does anyone have an example on how to get the SDL2 to compile using WebAssembly?
by felipellrocha 10y ago
Does anyone have an example on how to get the SDL2 to compile using WebAssembly?
- n00b101 10y agoThere are several SDL2 Emscripten examples for compiling to ASM.js. You would follow the same process, except just direct Emscripten to generate WebAssembly using a "vanilla" LLVM's WebAssembly backend [1]. You will probably first need to compile LLVM yourself with WebAssembly experimental target enabled, as explained in the link. [1] https://github.com/kripken/emscripten/wiki/New-WebAssembly-Backend https://github.com/kripken/emscripten/wiki/New-WebAssembly-B...
- azakai 10y agoThere is already SDL2 support for emscripten, and emscripten can compile to WebAssembly with the WASM flag flipped on. So basically just use emcc with -s WASM=1 -s USE_SDL=2 for WebAssembly + SDL2. The test_sdl2* tests in emscripten's test suite have working samples in them, https://github.com/kripken/emscripten/blob/master/tests/test_browser.py#L2371 https://github.com/kripken/emscripten/blob/master/tests/test... A full SDL1 testcase is in the tutorial, http://kripken.github.io/emscripten-site/docs/getting_started/Tutorial.html#generating-html http://kripken.github.io/emscripten-site/docs/getting_starte...