nSnake
A ncurses implementation of the classic Snake game
 All Data Structures Files Functions Variables Enumerations Macros Pages
Data Structures | Macros | Enumerations | Functions | Variables
nsnake.h File Reference

This file defines the core functions, variables and structures. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  game_t
 Global definitions related to the game in general. More...
 

Macros

#define TRUE   1
 Boolean type TRUE - this will make things easier to read.
 
#define FALSE   0
 Boolean type FALSE - this will make things easier to read.
 

Enumerations

enum  states {
  MAIN_MENU, GAME_INIT, GAME, PAUSED,
  GAME_OVER, EXIT
}
 
enum  modes { FREE_MODE, BORDERS_ON, BORDERS_OFF }
 The possible Game Modes. More...
 

Functions

void nsnake_abort (char *error_msg)
 Aborts the game and displays the error message. More...
 
void nsnake_exit ()
 Interrupts the game and quits to the terminal. More...
 
void nsnake_game_over ()
 
void nsnake_init ()
 Starts all the necessairy stuff. More...
 
void nsnake_pause ()
 It, umm, pauses the game, i guess.
 

Variables

struct game_t game
 The global game structure.
 

Detailed Description

This file defines the core functions, variables and structures.

Definition in file nsnake.h.

Enumeration Type Documentation

enum modes

The possible Game Modes.

In Normal Mode, the snake dies by colliding with itself or the borders.
In Teleport Mode, the snake only dies by colliding with itself.

Note
Free Mode is for testing purposes only.

Definition at line 51 of file nsnake.h.

Function Documentation

void nsnake_abort ( char *  error_msg)

Aborts the game and displays the error message.

Note
EXIT_FAILURE is a portable constant for indicating failure upon exiting a program.

Definition at line 48 of file nsnake.c.

void nsnake_exit ( )

Interrupts the game and quits to the terminal.

Note
EXIT_SUCCESS is a portable constant for indicating success upon exiting a program.

Definition at line 61 of file nsnake.c.

void nsnake_init ( )

Starts all the necessairy stuff.

Sets all the global variables and call the initial functions so the game may start.

See Also
hscore_init()
player_init()
fruit_init()
engine_show_screen()

Definition at line 84 of file nsnake.c.