work on ClientModule, add ChatServer
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#ifndef SERVERMODULE_H
|
||||
#define SERVERMODULE_H
|
||||
|
||||
#include "Archimedes.h"
|
||||
|
||||
#include <steam/steamnetworkingsockets.h>
|
||||
@@ -9,6 +12,9 @@ class ServerModule : public Archimedes::Module {
|
||||
|
||||
public:
|
||||
ServerModule(Archimedes::App*, void*);
|
||||
|
||||
ServerModule() { name = "ServerModule"; }
|
||||
|
||||
~ServerModule();
|
||||
void onLoad();
|
||||
bool onEvent(const Archimedes::Event&);
|
||||
@@ -26,7 +32,11 @@ class ServerModule : public Archimedes::Module {
|
||||
|
||||
void shouldHandleEvents(unsigned int events) { eventsToHandle = events; }
|
||||
|
||||
void sendData() {}
|
||||
void sendReliable(HSteamNetConnection client, const void* data, uint32 byteCount) {
|
||||
interface->SendMessageToConnection(client, data, byteCount, k_nSteamNetworkingSend_Reliable, nullptr);
|
||||
|
||||
}
|
||||
|
||||
void pollIncomingData();
|
||||
|
||||
private:
|
||||
@@ -48,16 +58,21 @@ class ServerModule : public Archimedes::Module {
|
||||
callbackInstance->OnSteamNetConnectionStatusChanged( pInfo );
|
||||
}
|
||||
|
||||
void OnSteamNetConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t *pInfo );
|
||||
|
||||
void OnSteamNetConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t *pInfo ) {
|
||||
app->emitEvent(new SMEvent::ConnectionStatusChangedEvent(pInfo));
|
||||
}
|
||||
|
||||
std::map<HSteamNetConnection, unsigned int> clients;
|
||||
|
||||
void PollConnectionStateChanges();
|
||||
void PollLocalUserInput();
|
||||
void PollConnectionStateChanges() {
|
||||
callbackInstance = this;
|
||||
interface->RunCallbacks();
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef SERVERMODULE_DYNAMIC
|
||||
#define MODULE_TYPE ServerModule
|
||||
#include "endModule.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user