nSnake
A ncurses implementation of the classic Snake game
src/player.h
Go to the documentation of this file.
00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
00002  * nSnake - The classic snake game with ncurses.                              *
00003  * Copyright (C) 2011-2012  Alexandre Dantas (kure)                           *
00004  *                                                                            *
00005  * This file is part of nSnake.                                               *
00006  *                                                                            *
00007  * nSnake is free software: you can redistribute it and/or modify             *
00008  * it under the terms of the GNU General Public License as published by       *
00009  * the Free Software Foundation, either version 3 of the License, or          *
00010  * any later version.                                                         *
00011  *                                                                            *
00012  * This program is distributed in the hope that it will be useful,            *
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
00015  * GNU General Public License for more details.                               *
00016  *                                                                            *
00017  * You should have received a copy of the GNU General Public License          *
00018  * along with this program.  If not, see <http://www.gnu.org/licenses/>.      *
00019  *                                                                            *
00020  * homepage: http://sourceforge.net/projects/nsnake/                          *
00021  *                                                                            *
00022 \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00023 
00029 #ifndef PLAYER_DEFINED
00030 #define PLAYER_DEFINED
00031 
00032 
00033 #include "nsnake.h"
00034 
00035 
00038 struct player_pieces
00039 {
00040         int x; 
00041         int y; 
00042 };
00043 
00044 
00047 enum directions { UP = 0, LEFT, DOWN, RIGHT };
00048 
00049 
00056 struct player_t
00057 {
00058         int is_alive;   
00059         int     speed;      
00060         int     size;       
00061         int score;      
00062         int direction;  
00064         struct player_pieces* body; 
00065 };
00066 
00067 
00069 extern struct player_t snake;
00070 
00071 
00072 void player_change_direction (int new_direction);
00073 int  player_collided_with_borders ();
00074 void player_exit ();
00075 int  player_hit_borders ();
00076 int  player_hit_fruit ();
00077 int  player_hit_self ();
00078 void player_increase_score (int add);
00079 void player_increase_size (int size);
00080 void player_init ();
00081 void player_teleport_borders ();
00082 void player_update ();
00083 
00084 
00085 #endif
 All Data Structures Files Functions Variables Enumerations Defines