31 bool firsttime =
true;
36 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;
86 sockcon->registerKeyListener(
p);
105 sockcon->sendGameGrid(gg);
void registerKeyListener(KeypressListener *p)
register a new KeypressListener
Definition: GameBase.h:85
void render()
Renders the game.
Definition: GameBase.h:93
NamedSymbol getSymbol(int row, int col)
What object is in this cell?
Definition: GameBase.h:168
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
The base class building and using the BRIDGES based games.
Definition: GameBase.h:25
NamedColor getBGColor(int row, int col)
What color is this cell?
Definition: GameBase.h:160
void drawSymbol(int row, int col, NamedSymbol symbol, NamedColor color)
Definition: GameGrid.h:466
void quit()
calling this function causes the game to end.
Definition: GameBase.h:118
void setDescription(std::string desc)
Set a short description of the game.
Definition: GameBase.h:152
void drawSymbol(int row, int col, NamedSymbol symb, NamedColor nc)
Draw an object on the game.
Definition: GameBase.h:137
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:176
This class contains methods to connect and transmit a user's data structure representation to the Bri...
Definition: Bridges.h:42
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:127
NamedColor
Definition: GameGrid.h:14
int getBoardWidth()
How wide is the Game Board?
Definition: GameBase.h:183
bool gameover() const
Definition: GameBase.h:110
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.
virtual ~GameBase()=default
void setTitle(std::string title)
Set the title of the game.
Definition: GameBase.h:145
int getBoardHeight()
How tall is the Game Board?
Definition: GameBase.h:191
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....
Definition: SocketConnection.h:34