#pragma once #include "stdafx.h" #include #include "GameServerConnection.h" #include "INotificationListener.h" #include "IInputProvider.h" #include "IInputRecorder.h" using std::thread; class GameServer : public IInputRecorder, public IInputProvider { private: static unique_ptr Instance; unique_ptr _serverThread; atomic _stop; unique_ptr _listener; uint16_t _port; list> _openConnections; bool _initialized = false; string _hostPlayerName; uint8_t _hostControllerPort; void AcceptConnections(); void UpdateConnections(); void Exec(); void Stop(); public: GameServer(uint16_t port, string hostPlayerName); ~GameServer(); static void StartServer(uint16_t port, string hostPlayerName); static void StopServer(); static bool Started(); static string GetHostPlayerName(); static uint8_t GetHostControllerPort(); static void SetHostControllerPort(uint8_t port); static uint8_t GetAvailableControllers(); static vector GetPlayerList(); static void SendPlayerList(); static list> GetConnectionList(); bool SetInput(BaseControlDevice *device) override; void RecordInput(vector> devices) override; };