In this repository a C++20 implementation of the popular snake game, using the SFML graphics library is provided. Audio effects are enabled and a few customizable options and scores are available.
During the gameplay some game files will be created in your home directory under the snake-game_files folder. These are files which will save game scores and options.
⚠️ if you are connecting more than one screens in your pc there may be small graphics glitches due to SFML doesn't supporting multiple screens yet.
- Linux
- Ubuntu (tested)
- Windows (release 10 or higher)
- Cygwin64 (tested)
- MSYS2 (tested)
- MinGW (tested)
- WSL (tested)
- Powershell (tested)
- MacOS
- gcc:
- C++20: 9/10/11/12
- clang:
- C++20: 9/10/11/12/13
- MSVC:
- C++20: // (not tested yet)
Steps to be reproduced:
1) Download one of the releases of the repository.
2) Unzip and enter the downloaded repository directory.
3) Install and compile the game and its dependencies:
cmake -B build
Install:
sudo cmake --build build --target install
⚠️ sudo
is not required on Windows.
Mandatory prerequisites (automatically installed with the script):
⚠️ on Linux other prerequisites for SFML are:libx11-dev
,xorg-dev
,freeglut3-dev
,libudev-dev
,libalut-dev
,libvorbis-dev
,libflac-dev
.
To run the game:
snake-game
Or if you don't want to install it:
cmake -B build
sudo cmake --build build
./build/src/snake-game
To run debug mode:
cmake -B build -DCMAKE_BUILD_TYPE=Debug
sudo cmake --build build
Optional prerequisites for debug mode:
Commands:
- Key arrows (Up / Down): to move from a button to another.
- Esc: quit the window.
- Enter / Right mouse click: click on a button.
Commands:
- Key arrows (Up / Down / Left / Right): move snake.
- Esc: pause game.
Commands:
- Tab: go back to menu.
Only the three best scores, withing the respective player name, will be displayed here.
Gianluca Bianco |