- We followed the really cool blog from surma
- Step1: (tagged step1)
- First we will understand how we are generating wasm from C
- Start with a simple function add.c
- Step2: (tagged step2)
- Turned our simple function into something more complex that will allow to:
- move a small box within an area
game.c
is the core of the application.- It provides three functions (See
game.h
):game_init()
: do the init of structure used,game_render()
: render the small box,game_keydown()
: to be able to move the box when pressing keys,
game.c
requires functions defined ingame_ext.h
. These functions can be provided by:- JS: when running in the browser (
main_wasm.js
) - Raylib: when running as a standalone app (
main_rl.c
)
- JS: when running in the browser (
- So we have two ways to run the code:
- a standalone application that uses Raylib and that can be run using:
./game_rl
- a web application that uses HTML Canvas for rendering. The
game.wasm
is generated fromgame.c
.
- a standalone application that uses Raylib and that can be run using:
- Turned our simple function into something more complex that will allow to:
- Step3: (not tagger yet)
- Step1: (tagged step1)
- llvm: we are using clang for compilation.
- raylib for the standalone application.
- To install it we just untar the release in current directory.
make
will build the standalone application and the WASM module.- If you have python3 with http module you can do:
make run
that will build and start the http server for you. - NOTE:
build.sh
is documented but has been replaced byMakefile
after step1.