Merge branch 'master' of github.com:teamfisk/AgileBreakOut
This commit is contained in:
@@ -14,7 +14,7 @@ void dd::Systems::PhysicsSystem::Initialize()
|
|||||||
m_PhysicsWorld = new b2World(m_Gravity);
|
m_PhysicsWorld = new b2World(m_Gravity);
|
||||||
m_PhysicsWorld->SetContactListener(m_ContactListener);
|
m_PhysicsWorld->SetContactListener(m_ContactListener);
|
||||||
InitializeWater();
|
InitializeWater();
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, PhysicsSystem::SetImpulse);
|
EVENT_SUBSCRIBE_MEMBER(m_SetImpulse, &PhysicsSystem::SetImpulse);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PhysicsSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PhysicsSystem::OnPause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
|||||||
b2Vec2 *positionBuffer = m_ParticleSystem[e]->GetPositionBuffer();
|
b2Vec2 *positionBuffer = m_ParticleSystem[e]->GetPositionBuffer();
|
||||||
for (auto i : m_EntitiesToParticleHandle[e]) {
|
for (auto i : m_EntitiesToParticleHandle[e]) {
|
||||||
EntityID entity = i.first;
|
EntityID entity = i.first;
|
||||||
b2ParticleHandle *particleH = i.second;
|
const b2ParticleHandle *particleH = i.second;
|
||||||
|
|
||||||
b2Vec2 positionB2 = positionBuffer[particleH->GetIndex()];
|
b2Vec2 positionB2 = positionBuffer[particleH->GetIndex()];
|
||||||
glm::vec2 position = glm::vec2(positionB2.x, positionB2.y);
|
glm::vec2 position = glm::vec2(positionB2.x, positionB2.y);
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
#include "PrecompiledHeader.h"
|
|
||||||
#include <boost/test/unit_test.hpp>
|
|
||||||
#include "Core/World.h"
|
|
||||||
#include "Core/EventBroker.h"
|
|
||||||
#include "Physics/PhysicsSystem.h"
|
|
||||||
#include "Transform/TransformSystem.h"
|
|
||||||
|
|
||||||
#include "Physics/CPhysics.h"
|
|
||||||
#include "Physics/CRectangleShape.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace dd;
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(RemovePhysicsSystemTest)
|
|
||||||
{
|
|
||||||
// Setup world
|
|
||||||
std::shared_ptr<EventBroker> eventBroker = std::make_shared<EventBroker>();
|
|
||||||
World world(eventBroker);
|
|
||||||
|
|
||||||
world.SystemFactory.Register<Systems::TransformSystem>(
|
|
||||||
[this]() { return new Systems::TransformSystem(&world, eventBroker); });
|
|
||||||
world.AddSystem<Systems::TransformSystem>();
|
|
||||||
|
|
||||||
world.SystemFactory.Register<Systems::PhysicsSystem>(
|
|
||||||
[this]() { return new Systems::PhysicsSystem(&world, eventBroker); });
|
|
||||||
world.AddSystem<Systems::PhysicsSystem>();
|
|
||||||
|
|
||||||
world.ComponentFactory.Register<Components::RectangleShape>();
|
|
||||||
world.ComponentFactory.Register<Components::Physics>();
|
|
||||||
|
|
||||||
//Create entity
|
|
||||||
EntityID ent = world.CreateEntity();
|
|
||||||
|
|
||||||
auto transform = world.AddComponent<Components::Transform>(ent);
|
|
||||||
transform->Position = glm::vec3(20.f, 0.f, -10.f);
|
|
||||||
transform->Velocity = glm::vec3(1.f, 3.f, 0.f);
|
|
||||||
transform->Scale = glm::vec3(2.f, 5.f, 1.f);
|
|
||||||
|
|
||||||
auto physics = world.AddComponent<Components::Physics>(ent);
|
|
||||||
physics->Static = false;
|
|
||||||
physics->Calculate = true;
|
|
||||||
physics->Category = CollisionLayer::Type::Ball;
|
|
||||||
physics->Mask = CollisionLayer::Type::Brick | CollisionLayer::Type::Pad | CollisionLayer::Wall;
|
|
||||||
physics->GravityScale = 0.f;
|
|
||||||
|
|
||||||
auto rectangle = world.AddComponent<Components::RectangleShape>(ent);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user