Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barrettotte/tetris-wasm
Tetris clone in C and compiled to WASM
https://github.com/barrettotte/tetris-wasm
cmake conan raylib tetris wasm
Last synced: 12 days ago
JSON representation
Tetris clone in C and compiled to WASM
- Host: GitHub
- URL: https://github.com/barrettotte/tetris-wasm
- Owner: barrettotte
- License: mit
- Created: 2024-08-14T19:39:50.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-08-24T21:24:17.000Z (4 months ago)
- Last Synced: 2024-10-31T20:07:11.132Z (2 months ago)
- Topics: cmake, conan, raylib, tetris, wasm
- Language: C
- Homepage: https://barrettotte.github.io/tetris-wasm/
- Size: 138 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tetris-wasm
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/
## Controls
- Left: ←, A
- Right: →, D
- Rotate: ↑, W
- Down: ↓, S
- Fast drop: SPACE
- Restart: R
## Development
Dependencies: CMake, Conan, Ninja, Emscripten
```sh
# 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
```
```sh
# 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 serve
```
### VS Code
For intellisense, add `compileCommands` property:
```js
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
// ...
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
```
## Unimplemented Features
- Tetromino ghost/shadow
- Next tetromino preview
- Tetromino hold
- Levels
- Pause screen
- Audio
- Limited scoring
- No high score recording
- Probably more I didn't notice
## References
- https://tetris.wiki/Tetris.wiki
- https://tetris.wiki/Scoring
- https://emscripten.org/
- https://en.wikipedia.org/wiki/Tetromino
- https://emscripten.org/docs/getting_started/downloads.html
- https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)