Hello,
first of all, emscripten is a great project! But are you aware of a tutorial combining emscripten and SDL2? I started using the tutorial in the documentation which uses the embedded SDL 1 api. It took a while to notice that SDL_ttf and SDL_image are not complete and that there is a great SDL 2 port.
Maybe the tutorial should use SDL 2 from the beginning or add a link to a complete SDL 2 tutorial?
-- ooxi
I agree, that is a good idea. I don't think there is such a tutorial written up, so someone would have to write one.
Thanks for the feedback! I'm not sure if I'm good at writing tutorials but if I find the time I'll look into it :)
I think it would be a great idea to include a SDL2 tutorial. Maybe this issue should be reopened to make it more visible?
I found it a bit confusing that there are some examples (like this) that uses sdl2/* includes which, as far as I can tell, are not included in the repo by default.
@kripken out of curiosity, how come SDL2 hasn't replaced SDL as the "default" SDL port for Emscripten? Are there compatability problems or something else stopping that from happening? (My understanding is that Emscripten "comes with" SDL1, sorry if I missundertood it)
@ooxi, is this the port you are referring to?
@ooxi, is this the port you are referring to?
Yes, this is the port I'm talking about.
@kripken out of curiosity, how come SDL2 hasn't replaced SDL as the "default" SDL port for Emscripten? Are there compatability problems or something else stopping that from happening? (My understanding is that Emscripten "comes with" SDL1, sorry if I missundertood it)
The big difference between SDL1 and SDL2 in emscripten is (if I understand correctly) that emscripten reimplemented the SDL1 API in JavaScript whereas SDL2 is compiled with emscripten itself from the original C sources. Thus the SDL2 port is much more feature complete than the SDL1 reimplementation.
I think it would be a great idea to include a SDL2 tutorial. Maybe this issue should be reopened to make it more visible?
(I closed the issue out of selfish reasons because I wanted to have time to write such a tutorial myself :flushed:)
@ooxi thanks for taking the time to explain!
(I closed the issue out of selfish reasons because I wanted to have time to write such a tutorial myself :flushed:)
That is anything but selfish. A lot of people will benefit from that tutorial if you write it :+1:
Just wanted to add that I had missed this section, which was most helpful in getting SDL2 to work with minimal effort.
Yes, let's reopen this, hopefully someone will do it.
@GGAlanSmithee: the SDL1 port is just a small library_sdl.js file, included with emscripten, and SDL2 is external, larger, and was added later. That's why SDL1 is the default. But, maybe we should change that.
@kripken thanks for answering. I guess SDL1 vs SDL2 doesn't mather too much since it's still the same canvas tech running in browsers, but when targeting both native and web, i'd argue SDL 2 makes more sense since it's the future (and present) for SDL. This is comming from someone with zero knowlege of Emscriptens inner workings though :)
Yeah, I think you're right. A first step towards SDL2 by default would be a tutorial for it, and to replace the SDL1 parts in the existing tutorial.
OK nice!
I guess @ooxi is writing a tutorial, but what parts would need to be replaced? The ones I can find are this section as well as the SDL related tests in the /tests folder. Is there any other place that you know of?
@GGAlanSmithee yes, I'm currently writing a simple tutorial, I guess it will be finished between the years :)
@GGAlanSmithee: yeah, just that section that you linked to. The SDL1 tests can remain, although we might want to add more SDL2 tests over time (we already have a bunch, but not as much as SDL1).
I don't know if this helps, but I've written a tutorial for Emscripten and SDL2 using "-s USE_SDL=2", and SDL_ttf too. It can be found here if anyone's looking for one...
Nice @lyceum-allotments, thanks!
This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.
Most helpful comment
I don't know if this helps, but I've written a tutorial for Emscripten and SDL2 using "-s USE_SDL=2", and SDL_ttf too. It can be found here if anyone's looking for one...