Civilization
Public Member Functions | Public Attributes | List of all members
client::ClientGameEngine Class Reference

class ClientGameEngine - More...

#include <ClientGameEngine.hpp>

Collaboration diagram for client::ClientGameEngine:
Collaboration graph
[legend]

Public Member Functions

 ClientGameEngine ()
 Constructor. More...
 
void handleInformation (int x, int y)
 Print where the user click on the GameWindow. More...
 
void handleQuitMenu (bool quitDef=false)
 Change the Window for nothing, Menu or Game. More...
 
void renderGame ()
 Loop that manage the entire Engine.
 
void startMenuWindow ()
 Start the loop that manage the MenuWindow.
 
void startGameWindow ()
 Start the loop that manage the GameWindow.
 
void playGame ()
 Loop that is used when the client is in GameMode.
 
void playMenu ()
 Loop that is used when the client is in MenuMode.
 
bool connect (const std::string &serverAddress, int serverPort)
 
void startReceiving ()
 
void registerServerAnswer (const std::string &response)
 
void processServerRequest (std::string request)
 
void askServer ()
 
bool tryConnection (std::string id, std::string username, std::string server, std::string port)
 A player is connecting to a Game. More...
 
bool intersectPointRect (sf::Vector2i point, sf::FloatRect rectangle)
 Detect an intersection between a point and a rect. More...
 
void handlePriorityCardPlay (std::string typePlayed, int difficulty, int boxes)
 Print which priority card the user wants to play and its difficulty. More...
 
void printChat (const std::string &message)
 
void processMessage (boost::asio::streambuf &receiveBuffer)
 
void generateMap (const unsigned height, const unsigned width, const int seed)
 
void loadMap ()
 
void playTurn ()
 
void waitToBeReady ()
 
void runRule (shared::RuleArgsStruct ruleArgs)
 
void handleEndTurnButton ()
 
void randomIA ()
 

Public Attributes

std::shared_ptr< sf::RenderWindow > clientWindow
 
std::atomic< int > runningWindow = 1
 
std::atomic< bool > areTextureLoaded = false
 
std::unique_ptr< GameWindowclientGame = nullptr
 
std::unique_ptr< MenuWindowclientMenu = nullptr
 
std::vector< int > map
 
int turn = 0
 
std::shared_ptr< shared::Playermyself
 
std::string gameId = "new"
 
std::atomic< bool > clientConnectedAndReady
 
std::string serverGameId
 
shared::RuleArgsStruct ruleArgsStruct
 
std::atomic< bool > endOfTurn
 
std::vector< std::shared_ptr< shared::Player > > otherPlayers
 
std::atomic< bool > IATurn
 

Detailed Description

class ClientGameEngine -

Constructor & Destructor Documentation

◆ ClientGameEngine()

ClientGameEngine::ClientGameEngine ( )

Constructor.

Constructor of ClientGameEngine class

Member Function Documentation

◆ handleInformation()

void ClientGameEngine::handleInformation ( int  x,
int  y 
)

Print where the user click on the GameWindow.

Parameters
xposition on x axis
yposition on y axis

◆ handlePriorityCardPlay()

void ClientGameEngine::handlePriorityCardPlay ( std::string  typePlayed,
int  difficulty,
int  boxes 
)

Print which priority card the user wants to play and its difficulty.

Parameters
typePlayedtype of the priority card played (economy, science, culture, ...)
difficultylevel of difficulty played (0 to 4 for the 5 fields)

◆ handleQuitMenu()

void ClientGameEngine::handleQuitMenu ( bool  quitDef = false)

Change the Window for nothing, Menu or Game.

Parameters
quitDefif quitDef is true, the game stop, else it change Menu to Game

◆ intersectPointRect()

bool ClientGameEngine::intersectPointRect ( sf::Vector2i  point,
sf::FloatRect  rectangle 
)

Detect an intersection between a point and a rect.

Parameters
pointthe point
rectanglethe rectangle

◆ tryConnection()

bool ClientGameEngine::tryConnection ( std::string  id,
std::string  username,
std::string  server,
std::string  port 
)

A player is connecting to a Game.

Parameters
idgame ID, = new for a new Game
usernameplayer username
serverserveur adresse
portport number

The documentation for this class was generated from the following files: