From eb0b5ec0eec7b7415e2fea736ce3bcc6a5af7b7e Mon Sep 17 00:00:00 2001 From: dean11 Date: Tue, 10 Dec 2013 13:38:25 +0100 Subject: [PATCH] Network - Removing old gamelogic stuff before replacing them with new stuff --- Code/DanBiasGame/DanBiasGame.vcxproj | 193 -------------- Code/DanBiasGame/DanBiasMaincpp.cpp | 316 ----------------------- Code/GameLogic/Camera.cpp | 185 ------------- Code/GameLogic/Camera.h | 63 ----- Code/GameLogic/CollisionManager.cpp | 50 ---- Code/GameLogic/CollisionManager.h | 27 -- Code/GameLogic/DynamicObject.cpp | 20 -- Code/GameLogic/DynamicObject.h | 28 -- Code/GameLogic/Game.cpp | 68 ----- Code/GameLogic/Game.h | 28 -- Code/GameLogic/GameLogic.vcxproj | 210 --------------- Code/GameLogic/GameLogic.vcxproj.filters | 96 ------- Code/GameLogic/GameMode.cpp | 15 -- Code/GameLogic/GameMode.h | 22 -- Code/GameLogic/IGame.cpp | 43 --- Code/GameLogic/IGame.h | 47 ---- Code/GameLogic/Level.cpp | 12 - Code/GameLogic/Level.h | 37 --- Code/GameLogic/Object.cpp | 47 ---- Code/GameLogic/Object.h | 49 ---- Code/GameLogic/Player.cpp | 55 ---- Code/GameLogic/Player.h | 37 --- Code/GameLogic/RefManager.cpp | 47 ---- Code/GameLogic/RefManager.h | 37 --- Code/GameLogic/StaticObject.cpp | 12 - Code/GameLogic/StaticObject.h | 25 -- Code/GameLogic/TestGLMain.cpp | 304 ---------------------- Code/GameLogic/Weapon.cpp | 12 - Code/GameLogic/Weapon.h | 26 -- 29 files changed, 2111 deletions(-) delete mode 100644 Code/DanBiasGame/DanBiasGame.vcxproj delete mode 100644 Code/DanBiasGame/DanBiasMaincpp.cpp delete mode 100644 Code/GameLogic/Camera.cpp delete mode 100644 Code/GameLogic/Camera.h delete mode 100644 Code/GameLogic/CollisionManager.cpp delete mode 100644 Code/GameLogic/CollisionManager.h delete mode 100644 Code/GameLogic/DynamicObject.cpp delete mode 100644 Code/GameLogic/DynamicObject.h delete mode 100644 Code/GameLogic/Game.cpp delete mode 100644 Code/GameLogic/Game.h delete mode 100644 Code/GameLogic/GameLogic.vcxproj delete mode 100644 Code/GameLogic/GameLogic.vcxproj.filters delete mode 100644 Code/GameLogic/GameMode.cpp delete mode 100644 Code/GameLogic/GameMode.h delete mode 100644 Code/GameLogic/IGame.cpp delete mode 100644 Code/GameLogic/IGame.h delete mode 100644 Code/GameLogic/Level.cpp delete mode 100644 Code/GameLogic/Level.h delete mode 100644 Code/GameLogic/Object.cpp delete mode 100644 Code/GameLogic/Object.h delete mode 100644 Code/GameLogic/Player.cpp delete mode 100644 Code/GameLogic/Player.h delete mode 100644 Code/GameLogic/RefManager.cpp delete mode 100644 Code/GameLogic/RefManager.h delete mode 100644 Code/GameLogic/StaticObject.cpp delete mode 100644 Code/GameLogic/StaticObject.h delete mode 100644 Code/GameLogic/TestGLMain.cpp delete mode 100644 Code/GameLogic/Weapon.cpp delete mode 100644 Code/GameLogic/Weapon.h diff --git a/Code/DanBiasGame/DanBiasGame.vcxproj b/Code/DanBiasGame/DanBiasGame.vcxproj deleted file mode 100644 index 88181e55..00000000 --- a/Code/DanBiasGame/DanBiasGame.vcxproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {2A1BC987-AF42-4500-802D-89CD32FC1309} - Win32Proj - DanBiasGame - - - - Application - true - v110 - Unicode - - - Application - true - v110 - Unicode - - - Application - false - v110 - true - Unicode - - - Application - false - v110 - true - Unicode - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)..\Bin\Executable\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; - - - true - $(SolutionDir)..\Bin\Executable\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; - - - false - $(SolutionDir)..\Bin\Executable\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; - - - false - $(SolutionDir)..\Bin\Executable\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) - - - Windows - true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) - - - Windows - true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - - - - - {b1195bb9-b3a5-47f0-906c-8dea384d1520} - - - {7e3990d2-3d94-465c-b58d-64a74b3ecf9b} - - - {f10cbc03-9809-4cba-95d8-327c287b18ee} - - - {4285bd3f-3c6c-4670-b7af-a29afef5f6a8} - - - - - - - - - \ No newline at end of file diff --git a/Code/DanBiasGame/DanBiasMaincpp.cpp b/Code/DanBiasGame/DanBiasMaincpp.cpp deleted file mode 100644 index 23c1a119..00000000 --- a/Code/DanBiasGame/DanBiasMaincpp.cpp +++ /dev/null @@ -1,316 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: TemplateMain.cpp -// -// BTH-D3D-Template -// -// Copyright (c) Stefan Petersson 2011. All rights reserved. -//-------------------------------------------------------------------------------------- -#define NOMINMAX -#include - -#include "DllInterfaces/GFXAPI.h" -#include "IGame.h" - -#include "L_inputClass.h" - -// debug window include -#include -#include -#include -#include - - - - -//-------------------------------------------------------------------------------------- -// 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; -} - diff --git a/Code/GameLogic/Camera.cpp b/Code/GameLogic/Camera.cpp deleted file mode 100644 index a969ced5..00000000 --- a/Code/GameLogic/Camera.cpp +++ /dev/null @@ -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(); -} \ No newline at end of file diff --git a/Code/GameLogic/Camera.h b/Code/GameLogic/Camera.h deleted file mode 100644 index deb9df62..00000000 --- a/Code/GameLogic/Camera.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/CollisionManager.cpp b/Code/GameLogic/CollisionManager.cpp deleted file mode 100644 index f7868b79..00000000 --- a/Code/GameLogic/CollisionManager.cpp +++ /dev/null @@ -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; - } - } - } -} \ No newline at end of file diff --git a/Code/GameLogic/CollisionManager.h b/Code/GameLogic/CollisionManager.h deleted file mode 100644 index a650f595..00000000 --- a/Code/GameLogic/CollisionManager.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/DynamicObject.cpp b/Code/GameLogic/DynamicObject.cpp deleted file mode 100644 index 14e0518d..00000000 --- a/Code/GameLogic/DynamicObject.cpp +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/Code/GameLogic/DynamicObject.h b/Code/GameLogic/DynamicObject.h deleted file mode 100644 index 2d6ffdc8..00000000 --- a/Code/GameLogic/DynamicObject.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/Game.cpp b/Code/GameLogic/Game.cpp deleted file mode 100644 index b4095130..00000000 --- a/Code/GameLogic/Game.cpp +++ /dev/null @@ -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(); -} \ No newline at end of file diff --git a/Code/GameLogic/Game.h b/Code/GameLogic/Game.h deleted file mode 100644 index 0a8a031a..00000000 --- a/Code/GameLogic/Game.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/GameLogic.vcxproj b/Code/GameLogic/GameLogic.vcxproj deleted file mode 100644 index 236258d2..00000000 --- a/Code/GameLogic/GameLogic.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {B1195BB9-B3A5-47F0-906C-8DEA384D1520} - GameLogic - - - - DynamicLibrary - true - v110 - Unicode - - - DynamicLibrary - true - v110 - Unicode - - - DynamicLibrary - false - v110 - true - Unicode - - - DynamicLibrary - false - v110 - true - Unicode - - - - - - - - - - - - - - - - - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - .dll - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - $(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath) - - - - Level3 - Disabled - true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) - - - true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) - - - - - Level3 - Disabled - true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) - - - true - OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) - - - - - Level3 - MaxSpeed - true - true - true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) - - - true - true - true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) - - - - - Level3 - MaxSpeed - true - true - true - $(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories) - GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions) - - - true - true - true - OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies) - - - - - {104fa3e9-94d9-4e1d-a941-28a03bc8a095} - false - true - false - false - false - - - {7e3990d2-3d94-465c-b58d-64a74b3ecf9b} - - - {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} - - - {0ec83e64-230e-48ef-b08c-6ac9651b4f82} - - - {f10cbc03-9809-4cba-95d8-327c287b18ee} - - - {4285bd3f-3c6c-4670-b7af-a29afef5f6a8} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Code/GameLogic/GameLogic.vcxproj.filters b/Code/GameLogic/GameLogic.vcxproj.filters deleted file mode 100644 index f2c5e978..00000000 --- a/Code/GameLogic/GameLogic.vcxproj.filters +++ /dev/null @@ -1,96 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/Code/GameLogic/GameMode.cpp b/Code/GameLogic/GameMode.cpp deleted file mode 100644 index 0eddb7f9..00000000 --- a/Code/GameLogic/GameMode.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "GameMode.h" - -using namespace GameLogic; - - -GameMode::GameMode(void) -{ - -} - - -GameMode::~GameMode(void) -{ - -} diff --git a/Code/GameLogic/GameMode.h b/Code/GameLogic/GameMode.h deleted file mode 100644 index 42273946..00000000 --- a/Code/GameLogic/GameMode.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/IGame.cpp b/Code/GameLogic/IGame.cpp deleted file mode 100644 index dd07c9f8..00000000 --- a/Code/GameLogic/IGame.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "IGame.h" -#include "Game.h" -#include - -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; -} \ No newline at end of file diff --git a/Code/GameLogic/IGame.h b/Code/GameLogic/IGame.h deleted file mode 100644 index 41b2e0d5..00000000 --- a/Code/GameLogic/IGame.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/Level.cpp b/Code/GameLogic/Level.cpp deleted file mode 100644 index 32fbe2d5..00000000 --- a/Code/GameLogic/Level.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Level.h" - -using namespace GameLogic; - -Level::Level(void) -{ -} - - -Level::~Level(void) -{ -} diff --git a/Code/GameLogic/Level.h b/Code/GameLogic/Level.h deleted file mode 100644 index b43f193d..00000000 --- a/Code/GameLogic/Level.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/Object.cpp b/Code/GameLogic/Object.cpp deleted file mode 100644 index 33679058..00000000 --- a/Code/GameLogic/Object.cpp +++ /dev/null @@ -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; -} diff --git a/Code/GameLogic/Object.h b/Code/GameLogic/Object.h deleted file mode 100644 index 767edb1f..00000000 --- a/Code/GameLogic/Object.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/Player.cpp b/Code/GameLogic/Player.cpp deleted file mode 100644 index 93a83506..00000000 --- a/Code/GameLogic/Player.cpp +++ /dev/null @@ -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() -{ - -} diff --git a/Code/GameLogic/Player.h b/Code/GameLogic/Player.h deleted file mode 100644 index 7c4045e3..00000000 --- a/Code/GameLogic/Player.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/RefManager.cpp b/Code/GameLogic/RefManager.cpp deleted file mode 100644 index a119898c..00000000 --- a/Code/GameLogic/RefManager.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "RefManager.h" - -using namespace GameLogic; - -typedef std::pair 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)); -} - - diff --git a/Code/GameLogic/RefManager.h b/Code/GameLogic/RefManager.h deleted file mode 100644 index b5fd91d2..00000000 --- a/Code/GameLogic/RefManager.h +++ /dev/null @@ -1,37 +0,0 @@ -////////////////////////////////////////////////// -//Created by Erik and Linda of the GameLogic team -////////////////////////////////////////////////// - - -#ifndef REFMANAGER_H -#define REFMANAGER_H - -#include -#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 mapper; //mapper points a rigidBody to an actual game object - - - }; -} -#endif \ No newline at end of file diff --git a/Code/GameLogic/StaticObject.cpp b/Code/GameLogic/StaticObject.cpp deleted file mode 100644 index 855ef645..00000000 --- a/Code/GameLogic/StaticObject.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "StaticObject.h" - -using namespace GameLogic; - -StaticObject::StaticObject(void) -{ -} - - -StaticObject::~StaticObject(void) -{ -} diff --git a/Code/GameLogic/StaticObject.h b/Code/GameLogic/StaticObject.h deleted file mode 100644 index 07d23311..00000000 --- a/Code/GameLogic/StaticObject.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Code/GameLogic/TestGLMain.cpp b/Code/GameLogic/TestGLMain.cpp deleted file mode 100644 index 57392224..00000000 --- a/Code/GameLogic/TestGLMain.cpp +++ /dev/null @@ -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 -#include "Core/Core.h" -#include "DllInterfaces/GFXAPI.h" -#include "IGame.h" - -#include "L_inputClass.h" - -// debug window include -#include -#include -#include -#include - - - - -//-------------------------------------------------------------------------------------- -// 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; -} - diff --git a/Code/GameLogic/Weapon.cpp b/Code/GameLogic/Weapon.cpp deleted file mode 100644 index 2cbd4e71..00000000 --- a/Code/GameLogic/Weapon.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Weapon.h" - -using namespace GameLogic; - -Weapon::Weapon(void) -{ -} - - -Weapon::~Weapon(void) -{ -} diff --git a/Code/GameLogic/Weapon.h b/Code/GameLogic/Weapon.h deleted file mode 100644 index e8d37a15..00000000 --- a/Code/GameLogic/Weapon.h +++ /dev/null @@ -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 \ No newline at end of file