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

This commit is contained in:
Pontus Fransson 2013-12-11 21:45:51 +01:00
commit bbe59836da
100 changed files with 2885 additions and 719 deletions

View File

View File

233
Bin/Content/crate.obj Normal file
View File

@ -0,0 +1,233 @@
# This file uses centimeters as units for non-parametric coordinates.
mtllib crate.mtl
g default
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 -0.500000
v -0.479379 0.522314 0.479379
v 0.479379 0.522314 0.479379
v 0.479379 0.522314 -0.479379
v -0.479379 0.522314 -0.479379
v -0.470939 -0.528599 -0.470939
v 0.470939 -0.528599 -0.470939
v 0.470939 -0.528599 0.470939
v -0.470939 -0.528599 0.470939
v 0.520103 -0.460610 -0.460610
v 0.520103 -0.460610 0.460610
v 0.520103 0.460610 -0.460610
v 0.520103 0.460610 0.460610
v -0.522559 -0.464751 -0.464751
v -0.522559 -0.464751 0.464751
v -0.522559 0.464751 0.464751
v -0.522559 0.464751 -0.464751
v -0.460954 -0.460954 0.522335
v 0.460954 -0.460954 0.522335
v 0.460954 0.460954 0.522335
v -0.460954 0.460954 0.522335
v -0.466507 0.466507 -0.525017
v 0.466507 0.466507 -0.525017
v 0.466507 -0.466507 -0.525017
v -0.466507 -0.466507 -0.525017
vt 0.995838 0.004695
vt 0.999640 -0.003712
vt 0.003809 -0.000160
vt -0.000796 1.000526
vt 0.003809 0.003892
vt 0.999640 0.995671
vt 0.003809 0.007944
vt 0.999640 0.999723
vt 0.003809 1.003774
vt 0.999640 1.003774
vt 0.995035 0.004695
vt 0.995035 1.000526
vt 0.000007 0.004695
vt 0.000007 1.000526
vt 0.999640 0.007944
vt -0.000796 0.004695
vt 0.003809 0.999723
vt 0.003809 -0.003712
vt 0.999640 0.003892
vt 0.003809 0.995671
vt 0.999640 0.992119
vt 0.999640 -0.000160
vt 0.003809 0.992119
vt 0.995838 1.000526
vt 0.003809 -0.003712
vt 0.999640 -0.003712
vt 0.999640 0.992119
vt 0.003809 0.992119
vt 0.003809 -0.000160
vt 0.999640 -0.000160
vt 0.999640 0.995671
vt 0.003809 0.995671
vt 0.003809 0.003892
vt 0.999640 0.003892
vt 0.999640 0.999723
vt 0.003809 0.999723
vt 0.003809 0.007944
vt 0.999640 0.007944
vt 0.999640 1.003774
vt 0.003809 1.003774
vt -0.000796 0.004695
vt 0.995035 0.004695
vt 0.995035 1.000526
vt -0.000796 1.000526
vt 0.000007 0.004695
vt 0.995838 0.004695
vt 0.995838 1.000526
vt 0.000007 1.000526
vt 0.003809 -0.000160
vt 0.999640 -0.000160
vt 0.999640 0.995671
vt 0.003809 0.995671
vt 0.003809 0.007944
vt 0.999640 0.007944
vt 0.999640 1.003774
vt 0.003809 1.003774
vt -0.000796 0.004695
vt 0.995035 0.004695
vt 0.995035 1.000526
vt -0.000796 1.000526
vt 0.000007 0.004695
vt 0.995838 0.004695
vt 0.995838 1.000526
vt 0.000007 1.000526
vt 0.003809 -0.003712
vt 0.999640 -0.003712
vt 0.999640 0.992119
vt 0.003809 0.992119
vt 0.003809 0.003892
vt 0.999640 0.003892
vt 0.999640 0.999723
vt 0.003809 0.999723
vn -0.031209 -0.033799 0.998941
vn 0.033799 -0.031209 0.998941
vn -0.033799 0.031209 0.998941
vn 0.031209 0.033799 0.998941
vn -0.030245 0.999045 0.031527
vn 0.031527 0.999045 0.030245
vn -0.031527 0.999045 -0.030245
vn 0.030245 0.999045 -0.031527
vn -0.034614 0.037052 -0.998714
vn 0.037051 0.034614 -0.998714
vn -0.037051 -0.034614 -0.998714
vn 0.034614 -0.037052 -0.998714
vn -0.038824 -0.998397 -0.041174
vn 0.041174 -0.998397 -0.038824
vn -0.041174 -0.998397 0.038824
vn 0.038824 -0.998397 0.041174
vn 0.999134 -0.030589 0.028224
vn 0.999134 -0.028224 -0.030589
vn 0.999134 0.028224 0.030589
vn 0.999134 0.030589 -0.028224
vn -0.998933 -0.033811 -0.031470
vn -0.998933 -0.031470 0.033811
vn -0.998933 0.031470 -0.033811
vn -0.998933 0.033811 0.031470
vn 0.577350 0.577350 -0.577350
vn 0.577350 -0.577350 -0.577350
vn -0.577350 0.577350 -0.577350
vn -0.577350 -0.577350 -0.577350
vn 0.577350 -0.577350 0.577350
vn -0.577350 -0.577350 0.577350
vn 0.577350 0.577350 0.577350
vn -0.577350 0.577350 0.577350
vn -0.608285 0.469952 0.639637
vn 0.633500 0.454555 0.626145
vn 0.657522 0.474071 -0.585595
vn -0.626276 0.491669 -0.605013
vn -0.608373 -0.534484 -0.586694
vn 0.635292 -0.520408 -0.570596
vn 0.616200 -0.500955 0.607735
vn -0.589957 -0.516183 0.620891
s 1
g meshCrate
usemtl matCrateSG
f 33/65/1 34/66/2 36/68/3
f 36/68/3 34/66/2 35/67/4
f 17/49/5 18/50/6 20/52/7
f 20/52/7 18/50/6 19/51/8
f 37/69/9 38/70/10 40/72/11
f 40/72/11 38/70/10 39/71/12
f 21/53/13 22/54/14 24/56/15
f 24/56/15 22/54/14 23/55/16
f 26/57/17 25/58/18 28/60/19
f 28/60/19 25/58/18 27/59/20
f 29/61/21 30/62/22 32/64/23
f 32/64/23 30/62/22 31/63/24
s 7
f 1/25/25 3/28/26 2/26/27
f 2/26/27 3/28/26 4/27/28
f 3/29/26 5/32/29 4/30/28
f 4/30/28 5/32/29 6/31/30
f 5/33/29 7/36/31 6/34/30
f 6/34/30 7/36/31 8/35/32
f 7/37/31 1/40/25 8/38/32
f 8/38/32 1/40/25 2/39/27
f 2/41/27 4/44/28 8/42/32
f 8/42/32 4/44/28 6/43/30
f 7/45/31 5/48/29 1/46/25
f 1/46/25 5/48/29 3/47/26
s 1
f 12/3/33 11/22/34 17/49/5
f 17/49/5 11/22/34 18/50/6
f 11/22/34 13/6/35 18/50/6
f 18/50/6 13/6/35 19/51/8
f 13/6/35 14/20/36 19/51/8
f 19/51/8 14/20/36 20/52/7
f 14/20/36 12/3/33 20/52/7
f 20/52/7 12/3/33 17/49/5
f 16/7/37 15/15/38 21/53/13
f 21/53/13 15/15/38 22/54/14
f 15/15/38 10/10/39 22/54/14
f 22/54/14 10/10/39 23/55/16
f 10/10/39 9/9/40 23/55/16
f 23/55/16 9/9/40 24/56/15
f 9/9/40 16/7/37 24/56/15
f 24/56/15 16/7/37 21/53/13
f 10/16/39 15/11/38 26/57/17
f 26/57/17 15/11/38 25/58/18
f 15/11/38 13/12/35 25/58/18
f 25/58/18 13/12/35 27/59/20
f 13/12/35 11/4/34 27/59/20
f 27/59/20 11/4/34 28/60/19
f 11/4/34 10/16/39 28/60/19
f 28/60/19 10/16/39 26/57/17
f 16/13/37 9/1/40 29/61/21
f 29/61/21 9/1/40 30/62/22
f 9/1/40 12/24/33 30/62/22
f 30/62/22 12/24/33 31/63/24
f 12/24/33 14/14/36 31/63/24
f 31/63/24 14/14/36 32/64/23
f 14/14/36 16/13/37 32/64/23
f 32/64/23 16/13/37 29/61/21
f 9/18/40 10/2/39 33/65/1
f 33/65/1 10/2/39 34/66/2
f 10/2/39 11/21/34 34/66/2
f 34/66/2 11/21/34 35/67/4
f 11/21/34 12/23/33 35/67/4
f 35/67/4 12/23/33 36/68/3
f 12/23/33 9/18/40 36/68/3
f 36/68/3 9/18/40 33/65/1
f 14/5/36 13/19/35 37/69/9
f 37/69/9 13/19/35 38/70/10
f 13/19/35 15/8/38 38/70/10
f 38/70/10 15/8/38 39/71/12
f 15/8/38 16/17/37 39/71/12
f 39/71/12 16/17/37 40/72/11
f 16/17/37 14/5/36 40/72/11
f 40/72/11 14/5/36 37/69/9

BIN
Bin/Content/tex_crate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

View File

@ -0,0 +1,8 @@
#define NOMINMAX
#include <windows.h>
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
{
//MessageBox(0, L"DanBiasGame Loaded", 0, 0);
return TRUE;
}

View File

@ -0,0 +1,217 @@
<?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>{2A1BC987-AF42-4500-802D-89CD32FC1309}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DanBiasGame</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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</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'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>OysterGraphics_x86.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<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>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GameClientState\Obj\C_UIobject.cpp" />
<ClCompile Include="DanBiasGame_Impl.cpp" />
<ClCompile Include="DLLMain.cpp" />
<ClCompile Include="GameClientState\Obj\C_DynamicObj.cpp" />
<ClCompile Include="GameClientState\GameClientState.cpp" />
<ClCompile Include="GameClientState\GameState.cpp" />
<ClCompile Include="GameClientState\LobbyState.cpp" />
<ClCompile Include="GameClientState\Obj\C_Player.cpp" />
<ClCompile Include="GameClientState\Obj\C_StaticObj.cpp" />
<ClCompile Include="GameClientState\C_Object.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameClientState\Obj\C_UIobject.h" />
<ClInclude Include="GameClientState\Obj\C_DynamicObj.h" />
<ClInclude Include="GameClientState\GameClientState.h" />
<ClInclude Include="GameClientState\GameState.h" />
<ClInclude Include="Include\DanBiasGame.h" />
<ClInclude Include="GameClientState\LobbyState.h" />
<ClInclude Include="GameClientState\Obj\C_Player.h" />
<ClInclude Include="GameClientState\Obj\C_StaticObj.h" />
<ClInclude Include="GameClientState\C_Object.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,270 @@
#define NOMINMAX
#include <Windows.h>
#include "Include\DanBiasGame.h"
#include "DllInterfaces/GFXAPI.h"
#include "GameClientState/GameClientState.h"
#include "GameClientState\GameState.h"
#include "GameClientState\LobbyState.h"
#include "vld.h"
namespace DanBias
{
__int64 DanBiasGame::cntsPerSec = 0;
__int64 DanBiasGame::prevTimeStamp = 0;
float DanBiasGame::secsPerCnt = 0;
InputClass* DanBiasGame::inputObj = NULL;
HINSTANCE DanBiasGame::g_hInst = NULL;
HWND DanBiasGame::g_hWnd = NULL;
#pragma region Game Data
class DanBiasGamePrivateData
{
public:
DanBiasGamePrivateData()
{
}
~DanBiasGamePrivateData()
{
}
public:
Client::GameClientState* gameClientState;
// gameClient;
} data;
#pragma endregion
DanBiasGamePrivateData* DanBiasGame::m_data = new DanBiasGamePrivateData();
//--------------------------------------------------------------------------------------
// Interface API functions
//--------------------------------------------------------------------------------------
DanBiasClientReturn DanBiasGame::Initiate(DanBiasGameDesc& desc)
{
if( FAILED( InitWindow( desc.hinst, desc.nCmdShow ) ))
return DanBiasClientReturn_Error;
if( FAILED( InitDirect3D() ) )
return DanBiasClientReturn_Error;
if( FAILED( InitInput() ) )
return DanBiasClientReturn_Error;
cntsPerSec = 0;
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
secsPerCnt = 1.0f / (float)cntsPerSec;
prevTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
// Start in lobby state
m_data->gameClientState = new Client::LobbyState();
m_data->gameClientState->Init();
return DanBiasClientReturn_Sucess;
}
DanBiasClientReturn DanBiasGame::Run()
{
// Main message loop
MSG msg = {0};
while(WM_QUIT != msg.message)
{
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
__int64 currTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt;
//render
if(Update(dt) != S_OK)
return DanBiasClientReturn_Error;
if(Render(dt) != S_OK)
return DanBiasClientReturn_Error;
prevTimeStamp = currTimeStamp;
}
}
return DanBiasClientReturn_Sucess;
}
void DanBiasGame::Release()
{
CleanUp();
}
//--------------------------------------------------------------------------------------
// Register class and create window
//--------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitWindow( HINSTANCE hInstance, int nCmdShow )
{
// Register class
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = L"BTH_D3D_Template";
wcex.hIconSm = 0;
if( !RegisterClassEx(&wcex) )
return E_FAIL;
// Adjust and create window
g_hInst = hInstance;
RECT rc = { 0, 0, 1024, 768 };
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
if(!(g_hWnd = CreateWindow(
L"BTH_D3D_Template",
L"BTH - Direct3D 11.0 Template",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
rc.right - rc.left,
rc.bottom - rc.top,
NULL,
NULL,
hInstance,
NULL)))
{
return E_FAIL;
}
ShowWindow( g_hWnd, nCmdShow );
return S_OK;
}
//--------------------------------------------------------------------------------------
// Create Direct3D with Oyster Graphics
//--------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitDirect3D()
{
if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
return E_FAIL;
return S_OK;
}
//--------------------------------------------------------------------------------------
// Init the input
//-------------------------------------------------------------------------------------
HRESULT DanBiasGame::InitInput()
{
inputObj = new InputClass;
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
{
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
return E_FAIL;
}
return S_OK;
}
HRESULT DanBiasGame::Update(float deltaTime)
{
inputObj->Update();
DanBias::Client::GameClientState::ClientState state = DanBias::Client::GameClientState::ClientState_Same;
state = m_data->gameClientState->Update(deltaTime, inputObj);
if(state != Client::GameClientState::ClientState_Same)
{
m_data->gameClientState->Release();
delete m_data->gameClientState;
m_data->gameClientState = NULL;
switch (state)
{
case Client::GameClientState::ClientState_Lobby:
m_data->gameClientState = new Client::LobbyState();
break;
case Client::GameClientState::ClientState_Game:
m_data->gameClientState = new Client::GameState();
break;
default:
return E_FAIL;
break;
}
m_data->gameClientState->Init(); // send game client
}
return S_OK;
}
HRESULT DanBiasGame::Render(float deltaTime)
{
int isPressed = 0;
if(inputObj->IsKeyPressed(DIK_A))
{
isPressed = 1;
}
wchar_t title[255];
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
SetWindowText(g_hWnd, title);
m_data->gameClientState->Render();
return S_OK;
}
HRESULT DanBiasGame::CleanUp()
{
m_data->gameClientState->Release();
delete m_data->gameClientState;
delete m_data;
delete inputObj;
Oyster::Graphics::API::Clean();
return S_OK;
}
//--------------------------------------------------------------------------------------
// Called every time the application receives a message
//--------------------------------------------------------------------------------------
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
} //End namespace DanBias

View File

@ -9,7 +9,7 @@
#include <Windows.h> #include <Windows.h>
#include "DllInterfaces/GFXAPI.h" #include "DllInterfaces/GFXAPI.h"
#include "IGame.h" //#include "IGame.h"
#include "L_inputClass.h" #include "L_inputClass.h"
@ -28,7 +28,7 @@
HINSTANCE g_hInst = NULL; HINSTANCE g_hInst = NULL;
HWND g_hWnd = NULL; HWND g_hWnd = NULL;
GameLogic::IGame* game; //GameLogic::IGame* game;
InputClass* inputObj; InputClass* inputObj;
@ -205,34 +205,34 @@ HRESULT InitGame()
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK); MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
return false; return false;
} }
game = new GameLogic::IGame(); /*game = new GameLogic::IGame();
game->Init(); game->Init();
game->StartGame(); game->StartGame();
*/
return S_OK; return S_OK;
} }
HRESULT Update(float deltaTime) HRESULT Update(float deltaTime)
{ {
inputObj->Update(); inputObj->Update();
GameLogic::keyInput key = GameLogic::keyInput_none; //GameLogic::keyInput key = GameLogic::keyInput_none;
if(inputObj->IsKeyPressed(DIK_W)) //if(inputObj->IsKeyPressed(DIK_W))
{ //{
key = GameLogic::keyInput_W; // key = GameLogic::keyInput_W;
} //}
else if(inputObj->IsKeyPressed(DIK_A)) //else if(inputObj->IsKeyPressed(DIK_A))
{ //{
key = GameLogic::keyInput_A; // key = GameLogic::keyInput_A;
} //}
else if(inputObj->IsKeyPressed(DIK_S)) //else if(inputObj->IsKeyPressed(DIK_S))
{ //{
key = GameLogic::keyInput_S; // key = GameLogic::keyInput_S;
} //}
else if(inputObj->IsKeyPressed(DIK_D)) //else if(inputObj->IsKeyPressed(DIK_D))
{ //{
key = GameLogic::keyInput_D; // key = GameLogic::keyInput_D;
} //}
float pitch = 0; float pitch = 0;
float yaw = 0; float yaw = 0;
@ -243,7 +243,7 @@ HRESULT Update(float deltaTime)
yaw = inputObj->GetYaw(); yaw = inputObj->GetYaw();
//} //}
game->Update(key, pitch, yaw); //game->Update(key, pitch, yaw);
return S_OK; return S_OK;
@ -258,7 +258,7 @@ HRESULT Render(float deltaTime)
//std::cout<<"test"; //std::cout<<"test";
} }
game->Render(); //game->Render();
wchar_t title[255]; wchar_t title[255];
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
SetWindowText(g_hWnd, title); SetWindowText(g_hWnd, title);
@ -271,11 +271,11 @@ HRESULT Render(float deltaTime)
HRESULT CleanUp() HRESULT CleanUp()
{ {
if(game) /*if(game)
{ {
delete game; delete game;
game = NULL; game = NULL;
} }*/
return S_OK; return S_OK;
} }
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@ -0,0 +1,4 @@
#include "C_Object.h"
using namespace DanBias::Client;

View File

@ -0,0 +1,28 @@
#ifndef DANBIAS_CLIENT_COBJECT_H
#define DANBIAS_CLIENT_COBJECT_H
#include "DllInterfaces/GFXAPI.h"
namespace DanBias
{
namespace Client
{
struct ModelInitData
{
std::wstring modelPath;
Oyster::Math::Float4x4 world;
bool visible;
};
class C_Object
{
private:
public:
virtual void Init(ModelInitData modelInit) = 0;
virtual void setPos() = 0;
virtual void Render() = 0;
virtual void Release() = 0;
};};};
#endif

View File

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

View File

@ -0,0 +1,32 @@
#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define NOMINMAX
#include "L_inputClass.h"
namespace DanBias
{
namespace Client
{
class GameClientState
{
public:
enum ClientState
{
ClientState_Lobby,
ClientState_Game,
ClientState_Same,
};
public:
GameClientState(void);
virtual ~GameClientState(void);
virtual bool Init() = 0;
virtual ClientState Update(float deltaTime, InputClass* KeyInput) = 0;
virtual bool Render() = 0;
virtual bool Release() = 0;
};
};
};
#endif

View File

@ -0,0 +1,126 @@
#include "GameState.h"
#include "DllInterfaces/GFXAPI.h"
#include "Obj/C_Player.h"
#include "Obj/C_DynamicObj.h"
using namespace DanBias::Client;
struct GameState::myData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
C_Object* object[3];
int modelCount;
gameStateState state;
}privData;
GameState::GameState(void)
{
}
GameState::~GameState(void)
{
}
bool GameState::Init()
{
// load models
privData = new myData();
privData->state = gameStateState_loading;
privData->state = LoadGame();
return true;
}
GameState::gameStateState GameState::LoadGame()
{
LoadModels(L"map");
InitCamera(Oyster::Math::Float3(0,0,5.4f));
return gameStateState_playing;
}
bool GameState::LoadModels(std::wstring mapFile)
{
// open file
// read file
// init models
privData->modelCount = 2;
ModelInitData modelData;
modelData.world = Oyster::Math3D::Float4x4::identity;
modelData.visible = true;
modelData.modelPath = L"worldDummy";
// load models
privData->object[0] = new C_Player();
privData->object[0]->Init(modelData);
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,2));
modelData.world = modelData.world * translate;
modelData.modelPath = L"crate";
privData->object[1] = new C_DynamicObj();
privData->object[1]->Init(modelData);
return true;
}
bool GameState::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 GameState::Update(float deltaTime, InputClass* KeyInput)
{
switch (privData->state)
{
case gameStateState_loading:
// load map
// wait for all players
LoadGame();
privData->state = gameStateState_playing;
break;
case gameStateState_playing:
// read server data
// update objects
if(KeyInput->IsKeyPressed(DIK_L))
privData->state = GameState::gameStateState_end;
break;
case gameStateState_end:
return ClientState_Lobby;
break;
default:
break;
}
// send key input to server.
return ClientState_Same;
}
bool GameState::Render()
{
Oyster::Graphics::API::SetView(privData->view);
Oyster::Graphics::API::SetProjection(privData->proj);
Oyster::Graphics::API::NewFrame();
for (int i = 0; i < privData->modelCount; i++)
{
privData->object[i]->Render();
}
Oyster::Graphics::API::EndFrame();
return true;
}
bool GameState::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;
}

View File

@ -0,0 +1,36 @@
#ifndef DANBIAS_CLIENT_GAMESTATE_H
#define DANBIAS_CLIENT_GAMESTATE_H
#include "GameClientState.h"
#include "OysterMath.h"
#include <string>
namespace DanBias
{
namespace Client
{
class GameState : public GameClientState
{
enum gameStateState
{
gameStateState_loading,
gameStateState_playing,
gameStateState_end,
};
private:
struct myData;
myData* privData;
public:
GameState(void);
~GameState(void);
bool Init();
GameClientState::ClientState Update(float deltaTime, InputClass* KeyInput);
bool LoadModels(std::wstring mapFile);
bool InitCamera(Oyster::Math::Float3 startPos);
gameStateState LoadGame();
bool Render();
bool Release();
};
};
};
#endif

View File

@ -0,0 +1,121 @@
#include "LobbyState.h"
#include "DllInterfaces/GFXAPI.h"
#include "OysterMath.h"
#include "Obj/C_Player.h"
#include "Obj/C_StaticObj.h"
#include "Obj/C_DynamicObj.h"
using namespace DanBias::Client;
struct LobbyState::myData
{
myData(){}
Oyster::Math3D::Float4x4 view;
Oyster::Math3D::Float4x4 proj;
C_Object* object[2];
int modelCount;
// UI object
// game client*
}privData;
LobbyState::LobbyState(void)
{
}
LobbyState::~LobbyState(void)
{
}
bool LobbyState::Init()
{
privData = new myData();
// load models
LoadModels(L"UImodels.txt");
InitCamera(Oyster::Math::Float3(0,0,5.4f));
return true;
}
bool LobbyState::LoadModels(std::wstring file)
{
// open file
// read file
// init models
privData->modelCount = 2;
ModelInitData modelData;
modelData.world = Oyster::Math3D::Float4x4::identity;
modelData.visible = true;
modelData.modelPath = L"crate";
// load models
privData->object[0] = new C_StaticObj();
privData->object[0]->Init(modelData);
Oyster::Math3D::Float4x4 translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(2,2,2));
modelData.world = modelData.world * translate;
privData->object[1] = new C_DynamicObj();
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)
{
// picking
// mouse events
// different menus
// play sounds
// update animation
// send data to server
// check data from server
if( KeyInput->IsKeyPressed(DIK_G))
return ClientState_Game;
return ClientState_Same;
}
bool LobbyState::Render()
{
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();
return true;
}
bool LobbyState::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;
}

View File

@ -0,0 +1,36 @@
#ifndef DANBIAS_CLIENT_LOBBYSTATE_H
#define DANBIAS_CLIENT_LOBBYSTATE_H
#include "GameClientState.h"
#include "OysterMath.h"
#include <string>
namespace DanBias
{
namespace Client
{
class LobbyState : public GameClientState
{
private:
struct myData;
myData* privData;
public:
LobbyState(void);
~LobbyState(void);
bool Init();
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
bool Render();
bool Release();
};};};
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H

View File

@ -0,0 +1,73 @@
#ifndef DANBIASGAME_DANBIASGAME_H
#define DANBIASGAME_DANBIASGAME_H
#if defined (DANBIAS_GAME_DLL_EXPORT)
#define DANBIAS_GAME_DLL __declspec(dllexport)
#else
#define DANBIAS_GAME_DLL __declspec(dllimport)
#endif
#define NOMINMAX
#include <Windows.h>
#include "L_inputClass.h"
namespace DanBias
{
extern "C"
{
enum DanBiasClientReturn
{
DanBiasClientReturn_Error,
DanBiasClientReturn_Sucess,
};
struct DanBiasGameDesc
{
//Stuff goes here...
int port;
HINSTANCE hinst;
int nCmdShow;
};
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
class DanBiasGamePrivateData;
class DANBIAS_GAME_DLL DanBiasGame
{
public:
//--------------------------------------------------------------------------------------
// Interface API functions
//--------------------------------------------------------------------------------------
static DanBiasClientReturn Initiate(DanBiasGameDesc& desc);
static DanBiasClientReturn Run();
static void Release();
private:
static HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow);
static HRESULT InitDirect3D();
static HRESULT InitInput();
static HRESULT Update(float deltaTime);
static HRESULT Render(float deltaTime);
static HRESULT CleanUp();
private:
static __int64 cntsPerSec;
static __int64 prevTimeStamp;
static float secsPerCnt;
static InputClass* inputObj;
static HINSTANCE g_hInst;
static HWND g_hWnd;
static DanBiasGamePrivateData* m_data;
};
}//End Extern "C"
} //End namespace DanBias
#endif // !DANBIASGAME_DANBIASGAME_H

View File

@ -19,9 +19,9 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{2A1BC987-AF42-4500-802D-89CD32FC1309}</ProjectGuid> <ProjectGuid>{8690FDDF-C5B7-4C42-A337-BD5243F29B85}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>DanBiasGame</RootNamespace> <RootNamespace>DanBiasLauncher</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -71,28 +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>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</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>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</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>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</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>
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath> <IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -101,14 +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>
<SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -118,14 +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>
<SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -137,16 +139,15 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -158,34 +159,42 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\GameLogic\GameLogic.vcxproj"> <ClCompile Include="Launcher.cpp" />
<Project>{b1195bb9-b3a5-47f0-906c-8dea384d1520}</Project>
</ProjectReference>
<ProjectReference Include="..\Input\Input.vcxproj">
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
</ProjectReference>
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
</ProjectReference>
<ProjectReference Include="..\OysterPhysics3D\OysterPhysics3D.vcxproj">
<Project>{4285bd3f-3c6c-4670-b7af-a29afef5f6a8}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="DanBiasMaincpp.cpp" /> <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">
<Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project>
</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

@ -0,0 +1,52 @@
/////////////////////////////////////////////////
// Launcher to launch Danbias server or client //
/////////////////////////////////////////////////
#define NOMINMAX
#include <Windows.h>
//#define DANBIAS_SERVER
#define DANBIAS_CLIENT
#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)
{
#if defined(DANBIAS_SERVER)
if(SetDllDirectory(L"..\\DLL") == FALSE)
{
return cmdShow;
}
// Server starter code goes here
DanBias::DanBiasServerDesc desc;
desc.port = 0;
if( DanBias::DanBiasServer::Initiate(desc) == DanBias::DanBiasServerReturn_Sucess)
{
DanBias::DanBiasServer::Run();
DanBias::DanBiasServer::Release();
}
#elif defined(DANBIAS_CLIENT)
if(SetDllDirectory(L"..\\DLL") == FALSE)
{
return cmdShow;
}
// Game client starter code goes here
DanBias::DanBiasGameDesc gameDesc;
gameDesc.port = 1;
gameDesc.hinst = hinst;
gameDesc.nCmdShow = cmdShow;
if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Sucess)
{
DanBias::DanBiasGame::Run();
DanBias::DanBiasGame::Release();
}
#endif
return cmdShow;
}

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////
// 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

@ -0,0 +1,27 @@
/////////////////////////////////////////////////////////////////////
// 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

@ -0,0 +1,8 @@
#include <windows.h>
BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved )
{
MessageBox(0, L"DanBiasServer Loaded", 0, 0);
return TRUE;
}

View File

@ -0,0 +1,186 @@
<?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>{52380DAA-0F4A-4D97-8E57-98DF39319CAF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DanBiasServer</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>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</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'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<DelayLoadDLLs>GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>DANBIAS_SERVER;DANBIAS_SERVER_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)Misc\;$(SolutionDir)Game\</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<DelayLoadDLLs>GameLogic_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="IDanBiasServer.cpp" />
<ClCompile Include="DLLMain.cpp" />
<ClCompile Include="DBServer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="DBServer.h" />
<ClInclude Include="Include\IDanBiasServer.h" />
<ClInclude Include="Include\ServerWrapper.h" />
<ClInclude Include="MainLobby.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

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

View File

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef DANBIAS_SERVER_DANBIAS_SERVER_H
#define DANBIAS_SERVER_DANBIAS_SERVER_H
#if defined (DANBIAS_SERVER_DLL_EXPORT)
#define DANBIAS_SERVER_DLL __declspec(dllexport)
#else
#define DANBIAS_SERVER_DLL __declspec(dllimport)
#endif
namespace DanBias
{
extern "C"
{
enum DanBiasServerReturn
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
};
struct DanBiasServerDesc
{
//Stuff goes here...
int port;
};
class DANBIAS_SERVER_DLL DanBiasServer
{
public:
static DanBiasServerReturn Initiate(DanBiasServerDesc& desc);
static DanBiasServerReturn Run();
static DanBiasServerReturn Release();
};
}//End Extern "C"
} //End namspace DanBias
#endif // !DANBIAS_SERVER_DANBIAS_SERVER_H

View File

@ -0,0 +1,23 @@
#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

@ -0,0 +1,17 @@
#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,45 @@
#include "AttatchmentMassDriver.h"
using namespace GameLogic;
struct AttatchmentMassDriver::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
AttatchmentMassDriver::AttatchmentMassDriver(void)
{
}
AttatchmentMassDriver::~AttatchmentMassDriver(void)
{
}
/********************************************************
* Uses the attatchment and will from here switch case the different WEAPON_FIRE's that are to be used
********************************************************/
void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
{
ForcePush(fireInput);
}
/********************************************************
* This is a specific functionallity of the weapon
********************************************************/
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
{
}

View File

@ -0,0 +1,25 @@
#ifndef ATTATCHMENTMASSDRIVER_H
#define ATTATCHMENTMASSDRIVER_H
#include "IAttatchment.h"
namespace GameLogic
{
class AttatchmentMassDriver : public IAttatchment
{
public:
AttatchmentMassDriver(void);
~AttatchmentMassDriver(void);
void UseAttatchment(const WEAPON_FIRE &fireInput);
private:
void ForcePush(const WEAPON_FIRE &fireInput);
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -0,0 +1,34 @@
#include "AttatchmentSocket.h"
#include "IAttatchment.h"
using namespace GameLogic;
struct AttatchmentSocket::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
IAttatchment *Attatchment;
}myData;
AttatchmentSocket::AttatchmentSocket(void)
{
}
AttatchmentSocket::~AttatchmentSocket(void)
{
}
IAttatchment* AttatchmentSocket::GetAttatchment()
{
return myData->Attatchment;
}

View File

@ -0,0 +1,20 @@
#ifndef ATTATCHMENTSOCKET_H
#define ATTATCHMENTSOCKET_H
#include "IAttatchment.h"
namespace GameLogic
{
class AttatchmentSocket
{
public:
AttatchmentSocket(void);
~AttatchmentSocket(void);
IAttatchment* GetAttatchment();
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -1,6 +1,6 @@
#include "CollisionManager.h" #include "CollisionManager.h"
using namespace Oyster;
namespace GameLogic namespace GameLogic
{ {
@ -8,10 +8,10 @@ namespace GameLogic
namespace CollisionManager namespace CollisionManager
{ {
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj) Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
{ {
Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyPlayer)); Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyPlayer));
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj); Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
switch (realObj->GetType()) switch (realObj->GetType())
{ {
@ -24,6 +24,7 @@ namespace GameLogic
} }
//spela ljud? ta skada? etc etc //spela ljud? ta skada? etc etc
return Physics::ICustomBody::SubscriptMessage_none;
} }
void PlayerVBox(Player &player, DynamicObject &box) void PlayerVBox(Player &player, DynamicObject &box)
@ -31,10 +32,10 @@ namespace GameLogic
//spela ljud? ta skada? etc etc //spela ljud? ta skada? etc etc
} }
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj) Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
{ {
DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(rigidBodyBox)); DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyBox));
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(obj); Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
switch (realObj->GetType()) switch (realObj->GetType())
{ {
@ -45,6 +46,8 @@ namespace GameLogic
PlayerVBox(*(Player*)realObj,*box); PlayerVBox(*(Player*)realObj,*box);
break; break;
} }
return Physics::ICustomBody::SubscriptMessage_none;
} }
} }
} }

View File

@ -13,8 +13,9 @@ namespace GameLogic
namespace CollisionManager namespace CollisionManager
{ {
//these are the main collision functions //these are the main collision functions
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj); //typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj); Oyster::Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj);
Oyster::Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj);
//these are the specific collision case functions //these are the specific collision case functions
void PlayerVBox(Player &player, DynamicObject &box); void PlayerVBox(Player &player, DynamicObject &box);

View File

@ -0,0 +1,29 @@
#include "DynamicObject.h"
using namespace GameLogic;
struct DynamicObject::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
DynamicObject::DynamicObject()
{
myData = new PrivateData();
}
DynamicObject::~DynamicObject(void)
{
delete myData;
}

View File

@ -6,21 +6,22 @@
#ifndef DYNAMICOBJECT_H #ifndef DYNAMICOBJECT_H
#define DYNAMICOBJECT_H #define DYNAMICOBJECT_H
#include "Object.h"
namespace GameLogic namespace GameLogic
{ {
class DynamicObject : public Object class DynamicObject
{ {
public: public:
DynamicObject(void); DynamicObject();
~DynamicObject(void); ~DynamicObject(void);
void Update(); void Update();
private:
struct PrivateData;
PrivateData *myData;
}; };
} }

View File

@ -1,4 +1,5 @@
#include "Game.h" #include "Game.h"
using namespace GameLogic; using namespace GameLogic;
Game::Game(void) Game::Game(void)
@ -26,7 +27,13 @@ Game::~Game(void)
void Game::Init() void Game::Init()
{ {
player = new Player(); //Oyster::Physics::API::SetSubscription("remove object");
player = new Player(L"worldDummy");
box = new DynamicObject(L"crate");
//poi
//box = new physcTestObj("box");
camera = new Camera(); camera = new Camera();
} }
void Game::StartGame() void Game::StartGame()
@ -60,9 +67,13 @@ void Game::Update(keyInput keyPressed, float pitch, float yaw)
camera->Walk(0.1); camera->Walk(0.1);
} }
camera->UpdateViewMatrix(); camera->UpdateViewMatrix();
//poi Oyster::Physics::API::Update();
} }
void Game::Render() void Game::Render()
{ {
Oyster::Graphics::API::NewFrame(camera->View(), camera->Proj()); Oyster::Graphics::API::SetView(camera->View());
Oyster::Graphics::API::SetProjection(camera->Proj());
Oyster::Graphics::API::NewFrame();
player->Render(); player->Render();
box->Render();
} }

View File

@ -5,6 +5,7 @@
#include "Player.h" #include "Player.h"
#include "IGame.h" #include "IGame.h"
#include "Camera.h" #include "Camera.h"
#include "DynamicObject.h"
namespace GameLogic namespace GameLogic
{ {
@ -21,6 +22,7 @@ namespace GameLogic
private: private:
Level* level; Level* level;
DynamicObject* box;
Player* player; Player* player;
Camera* camera; Camera* camera;
}; };

View File

@ -101,6 +101,7 @@
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>GamePhysics_$(PlatformShortName)D.dll</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -151,37 +152,27 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\GamePhysics\GamePhysics.vcxproj"> <ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project> <Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
<Private>false</Private>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Input\Input.vcxproj"> <ProjectReference Include="..\..\Misc\Misc.vcxproj">
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
</ProjectReference>
<ProjectReference Include="..\Misc\Misc.vcxproj">
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project> <Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OysterGraphics\OysterGraphics.vcxproj"> <ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
</ProjectReference>
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project> <Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\OysterPhysics3D\OysterPhysics3D.vcxproj"> <ProjectReference Include="..\..\OysterPhysics3D\OysterPhysics3D.vcxproj">
<Project>{4285bd3f-3c6c-4670-b7af-a29afef5f6a8}</Project> <Project>{4285bd3f-3c6c-4670-b7af-a29afef5f6a8}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="AttatchmentMassDriver.h" />
<ClInclude Include="AttatchmentSocket.h" />
<ClInclude Include="Camera.h" /> <ClInclude Include="Camera.h" />
<ClInclude Include="CollisionManager.h" /> <ClInclude Include="CollisionManager.h" />
<ClInclude Include="DynamicObject.h" /> <ClInclude Include="DynamicObject.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="GameMode.h" /> <ClInclude Include="GameMode.h" />
<ClInclude Include="IGame.h" /> <ClInclude Include="IAttatchment.h" />
<ClInclude Include="Level.h" /> <ClInclude Include="Level.h" />
<ClInclude Include="Object.h" /> <ClInclude Include="Object.h" />
<ClInclude Include="Player.h" /> <ClInclude Include="Player.h" />
@ -190,18 +181,18 @@
<ClInclude Include="Weapon.h" /> <ClInclude Include="Weapon.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AttatchmentMassDriver.cpp" />
<ClCompile Include="AttatchmentSocket.cpp" />
<ClCompile Include="Camera.cpp" /> <ClCompile Include="Camera.cpp" />
<ClCompile Include="CollisionManager.cpp" /> <ClCompile Include="CollisionManager.cpp" />
<ClCompile Include="DynamicObject.cpp" /> <ClCompile Include="DynamicObject.cpp" />
<ClCompile Include="Game.cpp" />
<ClCompile Include="GameMode.cpp" /> <ClCompile Include="GameMode.cpp" />
<ClCompile Include="IGame.cpp" /> <ClCompile Include="IAttatchment.cpp" />
<ClCompile Include="Level.cpp" /> <ClCompile Include="Level.cpp" />
<ClCompile Include="Object.cpp" /> <ClCompile Include="Object.cpp" />
<ClCompile Include="Player.cpp" /> <ClCompile Include="Player.cpp" />
<ClCompile Include="RefManager.cpp" /> <ClCompile Include="RefManager.cpp" />
<ClCompile Include="StaticObject.cpp" /> <ClCompile Include="StaticObject.cpp" />
<ClCompile Include="TestGLMain.cpp" />
<ClCompile Include="Weapon.cpp" /> <ClCompile Include="Weapon.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -0,0 +1,41 @@
#ifndef GAMELOGICSTATES_H
#define GAMELOGICSTATES_H
namespace GameLogic
{
enum PLAYER_STATE
{
PLAYER_STATE_JUMPING = 0,
PLAYER_STATE_WALKING = 1,
PLAYER_STATE_IDLE = 2,
};
enum PLAYER_MOVEMENT
{
PLAYER_MOVEMENT_FORWARD = 0,
PLAYER_MOVEMENT_BACKWARD = 1,
PLAYER_MOVEMENT_LEFT = 2,
PLAYER_MOVEMENT_RIGHT = 4,
PLAYER_MOVEMENT_JUMP = 8,
};
enum WEAPON_FIRE
{
WEAPON_USE_PRIMARY_PRESS = 0,
WEAPON_USE_PRIMARY_RELEASE = 1,
WEAPON_USE_SECONDARY_PRESS = 2,
WEAPON_USE_SECONDARY_RELEASE = 4,
WEAPON_USE_UTILLITY_PRESS = 8,
WEAPON_USE_UTILLITY_RELEASE = 16,
};
enum WEAPON_STATE
{
WEAPON_STATE_FIREING = 0,
WEAPON_STATE_IDLE = 1,
WEAPON_STATE_RELOADING = 2,
};
}
#endif

View File

@ -0,0 +1,30 @@
#include "GameMode.h"
using namespace GameLogic;
struct GameMode::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
GameMode::GameMode()
{
myData = new PrivateData();
}
GameMode::~GameMode(void)
{
delete myData;
}

View File

@ -15,7 +15,8 @@ namespace GameLogic
GameMode(void); GameMode(void);
~GameMode(void); ~GameMode(void);
private: private:
//variabels that control what game rules the level runs on struct PrivateData;
PrivateData *myData;
}; };
} }

View File

@ -0,0 +1,29 @@
#include "IAttatchment.h"
#include "AttatchmentSocket.h"
using namespace GameLogic;
struct IAttatchment::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
IAttatchment::IAttatchment(void)
{
}
IAttatchment::~IAttatchment(void)
{
}

View File

@ -0,0 +1,25 @@
#ifndef IATTATCHMENT_H
#define IATTATCHMENT_H
#include "GameLogicStates.h"
namespace GameLogic
{
class IAttatchment
{
public:
IAttatchment(void);
~IAttatchment(void);
virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -0,0 +1,42 @@
#include "Level.h"
#include "StaticObject.h"
#include "DynamicObject.h"
#include "GameMode.h"
using namespace GameLogic;
struct Level::PrivateData
{
PrivateData()
{
gameMode = new GameMode();
}
~PrivateData()
{
if (gameMode)
{
delete gameMode;
}
}
StaticObject** staticObjects;
int nrOfStaticObjects;
DynamicObject** dynamicObjects;
int nrOfDynamicObjects;
GameMode* gameMode;
}myData;
Level::Level(void)
{
myData = new PrivateData();
}
Level::~Level(void)
{
delete myData;
}

View File

@ -1,24 +1,22 @@
////////////////////////////////////////////////// //////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team //Created by Erik and Linda of the GameLogic team
////////////////////////////////////////////////// //////////////////////////////////////////////////
#ifndef LEVEL_H
#define LEVEL_H
#ifndef WEAPON_H
#define WEAPON_H
#include "Object.h"
namespace GameLogic namespace GameLogic
{ {
class Weapon : public Object class Level
{ {
public: public:
Weapon(void); Level(void);
~Weapon(void); ~Level(void);
private: private:
struct PrivateData;
PrivateData *myData;
}; };

View File

@ -12,15 +12,16 @@ using namespace Oyster::Graphics::Model;
using namespace Utility::DynamicMemory; using namespace Utility::DynamicMemory;
using namespace Oyster::Physics; using namespace Oyster::Physics;
Object::Object(void) Object::Object(std::wstring objFile)
{ {
model = new Model(); //model = new Model();
model = Oyster::Graphics::API::CreateModel(L"orca"); model = Oyster::Graphics::API::CreateModel(objFile);
API::SimpleBodyDescription sbDesc; API::SimpleBodyDescription sbDesc;
//sbDesc.centerPosition = //sbDesc.centerPosition =
//poi
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this); GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);

View File

@ -25,7 +25,7 @@ namespace GameLogic
OBJECT_TYPE_PLAYER, OBJECT_TYPE_PLAYER,
OBJECT_TYPE_BOX, OBJECT_TYPE_BOX,
}; };
Object(void); Object(std::wstring objFile );
virtual ~Object(void); virtual ~Object(void);
void Render(); void Render();

View File

@ -0,0 +1,125 @@
#include "Player.h"
#include "OysterMath.h"
#include "CollisionManager.h"
#include "Weapon.h"
using namespace GameLogic;
using namespace Oyster::Physics;
struct Player::PrivateData
{
PrivateData()
{
weapon = new Weapon();
life = 100;
playerState = PLAYER_STATE_IDLE;
rigidBody->SetSubscription(CollisionManager::PlayerCollision);
}
~PrivateData()
{
if (weapon)
{
delete weapon;
}
}
int life;
Weapon *weapon;
PLAYER_STATE playerState;
ICustomBody *rigidBody;
}myData;
Player::Player()
{
myData = new PrivateData();
}
Player::~Player(void)
{
delete myData;
}
/********************************************************
* Updates the player(is this function needed?)
********************************************************/
void Player::Update()
{
}
/********************************************************
* Moves the player based on client input
* Uses the physics to move the player by adding a force in the chosen direction
* Uses the Jump() function if the player is to jump, this is becuase jumping requires additional logic compared to normal movement
********************************************************/
void Player::Move(const PLAYER_MOVEMENT &movement)
{
switch(movement)
{
case PLAYER_MOVEMENT_FORWARD:
break;
case PLAYER_MOVEMENT_BACKWARD:
break;
case PLAYER_MOVEMENT_LEFT:
break;
case PLAYER_MOVEMENT_RIGHT:
break;
case PLAYER_MOVEMENT_JUMP:
Jump();
break;
}
}
/********************************************************
* Uses the players weapon based on user input
********************************************************/
void Player::Shoot(const WEAPON_FIRE &fireInput)
{
myData->weapon->UseWeapon(fireInput);
}
/********************************************************
* Jumps if the player is currently not in a state of jumping
* Applies a force upwards(current upwards)
********************************************************/
void Player::Jump()
{
}
bool Player::IsWalking()
{
return (myData->playerState == PLAYER_STATE_WALKING);
}
bool Player::IsJumping()
{
return (myData->playerState == PLAYER_STATE_JUMPING);
}
bool Player::IsIdle()
{
return (myData->playerState == PLAYER_STATE_IDLE);
}
Oyster::Math::Float3 Player::GetPos()
{
return myData->rigidBody->GetCenter();
}
/********************************************************
* Respawns the player on a new chosen position
* This resets a set of variables such as life, ammo etcetc
********************************************************/
void Player::Respawn()
{
}

View File

@ -0,0 +1,35 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef PLAYER_H
#define PLAYER_H
#include "GameLogicStates.h"
#include "OysterMath.h"
namespace GameLogic
{
class Player
{
public:
Player(void);
~Player(void);
void Update();
void Move(const PLAYER_MOVEMENT &movement);
void Shoot(const WEAPON_FIRE &fireInput);
void Jump();
bool IsWalking();
bool IsJumping();
bool IsIdle();
Oyster::Math::Float3 GetPos();
void Respawn();
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -2,7 +2,7 @@
using namespace GameLogic; using namespace GameLogic;
typedef std::pair<Oyster::Physics::ICustomBody*, Object*> mapData; typedef std::pair<const Oyster::Physics::ICustomBody*, Object*> mapData;
RefManager* RefManager::instance = 0; RefManager* RefManager::instance = 0;
@ -34,12 +34,12 @@ RefManager* RefManager::getInstance( )
return instance; return instance;
} }
Object* RefManager::GetMap(Oyster::Physics::ICustomBody &body) Object* RefManager::GetMap(const Oyster::Physics::ICustomBody &body)
{ {
return mapper[&body]; return mapper[&body];
} }
void RefManager::AddMapping(Oyster::Physics::ICustomBody &body, Object &obj) void RefManager::AddMapping( const Oyster::Physics::ICustomBody &body, Object &obj)
{ {
mapper.insert(mapData(&body,&obj)); mapper.insert(mapData(&body,&obj));
} }

View File

@ -23,13 +23,13 @@ namespace GameLogic
void Release(); void Release();
Object* GetMap(Oyster::Physics::ICustomBody &body); //returns the object of an rigidBody, mainly used for CollisionHandler Object* GetMap(const Oyster::Physics::ICustomBody &body); //returns the object of an rigidBody, mainly used for CollisionHandler
void AddMapping(Oyster::Physics::ICustomBody &body, Object &obj); //adds a mapping with body as key and the object as a value void AddMapping(const Oyster::Physics::ICustomBody &body, Object &obj); //adds a mapping with body as key and the object as a value
private: private:
static RefManager* instance; static RefManager* instance;
std::map<Oyster::Physics::ICustomBody*,Object*> mapper; //mapper points a rigidBody to an actual game object std::map<const Oyster::Physics::ICustomBody*,Object*> mapper; //mapper points a rigidBody to an actual game object
}; };

View File

@ -0,0 +1,29 @@
#include "StaticObject.h"
using namespace GameLogic;
struct StaticObject::PrivateData
{
PrivateData()
{
}
~PrivateData()
{
}
}myData;
StaticObject::StaticObject()
{
myData = new PrivateData();
}
StaticObject::~StaticObject(void)
{
delete myData;
}

View File

@ -11,13 +11,16 @@
namespace GameLogic namespace GameLogic
{ {
class StaticObject : public Object class StaticObject
{ {
public: public:
StaticObject(void); StaticObject();
~StaticObject(void); ~StaticObject(void);
private:
struct PrivateData;
PrivateData *myData;
}; };
} }

View File

@ -0,0 +1,69 @@
#include "Weapon.h"
#include "AttatchmentSocket.h"
#include "AttatchmentMassDriver.h"
using namespace GameLogic;
struct Weapon::PrivateData
{
PrivateData()
{
weaponState = WEAPON_STATE_IDLE;
SelectedAttatchment = new AttatchmentMassDriver();
}
~PrivateData()
{
delete SelectedAttatchment;
}
WEAPON_STATE weaponState;
AttatchmentSocket **attatchmentSockets;
int nrOfAttatchmentSockets;
IAttatchment *SelectedAttatchment;
}myData;
Weapon::Weapon()
{
myData = new PrivateData();
}
Weapon::~Weapon(void)
{
delete myData;
}
/********************************************************
* Uses the weapon based on the input given and the current chosen attatchment
********************************************************/
void Weapon::UseWeapon(const WEAPON_FIRE &fireInput)
{
myData->SelectedAttatchment->UseAttatchment(fireInput);
}
/********************************************************
* Specific weapon usage implementation
********************************************************/
/********************************************************
* Get functions for states
********************************************************/
bool Weapon::IsFireing()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_FIREING);
}
bool Weapon::IsIdle()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_IDLE);
}
bool Weapon::IsReloading()
{
return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_RELOADING);
}

View File

@ -0,0 +1,34 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef WEAPON_H
#define WEAPON_H
#include "GameLogicStates.h"
namespace GameLogic
{
class Weapon
{
public:
Weapon(void);
~Weapon(void);
void UseWeapon(const WEAPON_FIRE &fireInput);
bool IsFireing();
bool IsIdle();
bool IsReloading();
private:
struct PrivateData;
PrivateData *myData;
};
}
#endif

View File

@ -0,0 +1,163 @@
<?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>{DA2AA800-ED64-4649-8B3B-E7F1E3968B78}</ProjectGuid>
<RootNamespace>GameProtocols</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</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)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)Network\NetworkAPI\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)Network\NetworkAPI\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>$(SolutionDir)Network\NetworkAPI\;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>$(SolutionDir)Network\NetworkAPI\;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</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>
<Lib>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</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>
<Lib>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>NetworkAPI_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="PlayerProtocols.h" />
<ClInclude Include="ProtocolIdentificationID.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,50 @@
#ifndef GAMELOGIC_PLAYER_PROTOCOLS_H
#define GAMELOGIC_PLAYER_PROTOCOLS_H
#include "CustomNetProtocol.h"
#include "ProtocolIdentificationID.h"
namespace GameLogic
{
struct Protocol_PlayerMovement :public Network::CustomProtocolObject
{
int ProtocolID;
bool bForward;
bool bBackward;
bool bTurnLeft;
bool bTurnRight;
bool bStrafeRight;
bool bStrafeLeft;
Protocol_PlayerMovement()
{
protocol[0]->value = ProtocolID = protocol_PlayerNavigation;
protocol[0]->type = Network::NetAttributeType_Int;
protocol[1]->type = Network::NetAttributeType_Bool;
protocol[2]->type = Network::NetAttributeType_Bool;
protocol[3]->type = Network::NetAttributeType_Bool;
protocol[4]->type = Network::NetAttributeType_Bool;
protocol[5]->type = Network::NetAttributeType_Bool;
protocol[6]->type = Network::NetAttributeType_Bool;
}
Network::CustomNetProtocol* GetProtocol() override
{
protocol[1]->value = bForward;
protocol[2]->value = bBackward;
protocol[3]->value = bTurnLeft;
protocol[4]->value = bTurnRight;
protocol[5]->value = bStrafeRight;
protocol[6]->value = bStrafeRight;
return &protocol;
}
private:
Network::CustomNetProtocol protocol;
};
}
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H

View File

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

View File

@ -1,20 +0,0 @@
#include "DynamicObject.h"
using namespace GameLogic;
using namespace Oyster::Physics;
using namespace Utility::DynamicMemory;
DynamicObject::DynamicObject(void)
:Object()
{
}
DynamicObject::~DynamicObject(void)
{
}
void DynamicObject::Update()
{
//update object
}

View File

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Level.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Object.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Player.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IGame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StaticObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Weapon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DynamicObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RefManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameMode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CollisionManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Camera.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Level.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IGame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StaticObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Weapon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DynamicObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RefManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TestGLMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GameMode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CollisionManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,15 +0,0 @@
#include "GameMode.h"
using namespace GameLogic;
GameMode::GameMode(void)
{
}
GameMode::~GameMode(void)
{
}

View File

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

View File

@ -1,37 +0,0 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef LEVEL_H
#define LEVEL_H
#include "StaticObject.h"
#include "DynamicObject.h"
#include "GameMode.h"
namespace GameLogic
{
class Level
{
public:
Level(void);
~Level(void);
private:
StaticObject** staticObjects;
int nrOfStaticObjects;
DynamicObject** dynamicObjects;
int nrOfDynamicObjects;
GameMode* gameMode;
};
}
#endif

View File

@ -1,55 +0,0 @@
#include "Player.h"
#include "OysterMath.h"
using namespace GameLogic;
using namespace Oyster::Physics;
Player::Player(void)
:Object()
{
life = 100;
}
Player::~Player(void)
{
delete this->rigidBody;
}
void Player::Update(keyInput keyPressed)
{
if(keyPressed != keyInput_none)
{
Move(keyPressed);
}
}
void Player::Move(keyInput keyPressed)
{
if(keyPressed == keyInput_A)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_D)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x += 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_S)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_W)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y += 0.1;
rigidBody->SetCenter(pos);
}
}
void Player::Shoot()
{
}

View File

@ -1,37 +0,0 @@
//////////////////////////////////////////////////
//Created by Erik and Linda of the GameLogic team
//////////////////////////////////////////////////
#ifndef PLAYER_H
#define PLAYER_H
#include "Object.h"
#include "Weapon.h"
#include "IGame.h"
namespace GameLogic
{
class Player : public Object
{
public:
Player(void);
~Player(void);
/********************************************************
* Update the position of the rigid body
* This will be done with physics later
********************************************************/
void Update(keyInput keyPressed);
void Move(keyInput keyPressed);
void Shoot();
private:
int life;
Weapon *weapon;
};
}
#endif

View File

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

View File

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

View File

@ -7,7 +7,6 @@
#ifndef _INPUTCLASS_H_ #ifndef _INPUTCLASS_H_
#define _INPUTCLASS_H_ #define _INPUTCLASS_H_
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#pragma comment(lib, "dinput8.lib") #pragma comment(lib, "dinput8.lib")

View File

@ -120,11 +120,12 @@ void OysterResource::Clean()
//Remove all the references //Remove all the references
while (!OResource::Release(i->second)); while (!OResource::Release(i->second));
const wchar_t* temp = i->second->GetResourceFilename(); std::wstring temp = i->second->GetResourceFilename();
delete resourcePrivate.resources[temp]; delete resourcePrivate.resources[temp];
resourcePrivate.resources.erase(temp);
} }
resourcePrivate.resources.clear();
} }
void OysterResource::ReleaseResource(const OHRESOURCE& resourceData) void OysterResource::ReleaseResource(const OHRESOURCE& resourceData)
{ {
@ -133,7 +134,7 @@ void OysterResource::ReleaseResource(const OHRESOURCE& resourceData)
{ {
if(OResource::Release(t)) if(OResource::Release(t))
{ {
const wchar_t* temp = t->GetResourceFilename(); std::wstring temp = t->GetResourceFilename();
delete resourcePrivate.resources[temp]; delete resourcePrivate.resources[temp];
resourcePrivate.resources.erase(temp); resourcePrivate.resources.erase(temp);
} }
@ -146,7 +147,7 @@ void OysterResource::ReleaseResource(const wchar_t filename[])
{ {
if(OResource::Release(t)) if(OResource::Release(t))
{ {
const wchar_t* temp = t->GetResourceFilename(); std::wstring temp = t->GetResourceFilename();
delete resourcePrivate.resources[temp]; delete resourcePrivate.resources[temp];
resourcePrivate.resources.erase(temp); resourcePrivate.resources.erase(temp);
} }

View File

@ -1,162 +0,0 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef MISC_OYSTER_RESOURCE_H
#define MISC_OYSTER_RESOURCE_H
namespace Oyster
{
namespace Resource
{
struct CustomData;
/** A Resource handle representing various resources */
typedef void* OHRESOURCE;
/** Typedef on a fuction required for custom unloading */
typedef void(*CustomUnloadFunction)(void* loadedData);
/** Typedef on a fuction required for custom loading */
<<<<<<< HEAD
typedef CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
=======
typedef void(*CustomLoadFunction)(const wchar_t filename[], CustomData& outData);
>>>>>>> d08644e8e1ecc56f4d9dfa6a9aa33df94d9e655a
/** An enum class representing all avalible resources that is supported. */
enum ResourceType
{
//Byte
ResourceType_Byte_Raw, /**< Handle can be interpeted as char[] or char* */
ResourceType_Byte_ANSI, /**< Handle can be interpeted as char[] or char* */
ResourceType_Byte_UTF8, /**< Handle can be interpeted as char[] or char* */
ResourceType_Byte_UNICODE, /**< Handle can be interpeted as char[] or char* */
ResourceType_Byte_UTF16LE, /**< Handle can be interpeted as char[] or char* */
ResourceType_COUNT, /**< Not used. */
ResourceType_UNKNOWN = -1, /**< Handle can be interpeted as void* */
ResourceType_INVALID = -2, /**< Invalid or non existing resource */
};
/** A struct to fill when doing a custom resource Load. */
struct CustomData
{
void* loadedData; //<! The loaded resource interpeted as a void*.
CustomUnloadFunction resourceUnloadFnc; //<! The function that will be used to free the resource when needed.
};
/** A resource handler interface to interact with when loading resources.
* The resource handler uses the filename to make resources unuiqe.
*/
class OysterResource
{
public:
/**
* Load a resource given a type.
* @param filename The path to the resource.
* @param type The resource type to load.
* @param force If set to true, the resource will be reloaded if it already exists. If it does not, nothing happens.
* @return If function suceeds, a handle to the resource will be returned. If failed 0 is returned.
*/
static OHRESOURCE LoadResource(const wchar_t filename[], ResourceType type, int customId = -1, bool force = false);
/**
* Load a resource with a custom loading function
* @param filename The path to the resource.
* @param loadFnc If set, this gives you the right to do custom resource loading if your recource type is not supported.
* @param customId A custom ID that can be used.
* @param force If set to true, the resource will be reloaded even if exists.
* @return If function suceeds, a handle to the resource will be returned. If failed 0 is returned.
*/
static OHRESOURCE LoadResource(const wchar_t filename[], CustomLoadFunction loadFnc = 0, int customId = -1, bool force = false);
/**
* Reload a resource
* @param filename The path to the resource.
* @return If function suceeds, a handle to the resource will be returned. If failed 0 is returned.
*/
static OHRESOURCE ReloadResource(const wchar_t filename[]);
/**
* Reload a resource
* @param filename The path to the resource.
* @return If function suceeds, a handle to the resource will be returned. If failed 0 is returned.
*/
static OHRESOURCE ReloadResource(OHRESOURCE resource);
/**
* Releases all resources loaded by the resource handler.
* @return Nothing
*/
static void Clean();
/**
* Release a reference to the resource handle
* @param resource The handle to release.
* @return Nothing
*/
static void ReleaseResource(const OHRESOURCE& resource);
/**
* Release a reference to the resource handle
* @param resource The resource filename to release reference.
* @return Nothing
*/
static void ReleaseResource(const wchar_t filename[]);
/** Set a user defined ID
* @param resource A handle to accociate the id with.
* @param id A user defined identifier that the resource handler does not touch.
*/
static void SetResourceId(const OHRESOURCE& resource, unsigned int id);
/** Set a user defined ID
* If the resource is not loaded the id will not be set.
* @param resource A filename to accociate the id with.
* @param id A user defined identifier that the resource handler does not touch.
*/
static void SetResourceId(const wchar_t filename[], unsigned int id);
/** Get a resource type given a OHRESOURCE handle
* @param resource The handle to check
* @return Returns the resource type of the handle
*/
static ResourceType GetResourceType(const OHRESOURCE& resource);
/** Get a resource type given a filename
* If the resource is not loaded the id will not be set.
* @param resource The filename to check
* @return Returns the resource type of the handle
*/
static ResourceType GetResourceType (const wchar_t filename[]);
/** Get a resource filename given a OHRESOURCE handle
* @param resource The handle to check
* @return Returns the accociated filename
*/
static const wchar_t* GetResourceFilename(const OHRESOURCE& resource);
/** Get a resource handle given a filename
* If the resource is not loaded function returns 0.
* @param resource The filename to check
* @return Returns the accociated handle
*/
static OHRESOURCE GetResourceHandle(const wchar_t filename[]);
/** Get a user defined ID accociated with a handle
* @param resource The handle to check
* @return Returns the accociated ID
*/
static int GetResourceId(const OHRESOURCE& resource);
/** Get a user defined ID accociated with a filename
* @param resource The filename to check
* @return Returns the accociated ID
*/
static int GetResourceId(const wchar_t filename[]);
};
}
}
#endif

View File

@ -22,7 +22,7 @@ std::wstring GetErrorMessage(int errorCode)
LPWSTR lpMessage; LPWSTR lpMessage;
std::wstring retVal(L"Succesful"); std::wstring retVal(L"Succesful");
DWORD bufLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , DWORD bufLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS ,
NULL, NULL,
errorCode , errorCode ,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) , MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) ,

View File

@ -32,7 +32,8 @@ namespace Oyster
log << "DirectX running in debug mode.\n"; log << "DirectX running in debug mode.\n";
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif #endif
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
D3D_FEATURE_LEVEL featureLevelsToTry[] = D3D_FEATURE_LEVEL featureLevelsToTry[] =
{ {

View File

@ -279,7 +279,7 @@ namespace Oyster
void Core::ShaderManager::Clean() void Core::ShaderManager::Clean()
{ {
for(int i = 0; i < VData.size(); ++i) for(int i = 0; i < (int)VData.size(); ++i)
{ {
delete[] VData[i].data; delete[] VData[i].data;
} }

View File

@ -4,11 +4,18 @@
#include "../Render/Rendering/Render.h" #include "../Render/Rendering/Render.h"
#include "../FileLoader/ObjReader.h" #include "../FileLoader/ObjReader.h"
#include "../../Misc/Resource/OysterResource.h" #include "../../Misc/Resource/OysterResource.h"
#include "../FileLoader/GeneralLoader.h"
namespace Oyster namespace Oyster
{ {
namespace Graphics namespace Graphics
{ {
namespace
{
Math::Float4x4 View;
Math::Float4x4 Projection;
}
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
{ {
Core::resolution = resulotion; Core::resolution = resulotion;
@ -26,16 +33,31 @@ namespace Oyster
return API::Sucsess; return API::Sucsess;
} }
void API::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection) void API::SetProjection(Math::Float4x4& projection)
{
Projection = projection;
}
void API::SetView(Math::Float4x4& view)
{
View = view;
}
void API::NewFrame()
{ {
Render::Rendering::Basic::NewFrame(View, Projection); Render::Rendering::Basic::NewFrame(View, Projection);
} }
void API::RenderScene(Model::Model* models, int count) void API::RenderScene(Model::Model models[], int count)
{ {
Render::Rendering::Basic::RenderScene(models,count); Render::Rendering::Basic::RenderScene(models,count);
} }
void API::RenderModel(Model::Model& m)
{
Render::Rendering::Basic::RenderScene(&m,1);
}
void API::EndFrame() void API::EndFrame()
{ {
Render::Rendering::Basic::EndFrame(); Render::Rendering::Basic::EndFrame();
@ -52,9 +74,7 @@ namespace Oyster
m->WorldMatrix = Oyster::Math::Float4x4::identity; m->WorldMatrix = Oyster::Math::Float4x4::identity;
m->Visible = true; m->Visible = true;
OBJReader or; m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadOBJ);
or.readOBJFile(filename);
m->info = or.toModel();
return m; return m;
} }
@ -63,7 +83,7 @@ namespace Oyster
{ {
Model::ModelInfo* info = (Model::ModelInfo*)model->info; Model::ModelInfo* info = (Model::ModelInfo*)model->info;
delete model; delete model;
info->Vertices->~Buffer(); Oyster::Resource::OysterResource::ReleaseResource((Oyster::Resource::OHRESOURCE)info);
} }
void API::Clean() void API::Clean()
@ -72,6 +92,14 @@ namespace Oyster
Oyster::Resource::OysterResource::Clean(); Oyster::Resource::OysterResource::Clean();
Oyster::Graphics::Core::ShaderManager::Clean(); Oyster::Graphics::Core::ShaderManager::Clean();
Oyster::Graphics::Render::Resources::Clean(); Oyster::Graphics::Render::Resources::Clean();
SAFE_RELEASE(Core::depthStencil);
SAFE_RELEASE(Core::backBufferRTV);
SAFE_RELEASE(Core::backBufferUAV);
SAFE_RELEASE(Core::swapChain);
SAFE_RELEASE(Core::deviceContext);
SAFE_RELEASE(Core::device);
} }
} }
} }

View File

@ -4,13 +4,12 @@
#include "OysterMath.h" #include "OysterMath.h"
#include <Windows.h> #include <Windows.h>
#if defined GFX_DLL_EXPORT #ifdef GFX_DLL_EXPORT
#define GFX_DLL_USAGE __declspec(dllexport) #define GFX_DLL_USAGE __declspec(dllexport)
#else #else
#define GFX_DLL_USAGE __declspec(dllimport) #define GFX_DLL_USAGE
#endif #endif
namespace Oyster namespace Oyster
{ {
namespace Graphics namespace Graphics
@ -29,9 +28,14 @@ namespace Oyster
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion);
static void Clean(); static void Clean();
//! @brief from Oyster::Math Float4x4, expects corect methods
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection); static void SetView(Oyster::Math::Float4x4& View);
static void RenderScene(Oyster::Graphics::Model::Model* models, int count); static void SetProjection(Oyster::Math::Float4x4& Projection);
//! @brief will internally use last values from SetView and SetProjection
static void NewFrame();
static void RenderScene(Oyster::Graphics::Model::Model models[], int count);
static void RenderModel(Oyster::Graphics::Model::Model& model);
static void EndFrame(); static void EndFrame();
static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename); static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);

View File

@ -27,7 +27,8 @@ namespace Oyster
void UnloadShaderD(void* loadedData); void UnloadShaderD(void* loadedData);
void LoadShaderD(const wchar_t filename[], Oyster::Resource::CustomData& out); void LoadShaderD(const wchar_t filename[], Oyster::Resource::CustomData& out);
void LoadShader(const wchar_t filename[], Oyster::Resource::CustomData& out, int type); void UnloadOBJ(void* loadedData);
void LoadOBJ(const wchar_t filename[], Oyster::Resource::CustomData& out);
} }
} }
} }

View File

@ -1,6 +1,7 @@
#include "GeneralLoader.h" #include "GeneralLoader.h"
#include "..\Core\Dx11Includes.h" #include "..\Core\Dx11Includes.h"
#include "..\Core\Core.h" #include "..\Core\Core.h"
#include "ObjReader.h"
HRESULT CreateWICTextureFromFileEx( ID3D11Device* d3dDevice, HRESULT CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
ID3D11DeviceContext* d3dContext, ID3D11DeviceContext* d3dContext,
@ -35,6 +36,30 @@ void Oyster::Graphics::Loading::UnloadTexture(void* data)
SAFE_RELEASE(srv); SAFE_RELEASE(srv);
} }
void Oyster::Graphics::Loading::LoadOBJ(const wchar_t filename[], Oyster::Resource::CustomData& out)
{
OBJReader obj;
obj.readOBJFile(filename);
Model::ModelInfo* info;
info = obj.toModel();
out.loadedData = info;
out.resourceUnloadFnc = Oyster::Graphics::Loading::UnloadOBJ;
}
void Oyster::Graphics::Loading::UnloadOBJ(void* data)
{
Model::ModelInfo* info = (Model::ModelInfo*) data;
SAFE_DELETE(info->Vertices);
if(info->Indexed)
{
SAFE_DELETE(info->Indecies);
}
for(int i =0;i<info->Material.size();++i)
{
Oyster::Resource::OysterResource::ReleaseResource(info->Material[i]);
}
delete info;
}
#include <wrl.h> #include <wrl.h>
#include <memory> #include <memory>

View File

@ -95,7 +95,7 @@ void OBJReader::readOBJFile( std::wstring fileName )
inStream.close(); inStream.close();
Mat = Oyster::Resource::OysterResource::LoadResource((fileName + L".jpg").c_str(),Oyster::Graphics::Loading::LoadTexture); Mat = Oyster::Resource::OysterResource::LoadResource((fileName + L".png").c_str(),Oyster::Graphics::Loading::LoadTexture);
} }
Oyster::Graphics::Model::ModelInfo* OBJReader::toModel() Oyster::Graphics::Model::ModelInfo* OBJReader::toModel()

View File

@ -10,6 +10,8 @@ namespace Oyster
{ {
namespace Loading namespace Loading
{ {
void LoadShader(const wchar_t filename[], Oyster::Resource::CustomData& out, int type);
void UnloadShaderP(void* loadedData) void UnloadShaderP(void* loadedData)
{ {
ID3D11PixelShader* ps = ((ID3D11PixelShader*)loadedData); ID3D11PixelShader* ps = ((ID3D11PixelShader*)loadedData);
@ -165,14 +167,16 @@ namespace Oyster
data.data = new char[data.size]; data.data = new char[data.size];
memcpy(data.data,Shader->GetBufferPointer(),data.size); memcpy(data.data,Shader->GetBufferPointer(),data.size);
#else #else
std::ifstream stream;
stream.open(filename, std::ifstream::in | std::ifstream::binary); stream.open(filename, std::ifstream::in | std::ifstream::binary);
if(stream.good()) if(stream.good())
{ {
stream.seekg(0, std::ios::end); stream.seekg(0, std::ios::end);
sd.size = size_t(stream.tellg()); data.size = size_t(stream.tellg());
sd.data = new char[sd.size]; data.data = new char[data.size];
stream.seekg(0, std::ios::beg); stream.seekg(0, std::ios::beg);
stream.read(&sd.data[0], sd.size); stream.read(&data.data[0], data.size);
stream.close(); stream.close();
} }
else else
@ -180,7 +184,6 @@ namespace Oyster
memset(&out,0,sizeof(out)); memset(&out,0,sizeof(out));
return; return;
} }
#endif #endif
out.loadedData = Core::ShaderManager::CreateShader(data, Core::ShaderManager::ShaderType(type)); out.loadedData = Core::ShaderManager::CreateShader(data, Core::ShaderManager::ShaderType(type));
} }

View File

@ -109,6 +109,7 @@
</ProjectReference> </ProjectReference>
<FxCompile> <FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput> <ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<ShaderModel>5.0</ShaderModel>
</FxCompile> </FxCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -124,12 +125,13 @@
</Link> </Link>
<FxCompile> <FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput> <ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<ShaderModel>5.0</ShaderModel>
</FxCompile> </FxCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
@ -143,12 +145,14 @@
</Link> </Link>
<FxCompile> <FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput> <ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<EnableDebuggingInformation>true</EnableDebuggingInformation>
<ShaderModel>5.0</ShaderModel>
</FxCompile> </FxCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
@ -162,6 +166,8 @@
</Link> </Link>
<FxCompile> <FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput> <ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<EnableDebuggingInformation>true</EnableDebuggingInformation>
<ShaderModel>5.0</ShaderModel>
</FxCompile> </FxCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -172,7 +178,7 @@
<ClCompile Include="DllInterfaces\GFXAPI.cpp" /> <ClCompile Include="DllInterfaces\GFXAPI.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" /> <ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="FileLoader\ShaderLoader.cpp" /> <ClCompile Include="FileLoader\ShaderLoader.cpp" />
<ClCompile Include="FileLoader\TextureLoader.cpp" /> <ClCompile Include="FileLoader\ModelLoader.cpp" />
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" /> <ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" /> <ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Render\Resources\Resources.cpp" /> <ClCompile Include="Render\Resources\Resources.cpp" />
@ -264,6 +270,8 @@
<ItemGroup> <ItemGroup>
<None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" /> <None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" />
<None Include="Shader\HLSL\Deffered Shaders\Render\Defines.hlsli" /> <None Include="Shader\HLSL\Deffered Shaders\Render\Defines.hlsli" />
<None Include="Shader\HLSL\Deffered Shaders\Render\LightCalc.hlsli" />
<None Include="Shader\HLSL\Deffered Shaders\Render\PosManipulation.hlsli" />
<None Include="Shader\HLSL\SimpleDebug\Debug.hlsl" /> <None Include="Shader\HLSL\SimpleDebug\Debug.hlsl" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -2,6 +2,8 @@
#include "../Resources/Resources.h" #include "../Resources/Resources.h"
#include "../../Definitions/GraphicalDefinition.h" #include "../../Definitions/GraphicalDefinition.h"
#include "../../Model/ModelInfo.h" #include "../../Model/ModelInfo.h"
#include <map>
#include <vector>
namespace Oyster namespace Oyster
{ {
@ -60,7 +62,8 @@ namespace Oyster
} }
void Basic::EndFrame() void Basic::EndFrame()
{ {
Core::swapChain->Present(0,0); IDXGISwapChain* chain = Core::swapChain;
chain->Present(0,0);
} }
} }
} }

View File

@ -3,7 +3,8 @@
// /Bin/Executable/Tester -> // /Bin/Executable/Tester ->
// /Code/OysterGraphics/Shader/HLSL // /Code/OysterGraphics/Shader/HLSL
const std::wstring PathFromExeToHlsl = L"..\\..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\"; const std::wstring PathFromExeToCso = L"..\\Content\\Shaders\\";
const std::wstring PathFromExeToHlsl = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\";
const std::wstring VertexTransformDebug = L"TransformDebugVertex"; const std::wstring VertexTransformDebug = L"TransformDebugVertex";
const std::wstring VertexDebug = L"DebugVertex"; const std::wstring VertexDebug = L"DebugVertex";
const std::wstring PixelRed = L"DebugPixel"; const std::wstring PixelRed = L"DebugPixel";
@ -42,6 +43,12 @@ namespace Oyster
#else #else
/** Load Vertex Shader with Precompiled */ /** Load Vertex Shader with Precompiled */
Core::ShaderManager::Init(PathFromExeToCso + L"DebugCameraVertex.cso",ShaderType::Vertex, VertexTransformDebug);
Core::ShaderManager::Init(PathFromExeToCso + L"DebugVertex.cso",ShaderType::Vertex, VertexDebug);
/** Load Pixel Shader with Precompiled */
Core::ShaderManager::Init(PathFromExeToCso + L"DebugPixel.cso",ShaderType::Pixel, PixelRed);
Core::ShaderManager::Init(PathFromExeToCso + L"TextureDebug.cso",ShaderType::Pixel, PixelTexture);
#endif #endif
#pragma endregion #pragma endregion
@ -152,10 +159,9 @@ namespace Oyster
void Resources::Clean() void Resources::Clean()
{ {
Resources::ModelData.~Buffer(); Resources::ModelData.~Buffer();
Resources::VPData.~Buffer();
for(int i = 0; i < obj.CBuffers.Vertex.size(); ++i) for(int i = 0; i < obj.CBuffers.Vertex.size(); ++i)
{ {
//SAFE_RELEASE(obj.CBuffers.Vertex[i]); obj.CBuffers.Vertex[i]->~Buffer();
} }
for(int i = 0; i < obj.CBuffers.Pixel.size(); ++i) for(int i = 0; i < obj.CBuffers.Pixel.size(); ++i)
{ {

View File

@ -1,7 +1,31 @@
#ifndef DEFINES
#define DEFINES
struct PointLight struct PointLight
{ {
float3 Pos; float4 PosRadius;
float Radius; float4 ColorBright;
};
float3 Color; struct DiffSpec
} {
float3 Diffuse;
float3 Specular;
};
cbuffer PointLights : register(b0)
{
PointLight pl;
}
cbuffer LightConstants : register(b1)
{
float4x4 InvProj;
int2 Pixels;
}
Texture2D DiffuseGlow : register(t0);
Texture2D NormalSpec : register(t1);
Texture2D DepthTexture : register(t2);
#endif

View File

@ -0,0 +1,23 @@
#include "Defines.hlsli"
DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord)
{
DiffSpec output;
float4 normalSpec = NormalSpec[texCoord];
float3 lightVec = pl.PosRadius.xyz - pos.xyz;
float d = length(lightVec);
lightVec = lightVec/d;
float diffFactor = max(dot(lightVec, normalSpec.xyz), 0.0f);
float3 v = reflect(-lightVec, normalSpec.xyz);
float specFactor = pow(max(dot(v,normalize(-pos)), 0.0f),normalSpec.w);
//Check att later
float att = (max(d-pl.PosRadius.w,0)/pow(pl.PosRadius.w,2));
//fix Ilum calcs instead of PhongBlinn
output.Diffuse = pl.ColorBright.w * att * diffFactor * pl.ColorBright.xyz;
output.Specular = pl.ColorBright.w * att * specFactor * pl.ColorBright.xyz;
if(diffFactor == 0)
output.Specular * 0;
return output;
}

View File

@ -1,11 +1,16 @@
#include "Defines.hlsli"
#include "LightCalc.hlsli"
#include "PosManipulation.hlsli"
//todo //todo
//LightCulling //LightCulling
//Calc Diff + Spec //Calc Diff + Spec
//Calc Ambience //Calc Ambience
//Write Glow //Write Glow
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main( uint3 DTid : SV_DispatchThreadID ) void main( uint3 DTid : SV_DispatchThreadID )
{ {
float3 ViewPos = ToVpos(DTid.xy);
//DiffSpec LightCalc(pl, float3 pos)
} }

View File

@ -0,0 +1,21 @@
#include "Defines.hlsli"
//assumes ProperfloatTexCoords
float3 ToVpos(float2 texCoord)
{
//Get proper UV
float2 UV = float2(texCoord) / float2(Pixels);
float4 ViewPos;
// Get the depth value for this pixel
ViewPos.z= DepthTexture[texCoord].x;
//Get X/w
ViewPos.x = UV.x * 2 - 1;
//Get Y/w
ViewPos.y = 1 - 2 * UV.y;
ViewPos.w = 1;
//Un project
ViewPos = mul(ViewPos, InvProj);
return ViewPos.xyz / ViewPos.w;
}

View File

@ -69,21 +69,25 @@
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</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>
<TargetExt>.lib</TargetExt>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<TargetExt>.lib</TargetExt>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</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>
<TargetExt>.lib</TargetExt>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<TargetExt>.lib</TargetExt>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>

View File

@ -18,6 +18,7 @@
HINSTANCE g_hInst = NULL; HINSTANCE g_hInst = NULL;
HWND g_hWnd = NULL; HWND g_hWnd = NULL;
Oyster::Graphics::Model::Model* m = NULL; Oyster::Graphics::Model::Model* m = NULL;
Oyster::Graphics::Model::Model* m2 = NULL;
Oyster::Math::Float4x4 V; Oyster::Math::Float4x4 V;
Oyster::Math::Float4x4 P; Oyster::Math::Float4x4 P;
@ -41,7 +42,7 @@ HRESULT InitDirect3D();
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{ {
BOOL b = SetDllDirectoryW(L"..\\..\\DLL"); BOOL b = SetDllDirectoryW(L"..\\DLL");
typedef struct tagLOADPARMS32 typedef struct tagLOADPARMS32
{ {
LPSTR lpEnvAddress; // address of environment strings LPSTR lpEnvAddress; // address of environment strings
@ -92,6 +93,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
} }
Oyster::Graphics::API::DeleteModel(m); Oyster::Graphics::API::DeleteModel(m);
Oyster::Graphics::API::DeleteModel(m2);
Oyster::Graphics::API::Clean(); Oyster::Graphics::API::Clean();
return (int) msg.wParam; return (int) msg.wParam;
} }
@ -186,11 +188,15 @@ HRESULT InitDirect3D()
#pragma endregion #pragma endregion
#pragma region Obj #pragma region Obj
m = Oyster::Graphics::API::CreateModel(L"orca"); m = Oyster::Graphics::API::CreateModel(L"crate");
m2 = Oyster::Graphics::API::CreateModel(L"crate");
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null);
#pragma endregion #pragma endregion
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000); P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
Oyster::Graphics::API::SetProjection(P);
P.Invert();
V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f)); V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f));
V = Oyster::Math3D::InverseOrientationMatrix(V); V = Oyster::Math3D::InverseOrientationMatrix(V);
@ -203,14 +209,17 @@ HRESULT Update(float deltaTime)
{ {
angle += Oyster::Math::pi/30000; angle += Oyster::Math::pi/30000;
m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle);
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,0,1)*-angle,Oyster::Math::Float3(0,4,0),Oyster::Math::Float3::null);
return S_OK; return S_OK;
} }
HRESULT Render(float deltaTime) HRESULT Render(float deltaTime)
{ {
Oyster::Graphics::API::NewFrame(V,P); Oyster::Graphics::API::SetView(V);
Oyster::Graphics::API::NewFrame();
Oyster::Graphics::API::RenderScene(m,1); Oyster::Graphics::API::RenderModel(*m);
Oyster::Graphics::API::RenderModel(*m2);
Oyster::Graphics::API::EndFrame(); Oyster::Graphics::API::EndFrame();

View File

@ -69,7 +69,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
@ -77,7 +77,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
@ -85,7 +85,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
@ -93,7 +93,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
@ -113,7 +113,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>OysterGraphics_x86D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
<ProjectReference> <ProjectReference>
<LinkLibraryDependencies> <LinkLibraryDependencies>
@ -136,7 +136,6 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding> <PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -144,9 +143,9 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -159,7 +158,7 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding> <PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>OysterGraphics_x86.dll;</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -167,7 +166,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -182,7 +181,6 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding> <PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View File

@ -34,8 +34,14 @@ WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100; ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
break; break;
case WM_KEYDOWN:
if(wParam == VK_ESCAPE)
PostQuitMessage(0);
break;
default: default:
return DefWindowProc(hwnd, msg, wParam, lParam); return DefWindowProc(hwnd, msg, wParam, lParam);
} }
return 0; return 0;
} }
@ -84,39 +90,18 @@ int WINAPI WinMain( HINSTANCE hInst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
{ {
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
/******************************************** /********************************************
* Description of a window * * Description of a window *
*******************************************/ *******************************************/
WindowShell::INIT_DESC_WINDOW wDesc; WindowShell::WINDOW_INIT_DESC wDesc;
wDesc.hInstance = hInst; //wDesc.hInstance = hInst;
wDesc.windowName = L"Glare"; wDesc.windowPosition.x = 50;
wDesc.windowPosition = Point2D(50); wDesc.windowPosition.y = 50;
wDesc.windowSize = Point2D(1024, 800); wDesc.windowSize.x = 1024;
wDesc.windowSize.x = 800;
wDesc.windowProcCallback = WndProc; wDesc.windowProcCallback = WndProc;
/********************************************
* Description of a child window *
*******************************************/
WindowShell::INIT_DESC_CHILD_WINDOW cDesc;
cDesc.name = L"Child";
cDesc.style = WS_EX_RIGHTSCROLLBAR;
cDesc.topLeftPos = Point2D();
cDesc.windowProcCallback = ChildWndProc;
cDesc.windowSize = Point2D(80);
/************************************************************
* Initializing main window and several children *
************************************************************/
WindowShell::self()->createWin(wDesc); WindowShell::self()->createWin(wDesc);
WindowShell::self()->createChildWin(cDesc);
WindowShell::self()->createChildWin(cDesc);
WindowShell::self()->createChildWin(cDesc);
@ -134,7 +119,7 @@ int WINAPI WinMain( HINSTANCE hInst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh
} }
else else
{ {
} }
} }

View File

@ -24,30 +24,30 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -138,6 +138,10 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="WindowShell.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="WindowShell.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -14,4 +14,14 @@
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClCompile Include="WindowShell.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="WindowShell.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>

View File

@ -56,7 +56,7 @@ WindowShell::~WindowShell()
bool WindowShell::createWin(INIT_DESC_WINDOW &desc) bool WindowShell::createWin(WINDOW_INIT_DESC &desc)
{ {
if(pData->hWnd) if(pData->hWnd)
{ {
@ -68,14 +68,15 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
MessageBox(0, L"No callback function for window messages was found!" ,L"Error", 0); MessageBox(0, L"No callback function for window messages was found!" ,L"Error", 0);
return false; return false;
} }
if(!desc.hInstance) if(desc.windowSize.x < 0 || desc.windowSize.y < 0)
{
MessageBox(0, L"No HINSTANCE was specified!" ,L"Error", 0);
return false;
}
if(desc.windowSize < 0)
{ {
MessageBox(0, L"Size specified for window is invalid!" ,L"Error", 0); MessageBox(0, L"Size specified for window is invalid!" ,L"Error", 0);
return false;
}
if(!desc.hInstance)
{
desc.hInstance = GetModuleHandle(0);
} }
@ -87,7 +88,7 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
WNDCLASSEX wc; WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX); wc.cbSize = sizeof(WNDCLASSEX);
wc.hIconSm = NULL; wc.hIconSm = NULL;
wc.style = CS_HREDRAW | CS_VREDRAW; wc.style = desc.windowClassStyle;
wc.lpfnWndProc = desc.windowProcCallback; wc.lpfnWndProc = desc.windowProcCallback;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
@ -112,7 +113,7 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
pData->hWnd = CreateWindow( pData->hWnd = CreateWindow(
L"MainWindowClass" , L"MainWindowClass" ,
desc.windowName.c_str(), desc.windowName.c_str(),
WS_OVERLAPPEDWINDOW, desc.windowStyle,
desc.windowPosition.x, desc.windowPosition.x,
desc.windowPosition.y, desc.windowPosition.y,
desc.windowSize.x, desc.windowSize.x,
@ -138,7 +139,7 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
return true; return true;
} }
int WindowShell::createChildWin(INIT_DESC_CHILD_WINDOW &desc) int WindowShell::createChildWin(CHILD_WINDOW_INIT_DESC &desc)
{ {
ChildWin win; ChildWin win;

View File

@ -5,72 +5,45 @@
#include <string> #include <string>
struct Point2D
{
int x;
int y;
Point2D()
{
x = 0;
y = 0;
}
Point2D(int _x, int _y)
{
x = _x;
y = _y;
}
Point2D(int _p)
{
x = _p;
y = _p;
}
operator POINT() const
{
return Point2D(x, y);
}
bool operator<(int i)
{
bool a = x<i;
bool b = y<i;
return (a || b);
}
};
class WindowShell class WindowShell
{ {
public: public:
struct INIT_DESC_WINDOW struct WINDOW_INIT_DESC
{ {
HINSTANCE hInstance; HINSTANCE hInstance;
std::wstring windowName; std::wstring windowName;
Point2D windowSize; POINT windowSize;
Point2D windowPosition; POINT windowPosition;
WNDPROC windowProcCallback; WNDPROC windowProcCallback;
UINT windowClassStyle;
UINT windowStyle;
INIT_DESC_WINDOW() WINDOW_INIT_DESC()
{ {
hInstance = NULL; hInstance = NULL;
windowName = L"Child window"; windowName = L"MADAFACKA";
windowSize.x = 800; windowSize.x = 800;
windowSize.y = 600; windowSize.y = 600;
windowPosition.x = 0; windowPosition.x = 0;
windowPosition.y = 0; windowPosition.y = 0;
windowProcCallback = NULL; windowProcCallback = NULL;
windowClassStyle = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
windowStyle = WS_OVERLAPPEDWINDOW;
} }
}; };
struct INIT_DESC_CHILD_WINDOW struct CHILD_WINDOW_INIT_DESC
{ {
std::wstring name; std::wstring name;
DWORD style; DWORD style;
Point2D topLeftPos; POINT topLeftPos;
Point2D windowSize; POINT windowSize;
WNDPROC windowProcCallback; WNDPROC windowProcCallback;
INIT_DESC_CHILD_WINDOW() CHILD_WINDOW_INIT_DESC()
{ {
name = L"Child Window"; name = L"Child Window";
style = WS_CHILD; style = WS_CHILD;
topLeftPos = Point2D(0,0); memset(&topLeftPos, 0, sizeof(POINT));
windowSize.x = 300; windowSize.x = 300;
windowSize.y = 200; windowSize.y = 200;
windowProcCallback = NULL; windowProcCallback = NULL;
@ -94,9 +67,9 @@ class WindowShell
const int getChildID (HWND hwnd) const; const int getChildID (HWND hwnd) const;
/* Creates an empty window */ /* Creates an empty window */
bool createWin (INIT_DESC_WINDOW&); bool createWin (WINDOW_INIT_DESC&);
/*Creates a child window and returns the id of child window or -1 if failed*/ /*Creates a child window and returns the id of child window or -1 if failed*/
int createChildWin (INIT_DESC_CHILD_WINDOW&); int createChildWin (CHILD_WINDOW_INIT_DESC&);
/* Removes a child window */ /* Removes a child window */
bool removeChild (int id); bool removeChild (int id);
/* Removes a child window */ /* Removes a child window */