You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6 KiB

# 3D Tetris
A C++17 3D Tetris game rendered with SDL2 and OpenGL. The playfield is six
cells wide, six cells deep, and twelve layers high. Fill a complete horizontal
layer to clear it. Drag with the left mouse button to orbit the 3D view and use
the mouse wheel to zoom.
## Build and run
Install SDL2 and OpenGL development libraries, plus `pkg-config`, then build
and run on Linux:
```sh
make
./build/3dtetris
```
On Windows, install SDL2 development libraries and compile `main.cpp` with a
C++17 compiler, SDL2, and OpenGL. To cross-compile from Linux, install the
x86_64 MinGW-w64 compiler and download/unpack the SDL2 MinGW development
package. Point `SDL2_CROSS_ROOT` at its `x86_64-w64-mingw32` directory (the
directory containing `include/SDL2` and `lib`):
```sh
make SDL2_CROSS_ROOT=/path/to/SDL2/x86_64-w64-mingw32 bundle-windows
```
The `bundle-windows` target cross-compiles a stripped, statically linked
x86_64 Windows executable and packages only that executable as
`dist/3dtetris-v0.1-windows-x64.zip`. Override `VERSION` to change the version
shown in the window title and used in the archive name, for example:
```sh
make VERSION=0.2 bundle-windows
```
The SDL2 MinGW development package and `zip` must be installed to create the
Windows bundle.
## Controls
- **A / D** or **Left / Right**: move left / right
- **W / S** or **Up / Down**: move across the depth; Down soft-drops
- **Q / E**: rotate
- **Space**: hard drop
- **P**: pause / resume
- **R**: restart
- **Esc**: quit
- **Left mouse drag / wheel**: orbit / zoom the camera
`--help` and `--version` print usage and version information.