A wasm version of yumaikas' Sparkworks
The current approach is to build a small program that embeds janet and is linked to Raylib. The program loads and executes Sparkworks, a game written by yumaikas in Janet that uses Raylib via jaylib.
The program is made executable in a web browser by being compiled by Emscripten.
The goal of this demo is to produce appropriate .wasm
, .js
, .html
, and related files and then to test their functionality via a web browser. Before compilation via Emscripten can take place, some pieces need to be prepared:
main.c
- the aforementioned small programjanet.c
+ support files - for embedding janetlibraylib.a
- "HTML5-ready" Raylib static libraryresources
- a directory containing Sparkworks bits
- Emscripten 3.1.3 (other versions might work)
- Usual build tools
- Janet
-
Ensure repository has been cloned recursively:
git clone --recursive https://github.com/sogaiu/sparkworks-wasm
-
For *nixen, with emsdk under
~/src/emsdk
:source ~/src/emsdk/emsdk_env.sh janet build-unix.janet
-
For Windows, with emsdk in a sibling directory of this repository (likely need to do via a Native Tools Command Prompt):
..\emsdk\emsdk_env.bat janet build-windows.janet
-
Start a web server to serve the built files:
For a machine with python3, that might be:
python3 -m http.server --directory public
-
Try out the results:
Visit http://localhost:8000 and click on
main.html
- bakpakin
- MikeBeller
- pyrmont
- raysan5
- saikyun
- yumaikas