A template to use Rust with Emscripten
rust_src | ||
src | ||
third_party | ||
.gitignore | ||
Makefile | ||
README.md | ||
UNLICENSE.txt |
Emscripten Rust/C Template
This is a template for an emscripten project with a "Rust backend".
Setting up
(Note that this has only been tested in a Linux environment.)
- Clone
https://github.com/emscripten-core/emsdk
to${HOME}/git/emsdk
. - Set up
emsdk
with${HOME}/git/emsdk/emsdk install latest
and${HOME}/git/emsdk/emsdk activate latest
. - Set up
rustup
. - Get the
wasm32-unknown-emscripten
target withrustup target add wasm32-unknown-emscripten
.
Build
Just run make
in the root of this project.
Other Notes
This raylib
branch pulls the repository (if it doesn't exist) and builds it.
It should do this automatically when you invoke make
.
The current set up of the update/draw loop uses
emscripten_set_main_loop_arg(...)
with parameters that should call the
browser's requestAnimationFrame
that should call update
and draw
once per
each frame at the fps that the browser decides, which should match the fps of
your display.