ServerEvents
This commit is contained in:
@@ -3,16 +3,44 @@
|
||||
#include <steam/steamnetworkingsockets.h>
|
||||
#include <steam/isteamnetworkingutils.h>
|
||||
|
||||
#include "ServerEvents.h"
|
||||
|
||||
class ServerModule : public Archimedes::Module {
|
||||
|
||||
public:
|
||||
ServerModule(Archimedes::App*, void*);
|
||||
~ServerModule();
|
||||
void onLoad();
|
||||
bool onEvent(const Archimedes::Event&);
|
||||
void run();
|
||||
|
||||
private:
|
||||
void startServer(int);
|
||||
void stopServer();
|
||||
|
||||
private:
|
||||
bool running = false;
|
||||
|
||||
int port = -1;
|
||||
|
||||
unsigned int numClients = 0;
|
||||
|
||||
HSteamListenSocket listenSock;
|
||||
HSteamNetPollGroup pollGroup;
|
||||
ISteamNetworkingSockets* interface;
|
||||
|
||||
inline static ServerModule *callbackInstance = nullptr;
|
||||
static void SteamNetConnectionStatusChangedCallback( SteamNetConnectionStatusChangedCallback_t *pInfo ) {
|
||||
callbackInstance->OnSteamNetConnectionStatusChanged( pInfo );
|
||||
}
|
||||
|
||||
void OnSteamNetConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t *pInfo );
|
||||
|
||||
|
||||
std::map<HSteamNetConnection, Client> clients;
|
||||
|
||||
void PollIncomingMessages();
|
||||
void PollConnectionStateChanges();
|
||||
void PollLocalUserInput();
|
||||
};
|
||||
|
||||
#ifdef SERVERMODULE_DYNAMIC
|
||||
|
||||
Reference in New Issue
Block a user