test with physic
This commit is contained in:
parent
61be10b573
commit
15a55f76a3
|
@ -5,6 +5,8 @@
|
||||||
#include "Render/Rendering/Render.h"
|
#include "Render/Rendering/Render.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
#include "PhysicsAPI.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -23,6 +25,8 @@ namespace GameLogic
|
||||||
protected:
|
protected:
|
||||||
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
||||||
//rigidBody
|
//rigidBody
|
||||||
|
unsigned int ref;
|
||||||
|
::Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> rigidBody;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,78 @@
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "OysterMath.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
using namespace Oyster::Physics;
|
||||||
|
using namespace Utility::DynamicMemory;
|
||||||
|
|
||||||
|
|
||||||
|
//void ColisionEvent(unsigned int obj1Ref, unsigned int obj2Ref)
|
||||||
|
//{
|
||||||
|
// const ICustomBody *body1 = &API::Instance().Peek( obj1Ref );
|
||||||
|
// const ICustomBody *body2 = &API::Instance().Peek( obj2Ref );
|
||||||
|
// if( body1 != &Error::nobody )
|
||||||
|
// {
|
||||||
|
// Object *obj1 = (Object*) const_cast<ICustomBody*>(body1);
|
||||||
|
//
|
||||||
|
// Object *obj2 = (Object*) const_cast<ICustomBody*>(body2);
|
||||||
|
//
|
||||||
|
// //switch( obj1->type )
|
||||||
|
// //{
|
||||||
|
// //case Player:
|
||||||
|
// // switch (obj2->type)
|
||||||
|
// // {
|
||||||
|
// // case låda:
|
||||||
|
// // //action
|
||||||
|
// // //soud
|
||||||
|
// // //particle effect
|
||||||
|
//
|
||||||
|
// // }
|
||||||
|
//
|
||||||
|
// //case låda :
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //}
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
void DestructionEvent(unsigned int obj1, ::Utility::DynamicMemory::UniquePointer<ICustomBody> obj2)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Player::Player(void)
|
Player::Player(void)
|
||||||
:Object()
|
:Object()
|
||||||
{
|
{
|
||||||
life = 10;
|
life = 10;
|
||||||
|
|
||||||
|
UniquePointer<ICustomBody> rigidBody = API::Instance().CreateSimpleRigidBody();
|
||||||
|
ref = API::Instance().AddObject(rigidBody);
|
||||||
|
//ref = API::Instance().AddObject(API::Instance().CreateSimpleRigidBody());
|
||||||
|
const ICustomBody* rB;
|
||||||
|
|
||||||
|
//rB = &API::Instance().Peek(ref);
|
||||||
|
//if( rB == &Error::nobody)
|
||||||
|
//{
|
||||||
|
// //error
|
||||||
|
//}
|
||||||
|
|
||||||
|
API::Instance().SetCenter(ref, Oyster::Math::Float3::null);
|
||||||
|
API::Instance().SetMass_KeepMomentum(ref, 20);
|
||||||
|
// get Tensor matrix (tröghetsmonent)
|
||||||
|
//API::Instance().SetMomentOfInertiaTensor_KeepMomentum(ref, tensorMatrix )
|
||||||
|
|
||||||
|
//Oyster::Math::Float3 ve = rB->GetCenter();
|
||||||
|
API::Instance().SetDeltaTime(0.01f);
|
||||||
|
|
||||||
|
//API::Instance().ApplyForceAt(ref, rB->GetCenter(), Oyster::Math::Float3::null);
|
||||||
|
|
||||||
|
//API::Instance().SetAction(ColisionEvent);
|
||||||
|
|
||||||
|
//API::Instance().Update();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +82,8 @@ Player::~Player(void)
|
||||||
}
|
}
|
||||||
void Player::Update()
|
void Player::Update()
|
||||||
{
|
{
|
||||||
|
//API::Instance().API::Update();
|
||||||
|
//API::Instance().API::ApplyForceAt(ref, )
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Move()
|
void Player::Move()
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
//void ColisionEvent(unsigned int obj1, unsigned int obj2);
|
||||||
|
void DestructionEvent(unsigned int obj1, ::Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> obj2);
|
||||||
|
|
||||||
class Player : public Object
|
class Player : public Object
|
||||||
{
|
{
|
||||||
|
@ -23,6 +26,8 @@ namespace GameLogic
|
||||||
private:
|
private:
|
||||||
int life;
|
int life;
|
||||||
Weapon *weapon;
|
Weapon *weapon;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Render\Preparations\Preparations.h"
|
#include "Render\Preparations\Preparations.h"
|
||||||
#include "IGame.h"
|
#include "IGame.h"
|
||||||
|
#include "InputController.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,6 +199,9 @@ HRESULT Render(float deltaTime)
|
||||||
//Oyster::Graphics::Core::deviceContext->Draw(3,0);
|
//Oyster::Graphics::Core::deviceContext->Draw(3,0);
|
||||||
|
|
||||||
//Oyster::Graphics::Render::Rendering::Basic::EndFrame();
|
//Oyster::Graphics::Render::Rendering::Basic::EndFrame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Oyster::Graphics::Core::swapChain->Present(0,0);
|
Oyster::Graphics::Core::swapChain->Present(0,0);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
Loading…
Reference in New Issue