sxtetris

Crates.iosxtetris
lib.rssxtetris
version1.4.0
created_at2024-06-22 08:50:30.592115+00
updated_at2025-08-23 17:55:10.312689+00
descriptionA terminal Tetris game
homepage
repositoryhttps://github.com/shixinhuang99/sxtetris
max_upload_size
id1280279
size3,314,503
Shixin Huang (shixinhuang99)

documentation

README

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

  1. Terminal Size: Suggested minimum terminal size: 105x45
  2. Color Support: Terminal must support 24-bit color (true color)
  3. Recommended Terminals:
    • macOS: iTerm2
    • Linux: GNOME Terminal
    • Windows: Windows Terminal

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.

Commit count: 41

cargo fmt