Lagt till alla funktion, inte en aning om det fungerar.
This commit is contained in:
parent
ff6a4a0d47
commit
4c4693e890
|
@ -0,0 +1,104 @@
|
|||
#include "C++StandaloneCLI.h"
|
||||
|
||||
CppStandaloneCLI::CppStandaloneCLI()
|
||||
{
|
||||
}
|
||||
|
||||
CppStandaloneCLI::~CppStandaloneCLI()
|
||||
{
|
||||
}
|
||||
|
||||
DanBiasServerReturn CppStandaloneCLI::ServerInitiate(ServerInitDesc desc)
|
||||
{
|
||||
DanBias::GameServerAPI::ServerInitDesc d;
|
||||
//Convert from String to char*
|
||||
IntPtr p = Marshal::StringToHGlobalAnsi(desc.serverName);
|
||||
d.serverName = static_cast<char*>(p.ToPointer());
|
||||
Marshal::FreeHGlobal(p);
|
||||
|
||||
d.listenPort = desc.listenPort;
|
||||
d.broadcast = desc.broadcast;
|
||||
|
||||
return (DanBiasServerReturn)DanBias::GameServerAPI::ServerInitiate(d);
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::ServerStart()
|
||||
{
|
||||
DanBias::GameServerAPI::ServerStart();
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::ServerStop()
|
||||
{
|
||||
DanBias::GameServerAPI::ServerStop();
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::ServerUpdate()
|
||||
{
|
||||
DanBias::GameServerAPI::ServerUpdate();
|
||||
}
|
||||
|
||||
GameServerInfo CppStandaloneCLI::ServerGetInfo()
|
||||
{
|
||||
GameServerInfo info;
|
||||
|
||||
DanBias::GameServerAPI::GameServerInfo i = DanBias::GameServerAPI::ServerGetInfo();
|
||||
info.listenPort = i.listenPort;
|
||||
info.serverIp = gcnew String(i.serverIp);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
bool CppStandaloneCLI::ServerIsRunning()
|
||||
{
|
||||
return DanBias::GameServerAPI::ServerIsRunning();
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::GameSetMapId(const int val)
|
||||
{
|
||||
DanBias::GameServerAPI::GameSetMapId(val);
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::GameSetMaxClients(const int val)
|
||||
{
|
||||
DanBias::GameServerAPI::GameSetMaxClients(val);
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::GameSetGameMode(const int val)
|
||||
{
|
||||
DanBias::GameServerAPI::GameSetGameMode(val);
|
||||
}
|
||||
|
||||
void CppStandaloneCLI::GameSetGameTime(const int val)
|
||||
{
|
||||
DanBias::GameServerAPI::GameSetGameTime(val);
|
||||
}
|
||||
|
||||
int CppStandaloneCLI::GameGetMapId()
|
||||
{
|
||||
return DanBias::GameServerAPI::GameGetMapId();
|
||||
}
|
||||
|
||||
int CppStandaloneCLI::GameGetMaxClients()
|
||||
{
|
||||
return DanBias::GameServerAPI::GameGetMaxClients();
|
||||
}
|
||||
|
||||
int CppStandaloneCLI::GameGetGameMode()
|
||||
{
|
||||
return DanBias::GameServerAPI::GameGetGameMode();
|
||||
}
|
||||
|
||||
int CppStandaloneCLI::GameGetGameTime()
|
||||
{
|
||||
return DanBias::GameServerAPI::GameGetGameTime();
|
||||
}
|
||||
|
||||
String^ CppStandaloneCLI::GameGetGameName()
|
||||
{
|
||||
return gcnew String(DanBias::GameServerAPI::GameGetGameName());
|
||||
}
|
||||
|
||||
bool CppStandaloneCLI::GameStart()
|
||||
{
|
||||
return DanBias::GameServerAPI::GameStart();
|
||||
}
|
|
@ -1,23 +1,67 @@
|
|||
#ifndef CLISTANDALONESERVER_C++_Standalone_CLI_H
|
||||
#define CLISTANDALONESERVER_C++_Standalone_CLI_H
|
||||
#ifndef CLISTANDALONESERVER_CPP_Standalone_CLI_H
|
||||
#define CLISTANDALONESERVER_CPP_Standalone_CLI_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "..\Game\GameServer\GameServerAPI.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Windows::Interop;
|
||||
using namespace System::Windows;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Collections::Generic;
|
||||
|
||||
struct ServerInitDesc
|
||||
enum DanBiasServerReturn
|
||||
{
|
||||
DanBiasServerReturn_Error,
|
||||
DanBiasServerReturn_Sucess,
|
||||
DanBiasServerReturn_GameNotCreated,
|
||||
};
|
||||
|
||||
public ref struct ServerInitDesc
|
||||
{
|
||||
String^ serverName;
|
||||
int listenPort;
|
||||
bool broadcast; //Not fully implemented!
|
||||
ServerInitDesc()
|
||||
{
|
||||
serverName = "Game Server";
|
||||
listenPort = 15152;
|
||||
broadcast = true;
|
||||
};
|
||||
};
|
||||
|
||||
public value struct GameServerInfo
|
||||
{
|
||||
unsigned int listenPort; // If set to 0, the default port 15151 will be used
|
||||
String^ serverIp; // This cant be mofidfied..
|
||||
};
|
||||
|
||||
public ref class CppStandaloneCLI
|
||||
{
|
||||
public:
|
||||
CppStandaloneCLI();
|
||||
~CppStandaloneCLI();
|
||||
|
||||
DanBiasServerReturn ServerInitiate(ServerInitDesc desc);
|
||||
void ServerStart();
|
||||
void ServerStop();
|
||||
void ServerUpdate();
|
||||
GameServerInfo ServerGetInfo();
|
||||
bool ServerIsRunning();
|
||||
|
||||
protected:
|
||||
DanBias::GameServerAPI* gameServer;
|
||||
|
||||
void GameSetMapId(const int val);
|
||||
void GameSetMaxClients(const int val);
|
||||
void GameSetGameMode(const int val);
|
||||
void GameSetGameTime(const int val);
|
||||
int GameGetMapId();
|
||||
int GameGetMaxClients();
|
||||
int GameGetGameMode();
|
||||
int GameGetGameTime();
|
||||
String^ GameGetGameName();
|
||||
bool GameStart();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -97,6 +97,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -142,6 +143,16 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AssemblyInfo.cpp" />
|
||||
<ClCompile Include="C++StandaloneCLI.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Game\GameServer\GameServer.vcxproj">
|
||||
<Project>{143bd516-20a1-4890-a3e4-f8bfd02220e7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
|
||||
#define DANBIAS_SERVER_DANBIAS_SERVER_H
|
||||
|
||||
#include <vld.h>
|
||||
//#include <vld.h>
|
||||
|
||||
#define DANBIAS_SERVER
|
||||
|
||||
|
|
Loading…
Reference in New Issue