Skip to content

Sam1624/sfml-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game in C++ with SFML

A classic Snake game, brought to life with C++ and SFML. Simple yet dynamic, written from scratch — head to tail 🐍.

Gameplay

🚀 Features

  • ✅ Fullscreen mode
  • ✅ Smooth movement with interpolation
  • ✅ Collision with walls and snake’s own body
  • ✅ Food spawns outside the snake
  • ✅ Real-time score tracking
  • ✅ Restart with the R key
  • ✅ Quit anytime with Q

🎮 Controls

Key Action
W Move up
S Move down
A Move left
D Move right
R Restart the game
Q Quit the game

🛠️ Build Instructions

📋 Requirements

  • C++17 compatible compiler
  • SFML 2.5+
  • CMake ≥ 3.16

🔧 Build Steps

git clone https://github.com/Sam1624/sfml-snake.git
cd sfml-snake
mkdir build && cd build
cmake ..
make
./snake

If SFML is installed in a non-default location:

cmake -DSFML_DIR=/path/to/SFML ..

📁 Project Structure

.
├── CMakeLists.txt
├── LICENSE
├── .gitignore
├── .clangd
├── include/
│   ├── Config.hpp
│   ├── Food.hpp
│   ├── Game.hpp
│   └── Snake.hpp
├── src/
│   ├── Food.cpp
│   ├── Game.cpp
│   ├── Snake.cpp
│   └── main.cpp
├── resources/
│   ├── font.ttf
│   └── gameplay.gif

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A classic Snake game built with modern C++17 and SFML, featuring smooth interpolated movement.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published