https://github.com/sonodima/nxtetris
Cross-platform, over-engineered XTetris built in ANSI-C
https://github.com/sonodima/nxtetris
cross-platform game game-development ncurses tui xtetris
Last synced: about 2 months ago
JSON representation
Cross-platform, over-engineered XTetris built in ANSI-C
- Host: GitHub
- URL: https://github.com/sonodima/nxtetris
- Owner: sonodima
- License: mit
- Created: 2021-10-15T08:15:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T07:33:16.000Z (over 2 years ago)
- Last Synced: 2025-02-03T12:22:02.817Z (4 months ago)
- Topics: cross-platform, game, game-development, ncurses, tui, xtetris
- Language: C
- Homepage: https://sonodima.github.io/nxtetris
- Size: 9.56 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NXTetris đšī¸
> Cross-platform, over-engineered XTetris written in C## Features
- [x] Single-player game mode
- [x] Two-players game mode
- [x] Player vs. AI game mode _(AI algorithm is still really basic)_
- [x] Piece control with keyboard and mouse
- [x] 2D CLI graphics abstraction
- [x] Audio output support## Controls
### Menu(s)
* KB_RIGHT - Confirm
* KB_LEFT - Exit / Back
* KB_UP, KB_DOWN - Menu navigation### Game
* KB_LEFT, KB_RIGHT - Rotate the tetromino
* KB_UP, KB_DOWN - Change tetromino
* MOUSE_X - Position the tetromino in the x-axis
* MOUSE_LEFT - Drop the current tetromino in the board## Build
Requirements:
- cmake
- make
- pkg-config _(macOS/Linux only)_---
Building the program is done by running the following commands:
```bash
git clone --recursive https://github.com/sonodima/nxtetris
cd nxtetrismkdir -p build/release
cd build/releasecmake ../.. -DCMAKE_BUILD_TYPE=Release
make
```The output executable will be named `nxtetris` and will be placed in `build/release`.
NOTE: The binary needs to be shipped with the `resources` folder _(which is copied to the build directory at
compile time)_ in order to work properly. _(without it the audio won't play)_### Windows Compilation
Due to ncurses limitations, on Windows MinGW is required to compile the program.
You can use the following command to generate the Makefile for MinGW:```bash
cmake ../.. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
```## Libraries
- [ncurses:](https://invisible-island.net/ncurses) terminal control library, enabling the construction of text user
interface (TUI) applications.
- [portaudio:](http://www.portaudio.com/) cross-platform audio I/O library.
- [libsndfile:](http://www.mega-nerd.com/libsndfile/) audio file I/O library.All the libraries are managed by [vcpkg](https://vcpkg.io/) and are automatically obtained during the build process.
NOTE: The first build will take a while since all the libraries need to be downloaded and built.