Breakout Standard Screen

Meaning bricks, ball, pad, walls bounces, things.
May or may not work as intended.
This commit is contained in:
PlatinumSkink
2015-09-11 15:07:00 +02:00
parent ead7c6c754
commit bda864ac11
7 changed files with 67 additions and 23 deletions
+8 -5
View File
@@ -39,6 +39,7 @@
#include "Game/PadSystem.h"
#include "Game/CBall.h"
#include "Game/CBrick.h"
#include "Game/CPad.h"
#include "Physics/PhysicsSystem.h"
#include "Physics/CPhysics.h"
@@ -78,6 +79,7 @@ public:
m_World->ComponentFactory.Register<Components::Physics>();
m_World->ComponentFactory.Register<Components::Ball>();
m_World->ComponentFactory.Register<Components::Brick>();
m_World->ComponentFactory.Register<Components::Pad>();
m_World->SystemFactory.Register<Systems::PhysicsSystem>(
[this]() { return new Systems::PhysicsSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::PhysicsSystem>();
@@ -110,7 +112,7 @@ public:
Events::SetImpulse e;
e.Entity = ent;
e.Impulse = glm::vec2(0.f, -1.f);
e.Impulse = glm::vec2(0.f, -7.f);
e.Point = glm::vec2(0.5f, 0.f);
m_EventBroker->Publish(e);
}
@@ -118,8 +120,8 @@ public:
{
auto topWall = m_World->CreateEntity();
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(topWall);
transform->Position = glm::vec3(-9.f, 5.f, -9.f);
transform->Scale = glm::vec3(10.f, 0.5f, 1.f);
transform->Position = glm::vec3(0.f, 5.f, -10.f);
transform->Scale = glm::vec3(15.f, 0.5f, 1.f);
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(topWall);
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
@@ -134,7 +136,7 @@ public:
{
auto leftWall = m_World->CreateEntity();
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(leftWall);
transform->Position = glm::vec3(-7.f, 1.f, -9.f);
transform->Position = glm::vec3(-9.f, 1.f, -10.f);
transform->Scale = glm::vec3(0.5f, 10.f, 1.f);
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(leftWall);
@@ -150,7 +152,7 @@ public:
{
auto rightWall = m_World->CreateEntity();
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(rightWall);
transform->Position = glm::vec3(7.f, 1.f, -9.f);
transform->Position = glm::vec3(9.f, 1.f, -10.f);
transform->Scale = glm::vec3(0.5f, 10.f, 1.f);
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(rightWall);
@@ -192,6 +194,7 @@ public:
auto rectangle = m_World->AddComponent<Components::RectangleShape>(ent);
auto physics = m_World->AddComponent<Components::Physics>(ent);
auto csprite = m_World->AddComponent<Components::Sprite>(ent);
auto pad = m_World->AddComponent<Components::Pad>(ent);
csprite->SpriteFile = "Textures/Pad.png";
m_World->CommitEntity(ent);
}