Dependencies (Ubuntu/Debian)
sudo apt install -y libx11-dev libxi-dev libxcursor-dev libxrandr-dev libgl-dev
Compiling to JS
v -b js_browser examples/tetris/tetris.js.v
And then open index.html with your favourite web browser.
Compiling to WASM
-
Install Emscripten from https://emscripten.org/docs/getting_started/downloads.html
-
Make sure that the environment in your shell is setup correctly, i.e. that
emcc --versionworks.
. /opt/emsdk/emsdk_env.sh
emcc --version- Compile the game to WASM:
v -skip-unused -prod -os wasm32_emscripten examples/tetris/`- Copy the generated
tetrisfile toindex.jsThis can be done once. Note that this step will be removed soon, when the option-os wasm32_emscriptenbecomes better integrated:
cp examples/tetris/tetris examples/tetris/tetris.js
- Run/test the game:
emrun examples/tetris/index.html
Once you have run the game, you can make changes, then just recompile (step 3), and refresh the game in your browser.
