Simple clone of Tetris in C/C++ using SDL2, for educational purposes.
This project depends on SDL2 and SDL_ttf 2.0
The SDL2 Development libraries for Visual C++ are checked in to the 3rdparty
folder for convenience.
Install using your package manager, e.g.
$ sudo apt-get install libsdl2-dev
$ sudo apt-get install libsdl2-ttf-dev
or download and install from source
The SDL2 packages (libsdl2-dev, libsdl2-ttf-dev) are available to install in Raspbian Jessie. On Wheezy and earlier you'll have to install from source.
Download the SDL2 source code and follow installation instructions or install with Brew
This project uses GENie to generate the build files for the target platform.
$ git clone https://github.com/howprice/sdl2-tetris
$ cd sdl2-tetris
$ tools/bin/linux/genie gmake
$ cd build
$ make
n.b. You may need to 'chmod +x' genie executable - I haven't figured out how to make the checked in file executable.
make
with no confic specified defaults to the debug config for native architecture (usually 64-bit). Can call make config=<xxx>
where xxx
can be debug
, release
, debug32
, release32
, debug64
or release64
.
Use tools/bin/raspberry-pi/genie
$ git clone https://github.com/howprice/sdl2-tetris
$ tools\bin\windows\genie.exe vs2015 -- You can also use vs2013 etc.
Open build\sdl2-tetris.sln with Visual Studio 2015.
The SDL2 Development libraries for Visual C++ are checked in to 3rdparty for convenience.
$ ./tools/bin/macosx/genie xcode9
or
$ ./genie_xcode9.sh
Open build/sdl2-tetris.xcworkspace in Xcode and build
$ ./genie_gmake.sh
$ cd build
$ make
$ tools/bin/linux/genie clean
or
$ ./genie_clean.sh
$ tools/bin/raspberry-pi/genie clean
$ tools\bin\windows\genie clean
$ tools/bin/macosx/genie clean
or
$ ./genie_clean.sh
Genie is configured to generate sdl2-tetris.vcxproj.user
which correctly sets the debugger working directory to data/
$ cd data
$ ../build/sdl2-tetris
GENie cannot set the working directory for Xcode so you must do it manually:
Xcode -> Product -> Scheme -> Edit Scheme... -> Options -> Working Directory -> Use custom working directory: $PROJECT_DIR/../data
$ cd data
$ ../build/sdl2-tetris
Cursor left and right | Move left and right Cursor down | Move down one tile Cursor up | Move down to bottom z | Rotate left x | Rotate right Esc | Quit
Classic Console font from http://webdraft.hu/fonts/classic-console