diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index 5f9dee44..ec283376 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -106,12 +106,12 @@ Disabled DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)OysterMath;$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(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.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -123,12 +123,12 @@ Disabled DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)OysterMath;$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(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.lib;Input_$(PlatformShortName)D.lib;%(AdditionalDependencies) OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -142,14 +142,14 @@ true DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)OysterMath;$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(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).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies) OysterGraphics_x86.dll;%(DelayLoadDLLs) @@ -163,14 +163,14 @@ true DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true - $(SolutionDir)OysterMath;$(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) + $(SolutionDir)OysterMath;$(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).lib;Input_$(PlatformShortName).lib;%(AdditionalDependencies) OysterGraphics_x86.dll;%(DelayLoadDLLs) @@ -187,22 +187,27 @@ {f10cbc03-9809-4cba-95d8-327c287b18ee} - - {b1195bb9-b3a5-47f0-906c-8dea384d1520} - + + + + + + + + diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index 025be43f..5698cb1d 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -5,7 +5,7 @@ #include "GameClientState/GameClientState.h" #include "GameClientState\GameState.h" #include "GameClientState\LobbyState.h" - +#include "vld.h" namespace DanBias { @@ -180,6 +180,9 @@ namespace DanBias if(state != Client::GameClientState::ClientState_Same) { m_data->gameClientState->Release(); + delete m_data->gameClientState; + m_data->gameClientState = NULL; + switch (state) { case Client::GameClientState::ClientState_Lobby: @@ -193,6 +196,7 @@ namespace DanBias break; } m_data->gameClientState->Init(); + } return S_OK; } @@ -221,8 +225,12 @@ namespace DanBias HRESULT DanBiasGame::CleanUp() { + m_data->gameClientState->Release(); delete m_data->gameClientState; delete m_data; + delete inputObj; + + Oyster::Graphics::API::Clean(); return S_OK; } diff --git a/Code/Game/DanBiasGame/GameClientState/C_Object.cpp b/Code/Game/DanBiasGame/GameClientState/C_Object.cpp new file mode 100644 index 00000000..840e6267 --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/C_Object.cpp @@ -0,0 +1,4 @@ +#include "C_Object.h" +using namespace DanBias::Client; + + diff --git a/Code/Game/DanBiasGame/GameClientState/C_Object.h b/Code/Game/DanBiasGame/GameClientState/C_Object.h new file mode 100644 index 00000000..0f2bdf81 --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/C_Object.h @@ -0,0 +1,18 @@ +#pragma once +namespace DanBias +{ + namespace Client + { +class C_Object +{ +private: + +public: + + virtual void Init() = 0; + virtual void setPos() = 0; + + virtual void Render() = 0; + virtual void Release() = 0; +};};}; + diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index a1df56f8..0914f259 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -1,5 +1,6 @@ #include "GameState.h" #include "DllInterfaces/GFXAPI.h" +#include "GameState/C_Player.h" using namespace DanBias::Client; struct GameState::myData @@ -7,7 +8,7 @@ struct GameState::myData myData(){} Oyster::Math3D::Float4x4 view; Oyster::Math3D::Float4x4 proj; - Oyster::Graphics::Model::Model *model; + C_Object* player; }privData; GameState::GameState(void) @@ -17,12 +18,14 @@ GameState::GameState(void) GameState::~GameState(void) { + } bool GameState::Init() { // load models privData = new myData(); - privData->model = Oyster::Graphics::API::CreateModel(L"crate"); + privData->player = new C_Player; + privData->player->Init(); privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000); Oyster::Graphics::API::SetProjection(privData->proj); @@ -46,11 +49,16 @@ bool GameState::Render() Oyster::Graphics::API::SetView(privData->view); Oyster::Graphics::API::SetProjection( privData->proj); Oyster::Graphics::API::NewFrame(); - //Oyster::Graphics::API::RenderModel(*(privData->model)); + privData->player->Render(); Oyster::Graphics::API::EndFrame(); return true; } bool GameState::Release() { + privData->player->Release(); + delete privData->player; + privData->player = NULL; + delete privData; + privData = NULL; return true; } \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.cpp b/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.cpp new file mode 100644 index 00000000..79d89eb9 --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.cpp @@ -0,0 +1,40 @@ +#include "C_DynamicObj.h" +#include "DllInterfaces/GFXAPI.h" +using namespace DanBias::Client; +struct C_DynamicObj::myData +{ + myData(){} + Oyster::Graphics::Model::Model *model; + // light + // sound + // effect +}privData; +C_DynamicObj::C_DynamicObj(void) +{ +} + + +C_DynamicObj::~C_DynamicObj(void) +{ + +} +void C_DynamicObj::Init() +{ + // load models + privData = new myData(); + privData->model = Oyster::Graphics::API::CreateModel(L"crate"); +} +void C_DynamicObj::setPos() +{ + +} + +void C_DynamicObj::Render() +{ + Oyster::Graphics::API::RenderModel(*(privData->model)); +} +void C_DynamicObj::Release() +{ + Oyster::Graphics::API::DeleteModel(privData->model); + delete privData; +} \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.h b/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.h new file mode 100644 index 00000000..01638550 --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_DynamicObj.h @@ -0,0 +1,20 @@ +#pragma once +namespace DanBias +{ + namespace Client + { +class C_DynamicObj +{ +private: + struct myData; + myData* privData; +public: + C_DynamicObj(void); + virtual ~C_DynamicObj(void); + void Init(); + void setPos(); + + void Render(); + void Release(); +};};}; + diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.cpp b/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.cpp new file mode 100644 index 00000000..6c0e327f --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.cpp @@ -0,0 +1,42 @@ +#include "C_Player.h" +#include "DllInterfaces/GFXAPI.h" +using namespace DanBias::Client; + +struct C_Player::myData +{ + myData(){} + Oyster::Math3D::Float4x4 view; + Oyster::Math3D::Float4x4 proj; + Oyster::Graphics::Model::Model *model; +}privData; + +C_Player::C_Player(void) +{ +} + + +C_Player::~C_Player(void) +{ + +} + +void C_Player::Init() +{ + // load models + privData = new myData(); + privData->model = Oyster::Graphics::API::CreateModel(L"crate"); +} +void C_Player::setPos() +{ + +} + +void C_Player::Render() +{ + Oyster::Graphics::API::RenderModel(*(privData->model)); +} +void C_Player::Release() +{ + Oyster::Graphics::API::DeleteModel(privData->model); + delete privData; +} diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.h b/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.h new file mode 100644 index 00000000..43f12e5d --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_Player.h @@ -0,0 +1,23 @@ +#pragma once +#include "../C_Object.h" +namespace DanBias +{ + namespace Client + { +class C_Player : public C_Object +{ +private: + struct myData; + myData* privData; + //Oyster::Graphics:: LIght +public: + C_Player(void); + ~C_Player(void); + void Init(); + void setPos(); + + void Render(); + void Release(); + +};};}; + diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.cpp b/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.cpp new file mode 100644 index 00000000..d3ceaf3f --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.cpp @@ -0,0 +1,42 @@ + +#include "C_StaticObj.h" +#include "DllInterfaces/GFXAPI.h" +using namespace DanBias::Client; + +struct C_StaticObj::myData +{ + myData(){} + Oyster::Graphics::Model::Model *model; + // light + // sound + // effect +}privData; +C_StaticObj::C_StaticObj(void) +{ +} + + +C_StaticObj::~C_StaticObj(void) +{ + +} +void C_StaticObj::Init() +{ + // load models + privData = new myData(); + privData->model = Oyster::Graphics::API::CreateModel(L"worldDummy"); +} +void C_StaticObj::setPos() +{ + +} + +void C_StaticObj::Render() +{ + Oyster::Graphics::API::RenderModel(*(privData->model)); +} +void C_StaticObj::Release() +{ + Oyster::Graphics::API::DeleteModel(privData->model); + delete privData; +} \ No newline at end of file diff --git a/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.h b/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.h new file mode 100644 index 00000000..06be4a55 --- /dev/null +++ b/Code/Game/DanBiasGame/GameClientState/GameState/C_StaticObj.h @@ -0,0 +1,21 @@ +#pragma once +#include "../C_Object.h" +namespace DanBias +{ + namespace Client + { +class C_StaticObj : public C_Object +{ +private: + struct myData; + myData* privData; +public: + C_StaticObj(void); + virtual ~C_StaticObj(void); + void Init(); + void setPos(); + + void Render(); + void Release(); +};};}; + diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index b52e9b6d..4cd06d01 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -1,6 +1,8 @@ #include "LobbyState.h" #include "DllInterfaces/GFXAPI.h" #include "OysterMath.h" +#include "GameState/C_Player.h" +#include "GameState/C_StaticObj.h" using namespace DanBias::Client; struct LobbyState::myData @@ -8,7 +10,7 @@ struct LobbyState::myData myData(){} Oyster::Math3D::Float4x4 view; Oyster::Math3D::Float4x4 proj; - Oyster::Graphics::Model::Model *model; + C_Object* object; }privData; @@ -20,14 +22,14 @@ LobbyState::LobbyState(void) LobbyState::~LobbyState(void) { - Oyster::Graphics::API::DeleteModel(privData->model); - Oyster::Graphics::API::Clean(); + } bool LobbyState::Init() { // load models privData = new myData(); - privData->model = Oyster::Graphics::API::CreateModel(L"crate"); + privData->object = new C_StaticObj(); + privData->object->Init(); privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000); //privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000); @@ -36,14 +38,12 @@ bool LobbyState::Init() privData->view = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f)); privData->view = Oyster::Math3D::InverseOrientationMatrix(privData->view); - - return true; } GameClientState::ClientState LobbyState::Update(float deltaTime, InputClass* KeyInput) { - if( KeyInput->IsKeyPressed(DIK_Q)) + if( KeyInput->IsKeyPressed(DIK_G)) return ClientState_Game; return ClientState_Same; } @@ -53,11 +53,17 @@ bool LobbyState::Render() Oyster::Graphics::API::SetView(privData->view); Oyster::Graphics::API::SetProjection( privData->proj); Oyster::Graphics::API::NewFrame(); - Oyster::Graphics::API::RenderModel(*(privData->model)); + // render objects + privData->object->Render(); Oyster::Graphics::API::EndFrame(); return true; } bool LobbyState::Release() { + privData->object->Release(); + delete privData->object; + privData->object = NULL; + delete privData; + privData = NULL; return true; } \ No newline at end of file diff --git a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj index 9d4363bb..6e5f099c 100644 --- a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj +++ b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj @@ -111,7 +111,7 @@ Windows true DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) + Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -127,7 +127,7 @@ Windows true DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) + Input_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -147,7 +147,7 @@ true true DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) - Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) + Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) @@ -167,7 +167,7 @@ true true DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) - Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) + Input_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) @@ -195,9 +195,6 @@ {52380daa-0f4a-4d97-8e57-98df39319caf} - - {b1195bb9-b3a5-47f0-906c-8dea384d1520} - diff --git a/Code/Game/GameLogic/Game.h b/Code/Game/GameLogic/Game.h index b3ac07c3..708c01e3 100644 --- a/Code/Game/GameLogic/Game.h +++ b/Code/Game/GameLogic/Game.h @@ -5,6 +5,7 @@ #include "Player.h" #include "IGame.h" #include "Camera.h" +#include "DynamicObject.h" namespace GameLogic { diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index 8afb5bb4..a01328ef 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -169,9 +169,7 @@ - - @@ -183,15 +181,12 @@ - - -