Merge branch 'master' into Sound

Conflicts:
	src/game/Game/BallSystem.cpp
This commit is contained in:
Stiffly
2015-10-22 16:45:25 +02:00
53 changed files with 25377 additions and 2249 deletions
+50 -14
View File
@@ -51,10 +51,12 @@
#include "Game/CBrickPart.h"
#include "Game/CWall.h"
#include "Game/CKraken.h"
#include "Game/CNewWaterVolume.h"
#include "Game/CBackground.h"
#include "Game/CTravels.h"
#include "Game/CStickyAim.h"
#include "Game/BallSystem.h"
#include "Game/LifeSystem.h"
#include "Game/HitLagSystem.h"
#include "Game/TravellingSystem.h"
#include "Game/LifebuoySystem.h"
@@ -84,6 +86,8 @@
#include "GUI/Button.h"
#include "Game/GUI/MainMenu.h"
#include "Game/GUI/HUD.h"
#include "Game/GUI/ELoadingFrameComplete.h"
#include "Game/GUI/LoadingFrame.h"
namespace dd
{
@@ -92,9 +96,15 @@ class Engine
{
public:
Engine(int argc, char* argv[]) {
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
Engine(int argc, char* argv[])
{
ResourceManager::RegisterType<Texture>("Texture");
ResourceManager::RegisterType<Model>("Model");
ResourceManager::RegisterType<Sound>("Sound");
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
ResourceManager::LoadPreloadsFromFile();
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
LOG_LEVEL = static_cast<_LOG_LEVEL>(config->GetValue<int>("Debug.LogLevel", 1));
m_EventBroker = std::make_shared<EventBroker>();
@@ -112,15 +122,11 @@ public:
m_FrameStack = new GUI::Frame(m_EventBroker.get());
m_FrameStack->Width = 675;
m_FrameStack->Height = 1080;
if (config->GetValue<bool>("Debug.SkipStory", false)) {
Events::GameStart e;
m_EventBroker->Publish(e);
auto hud = new GUI::HUD(m_FrameStack, "HUD");
}
else {
auto menu = new GUI::MainMenu(m_FrameStack, "MainMenu");
}
m_MainMenu = new GUI::MainMenu(m_FrameStack, "MainMenu");
m_MainMenu->Hide();
m_LoadingFrame = new GUI::LoadingFrame(m_FrameStack, "Loading");
m_LoadingFrame->SetTexture("Textures/GUI/Loading.png");
PreloadAllTheShit();
m_InputManager = std::make_shared<InputManager>(m_Renderer->Window(), m_EventBroker);
@@ -148,6 +154,7 @@ public:
m_World->ComponentFactory.Register<Components::BrickPart>();
m_World->ComponentFactory.Register<Components::Pad>();
m_World->ComponentFactory.Register<Components::Wall>();
m_World->ComponentFactory.Register<Components::NewWaterVolume>();
m_World->ComponentFactory.Register<Components::Background>();
m_World->ComponentFactory.Register<Components::Life>();
m_World->ComponentFactory.Register<Components::Lifebuoy>();
@@ -199,6 +206,9 @@ public:
m_World->SystemFactory.Register<Systems::WaterSystem>(
[this]() { return new Systems::WaterSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::WaterSystem>();
m_World->SystemFactory.Register<Systems::LifeSystem>(
[this]() { return new Systems::LifeSystem(m_World.get(), m_EventBroker); });
m_World->AddSystem<Systems::LifeSystem>();
m_World->ComponentFactory.Register<Components::Model>();
m_World->ComponentFactory.Register<Components::Template>();
@@ -210,15 +220,28 @@ public:
//auto particleEmitter= m_World->AddComponent<Components::Emitter>(Pe);
//EVENT_SUBSCRIBE_MEMBER(m_EGameStart, &Engine::OnGameStart);
m_EGameStart = decltype(m_EGameStart)(std::bind(&Engine::OnGameStart, this, std::placeholders::_1));
m_EventBroker->Subscribe(m_EGameStart);
m_ELoadingFrameComplete = decltype(m_ELoadingFrameComplete)(std::bind(&Engine::OnLoadingFrameComplete, this, std::placeholders::_1));
m_EventBroker->Subscribe(m_ELoadingFrameComplete);
m_LastTime = glfwGetTime();
}
void PreloadAllTheShit()
{
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Debug.SkipPreload", false)) {
m_LoadingFrame->Hide();
m_MainMenu->Show();
return;
}
for (auto& pair : ResourceManager::GetPreloads()) {
m_LoadingFrame->AddResource(pair.first, pair.second);
}
m_LoadingFrame->Preload();
}
bool Running() const { return !glfwWindowShouldClose(m_Renderer->Window()); }
void Tick()
@@ -418,6 +441,8 @@ public:
private:
std::shared_ptr<EventBroker> m_EventBroker;
GUI::Frame* m_FrameStack = nullptr;
GUI::MainMenu* m_MainMenu = nullptr;
GUI::LoadingFrame* m_LoadingFrame = nullptr;
std::shared_ptr<Renderer> m_Renderer;
RenderQueueCollection m_RendererQueue;
std::shared_ptr<InputManager> m_InputManager;
@@ -447,6 +472,17 @@ private:
return true;
};
EventRelay<Engine, Events::LoadingFrameComplete> m_ELoadingFrameComplete;
bool OnLoadingFrameComplete(const Events::LoadingFrameComplete& event)
{
if (event.FrameName == "Loading") {
event.Frame->Hide();
m_MainMenu->Show();
}
return true;
}
double m_LastTime;
};
+25 -82
View File
@@ -22,7 +22,9 @@
#include <string>
#include <functional>
#include <vector>
#include <set>
#include <unordered_map>
#include <fstream>
#include "Util/UnorderedMapPair.h"
#include "Util/Factory.h"
@@ -70,13 +72,8 @@ public:
return s;
}*/
/** Registers the factory function of a resource type
@tparam T Resource type.
@param factoryFunction Lambda function that creates a new instance of the resource.
*/
template <typename T>
static void RegisterType(std::function<Resource*(std::string)> factoryFunction);
static void RegisterType(std::string typeName);
/** Preloads a resource and caches it for future use
@@ -85,6 +82,7 @@ public:
*/
template <typename T>
static void Preload(std::string resourceName);
static void Preload(std::string resourceType, std::string resourceName);
/** Checks if a resource is in cache
@@ -101,14 +99,7 @@ public:
*/
template <typename T>
static T* Load(std::string resourceName, Resource* parent = nullptr);
/** Fetches a loaded resource
@tparam T Resource type.
@param resourceName Fully qualified name of the resource to fetch.
*/
template <typename T>
static T* Fetch(std::string resourceName);
static Resource* Load(std::string resourceType, std::string resourceName, Resource* parent = nullptr);
/** Reloads an already loaded resource, keeping its resource ID intact.
@@ -116,14 +107,19 @@ public:
@param resourceName Fully qualified name of the resource to reload.
*/
static void Reload(std::string resourceName);
static void LoadPreloadsFromFile();
static const std::set<std::pair<std::string, std::string>>& GetPreloads() { return m_Preloads; }
static void Update();
private:
static std::unordered_map<std::string, std::string> m_CompilerTypenameToResourceType;
static std::unordered_map<std::string, std::function<Resource*(std::string)>> m_FactoryFunctions; // type -> factory function
static std::unordered_map<std::pair<std::string, std::string>, Resource*> m_ResourceCache; // (type, name) -> resource
static std::unordered_map<std::string, Resource*> m_ResourceFromName; // name -> resource
static std::unordered_map<Resource*, Resource*> m_ResourceParents; // resource -> parent resource
static std::set<std::pair<std::string, std::string>> m_Preloads; // (type, name)
// TODO: Getters for IDs
static unsigned int m_CurrentResourceTypeID;
@@ -140,93 +136,40 @@ private:
static unsigned int GetNewResourceID(unsigned int typeID);
// Internal: Create a resource and cache it
template <typename T>
static T* CreateResource(std::string resourceName, Resource* parent);
static Resource* CreateResource(std::string resourceType, std::string resourceName, Resource* parent);
};
template <typename T>
T* ResourceManager::Load(std::string resourceName, Resource* parent /* = nullptr */)
{
auto resourceType = typeid(T).name();
auto it = m_ResourceCache.find(std::make_pair(resourceType, resourceName));
if (it != m_ResourceCache.end())
return static_cast<T*>(it->second);
if (m_Preloading) {
LOG_INFO("Preloading resource \"%s\"", resourceName.c_str());
} else {
LOG_WARNING("Hot-loading resource \"%s\"", resourceName.c_str());
}
return CreateResource<T>(resourceName, parent);
}
template <typename T>
T* ResourceManager::Fetch(std::string resourceName)
{
auto resourceType = typeid(T).name();
auto it = m_ResourceCache.find(std::make_pair(resourceType, resourceName));
if (it == m_ResourceCache.end())
{
LOG_ERROR("Failed to fetch resource \"%s\": Resource not loaded!", resourceName.c_str());
auto resourceTypename = typeid(T).name();
auto it = m_CompilerTypenameToResourceType.find(resourceTypename);
if (it == m_CompilerTypenameToResourceType.end()) {
LOG_ERROR("Failed to load resource \"%s\" of type \"%s\": type not registered", resourceName.c_str(), resourceTypename);
return nullptr;
} else
{
return static_cast<T*>(it->second);
}
return static_cast<T*>(Load(it->second, resourceName, parent));
}
template <typename T>
void ResourceManager::RegisterType(std::function<Resource*(std::string)> factoryFunction)
void ResourceManager::RegisterType(std::string typeName)
{
m_FactoryFunctions[typeid(T).name()] = factoryFunction;
m_CompilerTypenameToResourceType[typeid(T).name()] = typeName;
m_FactoryFunctions[typeName] = [](std::string resourceName) { return new T(resourceName); };
}
template <typename T>
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.c_str());
auto resourceTypename = typeid(T).name();
auto it = m_CompilerTypenameToResourceType.find(resourceTypename);
if (it == m_CompilerTypenameToResourceType.end()) {
LOG_ERROR("Failed to load resource \"%s\" of type \"%s\": type not registered", resourceName.c_str(), resourceTypename);
return;
}
m_Preloading = true;
LOG_INFO("Preloading resource \"%s\"", resourceName.c_str());
CreateResource<T>(resourceName, nullptr);
m_Preloading = false;
}
template <typename T>
T* ResourceManager::CreateResource(std::string resourceName, Resource* parent)
{
const char* resourceType = typeid(T).name();
/*auto facIt = m_FactoryFunctions.find(resourceType);
if (facIt == m_FactoryFunctions.end())
{
LOG_ERROR("Failed to load resource \"%s\" of type \"%s\": Type not registered", resourceName.c_str(), resourceType);
return nullptr;
}*/
// Call the factory function
T* resource = new T(resourceName);
// Store IDs
resource->TypeID = GetTypeID(resourceType);
resource->ResourceID = GetNewResourceID(resource->TypeID);
// Cache
m_ResourceCache[std::make_pair(resourceType, resourceName)] = resource;
m_ResourceFromName[resourceName] = resource;
if (parent != nullptr)
{
m_ResourceParents[resource] = parent;
}
if (!boost::filesystem::is_directory(resourceName))
{
LOG_DEBUG("Adding watch for %s", resourceName.c_str());
m_FileWatcher.AddWatch(resourceName, fileWatcherCallback);
}
return resource;
Preload(it->second, resourceName);
}
}
+10 -10
View File
@@ -1,6 +1,8 @@
#ifndef DAYDREAM_BALLSYSTEM_H
#define DAYDREAM_BALLSYSTEM_H
#include <random>
#include "Core/System.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
@@ -8,14 +10,17 @@
#include "Core/CTemplate.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include "Physics/CPhysics.h"
#include "Physics/CCircleShape.h"
#include "Physics/CRectangleShape.h"
#include "Physics/EContact.h"
#include "Rendering/CModel.h"
#include "Rendering/CSprite.h"
#include "Rendering/CPointLight.h"
#include "Rendering/CAnimation.h"
#include "Game/CBall.h"
#include "Game/CPowerUp.h"
#include "Game/CLife.h"
@@ -41,6 +46,7 @@
#include "Game/EHitLag.h"
#include "Game/EActionButton.h"
#include "Game/ELifebuoyHit.h"
#include "Physics/ECreateParticleSequence.h"
#include "Sound/CCollisionSound.h"
#include "Sound/EPlaySound.h"
@@ -78,7 +84,6 @@ public:
void OnEntityRemoved(EntityID entity) override;
EntityID CreateBall();
void CreateLife(int);
EntityID Ball() { return m_Ball; };
void SetBall(const EntityID& ball) { m_Ball = ball; }
@@ -90,22 +95,18 @@ public:
void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; }
int& MultiBalls() { return m_MultiBalls; }
void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
bool ReplaceBall() const { return m_ReplaceBall; }
void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; }
bool IsPaused() const { return m_Pause; }
void SetPause(const bool& pause) { m_Pause = pause; }
private:
std::mt19937 m_RandomGenerator;
float m_XMovementMultiplier = 2.f;
float m_EdgeX = 3.4f; //Actually 3.2, but anyways.
float m_EdgeY = 5.2f;
int m_MultiBalls = 0;
int m_Lives = 3;
int m_PastLives = 3;
bool m_ReplaceBall = false;
bool m_Pause = false;
bool m_Waiting = true;
@@ -117,7 +118,8 @@ private:
double m_KrakenCharge = 0;
bool m_Restarting = false;
int m_StickyCounter = 3;
bool m_GodMode = false;
bool m_First = true;
bool m_StageBlockedWaiting = false;
@@ -129,7 +131,6 @@ private:
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::ResetBall> m_EResetBall;
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
@@ -146,7 +147,6 @@ private:
dd::EventRelay<BallSystem, dd::Events::ArrivedAtNewStage> m_EArrivedAtNewStage;
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);
+3 -1
View File
@@ -23,7 +23,9 @@ struct Ball : Component
bool InkBlaster = false;
bool Sticky = false;
glm::vec3 StickyPlacement = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
glm::vec3 SavedSpeed = glm::vec3(0, 1, 0);
int PosterBoy = 0;
};
}
+2
View File
@@ -20,6 +20,8 @@ struct Brick : Component
int Type = 0;
bool Removed = false;
int Number = 100; // For the Kraken to keep track of which bricks needs replacing.
bool BeingGenerated = false;
glm::vec3 GenerationGoal;
//What number of types each is.
const int EmptyBrickSpace = 0;
+2 -1
View File
@@ -15,7 +15,8 @@ namespace Components
struct BrickPart : Component
{
bool Submerged = false;
int NumberOfPartsInBrick;
};
}
+4 -3
View File
@@ -13,10 +13,11 @@ namespace dd
namespace Components
{
struct Life : Component {
struct Life : Component
{
int Number = 0;
float SinusAltitude = 1;
bool Left = false;
};
}
+25
View File
@@ -0,0 +1,25 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef CNEWWATERVOLUME_H
#define CNEWWATERVOLUME_H
#include "Core/Component.h"
namespace dd
{
namespace Components
{
struct NewWaterVolume : public Component
{
};
}
}
#endif //DAYDREAM_NEWWATERVOLUME_H
+6 -10
View File
@@ -5,7 +5,6 @@
#include "GUI/Slider.h"
#include "Core/ResourceManager.h"
#include "Game/GUI/ELoadingFrameComplete.h"
#include "Sound/EPlaySound.h"
namespace dd
{
@@ -29,9 +28,9 @@ public:
m_Slider->X = Width / 2.f - m_Slider->Width / 2.f;
}
void AddTexturePreload(std::string resourceName)
void AddResource(std::string resourceType, std::string resourceName)
{
m_Items.push_back(resourceName);
m_Preload.push_back(std::make_pair(resourceType, resourceName));
}
void Preload()
@@ -48,18 +47,15 @@ public:
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());
ResourceManager::Preload(m_Preload[m_CurrentItem].first, m_Preload[m_CurrentItem].second);
m_Slider->SetPercentage((m_CurrentItem + 1) / (float)m_Preload.size());
m_CurrentItem++;
if (m_CurrentItem >= m_Items.size()) {
if (m_CurrentItem >= m_Preload.size()) {
m_Preloading = false;
dd::Events::LoadingFrameComplete e;
e.FrameName = Name();
e.Frame = this;
EventBroker->Publish(e);
Events::PlaySound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
}
}
}
@@ -67,7 +63,7 @@ public:
private:
bool m_Preloading = false;
int m_CurrentItem = 0;
std::vector<std::string> m_Items;
std::vector<std::pair<std::string, std::string>> m_Preload;
GUI::Slider* m_Slider = nullptr;
};
+14
View File
@@ -2,9 +2,11 @@
#define GUI_MAINMENU_H__
#include "GUI/TextureFrame.h"
#include "Game/GUI/LoadingFrame.h"
#include "Game/GUI/MainMenuMain.h"
#include "Game/GUI/MainMenuOptions.h"
#include "Core/EKeyUp.h"
#include "Game/EGameStart.h"
namespace dd
{
@@ -37,6 +39,18 @@ public:
//EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &MainMenu::OnKeyUp);
}
void Show() override
{
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<bool>("Debug.SkipMenu", false)) {
Events::GameStart e;
EventBroker->Publish(e);
Hide();
auto hud = new GUI::HUD(BaseFrame, "HUD");
} else {
TextureFrame::Show();
}
}
private:
TextureFrame* m_LeftBanner;
MainMenuMain* m_MainMenuMain;
+1
View File
@@ -58,6 +58,7 @@ private:
if (event.Button == m_SquidoutButton) {
m_Parent->Hide();
auto story = new GUI::Story1(BaseFrame, "Story1");
story->Play();
}
return true;
+13 -43
View File
@@ -3,11 +3,11 @@
#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"
#include "Sound/EPlaySound.h"
#include "Sound/EStopSound.h"
namespace dd
{
@@ -20,37 +20,8 @@ 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);
@@ -196,6 +167,14 @@ public:
AddTransition(t);
}
virtual void Play() override
{
StoryboardFrame::Play();
Events::PlaySound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
}
void Update(double dt) override
{
StoryboardFrame::Update(dt);
@@ -209,7 +188,6 @@ public:
}
private:
GUI::LoadingFrame* m_LoadingFrame = nullptr;
TextureFrame* m_Spacebar = nullptr;
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
@@ -220,25 +198,17 @@ private:
}
if (event.KeyCode == GLFW_KEY_SPACE) {
m_LoadingFrame->CancelPreload();
Events::GameStart e;
EventBroker->Publish(e);
Events::StopSound se;
se.FilePath = "Sounds/jap-story.wav";
EventBroker->Publish(se);
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;
}
};
}
+2 -2
View File
@@ -33,12 +33,12 @@ public:
m_Timeline.push_back(transition);
}
void Play()
virtual void Play()
{
m_Playing = true;
}
void Skip()
virtual void Skip()
{
m_Playing = false;
OnComplete();
+2
View File
@@ -33,6 +33,8 @@
#include "Game/CBall.h"
#include "Game/CProjectile.h"
#include "Sound/CCollisionSound.h"
#include "Rendering/CAnimation.h"
#include "Rendering/CSprite.h"
//#include "Core/Camera.h" Camera Component
+1 -1
View File
@@ -212,7 +212,7 @@ private:
void GetNextLevel();
void SetBrokenModel(EntityID entity);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox);
void CreateBrokenModelPart(EntityID Parent, std::string ModelPath, glm::vec3 RelativePosition, glm::vec2 Hitbox, int NumberOfParts);
};
}
+78
View File
@@ -0,0 +1,78 @@
//
// Created by Adniklastrator on 2015-10-22.
//
#ifndef DAYDREAM_LIFESYSTEM_H
#define DAYDREAM_LIFESYSTEM_H
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Rendering/CModel.h"
#include "Game/CLife.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ELifeLost.h"
#include "Game/EGameOver.h"
#include "Game/EKrakenAttackEnd.h"
#include "Rendering/CAnimation.h"
namespace dd
{
namespace Systems
{
class LifeSystem : public System
{
public:
LifeSystem(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; }
int& Lives() { return m_Lives; }
void SetLives(const int& lives) { m_Lives = lives; }
int& PastLives() { return m_PastLives; }
void SetPastLives(const int& pastLives) { m_PastLives = pastLives; }
private:
bool m_Pause = false;
int m_Lives = 3;
int m_PastLives = 3;
float m_LifeSpeed = 0.8;
bool m_GodMode = false;
void CreateLife(int);
dd::EventRelay<LifeSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<LifeSystem, dd::Events::Resume> m_EResume;
dd::EventRelay<LifeSystem, dd::Events::LifeLost> m_ELifeLost;
bool OnPause(const dd::Events::Pause &event);
bool OnResume(const dd::Events::Resume &event);
bool OnLifeLost(const dd::Events::LifeLost &event);
};
}
}
#endif //DAYDREAM_LIFESYSTEM_H
+5 -1
View File
@@ -105,7 +105,11 @@ private:
double m_KrakenStrength = 0;
double m_PlayerStrength = 0;
float m_Edge = 2.8f;
EntityID m_KrakenArm;
float m_PadOriginalHeight = -4.8;
float m_PadHeight = m_PadOriginalHeight;
EntityID m_KrakenArm = NULL;
EntityID m_KrakenArmHitbox = NULL;
float m_PadRiseSpeed = 0.2;
Components::Transform* m_Transform = nullptr;
Components::Pad* m_Pad = nullptr;
std::shared_ptr<Components::Transform> m_StickTransform;
+4 -2
View File
@@ -5,6 +5,10 @@
#ifndef DAYDREAM_PROJECTILESYSTEM_H
#define DAYDREAM_PROJECTILESYSTEM_H
#include <fstream>
#include <iostream>
#include "Core/System.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
@@ -26,8 +30,6 @@
#include "Game/CProjectile.h"
#include "Game/CBall.h"
#include "Rendering/CSprite.h"
#include <fstream>
#include <iostream>
namespace dd
{
+1
View File
@@ -18,6 +18,7 @@
#include "Game/EStageCleared.h"
#include "Game/CTravels.h"
#include "Game/CBackground.h"
#include "Game/CNewWaterVolume.h"
namespace dd
+11
View File
@@ -11,9 +11,13 @@
#include "Core/CTemplate.h"
#include "Core/EventBroker.h"
#include "Core/World.h"
#include "Core/ConfigFile.h"
#include "Transform/EMove.h"
#include "Physics/CPhysics.h"
#include "Physics/CWaterVolume.h"
#include "Physics/CRectangleShape.h"
#include "Game/CBrickPart.h"
#include "Game/CNewWaterVolume.h"
#include "Game/EPause.h"
#include "Game/EResume.h"
#include "Game/ERelevantObjectCreated.h"
@@ -47,6 +51,13 @@ public:
private:
bool m_Pause = false;
EntityID m_BottomWall = 0;
float m_SubmergedOriginalHeight = -4.5;
float m_SubmergedHeight = m_SubmergedOriginalHeight;
bool m_RaiseWater = false;
bool m_RemoveWater = false;
std::array<int, 10> m_BrickPartCounters;
dd::EventRelay<WaterSystem, dd::Events::Pause> m_EPause;
dd::EventRelay<WaterSystem, dd::Events::Resume> m_EResume;
+1 -1
View File
@@ -22,7 +22,7 @@ struct ParticleEmitter : public Component
float Speed = 2.f;
double LifeTime = 100;
float RadiusDistribution = 0;
bool DefaultScale = false;
//values to interpolate between.
std::vector<glm::vec3> ScaleValues;
std::vector<float> AlphaValues;
@@ -26,6 +26,7 @@ struct CreateParticleSequence : public Event
glm::vec4 Color = glm::vec4(0);
EntityID parent = 0;
// values to interpolate between.
bool DefaultScale = false;
std::vector<glm::vec3> ScaleValues;
std::vector<float> AlphaValues;
+1
View File
@@ -14,6 +14,7 @@
#include "Core/CTemplate.h"
#include "Core/CTransform.h"
#include "Core/CTemplate.h"
#include "Rendering/Texture.h"
#include "Physics/EContact.h"
#include "Physics/ESetImpulse.h"