Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
Erik Persson 2013-12-16 10:04:27 +01:00
commit 77bc6050fc
37 changed files with 444 additions and 107 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Bin/DLL/NetworkAPI_x64.pdb Normal file

Binary file not shown.

BIN
Bin/DLL/NetworkAPI_x64D.pdb Normal file

Binary file not shown.

BIN
Bin/DLL/NetworkAPI_x86.pdb Normal file

Binary file not shown.

BIN
Bin/DLL/NetworkAPI_x86D.pdb Normal file

Binary file not shown.

View File

@ -196,6 +196,7 @@ Global
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32

View File

@ -192,26 +192,26 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GameClientState\Obj\C_UIobject.cpp" />
<ClCompile Include="GameClientState\C_obj\C_DynamicObj.cpp" />
<ClCompile Include="GameClientState\C_obj\C_Player.cpp" />
<ClCompile Include="GameClientState\C_obj\C_StaticObj.cpp" />
<ClCompile Include="GameClientState\C_obj\C_UIobject.cpp" />
<ClCompile Include="DanBiasGame_Impl.cpp" />
<ClCompile Include="DLLMain.cpp" />
<ClCompile Include="GameClientState\Obj\C_DynamicObj.cpp" />
<ClCompile Include="GameClientState\GameClientState.cpp" />
<ClCompile Include="GameClientState\GameState.cpp" />
<ClCompile Include="GameClientState\LobbyState.cpp" />
<ClCompile Include="GameClientState\Obj\C_Player.cpp" />
<ClCompile Include="GameClientState\Obj\C_StaticObj.cpp" />
<ClCompile Include="GameClientState\C_Object.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameClientState\Obj\C_UIobject.h" />
<ClInclude Include="GameClientState\Obj\C_DynamicObj.h" />
<ClInclude Include="GameClientState\C_obj\C_DynamicObj.h" />
<ClInclude Include="GameClientState\C_obj\C_Player.h" />
<ClInclude Include="GameClientState\C_obj\C_StaticObj.h" />
<ClInclude Include="GameClientState\C_obj\C_UIobject.h" />
<ClInclude Include="GameClientState\GameClientState.h" />
<ClInclude Include="GameClientState\GameState.h" />
<ClInclude Include="Include\DanBiasGame.h" />
<ClInclude Include="GameClientState\LobbyState.h" />
<ClInclude Include="GameClientState\Obj\C_Player.h" />
<ClInclude Include="GameClientState\Obj\C_StaticObj.h" />
<ClInclude Include="GameClientState\C_Object.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -30,41 +30,39 @@ namespace DanBias
void ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& p) override
{
int pType = p[0].value.netInt;
Client::GameClientState::ProtocolStruct* protocol;
switch (pType)
{
case protocol_PlayerNavigation:
int pType = p[0].value.netInt;
Client::GameClientState::ProtocolStruct* protocolData;
switch (pType)
{
case protocol_PlayerNavigation:
break;
case protocol_PlayerPosition:
protocol = new Client::GameClientState::PlayerPos;
for(int i = 0; i< 3; i++)
{
((Client::GameClientState::PlayerPos*)protocol)->playerPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocol);
delete protocol;
protocol = NULL;
break;
break;
case protocol_PlayerPosition:
protocolData = new Client::GameClientState::PlayerPos;
for(int i = 0; i< 3; i++)
{
((Client::GameClientState::PlayerPos*)protocolData)->playerPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocolData);
delete protocolData;
protocolData = NULL;
break;
case protocol_ObjectPosition:
protocol = new Client::GameClientState::ObjPos;
for(int i = 0; i< 16; i++)
{
((Client::GameClientState::ObjPos*)protocol)->worldPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocol);
delete protocol;
protocol = NULL;
break;
default:
break;
}
case protocol_ObjectPosition:
protocolData = new Client::GameClientState::ObjPos;
for(int i = 0; i< 16; i++)
{
((Client::GameClientState::ObjPos*)protocolData)->worldPos[i] = p[i].value.netFloat;
}
gameClientState->Protocol(protocolData);
delete protocolData;
protocolData = NULL;
break;
default:
break;
}
}
};
class DanBiasGamePrivateData
@ -112,12 +110,18 @@ namespace DanBias
prevTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
// Start in lobby state
m_data->gameClientState = new Client::LobbyState();
m_data->gameClientState->Init();
m_data->r = new MyRecieverObject;
m_data->r->nwClient = new Oyster::Network::NetworkClient();
m_data->r->nwClient->Connect(desc.port, desc.IP);
if (!m_data->r->nwClient->IsConnected())
{
// failed to connect
return DanBiasClientReturn_Error;
}
// Start in lobby state
m_data->gameClientState = new Client::LobbyState();
m_data->gameClientState->Init(m_data->r->nwClient);
return DanBiasClientReturn_Sucess;
}
@ -253,7 +257,7 @@ namespace DanBias
return E_FAIL;
break;
}
m_data->gameClientState->Init(); // send game client
m_data->gameClientState->Init(m_data->r->nwClient); // send game client
}
return S_OK;

View File

@ -0,0 +1,42 @@
#include "C_DynamicObj.h"
#include "DllInterfaces/GFXAPI.h"
using namespace DanBias::Client;
struct C_DynamicObj::myData
{
myData(){}
Oyster::Graphics::Model::Model *model;
// light
// sound
// effect
}privData;
C_DynamicObj::C_DynamicObj(void)
{
}
C_DynamicObj::~C_DynamicObj(void)
{
}
void C_DynamicObj::Init(ModelInitData modelInit)
{
// load models
privData = new myData();
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
privData->model->WorldMatrix = modelInit.world;
privData->model->Visible = modelInit.visible;
}
void C_DynamicObj::setPos()
{
}
void C_DynamicObj::Render()
{
Oyster::Graphics::API::RenderModel(*(privData->model));
}
void C_DynamicObj::Release()
{
Oyster::Graphics::API::DeleteModel(privData->model);
delete privData;
}

View File

@ -0,0 +1,22 @@
#ifndef DANBIAS_CLIENT_CDYNAMICOBJECT_H
#define DANBIAS_CLIENT_CDYNAMICOBJECT_H
#include "../C_Object.h"
namespace DanBias
{
namespace Client
{
class C_DynamicObj : public C_Object
{
private:
struct myData;
myData* privData;
public:
C_DynamicObj(void);
virtual ~C_DynamicObj(void);
void Init(ModelInitData modelInit);
void setPos();
void Render();
void Release();
};};};
#endif

View File

@ -0,0 +1,46 @@
#include "C_Player.h"
#include "DllInterfaces/GFXAPI.h"
using namespace DanBias::Client;
struct C_Player::myData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
Oyster::Graphics::Model::Model *model;
}privData;
C_Player::C_Player(void)
{
}
C_Player::~C_Player(void)
{
}
void C_Player::Init(ModelInitData modelInit)
{
// load models
privData = new myData();
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
privData->model->WorldMatrix = modelInit.world;
privData->model->Visible = modelInit.visible;
}
void C_Player::setPos()
{
}
void C_Player::Render()
{
Oyster::Graphics::API::RenderModel(*(privData->model));
}
void C_Player::Release()
{
Oyster::Graphics::API::DeleteModel(privData->model);
delete privData;
}

View File

@ -0,0 +1,25 @@
#ifndef DANBIAS_CLIENT_CPLAYER_H
#define DANBIAS_CLIENT_CPLAYER_H
#include "../C_Object.h"
namespace DanBias
{
namespace Client
{
class C_Player : public C_Object
{
private:
struct myData;
myData* privData;
//Oyster::Graphics:: LIght
public:
C_Player(void);
~C_Player(void);
void Init(ModelInitData modelInit);
void setPos();
void Render();
void Release();
};};};
#endif

View File

@ -0,0 +1,45 @@
#include "C_StaticObj.h"
#include "DllInterfaces/GFXAPI.h"
using namespace DanBias::Client;
struct C_StaticObj::myData
{
myData(){}
Oyster::Graphics::Model::Model *model;
// light
// sound
// effect
}privData;
C_StaticObj::C_StaticObj(void)
{
}
C_StaticObj::~C_StaticObj(void)
{
}
void C_StaticObj::Init(ModelInitData modelInit)
{
// load models
privData = new myData();
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
privData->model->WorldMatrix = modelInit.world;
privData->model->Visible = modelInit.visible;
}
void C_StaticObj::setPos()
{
}
void C_StaticObj::Render()
{
Oyster::Graphics::API::RenderModel(*(privData->model));
}
void C_StaticObj::Release()
{
Oyster::Graphics::API::DeleteModel(privData->model);
delete privData;
}

View File

@ -0,0 +1,22 @@
#ifndef DANBIAS_CLIENT_CSTATICOBJECT_H
#define DANBIAS_CLIENT_CSTATICOBJECT_H
#include "../C_Object.h"
namespace DanBias
{
namespace Client
{
class C_StaticObj : public C_Object
{
private:
struct myData;
myData* privData;
public:
C_StaticObj(void);
virtual ~C_StaticObj(void);
void Init(ModelInitData modelInit);
void setPos();
void Render();
void Release();
};};};
#endif

View File

@ -0,0 +1,43 @@
#include "C_UIobject.h"
#include "DllInterfaces/GFXAPI.h"
using namespace DanBias::Client;
struct C_UIobject::myData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
Oyster::Graphics::Model::Model *model;
}privData;
C_UIobject::C_UIobject(void)
{
}
C_UIobject::~C_UIobject(void)
{
}
void C_UIobject::Init(ModelInitData modelInit)
{
// load models
privData = new myData();
privData->model = Oyster::Graphics::API::CreateModel(modelInit.modelPath);
privData->model->WorldMatrix = modelInit.world;
privData->model->Visible = modelInit.visible;
}
void C_UIobject::setPos()
{
}
void C_UIobject::Render()
{
Oyster::Graphics::API::RenderModel(*(privData->model));
}
void C_UIobject::Release()
{
Oyster::Graphics::API::DeleteModel(privData->model);
delete privData;
}

View File

@ -0,0 +1,22 @@
#ifndef DANBIAS_CLIENT_CUIOBJECT_H
#define DANBIAS_CLIENT_CUIOBJECT_H
#include "../C_Object.h"
namespace DanBias
{
namespace Client
{
class C_UIobject : public C_Object
{
private:
struct myData;
myData* privData;
public:
C_UIobject(void);
virtual ~C_UIobject(void);
void Init(ModelInitData modelInit);
void setPos();
void Render();
void Release();
};};};
#endif

View File

@ -3,6 +3,7 @@
#define NOMINMAX
#include "L_inputClass.h"
#include "NetworkClient.h"
namespace DanBias
{
@ -42,7 +43,7 @@ public:
public:
GameClientState(void);
virtual ~GameClientState(void);
virtual bool Init() = 0;
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
virtual bool Render() = 0;
virtual bool Release() = 0;

View File

@ -1,7 +1,7 @@
#include "GameState.h"
#include "DllInterfaces/GFXAPI.h"
#include "Obj/C_Player.h"
#include "Obj/C_DynamicObj.h"
#include "C_obj/C_Player.h"
#include "C_obj/C_DynamicObj.h"
#include "NetworkClient.h"
#include "PlayerProtocols.h"
@ -28,11 +28,12 @@ GameState::~GameState(void)
{
}
bool GameState::Init()
bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
{
// load models
privData = new myData();
privData->state = gameStateState_loading;
privData->nwClient = nwClient;
privData->state = LoadGame();
return true;
}
@ -92,12 +93,37 @@ GameClientState::ClientState GameState::Update(float deltaTime, InputClass* KeyI
// update objects
// Client.send(obj);
{
GameLogic::Protocol_PlayerMovement movePlayer;
//privData->nwClient->Send(movePlayer);
GameLogic::Protocol_PlayerMovement movePlayer;
movePlayer.bForward = false;
movePlayer.bBackward = false;
movePlayer.bStrafeLeft = false;
movePlayer.bStrafeRight = false;
movePlayer.bTurnLeft = false;
movePlayer.bTurnRight = false;
if(KeyInput->IsKeyPressed(DIK_L))
privData->state = GameState::gameStateState_end;
if(KeyInput->IsKeyPressed(DIK_W))
{
movePlayer.bForward = true;
}
if(KeyInput->IsKeyPressed(DIK_S))
{
movePlayer.bBackward = true;
}
if(KeyInput->IsKeyPressed(DIK_A))
{
movePlayer.bStrafeLeft = true;
}
if(KeyInput->IsKeyPressed(DIK_D))
{
movePlayer.bStrafeRight = true;
}
privData->nwClient->Send(movePlayer);
if(KeyInput->IsKeyPressed(DIK_L))
privData->state = GameState::gameStateState_end;
}
break;
case gameStateState_end:

View File

@ -22,7 +22,7 @@ private:
public:
GameState(void);
~GameState(void);
bool Init();
bool Init(Oyster::Network::NetworkClient* nwClient);
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override;
bool LoadModels(std::wstring mapFile) ;
bool InitCamera(Oyster::Math::Float3 startPos) ;

View File

@ -1,9 +1,9 @@
#include "LobbyState.h"
#include "DllInterfaces/GFXAPI.h"
#include "OysterMath.h"
#include "Obj/C_Player.h"
#include "Obj/C_StaticObj.h"
#include "Obj/C_DynamicObj.h"
#include "C_obj/C_Player.h"
#include "C_obj/C_StaticObj.h"
#include "C_obj/C_DynamicObj.h"
using namespace DanBias::Client;
@ -28,7 +28,7 @@ LobbyState::~LobbyState(void)
}
bool LobbyState::Init()
bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient)
{
privData = new myData();

View File

@ -17,7 +17,7 @@ private:
public:
LobbyState(void);
~LobbyState(void);
bool Init();
bool Init(Oyster::Network::NetworkClient* nwClient);
bool LoadModels(std::wstring file);
bool InitCamera(Oyster::Math::Float3 startPos);
ClientState Update(float deltaTime, InputClass* KeyInput);

View File

@ -1,7 +1,7 @@
#ifndef DANBIASGAME_DANBIASGAME_H
#define DANBIASGAME_DANBIASGAME_H
#define DANBIAS_CLIENT_L
#define DANBIAS_CLIENT
#if defined (DANBIAS_GAME_DLL_EXPORT)
#define DANBIAS_GAME_DLL __declspec(dllexport)
@ -29,6 +29,7 @@ namespace DanBias
{
//Stuff goes here...
int port;
const char* IP;
HINSTANCE hinst;
int nCmdShow;

View File

@ -22,7 +22,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
DanBias::DanBiasServerAPI::Run();
DanBias::DanBiasServerAPI::Release();
}
#elif defined(DANBIAS_CLIENT_L)
#elif defined(DANBIAS_CLIENT)
if(SetDllDirectory(L"..\\DLL") == FALSE)
{
return cmdShow;
@ -30,6 +30,7 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
// Game client starter code goes here
DanBias::DanBiasGameDesc gameDesc;
gameDesc.port = 1;
gameDesc.IP = "10.1010.303";
gameDesc.hinst = hinst;
gameDesc.nCmdShow = cmdShow;

View File

@ -18,25 +18,26 @@ namespace DanBias
void MainLobby::Frame()
{
if(!this->box.IsEmpty())
{
NetEvent &e = this->box.Fetch();
ParseEvent(e);
}
ParseEvents();
}
//////// Private
void MainLobby::ParseEvent(NetEvent& e)
void MainLobby::ParseEvents()
{
static const short i = MAXSHORT;
if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return;
short f = e.protocol[0].value.netShort;
switch (f)
if(!this->box.IsEmpty())
{
default:
break;
NetEvent &e = this->box.Fetch();
if(e.protocol[0].type != Oyster::Network::NetAttributeType_Short) return;
short f = e.protocol[0].value.netShort;
switch (f)
{
default:
break;
}
}
}

View File

@ -15,7 +15,7 @@ namespace DanBias
void Frame();
private:
void ParseEvent(NetEvent& e);
void ParseEvents();
};
}//End namespace DanBias

View File

@ -25,7 +25,7 @@ namespace GameLogic
Protocol_PlayerMovement()
{
this->protocol[0].value = ProtocolID = protocol_PlayerNavigation;
this->protocol[0].value = ProtocolID = protocol_Gamplay_PlayerNavigation;
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
this->protocol[1].type = Oyster::Network::NetAttributeType_Bool;
@ -58,7 +58,7 @@ namespace GameLogic
Protocol_PlayerPosition()
{
this->protocol[0].value = protocol_PlayerPosition;
this->protocol[0].value = protocol_Gamplay_PlayerPosition;
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
this->protocol[1].type = Oyster::Network::NetAttributeType_Float;

View File

@ -7,15 +7,15 @@
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
#define protocol_PlayerNavigation 0
#define protocol_PlayerPosition 1
#define protocol_ObjectPosition 2
#define protocol_Gamplay_PlayerNavigation 0
#define protocol_Gamplay_PlayerPosition 1
#define protocol_Gamplay_ObjectPosition 2
#define protocol_Lobby_Msg 60
#define protocol_Lobby_Msg 100
#define protocol_General_Disconnect 100
#define protocol_General_Ping 101
#define protocol_General_Disconnect 200
#define protocol_General_Ping 201
#define PROTOCOL_TEST 1000
#define PROTOCOL_TEST 1000
#endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H

View File

@ -54,7 +54,7 @@ namespace Oyster
template <class T>
bool PostBox<T>::IsEmpty()
{
return !messages.IsEmpty();
return messages.IsEmpty();
}
}

View File

@ -49,6 +49,7 @@ struct ClientDataContainer
callbackType = NetworkProtocolCallbackType_Unknown;
sendPostBox = new PostBox<CustomNetProtocol>();
connection.SetBlockingMode(false);
connection.InitiateClient();
}
ClientDataContainer(IThreadObject* o, unsigned int socket )
:connection(socket), ID(currID++)
@ -56,6 +57,7 @@ struct ClientDataContainer
InitWinSock();
callbackType = NetworkProtocolCallbackType_Unknown;
sendPostBox = new PostBox<CustomNetProtocol>();
connection.InitiateClient();
connection.SetBlockingMode(false);
}
~ClientDataContainer()

View File

@ -177,6 +177,7 @@ int Connection::SetBlockingMode(bool blocking)
return WSAGetLastError();
}
//Success
return 0;
}

View File

@ -84,7 +84,7 @@ int ThreadedClient::Recv()
{
int errorCode = -1;
SmartPointer<OysterByte> temp = new OysterByte;
OysterByte temp;
errorCode = this->connection->Recieve(temp);
if(errorCode == 0)

View File

@ -18,9 +18,6 @@ using namespace Oyster::Network;
using namespace Utility;
using namespace Utility::DynamicMemory;
void chat(ThreadedClient &client);
void PrintOutMessage(ProtocolSet* set);
void proc(CustomNetProtocol& protocol)
{
@ -44,11 +41,14 @@ int main()
errorCode = client.Connect(15151, "127.0.0.1");
client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
if(errorCode != 0)
if(errorCode != 1)
{
wstring errorTest = GetErrorMessage(errorCode);
wcout << "errorMessage: " << errorTest << endl;
printf("%d", errorCode);
cout << "FAILED" << endl;
}
//client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
cout << "Done" << endl;
while(1)
{

View File

@ -70,28 +70,28 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;$(SolutionDir)..\Bin\DLL;C:\Program Files (x86)\Visual Leak Detector\lib\Win32</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;$(SolutionDir)..\Bin\DLL;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -116,6 +116,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -131,6 +132,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -146,6 +148,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -66,32 +66,32 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -104,6 +104,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>
</DelayLoadDLLs>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

View File

@ -2,16 +2,44 @@
#include <vector>
#include <vld.h>
#include "../NetworkDependencies/WinsockFunctions.h"
#include "../NetworkAPI/NetworkServer.h"
using namespace Oyster::Network;
using namespace std;
void proc(NetworkClient client)
{
cout << "Hej" << endl;
}
int main()
{
if(!InitWinSock())
NetworkServer server;
Oyster::Network::NetworkServer::INIT_DESC desc;
desc.port = 15151;
desc.callbackType = NetworkClientCallbackType_Function;
desc.recvObj = proc;
if(!server.Init(desc))
{
cout << "errorMessage: unable to start winsock" << endl;
cout << "Init failed" << endl;
return 0;
}
if(!server.Start())
{
cout << "Start failed" << endl;
return 0;
}
cout << "Server started" << endl;
while(1)
{
}
system("pause");
return 0;