Skip to content

๐Ÿ A simple recreation of the classic Snake game employing dynamically loaded visualization libraries

License

Notifications You must be signed in to change notification settings

jacksonwb/nibbler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

nibbler

A simple recreation of the classic Snake game employing dynamically loaded visualization libraries

render style 1

render style 2 render style 3

Usage

./nibbler [-h] width height

-h enable hard mode - snake accelerates

  • wsad or UpDownLeftRight
  • Esc - exit
  • Space - pause
  • 123 - select graphics module

Dependencies

  • clang++
  • ncurses
  • SDL
  • SDL_ttf
  • SDL_image

Build

make; make dylib

On MacOS a simple script has been included to install dependencies through brew. The install script also supports linux systems using apt

Install with : ./install.sh

Graphics Module Interface

Each graphics module is seperately compiled as a shared object and loaded dynamically during runtime. The game makes calls to the graphics library using the following class interface:

#ifndef IRENDER_HPP
# define IRENDER_HPP

class IRender {
	public:
		IRender(void) {};
		virtual void init(void) = 0;
		virtual char getInput(void) = 0;
		virtual void destroy(void) = 0;
		virtual void render(void) = 0;
		virtual ~IRender(void) {};
};

#endif

A two dimensional char array representing the game state is made available to the library to draw the board.

About

๐Ÿ A simple recreation of the classic Snake game employing dynamically loaded visualization libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published