Go home


Tetris

Source code at github.com/dashed/tetris-sdl-c

A simple tetris game implemented in C using SDL 2.x. It was just a toy project to play with and learn SDL 2.x.

Scroll down for some GIFs 👇



The original source code was developed in JavaScript within a jsfiddle sandbox; and I have written the C version based on it.

Unfortunately, I have since lost the original link.

However, I have managed to find the piece of code I was working on to encode the tetrominoes and their rotations into a 4x4 grid:

This representation was ported into these lines of code: https://github.com/dashed/tetris-sdl-c/blob/80e6bad084746663bbe51a8d54c8f028269ae653/src/tetris.h#L62-L96





Demo on El Capitan OSX (2017)


Demo on Snow Leopard OSX (2014)

Tetris Snow Leopard demo