emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.67k stars 3.29k forks source link

Multiple canvases with SDL and Emscripten #19407

Open eliasbauer1 opened 1 year ago

eliasbauer1 commented 1 year ago

multiple canvases

I tried to create a game which requires multiple canvases, the problem is that there is no way to control more than 1 canvas. I request a feature so that you can address multiple canvases at once from a single c++ file from SDL.

SDL to HTML5 Canvas

As a side note it would be great if you could release a documentation for the SDL to html canvas conversion in the generated Javascript file, so that the javascript in the project can be minimized to the simplest form.

sbc100 commented 1 year ago

Are you using SDL v1 or SDL v2?

eliasbauer1 commented 1 year ago

SDL2

sbc100 commented 1 year ago

In that case maybe it worth looking at the implementation which is upstream: https://github.com/libsdl-org/SDL/tree/main/src/video/emscripten.

I don't know of any internal documentation that we could "release". Perhaps @Daft-Freak know the answer to the multiple canvases question?

Daft-Freak commented 1 year ago

I think https://github.com/Daft-Freak/SDL/commits/create-window-from-2 was the last time I looked at multiple canvases. The first few bits were merged to SDL3 (https://github.com/libsdl-org/SDL/pull/6142) but I'm not sure what the state of the rest was.