Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
/ snake-game Public archive

A snake game with scores, options, audio and more created using SFML.

License

Notifications You must be signed in to change notification settings

JustWhit3/snake-game

Repository files navigation

A snake game with scores, options, audio and more created using SFML.

v1.0 license C++20
code size repo size total lines
codeq doc


Table of contents

Introduction

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.

Architectures support

Operating systems

  • Linux
    • Ubuntu (tested)
  • Windows (release 10 or higher)
    • Cygwin64 (tested)
    • MSYS2 (tested)
    • MinGW (tested)
    • WSL (tested)
    • Powershell (tested)
  • MacOS

Compilers

  • gcc:
    • C++20: 9/10/11/12
  • clang:
    • C++20: 9/10/11/12/13
  • MSVC:
    • C++20: // (not tested yet)

Install and use

Install

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):

  • C++20 standard
  • g++ compiler
  • CMake (at least version 3.15)
  • SFML library (version 2.5.1)

⚠️ 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

Debug mode

To run debug mode:

cmake -B build -DCMAKE_BUILD_TYPE=Debug
sudo cmake --build build

Optional prerequisites for debug mode:

States

Menu

Commands:

  • Key arrows (Up / Down): to move from a button to another.
  • Esc: quit the window.
  • Enter / Right mouse click: click on a button.

Game

Commands:

  • Key arrows (Up / Down / Left / Right): move snake.
  • Esc: pause game.

Options

Commands:

  • Tab: go back to menu.

Scores

Only the three best scores, withing the respective player name, will be displayed here.

Credits

Project leaders


Gianluca Bianco

Stargazers over time

Stargazers over time

About

A snake game with scores, options, audio and more created using SFML.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published