nsnake
Classic snake game for the terminal
|
1 #ifndef BOARD_H_DEFINED
2 #define BOARD_H_DEFINED
4 #include <Misc/Array2D.hpp>
5 #include <Interface/Window.hpp>
14 #define BOARD_DEFAULT_PLAYER_X 2
15 #define BOARD_DEFAULT_PLAYER_Y 2
35 static int small_width;
36 static int small_height;
38 static int medium_width;
39 static int medium_height;
41 static int large_width;
42 static int large_height;
60 bool isBorder(
int x,
int y);
83 void setBoard(std::vector<std::vector<bool> >& newBoard);
95 void setStartX(
int x);
96 void setStartY(
int y);
102 void setMetadata(std::string name, std::string value);
128 std::map<std::string, std::string> metadata;
131 #endif //BOARD_H_DEFINED
bool hasMetadata(std::string name)
Tells if this level has a specific information attached.
std::string getMetadata(std::string name)
Gets a meta information from this level.
A segment of the terminal screen (2D char matrix).
void randomlyFillExceptBy(int x, int y)
Places random walls all over the Board except by #x and #y, allowing the Player to move a little bit ...
Board(int width, int height, Style style)
Creates a new Board.
A level where the snake runs and eats fruits.
void setMetadata(std::string name, std::string value)
Sets a meta information from this level.
Style style
Tells if the player will teleport when reaching the Board's limits or not.
Style
If the player will teleport when reaching the Board's limits or not.
bool isWall(int x, int y)
Tells if there's a wall at #x #y.
void setBoard(std::vector< std::vector< bool > > &newBoard)
Sets the whole level content.
void clear()
Makes the whole level empty.
void teleport(Player *player)
Makes the Player teleport if it's on a border.