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

Conflicts:
	src/game/Game/LevelSystem.cpp
This commit is contained in:
viktorljung
2015-10-13 17:32:07 +02:00
62 changed files with 628 additions and 147 deletions
+13 -1
View File
@@ -31,14 +31,15 @@
//TODO: Remove includes that are only here for the temporary draw solution.
#include "World.h"
#include "CTransform.h"
#include "CTemplate.h"
#include "Core/EventBroker.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "CTemplate.h"
#include "Rendering/CPointLight.h"
#include "Transform/TransformSystem.h"
#include "Sound/SoundSystem.h"
#include "Sound/CCollisionSound.h"
#include "Game/LevelSystem.h"
#include "Game/PadSystem.h"
#include "Game/CBall.h"
@@ -46,12 +47,15 @@
#include "Game/CLifebuoy.h"
#include "Game/CProjectile.h"
#include "Game/CBrick.h"
#include "Game/CStickyAim.h"
#include "Game/BallSystem.h"
#include "Game/HitLagSystem.h"
#include "Game/LifebuoySystem.h"
#include "Game/ProjectileSystem.h"
#include "Game/Bricks/CPowerUpBrick.h"
#include "Game/BrickComponents.h"
#include "Physics/PhysicsSystem.h"
#include "Physics/CPhysics.h"
#include "Physics/CRectangleShape.h"
@@ -116,10 +120,18 @@ public:
m_World->ComponentFactory.Register<Components::Life>();
m_World->ComponentFactory.Register<Components::Lifebuoy>();
m_World->ComponentFactory.Register<Components::Projectile>();
m_World->ComponentFactory.Register<Components::StickyAim>();
m_World->ComponentFactory.Register<Components::PowerUp>();
m_World->ComponentFactory.Register<Components::PowerUpBrick>();
m_World->ComponentFactory.Register<Components::StandardBrick>();
m_World->ComponentFactory.Register<Components::MultiBallBrick>();
m_World->ComponentFactory.Register<Components::LifebuoyBrick>();
m_World->ComponentFactory.Register<Components::StickyBrick>();
m_World->ComponentFactory.Register<Components::InkBlasterBrick>();
m_World->ComponentFactory.Register<Components::KrakenAttackBrick>();
m_World->SystemFactory.Register<Systems::LevelSystem>(
[this]() { return new Systems::LevelSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::LevelSystem>();
+2 -2
View File
@@ -93,7 +93,7 @@ protected:
virtual bool OnMousePress(const Events::MousePress& event)
{
if (Hidden()) {
LOG_DEBUG("Pressed hidden button");
//LOG_DEBUG("Pressed hidden button");
return false;
}
@@ -117,7 +117,7 @@ protected:
virtual bool OnMouseRelease(const Events::MouseRelease& event)
{
if (Hidden()) {
LOG_DEBUG("Released hidden button");
//LOG_DEBUG("Released hidden button");
return false;
}
+2 -2
View File
@@ -10,11 +10,11 @@ namespace dd
namespace GUI
{
class NumberFrame : public Frame
class NumberFrame : public TextureFrame
{
public:
NumberFrame(Frame* parent, std::string name)
: Frame(parent, name)
: TextureFrame(parent, name)
{
m_CharacterTextures['0'] = "Textures/GUI/Numbers/N0.png";
m_CharacterTextures['1'] = "Textures/GUI/Numbers/N1.png";
+15 -4
View File
@@ -11,25 +11,29 @@
#include "Physics/CRectangleShape.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h"
#include "Game/CBall.h"
#include "Game/CPowerUp.h"
#include "Game/CLife.h"
#include "Game/CBrick.h"
#include "Game/CLifebuoy.h"
#include "Game/ELifeLost.h"
#include "Game/EComboEvent.h"
#include "Game/EResetBall.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EStickyPad.h"
#include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h"
#include "Game/EStageCleared.h"
#include "Game/EArrivedAtNewStage.h"
#include "Game/EGameOver.h"
#include "Game/EPause.h"
#include "Game/EHitPad.h"
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/CLifebuoy.h"
#include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h"
namespace dd
@@ -99,8 +103,11 @@ private:
bool m_Sticky = false;
bool m_InkBlaster = false;
bool m_InkAttached = false;
bool m_BlockedWaiting = false;
int m_StickyCounter = 5;
bool m_InkBlockedWaiting = false;
bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_StageBlockedWaiting = false;
glm::vec3 m_SavedSpeed;
bool m_InitializePause = false;
@@ -120,6 +127,8 @@ private:
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
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);
@@ -131,6 +140,8 @@ private:
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
bool OnPause(const dd::Events::Pause &event);
bool OnActionButton(const dd::Events::ActionButton &event);
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event);
};
}
+15
View File
@@ -0,0 +1,15 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CBRICKCOMPONENTS_H
#define DAYDREAM_CBRICKCOMPONENTS_H
#include "Game/CStandardBrick.h"
#include "Game/CMultiBallBrick.h"
#include "Game/CLifebuoyBrick.h"
#include "Game/CStickyBrick.h"
#include "Game/CInkBlasterBrick.h"
#include "Game/CKrakenAttackBrick.h"
#endif //DAYDREAM_CBRICKCOMPONENTS_H
+10
View File
@@ -16,8 +16,18 @@ namespace Components
struct Brick : Component
{
int Score = 50;
//0 = empty, 1 = normal, 2 = multi-brick, 3 = lifebuoy, 4 = sticky, 5 = blaster, 6 = kraken
int Type = 0;
bool Removed = false;
//What number of types each is.
const int EmptyBrickSpace = 0;
const int StandardBrick = 1;
const int MultiBallBrick = 2;
const int LifebuoyBrick = 3;
const int StickyBrick = 4;
const int InkBlasterBrick = 5;
const int KrakenAttackBrick = 6;
};
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CINKBLASTERBRICK_H
#define DAYDREAM_CINKBLASTERBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct InkBlasterBrick : Component
{
};
}
}
#endif //DAYDREAM_CINKBLASTERBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CKRAKENATTACKBRICK_H
#define DAYDREAM_CKRAKENATTACKBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct KrakenAttackBrick : Component
{
};
}
}
#endif //DAYDREAM_CKRAKENATTACKBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CLIFEBUOYBRICK_H
#define DAYDREAM_CLIFEBUOYBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct LifebuoyBrick : Component
{
};
}
}
#endif //DAYDREAM_CLIFEBUOYBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CMULTIBALLBRICK_H
#define DAYDREAM_CMULTIBALLBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct MultiBallBrick : Component
{
};
}
}
#endif //DAYDREAM_CMULTIBALLBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CSTANDARDBRICK_H
#define DAYDREAM_CSTANDARDBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct StandardBrick : Component
{
};
}
}
#endif //DAYDREAM_CSTANDARDBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CSTICKYAIM_H
#define DAYDREAM_CSTICKYAIM_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct StickyAim : Component
{
bool Aiming = false;
};
}
}
#endif //DAYDREAM_CSTICKYAIM_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef DAYDREAM_CSTICKYBRICK_H
#define DAYDREAM_CSTICKYBRICK_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct StickyBrick : Component
{
};
}
}
#endif //DAYDREAM_CSTICKYBRICK_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef EVENTS_EARRIVEDATNEWSTAGE_H__
#define EVENTS_EARRIVEDATNEWSTAGE_H__
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct ArrivedAtNewStage : public Event
{
};
}
}
#endif //DAYDREAM_EARRIVEDATNEWSTAGE_H
+1
View File
@@ -16,6 +16,7 @@ namespace Events
struct InkBlaster : Event
{
Components::Transform* Transform;
int Shots;
};
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-12.
//
#ifndef EVENTS_ESTICKYATTACHEDTOPAD_H__
#define EVENTS_ESTICKYATTACHEDTOPAD_H__
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct StickyAttachedToPad : public Event
{
};
}
}
#endif //DAYDREAM_ESTICKYATTACHEDTOPADE_H
+1
View File
@@ -16,6 +16,7 @@ namespace Events
struct StickyPad : Event
{
Components::Transform* Transform;
int Times;
};
}
+21 -16
View File
@@ -26,24 +26,24 @@ public:
Width = parent->Width;
Height = parent->Height;
m_LevelIndicator = new GUI::TextureFrame(this, "HUDLevelIndicator");
m_LevelIndicator->SetTexture("Textures/GUI/HUD/LevelIndicatorBG.png");
//m_LevelIndicator = new GUI::TextureFrame(this, "HUDLevelIndicator");
//m_LevelIndicator->SetTexture("Textures/GUI/HUD/LevelIndicatorBG.png");
m_AreaNumberFrame = new GUI::NumberFrame(m_LevelIndicator, "HUDScoreNumberFrameawdawdwa");
m_AreaNumberFrame->X = 132;
m_AreaNumberFrame->Y = 19;
m_AreaNumberFrame->SetNumber(6);
m_StageNumberFrame = new GUI::NumberFrame(m_LevelIndicator, "HUDScoreNumberFrameawdawdwa");
m_StageNumberFrame->X = 165;
m_StageNumberFrame->Y = 19;
m_StageNumberFrame->SetNumber(5);
//m_AreaNumberFrame = new GUI::NumberFrame(m_LevelIndicator, "HUDScoreNumberFrameawdawdwa");
//m_AreaNumberFrame->X = 132;
//m_AreaNumberFrame->Y = 19;
//m_AreaNumberFrame->SetNumber(6);
//m_StageNumberFrame = new GUI::NumberFrame(m_LevelIndicator, "HUDScoreNumberFrameawdawdwa");
//m_StageNumberFrame->X = 165;
//m_StageNumberFrame->Y = 19;
//m_StageNumberFrame->SetNumber(5);
m_ScoreIndicator = new GUI::TextureFrame(this, "HUDScoreIndicator");
m_ScoreIndicator->SetTexture("Textures/GUI/HUD/ScoreIndicatorBG.png");
m_ScoreIndicator->SetRight(Right());
m_ScoreNumberFrame = new GUI::NumberFrame(m_ScoreIndicator, "HUDScoreNumberFrame");
m_ScoreNumberFrame->X = 15;
m_ScoreNumberFrame->Y = 21;
//m_ScoreIndicator = new GUI::TextureFrame(this, "HUDScoreIndicator");
//m_ScoreIndicator->SetTexture("Textures/GUI/HUD/ScoreIndicatorBG.png");
m_ScoreNumberFrame = new GUI::NumberFrame(this, "HUDScoreNumberFrame");
m_ScoreNumberFrame->SetTexture("Textures/GUI/Numbers/Background.png");
//m_ScoreNumberFrame->X = 15;
m_ScoreNumberFrame->Y = 18;
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
@@ -60,6 +60,11 @@ public:
EVENT_SUBSCRIBE_MEMBER(m_KrakenAttack, &HUD::OnKrakenAttack);
}
void Update(double dt) override
{
m_ScoreNumberFrame->SetLeft(Width / 2.f - m_ScoreNumberFrame->Width / 2.f);
}
private:
TextureFrame* m_LevelIndicator = nullptr;
TextureFrame* m_ScoreIndicator = nullptr;
+6 -1
View File
@@ -16,11 +16,15 @@
#include "Core/World.h"
#include "Rendering/CSprite.h"
#include "Rendering/CModel.h"
#include "Game/CBrick.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
#include "Game/CProjectile.h"
#include "Game/CPowerUp.h"
#include "Game/BrickComponents.h"
#include "Game/EStageCleared.h"
#include "Game/ELifeLost.h"
#include "Game/EResetBall.h"
@@ -38,7 +42,7 @@
#include "Game/EClusterClear.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
//#include "Game/Bricks/CPowerUpBrick.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
@@ -79,6 +83,7 @@ public:
void CreateBasicLevel(int, int, glm::vec2, float);
void CreateLevel(int);
void CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
void BrickHit(EntityID, EntityID, int);
void OnEntityRemoved(EntityID entity);
+11
View File
@@ -24,8 +24,12 @@
#include "Game/CBall.h"
#include "Game/CPad.h"
#include "Game/CPowerUp.h"
#include "Game/CStickyAim.h"
#include "Game/EResetBall.h"
#include "Game/EMultiBall.h"
#include "Game/EStickyPad.h"
#include "Game/EStickyAttachedToPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EKrakenAttack.h"
#include "Game/EPowerUpTaken.h"
#include "Game/EStageCleared.h"
@@ -78,12 +82,15 @@ private:
bool m_ReplaceBall = false;
bool m_MultiBall = false;
bool m_KrakenAttack = false;
bool m_BallStuck = false;
double m_KrakenCharge = 0;
double m_KrakenStrength = 0;
double m_PlayerStrength = 0;
float m_Edge = 2.8f;
Components::Transform* m_Transform = nullptr;
Components::Pad* m_Pad = nullptr;
std::shared_ptr<Components::Transform> m_StickTransform;
std::shared_ptr<Components::StickyAim> m_StickyAim;
bool m_Pause = false;
@@ -94,6 +101,8 @@ private:
dd::EventRelay<PadSystem, dd::Events::StageCleared> m_EStageCleared;
dd::EventRelay<PadSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<PadSystem, dd::Events::KrakenAttack> m_EKrakenAttack;
dd::EventRelay<PadSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<PadSystem, dd::Events::StickyAttachedToPad> m_EStickyAttachedToPad;
dd::EventRelay<PadSystem, dd::Events::ActionButton> m_EActionButton;
bool OnKeyDown(const dd::Events::KeyDown &event);
@@ -103,6 +112,8 @@ private:
bool OnStageCleared(const dd::Events::StageCleared &event);
bool OnPause(const dd::Events::Pause &event);
bool OnKrakenAttack(const dd::Events::KrakenAttack &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event);
bool OnActionButton(const dd::Events::ActionButton &event);
class PadSteeringInputController;
+6 -1
View File
@@ -25,12 +25,15 @@
#include "Physics/CCircleShape.h"
#include "Physics/CParticleEmitter.h"
#include "Game/BrickComponents.h"
#include "Transform/TransformSystem.h"
#include "Transform/TransformSystem.h"
#include "CRectangleShape.h"
#include "Game/EStageCleared.h"
#include "Game/EArrivedAtNewStage.h"
#include "Game/EPause.h"
#include "Game/CPad.h"
#include "Game/CBrick.h"
@@ -97,6 +100,8 @@ namespace dd
std::unordered_map<b2Body*, EntityID> m_BodiesToEntities;
int t_counter = 0;
void CreateBody(EntityID entity);
void SyncEntitiesWithBodies();
@@ -126,7 +131,7 @@ namespace dd
std::vector<EntityID> ParticleEmitter;
std::vector<EntityID> ParticleTemplate;
};
EmitterHandler m_ParticleEmitters;
EmitterHandler m_ParticleEmitters;
std::list<Impulse> m_Impulses;