Tetris clone in C and compiled to WASM.
This was made to learn the basics of Raylib, WASM, CMake, Conan, and Ninja.
WASM build served at https://barrettotte.github.io/tetris-wasm/
- Left: ←, A
- Right: →, D
- Rotate: ↑, W
- Down: ↓, S
- Fast drop: SPACE
- Restart: R
Dependencies: CMake, Conan, Ninja, Emscripten
# native build
conan install . --profile=profiles/default --output-folder=build --build=missing
cmake -G Ninja -B build
ninja -C build
# build and run binary
ninja -C build run# wasm build
conan install . --profile=profiles/wasm --output-folder=build-wasm --build=missing
cmake -G Ninja -B build-wasm -DEMSCRIPTEN=ON
ninja -C build-wasm
# build and serve wasm binary at http://localhost:1337
ninja -C build-wasm serveFor intellisense, add compileCommands property:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
// ...
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}- Tetromino ghost/shadow
- Next tetromino preview
- Tetromino hold
- Levels
- Pause screen
- Audio
- Limited scoring
- No high score recording
- Probably more I didn't notice
