Initial commit.
This commit is contained in:
commit
82b4f23c06
56 changed files with 3485 additions and 0 deletions
52
TestGame/main.cpp
Normal file
52
TestGame/main.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include <Client.h>
|
||||
#include <Server.h>
|
||||
#include <Network/Network.h>
|
||||
#include <Paths.h>
|
||||
|
||||
using namespace Artifact;
|
||||
|
||||
struct Args {
|
||||
bool server = false;
|
||||
std::string host = "";
|
||||
std::string port = "";
|
||||
};
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
Args args {};
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (strcmp(argv[i], "--server")) {
|
||||
args.server = true;
|
||||
} else if (strcmp(argv[i], "--host")) {
|
||||
args.host = argv[++i];
|
||||
} else if (strcmp(argv[i], "--port")) {
|
||||
args.port = argv[++i];
|
||||
}
|
||||
}
|
||||
|
||||
getDataPath();
|
||||
|
||||
Client client;
|
||||
|
||||
client.addDefaultSubsystems();
|
||||
|
||||
std::thread([&client]() {
|
||||
Server server;
|
||||
|
||||
server.addDefaultSubsystems();
|
||||
|
||||
auto serverListener = server.subsystem<NetworkServer>();
|
||||
auto clientConnection = client.subsystem<NetworkClient>();
|
||||
|
||||
serverListener->host(clientConnection);
|
||||
clientConnection->connect(serverListener);
|
||||
|
||||
server.run();
|
||||
}).detach();
|
||||
|
||||
client.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue