29 bool firsttime =
true;
32 std::unique_ptr<SocketConnection> sockcon;
44 GameBase(
int assignmentID, std::string username,
45 std::string apikey,
int nbRow = 10,
int nbColumn = 10)
46 :
bridges(assignmentID, username, apikey), gg(nbRow,
50 sockcon = std::make_unique<SocketConnection>(
bridges);
53 std::cerr <<
"nbRow: " << nbRow <<
" nbCol: " <<
54 nbColumn << std::endl;
80 sockcon->registerKeyListener(
p);
99 sockcon->sendDataToServer(gg);
This class contains methods to connect and transmit a user's data structure representation to the Bri...
Definition: Bridges.h:50
int const * getDimensions()
Get dimenions of the grid.
Definition: Grid.h:164
The base class building and using the BRIDGES based games.
Definition: GameBase.h:23
NamedSymbol getSymbol(int row, int col)
What object is in this cell?
Definition: GameBase.h:162
void setTitle(std::string title)
Set the title of the game.
Definition: GameBase.h:139
int getBoardHeight()
How tall is the Game Board?
Definition: GameBase.h:185
virtual void gameLoop()=0
This function is called once per frame of the game.
NamedColor getSymbolColor(int row, int col)
What color is object in this cell?
Definition: GameBase.h:170
void drawSymbol(int row, int col, NamedSymbol symb, NamedColor nc)
Draw an object on the game.
Definition: GameBase.h:131
void quit()
calling this function causes the game to end.
Definition: GameBase.h:112
NamedColor getBGColor(int row, int col)
What color is this cell?
Definition: GameBase.h:154
void registerKeyListener(KeypressListener *p)
register a new KeypressListener
Definition: GameBase.h:79
virtual void initialize()=0
This function is called once when the game starts.
virtual ~GameBase()=default
void setDescription(std::string desc)
Set a short description of the game.
Definition: GameBase.h:146
void setBGColor(int row, int col, NamedColor nc)
Change the background color of a cell.
Definition: GameBase.h:121
GameBase(int assignmentID, std::string username, std::string apikey, int nbRow=10, int nbColumn=10)
Protected constructed prevens direct creation.
Definition: GameBase.h:44
void render()
Renders the game.
Definition: GameBase.h:87
bool debug
Definition: GameBase.h:35
int getBoardWidth()
How wide is the Game Board?
Definition: GameBase.h:177
bool gameover() const
Definition: GameBase.h:104
This is a class in BRIDGES for representing an (n x n)game grid.
Definition: GameGrid.h:398
void setBGColor(int row, int col, NamedColor color)
Definition: GameGrid.h:419
void drawSymbol(int row, int col, NamedSymbol symbol, NamedColor color)
Definition: GameGrid.h:461
NamedColor getFGColor(int row, int col) const
Definition: GameGrid.h:427
NamedSymbol getSymbol(int row, int col) const
Definition: GameGrid.h:431
NamedColor getBGColor(int row, int col) const
Definition: GameGrid.h:423
This is meant to be an internal class, not something that the library user will use....
Definition: SocketConnection.h:34
NamedSymbol
Definition: GameGrid.h:164
NamedColor
Definition: GameGrid.h:14
Support for drawing Bar charts.
Definition: alltypes.h:4