2 #ifndef CLIENT__GAMEWINDOW__H
3 #define CLIENT__GAMEWINDOW__H
8 #include <unordered_map>
9 #include <SFML/Graphics.hpp>
12 #include <json/json.h>
15 class ClientGameEngine;
16 class TextureDisplayer;
28 #include "TextureDisplayer.hpp"
29 #include "GraphicCard.hpp"
30 #include "shared/Map.hpp"
33 #include "PopUpWindow.hpp"
43 std::unique_ptr<TextureDisplayer> backgroundTexture;
44 std::vector<TextureDisplayer> mapTextureToDisplay;
45 std::unique_ptr<TextureDisplayer> boxTexture;
46 std::unordered_map<std::string, std::unique_ptr<TextureDisplayer>> elementTextureToDisplay;
47 std::vector<TextureDisplayer> hudTextureToDisplay;
48 std::vector<GraphicCard> priorityCards;
49 std::vector<GraphicCard> actionCardsToDisplay;
50 std::shared_ptr<shared::Map> mapShared =
nullptr;
51 sf::Cursor clientCursor;
53 std::array<int, 2> firstHexagonPosition;
54 std::vector<Button> whoIsPlayingButtons;
56 std::unique_ptr<Chat> chatBox;
57 bool isChatOpen =
false;
58 std::unique_ptr<PopUpWindow> validateBoxesWindow;
59 std::array<int, 25> techWheelRotation;
60 std::shared_ptr<Button> textForTheUser;
61 std::mutex updatePlayerMutex;
62 std::unique_ptr<Button> endOfRoundButton;
63 std::unique_ptr<PopUpWindow> winnerWindow;
75 void setUpText (
GraphicCard& card, std::string title, std::string body, sf::Font& titleFont, sf::Font& bodyFont,
const Json::Value& dataNumber,
float titleTextProportion,
float bodyTextProportion);
76 bool clickAction (sf::Event& event, sf::Vector2i clickPosition, std::shared_ptr<bool> moveMode);
79 bool handleGameEvent (sf::Event& event, sf::Vector2i& clickStartingPoint, std::shared_ptr<bool> moveMode, std::shared_ptr<bool> clickMode);
81 void moveMap (sf::Vector2i & clickStartingPoint, sf::Vector2i position,
bool reset =
false);
85 void rotateTechWheel (
int newLevel);
87 bool onHexagonClick (sf::Vector2i clickPosition);
88 void addPlayer (std::string username);
90 int getPlayerNumber (std::string username);
91 void selectElementToDisplay (
int x,
int y);
class ClientGameEngine -
Definition: ClientGameEngine.hpp:34
class GameWindow -
Definition: GameWindow.hpp:38
const Json::Value openJsonFile(std::string path)
Open JSON File.
Definition: GameWindow.cpp:366
void modifyTextForUser(std::string text)
Function to modify the text that is specified at a player.
Definition: GameWindow.cpp:1014
void moveToRightPriorityCards(int difficulty)
Move to right priority cards when a player play one.
Definition: GameWindow.cpp:392
void updateElementTexture()
Update all the textures of the map.
Definition: GameWindow.cpp:725
void moveMap(sf::Vector2i &clickStartingPoint, sf::Vector2i position, bool reset=false)
Move the map on the screen.
Definition: GameWindow.cpp:329
bool clickAction(sf::Event &event, sf::Vector2i clickPosition, std::shared_ptr< bool > moveMode)
Function that deteck where the user click and what to send to the engine.
Definition: GameWindow.cpp:506
bool handleKeyboardEvent(sf::Event::KeyEvent keyEvent)
Test keyboard events and do actions corresponding to the event.
Definition: GameWindow.cpp:257
void setUpText(GraphicCard &card, std::string title, std::string body, sf::Font &titleFont, sf::Font &bodyFont, const Json::Value &dataNumber, float titleTextProportion, float bodyTextProportion)
Display text on the cards.
Definition: GameWindow.cpp:565
bool handleGameEvent(sf::Event &event, sf::Vector2i &clickStartingPoint, std::shared_ptr< bool > moveMode, std::shared_ptr< bool > clickMode)
Test events and do actions corresponding to the event.
Definition: GameWindow.cpp:201
long getCurrentTime(bool timeSecond=true)
Function that deteck where the user click and what to send to the engine.
Definition: GameWindow.cpp:1052
GameWindow()
Constructor.
Definition: GameWindow.cpp:58
void startGame()
Loop that look for events to happend and call displayWindow()
Definition: GameWindow.cpp:152
void changeMouseCursor(sf::Event &event, std::shared_ptr< bool > moveMode)
Change the cursor type to a hand or an arrow.
Definition: GameWindow.cpp:300
bool priorityCardClickAction(sf::Vector2i clickPosition)
Detect when we click on a priority card or on the play button on priorityCard and make the action ass...
Definition: GameWindow.cpp:421
void loadMapTexture()
Load all the textures of the map.
Definition: GameWindow.cpp:662
void displayWindow()
Display all the different variable in the screen.
Definition: GameWindow.cpp:74
sf::Vector2i getBoxesElementsPosition(float boxXProportion, float boxYProportion, GraphicCard &priorityCard)
Get position of number of boxes and boxes on priority cards.
Definition: GameWindow.cpp:838
void loadHudTexture()
Load all the HUD textures.
Definition: GameWindow.cpp:857
void setWinnerWindow(std::string winner, std::string causes)
Function to set the winnee window at the end of the party.
Definition: GameWindow.cpp:1069
void loadElementTexture()
Load all the textures of the elements.
Definition: GameWindow.cpp:690
void sendMessage()
This function send a message to the server.
Definition: GameWindow.cpp:281
class GraphicCard -
Definition: GraphicCard.hpp:22