31 bool firsttime =
true;
34 std::unique_ptr<SocketConnection> sockcon;
49 GameBase(
int assignmentID, std::string username,
50 std::string apikey,
int nbRow = 10,
int nbColumn = 10)
51 : bridges(assignmentID, username, apikey), gg(nbRow,
55 sockcon = std::make_unique<SocketConnection>(bridges);
58 std::cerr <<
"nbRow: " << nbRow <<
" nbCol: " <<
59 nbColumn << std::endl;
84 sockcon->registerKeyListener(p);
103 sockcon->sendGameGrid(gg);
void visualize()
Definition: Bridges.h:430
void registerKeyListener(KeypressListener *p)
register a new KeypressListener
Definition: GameBase.h:83
void setDescription(const string &descr)
Definition: Bridges.h:269
void render()
Renders the game.
Definition: GameBase.h:91
NamedSymbol getSymbol(int row, int col)
What object is in this cell?
Definition: GameBase.h:166
bool debug
Definition: GameBase.h:39
This is a class in BRIDGES for representing an (n x n)game grid.
Definition: GameGrid.h:400
NamedColor getBGColor(int row, int col) const
Definition: GameGrid.h:426
void setTitle(const string &t)
Definition: Bridges.h:254
The base class building and using the BRIDGES based games.
Definition: GameBase.h:25
void setServer(const string &server_type)
Definition: Bridges.h:335
NamedColor getBGColor(int row, int col)
What color is this cell?
Definition: GameBase.h:158
void drawSymbol(int row, int col, NamedSymbol symbol, NamedColor color)
Definition: GameGrid.h:466
void setDataStructure(DataStructure *ds)
Definition: Bridges.h:280
void quit()
calling this function causes the game to end.
Definition: GameBase.h:116
void setDescription(std::string desc)
Set a short description of the game.
Definition: GameBase.h:150
void drawSymbol(int row, int col, NamedSymbol symb, NamedColor nc)
Draw an object on the game.
Definition: GameBase.h:135
GameBase(int assignmentID, std::string username, std::string apikey, int nbRow=10, int nbColumn=10)
Protected constructed prevens direct creation.
Definition: GameBase.h:49
NamedColor getSymbolColor(int row, int col)
What color is object in this cell?
Definition: GameBase.h:174
This class contains methods to connect and transmit a user's data structure representation to the Bri...
Definition: Bridges.h:39
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
void setBGColor(int row, int col, NamedColor nc)
Change the background color of a cell.
Definition: GameBase.h:125
NamedColor
Definition: GameGrid.h:14
int getBoardWidth()
How wide is the Game Board?
Definition: GameBase.h:181
bool gameover() const
Definition: GameBase.h:108
void setVisualizeJSONFlag(bool flag)
Definition: Bridges.h:149
NamedSymbol
Definition: GameGrid.h:164
NamedSymbol getSymbol(int row, int col) const
Definition: GameGrid.h:434
virtual void initialize()=0
This function is called once when the game starts.
void setTitle(std::string title)
Set the title of the game.
Definition: GameBase.h:143
int getBoardHeight()
How tall is the Game Board?
Definition: GameBase.h:189
void setBGColor(int row, int col, NamedColor color)
Definition: GameGrid.h:422
int const * getDimensions()
Get dimenions of the grid.
Definition: Grid.h:168
NamedColor getFGColor(int row, int col) const
Definition: GameGrid.h:430
virtual void gameLoop()=0
This function is called once per frame of the game.
This is meant to be an internal class, not something that the library user will use. Provides support for input handling for the Game API.
Definition: SocketConnection.h:23