2014-07-06 19:54:47 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
2016-02-05 23:14:27 -05:00
|
|
|
#include <thread>
|
2014-07-09 19:05:07 -04:00
|
|
|
#include "INotificationListener.h"
|
2016-02-05 23:14:27 -05:00
|
|
|
using std::thread;
|
|
|
|
class Socket;
|
|
|
|
class GameClientConnection;
|
2015-07-01 23:17:14 -04:00
|
|
|
class ClientConnectionData;
|
|
|
|
|
2014-07-09 18:29:07 -04:00
|
|
|
class GameClient : public INotificationListener
|
2014-07-06 19:54:47 -04:00
|
|
|
{
|
|
|
|
private:
|
2014-07-09 18:29:07 -04:00
|
|
|
static unique_ptr<GameClient> Instance;
|
|
|
|
unique_ptr<thread> _clientThread;
|
|
|
|
atomic<bool> _stop;
|
|
|
|
|
2014-07-06 19:54:47 -04:00
|
|
|
shared_ptr<Socket> _socket;
|
|
|
|
unique_ptr<GameClientConnection> _connection;
|
|
|
|
bool _connected = false;
|
|
|
|
|
2015-07-01 23:17:14 -04:00
|
|
|
void PrivateConnect(shared_ptr<ClientConnectionData> connectionData);
|
2014-07-09 18:29:07 -04:00
|
|
|
void Exec();
|
2014-07-06 19:54:47 -04:00
|
|
|
|
2014-07-09 18:29:07 -04:00
|
|
|
public:
|
|
|
|
GameClient();
|
|
|
|
~GameClient();
|
2014-07-06 19:54:47 -04:00
|
|
|
|
2014-07-09 18:29:07 -04:00
|
|
|
static bool Connected();
|
2015-07-01 23:17:14 -04:00
|
|
|
static void Connect(shared_ptr<ClientConnectionData> connectionData);
|
2014-07-09 18:29:07 -04:00
|
|
|
static void Disconnect();
|
2014-07-06 19:54:47 -04:00
|
|
|
|
2016-02-06 15:33:45 -05:00
|
|
|
static void SelectController(uint8_t port);
|
|
|
|
static uint8_t GetControllerPort();
|
|
|
|
static uint8_t GetAvailableControllers();
|
|
|
|
|
2016-02-05 23:14:27 -05:00
|
|
|
static uint8_t GetControllerState(uint8_t port);
|
|
|
|
|
2015-12-26 17:11:00 -05:00
|
|
|
void ProcessNotification(ConsoleNotificationType type, void* parameter);
|
2014-07-09 18:29:07 -04:00
|
|
|
};
|