A terminal-based Tetris game written in C++17, powered by FTXUI.
- All 7 standard pieces (I, O, T, S, Z, J, L) with 4 rotations each
- Wall-kick rotation system
- Ghost piece (hard-drop preview)
- Score, level, and line counter — level speeds up as you clear more lines
- Pause / resume
- Unicode block-drawing graphics
| Key | Action |
|---|---|
| ← → | Move left/right |
| ↑ | Rotate clockwise |
| ↓ | Soft drop (+1pt) |
| Space | Hard drop (+2pt/cell) |
| P | Pause |
| Q / Esc | Quit |
| Lines cleared | Points (× level) |
|---|---|
| 1 | 100 |
| 2 | 300 |
| 3 | 500 |
| 4 (Tetris) | 800 |
Level increases every 10 lines cleared. Drop speed increases from 800ms down to a minimum of 50ms.
| Tool | Minimum Version |
|---|---|
| CMake | 3.20 |
| C++ compiler | C++17 (GCC 8+, Clang 7+, MSVC 2019 16.8+) |
FTXUI is fetched automatically via CMake FetchContent — no manual dependency installation needed.
macOS / Linux
# 1. Configure (generate build system)
cmake -B build -DCMAKE_BUILD_TYPE=Release
# 2. Compile
cmake --build build
# 3. Run
./build/tetrisWindows (Developer Command Prompt / PowerShell)
# 1. Configure
cmake -B build
# 2. Compile
cmake --build build --config Release
# 3. Run
.\build\Release\tetris.exeNote: On Windows, MSVC places the executable in a
Release(orDebug) subdirectory by default. Use--config Releasewithcmake --buildand run from the matching folder.
# Debug build with Address Sanitizer (GCC/Clang)
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON
cmake --build buildshow/
├── CMakeLists.txt # Build configuration
├── src/
│ ├── game.hpp # Game logic header
│ ├── game.cpp # Piece data, collision, line clearing
│ └── main.cpp # FTXUI rendering and input handling
└── README.md
