-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.h
More file actions
36 lines (30 loc) · 1.08 KB
/
Client.h
File metadata and controls
36 lines (30 loc) · 1.08 KB
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
#ifndef CLIENT_H
#define CLIENT_H
#include <steam/steamnetworkingsockets.h>
#include <steam/isteamnetworkingutils.h>
#include <queue>
#include <string>
class Client
{
public:
void run(const SteamNetworkingIPAddr &serverAddress);
void sendMessageFromClient(std::string messageText);
bool reciveMessageFromClient(SteamNetworkingMessage_t **outMessage);
private:
HSteamNetConnection connection;
ISteamNetworkingSockets *sockets;
std::queue<ISteamNetworkingMessage> messageBuffer;
bool active = true;
void processLiveChat();
void pollConnectionChange();
void onConnectionStatusChanged(SteamNetConnectionStatusChangedCallback_t *info);
void pollMessages();
bool reciveMessage(ISteamNetworkingMessage *incommingMessage);
static Client *callbackInstance;
static void connectionStatusChangedCallback(SteamNetConnectionStatusChangedCallback_t *info)
{
callbackInstance -> onConnectionStatusChanged(info);
}
};
Client *Client::callbackInstance = nullptr;
#endif