2014-01-13 12:44:33 +01:00
|
|
|
/////////////////////////////////////////
|
|
|
|
// 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
|
|
|
|
|
2014-02-17 08:53:15 +01:00
|
|
|
#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
|
|
|
{
|
2014-02-17 08:53:15 +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()
|
2014-02-17 08:53:15 +01:00
|
|
|
: serverName(L"Game Server")
|
2014-02-09 16:42:26 +01:00
|
|
|
, listenPort(15152)
|
2014-01-30 00:19:00 +01:00
|
|
|
{};
|
|
|
|
};
|
|
|
|
struct GameServerInfo
|
|
|
|
{
|
2014-02-17 08:53:15 +01:00
|
|
|
int listenPort;
|
|
|
|
wchar_t serverIp[255];
|
2014-01-28 09:00:02 +01:00
|
|
|
};
|
2014-02-17 08:53:15 +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();
|
2014-02-04 16:07:10 +01:00
|
|
|
static bool ServerIsRunning();
|
2014-02-17 08:53:15 +01:00
|
|
|
static void NotifyWhenClientConnect(ClientConnectedNotify func);
|
|
|
|
static void NotifyWhenClientDisconnect(ClientDisconnectedNotify func);
|
2014-01-30 00:19:00 +01:00
|
|
|
|
2014-02-18 11:34:24 +01:00
|
|
|
static void GameSetGameTime(const int& val);
|
2014-01-30 00:19:00 +01:00
|
|
|
static void GameSetMaxClients(const int& val);
|
2014-02-18 11:34:24 +01:00
|
|
|
static void GameSetGameName(const wchar_t* val);
|
|
|
|
static void GameSetMapName(const wchar_t* val);
|
2014-02-17 08:53:15 +01:00
|
|
|
static void GameSetGameMode(const wchar_t* val);
|
2014-02-18 11:34:24 +01:00
|
|
|
|
2014-01-30 00:19:00 +01:00
|
|
|
static int GameGetGameTime();
|
2014-02-18 11:34:24 +01:00
|
|
|
static int GameGetMaxClients();
|
|
|
|
static const wchar_t* GameGetGameMode();
|
|
|
|
static const wchar_t* GameGetGameName();
|
|
|
|
static const wchar_t* GameGetMapName();
|
|
|
|
|
2014-01-30 00:19:00 +01:00
|
|
|
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
|