nSnake
A ncurses implementation of the classic Snake game
 All Data Structures Files Functions Variables Enumerations Macros Pages
engine.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 
30 #ifndef ENGINE_DEFINED
31 #define ENGINE_DEFINED
32 
34 #define OS_IS_WINDOWS ((defined __WIN32__) && (!defined __CYGWIN__))
35 
36 #if OS_IS_WINDOWS
37  // Ugh... windows...
38  #include <curses.h>
39 #else
40  // Yay! Anything else!
41  #include <ncurses.h>
42 #endif
43 
46 struct screen_t
47 {
48  int width;
49  int height;
50  int delay;
51 };
52 
53 
55 extern struct screen_t screen;
56 
57 
58 void draw_background ();
59 void draw_borders ();
60 void draw_fruit ();
61 void draw_fruit_bonus ();
62 void draw_player ();
63 void draw_score ();
64 
65 void engine_exit ();
66 void engine_init ();
67 void engine_show_game_over ();
68 void engine_show_main_menu ();
69 void engine_show_pause ();
70 void engine_show_screen ();
71 
72 int get_main_menu_input (int* current_option);
74 void engine_clean_game_over ();
75 void engine_clean_pause ();
76 
77 void start_atrribute (int attr);
78 
79 #endif