Added first stage story
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 535 KiB |
|
After Width: | Height: | Size: 632 KiB |
|
After Width: | Height: | Size: 563 KiB |
|
After Width: | Height: | Size: 633 KiB |
|
After Width: | Height: | Size: 505 KiB |
|
After Width: | Height: | Size: 633 KiB |
|
After Width: | Height: | Size: 434 KiB |
|
After Width: | Height: | Size: 467 KiB |
|
After Width: | Height: | Size: 456 KiB |
|
After Width: | Height: | Size: 405 KiB |
|
After Width: | Height: | Size: 430 KiB |
|
After Width: | Height: | Size: 599 KiB |
|
After Width: | Height: | Size: 535 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 583 KiB |
|
After Width: | Height: | Size: 710 KiB |
|
After Width: | Height: | Size: 563 KiB |
|
After Width: | Height: | Size: 632 KiB |
|
After Width: | Height: | Size: 591 KiB |
@@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include "GUI/TextureFrame.h"
|
#include "GUI/TextureFrame.h"
|
||||||
#include "GUI/Button.h"
|
#include "GUI/Button.h"
|
||||||
#include "Game/EGameStart.h"
|
#include "Game/GUI/Story1.h"
|
||||||
#include "Game/GUI/HUD.h"
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -57,10 +56,8 @@ private:
|
|||||||
virtual bool OnButtonRelease(const Events::ButtonRelease& event)
|
virtual bool OnButtonRelease(const Events::ButtonRelease& event)
|
||||||
{
|
{
|
||||||
if (event.Button == m_SquidoutButton) {
|
if (event.Button == m_SquidoutButton) {
|
||||||
Events::GameStart e;
|
|
||||||
EventBroker->Publish(e);
|
|
||||||
m_Parent->Hide();
|
m_Parent->Hide();
|
||||||
auto hud = new GUI::HUD(BaseFrame, "HUD");
|
auto story = new GUI::Story1(BaseFrame, "Story1");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include "Game/GUI/StoryboardFrame.h"
|
#include "Game/GUI/StoryboardFrame.h"
|
||||||
#include "Game/GUI/ELoadingFrameComplete.h"
|
#include "Game/GUI/ELoadingFrameComplete.h"
|
||||||
#include "Game/GUI/LoadingFrame.h"
|
#include "Game/GUI/LoadingFrame.h"
|
||||||
|
#include "Game/EGameStart.h"
|
||||||
|
#include "Core/EKeyDown.h"
|
||||||
|
#include "Game/GUI/HUD.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -18,6 +21,41 @@ public:
|
|||||||
: StoryboardFrame(parent, name)
|
: StoryboardFrame(parent, name)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ELoadingFrameComplete, &Story1::OnLoadingFrameComplete);
|
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;
|
Transition t;
|
||||||
|
|
||||||
@@ -157,12 +195,42 @@ public:
|
|||||||
t.Texture = "Textures/Story/SubScene19.png";
|
t.Texture = "Textures/Story/SubScene19.png";
|
||||||
AddTransition(t);
|
AddTransition(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update(double dt) override
|
||||||
|
{
|
||||||
|
StoryboardFrame::Update(dt);
|
||||||
|
|
||||||
|
if (m_Spacebar == nullptr) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OnComplete() override
|
||||||
|
{
|
||||||
|
m_Spacebar->Show();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
GUI::LoadingFrame* m_LoadingFrame = nullptr;
|
||||||
|
TextureFrame* m_Spacebar = nullptr;
|
||||||
|
|
||||||
|
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
|
||||||
|
bool OnKeyDown(const Events::KeyDown& event)
|
||||||
|
{
|
||||||
|
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;
|
EventRelay<Frame, Events::LoadingFrameComplete> m_ELoadingFrameComplete;
|
||||||
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
|
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
|
||||||
{
|
{
|
||||||
if (event.FrameName == "Story1LoadingFrame") {
|
if (event.FrameName == "Story1LoadingFrame") {
|
||||||
event.Frame->Hide();
|
event.Frame->Hide();
|
||||||
|
m_Spacebar->Hide();
|
||||||
Play();
|
Play();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ public:
|
|||||||
StoryboardFrame(Frame* parent, std::string name)
|
StoryboardFrame(Frame* parent, std::string name)
|
||||||
: TextureFrame(parent, name)
|
: TextureFrame(parent, name)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_TextureFrame = new TextureFrame(this, "StoryboardFrameHelper");
|
m_TextureFrame = new TextureFrame(this, "StoryboardFrameHelper");
|
||||||
|
|
||||||
//m_TextureFrame->DisableScissor();
|
//m_TextureFrame->DisableScissor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,44 +35,55 @@ public:
|
|||||||
|
|
||||||
void Play()
|
void Play()
|
||||||
{
|
{
|
||||||
m_Playing = 1;
|
m_Playing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Skip()
|
||||||
|
{
|
||||||
|
m_Playing = false;
|
||||||
|
OnComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update(double dt)
|
void Update(double dt)
|
||||||
{
|
{
|
||||||
if (!m_Playing) {
|
if (Hidden()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Time += (double)m_Playing * dt;
|
if (m_Playing) {
|
||||||
|
m_Time += dt;
|
||||||
|
|
||||||
if (m_NextIndex < m_Timeline.size()) {
|
if (m_NextIndex < m_Timeline.size()) {
|
||||||
if (m_Time >= m_Timeline.at(m_NextIndex).Time) {
|
if (m_Time >= m_Timeline.at(m_NextIndex).Time) {
|
||||||
m_CurrentIndex = m_NextIndex;
|
m_CurrentIndex = m_NextIndex;
|
||||||
Transition& t = m_Timeline.at(m_CurrentIndex);
|
Transition& t = m_Timeline.at(m_CurrentIndex);
|
||||||
|
|
||||||
m_TextureFrame->FadeToTexture(t.Texture, t.Duration);
|
m_TextureFrame->FadeToTexture(t.Texture, t.Duration);
|
||||||
//m_TextureFrame->SetTexture(t.Texture);
|
//m_TextureFrame->SetTexture(t.Texture);
|
||||||
m_TextureFrame->SizeToTexture();
|
m_TextureFrame->SizeToTexture();
|
||||||
|
|
||||||
if (m_StartRect == Rectangle()) {
|
if (m_StartRect == Rectangle()) {
|
||||||
m_StartRect = Rectangle(0, 0, m_TextureFrame->Width, m_TextureFrame->Height);
|
m_StartRect = Rectangle(0, 0, m_TextureFrame->Width, m_TextureFrame->Height);
|
||||||
} else {
|
}
|
||||||
m_StartRect = m_TargetRect;
|
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 {
|
||||||
double wScaleParent = Width / (double)m_TextureFrame->Width;
|
OnComplete();
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +95,13 @@ public:
|
|||||||
m_TextureFrame->Height = (int)easeSine(progress, m_StartRect.Height, (m_TargetRect.Height - m_StartRect.Height), 1.0);
|
m_TextureFrame->Height = (int)easeSine(progress, m_StartRect.Height, (m_TargetRect.Height - m_StartRect.Height), 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
virtual void OnComplete() { }
|
||||||
int m_Playing = 0;
|
|
||||||
|
protected:
|
||||||
|
TextureFrame* m_TextureFrame = nullptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Playing = false;
|
||||||
double m_Time = 0;
|
double m_Time = 0;
|
||||||
int m_CurrentIndex = 0;
|
int m_CurrentIndex = 0;
|
||||||
int m_NextIndex = 0;
|
int m_NextIndex = 0;
|
||||||
@@ -91,8 +109,6 @@ public:
|
|||||||
Rectangle m_StartRect;
|
Rectangle m_StartRect;
|
||||||
Rectangle m_TargetRect;
|
Rectangle m_TargetRect;
|
||||||
|
|
||||||
TextureFrame* m_TextureFrame = nullptr;
|
|
||||||
|
|
||||||
double easeSine(double t, double b, double c, double d)
|
double easeSine(double t, double b, double c, double d)
|
||||||
{
|
{
|
||||||
return -c / 2 * (glm::cos(glm::pi<double>()*t / d) - 1) + b;
|
return -c / 2 * (glm::cos(glm::pi<double>()*t / d) - 1) + b;
|
||||||
|
|||||||