/tetris

Tetris games based on C++ and SDL2

Primary LanguageC++

Tetris

This is a classic Tetris game implemented in C++ using the SDL2 library.

Demo

Tetris Gameplay

Features

  • Classic Tetris gameplay with 7 standard tetromino shapes.
  • Colorful blocks and grid.
  • Line clearing mechanics.
  • Game over detection.
  • Pause functionality (press Spacebar).

Requirements

  • SDL2 library
  • C++ compiler (e.g., g++, clang++)

Building

  1. Make sure you have SDL2 installed on your system.
  2. Clone this repository.
  3. Navigate to the project directory.
  4. Compile the code using a C++ compiler:
    g++ -o tetris game.cpp -lSDL2 
    or use CMake
    cmake .
    cmake --build .
  5. Run the executable
    ./tetris

Controls

  • Left Arrow: Move tetromino left
  • Right Arrow: Move tetromino right
  • Down Arrow: Soft drop tetromino
  • Up Arrow: Rotate tetromino
  • Spacebar: Pause/unpause game
  • Escape: Quit game