Merge branch 'master' into gui

Conflicts:
	include/Game/GUI/HUD.h
	src/game/Core/Renderer.cpp
This commit is contained in:
2015-10-08 23:47:25 +02:00
73 changed files with 22402 additions and 302 deletions
+21 -2
View File
@@ -21,10 +21,16 @@
#include "Game/EResetBall.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EStickyPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.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/ELifebuoyHit.h"
namespace dd
{
@@ -89,7 +95,12 @@ private:
int m_PastLives = 3;
bool m_ReplaceBall = false;
bool m_Pause = false;
EntityID m_LastCollision = 999999;
bool m_Waiting = true;
bool m_Sticky = false;
bool m_InkBlaster = false;
bool m_InkAttached = false;
bool m_BlockedWaiting = false;
int m_StickyCounter = 5;
glm::vec3 m_SavedSpeed;
bool m_InitializePause = false;
@@ -103,15 +114,23 @@ private:
dd::EventRelay<BallSystem, dd::Events::MultiBallLost> m_EMultiBallLost;
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
dd::EventRelay<BallSystem, dd::Events::StickyPad> m_EStickyPad;
dd::EventRelay<BallSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<BallSystem, dd::Events::InkBlasterOver> m_EInkBlasterOver;
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
EventRelay<BallSystem, Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
bool Contact(const Events::Contact &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
bool OnMultiBallLost(const dd::Events::MultiBallLost &event);
bool OnResetBall(const dd::Events::ResetBall &event);
bool OnMultiBall(const dd::Events::MultiBall &event);
bool OnStickyPad(const dd::Events::StickyPad &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event);
bool OnPause(const dd::Events::Pause &event);
bool OnActionButton(const dd::Events::ActionButton &event);
};
}
+4
View File
@@ -19,6 +19,10 @@ struct Ball : Component
float Speed = 5.f;
int Combo = 0;
bool Paused = false;
bool Waiting = true;
bool InkBlaster = false;
bool Sticky = false;
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
};
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_CLIFEBUOY_H
#define DAYDREAM_CLIFEBUOY_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Lifebuoy : Component
{
int Hits = 4;
};
}
}
#endif //DAYDREAM_CLIFEBUOY_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_CPROJECTILE_H
#define DAYDREAM_CPROJECTILE_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct Projectile : Component
{
};
}
}
#endif //DAYDREAM_CPROJECTILE_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Administrator on 2015-10-07.
//
#ifndef DAYDREAM_EACTIONBUTTON_H
#define DAYDREAM_EACTIONBUTTON_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct ActionButton : Event
{
glm::vec3 Position;
};
}
}
#endif //DAYDREAM_EACTIONBUTTON_H
+22
View File
@@ -0,0 +1,22 @@
#ifndef DAYDREAM_ECLUSTERCLEAR_H
#define DAYDREAM_ECLUSTERCLEAR_H
#include "Core/EventBroker.h"
#include "Core/Entity.h"
namespace dd
{
namespace Events
{
struct ClusterClear : Event
{
};
}
}
#endif //DAYDREAM_ECLUSTERCLEAR_H
+3 -1
View File
@@ -6,6 +6,7 @@
#define DAYDREAM_EHITPAD_H
#include "Core/EventBroker.h"
#include "Core/Entity.h"
namespace dd
{
@@ -13,7 +14,8 @@ namespace Events
{
struct HitPad : Event
{
EntityID Pad;
EntityID Ball;
};
}
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_EINKBLASTER_H
#define DAYDREAM_EINKBLASTER_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct InkBlaster : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_EINKBLASTER_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_EINKBLASTEROVER_H
#define DAYDREAM_EINKBLASTEROVER_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct InkBlasterOver : Event
{
EntityID Ball;
};
}
}
#endif //DAYDREAM_EINKBLASTEROVER_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_ELIFEBUOY_H
#define DAYDREAM_ELIFEBUOY_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct Lifebuoy : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_ELIFEBUOY_H
+26
View File
@@ -0,0 +1,26 @@
//
// Created by Adniklastrator on 2015-09-29.
//
#ifndef DAYDREAM_ELIFEBUOYHIT_H
#define DAYDREAM_ELIFEBUOYHIT_H
#include "Core/Entity.h"
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct LifebuoyHit : Event
{
EntityID Lifebuoy;
};
}
}
#endif //DAYDREAM_ELIFEBUOYHIT_H
+6 -1
View File
@@ -9,13 +9,18 @@
namespace dd
{
namespace Events
{
struct StageCleared : Event
{
int ClearedStage = 0;
int StageCluster = 0;
};
}
}
#endif //DAYDREAM_ESTAGECLEARED_H
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-08.
//
#ifndef DAYDREAM_ESTICKYPAD_H
#define DAYDREAM_ESTICKYPAD_H
#include "Core/EventBroker.h"
namespace dd
{
namespace Events
{
struct StickyPad : Event
{
Components::Transform* Transform;
};
}
}
#endif //DAYDREAM_ESTICKYPAD_H
+22
View File
@@ -7,6 +7,8 @@
#include "Core/EKeyUp.h"
#include "Game/EScoreEvent.h"
#include "Game/GUI/FPSCounter.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
namespace dd
{
@@ -44,6 +46,8 @@ public:
m_FPSCounter = new GUI::FPSCounter(this, "FPSCounter");
EVENT_SUBSCRIBE_MEMBER(m_EScore, &HUD::OnScore);
EVENT_SUBSCRIBE_MEMBER(m_EGameOver, &HUD::OnGameOver);
EVENT_SUBSCRIBE_MEMBER(m_ClusterClear, &HUD::OnClusterClear);
}
private:
@@ -53,14 +57,32 @@ private:
NumberFrame* m_StageNumberFrame = nullptr;
NumberFrame* m_ScoreNumberFrame = nullptr;
FPSCounter* m_FPSCounter = nullptr;
TextureFrame* m_GameOverFrame = nullptr;
TextureFrame* m_ClusterClearFrame = nullptr;
EventRelay<Frame, Events::ScoreEvent> m_EScore;
EventRelay<Frame, Events::GameOver> m_EGameOver;
EventRelay<Frame, Events::ClusterClear> m_ClusterClear;
bool OnScore(const Events::ScoreEvent& event)
{
m_ScoreNumberFrame->SetNumber(m_ScoreNumberFrame->Number() + event.Score);
return true;
}
bool OnGameOver(const Events::GameOver& event)
{
m_GameOverFrame = new GUI::TextureFrame(this, "HUDGameOverFrame");
m_GameOverFrame->SetTexture("Textures/GUI/HUD/GameOverScreen.png");
return true;
}
bool OnClusterClear(const Events::ClusterClear& event)
{
m_ClusterClearFrame = new GUI::TextureFrame(this, "HUDGameOverFrame");
m_ClusterClearFrame->SetTexture("Textures/GUI/HUD/WinScreen.png");
return true;
}
};
}
+15 -4
View File
@@ -15,6 +15,7 @@
#include "Game/CBrick.h"
#include "Game/CBall.h"
#include "Game/CLife.h"
#include "Game/CProjectile.h"
#include "Game/CPowerUp.h"
#include "Game/EStageCleared.h"
#include "Game/ELifeLost.h"
@@ -22,13 +23,17 @@
#include "Game/EScoreEvent.h"
#include "Game/EComboEvent.h"
#include "Game/EHitPad.h"
#include "Game/ELifebuoy.h"
#include "Game/EStickyPad.h"
#include "Game/EInkBlaster.h"
#include "Game/EMultiBall.h"
#include "Game/EMultiBallLost.h"
#include "Game/EPause.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
#include "Game/ECreatePowerUp.h"
#include "Game/EPowerUpTaken.h"
#include "Game/Bricks/CPowerUpBrick.h"
//#include "Game/Bricks/CPowerUpBrick.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
@@ -39,6 +44,8 @@
#include <fstream>
#include <iostream>
#include "Physics/ECreateParticleSequence.h"
namespace dd
{
@@ -66,8 +73,8 @@ public:
void Initialize() override;
void CreateBasicLevel(int, int, glm::vec2, float);
void CreateLevel();
void CreateBrick(int, int, glm::vec2, float, int, int);
void CreateLevel(int);
void CreateBrick(int, int, glm::vec2, float, int, int, int, glm::vec4);
void OnEntityRemoved(EntityID entity);
@@ -108,7 +115,7 @@ private:
bool m_Initialized = false;
bool m_Pause = false;
int m_LooseBricks = 0;
int m_CurrentCluster = 2;
int m_CurrentCluster = 1;
int m_CurrentLevel = 1;
int m_MultiBalls = 0;
int m_PowerUps = 0;
@@ -123,10 +130,14 @@ private:
const int EmptyBrickSpace = 0;
const int StandardBrick = 1;
const int MultiBallBrick = 2;
const int LifebuoyBrick = 3;
const int StickyBrick = 4;
const int InkBlasterBrick = 5;
EntityID m_BrickTemplate;
std::array<int, 42> m_Bricks;
std::array<glm::vec4, 42> m_Colors;
dd::EventRelay<LevelSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LevelSystem, dd::Events::ScoreEvent> m_EScoreEvent;
+76
View File
@@ -0,0 +1,76 @@
//
// Created by Adniklastrator on 2015-09-09.
//
#ifndef DAYDREAM_LIFEBUOYSYSTEM_H
#define DAYDREAM_LIFEBUOYSYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Physics/CPhysics.h"
#include "Physics/CRectangleShape.h"
#include "Game/EPause.h"
#include "Game/ELifebuoy.h"
#include "Game/ELifebuoyHit.h"
#include "Game/CLifebuoy.h"
#include <fstream>
#include <iostream>
namespace dd
{
namespace Systems
{
class LifebuoySystem : public System
{
public:
LifebuoySystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
bool m_Pause = false;
EntityID m_Template;
dd::EventRelay<LifebuoySystem, dd::Events::Contact> m_EContact;
dd::EventRelay<LifebuoySystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifebuoySystem, dd::Events::Lifebuoy> m_ELifebuoy;
dd::EventRelay<LifebuoySystem, dd::Events::LifebuoyHit> m_ELifebuoyHit;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnLifebuoy(const dd::Events::Lifebuoy &event);
bool OnLifebuoyHit(const dd::Events::LifebuoyHit &event);
struct LifebuoyInfo
{
EntityID Entity;
//int Hits = 4;
};
float m_LeftEdge = -3.8f;
float m_RightEdge = 3.8f;
float m_DownLimit = -5.3f;
float m_DownEdge = -9.2f;
std::list<LifebuoyInfo> m_Lifebuoys;
};
}
}
#endif //DAYDREAM_LIFEBUOYSYSTEM_H
+1
View File
@@ -30,6 +30,7 @@
#include "Game/EStageCleared.h"
#include "Game/EPause.h"
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
namespace dd
+74
View File
@@ -0,0 +1,74 @@
//
// Created by Adniklastrator on 2015-09-09.
//
#ifndef DAYDREAM_PROJECTILESYSTEM_H
#define DAYDREAM_PROJECTILESYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Game/EPause.h"
#include "Game/EInkBlaster.h"
#include "Game/EInkBlasterOver.h"
#include "Game/EActionButton.h"
#include "Game/EHitPad.h"
#include "Game/CProjectile.h"
#include "Game/CBall.h"
#include <fstream>
#include <iostream>
namespace dd
{
namespace Systems
{
class ProjectileSystem : public System
{
public:
ProjectileSystem(World* world, std::shared_ptr<dd::EventBroker> eventBroker)
: System(world, eventBroker)
{ }
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
bool m_Pause = false;
bool m_InkBlaster = false;
bool m_SquidLoaded = false;
int m_Shots = 0;
EntityID m_InkBlastTemplate;
EntityID m_AttachedSquid;
dd::EventRelay<ProjectileSystem, dd::Events::Contact> m_EContact;
dd::EventRelay<ProjectileSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<ProjectileSystem, dd::Events::InkBlaster> m_EInkBlaster;
dd::EventRelay<ProjectileSystem, dd::Events::HitPad> m_EHitPad;
dd::EventRelay<ProjectileSystem, dd::Events::ActionButton> m_EActionButton;
bool OnContact(const dd::Events::Contact &event);
bool OnPause(const dd::Events::Pause &event);
bool OnInkBlaster(const dd::Events::InkBlaster &event);
bool OnHitPad(const dd::Events::HitPad &event);
bool OnActionButton(const dd::Events::ActionButton &event);
};
}
}
#endif //DAYDREAM_PROJECTILESYSTEM_H