-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonlinegameboardwindow.h
68 lines (54 loc) · 1.6 KB
/
onlinegameboardwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#ifndef ONLINEGAMEBOARDWINDOW_H
#define ONLINEGAMEBOARDWINDOW_H
/*
* This is the class for the window in which the players play the game in the online mode.
*
*/
#include "mainwindow.h"
#include <QTimer>
#include <boost/json/value.hpp>
#include <boost/json.hpp>
#include "hexboardmanager.h"
namespace Ui {
class OnlineGameBoardWindow;
}
class OnlineGameBoardWindow : public QMainWindow, public HexBoardManager
{
Q_OBJECT
public:
explicit OnlineGameBoardWindow(QWidget *parent = nullptr);
~OnlineGameBoardWindow();
std::string username = "";
std::string creator = "";
std::string opponent = "";
void show_players();
int gameid = -1;
std::string host = "";
std::string port = "";
std::string sessionid = "";
std::string csrftoken = "";
QTimer* perform_timer;
Colour player_colour = Colour::EMPTY;
private slots:
void on_readyBbutton_clicked();
void perform();
void cancel();
void timeout();
void perform_check_turn();
void timeout_check_turn();
void perform_check_colour();
void timeout_check_colour();
private:
Ui::OnlineGameBoardWindow *ui;
void createHexagonalButtons(int length, int size, int x_offset, int y_offset);
void on_HexagonalButton_clicked(int val);
void get_host_info_from_file();
void connect_web_socket_with_text(std::string path, std::string text, std::string* ret_msg);
void set_colour_turn(Colour c);
void ready_to_start(boost::json::object v);
void wait_for_turn();
void update_board(std::string ret_msg);
void check_colour();
};
#endif // ONLINEGAMEBOARDWINDOW_H