Snoke
common.h
Go to the documentation of this file.
1 
11 #ifndef COMMON_H
12 #define COMMON_H
13 #include <iostream>
14 #include <ncurses.h>
15 
16 #ifdef _WIN32
17 #include <windows.h>
18 #endif
19 
20 #ifdef _WIN64
21 #include <windows.h>
22 #endif
23 
24 #ifdef __unix__
25 #include <unistd.h>
26 #endif
27 
28 const int MAXLINE = 256;
29 
38 {
39  public:
40  char letter;
41  int fg;
42  int bg;
43 };
44 
52 class Point
53 {
54  public:
55  short x;
56  short y;
58  bool operator== (Point p);
59 };
60 
61 /*
62  * @brief Class definitions for the individual files to know that they exist
63  * while being separetly compiled
64  */
65 class Snake;
66 class Labyrinth;
67 class Game;
68 class Change;
69 class Ball;
70 
71 
72 std::ostream& operator<< (std::ostream &s, Point p);
73 void mSleep(int time);
74 void addSleep();
76 void sleepHandler();
77 
78 #ifndef __unix__
79 void set_escdelay(short mode);
80 #endif
81 
82 #ifndef __unix__
83 void set_escdelay(short mode);
84 #endif
85 
86 #endif
void set_escdelay(short mode)
Definition: common.cpp:71
short x
Definition: common.h:55
class for containing and displaying the game field
Definition: labyrinth.h:66
Describes the Ball entity of the game.
Definition: ball.h:33
Point getConsoleSize()
Gets size of current console screen in symdols.
Definition: common.cpp:100
std::ostream & operator<<(std::ostream &s, Point p)
Operation &#39;<<&#39; override for the Point class.
Definition: common.cpp:30
const int MAXLINE
Definition: common.h:28
A Support Change class.
Definition: change.h:21
int fg
Definition: common.h:41
Style of the cell in console window.
Definition: common.h:37
PointStyle style
Definition: common.h:57
Main game class.
Definition: game.h:30
short y
Definition: common.h:56
char letter
Definition: common.h:40
void sleepHandler()
setting new values for sleep function on signal interrupt
Definition: common.cpp:78
Describes the Snake entity of the game.
Definition: snake.h:79
void mSleep(int time)
Cross-platform sleep function cover.
Definition: common.cpp:49
int bg
Definition: common.h:42
void addSleep()
For unix-based systems interrupted sleep must be continued.
Definition: common.cpp:90
Coordinates and style of the cell in console window.
Definition: common.h:52