v/examples/tetris
2023-08-13 17:45:19 +03:00
..
.gitignore examples/tetris: add instructions, on how to compile the game through Emscripten and v -os wasm32_emscripten 2023-08-13 17:28:27 +03:00
index.html examples/tetris: add instructions, on how to compile the game through Emscripten and v -os wasm32_emscripten 2023-08-13 17:28:27 +03:00
README.md examples/tetris: add instructions, on how to compile the game through Emscripten and v -os wasm32_emscripten 2023-08-13 17:28:27 +03:00
screenshot.png all: optimize png images (#6860) 2020-11-17 17:42:21 +01:00
tetris.js.v gg: use html5_canvas_name as the name of the canvas in gg.js.v too, similarly to gg.c.v 2023-08-13 17:45:19 +03:00
tetris.v all: 2023 copyright 2023-03-28 22:55:57 +02:00

Dependencies (Ubuntu)

sudo apt install libx11-dev
sudo apt install libxi-dev
sudo apt install libxcursor-dev
sudo apt install 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

  1. Install Emscripten from https://emscripten.org/docs/getting_started/downloads.html

  2. Make sure that the environment in your shell is setup correctly, i.e. that emcc --version works.

. /opt/emsdk/emsdk_env.sh
emcc --version
  1. Compile the game to WASM:
v -skip-unused -prod -os wasm32_emscripten examples/tetris/`
  1. Copy the generated tetris file to index.js This can be done once. Note that this step will be removed soon, when the option -os wasm32_emscripten becomes better integrated:
cp examples/tetris/tetris examples/tetris/tetris.js
  1. 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.