CircleShape

This commit is contained in:
viktorljung
2015-09-10 22:24:19 +01:00
parent 4853c67520
commit 963e492f9c
8 changed files with 101 additions and 31 deletions
+5 -3
View File
@@ -38,7 +38,8 @@
#include "Physics/PhysicsSystem.h"
#include "Physics/CPhysics.h"
#include "CBoxShape.h"
#include "Physics/CBoxShape.h"
namespace dd
{
@@ -83,10 +84,11 @@ public:
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
transform->Position = glm::vec3(0.f, 0.f, -10.f);
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(ent);
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
std::shared_ptr<Components::RectangleShape> boxShape = m_World->AddComponent<Components::RectangleShape>(ent);
std::shared_ptr<Components::CircleShape> circleShape = m_World->AddComponent<Components::CircleShape>(ent);
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(ent);
physics->Static = false;
@@ -100,7 +102,7 @@ public:
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
transform->Position = glm::vec3(0.f, -3.f, -9.f);
transform->Scale = glm::vec3(2.f, 0.5f, 1.f);
//transform->Orientation = glm::rotate(transform->Orientation, glm::radians(45.f), glm::vec3(0, 0, -1));
//transform->Orientation = glm::rotate(transform->Orientation, glm::radians(35.f), glm::vec3(0, 0, -1));
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(ent);
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
@@ -8,10 +8,10 @@ namespace dd
namespace Components
{
struct RectangleShape : public Component
{
struct RectangleShape : public Component
{
};
};
}
+20
View File
@@ -0,0 +1,20 @@
#ifndef CCIRCLESHAPE_H__
#define CCIRCLESHAPE_H__
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct CircleShape : public Component
{
// Circles are circles
};
}
}
#endif
+10 -9
View File
@@ -12,16 +12,17 @@
namespace dd
{
namespace Events
{
struct Contact : Event
{
EntityID Entity1;
EntityID Entity2;
glm::vec2 ContactPoint;
};
}
namespace Events
{
struct Contact : Event
{
EntityID Entity1;
EntityID Entity2;
glm::vec2 ContactPoint;
};
}
}
#endif //Events_ECONTACT_h__
+22
View File
@@ -0,0 +1,22 @@
#ifndef ESETIMPULSE_H__
#define ESETIMPULSE_H__
#include "Core/EventBroker.h"
#include "Core/Entity.h"
namespace dd
{
namespace Events
{
struct Contact : Event
{
EntityID Entity;
glm::vec2 Direction;
float Strength;
};
}
}
#endif
+2 -1
View File
@@ -5,12 +5,13 @@
#include "Core/System.h"
#include "Core/World.h"
#include "Core/CBoxShape.h"
#include "Physics/CBoxShape.h"
#include "Physics/CPhysics.h"
#include <Box2D/Box2D.h>
#include "Core/CTransform.h"
#include "Transform/TransformSystem.h"
#include "Physics/EContact.h"
#include "Physics/CCircleShape.h"
namespace dd