GameLogic - Pre-network merge

This commit is contained in:
dean11 2013-12-12 09:33:59 +01:00
parent d95d771c43
commit fd3776a53b
32 changed files with 736 additions and 520 deletions

View File

@ -0,0 +1,2 @@
port 15151
clients 200

View File

@ -0,0 +1,4 @@
ServerInit ..\Settings\ServerInit.ini
More a
more b
more c

View File

@ -101,6 +101,7 @@ Global
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Debug|x64
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Debug|x64
{35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64
@ -112,7 +113,6 @@ Global
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Release|x64
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Debug|Win32
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Debug|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Debug|x64
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Debug|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Debug|x64
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|x64
@ -124,6 +124,7 @@ Global
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Debug|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Debug|x64
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64
@ -207,6 +208,7 @@ Global
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.ActiveCfg = Debug|Win32 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.ActiveCfg = Debug|Win32
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|Win32.Build.0 = Debug|Win32
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.ActiveCfg = Debug|x64 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.ActiveCfg = Debug|x64
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.Build.0 = Debug|x64 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Debug|x64.Build.0 = Debug|x64
{52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {52380DAA-0F4A-4D97-8E57-98DF39319CAF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
@ -229,6 +231,7 @@ Global
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.ActiveCfg = Debug|Win32
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|Win32.Build.0 = Debug|Win32
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.ActiveCfg = Debug|x64
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Debug|x64.Build.0 = Debug|x64
{460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {460D625F-2AC9-4559-B809-0BA89CEAEDF4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
@ -240,6 +243,7 @@ Global
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.ActiveCfg = Debug|Win32
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|Win32.Build.0 = Debug|Win32
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.ActiveCfg = Debug|x64
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Debug|x64.Build.0 = Debug|x64
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {DA2AA800-ED64-4649-8B3B-E7F1E3968B78}.Release|Mixed Platforms.ActiveCfg = Release|Win32

View File

@ -10,9 +10,7 @@
#define NOMINMAX #define NOMINMAX
#include <Windows.h> #include <Windows.h>
#define DANBIAS_CLIENT
#include "L_inputClass.h"
namespace DanBias namespace DanBias
{ {
@ -25,8 +23,6 @@ namespace DanBias
DanBiasClientReturn_Sucess, DanBiasClientReturn_Sucess,
}; };
struct DanBiasGameDesc struct DanBiasGameDesc
{ {
//Stuff goes here... //Stuff goes here...

View File

@ -71,32 +71,32 @@
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <LibraryPath>$(OutDir)..\DLL\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <LibraryPath>$(OutDir)..\DLL\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <LibraryPath>$(OutDir)..\DLL\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <LibraryPath>$(OutDir)..\DLL\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -105,13 +105,13 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>DanBiasGame_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -121,13 +121,13 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>DanBiasGame_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -139,7 +139,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -147,7 +147,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -159,7 +159,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -167,34 +167,16 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Launcher.cpp" /> <ClCompile Include="Launcher.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
</ProjectReference>
<ProjectReference Include="..\..\Input\Input.vcxproj">
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
</ProjectReference>
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
</ProjectReference>
<ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
</ProjectReference>
<ProjectReference Include="..\DanBiasGame\DanBiasGame.vcxproj"> <ProjectReference Include="..\DanBiasGame\DanBiasGame.vcxproj">
<Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project> <Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\DanBiasServer\DanBiasServer.vcxproj">
<Project>{52380daa-0f4a-4d97-8e57-98df39319caf}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -4,16 +4,10 @@
#define NOMINMAX #define NOMINMAX
#include <Windows.h> #include <Windows.h>
//#define DANBIAS_SERVER #include "DanBiasServerAPI.h"
#define DANBIAS_CLIENT //#include "DanBiasGame.h"
#if defined(DANBIAS_SERVER)
#include "IDanBiasServer.h"
#elif defined(DANBIAS_CLIENT)
#include "DanBiasGame.h"
#endif
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow) int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
{ {
#if defined(DANBIAS_SERVER) #if defined(DANBIAS_SERVER)
@ -21,14 +15,10 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
{ {
return cmdShow; return cmdShow;
} }
// Server starter code goes here if( DanBias::DanBiasServerAPI::Initiate() == DanBias::DanBiasServerReturn_Sucess)
DanBias::DanBiasServerDesc desc;
desc.port = 0;
if( DanBias::DanBiasServer::Initiate(desc) == DanBias::DanBiasServerReturn_Sucess)
{ {
DanBias::DanBiasServer::Run(); DanBias::DanBiasServerAPI::Run();
DanBias::DanBiasServer::Release(); DanBias::DanBiasServerAPI::Release();
} }
#elif defined(DANBIAS_CLIENT) #elif defined(DANBIAS_CLIENT)
if(SetDllDirectory(L"..\\DLL") == FALSE) if(SetDllDirectory(L"..\\DLL") == FALSE)

View File

@ -1,56 +0,0 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include <Windows.h>
#include "DBServer.h"
//#include "GameLogic\?"
#include "Utilities.h"
using namespace DanBias;
DBServer::DBServer()
: initiated(0)
, running(0)
, released(0)
{
}
DBServer::~DBServer()
{
}
DanBiasServerReturn DBServer::Create(const DanBias::DanBiasServerDesc& desc)
{
this->initiated = true;
return DanBiasServerReturn_Sucess;
}
DanBiasServerReturn DBServer::Run()
{
if(this->running)
{
return DanBiasServerReturn_Error;
}
if(this->released)
{
return DanBiasServerReturn_Error;
}
if(!this->initiated)
{
return DanBiasServerReturn_Error;
}
this->running = true;
while (this->running)
{
MessageBox(0, L"What to do here...", L"TYPELESS", 0);
this->running = false;
}
return DanBiasServerReturn_Sucess;
}
DanBiasServerReturn DBServer::Release()
{
this->released = true;
return DanBiasServerReturn_Sucess;
}

View File

@ -1,27 +0,0 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef DANBIASSERVER_DBSERVER_H
#define DANBIASSERVER_DBSERVER_H
#include "Include\IDanBiasServer.h"
namespace DanBias
{
class DBServer
{
public:
DBServer();
~DBServer();
DanBiasServerReturn Create(const DanBias::DanBiasServerDesc& desc);
DanBiasServerReturn Run();
DanBiasServerReturn Release();
private:
bool initiated;
bool running;
bool released;
};
}// End namspace DanBias
#endif // !DANBIASSERVER_DBSERVER_H

View File

@ -3,6 +3,6 @@
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved ) BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
{ {
MessageBox(0, L"DanBiasServer Loaded", 0, 0);
return TRUE; return TRUE;
} }

View File

@ -73,28 +73,32 @@
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;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;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;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;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;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;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir> <OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)..\External\Include\;$(SolutionDir)Game\GameProtocols\;$(SolutionDir)Network\NetworkAPI\;$(SolutionDir)Misc\;$(SolutionDir)WindowManager\;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;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -102,13 +106,15 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -117,13 +123,15 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;WindowManager_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -134,8 +142,9 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -143,6 +152,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -153,8 +163,9 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -162,18 +173,28 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;WindowManager_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="IDanBiasServer.cpp" /> <ClCompile Include="Include\DanBiasServerAPI.cpp" />
<ClCompile Include="DLLMain.cpp" /> <ClCompile Include="DLLMain.cpp" />
<ClCompile Include="DBServer.cpp" /> <ClCompile Include="GameServer.cpp" />
<ClCompile Include="ServerObjects\ClientObject.cpp" />
<ClCompile Include="ServerObjects\Lobby\GameLobby.cpp" />
<ClCompile Include="ServerObjects\GameSession.cpp" />
<ClCompile Include="ServerObjects\Lobby\MainLobby.cpp" />
<ClCompile Include="ServerObjects\NetworkSession.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DBServer.h" /> <ClInclude Include="GameServer.h" />
<ClInclude Include="Include\IDanBiasServer.h" /> <ClInclude Include="Include\DanBiasServerAPI.h" />
<ClInclude Include="Include\ServerWrapper.h" /> <ClInclude Include="ServerInitReader.h" />
<ClInclude Include="MainLobby.h" /> <ClInclude Include="ServerObjects\ClientObject.h" />
<ClInclude Include="ServerObjects\GameSession.h" />
<ClInclude Include="ServerObjects\Lobby\GameLobby.h" />
<ClInclude Include="ServerObjects\Lobby\MainLobby.h" />
<ClInclude Include="ServerObjects\NetworkSession.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Misc\Misc.vcxproj"> <ProjectReference Include="..\..\Misc\Misc.vcxproj">

View File

@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#include <Windows.h>
#include <WindowShell.h>
#include "GameServer.h"
#include "Utilities.h"
#include "ServerInitReader.h"
namespace DanBias
{
using namespace Oyster::Network;
//void GameServer::ClientConnectCallbackFunction(Oyster::Network::NetworkClient& connectedClient)
//{
// if(
//}
void GameServer::ClientConnectCallback(NetworkClient &client)
{
}
GameServer::GameServer()
: initiated(0)
, running(0)
, released(0)
, maxClients(0)
, mainLobby(0)
, server(0)
{
}
GameServer::~GameServer()
{
}
DanBiasServerReturn GameServer::Create()
{
this->server = new NetworkServer();
this->mainLobby = new MainLobby();
InitData data;
if(!LoadIniFile(data)) return DanBiasServerReturn_Error;
NetworkServer::INIT_DESC serverDesc;
serverDesc.port = data.port;
this->maxClients = data.clients;
serverDesc.callback = this;
if(!this->server->Init(serverDesc)) return DanBiasServerReturn_Error;
if(!WindowShell::CreateConsoleWindow()) return DanBiasServerReturn_Error;
if(!WindowShell::CreateWin(WindowShell::WINDOW_INIT_DESC())) return DanBiasServerReturn_Error;
this->initiated = true;
return DanBiasServerReturn_Sucess;
}
DanBiasServerReturn GameServer::Run()
{
if(this->running) return DanBiasServerReturn_Error;
if(this->released) return DanBiasServerReturn_Error;
if(!this->initiated) return DanBiasServerReturn_Error;
this->running = true;
while (this->running)
{
if(!WindowShell::Frame())
break;
}
return DanBiasServerReturn_Sucess;
}
DanBiasServerReturn GameServer::Release()
{
this->released = true;
return DanBiasServerReturn_Sucess;
}
bool GameServer::LoadIniFile(InitData& ini)
{
std::ifstream in;
std::string f = GetInitPath(InitPath_ServerIni);
in.open(f, std::ios::in);
if(!in.is_open()) return false;
std::string buffer;
while (!in.eof())
{
in >> buffer;
if(buffer == "port")
{
in >> ini.port;
}
else if(buffer == "clients")
{
in >> ini.clients;
}
}
in.close();
return true;
}
}//End namespace DanBias

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef DANBIASSERVER_GAME_SERVER_H
#define DANBIASSERVER_GAME_SERVER_H
#include <vld.h>
#include "Include\DanBiasServerAPI.h"
#include "ServerObjects\Lobby\MainLobby.h"
#include <NetworkServer.h>
#include <NetworkCallbackHelper.h>
namespace DanBias
{
class GameServer :public Oyster::Network::ClientConnectedObject
{
public:
GameServer();
~GameServer();
DanBiasServerReturn Create();
DanBiasServerReturn Run();
DanBiasServerReturn Release();
private:
//static void ClientConnectCallbackFunction(Oyster::Network::NetworkClient& connectedClient);
void ClientConnectCallback(Oyster::Network::NetworkClient &client) override;
bool initiated;
bool running;
bool released;
int maxClients;
MainLobby *mainLobby;
Oyster::Network::NetworkServer *server;
private:
struct InitData
{
int port;
int clients;
};
bool LoadIniFile(InitData&);
};
}// End namspace DanBias
#endif // !DANBIASSERVER_DBSERVER_H

View File

@ -1,26 +1,26 @@
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013] // Created by [Dennis Andersen] [2013]
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
#include "Include\IDanBiasServer.h" #include "DanBiasServerAPI.h"
#include "DBServer.h" #include "..\GameServer.h"
namespace DanBias namespace DanBias
{ {
#pragma region Server Data #pragma region Server Data
static DBServer server; static GameServer server;
#pragma endregion #pragma endregion
DanBiasServerReturn DanBiasServer::Initiate(DanBiasServerDesc& desc) DanBiasServerReturn DanBiasServerAPI::Initiate()
{ {
return server.Create(desc); return server.Create();
} }
DanBiasServerReturn DanBiasServer::Run() DanBiasServerReturn DanBiasServerAPI::Run()
{ {
return server.Run(); return server.Run();
} }
DanBiasServerReturn DanBiasServer::Release() DanBiasServerReturn DanBiasServerAPI::Release()
{ {
return server.Release(); return server.Release();
} }

View File

@ -4,8 +4,9 @@
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H #ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
#define DANBIAS_SERVER_DANBIAS_SERVER_H #define DANBIAS_SERVER_DANBIAS_SERVER_H
#define DANBIAS_SERVER
#if defined (DANBIAS_SERVER_DLL_EXPORT) #ifdef DANBIAS_SERVER_DLL_EXPORT
#define DANBIAS_SERVER_DLL __declspec(dllexport) #define DANBIAS_SERVER_DLL __declspec(dllexport)
#else #else
#define DANBIAS_SERVER_DLL __declspec(dllimport) #define DANBIAS_SERVER_DLL __declspec(dllimport)
@ -13,28 +14,21 @@
namespace DanBias namespace DanBias
{ {
enum DanBiasServerReturn
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
};
extern "C" extern "C"
{ {
enum DanBiasServerReturn class DANBIAS_SERVER_DLL DanBiasServerAPI
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
};
struct DanBiasServerDesc
{
//Stuff goes here...
int port;
};
class DANBIAS_SERVER_DLL DanBiasServer
{ {
public: public:
static DanBiasServerReturn Initiate(DanBiasServerDesc& desc); static DanBiasServerReturn Initiate();
static DanBiasServerReturn Run(); static DanBiasServerReturn Run();
static DanBiasServerReturn Release(); static DanBiasServerReturn Release();
}; };//End class DanBiasServer
}//End Extern "C" }//End Extern "C"
} //End namspace DanBias } //End namspace DanBias

View File

@ -1,23 +0,0 @@
#ifndef NETWORK_SERVER_WRAPPER_H
#define NETWORK_SERVER_WRAPPER_H
class SingletonServer
{
public:
struct INIT_DESC
{
bool l;
};
void CreateServer(/*DATA*/);
void StartServer(/*DATA*/);
void StopServer(/*DATA*/);
void TerminateServer(/*DATA*/);
void AttachLobby(/*LOBBY*/);
void DetachLobby(/*LOBBY*/);
void KickClient(/*CLIENT*/);
};
#endif // !NETWORK_SERVER_WRAPPER_H

View File

@ -1,17 +0,0 @@
#ifndef DANBIASGAME_GAMELOBBY_H
#define DANBIASGAME_GAMELOBBY_H
#include "Include\ServerWrapper.h"
class MainLobby :public SingletonServer
{
public:
MainLobby();
~MainLobby();
private:
};
#endif // !DANBIASGAME_GAMELOBBY_H

View File

@ -0,0 +1,41 @@
#ifndef DANBIASSERVER_SERVER_INIT_READER_H
#define DANBIASSERVER_SERVER_INIT_READER_H
#include <fstream>
#include <string>
namespace DanBias
{
enum InitPath
{
InitPath_ServerIni,
};
std::string GetInitPath(InitPath file)
{
std::string type = "";
std::string path = "";
std::string flag = "";
switch (file)
{
case DanBias::InitPath_ServerIni:
flag = "ServerInit";
break;
}
std::fstream in;
in.open("..\\Settings\\serversearchpath.ini", std::ios::in);
if(!in.is_open()) return "";
while (!in.eof() && type != flag)
{
in >> type;
in >> path;
}
in.close();
return path;
}
}
#endif // !DANBIASSERVER_SERVER_INIT_READER_H

View File

@ -0,0 +1,12 @@
#include "ClientObject.h"
using namespace DanBias;
ClientObject::ClientObject()
{
}
ClientObject::~ClientObject()
{
}

View File

@ -0,0 +1,19 @@
#ifndef DANBIASSERVER_CLIENT_OBJECT_H
#define DANBIASSERVER_CLIENT_OBJECT_H
#include "NetworkClient.h"
namespace DanBias
{
class ClientObject
{
public:
ClientObject();
~ClientObject();
private:
};
}//End namespace DanBias
#endif // !DANBIASSERVER_CLIENT_OBJECT_H

View File

@ -0,0 +1,9 @@
namespace DanBias
{
}//End namespace DanBias

View File

@ -0,0 +1,19 @@
#ifndef DANBIASSERVER_GAME_SESSION_H
#define DANBIASSERVER_GAME_SESSION_H
#include "NetworkSession.h"
namespace DanBias
{
class GameSession :public NetworkSession
{
public:
GameSession();
~GameSession();
private:
};//End GameSession
}//End namespace DanBias
#endif // !DANBIASSERVER_GAME_SESSION_H

View File

@ -0,0 +1,18 @@
#include "GameLobby.h"
namespace DanBias
{
GameLobby::GameLobby()
{
}
GameLobby::~GameLobby()
{
}
void GameLobby::Release()
{
}
}//End namespace DanBias

View File

@ -0,0 +1,21 @@
#ifndef DANBIASSERVER_GAME_LOBBY_H
#define DANBIASSERVER_GAME_LOBBY_H
#include "..\NetworkSession.h"
namespace DanBias
{
class GameLobby :public NetworkSession
{
public:
GameLobby();
~GameLobby();
void Release();
private:
};
}//End namespace DanBias
#endif // !DANBIASSERVER_GAME_LOBBY_H

View File

@ -0,0 +1,18 @@
#include "MainLobby.h"
namespace DanBias
{
MainLobby::MainLobby()
{
}
MainLobby::~MainLobby()
{
}
void MainLobby::Release()
{
}
}//End namespace DanBias

View File

@ -0,0 +1,22 @@
#ifndef DANBIASGAME_GAMELOBBY_H
#define DANBIASGAME_GAMELOBBY_H
#include "..\NetworkSession.h"
#include <thread>
#include <future>
namespace DanBias
{
class MainLobby :public NetworkSession
{
public:
MainLobby();
~MainLobby();
void Release();
private:
};
}//End namespace DanBias
#endif // !DANBIASGAME_GAMELOBBY_H

View File

@ -0,0 +1,36 @@
#include "NetworkSession.h"
namespace DanBias
{
NetworkSession::NetworkSession()
{
}
NetworkSession::~NetworkSession()
{
}
void NetworkSession::AttachClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client)
{
}
void NetworkSession::DetachClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client)
{
}
void NetworkSession::DetachClient(short ID)
{
}
void NetworkSession::Kick(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client)
{
}
void NetworkSession::Kick()
{
}
Oyster::Network::NetworkClient* NetworkSession::operator[](int Identification)
{
return 0;
}
}//End namespace DanBias

View File

@ -0,0 +1,37 @@
#ifndef DANBIASSERVER_NETWORK_SESSION_H
#define DANBIASSERVER_NETWORK_SESSION_H
#include "Utilities.h"
#include "ClientObject.h"
#include <PlayerProtocols.h>
#include <vector>
namespace DanBias
{
class NetworkSession
{
public:
NetworkSession();
~NetworkSession();
void AttachClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client);
void DetachClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client);
void DetachClient(short ID);
void Kick(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client);
void Kick();
void Send(Network::CustomNetProtocol& protocol);
void Send(Network::CustomNetProtocol& protocol, int ID);
//TODO: Do more lobby features
protected:
Oyster::Network::NetworkClient* operator[](int Identification);
private:
std::vector<Utility::DynamicMemory::SmartPointer<ClientObject>> clients;
};
}//End namespace DanBias
#endif // !DANBIASSERVER_NETWORK_SESSION_H

View File

@ -1,7 +1,12 @@
//////////////////////////////////////////////////////////
// Created 2013 //
// Dennis Andersen, Linda Andersson //
//////////////////////////////////////////////////////////
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H #ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
#define GAMELOGIC_PLAYER_PROTOCOLS_H #define GAMELOGIC_PLAYER_PROTOCOLS_H
#include "CustomNetProtocol.h" #include <CustomNetProtocol.h>
#include "ProtocolIdentificationID.h" #include "ProtocolIdentificationID.h"
@ -20,24 +25,24 @@ namespace GameLogic
Protocol_PlayerMovement() Protocol_PlayerMovement()
{ {
protocol[0]->value = ProtocolID = protocol_PlayerNavigation; this->protocol[0].value = ProtocolID = protocol_PlayerNavigation;
protocol[0]->type = Network::NetAttributeType_Int; this->protocol[0].type = Network::NetAttributeType_Int;
protocol[1]->type = Network::NetAttributeType_Bool; this->protocol[1].type = Network::NetAttributeType_Bool;
protocol[2]->type = Network::NetAttributeType_Bool; this->protocol[2].type = Network::NetAttributeType_Bool;
protocol[3]->type = Network::NetAttributeType_Bool; this->protocol[3].type = Network::NetAttributeType_Bool;
protocol[4]->type = Network::NetAttributeType_Bool; this->protocol[4].type = Network::NetAttributeType_Bool;
protocol[5]->type = Network::NetAttributeType_Bool; this->protocol[5].type = Network::NetAttributeType_Bool;
protocol[6]->type = Network::NetAttributeType_Bool; this->protocol[6].type = Network::NetAttributeType_Bool;
} }
Network::CustomNetProtocol* GetProtocol() override Network::CustomNetProtocol* GetProtocol() override
{ {
protocol[1]->value = bForward; this->protocol[1].value = bForward;
protocol[2]->value = bBackward; this->protocol[2].value = bBackward;
protocol[3]->value = bTurnLeft; this->protocol[3].value = bTurnLeft;
protocol[4]->value = bTurnRight; this->protocol[4].value = bTurnRight;
protocol[5]->value = bStrafeRight; this->protocol[5].value = bStrafeRight;
protocol[6]->value = bStrafeRight; this->protocol[6].value = bStrafeRight;
return &protocol; return &protocol;
} }

View File

@ -3,6 +3,6 @@
/* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */ /* THERE CAN ABSOLUTLEY NOT BE TWO DEFINITIONS WITH THE SAME ID!! */
#define protocol_PlayerNavigation 0; #define protocol_PlayerNavigation 0
#endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H #endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H

View File

@ -1,87 +1,87 @@
#include "WindowShell.h" #include "WindowShell.h"
#include <vector> #include <vector>
// debug window include
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
struct ChildWin;
struct _PrSt;
#pragma region Declarations #pragma region Declarations
namespace struct _PrivateDataContainer
{
//Private data
static WindowShell* instance = NULL;
int childIdCounter = 0;
_PrSt *pData = NULL;
}
struct ChildWin
{
int id;
HWND hWnd;
ChildWin()
{
hWnd = NULL;
childIdCounter++;
id = childIdCounter;
}
int ID() const { return id; }
};
struct _PrSt
{ {
HINSTANCE hIns; HINSTANCE hIns;
HWND hWnd; HWND hWnd;
std::vector<ChildWin> childWindows; HWND parent;
bool consoleWindow;
WNDPROC callback;
const wchar_t* windowClassName;
_PrivateDataContainer()
: hIns(0)
, hWnd(0)
, parent(0)
, consoleWindow(0)
{ }
~_PrivateDataContainer() { if(this->consoleWindow) FreeConsole(); }
_PrSt() } __windowShellData;
{
hIns = NULL;
hWnd = NULL;
}
};
#pragma endregion #pragma endregion
LRESULT CALLBACK DefaultWindowCallback(HWND h, UINT m, WPARAM w, LPARAM l)
WindowShell::WindowShell()
{ {
pData = new _PrSt(); PAINTSTRUCT ps;
} HDC hdc;
WindowShell::~WindowShell()
{ switch (m)
delete pData; {
case WM_PAINT:
hdc = BeginPaint(h, &ps);
EndPaint(h, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_KEYDOWN:
switch(w)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;
}
return DefWindowProc(h, m, w, l);
} }
HINSTANCE WindowShell::GetHINSTANCE()
bool WindowShell::createWin(WINDOW_INIT_DESC &desc)
{ {
if(pData->hWnd) return __windowShellData.hIns;
{ }
MessageBox(0, L"There is already a window registered\nPlease use child windows to create more windows!" ,L"Error", 0); HWND WindowShell::GetHWND()
return false; {
} return __windowShellData.hWnd;
if(!desc.windowProcCallback) }
{ HWND WindowShell::GetParent()
MessageBox(0, L"No callback function for window messages was found!" ,L"Error", 0); {
return false; return __windowShellData.parent;
} }
if(desc.windowSize.x < 0 || desc.windowSize.y < 0) bool WindowShell::CreateWin(WINDOW_INIT_DESC &desc)
{ {
MessageBox(0, L"Size specified for window is invalid!" ,L"Error", 0); if(__windowShellData.hWnd) return false;
return false; if(!desc.windowProcCallback) desc.windowProcCallback = DefaultWindowCallback;
} if(!desc.hInstance) desc.hInstance = GetModuleHandle(0);
if(desc.windowSize.x <= 0) desc.windowSize.x = 50;
if(!desc.hInstance) if(desc.windowSize.y <= 0) desc.windowSize.y = 50;
{
desc.hInstance = GetModuleHandle(0);
}
pData->hIns = desc.hInstance;
__windowShellData.parent = desc.parent;
__windowShellData.hIns = desc.hInstance;
__windowShellData.windowClassName = L"MainWindowShellClassName";
#pragma region Register #pragma region Register
@ -92,12 +92,12 @@ bool WindowShell::createWin(WINDOW_INIT_DESC &desc)
wc.lpfnWndProc = desc.windowProcCallback; wc.lpfnWndProc = desc.windowProcCallback;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = pData->hIns; wc.hInstance = __windowShellData.hIns;
wc.hIcon = LoadIcon(0, IDI_APPLICATION); wc.hIcon = desc.icon;
wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hCursor = desc.cursor;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.hbrBackground = desc.background;
wc.lpszMenuName = 0; wc.lpszMenuName = NULL;
wc.lpszClassName = L"MainWindowClass"; wc.lpszClassName = __windowShellData.windowClassName;
if( !RegisterClassEx(&wc) ) if( !RegisterClassEx(&wc) )
{ {
@ -110,168 +110,131 @@ bool WindowShell::createWin(WINDOW_INIT_DESC &desc)
#pragma region Create window #pragma region Create window
pData->hWnd = CreateWindow( RECT rectW;
L"MainWindowClass" , int width;
desc.windowName.c_str(), int height;
desc.windowStyle, DWORD style = desc.windowStyle;
desc.windowPosition.x, bool windowed = false;
desc.windowPosition.y,
desc.windowSize.x, width = desc.windowSize.x + GetSystemMetrics(SM_CXFIXEDFRAME)*2;
desc.windowSize.y, height = desc.windowSize.y + GetSystemMetrics(SM_CYFIXEDFRAME)*2 + GetSystemMetrics(SM_CYCAPTION);
0,
0, rectW.left=(GetSystemMetrics(SM_CXSCREEN)-width)/2;
pData->hIns, rectW.top=(GetSystemMetrics(SM_CYSCREEN)-height)/2;
0 rectW.right=rectW.left+width;
); rectW.bottom=rectW.top+height;
if( !pData->hWnd )
if(__windowShellData.parent)
{ {
MessageBox(0, L"Failed to create window", L"Error!", 0); rectW.left = 0;
rectW.top = 0;
rectW.right = desc.windowSize.x;
rectW.bottom = desc.windowSize.y;
style = WS_CHILD | WS_VISIBLE;
windowed = true;
}
if(windowed)
{
__windowShellData.hWnd = CreateWindowEx(
0,
__windowShellData.windowClassName ,
desc.windowName,
style,
rectW.left,
rectW.top,
rectW.right - rectW.left,
rectW.bottom - rectW.top,
__windowShellData.parent,
NULL,
__windowShellData.hIns,
NULL
);
}
else
{
__windowShellData.hWnd = CreateWindowEx(
0,
__windowShellData.windowClassName ,
desc.windowName,
style,
desc.windowPosition.x,
desc.windowPosition.y,
desc.windowSize.x,
desc.windowSize.y,
0,
0,
__windowShellData.hIns,
0
);
}
if( !__windowShellData.hWnd )
{
printf("Failed to create window handle : Code ( %ul )", GetLastError());
//MessageBox(0, L"Failed to create window", L"Error!", 0);
return false; return false;
} }
#pragma endregion #pragma endregion
//Show and update window //Show and update window
ShowWindow(pData->hWnd, SW_SHOW); ShowWindow(__windowShellData.hWnd, SW_SHOW);
UpdateWindow(pData->hWnd); UpdateWindow(__windowShellData.hWnd);
return true; return true;
} }
int WindowShell::createChildWin(CHILD_WINDOW_INIT_DESC &desc) bool WindowShell::CreateConsoleWindow(bool redirectStdOut, const wchar_t* title)
{ {
ChildWin win; // allocate a console for this app
if(AllocConsole() == FALSE) return false;
if(redirectStdOut)
char idStr[3];
_itoa_s(win.id, idStr, 10);
std::string next = idStr;
std::wstring str = std::wstring(next.begin(), next.end());
std::wstring childClassName = L"ChildWindow_";
childClassName += str;
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_VREDRAW;
wcex.lpfnWndProc = desc.windowProcCallback;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = pData->hIns;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(0, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = childClassName.c_str();
wcex.hIconSm = NULL;
if(!RegisterClassEx(&wcex))
{ {
MessageBox(0, L"", 0, 0); // redirect unbuffered STDOUT to the console
} HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
if(!desc.style) FILE *fp = _fdopen( fileDescriptor, "w" );
desc.style = WS_EX_CLIENTEDGE; *stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
win.hWnd = CreateWindowEx
(
desc.style, // give the console window a bigger buffer size
childClassName.c_str(), CONSOLE_SCREEN_BUFFER_INFO csbi;
desc.name.c_str(), if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
WS_CAPTION | WS_SYSMENU ,
desc.topLeftPos.x, desc.topLeftPos.y,
desc.windowSize.x, desc.windowSize.y,
pData->hWnd,
NULL,
pData->hIns,
NULL
);
if (win.hWnd)
{
pData->childWindows.push_back(win);
ShowWindow(win.hWnd, 5);
UpdateWindow(win.hWnd);
}
else
{
DWORD err = GetLastError();
MessageBox(0, L"Failed to create child window", L"Error!", MB_OK);
return false;
}
return win.id;
}
bool WindowShell::removeChild(int id)
{
for (int i = 0; i < (int)pData->childWindows.size(); i++)
{
if(id == pData->childWindows[i].id)
{ {
pData->childWindows.erase(pData->childWindows.begin() + i); COORD bufferSize;
return true; bufferSize.X = csbi.dwSize.X;
bufferSize.Y = 50;
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
} }
} }
return false; // give the console window a nicer title
SetConsoleTitle(title);
return true;
} }
bool WindowShell::removeChild(HWND hwnd) bool WindowShell::Frame()
{ {
for (int i = 0; i < (int)pData->childWindows.size(); i++) MSG msg = {0};
while (true)
{ {
if(hwnd == pData->childWindows[i].hWnd) if(!__windowShellData.parent)
{ {
pData->childWindows.erase(pData->childWindows.begin() + i); if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
return true; {
if (msg.message == WM_QUIT) return false;
DispatchMessage(&msg);
continue;
}
} }
break;
} }
return false; return true;
} }
const HINSTANCE WindowShell::getHINSTANCE() const
{
return pData->hIns;
}
const HWND WindowShell::getHWND() const
{
return pData->hWnd;
}
const HWND WindowShell::getChildHWND(int id) const
{
for(int i = 0; i<(int)pData->childWindows.size(); i++)
{
if(id == pData->childWindows[i].id)
return pData->childWindows[i].hWnd;
}
return NULL;
}
const int WindowShell::getChildID(HWND hwnd) const
{
for(int i = 0; i<(int)pData->childWindows.size(); i++)
{
if(hwnd == pData->childWindows[i].hWnd)
return pData->childWindows[i].id;
}
return -1;
}
WindowShell* WindowShell::self()
{
if(!instance)
instance = new WindowShell();
return instance;
}
void WindowShell::destroy()
{
delete instance;
instance = NULL;
}

View File

@ -1,85 +1,62 @@
#ifndef GLARE_WINDOW_H //////////////////////////////////////////////////////////
#define GLARE_WINDOW_H // Created 2013 //
// Dennis Andersen, Linda Andersson //
//////////////////////////////////////////////////////////
#ifndef WINDOWMANAGER_WINDOWSHELL_H
#define WINDOWMANAGER_WINDOWSHELL_H
#include <Windows.h> #include <Windows.h>
#include <string>
class WindowShell class WindowShell
{ {
public: public:
struct WINDOW_INIT_DESC struct WINDOW_INIT_DESC
{
HWND parent; //!< Optional
HINSTANCE hInstance; //!< Optional
WNDPROC windowProcCallback; //!< Optional
const wchar_t* windowName; //!< Optional
POINT windowSize; //!< Optional
POINT windowPosition; //!< Optional
UINT windowClassStyle; //!< Optional
UINT windowStyle; //!< Optional
HICON icon; //!< Optional
HCURSOR cursor; //!< Optional
HBRUSH background; //!< Optional
WINDOW_INIT_DESC()
{ {
HINSTANCE hInstance; parent = 0;
std::wstring windowName; hInstance = NULL;
POINT windowSize; windowName = L"MADAFACKA";
POINT windowPosition; windowSize.x = 800;
WNDPROC windowProcCallback; windowSize.y = 600;
UINT windowClassStyle; windowPosition.x = 0;
UINT windowStyle; windowPosition.y = 0;
windowProcCallback = NULL;
WINDOW_INIT_DESC() windowClassStyle = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
{ windowStyle = WS_POPUPWINDOW|WS_SYSMENU|WS_CAPTION;
hInstance = NULL; //windowStyle = WS_OVERLAPPEDWINDOW;
windowName = L"MADAFACKA"; icon = LoadIcon(0, IDI_APPLICATION);
windowSize.x = 800; cursor = LoadCursor(NULL, IDC_ARROW);
windowSize.y = 600; background = (HBRUSH)GetStockObject(BLACK_BRUSH);
windowPosition.x = 0; //background = (HBRUSH)GetStockObject(BACKGROUND_BLUE);(HBRUSH)(COLOR_WINDOW+1);
windowPosition.y = 0; }
windowProcCallback = NULL; };
windowClassStyle = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
windowStyle = WS_OVERLAPPEDWINDOW;
}
};
struct CHILD_WINDOW_INIT_DESC
{
std::wstring name;
DWORD style;
POINT topLeftPos;
POINT windowSize;
WNDPROC windowProcCallback;
CHILD_WINDOW_INIT_DESC() public:
{ static HINSTANCE GetHINSTANCE ();
name = L"Child Window"; static HWND GetHWND ();
style = WS_CHILD; static HWND GetParent ();
memset(&topLeftPos, 0, sizeof(POINT)); static bool CreateWin (WINDOW_INIT_DESC&);
windowSize.x = 300; static bool CreateConsoleWindow (bool redirectStdOut = true, const wchar_t* title = L"Debug Output");
windowSize.y = 200;
windowProcCallback = NULL;
}
};
/** Procces window messages if avalible. If the return value was false, the window was destroyed. */
private: static bool Frame ();
WindowShell ();
WindowShell (const WindowShell&);
void operator= (const WindowShell&);
virtual~WindowShell ();
public:
const HINSTANCE getHINSTANCE () const;
/* Returns NULL if no hwnd exists */
const HWND getHWND () const;
/* Returns NULL if not found */
const HWND getChildHWND (int id) const;
/* Returns -1 if not found */
const int getChildID (HWND hwnd) const;
/* Creates an empty window */
bool createWin (WINDOW_INIT_DESC&);
/*Creates a child window and returns the id of child window or -1 if failed*/
int createChildWin (CHILD_WINDOW_INIT_DESC&);
/* Removes a child window */
bool removeChild (int id);
/* Removes a child window */
bool removeChild (HWND hwnd);
/* Returns a pointer to this class, dont forget to destroy on exit */
static WindowShell* self();
/* Deletes the instance */
static void destroy();
}; };
#endif #endif