SDL 2 on the web

Hello SDLF,

I’m designing an application using SDL 2, I’ve been using SDL for a while. Would there be a way for me to throw what i’m designing onto the web as a web application? I’ve attempted to use emscripten but it’s very volatile and only seems to work with sdl 1x. I code within c++ but am able to use Python (with pysdl2) if that would make the job any easier. Does anyone have any ideas on how I might go about this? I know it’s not easy, but i’m sure there has to be a way.

thanks in advance.

Message-ID: <1399147607.m2f.43316 at forums.libsdl.org>
Content-Type: text/plain; charset=“iso-8859-1”

Hello SDLF,

I’m designing an application using SDL 2, I’ve been using SDL for a while.
Would there be a way for me to throw what i’m designing onto the web as a web
application?

What do you mean “throw it onto the web”, does browser-side vs
server-side matter? If not then you could just modify your app to act
as a multi-seat program and send all of the data through the internet
instead of onto a screen. If you really do want to run everything on
the browser…

I’ve attempted to use emscripten but it’s very volatile and only seems to
work with sdl 1x. I code within c++ but am able to use Python (with pysdl2)
if that would make the job any easier. Does anyone have any ideas on how I
might go about this? I know it’s not easy, but i’m sure there has to be a
way.

I don’t think that anyone’s PREPARED a way. If I were trying to do
this quickly then I’d probably take this: (
http://bellard.org/jslinux/ ), and modify it to support graphics, then
write an SDL backend for it: I myself have implemented windows in HTML

  • Javascript, leaving just the graphical bit as a question (which you
    can deal with via anything from HTML 5’s canvas, to a
    stroke-inducingly large table). Sound is a little bit harder, as the
    last time that I heard there wasn’t a good standard API for it in
    browsers: maybe a Flash component could be used for that bit, as well
    as for IO. Alternatively, you could implement some browser plugins:
    this would probably be needed for reasonable save-file capability
    anyways (as in “file size”, not as in “being able to access the entire
    filesystem”).

If you were to go the plugin route, then a particularly interesting
method would be to write a plugin that exposes SDL 2 to Javascript,
and then build on top of that.> Date: Sat, 03 May 2014 20:06:47 +0000

From: “FSean” <sean.welgemoed at gmail.com>
To: sdl at lists.libsdl.org
Subject: [SDL] SDL 2 on the web

Hello SDLF,

I’m designing an application using SDL 2, I’ve been using SDL for a
while. Would there be a way for me to throw what i’m designing onto the web
as a web application? I’ve attempted to use emscripten but it’s very
volatile and only seems to work with sdl 1x. I code within c++ but am able
to use Python (with pysdl2) if that would make the job any easier. Does
anyone have any ideas on how I might go about this? I know it’s not easy,
but i’m sure there has to be a way.

thanks in advance.

What exactly are your problems with emscripten. Moat of the stuff works for
me with sdl2, too. Some simple wrappers are needed (like we had in the
previous compatibility layer). there is also work going on for emscripten
wwith sdl2. So it should only be a matter of time. I can only share the
experience, that its worth to get into emscripten. With their new llvm
based backend it also got a lot faster to compile your c++/c into
javascript. Even tcp works fine with websockets. The only smaller problem
is about sound (at least the last time i checked) - but that’s been a time,
so that might have been revolved, too (simple sound mixing via sdl_mixer
works out of the box.

One thing i would suggest for everyone who is considering html5 a valid
platform is to implement aync io. at least for textures and meshes this is
not a big problem and would make your lives a lot easier.

I would glady see more html5/emscripten discussions here to hear from other
usere experiences/problems/solutions.Am 07.05.2014 18:48 schrieb “FSean” <sean.welgemoed at gmail.com>: