Danbias/Code/Game/GameServer/GameServerAPI.h

75 lines
2.0 KiB
C
Raw Normal View History

/////////////////////////////////////////
// Created by [Dennis Andersen] [2013] //
/////////////////////////////////////////
2013-12-03 12:07:37 +01:00
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
#define DANBIAS_SERVER_DANBIAS_SERVER_H
#include <vld.h>
2013-12-13 23:47:16 +01:00
2013-12-12 09:33:59 +01:00
#define DANBIAS_SERVER
2013-12-03 12:07:37 +01:00
2013-12-12 09:33:59 +01:00
#ifdef DANBIAS_SERVER_DLL_EXPORT
2013-12-03 12:07:37 +01:00
#define DANBIAS_SERVER_DLL __declspec(dllexport)
#else
#define DANBIAS_SERVER_DLL __declspec(dllimport)
#endif
namespace DanBias
{
2013-12-12 09:33:59 +01:00
enum DanBiasServerReturn
2013-12-03 12:07:37 +01:00
{
2013-12-12 09:33:59 +01:00
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
2014-01-29 10:18:01 +01:00
DanBiasServerReturn_GameNotCreated,
2013-12-12 09:33:59 +01:00
};
2013-12-03 12:07:37 +01:00
2013-12-12 09:33:59 +01:00
extern "C"
{
2014-01-28 09:00:02 +01:00
class DANBIAS_SERVER_DLL GameServerAPI
2013-12-03 12:07:37 +01:00
{
public:
2014-01-30 00:19:00 +01:00
struct ServerInitDesc
2014-01-28 09:00:02 +01:00
{
const wchar_t* serverName;
2014-01-29 10:18:01 +01:00
int listenPort;
2014-01-30 00:19:00 +01:00
ServerInitDesc()
: serverName(L"Game Server")
, listenPort(15152)
2014-01-30 00:19:00 +01:00
{};
};
struct GameServerInfo
{
int listenPort;
wchar_t serverIp[255];
2014-01-28 09:00:02 +01:00
};
typedef void(*ClientConnectedNotify)(int ID, wchar_t clientAlias[255], wchar_t clientIp[255]);
typedef void(*ClientDisconnectedNotify)(int ID);
2014-01-29 10:18:01 +01:00
2014-01-28 09:00:02 +01:00
public:
2014-01-30 00:19:00 +01:00
static DanBiasServerReturn ServerInitiate(const ServerInitDesc& desc);
static void ServerStart();
static void ServerStop();
static void ServerUpdate();
static GameServerInfo ServerGetInfo();
static bool ServerIsRunning();
static void NotifyWhenClientConnect(ClientConnectedNotify func);
static void NotifyWhenClientDisconnect(ClientDisconnectedNotify func);
2014-01-30 00:19:00 +01:00
static void GameSetMapName(const wchar_t* val);
2014-01-30 00:19:00 +01:00
static void GameSetMaxClients(const int& val);
static void GameSetGameMode(const wchar_t* val);
2014-01-30 00:19:00 +01:00
static void GameSetGameTime(const int& val);
static int GameGetMapId();
static int GameGetMaxClients();
static int GameGetGameMode();
static int GameGetGameTime();
static const char* GameGetGameName();
static bool GameStart();
2014-01-29 10:18:01 +01:00
2013-12-12 09:33:59 +01:00
};//End class DanBiasServer
2013-12-03 12:07:37 +01:00
}//End Extern "C"
} //End namspace DanBias
#endif // !DANBIAS_SERVER_DANBIAS_SERVER_H