My first university project—a simple Snake Game made in OpenGL.reviving the nostalgia of childhood gaming. Smooth movement, retro vibes, and pure coding joy!
Control a snake, eat food, grow longer, and avoid collisions with walls and yourself.
- Interactive Menu System with Play, Help, and Exit options
- Multiple Difficulty Levels (Easy, Medium, Hard)
- Real-time Snake Movement controlled via arrow keys
- Progressive Gameplay where the snake grows with each food item eaten
- Score Tracking displayed at the end of each game
- Arrow Up: Move snake upward
- Arrow Down: Move snake downward
- Arrow Left: Move snake left
- Arrow Right: Move snake right
- ESC: Return to menu (during gameplay)
- Start the game by selecting "Play" from the main menu
- Control the snake to collect food items that appear randomly
- Avoid collisions with walls and the snake's own body
- Your score increases with each food item collected
- The game ends when the snake collides with a wall or itself
- Easy: Slower snake speed for beginners
- Medium: Moderate speed for casual players
- Hard: Fast speed for experienced players
- OpenGL
- GLUT (OpenGL Utility Toolkit)
- C/C++ compiler
- OpenGL and GLUT libraries
- C/C++ development environment
-
Install dependencies:
- Windows: Install MinGW/Visual Studio with OpenGL support
- Linux:
sudo apt-get install freeglut3-dev - macOS:
brew install freeglut
-
Clone the repository:
git clone https://github.com/sigma-asif/snake-game-opengl.git cd snake-game -
Compile the game:
- Windows (using MinGW):
g++ -o snake_game main.cpp -lopengl32 -lfreeglut
- Linux/macOS:
g++ -o snake_game main.cpp -lGL -lGLU -lglut
- Windows (using MinGW):
-
Run the game:
./snake_game
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Special thanks to the OpenGL and GLUT communities



