Snoke
labyrinth.h
Go to the documentation of this file.
1 
11 #ifndef LABYRINTH_H
12 #define LABYRINTH_H
13 #include "../Common/common.h"
14 #include "../Snake/snake.h"
15 #include "change.h"
16 #include "../Ball/ball.h"
17 #include <ncurses.h>
18 #include <string>
19 #include <cstring>
20 #include <cstdio>
21 #include <list>
22 
28 {
29  public:
32  void displayHandler(int displayMethod);
33  void displayFull();
34  void freeDisplay();
35  void forcedDisplay(int displayMethod);
36  void displayPartialy();
37  void displayUpdated();
38 };
39 
40 
44 const int DISPFULL = 0;
48 const int DISPPART = 1;
52 const int DISPUPD = 2;
53 
66 class Labyrinth
67 {
68  private:
69  char** labyrinth;
70  std::string reserved = "!";
71  Snake* snake = NULL;
77  friend class DisplayHandler;
79  void updateLabyrinth();
80  void sizeHandler();
81  public:
84  bool setLabyrinth(Point dimensions);
85  bool addSnake(Snake* snake);
86  bool addPoint(Point p);
87  bool rmPoint(Point p);
88  void displayHandler(int displayMethod = -1);
89  bool initBall();
90  bool generateBall();
91  short isFree(Point p);
92  bool save(char name[MAXLINE]);
93  bool load(char name[MAXLINE]);
94 };
95 
96 #endif
DisplayHandler dispHandler
Definition: labyrinth.h:78
Labyrinth * labyrinth
Definition: labyrinth.h:30
class for containing and displaying the game field
Definition: labyrinth.h:66
Describes the Ball entity of the game.
Definition: ball.h:33
Point end
Definition: labyrinth.h:73
void freeDisplay()
No extra stimulus, displaying the default way.
const int MAXLINE
Definition: common.h:28
Definitions and prototypes for Change class.
Ball ball
Definition: labyrinth.h:83
Point start
Definition: labyrinth.h:72
A Support Change class.
Definition: change.h:21
const int DISPPART
the whole labyrinth doesn&#39;t fit, so we are displaying it partialy
Definition: labyrinth.h:48
Point gameFieldSize
Definition: labyrinth.h:76
int prevDisplayMethod
Definition: labyrinth.h:31
void displayFull()
redraw every Point of the labyrinth
const int DISPFULL
the whole labyrinth can fit and was redrawed
Definition: labyrinth.h:44
char ** labyrinth
Definition: labyrinth.h:69
void displayPartialy()
display labyrinth partialy, using the start and end Points
void displayUpdated()
draw only the changed Points when the labyrinth is being fully displayed
Point prevEnd
Definition: labyrinth.h:75
Change change
Definition: labyrinth.h:82
void forcedDisplay(int displayMethod)
got an extra stimulus for displaying in a certain method
Describes the Snake entity of the game.
Definition: snake.h:79
void displayHandler(int displayMethod)
handler for choosing the approriate display method in the current environment
Point prevStart
Definition: labyrinth.h:74
const int DISPUPD
the whole labyrinth can fit and was already fully redrawn so we just need to redraw the changed Point...
Definition: labyrinth.h:52
Coordinates and style of the cell in console window.
Definition: common.h:52