42 gameFieldSize.
x = size;
43 gameFieldSize.
y = size/2;
59 this->loops = loops > 0 ? loops : -1;
97 while (!flag &&
loops != 0)
99 int command = getch();
173 bool initFlag =
snake.
init(begin, dir, length);
175 return initFlag && addFlag;
void setSpeed(int sp)
The method to change the game speed without giving the direct access and some error handling...
void mSleep(int time)
Cross-platform sleep function cover.
void initQueue()
Initializes change array, by resetting it.
bool init(int size=20, int sp=100, int loops=-1)
Initializes game.
bool initBall()
Ball initialization with labyrinth updating.
bool move(Labyrinth *labyrinth)
The snake movement on the game field(should be called in each iteration of the game cycle...
Definitions and prototypes for Game class.
void resizeHandler(int sig)
bool setLabyrinth(Point dimensions)
Sets the default values fro the variables as well as generating the labyritnh array with borders...
bool setDirection(int dir)
The method to set the direction where the snake is heading.
void sleepHandler()
setting new values for sleep function on signal interrupt
bool init(Point begin, short direction, int length)
Initializes snake as an entity without ancoring it anywhere.
const int DISPFULL
the whole labyrinth can fit and was redrawed
bool initSnake(Point begin, short dir, int length)
Snake initialization with labyrinth updating.
const int MVLEFT
snake's head is moving left
void setLoops(int loops)
sets loops with some error holding
const int MVUP
snake's head is moving up
bool addSnake(Snake *snake)
Adding snake to the laburinth and getting the host snake(firest added snake)
void addSleep()
For unix-based systems interrupted sleep must be continued.
const int MVRIGHT
snake's head is moving right
void displayHandler(int displayMethod=-1)
A method which decides what dispaly method will be used in each situation.
Coordinates and style of the cell in console window.
const int MVDOWN
snake's head is moving down