From fb5164221f8ec45b191c6395dfcfcc35a48e863c Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 12 Feb 2016 01:57:53 +0100 Subject: [PATCH] HealthHUD redesigned --- assets | 2 +- resources/Schema/Entities/AmmoHUD | 98 +++++++++++++++++++++++++++ resources/Schema/Entities/Player.xml | 99 +++++++++++++++++++--------- resources/Schema/Entities/temp | 38 +++++++++++ src/Engine/Rendering/Renderer.cpp | 1 + src/Game/Systems/HealthHUDSystem.cpp | 2 +- 6 files changed, 208 insertions(+), 32 deletions(-) create mode 100644 resources/Schema/Entities/AmmoHUD create mode 100644 resources/Schema/Entities/temp diff --git a/assets b/assets index 4d36fdce..0fd6b66b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4d36fdced7007a594a56b7371bb26861876889aa +Subproject commit 0fd6b66b599ab98a441f91d5cc53c603009f488c diff --git a/resources/Schema/Entities/AmmoHUD b/resources/Schema/Entities/AmmoHUD new file mode 100644 index 00000000..6cdb6568 --- /dev/null +++ b/resources/Schema/Entities/AmmoHUD @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + + + + 0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + 360 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + 0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + 360 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index 39e7331f..30ae942e 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -76,14 +76,14 @@ - Textures/Core/UnitHexagon.png - + Textures/HealthHUD3.png + - - - + + + @@ -279,13 +279,33 @@ + + + + 1 + + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + Idle - 0.1719161089749548 + 1.1017089512865343 1 @@ -305,8 +325,8 @@ true - - + + @@ -327,36 +347,55 @@ - - + - - 32 - Fonts/DroidSans.ttf,64 - - + + Textures/Core/UnitHexagon.png + + - + + - + - - 360 - Fonts/DroidSans.ttf,64 - - - - - - + - + + + + + 32 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + 360 + Fonts/DroidSans.ttf,64 + + + + + + + + + + @@ -393,7 +432,7 @@ Idle - 1.8038469763698401 + 1.5336333336960681 1 @@ -418,8 +457,8 @@ false - - + + diff --git a/resources/Schema/Entities/temp b/resources/Schema/Entities/temp new file mode 100644 index 00000000..baf4ce61 --- /dev/null +++ b/resources/Schema/Entities/temp @@ -0,0 +1,38 @@ + + + + + + + + + + + + 0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + 360 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + diff --git a/src/Engine/Rendering/Renderer.cpp b/src/Engine/Rendering/Renderer.cpp index 173ddb2b..be84160c 100644 --- a/src/Engine/Rendering/Renderer.cpp +++ b/src/Engine/Rendering/Renderer.cpp @@ -168,6 +168,7 @@ void Renderer::SortRenderJobsByDepth(RenderScene &scene) //Sort all forward jobs so transparency is good. scene.Jobs.TransparentObjects.sort(Renderer::DepthSort); scene.Jobs.SpriteJob.sort(Renderer::DepthSort); + scene.Jobs.Text.sort(Renderer::DepthSort); } void Renderer::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) diff --git a/src/Game/Systems/HealthHUDSystem.cpp b/src/Game/Systems/HealthHUDSystem.cpp index 49b2d0c1..b35bce12 100644 --- a/src/Game/Systems/HealthHUDSystem.cpp +++ b/src/Game/Systems/HealthHUDSystem.cpp @@ -27,7 +27,7 @@ void HealthHUDSystem::Update(double dt) s = s + "/"; s = s + std::to_string((int)(double)entityIDParent["Health"]["MaxHealth"]); float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"]; - (glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Fill"]["Color"]).a); + (glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Text"]["Color"]).a); entity["Text"]["Content"] = s; }