Closed tupini07 closed 11 months ago
Should be possible, at least with some hacks. Raylib currently uses emscripten for web apps iirc. I'll check on this when I get back from vacation later this week.
I'd also like to know. I would like to try Zig in a gamejam but I think WASM is essential for that.
Any news on this front?
Currently not possible, since raylib's build.zig
only offers support for Windows, Linux, macOS and *BSD. I have created an issue on its repository: https://github.com/raysan5/raylib/issues/2884
raylib now has support for building for emscripten since https://github.com/raysan5/raylib/pull/2901 was merged, but Zig can't generate the required extra files that create the required JS functions (for OpenGL etc.) so at least the link step for the final "executable" has to be done with emscripten.
On the Zig side https://github.com/ziglang/zig/issues/10836 tracks this issue.
I was able to get it to work: https://github.com/bluesillybeard/ZigAndRaylibSetup
It's a hassle to set up and it's also pretty janky, but it does work.
Edit: Forgot to mention, I didn't use this wrapper, but instead used Raylib by itself
If you can neatly integrate it into the current build script, don't hesitate to open a PR
Fixed in #52
As the title says, is there any possibility building a project using
raylib-zig
to wasm ? Any examples of how to accomplish this?