2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
#define NOMINMAX
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <vld.h>
|
|
|
|
|
|
|
|
#include "DanBiasGame.h"
|
2014-01-29 10:18:01 +01:00
|
|
|
#include <GameServerAPI.h>
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
|
|
void ServerFnc()
|
|
|
|
{
|
2014-01-29 10:18:01 +01:00
|
|
|
DanBias::GameServerAPI::GameInitDesc desc;
|
|
|
|
desc.listenPort = 15151;
|
|
|
|
if( DanBias::GameServerAPI::Create(desc) == DanBias::DanBiasServerReturn_Sucess)
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-01-29 10:18:01 +01:00
|
|
|
DanBias::GameServerAPI::Start();
|
|
|
|
DanBias::GameServerAPI::Terminate();
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
|
|
|
Sleep(100);
|
|
|
|
}
|
|
|
|
void ClientFnc()
|
|
|
|
{
|
|
|
|
// Game client starter code goes here
|
|
|
|
DanBias::DanBiasGameDesc gameDesc;
|
|
|
|
gameDesc.port = 15151;
|
|
|
|
//gameDesc.port = 15152;
|
|
|
|
//gameDesc.IP = "193.11.184.196";
|
|
|
|
//gameDesc.IP = "193.11.184.31";
|
|
|
|
//gameDesc.IP = "194.47.150.56";
|
|
|
|
gameDesc.IP = "127.0.0.1";
|
2014-01-28 09:00:02 +01:00
|
|
|
//gameDesc.IP = "194.47.150.184";
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Sucess)
|
|
|
|
{
|
|
|
|
DanBias::DanBiasGame::Run();
|
|
|
|
DanBias::DanBiasGame::Release();
|
|
|
|
}
|
|
|
|
Sleep(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
|
|
|
|
{
|
|
|
|
std::thread serverThread;
|
|
|
|
std::thread clientThread;
|
|
|
|
|
|
|
|
if(SetDllDirectory(L"..\\DLL") == FALSE)
|
|
|
|
{
|
|
|
|
return cmdShow;
|
|
|
|
}
|
|
|
|
|
|
|
|
serverThread = std::thread(ServerFnc);
|
|
|
|
|
2014-01-22 15:22:52 +01:00
|
|
|
Sleep(200);
|
2014-01-21 09:52:48 +01:00
|
|
|
|
|
|
|
clientThread = std::thread(ClientFnc);
|
|
|
|
|
|
|
|
if (serverThread.joinable()) serverThread.join();
|
|
|
|
if (clientThread.joinable()) clientThread.join();
|
|
|
|
|
|
|
|
return cmdShow;
|
|
|
|
}
|