diff --git a/include/Game/Systems/MainMenuSystem.h b/include/Game/Systems/MainMenuSystem.h index 7a51f4f0..2e85df97 100644 --- a/include/Game/Systems/MainMenuSystem.h +++ b/include/Game/Systems/MainMenuSystem.h @@ -24,6 +24,7 @@ public: private: IRenderer* m_Renderer; void OpenSubMenu(const Events::InputCommand& e); + void OpenDropDown(const Events::InputCommand& e); EventRelay m_EClicked; bool OnButtonClick(const Events::ButtonClicked& e); @@ -36,6 +37,7 @@ private: std::string m_CurrentCommand = ""; EntityWrapper m_OpenSubMenu = EntityWrapper::Invalid; + EntityWrapper m_DropDown = EntityWrapper::Invalid; }; diff --git a/resources/Schema/Entities/OptionMenu.xml b/resources/Schema/Entities/OptionMenu.xml index 600dc49b..b7be623d 100644 --- a/resources/Schema/Entities/OptionMenu.xml +++ b/resources/Schema/Entities/OptionMenu.xml @@ -37,6 +37,7 @@ Models/Core/UnitQuad.mesh Textures/Core/White.png + false @@ -72,121 +73,66 @@ - + - - - 1920 - 1080 - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - true - - - - + - + - - 1920x1080 - Fonts/DroidSans.ttf,64 - - - - - + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + + + + Resolution + 1 + - - + + + + + + + + + + Resolution + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + - + - - - 1366 - 768 - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - true - - - - - + + Schema/Entities/Resolution_Options.xml + + - - - - - 1366x768 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - - - - - - - 1280 - 720 - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - true - - - - - - - - - - - - 1280x720 - Fonts/DroidSans.ttf,64 - - - - - - - - - - - - - + diff --git a/resources/Schema/Entities/Resolution_Options b/resources/Schema/Entities/Resolution_Options new file mode 100644 index 00000000..293bee0a --- /dev/null +++ b/resources/Schema/Entities/Resolution_Options @@ -0,0 +1,128 @@ + + + + + + + + + + + + + 1920 + 1080 + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1920x1080 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + 1366 + 768 + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1366x768 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + 1280 + 720 + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1280x720 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/Resolution_Options.xml b/resources/Schema/Entities/Resolution_Options.xml new file mode 100644 index 00000000..3aaa32e5 --- /dev/null +++ b/resources/Schema/Entities/Resolution_Options.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + + + + + + + + + + + + + + 1920 + 1080 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1920x1080 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + 1366 + 768 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1366x768 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + 1280 + 720 + + + false + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + 1280x720 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/ServerIdentity.xml b/resources/Schema/Entities/ServerIdentity.xml index 3c47e045..1a24fb8a 100644 --- a/resources/Schema/Entities/ServerIdentity.xml +++ b/resources/Schema/Entities/ServerIdentity.xml @@ -17,7 +17,6 @@ 123.123.123.123 Fonts/DroidSans.ttf,64 - @@ -28,7 +27,7 @@ IP - + @@ -39,7 +38,6 @@ 65999 Fonts/DroidSans.ttf,64 - @@ -50,7 +48,7 @@ Port - + @@ -61,7 +59,6 @@ UnkownServer Fonts/DroidSans.ttf,64 - @@ -72,7 +69,7 @@ ServerName - + @@ -82,7 +79,6 @@ 0 Fonts/DroidSans.ttf,64 - @@ -93,7 +89,7 @@ PlayersConnected - + @@ -102,14 +98,15 @@ + false + Models/Core/UnitQuad.mesh + Textures/Core/White.png true - - false - + - + @@ -117,6 +114,75 @@ + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + diff --git a/resources/Schema/Entities/ServerList.xml b/resources/Schema/Entities/ServerList.xml index 79f50c09..aa8f787b 100644 --- a/resources/Schema/Entities/ServerList.xml +++ b/resources/Schema/Entities/ServerList.xml @@ -30,21 +30,6 @@ - - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - true - - - - - - - - @@ -87,20 +72,6 @@ - - - - Models/Core/UnitQuad.mesh - - Textures/Core/White.png - - - - - - - - @@ -117,6 +88,112 @@ + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + false + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/Core/White.png + true + + + + + + + + + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + + + + Models/Core/UnitQuad.mesh + + Textures/HUD/ButtonCorner_16.png + false + + + + + + + + + diff --git a/src/Engine/Rendering/BlurHUD.cpp b/src/Engine/Rendering/BlurHUD.cpp index 35327764..58a61fd4 100644 --- a/src/Engine/Rendering/BlurHUD.cpp +++ b/src/Engine/Rendering/BlurHUD.cpp @@ -119,6 +119,21 @@ GLuint BlurHUD::Draw(GLuint texture, RenderScene& scene) { GLERROR("DrawBloomPass::Draw: Pre"); + bool shouldRun = false; + for (auto& job : scene.Jobs.SpriteJob) { + auto spriteJob = std::dynamic_pointer_cast(job); + if (!spriteJob) { + continue; + } + if (!spriteJob->BlurBackground) { + continue; + } + shouldRun = true; + break; + } + if(!shouldRun) { + return m_BlackTexture->m_Texture; + } FillStencil(scene); RenderState state; @@ -226,6 +241,7 @@ void BlurHUD::FillStencil(RenderScene& scene) GLuint shaderHandle = m_FillDepthStencilProgram->GetHandle(); glm::mat4 VP = scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix(); + for (auto& job : scene.Jobs.SpriteJob) { auto spriteJob = std::dynamic_pointer_cast(job); if (!spriteJob) { diff --git a/src/Game/Systems/MainMenuSystem.cpp b/src/Game/Systems/MainMenuSystem.cpp index ff2e2981..fa7c0479 100644 --- a/src/Game/Systems/MainMenuSystem.cpp +++ b/src/Game/Systems/MainMenuSystem.cpp @@ -27,13 +27,15 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e) //No submenu is open, open one. for (auto& menu : *menus) { EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID); - auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner"); - if (!serverListSpawner.HasComponent("Spawner")) { + auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner"); + if (!spawner.HasComponent("Spawner")) { return; } - m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner); - Events::SearchForServers event; - m_EventBroker->Publish(event); + m_OpenSubMenu = SpawnerSystem::Spawn(spawner, spawner); + if (e.Command == "Play") { + Events::SearchForServers event; + m_EventBroker->Publish(event); + } break; } @@ -41,22 +43,53 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e) //Menu is open, but not the right one, delete the old one and open a new one. m_World->DeleteEntity(m_OpenSubMenu.ID); m_OpenSubMenu = EntityWrapper::Invalid; + m_World->DeleteEntity(m_DropDown.ID); + m_DropDown = EntityWrapper::Invalid; for (auto& menu : *menus) { EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID); - auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner"); - if (!serverListSpawner.HasComponent("Spawner")) { + auto Spawner = menuEntity.FirstChildByName(e.Command + "Spawner"); + if (!Spawner.HasComponent("Spawner")) { return; } - m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner); - Events::SearchForServers event; - m_EventBroker->Publish(event); + m_OpenSubMenu = SpawnerSystem::Spawn(Spawner, Spawner); + if(e.Command == "Play") { + Events::SearchForServers event; + m_EventBroker->Publish(event); + } break; } } else { - //Serverlist submenu is open, close it. + //wanted submenu is open, close it. m_World->DeleteEntity(m_OpenSubMenu.ID); m_OpenSubMenu = EntityWrapper::Invalid; + m_World->DeleteEntity(m_DropDown.ID); + m_DropDown = EntityWrapper::Invalid; + } +} + + +void MainMenuSystem::OpenDropDown(const Events::InputCommand& e) +{ + auto menus = m_World->GetComponents("Menu"); + if (menus == nullptr) { + return; + } + + if (m_DropDown == EntityWrapper::Invalid) { + //No submenu is open, open one. + for (auto& menu : *menus) { + EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID); + auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner"); + if (!spawner.HasComponent("Spawner")) { + return; + } + m_DropDown = SpawnerSystem::Spawn(spawner, spawner); + break; + } + } else { + m_World->DeleteEntity(m_DropDown.ID); + m_DropDown = EntityWrapper::Invalid; } } @@ -73,8 +106,10 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e) m_EventBroker->Publish(event); } } else if (entity.HasComponent("ConfigBtnResolution")) { - + m_Renderer->SetResolution(Rectangle((int)entity["ConfigBtnResolution"]["Width"], (int)entity["ConfigBtnResolution"]["Height"])); + m_World->DeleteEntity(m_DropDown.ID); + m_DropDown = EntityWrapper::Invalid; } return true; } @@ -98,6 +133,8 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e) m_EventBroker->Publish(event); } else if (e.Command == "Options" && e.Value == 1) { OpenSubMenu(e); + } else if (e.Command == "Resolution" && e.Value == 1) { + OpenDropDown(e); } return true; } \ No newline at end of file