/snake

Snake game in C using SDL

Primary LanguageC

SNAKE

Snake game in C using SDL

Compile:

You need to install SDL1.2, SDL_ttf and freetype first. Then in root directory execute: make

Run:

In root directory execute: ./bin/snake

You can provide a custom window width: ./bin/snake <width>

By default the window width is set in src/config.h The window height is calculated automatically.

Config and custom map:

In src/config.h you can change the default window width and the default framerate (FRAME_TIME = 1/FRAMERATE)

In src/map.h you can edit the map. ' ' is a free space and 'x' is a wall.

The map size is 10x10 by default.

Folder structure:

  • /bin/ contain the output binary file after compilation.
  • /build/ contain all .o files automatically generated by Makefile.
  • /lib/ contain the graphic library that is a wrapper of the SDL1.2 and the text font.
  • /src/ contain the source files of the game.