diff --git a/Code/GameLogic/GameLogic.vcxproj b/Code/GameLogic/GameLogic.vcxproj index e4e48526..b0733004 100644 --- a/Code/GameLogic/GameLogic.vcxproj +++ b/Code/GameLogic/GameLogic.vcxproj @@ -176,8 +176,10 @@ + + @@ -187,8 +189,10 @@ + + diff --git a/Code/GameLogic/GameLogic.vcxproj.filters b/Code/GameLogic/GameLogic.vcxproj.filters index 38b2d5fa..e0ed6161 100644 --- a/Code/GameLogic/GameLogic.vcxproj.filters +++ b/Code/GameLogic/GameLogic.vcxproj.filters @@ -42,6 +42,12 @@ Header Files + + Header Files + + + Header Files + @@ -74,5 +80,11 @@ Source Files + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Code/GameLogic/IGame.cpp b/Code/GameLogic/IGame.cpp index 883a9285..0fe09345 100644 --- a/Code/GameLogic/IGame.cpp +++ b/Code/GameLogic/IGame.cpp @@ -8,16 +8,14 @@ BOOL WINAPI DllMain( _In_ LPVOID lpvReserved ) { - return TRUE; } using namespace GameLogic; + IGame::IGame() { gameModule = new Game(); } - - IGame::~IGame() { delete gameModule; diff --git a/Code/GameLogic/Object.cpp b/Code/GameLogic/Object.cpp index a83d1fb6..d93dba63 100644 --- a/Code/GameLogic/Object.cpp +++ b/Code/GameLogic/Object.cpp @@ -43,7 +43,6 @@ void Object::Render() { this->rigidBody->GetOrientation(model->WorldMatrix); Oyster::Graphics::API::RenderScene(model, 1); - } Object::OBJECT_TYPE Object::GetType() diff --git a/Code/GameLogic/Player.cpp b/Code/GameLogic/Player.cpp index 3a9ae029..93a83506 100644 --- a/Code/GameLogic/Player.cpp +++ b/Code/GameLogic/Player.cpp @@ -1,54 +1,53 @@ #include "Player.h" #include "OysterMath.h" - using namespace GameLogic; using namespace Oyster::Physics; -using namespace Utility::DynamicMemory; - - - Player::Player(void) :Object() { life = 100; } - - Player::~Player(void) { delete this->rigidBody; } + void Player::Update(keyInput keyPressed) { if(keyPressed != keyInput_none) { - Move(); - - 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); - } + Move(keyPressed); } - } -void Player::Move() +void Player::Move(keyInput keyPressed) { - //API::Instance().Update(); - /*Oyster::Math::Float3 pos = this->rigidBody->GetCenter(); - pos.x += 0.1; - rigidBody->SetCenter(pos);*/ - //API::Instance().SetCenter(rigidBody, pos); + 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 index 7726fed4..9b4b86b0 100644 --- a/Code/GameLogic/Player.h +++ b/Code/GameLogic/Player.h @@ -13,27 +13,25 @@ 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(); + void Move(keyInput keyPressed); void Shoot(); - private: int life; Weapon *weapon; - - }; - } #endif \ No newline at end of file diff --git a/Code/GameLogic/TestGLMain.cpp b/Code/GameLogic/TestGLMain.cpp index 8cf34e5f..2d6e4853 100644 --- a/Code/GameLogic/TestGLMain.cpp +++ b/Code/GameLogic/TestGLMain.cpp @@ -272,10 +272,10 @@ HRESULT Render(float deltaTime) } // test view and projection matrix - Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1); - Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0); + 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); - + Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos); view = view.GetInverse();