Snake! In Terminal! With ncurses
! Ugh... (>_<)
Author: Bartosz Rodziewicz
This game is simple implementation of snake idea. It's written in C++ with ncurses
as a TUI. The code that provide ncurses
support is based on jvns/snake repo that is under MIT license (Copyright (c) 2013 Julia Evans).
- Release
ncurses
- Debug
- Threads
- Google Test (included as a submodule)
To run a game create a new folder in project root dir, run cmake
and make
, eg:
mkdir cmake-build
cd cmake-build
cmake ..
make run
The game will automatically close after you loose.
The app provides few targets depending on cmake
build type. To set build type you need to pass -DCMAKE_BUILD_TYPE
parameter when running cmake
, eg: cmake -DCMAKE_BUILD_TYPE=Debug ..
.
When parameter is not set the Release build type is set automatically.
The build types naturally differs with the compiler flags used (more about that in cmake
docs).
This build type contains three main targets:
TerminalSnake
- game itselfrun
- compileTerminalSnake
target and run itinstall
- more about that in Install paragraph.
This build type require ncurses
library installed in your system (on Ubuntu can be installed using sudo apt-get install libncurses5-dev
) and should not require googletest
submodule.
This build type contains 3 more targets:
UnitTests
- gtest unit testsrunUnitTests
- compileUnitTests
and run ittest
- compileUnitTests
and run it usingctest
(you can do it usingctest
command as well)
It requires googletest
submodule, before running cmake
make sure you have this submodule initialized and updated (eg. git submodule update --init --recursive --jobs 8
).
More targets (auto-generated by cmake
) can be found with command make help
.
git submodule update --init --recursive --jobs 8
mkdir cmake-build
cd cmake-build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make runUnitTests
ctest
make run
Same as Release (difference in compiler flags tho).
Same as Debug (difference in compiler flags tho).
This game contains install
target which lets you install the game.
It installs the game to the default (for cmake
) directory. To specify custom directory you need to use -DCMAKE_INSTALL_PREFIX
parameter.
Installation of googletest
is turned off. install
target can be turned off completely using -DINSTALL_TERMINALSNAKE=OFF
parameter.
mkdir cmake-build
cd cmake-build
cmake -DINSTALL_TERMINALSNAKE=OFF ..
make install
# make: *** No rule to make target 'install'. Stop.