This project is a 2D game written in C++ with SDL library for graphic rendering. It's called Snake Game. The goal is to guide the snake to eat the apple. Use direction buttons to set the direction (left, right, up, down) the snake is going to. Each time the snake eats the food his body grows up and score is incremented. If the snake eats his own body the game ends. The starter code can be found at the repo (https://github.com/udacity/CppND_Capstone_Snake_Game).
- 1st requirement: The project makes use of references in function declarations
- files: renderer.h (line 58); renderer.cpp (line 115)
- 6th requirement: The project uses smart pointers instead of raw pointers
- files: renderer.h (lines 62 to 73); renderer.cpp (lines 22 to 63)
- 7th requirement: Overloaded functions allow the same function to operate on different parameters
- files: renderer.h (lines 17 to 45)
- 5th requirement: Classes encapsulate behaviour
- files: snake.cpp (lines 5 to 150); snake.h (lines 31 to 47)
- 2th requirement: The project reads data from an external file
- file: renderer.cpp (lines 44 to 47)
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
- Note that for Linux, an
aptorapt-getinstallation is preferred to building from source.
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build - Compile:
cmake .. && make - Run it:
./SnakeGame.

