summaryrefslogtreecommitdiffstats
path: root/NetworkClient.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-15 12:17:53 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-15 12:17:53 +0200
commit2ee0f834487cfe4b6bd9424ca2715685a8db16e4 (patch)
tree6867718d6bfcd42f6a82c86dd8f149d6ea6cab68 /NetworkClient.hpp
downloadAltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.gz
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.bz2
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.lz
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.xz
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.tar.zst
AltCraft-2ee0f834487cfe4b6bd9424ca2715685a8db16e4.zip
Diffstat (limited to 'NetworkClient.hpp')
-rw-r--r--NetworkClient.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/NetworkClient.hpp b/NetworkClient.hpp
new file mode 100644
index 0000000..df2f616
--- /dev/null
+++ b/NetworkClient.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <queue>
+#include "Network.hpp"
+
+struct ServerInfo{
+ std::string version;
+ int protocol = 0;
+ int players_max = 0;
+ int players_online = 0;
+ std::vector<std::pair<std::string, std::string>> players;
+ std::string description;
+ double ping = 0;
+ std::string favicon;
+ std::string json;
+};
+class NetworkClient {
+public:
+ NetworkClient(std::string address, unsigned short port, std::string username);
+ ~NetworkClient();
+
+ void Update();
+
+ Packet GetPacket();
+ void AddPacketToQueue(Packet packet);
+
+ static ServerInfo ServerPing(std::string address,unsigned short port);
+private:
+ NetworkClient (const NetworkClient&);
+ NetworkClient&operator=(const NetworkClient&);
+ Network m_network;
+ std::queue <Packet> m_received;
+ std::queue <Packet> m_toSend;
+};
+