Skip to content
Tetris written in C++ with SDL2
C++ CMake
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
cmake
src
.gitignore
CMakeLists.txt
LICENSE
README.md

README.md

SDL-Tetris

Tetris made in C++ using SDL2.

About

I've always loved Tetris and thought re-creating it would be a great way to learn SDL2 and get more experience with C++ and object oriented design.

Build

If you're on Linux, you can use CMake to compile the project. Simply type:

cmake . && make

Run the executable with:

./tetris

You can also compile manually (assuming you have g++, SDL2 and SDL2_TTF):

g++ ./src/*.cpp -w -lSDL2 -lSDL2_ttf -o tetris && ./tetris

Controls

  • Left - Move tetromino left
  • Right - Move tetromino right
  • Down - Soft drop tetromino
  • Up/Z - Rotate tetromino clockwise
  • X - Rotate tetromino counter-clockwise
  • Space - Hard drop tetromino
  • Left Shift - Hold tetromino, or swap with currently held tetromino

Project goals:

  • CMake
    • Support Windows
  • Show proper piece colours after being set
  • Display score
  • Show next piece
    • Show next 4 pieces in queue
  • Piece queue (at least one of each piece every 7 drops)
  • Dynamic drop rate
  • Resolution config
  • Better piece rotation against walls
    • Fix I piece rotation against walls
You can’t perform that action at this time.