GameServer - Merged with Standalone Server and modified some stuff, still compile errors, will try to merge with other

This commit is contained in:
Dennis Andersen 2014-02-16 01:12:03 +01:00
commit 21c640c6e1
66 changed files with 3219 additions and 1101 deletions

View File

@ -0,0 +1,38 @@
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("PhysicsGameCLIWrapper")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("Microsoft")];
[assembly:AssemblyProductAttribute("PhysicsGameCLIWrapper")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) Microsoft 2010")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

View File

@ -0,0 +1,107 @@
#include "C++StandaloneCLI.h"
using namespace System;
using namespace System::Runtime::InteropServices;
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();
}

View File

@ -0,0 +1,56 @@
#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"
enum DanBiasServerReturn
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
DanBiasServerReturn_GameNotCreated,
};
public value struct ServerInitDesc
{
System::String^ serverName;
int listenPort;
bool broadcast; //Not fully implemented!
};
public value struct GameServerInfo
{
unsigned int listenPort; // If set to 0, the default port 15151 will be used
System::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();
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();
System::String^ GameGetGameName();
bool GameStart();
};
#endif

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB}</ProjectGuid>
<RootNamespace>CLIStandaloneServer</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="C++StandaloneCLI.h" />
</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">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,7 @@
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Game\GameServer\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -95,7 +95,7 @@
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(SolutionDir)..\External\Lib\;$(SolutionDir)..\Bin\DLL;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network/NetworkAPI;$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Game\GameServer\</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -195,7 +195,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GameClientState\Camera_Basic.cpp" />
<ClCompile Include="GameClientState\Camera.cpp" />
<ClCompile Include="GameClientState\Camera_FPS.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" />
@ -209,16 +211,18 @@
<ClCompile Include="GameClientState\LevelLoader\LevelParser.cpp" />
<ClCompile Include="GameClientState\LevelLoader\Loader.cpp" />
<ClCompile Include="GameClientState\LevelLoader\ParseFunctions.cpp" />
<ClCompile Include="GameClientState\LobbyAdminState.cpp" />
<ClCompile Include="GameClientState\LobbyState.cpp" />
<ClCompile Include="GameClientState\C_Object.cpp" />
<ClCompile Include="GameClientState\LoginState.cpp" />
<ClCompile Include="GameClientState\MainState.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameClientRecieverFunc.h" />
<ClInclude Include="GameClientState\Camera_Basic.h" />
<ClInclude Include="GameClientState\Buttons\ButtonEllipse.h" />
<ClInclude Include="GameClientState\Buttons\EventButtonGUI.h" />
<ClInclude Include="GameClientState\Buttons\ButtonRectangle.h" />
<ClInclude Include="GameClientState\Camera.h" />
<ClInclude Include="GameClientState\Camera_FPS.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" />
@ -231,10 +235,12 @@
<ClInclude Include="GameClientState\LevelLoader\Loader.h" />
<ClInclude Include="GameClientState\LevelLoader\ObjectDefines.h" />
<ClInclude Include="GameClientState\LevelLoader\ParseFunctions.h" />
<ClInclude Include="GameClientState\LoginState.h" />
<ClInclude Include="GameClientState\LobbyAdminState.h" />
<ClInclude Include="GameClientState\MainState.h" />
<ClInclude Include="Include\DanBiasGame.h" />
<ClInclude Include="GameClientState\LobbyState.h" />
<ClInclude Include="GameClientState\C_Object.h" />
<ClInclude Include="GameClientState\Buttons\TextField.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -5,7 +5,8 @@
#include "GameClientState/GameClientState.h"
#include "GameClientState\GameState.h"
#include "GameClientState\LobbyState.h"
#include "GameClientState\LoginState.h"
#include "GameClientState\LobbyAdminState.h"
#include "GameClientState\MainState.h"
#include "GameClientState\LanMenuState.h"
#include <Protocols.h>
#include "NetworkClient.h"
@ -15,43 +16,41 @@
#include "L_inputClass.h"
#include "WinTimer.h"
#include "vld.h"
#include "GameClientRecieverFunc.h"
#include "../Misc/EventHandler/EventHandler.h"
using namespace Oyster::Event;
using namespace ::Oyster;
using namespace ::Oyster::Event;
using namespace ::Oyster::Network;
using namespace ::Utility::DynamicMemory;
void ClientEventFunction( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e );
namespace DanBias
{
#pragma region Game Data
class DanBiasGamePrivateData
{
public:
DanBiasGamePrivateData()
{
}
~DanBiasGamePrivateData()
{
}
public:
WindowShell* window;
InputClass* inputObj;
Utility::WinTimer timer;
GameRecieverObject* recieverObj;
UniquePointer<Client::GameClientState> state;
NetworkClient networkClient;
bool serverOwner;
float capFrame;
DanBiasGamePrivateData()
{
this->capFrame = 0;
}
} data;
#pragma endregion
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
float DanBiasGame::capFrame = 0;
//--------------------------------------------------------------------------------------
// Interface API functions
//--------------------------------------------------------------------------------------
@ -59,8 +58,8 @@ namespace DanBias
{
WindowShell::CreateConsoleWindow();
if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1024, 768), cPOINT())))
//if(! m_data->window->CreateWin(WindowShell::WINDOW_INIT_DESC()))
//if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT())))
if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC()))
return DanBiasClientReturn_Error;
if( FAILED( InitDirect3D() ) )
@ -69,42 +68,50 @@ namespace DanBias
if( FAILED( InitInput() ) )
return DanBiasClientReturn_Error;
m_data->recieverObj = new GameRecieverObject;
m_data->serverOwner = false;
data.serverOwner = false;
// Start in lobby state
m_data->recieverObj->gameClientState = new Client::LoginState();
if(!m_data->recieverObj->gameClientState->Init(m_data->recieverObj))
data.networkClient.SetMessagePump( ClientEventFunction );
// Start in main menu state
data.state = new Client::MainState();
if( !data.state->Init( &data.networkClient ) )
return DanBiasClientReturn_Error;
m_data->timer.reset();
return DanBiasClientReturn_Sucess;
data.timer.reset();
return DanBiasClientReturn_Success;
}
DanBiasClientReturn DanBiasGame::Run()
{
// Main message loop
while(m_data->window->Frame())
while(data.window->Frame())
{
float dt = (float)m_data->timer.getElapsedSeconds();
m_data->timer.reset();
float dt = (float)data.timer.getElapsedSeconds();
data.timer.reset();
if(m_data->recieverObj->IsConnected())
m_data->recieverObj->Update();
Graphics::API::Update( dt );
if(data.networkClient.IsConnected())
data.networkClient.Update();
capFrame += dt;
if(capFrame > 0.03)
data.capFrame += dt;
if(data.capFrame > 0.03)
{
Oyster::Graphics::API::Update(capFrame);
if(Update(capFrame) != S_OK)
switch( Update(dt) )
{
case Result_continue: break;
case Result_quit: return DanBiasClientReturn_Success;
case Result_error: return DanBiasClientReturn_Error;
default: break;
}
if(Render() != S_OK)
return DanBiasClientReturn_Error;
if(Render(capFrame) != S_OK)
return DanBiasClientReturn_Error;
capFrame = 0;
data.capFrame = 0;
}
}
return DanBiasClientReturn_Sucess;
return DanBiasClientReturn_Success;
}
void DanBiasGame::Release()
@ -117,11 +124,13 @@ namespace DanBias
//--------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitDirect3D()
{
Oyster::Graphics::API::Option p;
p.modelPath = L"..\\Content\\Models\\";
p.texturePath = L"..\\Content\\Textures\\";
Oyster::Graphics::API::SetOptions(p);
if(Oyster::Graphics::API::Init(m_data->window->GetHWND(), false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
if(Oyster::Graphics::API::Init(data.window->GetHWND(), false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
return E_FAIL;
return S_OK;
}
@ -131,8 +140,8 @@ namespace DanBias
//-------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitInput()
{
m_data->inputObj = new InputClass;
if(!m_data->inputObj->Initialize(m_data->window->GetHINSTANCE(), m_data->window->GetHWND(), m_data->window->GetWidth(), m_data->window->GetHeight()))
data.inputObj = new InputClass;
if(!data.inputObj->Initialize(data.window->GetHINSTANCE(), data.window->GetHWND(), data.window->GetHeight(), data.window->GetWidth()))
{
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
return E_FAIL;
@ -140,91 +149,85 @@ namespace DanBias
return S_OK;
}
HRESULT DanBiasGame::Update(float deltaTime)
DanBiasGame::Result DanBiasGame::Update(float deltaTime)
{
//Get mouse pos and window size (Temporary)
POINT p;
RECT r;
GetCursorPos(&p);
ScreenToClient(WindowShell::GetHWND(), &p);
GetClientRect(WindowShell::GetHWND(), &r);
data.inputObj->Update();
//Update menu buttons
MouseInput mouseInput;
mouseInput.x = (float)p.x / (float)r.right;
mouseInput.y = (float)p.y / (float)r.bottom;
mouseInput.mouseButtonPressed = m_data->inputObj->IsMousePressed();
EventHandler::Instance().Update(mouseInput);
m_data->inputObj->Update();
if(m_data->serverOwner)
if( data.serverOwner )
{
DanBias::GameServerAPI::ServerUpdate();
}
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
state = m_data->recieverObj->gameClientState->Update(deltaTime, m_data->inputObj);
if(state != Client::GameClientState::ClientState_Same)
state = data.state->Update( deltaTime, data.inputObj );
if( state != Client::GameClientState::ClientState_Same )
{
bool stateVal = false;
m_data->recieverObj->gameClientState->Release();
delete m_data->recieverObj->gameClientState;
m_data->recieverObj->gameClientState = NULL;
bool stateChanged = false;
data.state->Release();
switch (state)
{
case Client::GameClientState::ClientState_LobbyCreated:
m_data->serverOwner = true;
stateVal = true;
case Client::GameClientState::ClientState_LobbyCreate:
data.state = new Client::LobbyAdminState();
stateChanged = true;
break;
case Client::GameClientState::ClientState_Lan:
data.state = new Client::LanMenuState();
stateChanged = true;
break;
case Client::GameClientState::ClientState_Lobby:
m_data->recieverObj->gameClientState = new Client::LobbyState();
stateVal = true;
data.state = new Client::LobbyState();
stateChanged = true;
break;
case Client::GameClientState::ClientState_Game:
data.state = new Client::GameState();
stateChanged = true;
break;
case Client::GameClientState::ClientState_Quit:
data.state->Release();
return Result_quit;
default:
return E_FAIL;
break;
data.state->Release();
return Result_error;
}
if(stateVal)
if( stateChanged )
{
m_data->recieverObj->gameClientState->Init(m_data->recieverObj); // send game client
}
else
{
}
data.state->Init( &data.networkClient ); // send game client
}
}
return S_OK;
return Result_continue;
}
HRESULT DanBiasGame::Render(float deltaTime)
HRESULT DanBiasGame::Render( )
{
m_data->recieverObj->gameClientState->Render(deltaTime);
data.state->Render();
return S_OK;
}
HRESULT DanBiasGame::CleanUp()
{
Oyster::Graphics::API::Clean();
if( data.networkClient.IsConnected() )
data.networkClient.Disconnect();
delete data.inputObj;
data.state = nullptr;
EventHandler::Instance().Clean();
Graphics::API::Clean();
GameServerAPI::ServerStop();
m_data->recieverObj->gameClientState->Release();
delete m_data->recieverObj->gameClientState;
m_data->recieverObj->Disconnect();
delete m_data->recieverObj;
delete m_data->inputObj;
delete m_data;
return S_OK;
}
} //End namespace DanBias
} //End namespace DanBias
void ClientEventFunction( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
{
if( DanBias::data.state )
DanBias::data.state->DataRecieved( e );
}

View File

@ -4,20 +4,23 @@
//WTF!? No headers included???
#include "../DanBiasGame/Include/DanBiasGame.h"
#include "../GameProtocols/GeneralProtocols.h"
#include "..\GameProtocols\Protocols.h"
#include "../GameProtocols/Protocols.h"
#include "../Network/NetworkAPI/NetworkClient.h"
#include "GameClientState\GameClientState.h"
#include "GameClientState\GameState.h"
#include <Utilities.h>
namespace DanBias
{
struct GameRecieverObject :public Oyster::Network::NetworkClient
struct GameRecieverObject : public Oyster::Network::NetworkClient
{
Client::GameClientState* gameClientState;
// receiver function for server messages
// parsing protocols and sending it to the gameState
//void NetworkCallback(Oyster::Network::CustomNetProtocol& p) override
void GameRecieverObject::DataRecieved(Oyster::Network::NetEvent<Oyster::Network::NetworkClient*, Oyster::Network::NetworkClient::ClientEventArgs> e) override
void GameRecieverObject::DataRecieved( Oyster::Network::NetEvent<Oyster::Network::NetworkClient*, Oyster::Network::NetworkClient::ClientEventArgs> e ) override
{
Oyster::Network::CustomNetProtocol p = e.args.data.protocol;
int pType = p[0].value.netInt;
@ -70,14 +73,27 @@ namespace DanBias
break;
case protocol_Gameplay_ObjectPosition:
{
// 0: reserved
// 1: objectID
// 2,3,4: position
// 5,6,7,8: rotation quaternion
GameLogic::Protocol_ObjectPosition data(p);
Client::GameClientState::ObjPos protocolData;
protocolData.object_ID = p[1].value.netInt;
for(int i = 0; i< 16; i++)
protocolData.object_ID = data.object_ID;
//protocolData.object_ID = p[1].value.netInt;
for( int i = 0; i < 3; ++i )
{
protocolData.worldPos[i] = p[i+2].value.netFloat;
protocolData.position[i] = data.position[i];
}
//for(int i = 0; i< 16; i++)
//{
// protocolData.worldPos[i] = p[i+2].value.netFloat;
//}
if(dynamic_cast<Client::GameState*>(gameClientState))
((Client::GameState*)gameClientState)->Protocol(&protocolData);
}

View File

@ -0,0 +1,202 @@
/********************************************************************
* Text field that allows multiple lines.
*
* Written by Dan Andersson, 2014
********************************************************************/
#ifndef DANBIAS_CLIENT_TEXT_FIELD_H
#define DANBIAS_CLIENT_TEXT_FIELD_H
#include <string>
#include <vector>
#include "ButtonRectangle.h"
#include "OysterMath.h"
#include "Utilities.h"
namespace DanBias { namespace Client
{
template<typename Owner>
class TextField : public ButtonRectangle<Owner>
{
public:
TextField();
TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height );
virtual ~TextField();
virtual void RenderText();
const ::std::wstring & operator[]( unsigned int i ) const;
::std::wstring & operator[]( unsigned int i );
void SetTextHeight( ::Oyster::Math::Float h );
void SetLineSpacing( ::Oyster::Math::Float ls );
void SetBottomAligned();
void SetTopAligned();
unsigned int GetNumLines() const;
unsigned int GetMaxLineLength() const;
void ReserveLines( unsigned int num );
void ClearText();
void AppendText( const ::std::wstring &text );
void PopBack();
void PopFront();
private:
bool isBottomAligned;
::Oyster::Math::Float textHeight, lineSpacing;
::std::vector<::std::wstring> lines;
};
// IMPLEMENTATIONS //////////////////////////////////////////////////
template<typename Owner>
TextField<Owner>::TextField()
: ButtonRectangle()
{
this->textHeight = 0.025f;
this->lineSpacing = 0.001f;
this->isBottomAligned = true;
}
template<typename Owner>
TextField<Owner>::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize )
: ButtonRectangle( backgroundTexture, L"", textColor, owner, pos, size, resize )
{
this->textHeight = 0.025f;
this->lineSpacing = 0.001f;
this->isBottomAligned = true;
}
template<typename Owner>
TextField<Owner>::~TextField() {}
template<typename Owner>
void TextField<Owner>::RenderText()
{
::Oyster::Math::Float lineStep = this->textHeight + this->lineSpacing;
::Oyster::Math::Float2 rowSize = ::Oyster::Math::Float2( this->size.x, this->textHeight );
if( this->isBottomAligned )
{
::Oyster::Math::Float2 topLeft = this->pos;
topLeft.y += this->size.y - lineStep;
auto line = this->lines.rbegin();
for( ; line != this->lines.rend(); ++line )
{
if( topLeft.y - lineStep >= this->pos.y )
{
::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->textColor );
topLeft.y -= lineStep;
}
else break;
}
}
else
{
::Oyster::Math::Float2 topLeft = this->pos;
auto line = this->lines.begin();
for( ; line != this->lines.end(); ++line )
{
if( topLeft.y + lineStep < this->size.y )
{
::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->textColor );
topLeft.y += lineStep;
}
else break;
}
}
}
template<typename Owner>
const ::std::wstring & TextField<Owner>::operator[]( unsigned int i ) const
{
return this->lines[(::std::vector<::std::wstring>::size_type)i];
}
template<typename Owner>
::std::wstring & TextField<Owner>::operator[]( unsigned int i )
{
return this->lines[(::std::vector<::std::wstring>::size_type)i];
}
template<typename Owner>
void TextField<Owner>::SetTextHeight( ::Oyster::Math::Float h )
{
this->textHeight = h;
}
template<typename Owner>
void TextField<Owner>::SetLineSpacing( ::Oyster::Math::Float ls )
{
this->lineSpacing = ls;
}
template<typename Owner>
void TextField<Owner>::SetBottomAligned()
{
this->isBottomAligned = true;
}
template<typename Owner>
void TextField<Owner>::SetTopAligned()
{
this->isBottomAligned = false;
}
template<typename Owner>
unsigned int TextField<Owner>::GetNumLines() const
{
return (unsigned int)this->lines.size();
}
template<typename Owner>
void TextField<Owner>::ReserveLines( unsigned int num )
{
this->lines.reserve( (::std::vector<::std::wstring>::size_type)num );
}
template<typename Owner>
void TextField<Owner>::ClearText()
{
this->lines.resize( 0 );
}
template<typename Owner>
void TextField<Owner>::AppendText( const ::std::wstring &text )
{
::std::vector<::std::wstring> split;
split.reserve( 10 );
::Utility::String::Split( split, text, L"\n", 0 );
auto line = split.begin();
for( ; line != split.end; ++line )
{
this->lines.push_back( (*line) );
}
}
template<typename Owner>
void TextField<Owner>::PopBack()
{
this->lines.pop_back();
}
template<typename Owner>
void TextField<Owner>::PopFront()
{
::std::vector<::std::wstring>::size_type i = 0,
n = this->lines.size() - 1;
for( ; i < n; ++i )
{
this->lines[i] = this->lines[i+1];
}
this->lines.pop_back();
}
} }
#endif

View File

@ -5,7 +5,6 @@ namespace DanBias
{
namespace Client
{
struct ModelInitData
{
int id;
@ -16,36 +15,52 @@ namespace DanBias
bool visible;
};
class C_Object
{
private:
Oyster::Math::Float4x4 world;
Oyster::Math::Float3 position;
Oyster::Math::Quaternion rotation;
Oyster::Math::Float3 scale;
int id;
void updateWorld();
protected:
Oyster::Graphics::Model::Model *model;
public:
class C_Object
{
protected:
Oyster::Graphics::Model::Model *model;
private:
Oyster::Math::Float4x4 world;
Oyster::Math::Float3 position;
Oyster::Math::Quaternion rotation;
Oyster::Math::Float3 scale;
int id;
void updateWorld();
public:
virtual void Init(ModelInitData modelInit);
virtual void Init(ModelInitData modelInit);
void setWorld(Oyster::Math::Float4x4 world);
Oyster::Math::Float4x4 getWorld() const;
void setPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getPos() const;
void addPos(Oyster::Math::Float3 deltaPos);
void setRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRotation() const;
void addRot(Oyster::Math::Quaternion deltaRot);
void setScale(Oyster::Math::Float3 newScale);
void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const;
void setWorld(Oyster::Math::Float4x4 world);
Oyster::Math::Float4x4 getWorld() const;
void setPos(Oyster::Math::Float3 newPos);
Oyster::Math::Float3 getPos() const;
void addPos(Oyster::Math::Float3 deltaPos);
void setRot(Oyster::Math::Quaternion newRot);
Oyster::Math::Quaternion getRotation() const;
void addRot(Oyster::Math::Quaternion deltaRot);
void setScale(Oyster::Math::Float3 newScale);
void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const;
virtual void Render();
virtual void Release();
virtual int GetId() const;
};
}
}
namespace Utility { namespace DynamicMemory
{ // template specializationto allowuse of dynamicmemory tools
template<>
inline void SafeDeleteInstance( ::DanBias::Client::C_Object *dynamicInstance )
{
if( dynamicInstance )
{
dynamicInstance->Release();
delete dynamicInstance;
}
}
} }
virtual void Render();
virtual void Release();
virtual int GetId() const;
};};};
#endif

View File

@ -3,19 +3,14 @@
using namespace DanBias::Client;
C_Player::C_Player(void)
:C_DynamicObj()
{
:C_DynamicObj() {}
}
C_Player::~C_Player(void)
{
}
C_Player::~C_Player(void) {}
void C_Player::Init(ModelInitData modelInit)
{
C_Object::Init(modelInit);
Oyster::Graphics::API::PlayAnimation(model, L"movement");
Oyster::Graphics::API::PlayAnimation( this->model, L"movement" );
//Oyster::Graphics::API::Update(0.002f);
}

View File

@ -5,13 +5,15 @@ namespace DanBias
{
namespace Client
{
class C_Player : public C_DynamicObj
{
private:
public:
C_Player(void);
virtual ~C_Player(void);
void Init(ModelInitData modelInit);
class C_Player : public C_DynamicObj
{
private:
public:
C_Player(void);
virtual ~C_Player(void);
void Init(ModelInitData modelInit);
};};};
};
}
}
#endif

View File

@ -0,0 +1,125 @@
#include "Camera_Basic.h"
using namespace ::Oyster::Math3D;
Camera_Basic::Camera_Basic()
{
this->translation = this->angularAxis = Float3::null;
this->projection = Float4x4::identity;
this->rotation = Quaternion::identity;
rotationIsOutOfDate = false;
}
Camera_Basic::Camera_Basic( const Float3 &position, const Float3 &angularAxis, const Float4x4 &projection )
{
this->translation = position;
this->angularAxis = angularAxis;
this->projection = projection;
this->rotation = Quaternion::identity;
rotationIsOutOfDate = true;
}
Camera_Basic::~Camera_Basic() {}
Camera_Basic & Camera_Basic::operator = ( const Camera_Basic &camera )
{
this->translation = camera.translation;
this->angularAxis = camera.angularAxis;
this->projection = camera.projection;
this->rotation = camera.rotation;
rotationIsOutOfDate = camera.rotationIsOutOfDate;
return *this;
}
void Camera_Basic::SetPosition( const Float3 &translation )
{
this->translation = translation;
}
void Camera_Basic::SetAngular( const Float3 &axis )
{
this->angularAxis = axis;
this->rotationIsOutOfDate = true;
}
void Camera_Basic::SetProjection( const Float4x4 &matrix )
{
this->projection = matrix;
}
void Camera_Basic::SetOrthographicProjection( Float width, Float height, Float nearClip, Float farClip )
{
ProjectionMatrix_Orthographic( width, height, nearClip, farClip, this->projection );
}
void Camera_Basic::SetPerspectiveProjection( Float verticalFoV, Float aspectRatio, Float nearClip, Float farClip )
{
ProjectionMatrix_Perspective( verticalFoV, aspectRatio, nearClip, farClip, this->projection );
}
void Camera_Basic::Move( const Float3 &deltaPosition )
{
this->translation += deltaPosition;
}
void Camera_Basic::Rotate( const Float3 &deltaAngularAxis )
{
this->angularAxis += deltaAngularAxis;
this->rotationIsOutOfDate = true;
}
const Float3 & Camera_Basic::GetPosition() const
{
return this->translation;
}
const Float3 & Camera_Basic::GetAngularAxis() const
{
return this->angularAxis;
}
Float3 Camera_Basic::GetNormalOf( const Float3 &axis ) const
{
return WorldAxisOf( this->GetRotation(), axis );
}
const Quaternion & Camera_Basic::GetRotation() const
{
if( this->rotationIsOutOfDate )
{
// Maintain rotation resolution by keeping axis within [0, 2pi] (trigonometric methods gets faster too)
Float4 integer;
::std::modf( this->angularAxis * (0.5f / pi), integer.xyz );
this->angularAxis -= ((2.0f * pi) * integer).xyz;
this->rotation = Rotation( this->angularAxis );
this->rotationIsOutOfDate = false;
}
return this->rotation;
}
Float3x3 & Camera_Basic::GetRotationMatrix( Float3x3 &targetMem ) const
{
return RotationMatrix( this->rotation, targetMem );
}
Float4x4 & Camera_Basic::GetRotationMatrix( Float4x4 &targetMem ) const
{
return RotationMatrix( this->rotation, targetMem );
}
Float4x4 & Camera_Basic::GetViewMatrix( Float4x4 &targetMem ) const
{
return ViewMatrix( this->GetRotation(), this->translation, targetMem );
}
const Float4x4 & Camera_Basic::GetProjectionMatrix() const
{
return this->projection;
}
Float4x4 & Camera_Basic::GetViewsProjMatrix( Float4x4 &targetMem ) const
{
return TransformMatrix( this->projection, this->GetViewMatrix(), targetMem );
}

View File

@ -0,0 +1,42 @@
#ifndef CAMERA_BASIC_H
#define CAMERA_BASIC_H
#include "OysterMath.h"
class Camera_Basic
{
public:
Camera_Basic();
Camera_Basic( const ::Oyster::Math::Float3 &position, const ::Oyster::Math::Float3 &angularAxis, const ::Oyster::Math::Float4x4 &projection );
virtual ~Camera_Basic();
Camera_Basic & operator = ( const Camera_Basic &camera );
void SetPosition( const ::Oyster::Math::Float3 &translation );
void SetAngular( const ::Oyster::Math::Float3 &axis );
void SetProjection( const ::Oyster::Math::Float4x4 &matrix );
void SetOrthographicProjection( ::Oyster::Math::Float width, ::Oyster::Math::Float height, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip );
void SetPerspectiveProjection( ::Oyster::Math::Float verticalFoV, ::Oyster::Math::Float aspectRatio, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip );
void Move( const ::Oyster::Math::Float3 &deltaPosition );
void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis );
const ::Oyster::Math::Float3 & GetPosition() const;
const ::Oyster::Math::Float3 & GetAngularAxis() const;
::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const;
const ::Oyster::Math::Quaternion & GetRotation() const;
::Oyster::Math::Float3x3 & GetRotationMatrix( ::Oyster::Math::Float3x3 &targetMem ) const;
::Oyster::Math::Float4x4 & GetRotationMatrix( ::Oyster::Math::Float4x4 &targetMem ) const;
::Oyster::Math::Float4x4 & GetViewMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const;
const ::Oyster::Math::Float4x4 & GetProjectionMatrix() const;
::Oyster::Math::Float4x4 & GetViewsProjMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const;
private:
::Oyster::Math::Float3 translation;
mutable ::Oyster::Math::Float3 angularAxis;
::Oyster::Math::Float4x4 projection;
mutable ::Oyster::Math::Quaternion rotation;
mutable bool rotationIsOutOfDate;
};
#endif

View File

@ -0,0 +1,183 @@
#include "Camera_FPS.h"
#include "Utilities.h"
using namespace ::Oyster::Math3D;
using namespace ::Utility::Value;
Camera_FPS::Camera_FPS()
{ // this->head is default set to identity uniformprojection at origo
this->pitchUp = 0.0f;
this->headOffset =
this->body.translation =
this->body.angularAxis = Float3( 0.0f );
this->body.direction = Float3x3::identity;
}
Camera_FPS::~Camera_FPS() {}
Camera_FPS & Camera_FPS::operator = ( const Camera_FPS &camera )
{
this->head = camera.head;
this->pitchUp = camera.pitchUp;
this->headOffset = camera.headOffset;
this->body.translation = camera.body.translation;
this->body.angularAxis = camera.body.angularAxis;
this->body.direction = camera.body.direction;
return *this;
}
void Camera_FPS::SetHeadOffset( const Float3 &translation )
{
this->head.Move( translation - this->headOffset );
this->headOffset = translation;
}
void Camera_FPS::SetPosition( const Float3 &translation )
{
this->head.Move( translation - this->body.translation );
this->body.translation = translation;
}
void Camera_FPS::SetAngular( const Float3 &axis )
{
this->head.SetAngular( axis );
this->pitchUp = 0.0f;
this->body.angularAxis = axis;
}
void Camera_FPS::SetProjection( const Float4x4 &matrix )
{
this->head.SetProjection( matrix );
}
void Camera_FPS::SetOrthographicProjection( Float width, Float height, Float nearClip, Float farClip )
{
this->head.SetOrthographicProjection( width, height, nearClip, farClip );
}
void Camera_FPS::SetPerspectiveProjection( Float verticalFoV, Float aspectRatio, Float nearClip, Float farClip )
{
this->head.SetPerspectiveProjection( verticalFoV, aspectRatio, nearClip, farClip );
}
void Camera_FPS::UpdateOrientation()
{
RotationMatrix( Rotation(this->body.angularAxis), this->body.direction );
Float4x4 orientation = Float4x4( Float4(this->body.direction.v[0], 0.0f),
Float4(this->body.direction.v[1], 0.0f),
Float4(this->body.direction.v[2], 0.0f),
Float4(this->body.translation, 1.0f) );
this->head.SetPosition( (orientation * Float4(this->headOffset, 1.0f)).xyz );
}
void Camera_FPS::SnapUpToNormal( const Float3 &normal )
{
SnapAngularAxis( this->body.angularAxis, this->body.direction.v[1], normal, this->body.angularAxis );
this->head.SetAngular( this->body.angularAxis + this->pitchUp * Float3::standard_unit_x );
}
void Camera_FPS::Move( const Float3 &deltaPosition )
{
this->head.Move( deltaPosition );
this->body.translation += deltaPosition;
}
void Camera_FPS::Rotate( const Float3 &deltaAngularAxis )
{
this->head.Rotate( deltaAngularAxis );
this->body.angularAxis += deltaAngularAxis;
}
void Camera_FPS::MoveForward( Float distance )
{
this->MoveBackward( -distance );
}
void Camera_FPS::MoveBackward( Float distance )
{
this->Move( distance * this->body.direction.v[2] );
}
void Camera_FPS::StrafeRight( Float distance )
{
this->Move( distance * this->body.direction.v[0] );
}
void Camera_FPS::StrafeLeft( Float distance )
{
this->StrafeRight( -distance );
}
void Camera_FPS::PitchUp( Float radian )
{
this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi );
this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] );
}
void Camera_FPS::PitchDown( Float radian )
{
this->PitchUp( -radian );
}
void Camera_FPS::YawRight( Float radian )
{
this->YawLeft( -radian );
}
void Camera_FPS::YawLeft( Float radian )
{
this->body.angularAxis += radian * this->body.direction.v[1];
this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] );
}
const Float3 & Camera_FPS::GetHeadOffset() const
{
return this->headOffset;
}
const Float3 & Camera_FPS::GetPosition() const
{
return this->body.translation;
}
Float4x4 & Camera_FPS::GetViewMatrix( Float4x4 &targetMem ) const
{
return this->head.GetViewMatrix( targetMem );
}
const Float4x4 & Camera_FPS::GetProjectionMatrix() const
{
return this->head.GetProjectionMatrix();
}
Float4x4 & Camera_FPS::GetViewsProjMatrix( Float4x4 &targetMem ) const
{
return this->head.GetViewsProjMatrix( targetMem );
}
Float3 Camera_FPS::GetNormalOf( const Float3 &axis ) const
{
return this->head.GetNormalOf( axis );
}
Float3 Camera_FPS::GetRight() const
{
return this->body.direction.v[0];
}
Float3 Camera_FPS::GetUp() const
{
return this->body.direction.v[1];
}
Float3 Camera_FPS::GetLook() const
{
return this->head.GetNormalOf( -Float3::standard_unit_z );
}
Float3 Camera_FPS::GetForward() const
{
return -this->body.direction.v[2];
}

View File

@ -0,0 +1,61 @@
#ifndef CAMERA_FPS_H
#define CAMERA_FPS_H
#include "OysterMath.h"
#include "Camera_Basic.h"
class Camera_FPS
{
public:
Camera_FPS();
virtual ~Camera_FPS();
Camera_FPS & operator = ( const Camera_FPS &camera );
void SetHeadOffset( const ::Oyster::Math::Float3 &translation );
void SetPosition( const ::Oyster::Math::Float3 &translation );
void SetAngular( const ::Oyster::Math::Float3 &axis );
void SetProjection( const ::Oyster::Math::Float4x4 &matrix );
void SetOrthographicProjection( ::Oyster::Math::Float width, ::Oyster::Math::Float height, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip );
void SetPerspectiveProjection( ::Oyster::Math::Float verticalFoV, ::Oyster::Math::Float aspectRatio, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip );
void UpdateOrientation();
void SnapUpToNormal( const ::Oyster::Math::Float3 &normal );
void Move( const ::Oyster::Math::Float3 &deltaPosition );
void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis );
void MoveForward( ::Oyster::Math::Float distance );
void MoveBackward( ::Oyster::Math::Float distance );
void StrafeRight( ::Oyster::Math::Float distance );
void StrafeLeft( ::Oyster::Math::Float distance );
void PitchUp( ::Oyster::Math::Float radian );
void PitchDown( ::Oyster::Math::Float radian );
void YawRight( ::Oyster::Math::Float radian );
void YawLeft( ::Oyster::Math::Float radian );
const ::Oyster::Math::Float3 & GetHeadOffset() const;
const ::Oyster::Math::Float3 & GetPosition() const;
::Oyster::Math::Float4x4 & GetViewMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const;
const ::Oyster::Math::Float4x4 & GetProjectionMatrix() const;
::Oyster::Math::Float4x4 & GetViewsProjMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const;
::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const;
::Oyster::Math::Float3 GetRight() const;
::Oyster::Math::Float3 GetUp() const;
::Oyster::Math::Float3 GetLook() const;
::Oyster::Math::Float3 GetForward() const;
private:
Camera_Basic head;
::Oyster::Math::Float pitchUp;
::Oyster::Math::Float3 headOffset;
struct
{
::Oyster::Math::Float3 translation, angularAxis;
::Oyster::Math::Float3x3 direction;
} body;
};
#endif

View File

@ -1,12 +1,11 @@
#include "GameClientState.h"
using namespace DanBias::Client;
using namespace ::Oyster::Network;
GameClientState::GameClientState(void)
{
}
GameClientState::GameClientState(void) {}
GameClientState::~GameClientState(void) {}
GameClientState::~GameClientState(void)
{
}
void GameClientState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
{ /* do nothing */ }

View File

@ -5,75 +5,47 @@
#include "L_inputClass.h"
#include "NetworkClient.h"
namespace DanBias
{
namespace Client
namespace DanBias { namespace Client
{
class GameClientState
{
public:
enum ClientState
{
ClientState_Login,
ClientState_Lan,
ClientState_Lobby,
ClientState_LobbyCreate,
ClientState_LobbyReady,
ClientState_Game,
ClientState_Same,
ClientState_Quit
};
class GameClientState
{
public:
struct ProtocolStruct
{
public:
GameClientState(void);
virtual ~GameClientState(void);
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
virtual bool Render() = 0;
virtual bool Release() = 0;
virtual void ChangeState( ClientState next ) = 0;
virtual void DataRecieved( ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> e );
};
struct ObjPos :public ProtocolStruct
{
int object_ID;
float worldPos[16];
};
struct NewObj :public ProtocolStruct
{
int object_ID;
char* path;
float worldPos[16];
};
struct RemoveObj :public ProtocolStruct
{
int object_ID;
//particle effect
};
struct KeyInput :public ProtocolStruct
{
/*
* key[0] =
*
*
*/
bool key[6];
};
struct PlayerPos :public ProtocolStruct
{
float playerPos[3];
};
struct PlayerMove :public ProtocolStruct
{
float playerPos[3];
};
struct PlayerName :public ProtocolStruct
{
char name[255];
};
enum ClientState
{
ClientState_Login,
ClientState_Lobby,
ClientState_Lan,
ClientState_LobbyCreated,
ClientState_Game,
ClientState_Same,
};
} }
public:
GameClientState(void);
virtual ~GameClientState(void);
virtual bool Init(Oyster::Network::NetworkClient* nwClient) = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
virtual bool Render(float dt) = 0;
virtual bool Release() = 0;
virtual void Protocol(ProtocolStruct* protocolStruct) = 0;
namespace Utility { namespace DynamicMemory
{ // template specializationto allowuse of dynamicmemory tools
template<>
inline void SafeDeleteInstance( ::DanBias::Client::GameClientState *dynamicInstance )
{
if( dynamicInstance )
{
dynamicInstance->Release();
delete dynamicInstance;
}
}
} }
};
};
};
#endif

View File

@ -3,63 +3,60 @@
#include "GameClientState.h"
#include "OysterMath.h"
#include <string>
#include "Camera.h"
#include "Camera_FPS.h"
#include "LevelLoader/LevelLoader.h"
#include "C_obj/C_Player.h"
#include "C_obj/C_DynamicObj.h"
#include "C_obj/C_StaticObj.h"
#include "DynamicArray.h"
namespace DanBias
namespace DanBias { namespace Client
{
namespace Client
{
class GameState : public GameClientState
{
enum gameStateState
class GameState : public GameClientState
{
gameStateState_loading,
gameStateState_playing,
gameStateState_end,
public:
enum gameStateState
{
gameStateState_loading,
gameStateState_playing,
gameStateState_end,
};
GameState(void);
~GameState(void);
bool Init(Oyster::Network::NetworkClient* nwClient);
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override;
bool LoadModels(std::string mapFile);
bool InitCamera(Oyster::Math::Float3 startPos) ;
void InitiatePlayer(int id, std::wstring modelName, Oyster::Math::Float4x4 world);
gameStateState LoadGame();
void readKeyInput(InputClass* KeyInput);
bool Render()override;
bool Release()override;
void ChangeState( ClientState next );
void DataRecieved( ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> e );
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
bool key_forward;
bool key_backward;
bool key_strafeRight;
bool key_strafeLeft;
bool key_Shoot;
bool key_Jump;
Camera_FPS camera;
int myId;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_StaticObj>> staticObjects;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_Object>> dynamicObjects;
//Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_Player>> playObjects;
};
private:
bool key_forward;
bool key_backward;
bool key_strafeRight;
bool key_strafeLeft;
bool key_Shoot;
bool key_Jump;
Camera* camera;
int myId;
float pitch;
float timer;
struct myData;
myData* privData;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_StaticObj>> staticObjects;
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_Object>> dynamicObjects;
//Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<C_Player>> playObjects;
public:
GameState(void);
~GameState(void);
bool Init(Oyster::Network::NetworkClient* nwClient);
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput) override;
bool LoadModels(std::string mapFile);
bool LoadModels();
bool InitCamera(Oyster::Math::Float3 startPos) ;
void InitiatePlayer(int id, std::wstring modelName, Oyster::Math::Float4x4 world);
gameStateState LoadGame();
void readKeyInput(InputClass* KeyInput);
bool Render(float dt)override;
bool Release()override;
void Protocol(ProtocolStruct* pos)override;
void Protocol(PlayerPos* pos);
void Protocol(ObjPos* pos);
void Protocol( NewObj* pos );
void Protocol(RemoveObj* obj);
//void Protocol(LightPos pos);
};
};
};
} }
#endif

View File

@ -7,210 +7,133 @@
#include "LobbyState.h"
#include "GameState.h"
#include "../GameClientRecieverFunc.h"
#include "../Network/NetworkAPI/NetworkClient.h"
#include "EventHandler\EventHandler.h"
#include "Buttons\ButtonRectangle.h"
#include "Buttons\TextField.h"
#include <GameServerAPI.h>
#include <string>
using namespace DanBias::Client;
using namespace ::DanBias::Client;
using namespace ::Oyster;
using namespace ::Oyster::Network;
using namespace ::Oyster::Event;
using namespace ::Oyster::Math3D;
struct LanMenuState::myData
struct LanMenuState::MyData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
C_Object* object[2];
int modelCount;
MyData(){}
GameRecieverObject* recieverObj;
bool serverOwner;
GameClientState::ClientState nextState;
NetworkClient *nwClient;
Graphics::API::Texture background;
EventButtonCollection guiElements;
// UI object
// game client*
}privData;
TextField<LanMenuState*> *connectIP;
unsigned short connectPort;
} privData;
LanMenuState::LanMenuState()
{
void OnButtonInteract_Connect( Oyster::Event::ButtonEvent<LanMenuState*>& e );
}
LanMenuState::LanMenuState() {}
LanMenuState::~LanMenuState()
{
if( this->privData )
this->Release();
}
bool LanMenuState::Init(Oyster::Network::NetworkClient* nwClient)
bool LanMenuState::Init(Network::NetworkClient* nwClient)
{
privData = new myData();
this->nwClient = nwClient;
// load models
LoadModels(L"UImodels.txt");
InitCamera(Oyster::Math::Float3(0,0,5.4f));
this->privData = new MyData();
return true;
}
this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient;
bool LanMenuState::LoadModels(std::wstring file)
{
Oyster::Graphics::Definitions::Pointlight plight;
plight.Pos = Oyster::Math::Float3(-2,3,0);
plight.Color = Oyster::Math::Float3(0,1,0);
plight.Radius = 10;
plight.Bright = 1;
Oyster::Graphics::API::AddLight(plight);
// open file
// read file
// init models
privData->modelCount = 2;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
ModelInitData modelData;
// create guiElements
ButtonRectangle<LanMenuState*> *guiElements;
//0.5f, 0.2f, 0.3f, 0.1f,
guiElements = new ButtonRectangle<LanMenuState*>( L"earth_md.png", L"Connect", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( guiElements );
modelData.position = Oyster::Math::Float3(0,0,0);
modelData.rotation = Oyster::Math::Quaternion::identity;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.visible = true;
modelData.modelPath = L"..\\Content\\Models\\box_2.dan";
// load models
privData->object[0] = new C_StaticObj();
privData->object[0]->Init(modelData);
this->privData->connectIP = new TextField<LanMenuState*>( L"earth_md.png", Float3(1.0f), this, Float3(0.1f, 0.2f, 0.5f), Float2(0.45f, 0.1f), ResizeAspectRatio_Width );
this->privData->connectIP->ReserveLines( 1 );
(*this->privData->connectIP)[0] = L"127.0.0.1";
this->privData->connectIP->SetTextHeight( 0.1f );
this->privData->connectIP->SetLineSpacing( 0.0f );
this->privData->guiElements.AddButton( this->privData->connectIP );
modelData.position = Oyster::Math::Float3(-2, -2, -2);
// bind guiElements collection to the singleton eventhandler
EventHandler::Instance().AddCollection( &this->privData->guiElements );
privData->object[1] = new C_DynamicObj();
privData->object[1]->Init(modelData);
return true;
}
this->privData->connectPort = 15151;
bool LanMenuState::InitCamera(Oyster::Math::Float3 startPos)
{
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
//privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000);
Oyster::Graphics::API::SetProjection(privData->proj);
privData->view = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),startPos);
privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view);
return true;
}
GameClientState::ClientState LanMenuState::Update(float deltaTime, InputClass* KeyInput)
{
/*ChangeState(KeyInput);
if(privData->recieverObj->IsConnected())
privData->recieverObj->Update();
KeyInput->Update();
if(privData->serverOwner)
MouseInput mouseState;
{
DanBias::GameServerAPI::ServerUpdate();
mouseState.x = KeyInput->GetPitch();
mouseState.y = KeyInput->GetYaw();
mouseState.mouseButtonPressed = KeyInput->IsMousePressed();
}
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
state = privData->recieverObj->gameClientState->Update(deltaTime, KeyInput);
EventHandler::Instance().Update( mouseState );
if(state != Client::GameClientState::ClientState_Same)
{
privData->recieverObj->gameClientState->Release();
delete privData->recieverObj->gameClientState;
privData->recieverObj->gameClientState = NULL;
switch (state)
{
case Client::GameClientState::ClientState_LobbyCreated:
privData->serverOwner = true;
case Client::GameClientState::ClientState_Lobby:
privData->recieverObj->gameClientState = new Client::LobbyState();
break;
case Client::GameClientState::ClientState_Game:
privData->recieverObj->gameClientState = new Client::GameState();
break;
default:
//return E_FAIL;
break;
}
privData->recieverObj->gameClientState->Init(privData->recieverObj); // send game client
}*/
return ChangeState(KeyInput);
return this->privData->nextState;
}
GameClientState::ClientState LanMenuState::ChangeState(InputClass* KeyInput)
bool LanMenuState::Render( )
{
// create game
if( KeyInput->IsKeyPressed(DIK_C))
{
DanBias::GameServerAPI::ServerInitDesc desc;
Graphics::API::NewFrame();
DanBias::GameServerAPI::ServerInitiate(desc);
DanBias::GameServerAPI::ServerStart();
// my ip
nwClient->Connect(15151, "127.0.0.1");
Graphics::API::StartGuiRender();
if (!nwClient->IsConnected())
{
// failed to connect
return ClientState_Same;
}
return ClientState_Lobby;
}
// join game
if( KeyInput->IsKeyPressed(DIK_J))
{
// game ip
nwClient->Connect(15151, "194.47.150.56");
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
this->privData->guiElements.RenderTexture();
if (!nwClient->IsConnected())
{
// failed to connect
return ClientState_Same;
}
return ClientState_Lobby;
}
return ClientState_Same;
}
Graphics::API::StartTextRender();
this->privData->guiElements.RenderText();
bool LanMenuState::Render(float dt)
{
Oyster::Graphics::API::SetView(privData->view);
Oyster::Graphics::API::SetProjection( privData->proj);
Oyster::Graphics::API::NewFrame();
// render objects
for (int i = 0; i < privData->modelCount; i++)
{
privData->object[i]->Render();
}
// render effects
// render lights
Oyster::Graphics::API::EndFrame();
Graphics::API::EndFrame();
return true;
}
bool LanMenuState::Release()
{
for (int i = 0; i < privData->modelCount; i++)
{
privData->object[i]->Release();
delete privData->object[i];
privData->object[i] = NULL;
}
delete privData;
privData = NULL;
return true;
}
void LanMenuState::Protocol(ProtocolStruct* protocolStruct)
{
if((PlayerName*)protocolStruct)
PlayerJoinProtocol((PlayerName*)protocolStruct);
}
void LanMenuState::PlayerJoinProtocol(PlayerName* name)
void LanMenuState::ChangeState( ClientState next )
{
switch( next )
{
case GameClientState::ClientState_Lobby:
// attempt to connect to lobby
if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) )
return;
break;
default: break;
}
this->privData->nextState = next;
}
void OnButtonInteract_Connect( Oyster::Event::ButtonEvent<LanMenuState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_LobbyCreate );
break;
default: break;
}
}

View File

@ -17,21 +17,13 @@ namespace DanBias
virtual bool Init(Oyster::Network::NetworkClient* nwClient);
virtual ClientState Update(float deltaTime, InputClass* KeyInput);
ClientState ChangeState(InputClass* KeyInput);
bool LoadModels(std::wstring file);
bool InitCamera(Oyster::Math::Float3 startPos);
virtual bool Render(float dt);
virtual bool Render();
virtual bool Release();
virtual void Protocol(ProtocolStruct* protocolStruct);
void PlayerJoinProtocol(PlayerName* name);
void ChangeState( ClientState next );
private:
Oyster::Network::NetworkClient* nwClient;
struct myData;
myData* privData;
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
};
}
}

View File

@ -0,0 +1,154 @@
#include "LobbyAdminState.h"
#include "DllInterfaces/GFXAPI.h"
#include "OysterMath.h"
#include "C_obj/C_Player.h"
#include "C_obj/C_StaticObj.h"
#include "C_obj/C_DynamicObj.h"
#include <GameServerAPI.h>
#include <Protocols.h>
#include "EventHandler\EventHandler.h"
#include "Buttons\ButtonRectangle.h"
using namespace ::DanBias::Client;
using namespace ::Oyster;
using namespace ::Oyster::Network;
using namespace ::Oyster::Event;
using namespace ::Oyster::Math3D;
struct LobbyAdminState::MyData
{
MyData(){}
GameClientState::ClientState nextState;
NetworkClient *nwClient;
Graphics::API::Texture background;
EventButtonCollection guiElements;
} privData;
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyAdminState*>& e );
LobbyAdminState::LobbyAdminState(void) {}
LobbyAdminState::~LobbyAdminState(void)
{
if( this->privData )
this->Release();
}
bool LobbyAdminState::Init(NetworkClient* nwClient)
{
privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
// create buttons
ButtonRectangle<LobbyAdminState*> *button;
button = new ButtonRectangle<LobbyAdminState*>( L"earth_md.png", L"Ready", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( button );
// bind button collection to the singleton eventhandler
EventHandler::Instance().AddCollection( &this->privData->guiElements );
return true;
}
GameClientState::ClientState LobbyAdminState::Update(float deltaTime, InputClass* KeyInput)
{
// Wishlist:
// picking
// mouse events
// different menus
// play sounds
// update animation
// send data to server
// check data from server
MouseInput mouseState;
{
mouseState.x = KeyInput->GetPitch();
mouseState.y = KeyInput->GetYaw();
mouseState.mouseButtonPressed = KeyInput->IsMousePressed();
}
EventHandler::Instance().Update( mouseState );
return this->privData->nextState;
}
bool LobbyAdminState::Render( )
{
Graphics::API::NewFrame();
Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
this->privData->guiElements.RenderTexture();
Graphics::API::StartTextRender();
this->privData->guiElements.RenderText();
Graphics::API::EndFrame();
return true;
}
bool LobbyAdminState::Release()
{
privData = NULL;
return true;
}
void LobbyAdminState::ChangeState( ClientState next )
{
if( next == GameClientState::ClientState_LobbyReady )
{ // If all is ready start server
}
else
this->privData->nextState = next;
}
using namespace ::Oyster::Network;
void LobbyAdminState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
{
CustomNetProtocol data = e.args.data.protocol;
short ID = data[0].value.netShort; // fetching the id data.
// Block irrelevant messages.
if( ProtocolIsLobby(ID) )
{
switch(ID)
{
case protocol_Lobby_Create: break; /** @todo TODO: implement */
case protocol_Lobby_Start: break; /** @todo TODO: implement */
case protocol_Lobby_Join: break; /** @todo TODO: implement */
case protocol_Lobby_Login: break; /** @todo TODO: implement */
case protocol_Lobby_Refresh: break; /** @todo TODO: implement */
case protocol_Lobby_ClientData: break; /** @todo TODO: implement */
case protocol_Lobby_GameData: break; /** @todo TODO: implement */
default: break;
}
}
else if( ProtocolIsGeneral(ID) )
{
switch( ID )
{
case protocol_General_Status: break; /** @todo TODO: implement */
case protocol_General_Text: break; /** @todo TODO: implement */
default: break;
}
}
}
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyAdminState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_LobbyReady );
break;
default: break;
}
}

View File

@ -0,0 +1,40 @@
#ifndef DANBIAS_CLIENT_LOBBYADMINSTATE_H
#define DANBIAS_CLIENT_LOBBYADMINSTATE_H
#include "GameClientState.h"
#include "NetworkClient.h"
// Feature wishlist:
// create session lobby
// join session lobby
// set name
// set rules
// set map
// ready
// chat
// kick
namespace DanBias
{
namespace Client
{
class LobbyAdminState : public GameClientState
{
public:
LobbyAdminState();
~LobbyAdminState();
bool Init( Oyster::Network::NetworkClient* nwClient );
ClientState Update( float deltaTime, InputClass* KeyInput );
bool Render();
bool Release();
void ChangeState( ClientState next );
void DataRecieved( ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> e );
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
};
}
}
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H

View File

@ -7,81 +7,59 @@
#include <GameServerAPI.h>
#include <Protocols.h>
using namespace DanBias::Client;
#include "EventHandler\EventHandler.h"
#include "Buttons\ButtonRectangle.h"
struct LobbyState::myData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
C_Object* object[2];
int modelCount;
// UI object
// game client*
}privData;
using namespace ::DanBias::Client;
using namespace ::Oyster;
using namespace ::Oyster::Network;
using namespace ::Oyster::Event;
using namespace ::Oyster::Math3D;
LobbyState::LobbyState(void)
struct LobbyState::MyData
{
}
MyData(){}
GameClientState::ClientState nextState;
NetworkClient *nwClient;
Graphics::API::Texture background;
EventButtonCollection guiElements;
} privData;
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyState*>& e );
LobbyState::LobbyState(void) {}
LobbyState::~LobbyState(void)
{
if( this->privData )
this->Release();
}
bool LobbyState::Init(NetworkClient* nwClient)
{
privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
// create buttons
ButtonRectangle<LobbyState*> *button;
}
button = new ButtonRectangle<LobbyState*>( L"earth_md.png", L"", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( button );
bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient)
{
privData = new myData();
this->nwClient = nwClient;
// load models
LoadModels(L"UImodels.txt");
InitCamera(Oyster::Math::Float3(0,0,5.4f));
return true;
}
bool LobbyState::LoadModels(std::wstring file)
{
Oyster::Graphics::Definitions::Pointlight plight;
plight.Pos = Oyster::Math::Float3(-2,3,0);
plight.Color = Oyster::Math::Float3(0,1,0);
plight.Radius = 10;
plight.Bright = 1;
Oyster::Graphics::API::AddLight(plight);
// open file
// read file
// init models
privData->modelCount = 2;
// bind button collection to the singleton eventhandler
EventHandler::Instance().AddCollection( &this->privData->guiElements );
ModelInitData modelData;
modelData.position = Oyster::Math::Float3(0,0,0);
modelData.rotation = Oyster::Math::Quaternion::identity;
modelData.scale = Oyster::Math::Float3(1,1,1);
modelData.visible = true;
modelData.modelPath = L"crate_colonists.dan";
// load models
privData->object[0] = new C_StaticObj();
privData->object[0]->Init(modelData);
modelData.position = Oyster::Math::Float3(2,2,2);
privData->object[1] = new C_StaticObj();
privData->object[1]->Init(modelData);
return true;
}
bool LobbyState::InitCamera(Oyster::Math::Float3 startPos)
{
privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
//privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000);
Oyster::Graphics::API::SetProjection(privData->proj);
privData->view = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),startPos);
privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view);
return true;
}
GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* KeyInput)
{
// Wishlist:
// picking
// mouse events
// different menus
@ -90,61 +68,87 @@ GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* Key
// send data to server
// check data from server
if(GameServerAPI::ServerIsRunning() && GameServerAPI::ServerIsRunning()) //May be a problem if server is not shut down properly after lan session.
MouseInput mouseState;
{
if( KeyInput->IsKeyPressed(DIK_G))
{
if(!DanBias::GameServerAPI::GameStart())
{
}
}
mouseState.x = KeyInput->GetPitch();
mouseState.y = KeyInput->GetYaw();
mouseState.mouseButtonPressed = KeyInput->IsMousePressed();
}
return ClientState_Same;
EventHandler::Instance().Update( mouseState );
return this->privData->nextState;
}
bool LobbyState::Render(float dt)
bool LobbyState::Render( )
{
Graphics::API::NewFrame();
Graphics::API::StartGuiRender();
Oyster::Graphics::API::SetView(privData->view);
Oyster::Graphics::API::SetProjection( privData->proj);
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
this->privData->guiElements.RenderTexture();
Graphics::API::StartTextRender();
this->privData->guiElements.RenderText();
Oyster::Graphics::API::NewFrame();
// render objects
for (int i = 0; i < privData->modelCount; i++)
{
privData->object[i]->Render();
}
// render effects
// render lights
Oyster::Graphics::API::EndFrame();
Graphics::API::EndFrame();
return true;
}
bool LobbyState::Release()
{
Oyster::Graphics::API::ClearLights();
for (int i = 0; i < privData->modelCount; i++)
{
privData->object[i]->Release();
delete privData->object[i];
privData->object[i] = NULL;
}
delete privData;
privData = NULL;
return true;
}
void LobbyState::Protocol(ProtocolStruct* protocol)
{
if((PlayerName*)protocol)
PlayerJoinProtocol((PlayerName*)protocol);
}
void LobbyState::PlayerJoinProtocol(PlayerName* name)
{
void LobbyState::ChangeState( ClientState next )
{
if( next == GameClientState::ClientState_LobbyReady )
{ // Send ready signal to server lobby
}
else
this->privData->nextState = next;
}
using namespace ::Oyster::Network;
void LobbyState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e )
{
CustomNetProtocol data = e.args.data.protocol;
short ID = data[0].value.netShort; // fetching the id data.
// Block irrelevant messages.
if( ProtocolIsLobby(ID) )
{
switch(ID)
{
case protocol_Lobby_Create: break; /** @todo TODO: implement */
case protocol_Lobby_Start: break; /** @todo TODO: implement */
case protocol_Lobby_Join: break; /** @todo TODO: implement */
case protocol_Lobby_Login: break; /** @todo TODO: implement */
case protocol_Lobby_Refresh: break; /** @todo TODO: implement */
case protocol_Lobby_ClientData: break; /** @todo TODO: implement */
case protocol_Lobby_GameData: break; /** @todo TODO: implement */
default: break;
}
}
else if( ProtocolIsGeneral(ID) )
{
switch( ID )
{
case protocol_General_Status: break; /** @todo TODO: implement */
case protocol_General_Text: break; /** @todo TODO: implement */
default: break;
}
}
}
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_LobbyReady );
break;
default: break;
}
}

View File

@ -5,38 +5,38 @@
#include "OysterMath.h"
#include "NetworkClient.h"
#include <string>
// Feature wishlist:
// create session lobby
// join session lobby
// set name
// set rules
// set map
// ready
// chat
// kick
namespace DanBias
{
namespace Client
{
class LobbyState : public GameClientState
{
private:
Oyster::Network::NetworkClient* nwClient;
struct myData;
myData* privData;
public:
LobbyState(void);
~LobbyState(void);
bool Init(Oyster::Network::NetworkClient* nwClient);
bool LoadModels(std::wstring file);
bool InitCamera(Oyster::Math::Float3 startPos);
ClientState Update(float deltaTime, InputClass* KeyInput);
// create session lobby
// join session lobby
// set name
// set rules
// set map
// ready
// chat
// kick
{
class LobbyState : public GameClientState
{
public:
LobbyState(void);
~LobbyState(void);
bool Render(float dt);
bool Release();
void Protocol(ProtocolStruct* protocol)override;
void PlayerJoinProtocol(PlayerName* name);
void GameStarted();
bool Init( Oyster::Network::NetworkClient* nwClient );
ClientState Update( float deltaTime, InputClass* KeyInput );
bool Render();
bool Release();
void ChangeState( ClientState next );
void DataRecieved( ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> e );
};};};
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
};
}
}
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H

View File

@ -1,37 +0,0 @@
#ifndef DANBIAS_CLIENT_LOGINSTATE_H
#define DANBIAS_CLIENT_LOGINSTATE_H
#include "GameClientState.h"
#include "OysterMath.h"
#include "NetworkClient.h"
#include <string>
#include "../Misc/EventHandler/EventButton.h"
namespace DanBias
{
namespace Client
{
class LoginState : public GameClientState
{
private:
Oyster::Network::NetworkClient* nwClient;
struct myData;
myData* privData;
public:
LoginState(void);
~LoginState(void);
bool Init(Oyster::Network::NetworkClient* nwClient);
bool LoadModels(std::wstring file);
bool InitCamera(Oyster::Math::Float3 startPos);
ClientState Update(float deltaTime, InputClass* KeyInput);
static void ButtonCallback(Oyster::Event::ButtonEvent<LoginState*>& e);
bool Render(float dt);
bool Release();
void Protocol(ProtocolStruct* protocol)override;
void PlayerJoinProtocol(PlayerName* name);
};};};
#endif // ! DANBIAS_CLIENT_LOGINSTATE_H

View File

@ -0,0 +1,156 @@
#include "MainState.h"
#include "DllInterfaces/GFXAPI.h"
#include "OysterMath.h"
#include "C_obj/C_Player.h"
#include "C_obj/C_StaticObj.h"
#include "C_obj/C_DynamicObj.h"
#include <GameServerAPI.h>
#include "NetworkClient.h"
#include "EventHandler\EventHandler.h"
#include "Buttons\ButtonRectangle.h"
using namespace ::DanBias::Client;
using namespace ::Oyster;
using namespace ::Oyster::Math3D;
using namespace ::Oyster::Network;
using namespace ::Oyster::Event;
using namespace ::Utility::DynamicMemory;
using namespace ::Utility::StaticArray;
struct MainState::MyData
{
MyData() {}
GameClientState::ClientState nextState;
NetworkClient *nwClient;
Graphics::API::Texture background;
EventButtonCollection guiElements;
};
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e );
MainState::MainState(void) {}
MainState::~MainState(void)
{
if( this->privData )
this->Release();
}
bool MainState::Init( NetworkClient* nwClient )
{
this->privData = new MyData();
this->privData->nextState = GameClientState::ClientState_Same;
this->privData->nwClient = nwClient;
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
// create buttons
ButtonRectangle<MainState*> *button;
button = new ButtonRectangle<MainState*>( L"earth_md.png", L"Create", Float3(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( button );
button = new ButtonRectangle<MainState*>( L"skysphere_md.png", L"Join", Float3(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( button );
button = new ButtonRectangle<MainState*>( L"plane_texture_md.png", L"Quit", Float3(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width );
this->privData->guiElements.AddButton( button );
// bind button collection to the singleton eventhandler
EventHandler::Instance().AddCollection( &this->privData->guiElements );
return true;
}
float mouseX, mouseY; // debug test
GameClientState::ClientState MainState::Update(float deltaTime, InputClass* KeyInput)
{
MouseInput mouseState;
{
mouseState.x = KeyInput->GetPitch();
mouseState.y = KeyInput->GetYaw();
mouseState.mouseButtonPressed = KeyInput->IsMousePressed();
}
EventHandler::Instance().Update( mouseState );
mouseX = mouseState.x; // debug test
mouseY = mouseState.y; // debug test
return this->privData->nextState;
}
bool MainState::Render()
{
Graphics::API::NewFrame();
Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
this->privData->guiElements.RenderTexture();
Graphics::API::StartTextRender();
this->privData->guiElements.RenderText();
Graphics::API::RenderText( ::std::to_wstring(mouseX), Float2(0.2f, 0.5f), Float2(0.2f, 0.05f) ); // debug test
Graphics::API::RenderText( ::std::to_wstring(mouseY), Float2(0.5f, 0.5f), Float2(0.2f, 0.05f) ); // debug test
Graphics::API::EndFrame();
return true;
}
bool MainState::Release()
{
if( this->privData )
{
Graphics::API::DeleteTexture( this->privData->background ); // TODO: @todo bug caught when exiting by X
EventHandler::Instance().ReleaseCollection( &this->privData->guiElements );
this->privData = NULL;
// button collection will be autoreleased from EventHandler
}
return true;
}
void MainState::ChangeState( ClientState next )
{
this->privData->nextState = next;
}
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_LobbyCreate );
break;
default: break;
}
}
void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_Lan );
break;
default: break;
}
}
void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e )
{
switch( e.state )
{
case ButtonState_Released:
e.owner->ChangeState( GameClientState::ClientState_Quit );
break;
default: break;
}
}

View File

@ -0,0 +1,29 @@
#ifndef DANBIAS_CLIENT_MAINSTATE_H
#define DANBIAS_CLIENT_MAINSTATE_H
#include "GameClientState.h"
#include "OysterMath.h"
#include "NetworkClient.h"
#include <string>
namespace DanBias
{
namespace Client
{
class MainState : public GameClientState
{
private:
struct MyData;
::Utility::DynamicMemory::UniquePointer<MyData> privData;
public:
MainState(void);
~MainState(void);
bool Init( Oyster::Network::NetworkClient* nwClient );
ClientState Update(float deltaTime, InputClass* KeyInput);
bool Render();
bool Release();
void ChangeState( ClientState next );
};
}
}
#endif // ! DANBIAS_CLIENT_LOGINSTATE_H

View File

@ -15,8 +15,6 @@
#define NOMINMAX
#include <Windows.h>
namespace DanBias
{
extern "C"
@ -24,7 +22,7 @@ namespace DanBias
enum DanBiasClientReturn
{
DanBiasClientReturn_Error,
DanBiasClientReturn_Sucess,
DanBiasClientReturn_Success
};
struct DanBiasGameDesc
@ -49,19 +47,19 @@ namespace DanBias
static void Release();
private:
static HRESULT InitDirect3D();
static HRESULT InitInput();
enum Result
{
Result_continue,
Result_quit,
Result_error
};
static HRESULT Update(float deltaTime);
static HRESULT Render(float deltaTime);
static HRESULT InitDirect3D();
static HRESULT InitInput();
static Result Update(float deltaTime);
static HRESULT Render();
static HRESULT CleanUp();
static float capFrame;
private:
static DanBiasGamePrivateData* m_data;
};

View File

@ -80,7 +80,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
@ -96,7 +96,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -25,11 +25,11 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
gameDesc.hinst = hinst;
gameDesc.nCmdShow = cmdShow;
if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Sucess)
if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Success )
{
DanBias::DanBiasGame::Run();
DanBias::DanBiasGame::Release();
}
return cmdShow;
return 0;
}

View File

@ -80,7 +80,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)Game\GameServer;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)WindowManager\;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>

View File

@ -192,7 +192,7 @@ namespace GameLogic
struct Protocol_ObjectScale :public Oyster::Network::CustomProtocolObject
{
short object_ID;
float position[3];
float scale[3];
Protocol_ObjectScale()
{
@ -204,14 +204,14 @@ namespace GameLogic
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
object_ID = 0;
memset(&position[0], 0, sizeof(float) * 3);
memset(&scale[0], 0, sizeof(float) * 3);
}
Protocol_ObjectScale(Oyster::Network::CustomNetProtocol& p)
{
object_ID = p[1].value.netShort;
position[0] = p[2].value.netFloat;
position[1] = p[3].value.netFloat;
position[2] = p[4].value.netFloat;
scale[0] = p[2].value.netFloat;
scale[1] = p[3].value.netFloat;
scale[2] = p[4].value.netFloat;
}
Protocol_ObjectScale(float v[3], int id)
{
@ -223,14 +223,14 @@ namespace GameLogic
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
object_ID = id;
memcpy(&position[0], &v[0], sizeof(float) * 3);
memcpy(&scale[0], &v[0], sizeof(float) * 3);
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol[2].value = position[0];
this->protocol[3].value = position[1];
this->protocol[4].value = position[2];
this->protocol[2].value = scale[0];
this->protocol[3].value = scale[1];
this->protocol[4].value = scale[2];
return protocol;
}
@ -242,7 +242,7 @@ namespace GameLogic
struct Protocol_ObjectRotation :public Oyster::Network::CustomProtocolObject
{
short object_ID;
float position[3];
float rotationQ[4];
Protocol_ObjectRotation()
{
@ -252,18 +252,20 @@ namespace GameLogic
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
object_ID = 0;
memset(&position[0], 0, sizeof(float) * 3);
memset(&rotationQ[0], 0, sizeof(float) * 4);
}
Protocol_ObjectRotation(Oyster::Network::CustomNetProtocol& p)
{
object_ID = p[1].value.netShort;
position[0] = p[2].value.netFloat;
position[1] = p[3].value.netFloat;
position[2] = p[4].value.netFloat;
rotationQ[0] = p[2].value.netFloat;
rotationQ[1] = p[3].value.netFloat;
rotationQ[2] = p[4].value.netFloat;
rotationQ[3] = p[5].value.netFloat;
}
Protocol_ObjectRotation(float v[3], int id)
Protocol_ObjectRotation(float v[4], int id)
{
this->protocol[0].value = protocol_Gameplay_ObjectRotation;
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
@ -271,16 +273,18 @@ namespace GameLogic
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
object_ID = id;
memcpy(&position[0], &v[0], sizeof(float) * 3);
memcpy(&rotationQ[0], &v[0], sizeof(float) * 4);
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol[2].value = position[0];
this->protocol[3].value = position[1];
this->protocol[4].value = position[2];
this->protocol[2].value = rotationQ[0];
this->protocol[3].value = rotationQ[1];
this->protocol[4].value = rotationQ[2];
this->protocol[5].value = rotationQ[3];
return protocol;
}
@ -292,7 +296,7 @@ namespace GameLogic
{
short object_ID;
float position[3];
float rotation[4];
float rotationQ[4];
Protocol_ObjectPositionRotation()
{
@ -311,7 +315,7 @@ namespace GameLogic
this->object_ID = 0;
memset(&this->position[0], 0, sizeof(float) * 3);
memset(&this->rotation[0], 0, sizeof(float) * 4);
memset(&this->rotationQ[0], 0, sizeof(float) * 4);
}
Protocol_ObjectPositionRotation(Oyster::Network::CustomNetProtocol& p)
{
@ -321,10 +325,10 @@ namespace GameLogic
this->position[1] = p[3].value.netFloat;
this->position[2] = p[4].value.netFloat;
//ROTATION
this->rotation[0] = p[5].value.netFloat;
this->rotation[1] = p[6].value.netFloat;
this->rotation[2] = p[7].value.netFloat;
this->rotation[3] = p[8].value.netFloat;
this->rotationQ[0] = p[5].value.netFloat;
this->rotationQ[1] = p[6].value.netFloat;
this->rotationQ[2] = p[7].value.netFloat;
this->rotationQ[3] = p[8].value.netFloat;
}
Protocol_ObjectPositionRotation(float p[3], float r[4], int id)
{
@ -343,7 +347,7 @@ namespace GameLogic
object_ID = id;
memcpy(&this->position[0], &p[0], sizeof(float) * 3);
memcpy(&this->rotation[0], &r[0], sizeof(float) * 4);
memcpy(&this->rotationQ[0], &r[0], sizeof(float) * 4);
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
@ -351,10 +355,10 @@ namespace GameLogic
this->protocol[2].value = this->position[0];
this->protocol[3].value = this->position[1];
this->protocol[4].value = this->position[2];
this->protocol[5].value = this->rotation[0];
this->protocol[6].value = this->rotation[1];
this->protocol[7].value = this->rotation[2];
this->protocol[8].value = this->rotation[3];
this->protocol[5].value = this->rotationQ[0];
this->protocol[6].value = this->rotationQ[1];
this->protocol[7].value = this->rotationQ[2];
this->protocol[8].value = this->rotationQ[3];
return protocol;
}
@ -441,66 +445,82 @@ namespace GameLogic
//ObjectType type; //ie player, box or whatever
int object_ID;
std::string name;
float worldMatrix[16];
float position[3];
float rotationQ[4];
float scale[3];
Protocol_ObjectCreate()
{
this->protocol[0].value = protocol_Gameplay_ObjectCreate;
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
//NAME
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
for (int i = 3; i <= 18; i++)
{
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
}
}
Protocol_ObjectCreate(Oyster::Network::CustomNetProtocol& p)
{
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
//POSITION
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
//ROTATION
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
//SCALE
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
this->object_ID = 0;
memset(this->position, 0, sizeof(float) * 3);
memset(this->rotationQ, 0, sizeof(float) * 4);
}
Protocol_ObjectCreate(float m[16], int id, char *path)
Protocol_ObjectCreate( Oyster::Network::CustomNetProtocol& p )
{
/** @todo TODO: not implemented */
}
Protocol_ObjectCreate(float p[3], float r[4], float s[3], int id, char *path)
{
this->protocol[0].value = protocol_Gameplay_ObjectCreate;
this->protocol[0].type = Oyster::Network::NetAttributeType_Int;
//NAME
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
this->protocol[2].type = Oyster::Network::NetAttributeType_CharArray;
for (int i = 3; i <= 18; i++)
{
this->protocol[i].type = Oyster::Network::NetAttributeType_Float;
}
//POSITION
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
//ROTATION
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
//SCALE
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
object_ID = id;
this->name = path;
memcpy(&worldMatrix[0], &m[0], sizeof(float)*16);
memcpy(this->position, p, sizeof(float) * 3);
memcpy(this->rotationQ, r, sizeof(float) * 4);
memcpy(this->scale, s, sizeof(float) * 3);
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = object_ID;
this->protocol.Set(2, name);
this->protocol[3].value = worldMatrix[0];
this->protocol[4].value = worldMatrix[1];
this->protocol[5].value = worldMatrix[2];
this->protocol[6].value = worldMatrix[3];
this->protocol[7].value = worldMatrix[4];
this->protocol[8].value = worldMatrix[5];
this->protocol[9].value = worldMatrix[6];
this->protocol[10].value = worldMatrix[7];
this->protocol[11].value = worldMatrix[8];
this->protocol[12].value = worldMatrix[9];
this->protocol[13].value = worldMatrix[10];
this->protocol[14].value = worldMatrix[11];
this->protocol[15].value = worldMatrix[12];
this->protocol[16].value = worldMatrix[13];
this->protocol[17].value = worldMatrix[14];
this->protocol[18].value = worldMatrix[15];
this->protocol[3].value = this->position[0];
this->protocol[4].value = this->position[1];
this->protocol[5].value = this->position[2];
this->protocol[6].value = this->rotationQ[0];
this->protocol[7].value = this->rotationQ[1];
this->protocol[8].value = this->rotationQ[2];
this->protocol[9].value = this->rotationQ[3];
this->protocol[10].value = this->scale[0];
this->protocol[11].value = this->scale[1];
this->protocol[12].value = this->scale[2];
return protocol;
}

View File

@ -74,6 +74,7 @@
/************************************/
/*********** PROTOCOL MACROS ***************************************************************************************************/
/************************************/
inline bool ProtocolIsLobby(short ID) { return (ID >= protocol_LobbyMIN && ID <= protocol_LobbyMAX); }
inline bool ProtocolIsGeneral(short ID) { return (ID >= protocol_GeneralMIN && ID <= protocol_GeneralMAX); }
inline bool ProtocolIsGameplay(short ID) { return (ID >= protocol_GameplayMIN && ID <= protocol_GameplayMAX); }

View File

@ -83,7 +83,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;$(SolutionDir)OysterPhysics3D\;$(SolutionDir)Game\ServerDependencies;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(SolutionDir)..\External\Lib\ServerDependencies\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(SolutionDir)..\External\Lib\ServerDependencies\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
@ -99,7 +99,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Game\GameLogic\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)OysterMath\;$(SolutionDir)GamePhysics\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;$(SolutionDir)OysterPhysics3D\;$(SolutionDir)Game\ServerDependencies;C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(SolutionDir)..\External\Lib\ServerDependencies\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir);$(SolutionDir)..\External\Lib\WindowManager\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(SolutionDir)..\External\Lib\ServerDependencies\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -200,6 +200,9 @@
<ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
</ProjectReference>
<ProjectReference Include="..\..\WindowManager\WindowManager.vcxproj">
<Project>{35aea3c0-e0a7-4e1e-88cd-514aa5a442b1}</Project>
</ProjectReference>
<ProjectReference Include="..\GameLogic\GameLogic.vcxproj">
<Project>{b1195bb9-b3a5-47f0-906c-8dea384d1520}</Project>
</ProjectReference>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -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

View File

@ -161,7 +161,11 @@ namespace DanBias
{
if((this->clients[k] && readyList[i]) && readyList[i]->GetClient()->GetID() != this->clients[k]->GetClient()->GetID())
{
Protocol_ObjectCreate p(this->clients[k]->GetPlayer()->GetOrientation(), this->clients[k]->GetPlayer()->GetID(), "char_temporary.dan"); //The model name will be custom later..
//Protocol_ObjectCreatePlayer
Protocol_ObjectCreate p( this->clients[k]->GetPlayer()->GetPosition(),
this->clients[k]->GetPlayer()->GetRotation(),
this->clients[k]->GetPlayer()->GetScale(),
this->clients[k]->GetPlayer()->GetID(), "char_white.dan"); //The model name will be custom later..
readyList[i]->GetClient()->Send(p);
}
}

View File

@ -80,7 +80,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Game\GameServer;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
@ -96,7 +96,7 @@
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;C:\Program Files %28x86%29\Visual Leak Detector\include;$(SolutionDir)Game\GameServer;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
<LibraryPath>$(OutDir)..\DLL\;C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

View File

@ -84,7 +84,7 @@ namespace Oyster
type = p.type;
if(type == NetAttributeType_CharArray && p.value.netCharPtr)
{
int len = 0;
size_t len = 0;
if((len = strlen(p.value.netCharPtr)) == 0) return;
len++;
value.netCharPtr = new char[len];
@ -106,7 +106,7 @@ namespace Oyster
type = p.type;
if(type == NetAttributeType_CharArray && p.value.netCharPtr)
{
int len = 0;
size_t len = 0;
if((len = strlen(p.value.netCharPtr)) == 0) return *this;
len++;
value.netCharPtr = new char[len];

View File

@ -35,6 +35,8 @@ using namespace std;
*************************************/
typedef NetworkClient::ClientEventArgs CEA;
void OnRecieve_Default(NetEvent<NetworkClient*, NetworkClient::ClientEventArgs> e) {}
struct NetworkClient::PrivateData : public IThreadObject
{
NetworkSession *owner;
@ -58,7 +60,6 @@ struct NetworkClient::PrivateData : public IThreadObject
, parent(0)
, owner(0)
{
InitWinSock();
this->thread.Create(this, false);
this->thread.SetPriority(Oyster::Thread::OYSTER_THREAD_PRIORITY_1);
@ -226,7 +227,8 @@ unsigned int NetworkClient::PrivateData::currID = 0;
*************************************/
NetworkClient::NetworkClient()
: privateData(0)
: privateData(nullptr),
OnRecieve(OnRecieve_Default)
{ }
NetworkClient::~NetworkClient()
@ -333,6 +335,18 @@ void NetworkClient::SetOwner(NetworkSession* owner)
this->privateData->owner = owner;
}
void NetworkClient::SetMessagePump( NetworkClient::ClientEventFunction func )
{
if( func )
{
this->OnRecieve = func;
}
else
{
this->OnRecieve = OnRecieve_Default;
}
}
bool NetworkClient::IsConnected()
{
if(!this->privateData) return false;
@ -350,6 +364,10 @@ void NetworkClient::DataRecieved(NetEvent<NetworkClient*, ClientEventArgs> e)
{
this->privateData->owner->ClientEventCallback(e);
}
else
{
this->OnRecieve( e );
}
}
//void NetworkClient::NetworkCallback(Oyster::Network::CustomNetProtocol& p)

View File

@ -113,6 +113,11 @@ namespace Oyster
*/
void SetOwner(NetworkSession* owner);
/**
*
*/
void SetMessagePump( ClientEventFunction func );
/**
*
*/
@ -140,6 +145,7 @@ namespace Oyster
NetworkClient(const NetworkClient& obj);
NetworkClient& operator =(const NetworkClient& obj);
ClientEventFunction OnRecieve;
struct PrivateData;
PrivateData* privateData;
};

View File

@ -47,7 +47,7 @@ struct Translator::PrivateData
headerString.push_back(it->type);
}
message.PackShort(headerString.size(), bytes);
message.PackShort((short)headerString.size(), bytes);
size += 2;
for(int i = 0; i < (int)headerString.size(); i++)

View File

@ -125,17 +125,17 @@ namespace std
}
/*******************************************************************
* @param numerator of the vector vec
* @return the denomiator of the vector vec.
* @param integer part of the elements in vector vec
* @return the fract part of the elements in vector vec.
*******************************************************************/
template<typename ScalarType>
inline ::LinearAlgebra::Vector3<ScalarType> modf( const ::LinearAlgebra::Vector3<ScalarType> &vec, ::LinearAlgebra::Vector3<ScalarType> &numerator )
inline ::LinearAlgebra::Vector3<ScalarType> modf( const ::LinearAlgebra::Vector3<ScalarType> &vec, ::LinearAlgebra::Vector3<ScalarType> &integer )
{
::LinearAlgebra::Vector3<ScalarType> denominator;
denominator.x = (ScalarType)modf( vec.x, &numerator.x );
denominator.y = (ScalarType)modf( vec.y, &numerator.y );
denominator.z = (ScalarType)modf( vec.z, &numerator.z );
return denominator;
::LinearAlgebra::Vector3<ScalarType> fract;
fract.x = (ScalarType)modf( vec.x, &integer.x );
fract.y = (ScalarType)modf( vec.y, &integer.y );
fract.z = (ScalarType)modf( vec.z, &integer.z );
return fract;
}
/*******************************************************************
@ -392,6 +392,25 @@ namespace LinearAlgebra3D
// return ::std::asin( ::LinearAlgebra::Vector4<ScalarType>(orientationMatrix.v[1].z, orientationMatrix.v[2].x, orientationMatrix.v[0].y, 0) );
//}
template<typename ScalarType>
inline ::LinearAlgebra::Matrix4x4<ScalarType> ScalingMatrix( const ::LinearAlgebra::Vector3<ScalarType> &s )
{
return ::LinearAlgebra::Matrix4x4<ScalarType>( s.x, 0, 0, 0,
0, s.y, 0, 0,
0, 0, s.z, 0,
0, 0, 0, 1 );
}
template<typename ScalarType>
inline ::LinearAlgebra::Matrix4x4<ScalarType> ScalingMatrix( const ::LinearAlgebra::Vector4<ScalarType> &s )
{
return ::LinearAlgebra::Matrix4x4<ScalarType>( s.x, 0, 0, 0,
0, s.y, 0, 0,
0, 0, s.z, 0,
0, 0, 0, s.w );
}
template<typename ScalarType>
inline ::LinearAlgebra::Matrix4x4<ScalarType> & TranslationMatrix( const ::LinearAlgebra::Vector3<ScalarType> &position, ::LinearAlgebra::Matrix4x4<ScalarType> &targetMem = ::LinearAlgebra::Matrix4x4<ScalarType>() )
{
@ -451,6 +470,17 @@ namespace LinearAlgebra3D
}
}
template<typename ScalarType>
inline ::LinearAlgebra::Matrix3x3<ScalarType> & RotationMatrix( const ::LinearAlgebra::Quaternion<ScalarType> &rotationQuaternion, ::LinearAlgebra::Matrix3x3<ScalarType> &targetMem = ::LinearAlgebra::Matrix3x3<ScalarType>() )
{
::LinearAlgebra::Quaternion<ScalarType> conjugate = rotationQuaternion.GetConjugate();
targetMem.v[0] = (rotationQuaternion * ::LinearAlgebra::Vector3<ScalarType>(1,0,0) * conjugate).imaginary;
targetMem.v[1] = (rotationQuaternion * ::LinearAlgebra::Vector3<ScalarType>(0,1,0) * conjugate).imaginary;
targetMem.v[2] = (rotationQuaternion * ::LinearAlgebra::Vector3<ScalarType>(0,0,1) * conjugate).imaginary;
return targetMem;
}
template<typename ScalarType>
inline ::LinearAlgebra::Matrix4x4<ScalarType> & RotationMatrix( const ::LinearAlgebra::Quaternion<ScalarType> &rotationQuaternion, ::LinearAlgebra::Matrix4x4<ScalarType> &targetMem = ::LinearAlgebra::Matrix4x4<ScalarType>() )
{
@ -790,7 +820,7 @@ namespace LinearAlgebra3D
{ return normalizedAxis * ( vector.Dot(normalizedAxis) ); }
template<typename ScalarType>
::LinearAlgebra::Vector4<ScalarType> & SnapAngularAxis( ::LinearAlgebra::Vector4<ScalarType> &startAngularAxis, const ::LinearAlgebra::Vector4<ScalarType> &localStartNormal, const ::LinearAlgebra::Vector4<ScalarType> &worldEndNormal, ::LinearAlgebra::Vector4<ScalarType> &targetMem = ::LinearAlgebra::Vector4<ScalarType>() )
::LinearAlgebra::Vector4<ScalarType> & SnapAngularAxis( const ::LinearAlgebra::Vector4<ScalarType> &startAngularAxis, const ::LinearAlgebra::Vector4<ScalarType> &localStartNormal, const ::LinearAlgebra::Vector4<ScalarType> &worldEndNormal, ::LinearAlgebra::Vector4<ScalarType> &targetMem = ::LinearAlgebra::Vector4<ScalarType>() )
{
::LinearAlgebra::Vector4<ScalarType> worldStartNormal( WorldAxisOf(Rotation(startAngularAxis.xyz), localStartNormal.xyz), (ScalarType)0 );
targetMem = ::LinearAlgebra::Vector4<ScalarType>( worldStartNormal.xyz.Cross(worldEndNormal.xyz), (ScalarType)0);
@ -799,11 +829,12 @@ namespace LinearAlgebra3D
}
template<typename ScalarType>
::LinearAlgebra::Vector3<ScalarType> & SnapAngularAxis( ::LinearAlgebra::Vector3<ScalarType> &startAngularAxis, const ::LinearAlgebra::Vector3<ScalarType> &localStartNormal, const ::LinearAlgebra::Vector3<ScalarType> &worldEndNormal, ::LinearAlgebra::Vector3<ScalarType> &targetMem = ::LinearAlgebra::Vector3<ScalarType>() )
::LinearAlgebra::Vector3<ScalarType> & SnapAngularAxis( const ::LinearAlgebra::Vector3<ScalarType> &startAngularAxis, const ::LinearAlgebra::Vector3<ScalarType> &localStartNormal, const ::LinearAlgebra::Vector3<ScalarType> &worldEndNormal, ::LinearAlgebra::Vector3<ScalarType> &targetMem = ::LinearAlgebra::Vector3<ScalarType>() )
{
return targetMem = SnapAngularAxis( ::LinearAlgebra::Vector4<ScalarType>(startAngularAxis, (ScalarType)0),
::LinearAlgebra::Vector4<ScalarType>(localStartNormal, (ScalarType)0),
::LinearAlgebra::Vector4<ScalarType>(worldEndNormal, (ScalarType)0) ).xyz;
::LinearAlgebra::Vector3<ScalarType> worldStartNormal( WorldAxisOf(Rotation(startAngularAxis), localStartNormal) );
targetMem = worldStartNormal.Cross( worldEndNormal );
targetMem *= (ScalarType)::std::acos( ::Utility::Value::Clamp(worldStartNormal.Dot(worldEndNormal), (ScalarType)0, (ScalarType)1) );
return targetMem += startAngularAxis;
}
template<typename ScalarType>

View File

@ -167,6 +167,11 @@ namespace Oyster { namespace Math3D
return ::LinearAlgebra3D::Rotation( angularAxis );
}
Float3x3 & RotationMatrix( const Quaternion &rotationQuaternion, Float3x3 &targetMem )
{
return ::LinearAlgebra3D::RotationMatrix( rotationQuaternion, targetMem );
}
Float4x4 & RotationMatrix( const Quaternion &rotationQuaternion, Float4x4 &targetMem )
{
return ::LinearAlgebra3D::RotationMatrix( rotationQuaternion, targetMem );

View File

@ -170,6 +170,9 @@ namespace Oyster { namespace Math3D //! Oyster's native math library specialized
/** @todo TODO: add doc */
Quaternion Rotation( const Float4 &angularAxis );
/** @todo TODO: add doc */
Float3x3 & RotationMatrix( const Quaternion &rotationQuaternion, Float3x3 &targetMem );
/** @todo TODO: add doc */
Float4x4 & RotationMatrix( const Quaternion &rotationQuaternion, Float4x4 &targetMem = Float4x4() );
@ -334,6 +337,8 @@ namespace Oyster { namespace Math3D //! Oyster's native math library specialized
using ::LinearAlgebra3D::InterpolateOrientation_UsingRigidNlerp;
using ::LinearAlgebra3D::InterpolateOrientation_UsingSlerp;
using ::LinearAlgebra3D::SnapAngularAxis;
using ::LinearAlgebra3D::WorldAxisOf;
using ::LinearAlgebra3D::ScalingMatrix;
} }
#endif

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,47 @@
namespace StandAloneLauncher
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(791, 318);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StandAloneLauncher
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StandAloneLauncher
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StandAloneLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StandAloneLauncher")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("097f66eb-157a-4774-8b3f-be55646a6398")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StandAloneLauncher.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StandAloneLauncher.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StandAloneLauncher.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{604A12A7-07BF-4482-BDF3-7101C811F121}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StandAloneLauncher</RootNamespace>
<AssemblyName>StandAloneLauncher</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CLIStandaloneServer\CLIStandaloneServer.vcxproj">
<Project>{c8cba520-5d7d-4d61-a8da-6e05fd132bcb}</Project>
<Name>CLIStandaloneServer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>