The Emscripten support is now in revision control!
https://hg.libsdl.org/SDL/rev/8900afb78a19
This means you can now compile your SDL2-based application, written in C
or C++ with Emscripten, and it will run as a web app.
For example, here’s a C++ test app I wrote that uses SDL’s render API,
compiled with Emscripten:
https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html
(The render calls end up as WebGL, so you get hardware acceleration,
render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)
You can read more about Emscripten at http://emscripten.org
Emscripten already ships with a “close enough” implementation of the SDL
1.2 API (written by hand in Javascript), but this new work makes it so
you can just compile SDL2’s actual code with Emscripten, along with the
new backends for video, audio, etc, and link the resulting library to
your Emscripten app.
There are one or two gotchas to porting your app code, but overall, it’s
pretty amazing how well this works.
Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jyl?nki,
Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all
their hard work on this!
–ryan.