Merge remote-tracking branch 'origin/master' into LevelSystemAndSuch

This commit is contained in:
PlatinumSkink
2015-10-15 10:24:13 +02:00
51 changed files with 212 additions and 160 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

+151 -150
View File
@@ -1,151 +1,152 @@
#ifndef DAYDREAM_BALLSYSTEM_H #ifndef DAYDREAM_BALLSYSTEM_H
#define DAYDREAM_BALLSYSTEM_H #define DAYDREAM_BALLSYSTEM_H
#include "Core/System.h" #include "Core/System.h"
#include "Core/World.h" #include "Core/World.h"
#include "Core/EventBroker.h" #include "Core/EventBroker.h"
#include "Core/CTransform.h" #include "Core/CTransform.h"
#include "Core/CTemplate.h" #include "Core/CTemplate.h"
#include "Physics/CPhysics.h" #include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h" #include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h" #include "Physics/CRectangleShape.h"
#include "Physics/EContact.h" #include "Physics/EContact.h"
#include "Rendering/CModel.h" #include "Rendering/CModel.h"
#include "Rendering/CSprite.h" #include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h" #include "Rendering/CPointLight.h"
#include "Game/CBall.h" #include "Game/CBall.h"
#include "Game/CPowerUp.h" #include "Game/CPowerUp.h"
#include "Game/CLife.h" #include "Game/CLife.h"
#include "Game/CBrick.h" #include "Game/CBrick.h"
#include "Game/CLifebuoy.h" #include "Game/CLifebuoy.h"
#include "Game/ELifeLost.h" #include "Game/ELifeLost.h"
#include "Game/EComboEvent.h" #include "Game/EComboEvent.h"
#include "Game/EResetBall.h" #include "Game/EResetBall.h"
#include "Game/EMultiBall.h" #include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h" #include "Game/EMultiBallLost.h"
#include "Game/EStickyPad.h" #include "Game/EStickyPad.h"
#include "Game/EStickyAttachedToPad.h" #include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h" #include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h" #include "Game/EInkBlasterOver.h"
#include "Game/EStageCleared.h" #include "Game/EStageCleared.h"
#include "Game/EArrivedAtNewStage.h" #include "Game/EArrivedAtNewStage.h"
#include "Game/EGameOver.h" #include "Game/EGameOver.h"
#include "Game/EPause.h" #include "Game/EPause.h"
#include "Game/EHitPad.h" #include "Game/EHitPad.h"
#include "Game/EHitLag.h" #include "Game/EHitLag.h"
#include "Game/EActionButton.h" #include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h" #include "Game/ELifebuoyHit.h"
#include "Physics/ECreateParticleSequence.h"
namespace dd
{ namespace dd
{
namespace Systems
{ namespace Systems
{
class BallSystem : public System
{ class BallSystem : public System
public: {
BallSystem(World *world, std::shared_ptr<dd::EventBroker> eventBroker) public:
: System(world, eventBroker) { } BallSystem(World *world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker) { }
~BallSystem();
~BallSystem();
void RegisterComponents(ComponentFactory *cf) override;
void RegisterComponents(ComponentFactory *cf) override;
void Initialize() override;
void Initialize() override;
// Called once per system every tick
void Update(double dt) override; // Called once per system every tick
void Update(double dt) override;
// Called once for every entity in the world every tick
void UpdateEntity(double dt, EntityID entity, EntityID parent) override; // Called once for every entity in the world every tick
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
// Called when components are committed to an entity
void OnEntityCommit(EntityID entity) override; // Called when components are committed to an entity
void OnEntityCommit(EntityID entity) override;
// Called when an entity is removed
void OnEntityRemoved(EntityID entity) override; // Called when an entity is removed
void OnEntityRemoved(EntityID entity) override;
EntityID CreateBall();
void CreateLife(int); EntityID CreateBall();
EntityID Ball() { return m_Ball; }; void CreateLife(int);
void SetBall(const EntityID& ball) { m_Ball = ball; } EntityID Ball() { return m_Ball; };
void SetBall(const EntityID& ball) { m_Ball = ball; }
float& XMovementMultiplier() { return m_XMovementMultiplier; }
void SetXMovementMultiplier(const float& xMovementMultiplier) { m_XMovementMultiplier = xMovementMultiplier; } float& XMovementMultiplier() { return m_XMovementMultiplier; }
float& EdgeX() { return m_EdgeX; } void SetXMovementMultiplier(const float& xMovementMultiplier) { m_XMovementMultiplier = xMovementMultiplier; }
void SetEdgeX(const float& edgeX) { m_EdgeX = edgeX; } float& EdgeX() { return m_EdgeX; }
float& EdgeY() { return m_EdgeY; } void SetEdgeX(const float& edgeX) { m_EdgeX = edgeX; }
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; } float& EdgeY() { return m_EdgeY; }
int& MultiBalls() { return m_MultiBalls; } void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; } int& MultiBalls() { return m_MultiBalls; }
int& Lives() { return m_Lives; } void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; }
void SetLives(const int& lives) { m_Lives = lives; } int& Lives() { return m_Lives; }
int& PastLives() { return m_PastLives; } void SetLives(const int& lives) { m_Lives = lives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; } int& PastLives() { return m_PastLives; }
bool ReplaceBall() const { return m_ReplaceBall; } void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; } bool ReplaceBall() const { return m_ReplaceBall; }
bool IsPaused() const { return m_Pause; } void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
void SetPause(const bool& pause) { m_Pause = pause; } bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
float m_XMovementMultiplier = 2.f; private:
float m_EdgeX = 3.2f; float m_XMovementMultiplier = 2.f;
float m_EdgeY = 5.2f; float m_EdgeX = 3.2f;
int m_MultiBalls = 0; float m_EdgeY = 5.2f;
int m_Lives = 3; int m_MultiBalls = 0;
int m_PastLives = 3; int m_Lives = 3;
bool m_ReplaceBall = false; int m_PastLives = 3;
bool m_Pause = false; bool m_ReplaceBall = false;
bool m_Waiting = true; bool m_Pause = false;
bool m_Sticky = false; bool m_Waiting = true;
bool m_InkBlaster = false; bool m_Sticky = false;
bool m_InkAttached = false; bool m_InkBlaster = false;
bool m_InkBlockedWaiting = false; bool m_InkAttached = false;
bool m_Restarting = false; bool m_InkBlockedWaiting = false;
int m_StickyCounter = 3; bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_StageBlockedWaiting = false;
bool m_StageBlockedWaiting = false;
glm::vec3 m_SavedSpeed;
bool m_InitializePause = false; glm::vec3 m_SavedSpeed;
bool m_InitializePause = false;
EntityID m_Ball;
EntityID m_Ball;
std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
void ResolveContacts(); std::unordered_map<EntityID, std::list<glm::vec2>> m_Contacts;
void ResolveContacts();
dd::EventRelay<BallSystem, dd::Events::LifeLost> m_ELifeLost;
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost; dd::EventRelay<BallSystem, dd::Events::LifeLost> m_ELifeLost;
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall; dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall; dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad; dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster; dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver; dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause; dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact; dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton; dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared; dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage; dd::EventRelay<BallSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
bool Contact(const Events::Contact &event);
bool OnLifeLost(const dd::Events::LifeLost &event); bool Contact(const Events::Contact &event);
bool OnMultiBallLost(const dd::Events::MultiBallLost &event); bool OnLifeLost(const dd::Events::LifeLost &event);
bool OnResetBall(const dd::Events::ResetBall &event); bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
bool OnMultiBall(const dd::Events::MultiBall &event); bool OnResetBall(const dd::Events::ResetBall &event);
bool OnStickyPad(const dd::Events::StickyPad &event); bool OnMultiBall(const dd::Events::MultiBall &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event); bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event); bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnPause(const dd::Events::Pause &event); bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
bool OnActionButton(const dd::Events::ActionButton &event); bool OnPause(const dd::Events::Pause &event);
bool OnStageCleared(const dd::Events::StageCleared &event); bool OnActionButton(const dd::Events::ActionButton &event);
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event); bool OnStageCleared(const dd::Events::StageCleared &event);
}; bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
};
}
}
}
}
#endif
#endif
+23 -6
View File
@@ -26,8 +26,14 @@ public:
Width = parent->Width; Width = parent->Width;
Height = parent->Height; Height = parent->Height;
m_ScoreBackground = new GUI::TextureFrame(this, "HUDScoreBackgroundFrame"); m_ScoreBackMid = new GUI::TextureFrame(this, "HUDScoreBackgroundFrame");
m_ScoreBackground->SetTexture("Textures/GUI/Numbers/Background.png"); m_ScoreBackMid->SetTexture("Textures/GUI/Numbers/ScoreBackgroundMid.png");
m_ScoreBackLeft = new GUI::TextureFrame(this, "HUDScoreBackgroundLeftFrame");
m_ScoreBackLeft->SetTexture("Textures/GUI/Numbers/ScoreBackgroundLeft.png");
m_ScoreBackRight = new GUI::TextureFrame(this, "HUDScoreBackgroundRightFrame");
m_ScoreBackRight->SetTexture("Textures/GUI/Numbers/ScoreBackgroundRight.png");
m_ScoreNumberFrame = new GUI::NumberFrame(this, "HUDScoreNumberFrame"); m_ScoreNumberFrame = new GUI::NumberFrame(this, "HUDScoreNumberFrame");
//m_ScoreNumberFrame->X = 15; //m_ScoreNumberFrame->X = 15;
m_ScoreNumberFrame->Y = 18; m_ScoreNumberFrame->Y = 18;
@@ -52,7 +58,9 @@ public:
private: private:
TextureFrame* m_ScoreBackground = nullptr; TextureFrame* m_ScoreBackMid = nullptr;
TextureFrame* m_ScoreBackLeft = nullptr;
TextureFrame* m_ScoreBackRight = nullptr;
NumberFrame* m_ScoreNumberFrame = nullptr; NumberFrame* m_ScoreNumberFrame = nullptr;
FPSCounter* m_FPSCounter = nullptr; FPSCounter* m_FPSCounter = nullptr;
TextureFrame* m_GameOverFrame = nullptr; TextureFrame* m_GameOverFrame = nullptr;
@@ -67,9 +75,18 @@ private:
void updateScore() void updateScore()
{ {
m_ScoreNumberFrame->SetLeft(Width / 2.f - m_ScoreNumberFrame->Width / 2.f); m_ScoreNumberFrame->SetLeft(Width / 2.f - m_ScoreNumberFrame->Width / 2.f);
m_ScoreBackground->SetLeft(m_ScoreNumberFrame->Left() - 20);
m_ScoreBackground->Width = m_ScoreNumberFrame->Width + 40; m_ScoreBackMid->SetLeft(m_ScoreNumberFrame->Left());
m_ScoreBackground->Height = m_ScoreNumberFrame->Height + 30; m_ScoreBackMid->Width = m_ScoreNumberFrame->Width;
m_ScoreBackMid->Height = m_ScoreNumberFrame->Height + 35;
m_ScoreBackLeft->SetRight(m_ScoreBackMid->Left());
m_ScoreBackLeft->Width = 40;
m_ScoreBackLeft->Height = m_ScoreBackMid->Height;
m_ScoreBackRight->SetLeft(m_ScoreBackMid->Right());
m_ScoreBackRight->Width = 40;
m_ScoreBackRight->Height = m_ScoreBackMid->Height;
} }
bool OnScore(const Events::ScoreEvent& event) bool OnScore(const Events::ScoreEvent& event)
+2 -3
View File
@@ -57,9 +57,6 @@ namespace dd
~PhysicsSystem(); ~PhysicsSystem();
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
void RegisterComponents(ComponentFactory* cf) override; void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override; void Initialize() override;
void Update(double dt) override; void Update(double dt) override;
@@ -116,6 +113,8 @@ namespace dd
bool OnPause(const dd::Events::Pause &event); bool OnPause(const dd::Events::Pause &event);
dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact; dd::EventRelay<PhysicsSystem, dd::Events::Contact> m_EContact;
bool OnContact(const dd::Events::Contact &event); bool OnContact(const dd::Events::Contact &event);
EventRelay<PhysicsSystem, Events::CreateParticleSequence> m_ECreateParticleSequence;
bool CreateParticleSequence(const Events::CreateParticleSequence &event);
//TODO: Fill struct with info needed. //TODO: Fill struct with info needed.
struct EmitterHandler //TODO CHANGE NAMES struct EmitterHandler //TODO CHANGE NAMES
+36 -1
View File
@@ -26,6 +26,7 @@ void dd::Systems::BallSystem::Initialize()
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared);
EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage); EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage);
//OctoBall //OctoBall
{ {
auto ent = m_World->CreateEntity(); auto ent = m_World->CreateEntity();
@@ -291,7 +292,41 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
float x = (ballTransform->Position.x - padTransform->Position.x) * XMovementMultiplier(); float x = (ballTransform->Position.x - padTransform->Position.x) * XMovementMultiplier();
float y = glm::cos((abs(x) / (1.6f)) * glm::pi<float>() / 2.f) + 1.f; float y = glm::cos((abs(x) / (1.6f)) * glm::pi<float>() / 2.f) + 1.f;
ballComponent->Combo = 0; //When a combo is more than 2 create a particle showing it.
if (ballComponent->Combo >= 2){
Events::CreateParticleSequence particleEvent;
particleEvent.EmitterLifeTime = 3;
particleEvent.EmittingAngle = glm::half_pi<float>();
particleEvent.Spread = 0.f;
particleEvent.NumberOfTicks = 1;
particleEvent.ParticleLifeTime = 2.f;
particleEvent.ParticlesPerTick = 1;
particleEvent.Position = glm::vec3(ballTransform->Position.x, -3.f, -3.f);
if (ballTransform->Position.x >= 2.7f) {
particleEvent.Position = glm::vec3(2.7f, -3.f, -3.f);
} else if (ballTransform->Position.x <= -2.7f) {
particleEvent.Position = glm::vec3(-2.7f, -3.f, -3.f);
}
particleEvent.Radius = 1.f;
particleEvent.Color = glm::vec4(1.f);
particleEvent.Speed = 0;
if (ballComponent->Combo <= 9) {
particleEvent.SpriteFile = "Textures/Combo/Combo00" + std::to_string(ballComponent->Combo) + ".png";
} else if (ballComponent->Combo <= 42) {
particleEvent.SpriteFile = "Textures/Combo/Combo0" + std::to_string(ballComponent->Combo) + ".png";
} else {
particleEvent.SpriteFile = "Textures/Combo/Combo043.png";
}
EventBroker->Publish(particleEvent);
}
ballComponent->Combo = 56;
if (!ballComponent->Waiting) { if (!ballComponent->Waiting) {
if (m_InkBlaster) { if (m_InkBlaster) {
if (!m_InkAttached) { if (!m_InkAttached) {