Network - Removing old gamelogic stuff before replacing them with new stuff
This commit is contained in:
parent
e06ee31754
commit
eb0b5ec0ee
|
@ -1,193 +0,0 @@
|
||||||
<?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>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>
|
|
||||||
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(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>
|
|
||||||
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(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>
|
|
||||||
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(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>
|
|
||||||
<LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(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>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(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;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(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;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;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>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(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;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.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>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)GameLogic;$(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;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\GameLogic\GameLogic.vcxproj">
|
|
||||||
<Project>{b1195bb9-b3a5-47f0-906c-8dea384d1520}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\Input\Input.vcxproj">
|
|
||||||
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
|
|
||||||
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\OysterPhysics3D\OysterPhysics3D.vcxproj">
|
|
||||||
<Project>{4285bd3f-3c6c-4670-b7af-a29afef5f6a8}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="DanBiasMaincpp.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
|
@ -1,316 +0,0 @@
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,185 +0,0 @@
|
||||||
#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();
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
#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
|
|
|
@ -1,50 +0,0 @@
|
||||||
#include "CollisionManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
|
|
||||||
namespace CollisionManager
|
|
||||||
{
|
|
||||||
|
|
||||||
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,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
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box)
|
|
||||||
{
|
|
||||||
//spela ljud? ta skada? etc etc
|
|
||||||
}
|
|
||||||
|
|
||||||
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
#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
|
|
||||||
void PlayerCollision(Oyster::Physics::ICustomBody &rigidBodyPlayer,Oyster::Physics::ICustomBody &obj);
|
|
||||||
void BoxCollision(Oyster::Physics::ICustomBody &rigidBodyBox, Oyster::Physics::ICustomBody &obj);
|
|
||||||
|
|
||||||
//these are the specific collision case functions
|
|
||||||
void PlayerVBox(Player &player, DynamicObject &box);
|
|
||||||
void BoxVBox(DynamicObject &box1, DynamicObject &box2);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,20 +0,0 @@
|
||||||
#include "DynamicObject.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
using namespace Oyster::Physics;
|
|
||||||
using namespace Utility::DynamicMemory;
|
|
||||||
|
|
||||||
DynamicObject::DynamicObject(void)
|
|
||||||
:Object()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DynamicObject::~DynamicObject(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicObject::Update()
|
|
||||||
{
|
|
||||||
//update object
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//Created by Erik and Linda of the GameLogic team
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DYNAMICOBJECT_H
|
|
||||||
#define DYNAMICOBJECT_H
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class DynamicObject : public Object
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
DynamicObject(void);
|
|
||||||
~DynamicObject(void);
|
|
||||||
|
|
||||||
void Update();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,68 +0,0 @@
|
||||||
#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()
|
|
||||||
{
|
|
||||||
player = new Player();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
void Game::Render()
|
|
||||||
{
|
|
||||||
Oyster::Graphics::API::NewFrame(camera->View(), camera->Proj());
|
|
||||||
player->Render();
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef GAME_H
|
|
||||||
#define GAME_H
|
|
||||||
|
|
||||||
#include "Level.h"
|
|
||||||
#include "Player.h"
|
|
||||||
#include "IGame.h"
|
|
||||||
#include "Camera.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;
|
|
||||||
Player* player;
|
|
||||||
Camera* camera;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,210 +0,0 @@
|
||||||
<?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>
|
|
||||||
</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>
|
|
||||||
<Private>false</Private>
|
|
||||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
|
||||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
|
||||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
|
||||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
|
||||||
</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="..\OysterPhysics3D\OysterPhysics3D.vcxproj">
|
|
||||||
<Project>{4285bd3f-3c6c-4670-b7af-a29afef5f6a8}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="Camera.h" />
|
|
||||||
<ClInclude Include="CollisionManager.h" />
|
|
||||||
<ClInclude Include="DynamicObject.h" />
|
|
||||||
<ClInclude Include="Game.h" />
|
|
||||||
<ClInclude Include="GameMode.h" />
|
|
||||||
<ClInclude Include="IGame.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="Camera.cpp" />
|
|
||||||
<ClCompile Include="CollisionManager.cpp" />
|
|
||||||
<ClCompile Include="DynamicObject.cpp" />
|
|
||||||
<ClCompile Include="Game.cpp" />
|
|
||||||
<ClCompile Include="GameMode.cpp" />
|
|
||||||
<ClCompile Include="IGame.cpp" />
|
|
||||||
<ClCompile Include="Level.cpp" />
|
|
||||||
<ClCompile Include="Object.cpp" />
|
|
||||||
<ClCompile Include="Player.cpp" />
|
|
||||||
<ClCompile Include="RefManager.cpp" />
|
|
||||||
<ClCompile Include="StaticObject.cpp" />
|
|
||||||
<ClCompile Include="TestGLMain.cpp" />
|
|
||||||
<ClCompile Include="Weapon.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
|
@ -1,96 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="Game.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Level.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Object.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Player.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="IGame.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="StaticObject.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Weapon.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="DynamicObject.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="RefManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="GameMode.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="CollisionManager.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Camera.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Game.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Level.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Object.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Player.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="IGame.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="StaticObject.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Weapon.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="DynamicObject.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RefManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TestGLMain.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="GameMode.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="CollisionManager.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Camera.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include "GameMode.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
|
|
||||||
|
|
||||||
GameMode::GameMode(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GameMode::~GameMode(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//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:
|
|
||||||
//variabels that control what game rules the level runs on
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,43 +0,0 @@
|
||||||
#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;
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//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
|
|
|
@ -1,12 +0,0 @@
|
||||||
#include "Level.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
|
|
||||||
Level::Level(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Level::~Level(void)
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//Created by Erik and Linda of the GameLogic team
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef LEVEL_H
|
|
||||||
#define LEVEL_H
|
|
||||||
|
|
||||||
#include "StaticObject.h"
|
|
||||||
#include "DynamicObject.h"
|
|
||||||
#include "GameMode.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
|
|
||||||
class Level
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
Level(void);
|
|
||||||
~Level(void);
|
|
||||||
|
|
||||||
private:
|
|
||||||
StaticObject** staticObjects;
|
|
||||||
int nrOfStaticObjects;
|
|
||||||
|
|
||||||
DynamicObject** dynamicObjects;
|
|
||||||
int nrOfDynamicObjects;
|
|
||||||
|
|
||||||
GameMode* gameMode;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,47 +0,0 @@
|
||||||
#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(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
model = new Model();
|
|
||||||
model = Oyster::Graphics::API::CreateModel(L"orca");
|
|
||||||
|
|
||||||
API::SimpleBodyDescription sbDesc;
|
|
||||||
//sbDesc.centerPosition =
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//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(void);
|
|
||||||
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
|
|
|
@ -1,55 +0,0 @@
|
||||||
#include "Player.h"
|
|
||||||
#include "OysterMath.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
using namespace Oyster::Physics;
|
|
||||||
|
|
||||||
Player::Player(void)
|
|
||||||
:Object()
|
|
||||||
{
|
|
||||||
life = 100;
|
|
||||||
}
|
|
||||||
Player::~Player(void)
|
|
||||||
{
|
|
||||||
delete this->rigidBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::Update(keyInput keyPressed)
|
|
||||||
{
|
|
||||||
if(keyPressed != keyInput_none)
|
|
||||||
{
|
|
||||||
Move(keyPressed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::Move(keyInput keyPressed)
|
|
||||||
{
|
|
||||||
if(keyPressed == keyInput_A)
|
|
||||||
{
|
|
||||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
||||||
pos.x -= 0.1;
|
|
||||||
rigidBody->SetCenter(pos);
|
|
||||||
}
|
|
||||||
if(keyPressed == keyInput_D)
|
|
||||||
{
|
|
||||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
||||||
pos.x += 0.1;
|
|
||||||
rigidBody->SetCenter(pos);
|
|
||||||
}
|
|
||||||
if(keyPressed == keyInput_S)
|
|
||||||
{
|
|
||||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
||||||
pos.y -= 0.1;
|
|
||||||
rigidBody->SetCenter(pos);
|
|
||||||
}
|
|
||||||
if(keyPressed == keyInput_W)
|
|
||||||
{
|
|
||||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
||||||
pos.y += 0.1;
|
|
||||||
rigidBody->SetCenter(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Player::Shoot()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//Created by Erik and Linda of the GameLogic team
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLAYER_H
|
|
||||||
#define PLAYER_H
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
#include "Weapon.h"
|
|
||||||
#include "IGame.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
class Player : public Object
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
Player(void);
|
|
||||||
~Player(void);
|
|
||||||
|
|
||||||
/********************************************************
|
|
||||||
* Update the position of the rigid body
|
|
||||||
* This will be done with physics later
|
|
||||||
********************************************************/
|
|
||||||
void Update(keyInput keyPressed);
|
|
||||||
|
|
||||||
void Move(keyInput keyPressed);
|
|
||||||
void Shoot();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int life;
|
|
||||||
Weapon *weapon;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,47 +0,0 @@
|
||||||
#include "RefManager.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
|
|
||||||
typedef std::pair<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(Oyster::Physics::ICustomBody &body)
|
|
||||||
{
|
|
||||||
return mapper[&body];
|
|
||||||
}
|
|
||||||
|
|
||||||
void RefManager::AddMapping(Oyster::Physics::ICustomBody &body, Object &obj)
|
|
||||||
{
|
|
||||||
mapper.insert(mapData(&body,&obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//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(Oyster::Physics::ICustomBody &body); //returns the object of an rigidBody, mainly used for CollisionHandler
|
|
||||||
void AddMapping(Oyster::Physics::ICustomBody &body, Object &obj); //adds a mapping with body as key and the object as a value
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
static RefManager* instance;
|
|
||||||
std::map<Oyster::Physics::ICustomBody*,Object*> mapper; //mapper points a rigidBody to an actual game object
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,12 +0,0 @@
|
||||||
#include "StaticObject.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
|
|
||||||
StaticObject::StaticObject(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
StaticObject::~StaticObject(void)
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//Created by Erik and Linda of the GameLogic team
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef STATICOBJECT_H
|
|
||||||
#define STATICOBJECT_H
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
|
|
||||||
class StaticObject : public Object
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
StaticObject(void);
|
|
||||||
~StaticObject(void);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,304 +0,0 @@
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#include "Weapon.h"
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
|
||||||
|
|
||||||
Weapon::Weapon(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Weapon::~Weapon(void)
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//Created by Erik and Linda of the GameLogic team
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef WEAPON_H
|
|
||||||
#define WEAPON_H
|
|
||||||
|
|
||||||
#include "Object.h"
|
|
||||||
|
|
||||||
namespace GameLogic
|
|
||||||
{
|
|
||||||
|
|
||||||
class Weapon : public Object
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
Weapon(void);
|
|
||||||
~Weapon(void);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue