Replies: 8 comments
-
To start the discussion, I want to share some data points that I gathered while doing work on emscripten:
glfw is not a very well supported API for emscripten:
|
Beta Was this translation helpful? Give feedback.
-
SDL2 is actually an emscripten "port": the actual source code lives in the SDL library itself and emscripten is simply pulling it when you use the This library is actually written in C and compiled to wasm when using the port. Note that this library is already Hi DPI aware (via flag Note that @ubkp already did an amazing job demonstrating that emscripten SDL can be used as a new or alternate raylib web platform (see PR). The PR also demonstrates that there are far more raylib APIs implemented due to the fact that emscripten/SDLs has more equivalent. |
Beta Was this translation helpful? Give feedback.
-
Based on these initial observations I think:
I also think that the PLATFORM_WEB_SDL direction from the PR should be investigated to see if it would be a better implementation than glfw. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed investigation. |
Beta Was this translation helpful? Give feedback.
-
@Peter0x44 Thank you for pointing out the copy/paste issue. I fixed it in the comment. |
Beta Was this translation helpful? Give feedback.
-
@ypujante Thanks for the investigation and the recap. Here some info for completion:
In any case, as usual, maintenance is a big concern for me so, new platform additions or big code changes would require some maintainer. |
Beta Was this translation helpful? Give feedback.
-
@raysan5 Thank you for providing history and context. It is always a pleasure to learn why things are the way they are and perspective moving forward. This helps a lot.
When I started my project (desktop ImGui based) I tried to use SDL and I agree that it was very big so I could not embed it and went with GLFW as well. That being said, as I was pointing out, when using the emscripten compiler, you don't need to embed SDL in raylib, nor need to worry about having it installed locally, nor how to compile it. It's all taken care of (which is pretty neat). But I totally see your point.
I think that it is definitely an interesting idea. As I suggested in one of the other issue/pr threads, when I have a few spare cycles, I can take a look at this and see how big of an effort that would be.
I feel like with a little more work on the platform split, it should be fairly easy to be able to add a new platform without requiring any changes to raylib at all, which would allow for external platforms that are neither created nor maintained by you. I do not know if this is something of interest to you, but this is something I could provide help as well with. |
Beta Was this translation helpful? Give feedback.
-
Thanks, please, let me know. I think it shouldn't be that complex but it could require some redesign on how inputs are polled to deal with the async nature of browser... probably the previous callback-based mechanism won't work any more.
That's ok for me, actually, I'm already aware of some custom platform implementations using the new architecture: PS4/PSVita homebrew, not officially released yet. |
Beta Was this translation helpful? Give feedback.
-
I am creating this ticket as a follow up to a bunch of conversations that happened throughout various tickets and pull requests created in the past right before the release of raylib 5.0.
This discussion is about the raylib web platform and the usage of emscripten.
The status (as of raylib 5.0) for the web platform is to use emscripten/glfw.
This implementation currently works fine since it is the one used for all the raylib examples. That being said it has a lot of limitations as indicated by the many unimplemented APIs.
The purpose of this ticket is to see whether there is a better alternative.
Disclaimer: I will not be offended if this ticket gets closed or leads nowhere. I am just trying to help, but I also understand that I do not have all the pieces/history of the project and it's fine to not want to move forward.
Beta Was this translation helpful? Give feedback.
All reactions