6 stable releases
Uses new Rust 2024
| 1.4.0 | Aug 23, 2025 |
|---|---|
| 1.3.1 | Jul 21, 2024 |
| 1.2.0 | Jun 30, 2024 |
#63 in Games
286 downloads per month
3MB
3K
SLoC
Sxtetris
A terminal Tetris game written in Rust, built with ratatui and tokio.
https://github.com/shixinhuang99/sxtetris/assets/31186725/1eb95c10-e57e-4239-8142-95800e1afca8
Features
- Classic Tetris gameplay in your terminal
- Smooth animations and responsive controls
- Background music and sound effects
- High score tracking
- Cross-platform compatibility
Installation
Using Homebrew (precompiled binaries)
brew tap shixinhuang99/brew
brew install sxtetris
Cargo
cargo install sxtetris --locked
AUR (Arch Linux)
You can install sxtetris from the AUR by using an AUR helper:
paru -S sxtetris
Binary Releases
Download pre-built binaries from the latest releases.
System Requirements
- Terminal Size: Suggested minimum terminal size:
105x45 - Color Support: Terminal must support 24-bit color (true color)
- Recommended Terminals:
- macOS:
iTerm2 - Linux:
GNOME Terminal - Windows:
Windows Terminal
- macOS:
Usage
sxtetris
To see the save file location:
sxtetris --show-save-path
Audio Sources
All audio files are located in the src/global/assets directory. Files from freesound have been trimmed for optimal gameplay experience.
| File | Author | Source |
|---|---|---|
| bg_music.mp3 | Stable Audio | Stable Audio |
| game_over.wav | themusicalnomad | FreeSound |
| lock.wav | Mellau | FreeSound |
| menu.wav | Christopherderp | FreeSound |
| move.wav | aphom000 | FreeSound |
| clear.mp3 | B_Lamerichs | FreeSound |
Troubleshooting
Linux ALSA Error
If you encounter the following error when using cargo install:
The system library `alsa` required by crate `alsa-sys` was not found.
The file `alsa.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
The PKG_CONFIG_PATH environment variable is not set.
HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `alsa.pc`.
Run these commands and try installing again:
sudo apt-get update
sudo apt-get install libasound2-dev
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig
Disclaimer
This project is an open-source implementation of Tetris designed to run in the terminal. Tetris is a registered trademark, and all rights belong to its respective owners. This project is intended solely for educational and research purposes and should not be used for commercial purposes.
By using this project, you agree to use it exclusively for non-commercial educational and research purposes. The developer assumes no responsibility for any infringement of intellectual property rights.
Dependencies
~10–43MB
~584K SLoC