This commit is contained in:
2025-04-13 19:51:28 -05:00
parent aa5d859f4a
commit 80d15e7f48
7 changed files with 92 additions and 37 deletions

View File

@@ -0,0 +1,21 @@
#include "ClientModule.h"
ClientModule::ClientModule(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
name = "ClientModule";
}
ClientModule::~ClientModule() {
GameNetworkingSockets_Kill();
}
void ClientModule::onLoad() {
SteamDatagramErrMsg errMsg;
if ( !GameNetworkingSockets_Init( nullptr, errMsg ) ) {
//FatalError( "GameNetworkingSockets_Init failed. %s", errMsg );
std::cerr << "GameNetworkingSockets_Init() Failed: " << errMsg << std::endl;
}
//g_logTimeZero = SteamNetworkingUtils()->GetLocalTimestamp();
//SteamNetworkingUtils()->SetDebugOutputFunction( k_ESteamNetworkingSocketsDebugOutputType_Msg, DebugOutput );
}

View File

@@ -0,0 +1,24 @@
#include "Archimedes.h"
#include <steam/steamnetworkingsockets.h>
#include <steam/isteamnetworkingutils.h>
class ClientModule : public Archimedes::Module {
public:
ClientModule(Archimedes::App*, void*);
~ClientModule();
void onLoad();
void run();
void startClient(std::string);
void startServer(unsigned int);
private:
};
#ifdef CLIENTMODULE_DYNAMIC
#define MODULE_TYPE ClientModule
#include "endModule.h"
#endif

View File

@@ -1,17 +0,0 @@
#include "NetworkingModule.h"
NetworkingModule::NetworkingModule(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
name = "NetworkingModule";
}
NetworkingModule::~NetworkingModule() {
}
void NetworkingModule::onLoad() {
}
void NetworkingModule::run() {
}

View File

@@ -1,18 +0,0 @@
#include "Archimedes.h"
#include <steam/steamnetworkingsockets.h>
#include <steam/isteamnetworkingutils.h>
class NetworkingModule : public Archimedes::Module {
public:
NetworkingModule(Archimedes::App*, void*);
~NetworkingModule();
void run();
void onLoad();
};
#ifdef NETWORKINGMODULE_DYNAMIC
#define MODULE_TYPE NetworkingModule
#include "endModule.h"
#endif

View File

@@ -0,0 +1,21 @@
#include "ServerModule.h"
ServerModule::ServerModule(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
name = "ServerModule";
}
ServerModule::~ServerModule() {
GameNetworkingSockets_Kill();
}
void ServerModule::onLoad() {
SteamDatagramErrMsg errMsg;
if ( !GameNetworkingSockets_Init( nullptr, errMsg ) ) {
//FatalError( "GameNetworkingSockets_Init failed. %s", errMsg );
std::cerr << "GameNetworkingSockets_Init() Failed: " << errMsg << std::endl;
}
//g_logTimeZero = SteamNetworkingUtils()->GetLocalTimestamp();
//SteamNetworkingUtils()->SetDebugOutputFunction( k_ESteamNetworkingSocketsDebugOutputType_Msg, DebugOutput );
}

View File

@@ -0,0 +1,24 @@
#include "Archimedes.h"
#include <steam/steamnetworkingsockets.h>
#include <steam/isteamnetworkingutils.h>
class ServerModule : public Archimedes::Module {
public:
ServerModule(Archimedes::App*, void*);
~ServerModule();
void onLoad();
void run();
void startClient(std::string);
void startServer(unsigned int);
private:
};
#ifdef SERVERMODULE_DYNAMIC
#define MODULE_TYPE ServerModule
#include "endModule.h"
#endif