DOOM Fire wasm

June 3, 2020 ยท View on GitHub

This example uses webassembly to run the DOOM Fire example in the browser. The example is mostly based on the rustwasm Conway's Game of Life tutorial.

Most of the files are just boilerplate. The important files are:

  • src/lib.rs the rust code. A small wrapper around the doomfire library
  • www/index.js the javascript code that uses the canvas api to render the DOOM Fire
  • www/index.html the html page

How to build and run

  1. Make sure you have wasm-pack and npm installed

  2. Install the wasm32-unknown-unknown target

$ rustup target add wasm32-unknown-unknown
  1. Compile rust to webassembly
$ cd examples/doomfire-wasm
$ wasm-pack build
  1. Install npm dependencies
$ cd www
$ npm install
  1. Run the development server
$ npm run start
  1. Access http://localhost:8080/ in your browser