nSnake
A ncurses implementation of the classic Snake game
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Enumerations
Macros
Pages
src
player.h
Go to the documentation of this file.
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* nSnake - The classic snake game with ncurses. *
3
* Copyright (C) 2011-2012 Alexandre Dantas (kure) *
4
* *
5
* This file is part of nSnake. *
6
* *
7
* nSnake is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* any later version. *
11
* *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
19
* *
20
* homepage: http://sourceforge.net/projects/nsnake/ *
21
* *
22
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
23
29
#ifndef PLAYER_DEFINED
30
#define PLAYER_DEFINED
31
32
33
#include "
nsnake.h
"
34
35
38
struct
player_pieces
39
{
40
int
x
;
41
int
y
;
42
};
43
44
47
enum
directions
{ UP = 0, LEFT, DOWN, RIGHT };
48
49
56
struct
player_t
57
{
58
int
is_alive
;
59
int
speed
;
60
int
size
;
61
int
score
;
62
int
direction
;
64
struct
player_pieces
*
body
;
65
};
66
67
69
extern
struct
player_t
snake
;
70
71
72
void
player_change_direction
(
int
new_direction);
73
int
player_collided_with_borders
();
74
void
player_exit
();
75
int
player_hit_borders
();
76
int
player_hit_fruit
();
77
int
player_hit_self
();
78
void
player_increase_score
(
int
add);
79
void
player_increase_size
(
int
size
);
80
void
player_init
();
81
void
player_teleport_borders
();
82
void
player_update
();
83
84
85
#endif
Generated on Wed May 15 2013 15:04:42 for nSnake by
1.8.3.1