Reputation: 121
I am a beginner programmer and I was wondering how I would make an HTML build from raylib. I tried looking at the GitHub https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5) I couldn't understand it. would you be able to write a simple step-by-step tutorial for me. please
Upvotes: 3
Views: 5168
Reputation: 906
For the very beginning you have to install emscripten SDK. As stated at the site "Emscripten is a complete compiler toolchain to WebAssembly, using LLVM, with a special focus on speed, size, and the Web platform."
Installation steps are prety easy:
After this steps you will have emscripten installed into the directory you've cloned it.
Then, you need to compile raylib itself to be usable in Web:
Go to the raylib/src
directory and open Makefile, find where EMSDK_PATH variable is being defined and edit it accordingly to your setup. If you downloaded emscripten into /home/user/emsdk
directory then put it in there:
EMSDK_PATH ?= /home/user/emsdk
Fix PYTHON_PATH
definition as well.
then launch execute make
:
make -e PLATFORM=PLATFORM_WEB -B
Notice -e
option. That option allows to propagate and override environment variables to makefile.
Generated libraylib.a is placed in raylib\src\libraylib.a directory.
After that you can cd into raylib/examples/
, fix Makefile as described above and launch make -e PLATFORM=PLATFORM_WEB -B
again.
After that you would be able to start python3 -m http.server
in that directory, navigate to http://0.0.0.0:8000/
in your browser and see examples.
Upvotes: 6