Initial Commit
This commit is contained in:
commit
5314a9d5c5
308 changed files with 190647 additions and 0 deletions
43
README.md
Normal file
43
README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Tetris (C + SDL3)
|
||||
|
||||
A small Tetris clone written in C using SDL3 for rendering/input and SDL3_ttf for text.
|
||||
|
||||
## Build
|
||||
|
||||
Requirements:
|
||||
- CMake (3.7+)
|
||||
- SDL3
|
||||
- A C compiler (gcc/clang)
|
||||
|
||||
Configure and build:
|
||||
|
||||
```bash
|
||||
cmake -S . -B build
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
./build/tetris
|
||||
```
|
||||
|
||||
## Controls
|
||||
|
||||
- Move left: `Left` or `A`
|
||||
- Move right: `Right` or `D`
|
||||
- Rotate: `Up` or `W`
|
||||
- Soft drop: `Down` or `S`
|
||||
- Quit: `Q` or `Esc`
|
||||
|
||||
## Gameplay Notes
|
||||
|
||||
- The board is `10 x 16` (`include/grid.h`).
|
||||
- Shapes are stored as an origin block plus 3 relative offsets (`src/shape.c`).
|
||||
- Rotation uses a 90-degree transform around the origin: `(x, y) -> (-y, x)` (`src/game.c`).
|
||||
- Collision checks allow negative `y` values so pieces can spawn/rotate partly above the visible top (`src/grid.c`).
|
||||
- Line clear logic re-checks the same row index after a clear, because rows above are shifted down (`src/grid.c`).
|
||||
|
||||
## Debug Logging
|
||||
|
||||
Debug logs are compiled in when `APP_DEBUG` is enabled (for example in Debug builds through CMake).
|
||||
Loading…
Add table
Add a link
Reference in a new issue