4 ms·
I was confused about where/how SDL gets recompiled for WASM, but it looks like Emscripten specifically has built-in support for SDL and a handful of other libra
by TillE 3y ago
I was confused about where/how SDL gets recompiled for WASM, but it looks like Emscripten specifically has built-in support for SDL and a handful of other libraries. That's cool.
Other C dependencies could probably be managed with vcpkg.
- speps 3y agoIf you don't want the portability, you can also write basic drawing code in JS, eg. WebGL, Canvas, WebGPU, whatever other API. Then, you can expose some basic functions to your WASM interface. It's more flexible but not much more complicated if you already are comfortable with JS.
- gnulinux 3y agoSDL API is used to interface with HTML5 canvas operations so that SDL doesn't need to be compiled: the entire SDL API is literally a primitive in your browser.
- a1o 3y agoThat is not true, SDL2 port is written in C and it has to be compiled. Here's where it's built https://github.com/emscripten-core/emscripten/blob/main/tools/ports/sdl2.py https://github.com/emscripten-core/emscripten/blob/main/tool...
- versteegen 3y agoHalf true. Emscripten implements (much of) the SDL 1.2 (and also SDL_mixer 1.2) API in Javascript here: https://github.com/emscripten-core/emscripten/blob/main/src/library_sdl.js https://github.com/emscripten-core/emscripten/blob/main/src/.... On the other hand SDL 2 (and SDL_mixer 2) are proper ports (which you linked to). So there's quite a size penalty to using SDL 2 rather than SDL 1.2, but the reimplemented SDL[_mixer] 1.2 is incomplete and differs from official.
- deleted 3y ago[deleted]