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

Conflicts:
	src/game/Game/LevelSystem.cpp
This commit is contained in:
viktorljung
2015-10-09 00:22:32 +02:00
48 changed files with 606 additions and 89 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 KiB

+2 -2
View File
@@ -65,8 +65,8 @@
#include "GUI/Frame.h"
#include "GUI/Button.h"
#include "Game/MainMenu.h"
#include "Game/HUD.h"
#include "Game/GUI/MainMenu.h"
#include "Game/GUI/HUD.h"
namespace dd
{
+2 -2
View File
@@ -188,13 +188,13 @@ void ResourceManager::Preload(std::string resourceName)
auto resourceType = typeid(T).name();
if (IsResourceLoaded(resourceType, resourceName))
{
LOG_WARNING("Attempted to preload resource \"%s\" multiple times!", resourceName);
LOG_WARNING("Attempted to preload resource \"%s\" multiple times!", resourceName.c_str());
return;
}
m_Preloading = true;
LOG_INFO("Preloading resource \"%s\"", resourceName.c_str());
CreateResource<T>(resourceName);
CreateResource<T>(resourceName, nullptr);
m_Preloading = false;
}
+2
View File
@@ -44,6 +44,8 @@ public:
: m_Name(name)
{
SetParent(parent);
Width = parent->Width;
Height = parent->Height;
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Frame::OnKeyDown);
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &Frame::OnKeyUp);
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Frame::OnCommand);
+15 -13
View File
@@ -23,18 +23,6 @@ public:
if (m_Texture == nullptr)
return;
// Main texture
{
FrameJob job;
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
job.Viewport = Rectangle(Left(), Top(), Width, Height);
job.TextureID = m_Texture->ResourceID;
job.DiffuseTexture = *m_Texture;
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a * m_CurrentFade);
job.Name = Name();
rq.GUI.Add(job);
}
// Texture while fading
if (m_FadeTexture && m_CurrentFade < 1) {
FrameJob job;
@@ -46,9 +34,21 @@ public:
job.Name = Name();
rq.GUI.Add(job);
}
// Main texture
{
FrameJob job;
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
job.Viewport = Rectangle(Left(), Top(), Width, Height);
job.TextureID = m_Texture->ResourceID;
job.DiffuseTexture = *m_Texture;
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a * m_CurrentFade);
job.Name = Name();
rq.GUI.Add(job);
}
}
dd::Texture* Texture() const { return m_Texture; }
std::string Texture() const { return m_TextureName; }
void SetTexture(std::string resourceName)
{
@@ -58,6 +58,7 @@ public:
}
m_Texture = ResourceManager::Load<dd::Texture>(resourceName);
m_TextureName = resourceName;
if (m_Texture == nullptr) {
m_Texture = ResourceManager::Load<dd::Texture>("Textures/Core/ErrorTexture.png");
}
@@ -98,6 +99,7 @@ public:
protected:
bool m_ScissorEnabled = true;
dd::Texture* m_Texture = nullptr;
std::string m_TextureName;
dd::Texture* m_FadeTexture = nullptr;
glm::vec4 m_Color = glm::vec4(1.f, 1.f, 1.f, 1.f);
float m_FadeDuration = 0.f;
+23
View File
@@ -0,0 +1,23 @@
#ifndef GAME_GUI_ELOADINGFRAMECOMPLETE_H__
#define GAME_GUI_ELOADINGFRAMECOMPLETE_H__
#include "Core/EventBroker.h"
namespace dd
{
namespace GUI { class LoadingFrame; }
namespace Events
{
struct LoadingFrameComplete : Event
{
std::string FrameName;
GUI::LoadingFrame* Frame = nullptr;
};
}
}
#endif
@@ -6,7 +6,7 @@
#include "GUI/NumberFrame.h"
#include "Core/EKeyUp.h"
#include "Game/EScoreEvent.h"
#include "Game/FPSCounter.h"
#include "Game/GUI/FPSCounter.h"
#include "Game/EGameOver.h"
#include "Game/EClusterClear.h"
#include "Game/EKrakenAttack.h"
+73
View File
@@ -0,0 +1,73 @@
#ifndef GAME_GUI_LOADINGFRAME_H__
#define GAME_GUI_LOADINGFRAME_H__
#include "GUI/TextureFrame.h"
#include "GUI/Slider.h"
#include "Core/ResourceManager.h"
#include "Game/GUI/ELoadingFrameComplete.h"
namespace dd
{
namespace GUI
{
class LoadingFrame : public TextureFrame
{
public:
LoadingFrame(Frame* parent, std::string name)
: TextureFrame(parent, name)
{
m_Slider = new GUI::Slider(this, "LoadingFrameSlider");
//m_SFXSlider->X = 0;
m_Slider->Y = 453;
//m_SFXSlider->SetTop(m_TitleSFX->Bottom() + 10);
m_Slider->SetTexture("Textures/GUI/Menu/SliderBackground.png");
m_Slider->SetTextureReleased("Textures/GUI/Menu/SliderHandle.png");
m_Slider->AlignVertically();
m_Slider->SetPercentage(1.f);
m_Slider->X = Width / 2.f - m_Slider->Width / 2.f;
}
void AddTexturePreload(std::string resourceName)
{
m_Items.push_back(resourceName);
}
void Preload()
{
m_Preloading = true;
}
void CancelPreload()
{
m_Preloading = false;
m_CurrentItem = 0;
}
void Update(double dt) override
{
if (m_Preloading) {
ResourceManager::Preload<dd::Texture>(m_Items[m_CurrentItem]);
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Items.size());
m_CurrentItem++;
if (m_CurrentItem >= m_Items.size()) {
m_Preloading = false;
dd::Events::LoadingFrameComplete e;
e.FrameName = Name();
e.Frame = this;
EventBroker->Publish(e);
}
}
}
private:
bool m_Preloading = false;
int m_CurrentItem = 0;
std::vector<std::string> m_Items;
GUI::Slider* m_Slider = nullptr;
};
}
}
#endif
@@ -2,8 +2,8 @@
#define GUI_MAINMENU_H__
#include "GUI/TextureFrame.h"
#include "Game/MainMenuMain.h"
#include "Game/MainMenuOptions.h"
#include "Game/GUI/MainMenuMain.h"
#include "Game/GUI/MainMenuOptions.h"
#include "Core/EKeyUp.h"
namespace dd
@@ -3,8 +3,7 @@
#include "GUI/TextureFrame.h"
#include "GUI/Button.h"
#include "Game/EGameStart.h"
#include "Game/HUD.h"
#include "Game/GUI/Story1.h"
namespace dd
{
@@ -57,10 +56,8 @@ private:
virtual bool OnButtonRelease(const Events::ButtonRelease& event)
{
if (event.Button == m_SquidoutButton) {
Events::GameStart e;
EventBroker->Publish(e);
m_Parent->Hide();
auto hud = new GUI::HUD(BaseFrame, "HUD");
auto story = new GUI::Story1(BaseFrame, "Story1");
}
return true;
+247
View File
@@ -0,0 +1,247 @@
#ifndef GAME_GUI_STORY1_H__
#define GAME_GUI_STORY1_H__
#include "Core/ResourceManager.h"
#include "Game/GUI/StoryboardFrame.h"
#include "Game/GUI/ELoadingFrameComplete.h"
#include "Game/GUI/LoadingFrame.h"
#include "Game/EGameStart.h"
#include "Core/EKeyDown.h"
#include "Game/GUI/HUD.h"
namespace dd
{
namespace GUI
{
class Story1 : public StoryboardFrame
{
public:
Story1(Frame* parent, std::string name)
: StoryboardFrame(parent, name)
{
EVENT_SUBSCRIBE_MEMBER(m_ELoadingFrameComplete, &Story1::OnLoadingFrameComplete);
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Story1::OnKeyDown);
m_LoadingFrame = new GUI::LoadingFrame(this, "Story1LoadingFrame");
m_LoadingFrame->SetTexture("Textures/GUI/Loading.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn1.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn2.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn3.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn4.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/Brunn5.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene1.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene2.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene3.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene4.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene5.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene6.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene7.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene8.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene9.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene10.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene11.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene12.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene13.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene14.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene15.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene16.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene17.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene18.png");
m_LoadingFrame->AddTexturePreload("Textures/Story/SubScene19.png");
m_LoadingFrame->Preload();
m_Spacebar = new TextureFrame(this, "ZZZSpacebar");
m_Spacebar->SetTexture("Textures/GUI/SpacebarSkip.png");
m_Spacebar->SetRight(Right() - 10);
m_Spacebar->SetBottom(Bottom() - 10);
m_Spacebar->DisableScissor();
Transition t;
/*
Sid in the well scene
*/
t.Time = t.Time + 0;
t.Duration = 0;
t.Texture = "Textures/Story/Brunn1.png";
t.Viewport = Rectangle(3108, 11276, 1376, 2203);
AddTransition(t);
t.Time = t.Time + 2;
t.Duration = 0.5;
t.Texture = "Textures/Story/Brunn2.png";
AddTransition(t);
t.Time = t.Time + 3;
t.Duration = 0.5;
t.Texture = "Textures/Story/Brunn3.png";
AddTransition(t);
t.Time = t.Time + 3;
t.Duration = 4;
t.Texture = "Textures/Story/Brunn4.png";
t.Viewport = Rectangle(2232, 0, 2952, 4725);
AddTransition(t);
t.Time = t.Time + 5;
t.Duration = 0;
t.Texture = "Textures/Story/Brunn5.png";
AddTransition(t);
/*
Submarine scene
*/
t.Time = t.Time + 4;
t.Duration = 2.5;
t.Texture = "Textures/Story/SubScene1.png";
t.Viewport = Rectangle(976, 0, 1615, 2586);
AddTransition(t);
// I'm Tom and stuff!
t.Time = t.Time + 1;
t.Duration = 0.5;
t.Texture = "Textures/Story/SubScene2.png";
AddTransition(t);
// Pan to the right here
t.Time = t.Time + 3.5;
t.Duration = 2;
t.Texture = "Textures/Story/SubScene3.png";
t.Viewport = Rectangle(1574, 0, 1615, 2586);
AddTransition(t);
// ZAP!
t.Time = t.Time + 2.5;
t.Duration = 0.5;
t.Texture = "Textures/Story/SubScene4.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene5.png";
AddTransition(t);
t.Time = t.Time + 0.1;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene6.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene7.png";
AddTransition(t);
// BZZT!
t.Time = t.Time + 1;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene8.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene9.png";
AddTransition(t);
t.Time = t.Time + 0.1;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene10.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene11.png";
AddTransition(t);
t.Time = t.Time + 1;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene12.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene13.png";
AddTransition(t);
t.Time = t.Time + 0.2;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene14.png";
AddTransition(t);
t.Time = t.Time + 0.5;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene15.png";
AddTransition(t);
t.Time = t.Time + 1;
t.Duration = 0.5;
t.Texture = "Textures/Story/SubScene16.png";
AddTransition(t);
t.Time = t.Time + 3.5;
t.Duration = 0.5;
t.Texture = "Textures/Story/SubScene17.png";
AddTransition(t);
t.Time = t.Time + 3;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene18.png";
AddTransition(t);
t.Time = t.Time + 2;
t.Duration = 0;
t.Texture = "Textures/Story/SubScene19.png";
AddTransition(t);
}
void Update(double dt) override
{
StoryboardFrame::Update(dt);
if (m_Spacebar == nullptr) {
}
}
void OnComplete() override
{
m_Spacebar->Show();
}
private:
GUI::LoadingFrame* m_LoadingFrame = nullptr;
TextureFrame* m_Spacebar = nullptr;
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
bool OnKeyDown(const Events::KeyDown& event)
{
if (Hidden()) {
return false;
}
if (event.KeyCode == GLFW_KEY_SPACE) {
m_LoadingFrame->CancelPreload();
Events::GameStart e;
EventBroker->Publish(e);
Hide();
auto hud = new GUI::HUD(BaseFrame, "HUD");
}
return true;
}
EventRelay<Frame, Events::LoadingFrameComplete> m_ELoadingFrameComplete;
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
{
if (event.FrameName == "Story1LoadingFrame") {
event.Frame->Hide();
m_Spacebar->Hide();
Play();
}
return true;
}
};
}
}
#endif
+128
View File
@@ -0,0 +1,128 @@
#ifndef GAME_GUI_STORYBOARDFRAME_H__
#define GAME_GUI_STORYBOARDFRAME_H__
#include "GUI/TextureFrame.h"
namespace dd
{
namespace GUI
{
class StoryboardFrame : public TextureFrame
{
public:
struct Transition
{
double Time = 0.0;
double Duration = 0.0;
Rectangle Viewport;
std::string Texture;
};
StoryboardFrame(Frame* parent, std::string name)
: TextureFrame(parent, name)
{
m_TextureFrame = new TextureFrame(this, "StoryboardFrameHelper");
//m_TextureFrame->DisableScissor();
}
void AddTransition(Transition& transition)
{
m_Timeline.push_back(transition);
}
void Play()
{
m_Playing = true;
}
void Skip()
{
m_Playing = false;
OnComplete();
}
void Update(double dt)
{
if (Hidden()) {
return;
}
if (m_Playing) {
m_Time += dt;
if (m_NextIndex < m_Timeline.size()) {
if (m_Time >= m_Timeline.at(m_NextIndex).Time) {
m_CurrentIndex = m_NextIndex;
Transition& t = m_Timeline.at(m_CurrentIndex);
m_TextureFrame->FadeToTexture(t.Texture, t.Duration);
//m_TextureFrame->SetTexture(t.Texture);
m_TextureFrame->SizeToTexture();
if (m_StartRect == Rectangle()) {
m_StartRect = Rectangle(0, 0, m_TextureFrame->Width, m_TextureFrame->Height);
}
else {
m_StartRect = m_TargetRect;
}
double wScaleParent = Width / (double)m_TextureFrame->Width;
double wScale = m_TextureFrame->Width / (double)t.Viewport.Width;
LOG_DEBUG("wScale: %f", wScale);
double hScaleParent = Height / (double)m_TextureFrame->Height;
double hScale = m_TextureFrame->Height / (double)t.Viewport.Height;
LOG_DEBUG("hScale: %f", hScale);
m_TargetRect.X = -t.Viewport.X * wScale * wScaleParent;
m_TargetRect.Y = -t.Viewport.Y * hScale * hScaleParent;
m_TargetRect.Width = m_TextureFrame->Width * wScale * wScaleParent;
m_TargetRect.Height = m_TextureFrame->Height * hScale * hScaleParent;
m_NextIndex++;
}
} else {
OnComplete();
}
}
Transition& t = m_Timeline.at(m_CurrentIndex);
double progress = glm::min((m_Time - t.Time)/t.Duration, 1.0);
m_TextureFrame->X = (int)easeSine(progress, m_StartRect.X, (m_TargetRect.X - m_StartRect.X), 1.0);
m_TextureFrame->Y = (int)easeSine(progress, m_StartRect.Y, (m_TargetRect.Y - m_StartRect.Y), 1.0);
m_TextureFrame->Width = (int)easeSine(progress, m_StartRect.Width, (m_TargetRect.Width - m_StartRect.Width), 1.0);
m_TextureFrame->Height = (int)easeSine(progress, m_StartRect.Height, (m_TargetRect.Height - m_StartRect.Height), 1.0);
}
virtual void OnComplete() { }
protected:
TextureFrame* m_TextureFrame = nullptr;
private:
bool m_Playing = false;
double m_Time = 0;
int m_CurrentIndex = 0;
int m_NextIndex = 0;
std::vector<Transition> m_Timeline;
Rectangle m_StartRect;
Rectangle m_TargetRect;
double easeSine(double t, double b, double c, double d)
{
return -c / 2 * (glm::cos(glm::pi<double>()*t / d) - 1) + b;
}
float easeExpo(float t,float b , float c, float d) {
if (t == 0) return b;
if (t == d) return b + c;
if ((t /= d / 2) < 1) return c / 2 * pow(2, 10 * (t - 1)) + b;
return c / 2 * (-pow(2, -10 * --t) + 2) + b;
}
};
}
}
#endif
+8 -1
View File
@@ -70,6 +70,11 @@ file(GLOB SOURCE_FILES_Game
"Game/*.cpp"
)
source_group(Game FILES ${SOURCE_FILES_Game})
file(GLOB SOURCE_FILES_Game_GUI
"${INCLUDE_PATH}/Game/GUI/*.h"
"Game/GUI/*.cpp"
)
source_group(Game\\GUI FILES ${SOURCE_FILES_Game_GUI})
file(GLOB SOURCE_FILES_Sound
"${INCLUDE_PATH}/Sound/*.h"
@@ -91,8 +96,10 @@ set(SOURCE_FILES
${SOURCE_FILES_Transform}
${SOURCE_FILES_Physics}
${SOURCE_FILES_Game}
${SOURCE_FILES_Game_GUI}
${SOURCE_FILES_Sound}
${SOURCE_FILES_GUI})
${SOURCE_FILES_GUI}
)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+1
View File
@@ -665,6 +665,7 @@ void dd::Renderer::DrawGUI(dd::RenderQueue& rq)
glUniformMatrix4fv(glGetUniformLocation(*m_SpScreen, "MVP"), 1, GL_FALSE, glm::value_ptr(MVP));
glUniformMatrix4fv(glGetUniformLocation(*m_SpScreen, "M"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
glUniformMatrix4fv(glGetUniformLocation(*m_SpScreen, "V"), 1, GL_FALSE, glm::value_ptr(viewMatrix));
glUniform4fv(glGetUniformLocation(*m_SpScreen, "Color"), 1, glm::value_ptr(frameJob->Color));
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, frameJob->DiffuseTexture);
+3 -1
View File
@@ -20,11 +20,13 @@
layout (binding=0) uniform sampler2D DiffuseTexture;
uniform vec4 Color;
in vec2 TextureCoord;
out vec4 FragmentColor;
void main()
{
FragmentColor = texture(DiffuseTexture, TextureCoord);
FragmentColor = texture(DiffuseTexture, TextureCoord) * Color;
}
+95 -60
View File
@@ -212,7 +212,7 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
model->ModelFile = "Models/Brick/StickyBrick.obj";
} else if (typeInt == InkBlasterBrick) {
cBrick->Type = InkBlasterBrick;
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, .0f);
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
} else if (typeInt == KrakenAttackBrick) {
cBrick->Type = KrakenAttackBrick;
model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f);
@@ -285,6 +285,7 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
auto transformComponentBrick = m_World->GetComponent<Components::Transform>(entityBrick);
auto transformComponentShot = m_World->GetComponent<Components::Transform>(entityShot);
auto brickModel = m_World->GetComponent<Components::Model>(entityBrick);
Events::SetImpulse e;
e.Entity = entityBrick;
@@ -303,6 +304,22 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
EventBroker->Publish(es);
m_World->RemoveEntity(entityShot);
Events::CreateParticleSequence ep;
ep.parent = entityBrick;
ep.EmitterLifeTime = 1.f;
ep.ParticleLifeTime = 1.5f;
ep.ParticlesPerTick = 1;
ep.SpawnRate = 0.2;
ep.EmittingAngle = glm::half_pi<float>();
ep.Spread = 1.5f;
ep.Position = transformComponentBrick->Position;
ep.Radius = 0.05;
ep.SpriteFile = "Textures/Particles/FadeBall.png";
ep.Color = brickModel->Color + glm::vec4(0.3f);
ep.Speed = 50;
EventBroker->Publish(ep);
return true;
}
@@ -354,7 +371,7 @@ bool dd::Systems::LevelSystem::OnContact(const dd::Events::Contact &event)
ep.Position = transformComponentBrick->Position;
ep.Radius = 0.05;
ep.SpriteFile = "Textures/Particles/FadeBall.png";
ep.Color = brickModel->Color + glm::vec4(1);
ep.Color = brickModel->Color + glm::vec4(0.3f);
ep.Speed = 50;
EventBroker->Publish(ep);
@@ -479,6 +496,23 @@ void dd::Systems::LevelSystem::GetNextLevel()
glm::vec4 c = glm::vec4(0, 1, 1, 0);
glm::vec4 m = glm::vec4(1, 0, 1, 0);
glm::vec4 d = glm::vec4(0, 0, 0, 0);
//glm::vec4 p4 = glm::vec4(asd.f / 255.f, asd.f / 255.f, sad.f / 255.f, 1.f);
glm::vec4 br = glm::vec4(143.f / 255.f, 98.f / 255.f, 0.f / 255.f, 1.f);
glm::vec4 lb1 = glm::vec4(115.f / 255.f, 232.f / 255.f, 236.f / 255.f, 1.f);
glm::vec4 lb2 = glm::vec4(107.f / 255.f, 214.f / 255.f, 218.f / 255.f, 1.f);
glm::vec4 lb3 = glm::vec4(91.f / 255.f, 183.f / 255.f, 186.f / 255.f, 1.f);
glm::vec4 lb4 = glm::vec4(70.f / 255.f, 153.f / 255.f, 156.f / 255.f, 1.f);
glm::vec4 p1 = glm::vec4(255.f / 255.f, 184.f / 255.f, 254.f / 255.f, 1.f);
glm::vec4 p2 = glm::vec4(255.f / 255.f, 81.f / 255.f, 253.f / 255.f, 1.f);
glm::vec4 p3 = glm::vec4(189.f / 255.f, 0.f / 255.f, 187.f / 255.f, 1.f);
glm::vec4 p4 = glm::vec4(125.f / 255.f, 0.f / 255.f, 147.f / 255.f, 1.f);
if (m_CurrentCluster == 0) {
if (m_CurrentLevel == 1) {
level =
@@ -559,78 +593,79 @@ void dd::Systems::LevelSystem::GetNextLevel()
} else if (m_CurrentCluster == 1) {
if (m_CurrentLevel == 1) {
level =
{1, 1, 0, 1, 0, 1, 1,
{0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 2, 1, 2, 1,
1, 1, 0, 1, 0, 1, 1,
4, 0, 0, 3, 0, 0, 5};
color =
{w, w, w, w, w, w, w,
r, g, b, y, c, m, d,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w};
} else if (m_CurrentLevel == 2) {
level =
{1, 0, 0, 0, 0, 0, 1,
0, 1, 0, 0, 0, 1, 0,
0, 0, 2, 2, 2, 0, 0,
0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 2, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1,
0, 0, 0, 0, 0, 0, 0};
color =
{w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
lb4, lb4, lb4, lb4, lb4, lb4, lb4,
lb3, lb3, lb3, lb3, lb3, lb3, lb3,
lb2, lb2, lb2, lb2, lb2, lb2, lb2,
lb1, lb1, lb1, lb1, lb1, lb1, lb1,
w, w, w, w, w, w, w};
} else if (m_CurrentLevel == 2) {
level =
{0, 0, 1, 0, 1, 0, 0,
0, 1, 0, 1, 0, 1, 0,
0, 0, 1, 1, 1, 0, 0,
0, 0, 0, 3, 0, 0, 0,
1, 1, 1, 0, 1, 1, 1,
1, 0, 0, 0, 0, 0, 1};
color =
{w, w, r, w, r, w, w,
w, w, w, r, w, w, w,
w, w, r, w, r, w, w,
w, w, w, w, w, w, w,
w, r, w, w, w, r, w,
r, w, w, w, w, w, r};
} else if (m_CurrentLevel == 3) {
level =
{2, 0, 0, 0, 0, 0, 2,
0, 1, 0, 0, 0, 1, 0,
1, 2, 1, 1, 1, 2, 1,
1, 0, 1, 1, 1, 0, 1,
1, 0, 1, 1, 1, 0, 1,
1, 0, 1, 1, 1, 0, 1};
{0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 0,
1, 1, 1, 4, 1, 1, 1,
0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 1, 1, 0, 0};
color =
{w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w};
{g, g, g, g, g, g, g,
g, g, g, g, g, g, g,
g, g, g, g, g, g, g,
g, g, g, w, g, g, g,
w, w, w, br, w, w, w,
w, w, br, br, br, w, w};
} else if (m_CurrentLevel == 4) {
level =
{1, 2, 1, 1, 1, 2, 1,
1, 0, 1, 1, 1, 0, 1,
1, 2, 1, 1, 1, 2, 1,
1, 0, 1, 1, 1, 0, 1,
1, 0, 0, 0, 0, 0, 1,
0, 1, 1, 0, 1, 1, 0};
{0, 0, 1, 0, 1, 0, 0,
0, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 0,
0, 0, 1, 5, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0};
color =
{w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w};
{w, w, p1, w, p1, w, w,
w, p2, p3, p2, p3, p2, w,
p1, p2, p3, p4, p3, p2, p1,
w, p1, p2, p3, p2, p1, w,
w, w, p1, w, p1, w, w,
w, w, w, p1, w, w, w};
} else if (m_CurrentLevel == 5) {
level =
{1, 0, 1, 0, 1, 0, 1,
{0, 1, 0, 0, 0, 1, 0,
1, 4, 1, 1, 1, 3, 1,
0, 1, 0, 1, 0, 1, 0,
2, 0, 1, 0, 1, 0, 2,
0, 1, 0, 2, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0};
0, 1, 0, 1, 0, 1, 0,
1, 5, 1, 1, 1, 2, 1,
0, 1, 0, 0, 0, 1, 0};
color =
{w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w,
w, w, w, w, w, w, w};
{w, p3, w, w, w, r, w,
p2, w, p1, g, w, w, w,
w, p4, w, g, w, r, w,
w, br, w, g, w, lb1, w,
y, w, y, g, b, w, b,
w, br, w, w, w, lb1, w};
}
} else if (m_CurrentCluster == 3) {
+1 -1
View File
@@ -94,7 +94,7 @@ void dd::Systems::PadSystem::Update(double dt)
Events::KrakenAttack e;
e.ChargeUpdate = m_KrakenCharge;
EventBroker->Publish(e);
std::cout << "Charge: " << m_KrakenCharge << std::endl;
//std::cout << "Charge: " << m_KrakenCharge << std::endl;
return;
}
+1 -1
View File
@@ -713,7 +713,7 @@ bool dd::Systems::PhysicsSystem::OnContact(const dd::Events::Contact &event)
e.Position = glm::vec3(event.IntersectionPoint.x, event.IntersectionPoint.y, -10);
e.Radius = 0.2f;
e.SpriteFile = "Textures/Particles/Cloud_Particle.png";
e.Color = model->Color + glm::vec4(1);
e.Color = model->Color + glm::vec4(0.5f);
e.Speed = 100;
EventBroker->Publish(e);
return true;