A simple Tetris clone built in Rust using the Raylib graphics library. This project was created as a learning exercise to explore Rust game development and understand the fundamentals of building classic arcade games.
Try the wasm version
This project is based on the tutorial "Creating Tetris in C++ with raylib - Beginner Tutorial (OOP)" by Programming With Nick, adapted from C++ to Rust to explore Rust's unique features and syntax.
- Classic Tetris Gameplay: All standard Tetris mechanics including line clearing, block rotation, and increasing difficulty
- Seven Tetris Pieces: Complete set of tetrominoes (I, O, T, S, Z, J, L blocks)
- Real-time Scoring: Track your performance with a live score counter
- Next Block Preview: See what piece is coming up next
- Game Over Detection: Proper end-game state handling
- Smooth 60 FPS Gameplay: Responsive controls and fluid animation
The project is structured with clean separation of concerns:
main.rs
- Game loop and rendering setupgame.rs
- Core game logic and state managementblock.rs
- Tetromino piece definitions and behaviorgrid.rs
- Game board management and line clearingcolors.rs
- Color scheme and visual stylingtimer.rs
- Game timing and automatic piece dropping
- Raylib: Cross-platform graphics and game programming library
- Rand: Random number generation for piece selection
- Arrow Keys: Move and rotate pieces
- Down Arrow: Soft drop (faster falling)
This project demonstrates:
- Rust ownership and borrowing principles
- Game loop architecture
- 2D graphics programming
- State management in interactive applications
- Modular code organization
# Clone and run
cargo run
Make sure you have the required font file in the font/
directory for proper text rendering.
Built with Rust 🦀 | A simple project for learning and playing with game development