Network - Merged with Gamelogic
This commit is contained in:
commit
d95d771c43
|
@ -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
|
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
@ -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;
|
||||
}
|
|
@ -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>
|
|
@ -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
|
|
@ -0,0 +1,316 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: TemplateMain.cpp
|
||||
//
|
||||
// BTH-D3D-Template
|
||||
//
|
||||
// Copyright (c) Stefan Petersson 2011. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
//#include "IGame.h"
|
||||
|
||||
#include "L_inputClass.h"
|
||||
|
||||
// debug window include
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Global Variables
|
||||
//--------------------------------------------------------------------------------------
|
||||
HINSTANCE g_hInst = NULL;
|
||||
HWND g_hWnd = NULL;
|
||||
|
||||
//GameLogic::IGame* game;
|
||||
InputClass* inputObj;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow );
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HRESULT Render(float deltaTime);
|
||||
HRESULT Update(float deltaTime);
|
||||
HRESULT InitDirect3D();
|
||||
HRESULT InitGame();
|
||||
HRESULT CleanUp();
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Entry point to the program. Initializes everything and goes into a message processing
|
||||
// loop. Idle time is used to render the scene.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
void SetStdOutToNewConsole()
|
||||
{
|
||||
// allocate a console for this app
|
||||
AllocConsole();
|
||||
|
||||
// redirect unbuffered STDOUT to the console
|
||||
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
|
||||
FILE *fp = _fdopen( fileDescriptor, "w" );
|
||||
*stdout = *fp;
|
||||
setvbuf( stdout, NULL, _IONBF, 0 );
|
||||
|
||||
// give the console window a nicer title
|
||||
|
||||
SetConsoleTitle(L"Debug Output");
|
||||
|
||||
// give the console window a bigger buffer size
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
|
||||
{
|
||||
COORD bufferSize;
|
||||
bufferSize.X = csbi.dwSize.X;
|
||||
bufferSize.Y = 50;
|
||||
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
// for dynamic .dll loading
|
||||
// path is relative to the .exe and .dll pos
|
||||
// also change the VC directories - working dir is set to $(SolutionDir)..\Bin\Executable\Tester
|
||||
// to fit with where the .obj files is
|
||||
// linker/ input/ delayed load .dll - specify the .dll that should be loaded
|
||||
|
||||
BOOL success = SetDllDirectory(L"..\\..\\DLL");
|
||||
if (success == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||
return 0;
|
||||
|
||||
if( FAILED( InitDirect3D() ) )
|
||||
return 0;
|
||||
|
||||
if( FAILED( InitGame() ) )
|
||||
return 0;
|
||||
|
||||
__int64 cntsPerSec = 0;
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
|
||||
float secsPerCnt = 1.0f / (float)cntsPerSec;
|
||||
|
||||
__int64 prevTimeStamp = 0;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||
|
||||
//debug window
|
||||
//SetStdOutToNewConsole();
|
||||
|
||||
// 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
|
||||
Update(dt);
|
||||
Render(dt);
|
||||
|
||||
prevTimeStamp = currTimeStamp;
|
||||
}
|
||||
}
|
||||
CleanUp();
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Register class and create window
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT 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 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 and the game
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT InitGame()
|
||||
{
|
||||
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 false;
|
||||
}
|
||||
/*game = new GameLogic::IGame();
|
||||
game->Init();
|
||||
game->StartGame();
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Update(float deltaTime)
|
||||
{
|
||||
inputObj->Update();
|
||||
//GameLogic::keyInput key = GameLogic::keyInput_none;
|
||||
|
||||
//if(inputObj->IsKeyPressed(DIK_W))
|
||||
//{
|
||||
// key = GameLogic::keyInput_W;
|
||||
//}
|
||||
//else if(inputObj->IsKeyPressed(DIK_A))
|
||||
//{
|
||||
// key = GameLogic::keyInput_A;
|
||||
//}
|
||||
//else if(inputObj->IsKeyPressed(DIK_S))
|
||||
//{
|
||||
// key = GameLogic::keyInput_S;
|
||||
//}
|
||||
//else if(inputObj->IsKeyPressed(DIK_D))
|
||||
//{
|
||||
// key = GameLogic::keyInput_D;
|
||||
//}
|
||||
|
||||
float pitch = 0;
|
||||
float yaw = 0;
|
||||
|
||||
//if(inputObj->IsMousePressed())
|
||||
//{
|
||||
pitch = inputObj->GetPitch();
|
||||
yaw = inputObj->GetYaw();
|
||||
//}
|
||||
|
||||
//game->Update(key, pitch, yaw);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Render(float deltaTime)
|
||||
{
|
||||
int isPressed = 0;
|
||||
if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
isPressed = 1;
|
||||
//std::cout<<"test";
|
||||
}
|
||||
|
||||
//game->Render();
|
||||
wchar_t title[255];
|
||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||
SetWindowText(g_hWnd, title);
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CleanUp()
|
||||
{
|
||||
|
||||
/*if(game)
|
||||
{
|
||||
delete game;
|
||||
game = NULL;
|
||||
}*/
|
||||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#include "C_Object.h"
|
||||
using namespace DanBias::Client;
|
||||
|
||||
|
|
@ -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
|
|
@ -0,0 +1,12 @@
|
|||
#include "GameClientState.h"
|
||||
|
||||
using namespace DanBias::Client;
|
||||
|
||||
GameClientState::GameClientState(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GameClientState::~GameClientState(void)
|
||||
{
|
||||
}
|
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,202 @@
|
|||
<?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>{8690FDDF-C5B7-4C42-A337-BD5243F29B85}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>DanBiasLauncher</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</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\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<DelayLoadDLLs>DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Launcher.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
|
||||
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Input\Input.vcxproj">
|
||||
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\OysterGraphics\OysterGraphics.vcxproj">
|
||||
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\OysterMath\OysterMath.vcxproj">
|
||||
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DanBiasGame\DanBiasGame.vcxproj">
|
||||
<Project>{2a1bc987-af42-4500-802d-89cd32fc1309}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DanBiasServer\DanBiasServer.vcxproj">
|
||||
<Project>{52380daa-0f4a-4d97-8e57-98df39319caf}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -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>
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,185 @@
|
|||
#include "Camera.h"
|
||||
|
||||
Camera::Camera()
|
||||
{
|
||||
this->m_position = Oyster::Math::Float3(0, 50, 0);
|
||||
this->mRight = Oyster::Math::Float3(1, 0, 0);
|
||||
this->mUp = Oyster::Math::Float3(0, 1, 0);
|
||||
this->mLook = Oyster::Math::Float3(0, 0, 1);
|
||||
}
|
||||
|
||||
Camera::~Camera()
|
||||
{
|
||||
}
|
||||
|
||||
void Camera::SetPosition(const Oyster::Math::Float3& v)
|
||||
{
|
||||
this->m_position = v;
|
||||
}
|
||||
|
||||
Oyster::Math::Float3 Camera::GetPosition()const
|
||||
{
|
||||
return this->m_position;
|
||||
}
|
||||
|
||||
Oyster::Math::Float3 Camera::GetRight()const
|
||||
{
|
||||
return this->mRight;
|
||||
}
|
||||
|
||||
Oyster::Math::Float3 Camera::GetUp()const
|
||||
{
|
||||
return this->mUp;
|
||||
}
|
||||
|
||||
Oyster::Math::Float3 Camera::GetLook()const
|
||||
{
|
||||
return this->mLook;
|
||||
}
|
||||
|
||||
float Camera::GetNearZ()const
|
||||
{
|
||||
return this->mNearZ;
|
||||
}
|
||||
|
||||
float Camera::GetFarZ()const
|
||||
{
|
||||
return this->mFarZ;
|
||||
}
|
||||
|
||||
float Camera::GetAspect()const
|
||||
{
|
||||
return this->mAspect;
|
||||
}
|
||||
|
||||
Oyster::Math::Float3 Camera::CrossMatrix(const Oyster::Math::Float3& vector, const Oyster::Math::Float4x4& matrix)
|
||||
{
|
||||
Oyster::Math::Float3 vec;
|
||||
vec.x = matrix.m11*vector.x + matrix.m12*vector.y + matrix.m13*vector.z;
|
||||
vec.y = matrix.m21*vector.x + matrix.m22*vector.y + matrix.m23*vector.z;
|
||||
vec.z = matrix.m31*vector.x + matrix.m32*vector.y + matrix.m33*vector.z;
|
||||
return vec;
|
||||
}
|
||||
|
||||
void Camera::SetLens(float fovY, float aspect, float zn, float zf)
|
||||
{
|
||||
this->mFovY = fovY;
|
||||
this->mAspect = aspect;
|
||||
this->mNearZ = zn;
|
||||
this->mFarZ = zf;
|
||||
|
||||
float yScale = tan((Oyster::Math::pi*0.5f) - (mFovY*0.5f));
|
||||
float xScale = yScale/this->mAspect;
|
||||
|
||||
mProj = Oyster::Math::Float4x4(xScale, 0, 0, 0,
|
||||
0, yScale, 0, 0,
|
||||
0, 0, zf/(zf-zn), 1,
|
||||
0, 0, -zn*zf/(zf-zn), 0);
|
||||
mProj.Transpose();
|
||||
}
|
||||
|
||||
void Camera::LookAt(Oyster::Math::Float3 pos, Oyster::Math::Float3 target, Oyster::Math::Float3 worldUp)
|
||||
{
|
||||
Oyster::Math::Float3 L;
|
||||
|
||||
L = target - pos;
|
||||
L.Normalize();
|
||||
|
||||
Oyster::Math::Float3 R;
|
||||
R = worldUp.Cross(L);
|
||||
R.Normalize();
|
||||
|
||||
Oyster::Math::Float3 U;
|
||||
U = L.Cross(R);
|
||||
|
||||
this->m_position = pos;
|
||||
this->mLook = L;
|
||||
this->mRight = R;
|
||||
this->mUp = U;
|
||||
}
|
||||
|
||||
Oyster::Math::Float4x4 Camera::View()const
|
||||
{
|
||||
return this->mView;
|
||||
}
|
||||
|
||||
Oyster::Math::Float4x4 Camera::Proj()const
|
||||
{
|
||||
return this->mProj;
|
||||
}
|
||||
|
||||
Oyster::Math::Float4x4 Camera::ViewsProj()const
|
||||
{
|
||||
Oyster::Math::Float4x4 M;
|
||||
M = mView * mProj;
|
||||
return M;
|
||||
}
|
||||
|
||||
void Camera::Walk(float dist)
|
||||
{
|
||||
this->m_position += dist*this->mLook;
|
||||
}
|
||||
|
||||
void Camera::Strafe(float dist)
|
||||
{
|
||||
this->m_position += dist*this->mRight;
|
||||
}
|
||||
|
||||
void Camera::Pitch(float angle)
|
||||
{
|
||||
float radians = angle * 0.0174532925f;
|
||||
|
||||
Oyster::Math::Float4x4 R;
|
||||
|
||||
Oyster::Math3D::RotationMatrix(radians,-mRight,R);
|
||||
this->mUp = CrossMatrix(this->mUp, R);
|
||||
this->mLook = CrossMatrix(this->mLook, R);
|
||||
}
|
||||
|
||||
void Camera::Yaw(float angle)
|
||||
{
|
||||
float radians = angle * 0.0174532925f;
|
||||
|
||||
Oyster::Math::Float4x4 R;
|
||||
|
||||
Oyster::Math::Float3 up(0,1,0);
|
||||
Oyster::Math3D::RotationMatrix(radians,-up,R);
|
||||
|
||||
this->mRight = CrossMatrix(this->mRight, R);
|
||||
this->mUp = CrossMatrix(mUp, R);
|
||||
this->mLook = CrossMatrix(this->mLook, R);
|
||||
}
|
||||
|
||||
void Camera::UpdateViewMatrix()
|
||||
{
|
||||
mLook.Normalize();
|
||||
mUp = mLook.Cross(mRight);
|
||||
mUp.Normalize();
|
||||
mRight = mUp.Cross(mLook);
|
||||
|
||||
float x = -m_position.Dot(mRight);
|
||||
float y = -m_position.Dot(mUp);
|
||||
float z = -m_position.Dot(mLook);
|
||||
|
||||
mView.m11 = mRight.x;
|
||||
mView.m21 = mRight.y;
|
||||
mView.m31 = mRight.z;
|
||||
mView.m41 = x;
|
||||
|
||||
mView.m12 = mUp.x;
|
||||
mView.m22 = mUp.y;
|
||||
mView.m32 = mUp.z;
|
||||
mView.m42 = y;
|
||||
|
||||
mView.m13 = mLook.x;
|
||||
mView.m23 = mLook.y;
|
||||
mView.m33 = mLook.z;
|
||||
mView.m43 = z;
|
||||
|
||||
mView.m14 = 0.0f;
|
||||
mView.m24 = 0.0f;
|
||||
mView.m34 = 0.0f;
|
||||
mView.m44 = 1.0f;
|
||||
|
||||
mView.Transpose();
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef CAMERA__H
|
||||
#define CAMERA__H
|
||||
|
||||
#include "OysterMath.h"
|
||||
|
||||
class Camera
|
||||
{
|
||||
private:
|
||||
|
||||
Oyster::Math::Float3 m_position;
|
||||
Oyster::Math::Float3 mRight;
|
||||
Oyster::Math::Float3 mUp;
|
||||
Oyster::Math::Float3 mLook;
|
||||
|
||||
|
||||
|
||||
float mNearZ;
|
||||
float mFarZ;
|
||||
float mAspect;
|
||||
float mFovY;
|
||||
|
||||
Oyster::Math::Float4x4 mView;
|
||||
Oyster::Math::Float4x4 mProj;
|
||||
|
||||
public:
|
||||
Camera();
|
||||
virtual ~Camera();
|
||||
|
||||
void SetPosition(const Oyster::Math::Float3& v);
|
||||
|
||||
Oyster::Math::Float3 GetPosition()const;
|
||||
|
||||
Oyster::Math::Float3 GetRight()const;
|
||||
Oyster::Math::Float3 GetUp()const;
|
||||
Oyster::Math::Float3 GetLook()const;
|
||||
|
||||
float GetNearZ()const;
|
||||
float GetFarZ()const;
|
||||
float GetAspect()const;
|
||||
|
||||
Oyster::Math::Float3 CrossMatrix(const Oyster::Math::Float3& v, const Oyster::Math::Float4x4& m);
|
||||
|
||||
void SetLens(float fovY, float aspect, float zn, float zf);
|
||||
|
||||
void LookAt(Oyster::Math::Float3 pos, Oyster::Math::Float3 target, Oyster::Math::Float3 worldUp);
|
||||
|
||||
void setLook(Oyster::Math::Float3 look) { mLook = look; }
|
||||
void setUp(Oyster::Math::Float3 up) { mUp = up; }
|
||||
void setRight(Oyster::Math::Float3 right) { mRight = right; }
|
||||
|
||||
Oyster::Math::Float4x4 View()const;
|
||||
Oyster::Math::Float4x4 Proj()const;
|
||||
Oyster::Math::Float4x4 ViewsProj()const;
|
||||
|
||||
void Walk(float dist);
|
||||
void Strafe(float dist);
|
||||
|
||||
void Pitch(float angle);
|
||||
void Yaw(float angle);
|
||||
|
||||
void UpdateViewMatrix();
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,53 @@
|
|||
#include "CollisionManager.h"
|
||||
|
||||
using namespace Oyster;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
namespace CollisionManager
|
||||
{
|
||||
|
||||
Physics::ICustomBody::SubscriptMessage PlayerCollision(const Oyster::Physics::ICustomBody *rigidBodyPlayer, const Oyster::Physics::ICustomBody *obj)
|
||||
{
|
||||
Player *player = ((Player*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyPlayer));
|
||||
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
|
||||
|
||||
switch (realObj->GetType())
|
||||
{
|
||||
case Object::OBJECT_TYPE_BOX:
|
||||
PlayerVBox(*player,(*(DynamicObject*) realObj));
|
||||
break;
|
||||
case Object::OBJECT_TYPE_PLAYER:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//spela ljud? ta skada? etc etc
|
||||
return Physics::ICustomBody::SubscriptMessage_none;
|
||||
}
|
||||
|
||||
void PlayerVBox(Player &player, DynamicObject &box)
|
||||
{
|
||||
//spela ljud? ta skada? etc etc
|
||||
}
|
||||
|
||||
Physics::ICustomBody::SubscriptMessage BoxCollision(const Oyster::Physics::ICustomBody *rigidBodyBox, const Oyster::Physics::ICustomBody *obj)
|
||||
{
|
||||
DynamicObject *box = ((DynamicObject*)GameLogic::RefManager::getInstance()->GetMap(*rigidBodyBox));
|
||||
Object *realObj = GameLogic::RefManager::getInstance()->GetMap(*obj);
|
||||
|
||||
switch (realObj->GetType())
|
||||
{
|
||||
case Object::OBJECT_TYPE_BOX:
|
||||
|
||||
break;
|
||||
case Object::OBJECT_TYPE_PLAYER:
|
||||
PlayerVBox(*(Player*)realObj,*box);
|
||||
break;
|
||||
}
|
||||
|
||||
return Physics::ICustomBody::SubscriptMessage_none;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef COLLISIONMANAGER_H
|
||||
#define COLLISIONMANAGER_H
|
||||
|
||||
#include "Object.h"
|
||||
#include "PhysicsAPI.h"
|
||||
#include "RefManager.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "Player.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
namespace CollisionManager
|
||||
{
|
||||
//these are the main collision functions
|
||||
//typedef SubscriptMessage (*EventAction_Collision)( const ICustomBody *proto, const ICustomBody *deuter );
|
||||
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
|
||||
void PlayerVBox(Player &player, DynamicObject &box);
|
||||
void BoxVBox(DynamicObject &box1, DynamicObject &box2);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef DYNAMICOBJECT_H
|
||||
#define DYNAMICOBJECT_H
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
|
||||
class DynamicObject
|
||||
{
|
||||
|
||||
public:
|
||||
DynamicObject();
|
||||
~DynamicObject(void);
|
||||
|
||||
void Update();
|
||||
|
||||
private:
|
||||
struct PrivateData;
|
||||
PrivateData *myData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,79 @@
|
|||
#include "Game.h"
|
||||
|
||||
using namespace GameLogic;
|
||||
|
||||
Game::Game(void)
|
||||
{
|
||||
player = NULL;
|
||||
level = NULL;
|
||||
camera = NULL;
|
||||
}
|
||||
|
||||
|
||||
Game::~Game(void)
|
||||
{
|
||||
//SAFE_DELETE(player);
|
||||
if(player)
|
||||
{
|
||||
delete player;
|
||||
player = NULL;
|
||||
}
|
||||
if(camera)
|
||||
{
|
||||
delete camera;
|
||||
camera = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Game::Init()
|
||||
{
|
||||
//Oyster::Physics::API::SetSubscription("remove object");
|
||||
|
||||
player = new Player(L"worldDummy");
|
||||
|
||||
box = new DynamicObject(L"crate");
|
||||
//poi
|
||||
//box = new physcTestObj("box");
|
||||
camera = new Camera();
|
||||
}
|
||||
void Game::StartGame()
|
||||
{
|
||||
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
|
||||
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
|
||||
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
|
||||
|
||||
camera->LookAt(pos, dir, up);
|
||||
camera->SetLens(3.14f/2, 1024/768, 1, 1000);
|
||||
}
|
||||
void Game::Update(keyInput keyPressed, float pitch, float yaw)
|
||||
{
|
||||
//player->Update(keyPressed);
|
||||
camera->Yaw(yaw);
|
||||
camera->Pitch(pitch);
|
||||
if(keyPressed == keyInput_A)
|
||||
{
|
||||
camera->Strafe(-0.1);
|
||||
}
|
||||
if(keyPressed == keyInput_D)
|
||||
{
|
||||
camera->Strafe(0.1);
|
||||
}
|
||||
if(keyPressed == keyInput_S)
|
||||
{
|
||||
camera->Walk(-0.1);
|
||||
}
|
||||
if(keyPressed == keyInput_W)
|
||||
{
|
||||
camera->Walk(0.1);
|
||||
}
|
||||
camera->UpdateViewMatrix();
|
||||
//poi Oyster::Physics::API::Update();
|
||||
}
|
||||
void Game::Render()
|
||||
{
|
||||
Oyster::Graphics::API::SetView(camera->View());
|
||||
Oyster::Graphics::API::SetProjection(camera->Proj());
|
||||
Oyster::Graphics::API::NewFrame();
|
||||
player->Render();
|
||||
box->Render();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include "Level.h"
|
||||
#include "Player.h"
|
||||
#include "IGame.h"
|
||||
#include "Camera.h"
|
||||
#include "DynamicObject.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
Game();
|
||||
~Game();
|
||||
|
||||
void Init();
|
||||
void StartGame();
|
||||
void Update(keyInput keyPressed, float pitch, float yaw);
|
||||
void Render();
|
||||
|
||||
private:
|
||||
Level* level;
|
||||
DynamicObject* box;
|
||||
Player* player;
|
||||
Camera* camera;
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,201 @@
|
|||
<?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>{B1195BB9-B3A5-47F0-906C-8DEA384D1520}</ProjectGuid>
|
||||
<RootNamespace>GameLogic</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'">
|
||||
<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>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>GamePhysics_$(PlatformShortName)D.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\GamePhysics\GamePhysics.vcxproj">
|
||||
<Project>{104fa3e9-94d9-4e1d-a941-28a03bc8a095}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</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>
|
||||
<ClInclude Include="AttatchmentMassDriver.h" />
|
||||
<ClInclude Include="AttatchmentSocket.h" />
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="CollisionManager.h" />
|
||||
<ClInclude Include="DynamicObject.h" />
|
||||
<ClInclude Include="GameMode.h" />
|
||||
<ClInclude Include="IAttatchment.h" />
|
||||
<ClInclude Include="Level.h" />
|
||||
<ClInclude Include="Object.h" />
|
||||
<ClInclude Include="Player.h" />
|
||||
<ClInclude Include="RefManager.h" />
|
||||
<ClInclude Include="StaticObject.h" />
|
||||
<ClInclude Include="Weapon.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AttatchmentMassDriver.cpp" />
|
||||
<ClCompile Include="AttatchmentSocket.cpp" />
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="CollisionManager.cpp" />
|
||||
<ClCompile Include="DynamicObject.cpp" />
|
||||
<ClCompile Include="GameMode.cpp" />
|
||||
<ClCompile Include="IAttatchment.cpp" />
|
||||
<ClCompile Include="Level.cpp" />
|
||||
<ClCompile Include="Object.cpp" />
|
||||
<ClCompile Include="Player.cpp" />
|
||||
<ClCompile Include="RefManager.cpp" />
|
||||
<ClCompile Include="StaticObject.cpp" />
|
||||
<ClCompile Include="Weapon.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef GAMEMODE_H
|
||||
#define GAMEMODE_H
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
class GameMode
|
||||
{
|
||||
public:
|
||||
GameMode(void);
|
||||
~GameMode(void);
|
||||
private:
|
||||
struct PrivateData;
|
||||
PrivateData *myData;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
|
@ -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)
|
||||
{
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,43 @@
|
|||
#include "IGame.h"
|
||||
#include "Game.h"
|
||||
#include <windows.h>
|
||||
|
||||
BOOL WINAPI DllMain(
|
||||
_In_ HINSTANCE hinstDLL,
|
||||
_In_ DWORD fdwReason,
|
||||
_In_ LPVOID lpvReserved
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
using namespace GameLogic;
|
||||
|
||||
IGame::IGame()
|
||||
{
|
||||
gameModule = new Game();
|
||||
}
|
||||
IGame::~IGame()
|
||||
{
|
||||
delete gameModule;
|
||||
}
|
||||
|
||||
void IGame::Init()
|
||||
{
|
||||
gameModule->Init();
|
||||
}
|
||||
void IGame::StartGame()
|
||||
{
|
||||
gameModule->StartGame();
|
||||
}
|
||||
void IGame::Update(keyInput keyPressed, float pitch, float yaw)
|
||||
{
|
||||
gameModule->Update(keyPressed, pitch, yaw);
|
||||
}
|
||||
void IGame::Render()
|
||||
{
|
||||
gameModule->Render();
|
||||
}
|
||||
Game* IGame::getGameModule()
|
||||
{
|
||||
return gameModule;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#ifndef IGAME_H
|
||||
#define IGAME_H
|
||||
|
||||
#if defined GAME_DLL_EXPORT
|
||||
#define GAME_DLL_USAGE __declspec(dllexport)
|
||||
#else
|
||||
#define GAME_DLL_USAGE __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
class Game;
|
||||
|
||||
enum keyInput
|
||||
{
|
||||
keyInput_W,
|
||||
keyInput_A,
|
||||
keyInput_S,
|
||||
keyInput_D,
|
||||
keyInput_none
|
||||
};
|
||||
|
||||
class GAME_DLL_USAGE IGame
|
||||
{
|
||||
private:
|
||||
Game* gameModule;
|
||||
public:
|
||||
IGame();
|
||||
~IGame();
|
||||
|
||||
|
||||
void Init();
|
||||
void StartGame();
|
||||
/************************************************************************/
|
||||
/* Get key input to update the player */
|
||||
/************************************************************************/
|
||||
void Update(keyInput keyPressed, float pitch, float yaw);
|
||||
void Render();
|
||||
Game* getGameModule();
|
||||
private:
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
#ifndef LEVEL_H
|
||||
#define LEVEL_H
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
class Level
|
||||
{
|
||||
|
||||
public:
|
||||
Level(void);
|
||||
~Level(void);
|
||||
|
||||
private:
|
||||
struct PrivateData;
|
||||
PrivateData *myData;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
#include "Object.h"
|
||||
#include "OysterMath.h"
|
||||
#include "DllInterfaces\GFXAPI.h"
|
||||
#include "CollisionManager.h"
|
||||
|
||||
|
||||
using namespace GameLogic;
|
||||
|
||||
using namespace Oyster::Math;
|
||||
using namespace Oyster::Graphics::Model;
|
||||
|
||||
using namespace Utility::DynamicMemory;
|
||||
using namespace Oyster::Physics;
|
||||
|
||||
Object::Object(std::wstring objFile)
|
||||
{
|
||||
|
||||
//model = new Model();
|
||||
model = Oyster::Graphics::API::CreateModel(objFile);
|
||||
|
||||
API::SimpleBodyDescription sbDesc;
|
||||
//sbDesc.centerPosition =
|
||||
|
||||
//poi
|
||||
ICustomBody* temp = rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||
|
||||
GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Object::~Object(void)
|
||||
{
|
||||
|
||||
Oyster::Graphics::API::DeleteModel(model);
|
||||
|
||||
}
|
||||
|
||||
void Object::Render()
|
||||
{
|
||||
this->rigidBody->GetOrientation(model->WorldMatrix);
|
||||
Oyster::Graphics::API::RenderScene(model, 1);
|
||||
}
|
||||
|
||||
Object::OBJECT_TYPE Object::GetType()
|
||||
{
|
||||
return this->type;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef OBJECT_H
|
||||
#define OBJECT_H
|
||||
|
||||
#include "PhysicsAPI.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
|
||||
#include "Model/Model.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
|
||||
enum OBJECT_TYPE
|
||||
{
|
||||
OBJECT_TYPE_PLAYER,
|
||||
OBJECT_TYPE_BOX,
|
||||
};
|
||||
Object(std::wstring objFile );
|
||||
virtual ~Object(void);
|
||||
|
||||
void Render();
|
||||
|
||||
OBJECT_TYPE GetType();
|
||||
|
||||
private:
|
||||
OBJECT_TYPE type;
|
||||
|
||||
protected:
|
||||
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
||||
//rigidBody
|
||||
|
||||
Oyster::Physics::ICustomBody *rigidBody;
|
||||
Oyster::Graphics::Model::Model *model;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,47 @@
|
|||
#include "RefManager.h"
|
||||
|
||||
using namespace GameLogic;
|
||||
|
||||
typedef std::pair<const Oyster::Physics::ICustomBody*, Object*> mapData;
|
||||
|
||||
RefManager* RefManager::instance = 0;
|
||||
|
||||
RefManager::RefManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RefManager::~RefManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
void RefManager::Release()
|
||||
{
|
||||
if (instance)
|
||||
{
|
||||
delete instance;
|
||||
instance = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RefManager* RefManager::getInstance( )
|
||||
{
|
||||
if (!instance)
|
||||
{
|
||||
instance = new RefManager();
|
||||
};
|
||||
return instance;
|
||||
}
|
||||
|
||||
Object* RefManager::GetMap(const Oyster::Physics::ICustomBody &body)
|
||||
{
|
||||
return mapper[&body];
|
||||
}
|
||||
|
||||
void RefManager::AddMapping( const Oyster::Physics::ICustomBody &body, Object &obj)
|
||||
{
|
||||
mapper.insert(mapData(&body,&obj));
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef REFMANAGER_H
|
||||
#define REFMANAGER_H
|
||||
|
||||
#include<map>
|
||||
#include "Object.h"
|
||||
#include "PhysicsAPI.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
class RefManager
|
||||
{
|
||||
public:
|
||||
RefManager(void);
|
||||
~RefManager(void);
|
||||
|
||||
static RefManager* getInstance( );
|
||||
void Release();
|
||||
|
||||
|
||||
Object* GetMap(const Oyster::Physics::ICustomBody &body); //returns the object of an rigidBody, mainly used for CollisionHandler
|
||||
void AddMapping(const Oyster::Physics::ICustomBody &body, Object &obj); //adds a mapping with body as key and the object as a value
|
||||
|
||||
|
||||
private:
|
||||
static RefManager* instance;
|
||||
std::map<const Oyster::Physics::ICustomBody*,Object*> mapper; //mapper points a rigidBody to an actual game object
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik and Linda of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef STATICOBJECT_H
|
||||
#define STATICOBJECT_H
|
||||
|
||||
#include "Object.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
class StaticObject
|
||||
{
|
||||
|
||||
public:
|
||||
StaticObject();
|
||||
~StaticObject(void);
|
||||
|
||||
private:
|
||||
struct PrivateData;
|
||||
PrivateData *myData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,304 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: TemplateMain.cpp
|
||||
//
|
||||
// BTH-D3D-Template
|
||||
//
|
||||
// Copyright (c) Stefan Petersson 2011. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Test main function for game logic when .exe
|
||||
// Doesn't run when Game logic is compiled as a .dll
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#include "Core/Core.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
#include "IGame.h"
|
||||
|
||||
#include "L_inputClass.h"
|
||||
|
||||
// debug window include
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Global Variables
|
||||
//--------------------------------------------------------------------------------------
|
||||
HINSTANCE g_hInst = NULL;
|
||||
HWND g_hWnd = NULL;
|
||||
|
||||
GameLogic::IGame *game;
|
||||
InputClass *inputObj;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow );
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HRESULT Render(float deltaTime);
|
||||
HRESULT Update(float deltaTime);
|
||||
HRESULT InitDirect3D();
|
||||
HRESULT InitGame();
|
||||
HRESULT CleanUp();
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Entry point to the program. Initializes everything and goes into a message processing
|
||||
// loop. Idle time is used to render the scene.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
void SetStdOutToNewConsole()
|
||||
{
|
||||
// allocate a console for this app
|
||||
AllocConsole();
|
||||
|
||||
// redirect unbuffered STDOUT to the console
|
||||
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
|
||||
FILE *fp = _fdopen( fileDescriptor, "w" );
|
||||
*stdout = *fp;
|
||||
setvbuf( stdout, NULL, _IONBF, 0 );
|
||||
|
||||
// give the console window a nicer title
|
||||
|
||||
SetConsoleTitle(L"Debug Output");
|
||||
|
||||
// give the console window a bigger buffer size
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
|
||||
{
|
||||
COORD bufferSize;
|
||||
bufferSize.X = csbi.dwSize.X;
|
||||
bufferSize.Y = 50;
|
||||
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||
return 0;
|
||||
|
||||
if( FAILED( InitDirect3D() ) )
|
||||
return 0;
|
||||
|
||||
if( FAILED( InitGame() ) )
|
||||
return 0;
|
||||
|
||||
__int64 cntsPerSec = 0;
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
|
||||
float secsPerCnt = 1.0f / (float)cntsPerSec;
|
||||
|
||||
__int64 prevTimeStamp = 0;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||
|
||||
//Init debug window
|
||||
//SetStdOutToNewConsole();
|
||||
|
||||
// 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
|
||||
Update(dt);
|
||||
Render(dt);
|
||||
|
||||
prevTimeStamp = currTimeStamp;
|
||||
}
|
||||
}
|
||||
CleanUp();
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Register class and create window
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT 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 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 and the game
|
||||
//-------------------------------------------------------------------------------------
|
||||
HRESULT InitGame()
|
||||
{
|
||||
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 false;
|
||||
}
|
||||
game = new GameLogic::IGame();
|
||||
game->Init();
|
||||
game->StartGame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Update(float deltaTime)
|
||||
{
|
||||
inputObj->Update();
|
||||
GameLogic::keyInput key = GameLogic::keyInput_none;
|
||||
|
||||
if(inputObj->IsKeyPressed(DIK_W))
|
||||
{
|
||||
key = GameLogic::keyInput_W;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
key = GameLogic::keyInput_A;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_S))
|
||||
{
|
||||
key = GameLogic::keyInput_S;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_D))
|
||||
{
|
||||
key = GameLogic::keyInput_D;
|
||||
}
|
||||
|
||||
float pitch = 0;
|
||||
float yaw = 0;
|
||||
|
||||
// move only when mouse is pressed
|
||||
//if(inputObj->IsMousePressed())
|
||||
//{
|
||||
pitch = inputObj->GetPitch();
|
||||
yaw = inputObj->GetYaw();
|
||||
//}
|
||||
|
||||
game->Update(key, pitch, yaw);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Render(float deltaTime)
|
||||
{
|
||||
int isPressed = 0;
|
||||
if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
isPressed = 1;
|
||||
//std::cout<<"test";
|
||||
}
|
||||
|
||||
game->Render();
|
||||
wchar_t title[255];
|
||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||
SetWindowText(g_hWnd, title);
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CleanUp()
|
||||
{
|
||||
SAFE_DELETE(game);
|
||||
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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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
|
|
@ -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>
|
|
@ -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
|
|
@ -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
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef _INPUTCLASS_H_
|
||||
#define _INPUTCLASS_H_
|
||||
|
||||
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
|
||||
#pragma comment(lib, "dinput8.lib")
|
||||
|
|
|
@ -120,11 +120,12 @@ void OysterResource::Clean()
|
|||
//Remove all the references
|
||||
while (!OResource::Release(i->second));
|
||||
|
||||
const wchar_t* temp = i->second->GetResourceFilename();
|
||||
std::wstring temp = i->second->GetResourceFilename();
|
||||
delete resourcePrivate.resources[temp];
|
||||
resourcePrivate.resources.erase(temp);
|
||||
|
||||
|
||||
}
|
||||
resourcePrivate.resources.clear();
|
||||
}
|
||||
void OysterResource::ReleaseResource(const OHRESOURCE& resourceData)
|
||||
{
|
||||
|
@ -133,7 +134,7 @@ void OysterResource::ReleaseResource(const OHRESOURCE& resourceData)
|
|||
{
|
||||
if(OResource::Release(t))
|
||||
{
|
||||
const wchar_t* temp = t->GetResourceFilename();
|
||||
std::wstring temp = t->GetResourceFilename();
|
||||
delete resourcePrivate.resources[temp];
|
||||
resourcePrivate.resources.erase(temp);
|
||||
}
|
||||
|
@ -146,7 +147,7 @@ void OysterResource::ReleaseResource(const wchar_t filename[])
|
|||
{
|
||||
if(OResource::Release(t))
|
||||
{
|
||||
const wchar_t* temp = t->GetResourceFilename();
|
||||
std::wstring temp = t->GetResourceFilename();
|
||||
delete resourcePrivate.resources[temp];
|
||||
resourcePrivate.resources.erase(temp);
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -17,7 +17,7 @@ std::wstring GetErrorMessage(int errorCode)
|
|||
LPWSTR lpMessage;
|
||||
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,
|
||||
errorCode ,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) ,
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace Oyster
|
|||
log << "DirectX running in debug mode.\n";
|
||||
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
||||
|
||||
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
|
||||
D3D_FEATURE_LEVEL featureLevelsToTry[] =
|
||||
{
|
||||
|
|
|
@ -279,7 +279,7 @@ namespace Oyster
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,18 @@
|
|||
#include "../Render/Rendering/Render.h"
|
||||
#include "../FileLoader/ObjReader.h"
|
||||
#include "../../Misc/Resource/OysterResource.h"
|
||||
#include "../FileLoader/GeneralLoader.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
namespace
|
||||
{
|
||||
Math::Float4x4 View;
|
||||
Math::Float4x4 Projection;
|
||||
}
|
||||
|
||||
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
|
||||
{
|
||||
Core::resolution = resulotion;
|
||||
|
@ -26,16 +33,31 @@ namespace Oyster
|
|||
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);
|
||||
}
|
||||
|
||||
void API::RenderScene(Model::Model* models, int count)
|
||||
void API::RenderScene(Model::Model models[], int count)
|
||||
{
|
||||
Render::Rendering::Basic::RenderScene(models,count);
|
||||
}
|
||||
|
||||
void API::RenderModel(Model::Model& m)
|
||||
{
|
||||
Render::Rendering::Basic::RenderScene(&m,1);
|
||||
}
|
||||
|
||||
void API::EndFrame()
|
||||
{
|
||||
Render::Rendering::Basic::EndFrame();
|
||||
|
@ -52,9 +74,7 @@ namespace Oyster
|
|||
m->WorldMatrix = Oyster::Math::Float4x4::identity;
|
||||
m->Visible = true;
|
||||
|
||||
OBJReader or;
|
||||
or.readOBJFile(filename);
|
||||
m->info = or.toModel();
|
||||
m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadOBJ);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -63,7 +83,7 @@ namespace Oyster
|
|||
{
|
||||
Model::ModelInfo* info = (Model::ModelInfo*)model->info;
|
||||
delete model;
|
||||
info->Vertices->~Buffer();
|
||||
Oyster::Resource::OysterResource::ReleaseResource((Oyster::Resource::OHRESOURCE)info);
|
||||
}
|
||||
|
||||
void API::Clean()
|
||||
|
@ -72,6 +92,14 @@ namespace Oyster
|
|||
Oyster::Resource::OysterResource::Clean();
|
||||
Oyster::Graphics::Core::ShaderManager::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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,13 +4,12 @@
|
|||
#include "OysterMath.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#if defined GFX_DLL_EXPORT
|
||||
#ifdef GFX_DLL_EXPORT
|
||||
#define GFX_DLL_USAGE __declspec(dllexport)
|
||||
#else
|
||||
#define GFX_DLL_USAGE __declspec(dllimport)
|
||||
#define GFX_DLL_USAGE
|
||||
#endif
|
||||
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Graphics
|
||||
|
@ -29,9 +28,14 @@ namespace Oyster
|
|||
|
||||
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion);
|
||||
static void Clean();
|
||||
//! @brief from Oyster::Math Float4x4, expects corect methods
|
||||
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
|
||||
static void RenderScene(Oyster::Graphics::Model::Model* models, int count);
|
||||
|
||||
static void SetView(Oyster::Math::Float4x4& View);
|
||||
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 Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace Oyster
|
|||
void UnloadShaderD(void* loadedData);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#include "GeneralLoader.h"
|
||||
#include "..\Core\Dx11Includes.h"
|
||||
#include "..\Core\Core.h"
|
||||
#include "ObjReader.h"
|
||||
|
||||
HRESULT CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
|
||||
ID3D11DeviceContext* d3dContext,
|
||||
|
@ -35,6 +36,30 @@ void Oyster::Graphics::Loading::UnloadTexture(void* data)
|
|||
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 <memory>
|
|
@ -95,7 +95,7 @@ void OBJReader::readOBJFile( std::wstring fileName )
|
|||
|
||||
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()
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace Oyster
|
|||
{
|
||||
namespace Loading
|
||||
{
|
||||
void LoadShader(const wchar_t filename[], Oyster::Resource::CustomData& out, int type);
|
||||
|
||||
void UnloadShaderP(void* loadedData)
|
||||
{
|
||||
ID3D11PixelShader* ps = ((ID3D11PixelShader*)loadedData);
|
||||
|
@ -165,14 +167,16 @@ namespace Oyster
|
|||
data.data = new char[data.size];
|
||||
memcpy(data.data,Shader->GetBufferPointer(),data.size);
|
||||
#else
|
||||
std::ifstream stream;
|
||||
|
||||
stream.open(filename, std::ifstream::in | std::ifstream::binary);
|
||||
if(stream.good())
|
||||
{
|
||||
stream.seekg(0, std::ios::end);
|
||||
sd.size = size_t(stream.tellg());
|
||||
sd.data = new char[sd.size];
|
||||
data.size = size_t(stream.tellg());
|
||||
data.data = new char[data.size];
|
||||
stream.seekg(0, std::ios::beg);
|
||||
stream.read(&sd.data[0], sd.size);
|
||||
stream.read(&data.data[0], data.size);
|
||||
stream.close();
|
||||
}
|
||||
else
|
||||
|
@ -180,7 +184,6 @@ namespace Oyster
|
|||
memset(&out,0,sizeof(out));
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
out.loadedData = Core::ShaderManager::CreateShader(data, Core::ShaderManager::ShaderType(type));
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
</ProjectReference>
|
||||
<FxCompile>
|
||||
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -124,12 +125,13 @@
|
|||
</Link>
|
||||
<FxCompile>
|
||||
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
|
@ -143,12 +145,14 @@
|
|||
</Link>
|
||||
<FxCompile>
|
||||
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
|
||||
<EnableDebuggingInformation>true</EnableDebuggingInformation>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
|
@ -162,6 +166,8 @@
|
|||
</Link>
|
||||
<FxCompile>
|
||||
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
|
||||
<EnableDebuggingInformation>true</EnableDebuggingInformation>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -172,7 +178,7 @@
|
|||
<ClCompile Include="DllInterfaces\GFXAPI.cpp" />
|
||||
<ClCompile Include="FileLoader\ObjReader.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\Rendering\BasicRender.cpp" />
|
||||
<ClCompile Include="Render\Resources\Resources.cpp" />
|
||||
|
@ -264,6 +270,8 @@
|
|||
<ItemGroup>
|
||||
<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\LightCalc.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\Render\PosManipulation.hlsli" />
|
||||
<None Include="Shader\HLSL\SimpleDebug\Debug.hlsl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "../Resources/Resources.h"
|
||||
#include "../../Definitions/GraphicalDefinition.h"
|
||||
#include "../../Model/ModelInfo.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
|
@ -60,7 +62,8 @@ namespace Oyster
|
|||
}
|
||||
void Basic::EndFrame()
|
||||
{
|
||||
Core::swapChain->Present(0,0);
|
||||
IDXGISwapChain* chain = Core::swapChain;
|
||||
chain->Present(0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
// /Bin/Executable/Tester ->
|
||||
// /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 VertexDebug = L"DebugVertex";
|
||||
const std::wstring PixelRed = L"DebugPixel";
|
||||
|
@ -42,6 +43,12 @@ namespace Oyster
|
|||
|
||||
#else
|
||||
/** 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
|
||||
|
||||
#pragma endregion
|
||||
|
@ -152,10 +159,9 @@ namespace Oyster
|
|||
void Resources::Clean()
|
||||
{
|
||||
Resources::ModelData.~Buffer();
|
||||
Resources::VPData.~Buffer();
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,31 @@
|
|||
#ifndef DEFINES
|
||||
#define DEFINES
|
||||
|
||||
struct PointLight
|
||||
{
|
||||
float3 Pos;
|
||||
float Radius;
|
||||
float4 PosRadius;
|
||||
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
|
|
@ -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;
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
|
||||
#include "Defines.hlsli"
|
||||
#include "LightCalc.hlsli"
|
||||
#include "PosManipulation.hlsli"
|
||||
//todo
|
||||
//LightCulling
|
||||
//Calc Diff + Spec
|
||||
//Calc Ambience
|
||||
//Write Glow
|
||||
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main( uint3 DTid : SV_DispatchThreadID )
|
||||
{
|
||||
float3 ViewPos = ToVpos(DTid.xy);
|
||||
//DiffSpec LightCalc(pl, float3 pos)
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -69,21 +69,25 @@
|
|||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
</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>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<TargetExt>.lib</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
HINSTANCE g_hInst = NULL;
|
||||
HWND g_hWnd = NULL;
|
||||
Oyster::Graphics::Model::Model* m = NULL;
|
||||
Oyster::Graphics::Model::Model* m2 = NULL;
|
||||
Oyster::Math::Float4x4 V;
|
||||
Oyster::Math::Float4x4 P;
|
||||
|
||||
|
@ -41,7 +42,7 @@ HRESULT InitDirect3D();
|
|||
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
|
||||
BOOL b = SetDllDirectoryW(L"..\\..\\DLL");
|
||||
BOOL b = SetDllDirectoryW(L"..\\DLL");
|
||||
typedef struct tagLOADPARMS32
|
||||
{
|
||||
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(m2);
|
||||
Oyster::Graphics::API::Clean();
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
@ -186,11 +188,15 @@ HRESULT InitDirect3D()
|
|||
#pragma endregion
|
||||
|
||||
#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
|
||||
|
||||
|
||||
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::InverseOrientationMatrix(V);
|
||||
|
@ -203,14 +209,17 @@ HRESULT Update(float deltaTime)
|
|||
{
|
||||
angle += Oyster::Math::pi/30000;
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>OysterGraphics_x86D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>
|
||||
|
@ -136,7 +136,6 @@
|
|||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<PreventDllBinding>true</PreventDllBinding>
|
||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -144,9 +143,9 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -159,7 +158,7 @@
|
|||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<PreventDllBinding>true</PreventDllBinding>
|
||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<DelayLoadDLLs>OysterGraphics_x86.dll;</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -167,7 +166,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -182,7 +181,6 @@
|
|||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<PreventDllBinding>true</PreventDllBinding>
|
||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -34,8 +34,14 @@ WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(wParam == VK_ESCAPE)
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
|
||||
}
|
||||
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);
|
||||
|
||||
|
||||
|
||||
/********************************************
|
||||
* Description of a window *
|
||||
*******************************************/
|
||||
WindowShell::INIT_DESC_WINDOW wDesc;
|
||||
wDesc.hInstance = hInst;
|
||||
wDesc.windowName = L"Glare";
|
||||
wDesc.windowPosition = Point2D(50);
|
||||
wDesc.windowSize = Point2D(1024, 800);
|
||||
WindowShell::WINDOW_INIT_DESC wDesc;
|
||||
//wDesc.hInstance = hInst;
|
||||
wDesc.windowPosition.x = 50;
|
||||
wDesc.windowPosition.y = 50;
|
||||
wDesc.windowSize.x = 1024;
|
||||
wDesc.windowSize.x = 800;
|
||||
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()->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
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,30 +24,30 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<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>MultiByte</CharacterSet>
|
||||
<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>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -138,6 +138,10 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="WindowShell.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="WindowShell.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -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>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="WindowShell.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="WindowShell.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -56,7 +56,7 @@ WindowShell::~WindowShell()
|
|||
|
||||
|
||||
|
||||
bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
|
||||
bool WindowShell::createWin(WINDOW_INIT_DESC &desc)
|
||||
{
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
if(!desc.hInstance)
|
||||
{
|
||||
MessageBox(0, L"No HINSTANCE was specified!" ,L"Error", 0);
|
||||
return false;
|
||||
}
|
||||
if(desc.windowSize < 0)
|
||||
if(desc.windowSize.x < 0 || desc.windowSize.y < 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;
|
||||
wc.cbSize = sizeof(WNDCLASSEX);
|
||||
wc.hIconSm = NULL;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.style = desc.windowClassStyle;
|
||||
wc.lpfnWndProc = desc.windowProcCallback;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
|
@ -112,7 +113,7 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
|
|||
pData->hWnd = CreateWindow(
|
||||
L"MainWindowClass" ,
|
||||
desc.windowName.c_str(),
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
desc.windowStyle,
|
||||
desc.windowPosition.x,
|
||||
desc.windowPosition.y,
|
||||
desc.windowSize.x,
|
||||
|
@ -138,7 +139,7 @@ bool WindowShell::createWin(INIT_DESC_WINDOW &desc)
|
|||
|
||||
return true;
|
||||
}
|
||||
int WindowShell::createChildWin(INIT_DESC_CHILD_WINDOW &desc)
|
||||
int WindowShell::createChildWin(CHILD_WINDOW_INIT_DESC &desc)
|
||||
{
|
||||
ChildWin win;
|
||||
|
||||
|
|
|
@ -5,72 +5,45 @@
|
|||
#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
|
||||
{
|
||||
public:
|
||||
struct INIT_DESC_WINDOW
|
||||
struct WINDOW_INIT_DESC
|
||||
{
|
||||
HINSTANCE hInstance;
|
||||
std::wstring windowName;
|
||||
Point2D windowSize;
|
||||
Point2D windowPosition;
|
||||
POINT windowSize;
|
||||
POINT windowPosition;
|
||||
WNDPROC windowProcCallback;
|
||||
UINT windowClassStyle;
|
||||
UINT windowStyle;
|
||||
|
||||
INIT_DESC_WINDOW()
|
||||
WINDOW_INIT_DESC()
|
||||
{
|
||||
hInstance = NULL;
|
||||
windowName = L"Child window";
|
||||
windowName = L"MADAFACKA";
|
||||
windowSize.x = 800;
|
||||
windowSize.y = 600;
|
||||
windowPosition.x = 0;
|
||||
windowPosition.y = 0;
|
||||
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;
|
||||
DWORD style;
|
||||
Point2D topLeftPos;
|
||||
Point2D windowSize;
|
||||
POINT topLeftPos;
|
||||
POINT windowSize;
|
||||
WNDPROC windowProcCallback;
|
||||
|
||||
INIT_DESC_CHILD_WINDOW()
|
||||
CHILD_WINDOW_INIT_DESC()
|
||||
{
|
||||
name = L"Child Window";
|
||||
style = WS_CHILD;
|
||||
topLeftPos = Point2D(0,0);
|
||||
memset(&topLeftPos, 0, sizeof(POINT));
|
||||
windowSize.x = 300;
|
||||
windowSize.y = 200;
|
||||
windowProcCallback = NULL;
|
||||
|
@ -94,9 +67,9 @@ class WindowShell
|
|||
const int getChildID (HWND hwnd) const;
|
||||
|
||||
/* 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*/
|
||||
int createChildWin (INIT_DESC_CHILD_WINDOW&);
|
||||
int createChildWin (CHILD_WINDOW_INIT_DESC&);
|
||||
/* Removes a child window */
|
||||
bool removeChild (int id);
|
||||
/* Removes a child window */
|
||||
|
|
Loading…
Reference in New Issue