From 0017006776f3abcfc278411537309166aaf7c501 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 4 Aug 2024 21:58:37 +0800 Subject: [PATCH] smoother conditional sliders --- .../Engine/Elements/Control/Slider/Slider.cpp | 5 - src/Client/GUI/Engine/Engine.cpp | 150 ++++++++++++++++++ src/Client/GUI/Engine/Engine.hpp | 4 + .../Modules/ClickGUI/ClickGUIRenderer.hpp | 2 +- .../Modules/ComboCounter/ComboCounter.hpp | 2 +- src/Client/Module/Modules/Module.cpp | 8 +- 6 files changed, 162 insertions(+), 9 deletions(-) diff --git a/src/Client/GUI/Engine/Elements/Control/Slider/Slider.cpp b/src/Client/GUI/Engine/Elements/Control/Slider/Slider.cpp index 3e246327..a7b863c3 100644 --- a/src/Client/GUI/Engine/Elements/Control/Slider/Slider.cpp +++ b/src/Client/GUI/Engine/Elements/Control/Slider/Slider.cpp @@ -35,11 +35,6 @@ #define o_colors_secondary7 clickgui->settings.getSettingByName("o_colors_secondary7")->value #define colors_secondary7_rgb clickgui->settings.getSettingByName("colors_secondary7_rgb")->value -//void FlarialGUI::Slider(bool troll, int index, float x, float y, float& startingPoint, const float maxValue, const float minValue, const bool zerosafe) { -//float yes = Slider(index, x, y, (float)startingPoint, maxValue, minValue, zerosafe); -// startingPoint = yes; -//} - float FlarialGUI::Slider(int index, float x, float y, float& startingPoint, const float maxValue, const float minValue, const bool zerosafe) { D2D1_COLOR_F color = colors_primary1_rgb ? rgbColor : colors_primary1; D2D1_COLOR_F disabledColor = colors_primary3_rgb ? rgbColor : colors_primary3; diff --git a/src/Client/GUI/Engine/Engine.cpp b/src/Client/GUI/Engine/Engine.cpp index a00c5a81..b903933f 100644 --- a/src/Client/GUI/Engine/Engine.cpp +++ b/src/Client/GUI/Engine/Engine.cpp @@ -34,6 +34,14 @@ #define o_colors_text clickgui->settings.getSettingByName("o_colors_text")->value #define colors_text_rgb clickgui->settings.getSettingByName("colors_text_rgb")->value +#define colors_enabled HexToColorF(clickgui->settings.getSettingByName("colors_enabled")->value) +#define o_colors_enabled clickgui->settings.getSettingByName("o_colors_enabled")->value +#define colors_enabled_rgb clickgui->settings.getSettingByName("colors_enabled_rgb")->value + +#define colors_disabled HexToColorF(clickgui->settings.getSettingByName("colors_disabled")->value) +#define o_colors_disabled clickgui->settings.getSettingByName("o_colors_disabled")->value +#define colors_disabled_rgb clickgui->settings.getSettingByName("colors_disabled_rgb")->value + #define colors_primary1 HexToColorF(clickgui->settings.getSettingByName("colors_primary1")->value) #define o_colors_primary1 clickgui->settings.getSettingByName("o_colors_primary1")->value #define colors_primary1_rgb clickgui->settings.getSettingByName("colors_primary1_rgb")->value @@ -58,10 +66,46 @@ #define o_colors_secondary2 clickgui->settings.getSettingByName("o_colors_secondary2")->value #define colors_secondary2_rgb clickgui->settings.getSettingByName("colors_secondary2_rgb")->value +#define colors_secondary3 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary4")->value) +#define o_colors_secondary3 clickgui->settings.getSettingByName("o_colors_secondary3")->value +#define colors_secondary3_rgb clickgui->settings.getSettingByName("colors_secondary4_rgb")->value + +#define colors_secondary4 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary3")->value) +#define o_colors_secondary4 clickgui->settings.getSettingByName("o_colors_secondary4")->value +#define colors_secondary4_rgb clickgui->settings.getSettingByName("colors_secondary3_rgb")->value + +#define colors_secondary5 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary5")->value) +#define o_colors_secondary5 clickgui->settings.getSettingByName("o_colors_secondary5")->value +#define colors_secondary5_rgb clickgui->settings.getSettingByName("colors_secondary5_rgb")->value + +#define colors_secondary6 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary6")->value) +#define o_colors_secondary6 clickgui->settings.getSettingByName("o_colors_secondary6")->value +#define colors_secondary6_rgb clickgui->settings.getSettingByName("colors_secondary6_rgb")->value + #define colors_secondary7 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary7")->value) #define o_colors_secondary7 clickgui->settings.getSettingByName("o_colors_secondary7")->value #define colors_secondary7_rgb clickgui->settings.getSettingByName("colors_secondary7_rgb")->value +#define colors_secondary8 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_secondary8")->value) +#define o_colors_secondary8 clickgui->settings.getSettingByName("o_colors_secondary8")->value +#define colors_secondary8_rgb clickgui->settings.getSettingByName("colors_secondary8_rgb")->value + +#define colors_mod1 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_mod1")->value) +#define o_colors_mod1 clickgui->settings.getSettingByName("o_colors_mod1")->value +#define colors_mod1_rgb clickgui->settings.getSettingByName("colors_mod1_rgb")->value + +#define colors_mod2 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_mod2")->value) +#define o_colors_mod2 clickgui->settings.getSettingByName("o_colors_mod2")->value +#define colors_mod2_rgb clickgui->settings.getSettingByName("colors_mod2_rgb")->value + +#define colors_mod3 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_mod3")->value) +#define o_colors_mod3 clickgui->settings.getSettingByName("o_colors_mod3")->value +#define colors_mod3_rgb clickgui->settings.getSettingByName("colors_mod3_rgb")->value + +#define colors_mod4 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName("colors_mod4")->value) +#define o_colors_mod4 clickgui->settings.getSettingByName("o_colors_mod4")->value +#define colors_mod4_rgb clickgui->settings.getSettingByName("colors_mod4_rgb")->value + std::map ImagesClass::eimages; std::map ImagesClass::images; @@ -86,6 +130,112 @@ std::unordered_map FlarialGUI::additionalY; //std::unordered_map> FlarialGUI::gradientStopCache; LRUCache> FlarialGUI::gradientBrushCache(300); +/* +float b_o_colors_text = o_colors_text; +float b_o_colors_enabled = o_colors_enabled; +float b_o_colors_disabled = o_colors_disabled; +float b_o_colors_primary1 = o_colors_primary1; +float b_o_colors_primary2 = o_colors_primary2; +float b_o_colors_primary3 = o_colors_primary3; +float b_o_colors_primary4 = o_colors_primary4; +float b_o_colors_secondary1 = o_colors_secondary1; +float b_o_colors_secondary2 = o_colors_secondary2; +float b_o_colors_secondary3 = o_colors_secondary3; +float b_o_colors_secondary4 = o_colors_secondary4; +float b_o_colors_secondary5 = o_colors_secondary5; +float b_o_colors_secondary6 = o_colors_secondary6; +float b_o_colors_secondary7 = o_colors_secondary7; +float b_o_colors_secondary8 = o_colors_secondary8; +float b_o_colors_mod1 = o_colors_mod1; +float b_o_colors_mod2 = o_colors_mod2; +float b_o_colors_mod3 = o_colors_mod3; +float b_o_colors_mod4 = o_colors_mod4; +*/ + +float b_o_colors_text; +float b_o_colors_enabled; +float b_o_colors_disabled; +float b_o_colors_primary1; +float b_o_colors_primary2; +float b_o_colors_primary3; +float b_o_colors_primary4; +float b_o_colors_secondary1; +float b_o_colors_secondary2; +float b_o_colors_secondary3; +float b_o_colors_secondary4; +float b_o_colors_secondary5; +float b_o_colors_secondary6; +float b_o_colors_secondary7; +float b_o_colors_secondary8; +float b_o_colors_mod1; +float b_o_colors_mod2; +float b_o_colors_mod3; +float b_o_colors_mod4; + +void FlarialGUI::OverrideAlphaValues(float percent) { + b_o_colors_text = o_colors_text; + b_o_colors_enabled = o_colors_enabled; + b_o_colors_disabled = o_colors_disabled; + b_o_colors_primary1 = o_colors_primary1; + b_o_colors_primary2 = o_colors_primary2; + b_o_colors_primary3 = o_colors_primary3; + b_o_colors_primary4 = o_colors_primary4; + b_o_colors_secondary1 = o_colors_secondary1; + b_o_colors_secondary2 = o_colors_secondary2; + b_o_colors_secondary3 = o_colors_secondary3; + b_o_colors_secondary4 = o_colors_secondary4; + b_o_colors_secondary5 = o_colors_secondary5; + b_o_colors_secondary6 = o_colors_secondary6; + b_o_colors_secondary7 = o_colors_secondary7; + b_o_colors_secondary8 = o_colors_secondary8; + b_o_colors_mod1 = o_colors_mod1; + b_o_colors_mod2 = o_colors_mod2; + b_o_colors_mod3 = o_colors_mod3; + b_o_colors_mod4 = o_colors_mod4; + + o_colors_text = percent * b_o_colors_text; + o_colors_enabled = percent * b_o_colors_enabled; + o_colors_disabled = percent * b_o_colors_disabled; + o_colors_primary1 = percent * b_o_colors_primary1; + o_colors_primary2 = percent * b_o_colors_primary2; + o_colors_primary3 = percent * b_o_colors_primary3; + o_colors_primary4 = percent * b_o_colors_primary4; + o_colors_secondary1 = percent * b_o_colors_secondary1; + o_colors_secondary2 = percent * b_o_colors_secondary2; + o_colors_secondary3 = percent * b_o_colors_secondary3; + o_colors_secondary4 = percent * b_o_colors_secondary4; + o_colors_secondary5 = percent * b_o_colors_secondary5; + o_colors_secondary6 = percent * b_o_colors_secondary6; + o_colors_secondary7 = percent * b_o_colors_secondary7; + o_colors_secondary8 = percent * b_o_colors_secondary8; + o_colors_mod1 = percent * b_o_colors_mod1; + o_colors_mod2 = percent * b_o_colors_mod2; + o_colors_mod3 = percent * b_o_colors_mod3; + o_colors_mod4 = percent * b_o_colors_mod4; +} + +void FlarialGUI::ResetOverrideAlphaValues() { + o_colors_text = b_o_colors_text; + o_colors_enabled = b_o_colors_enabled; + o_colors_disabled = b_o_colors_disabled; + o_colors_primary1 = b_o_colors_primary1; + o_colors_primary2 = b_o_colors_primary2; + o_colors_primary3 = b_o_colors_primary3; + o_colors_primary4 = b_o_colors_primary4; + o_colors_secondary1 = b_o_colors_secondary1; + o_colors_secondary2 = b_o_colors_secondary2; + o_colors_secondary3 = b_o_colors_secondary3; + o_colors_secondary4 = b_o_colors_secondary4; + o_colors_secondary5 = b_o_colors_secondary5; + o_colors_secondary6 = b_o_colors_secondary6; + o_colors_secondary7 = b_o_colors_secondary7; + o_colors_secondary8 = b_o_colors_secondary8; + o_colors_mod1 = b_o_colors_mod1; + o_colors_mod2 = b_o_colors_mod2; + o_colors_mod3 = b_o_colors_mod3; + o_colors_mod4 = b_o_colors_mod4; +} + UINT32 ColorValueToUInt(const D3DCOLORVALUE &color) { auto r = static_cast(color.r * 255.0f); auto g = static_cast(color.g * 255.0f); diff --git a/src/Client/GUI/Engine/Engine.hpp b/src/Client/GUI/Engine/Engine.hpp index 4b44c7cd..89ff9cda 100644 --- a/src/Client/GUI/Engine/Engine.hpp +++ b/src/Client/GUI/Engine/Engine.hpp @@ -361,4 +361,8 @@ namespace FlarialGUI { const float imageHeight); ImColor D2DColorToImColor(D2D1_COLOR_F color); + + void OverrideAlphaValues(float percent); + + void ResetOverrideAlphaValues(); } \ No newline at end of file diff --git a/src/Client/Module/Modules/ClickGUI/ClickGUIRenderer.hpp b/src/Client/Module/Modules/ClickGUI/ClickGUIRenderer.hpp index 4afee4ed..71cf98dd 100644 --- a/src/Client/Module/Modules/ClickGUI/ClickGUIRenderer.hpp +++ b/src/Client/Module/Modules/ClickGUI/ClickGUIRenderer.hpp @@ -129,7 +129,7 @@ class ClickGUIRenderer : public Listener { } - Blur::RenderBlur(event.RTV, 3, realBlurAmount/4); + //Blur::RenderBlur(event.RTV, 3, realBlurAmount/4); float baseHeight = Constraints::RelativeConstraint(baseHeightReal); diff --git a/src/Client/Module/Modules/ComboCounter/ComboCounter.hpp b/src/Client/Module/Modules/ComboCounter/ComboCounter.hpp index 128fbbf0..35c10abe 100644 --- a/src/Client/Module/Modules/ComboCounter/ComboCounter.hpp +++ b/src/Client/Module/Modules/ComboCounter/ComboCounter.hpp @@ -52,7 +52,7 @@ class ComboCounter : public Module { this->addToggle("Border", "im just trolling", settings.getSettingByName("border")->value); this->addConditionalSlider(settings.getSettingByName("border")->value, "Border Width", "", settings.getSettingByName("borderWidth")->value, 4.0f); - + this->addToggle("NO MORE TROLLING.....", "", settings.getSettingByName("reversepaddingx")->value); this->extraPadding(); diff --git a/src/Client/Module/Modules/Module.cpp b/src/Client/Module/Modules/Module.cpp index 08012707..92a9ab1d 100644 --- a/src/Client/Module/Modules/Module.cpp +++ b/src/Client/Module/Modules/Module.cpp @@ -218,6 +218,9 @@ void Module::addHeader(std::string text) { } void Module::addConditionalSlider(bool condition, std::string text, std::string subtext, float& startingPoint, float maxVal, float minVal, bool zerosafe) { + + FlarialGUI::OverrideAlphaValues((Constraints::RelativeConstraint(0.05f, "height", true) - conditionalSliderAnims[sliderIndex]) / Constraints::RelativeConstraint(0.05f, "height", true)); + if (condition) { padding -= conditionalSliderAnims[sliderIndex]; FlarialGUI::lerp(conditionalSliderAnims[sliderIndex], 0.0f, 0.25f * FlarialGUI::frameFactor); @@ -227,10 +230,11 @@ void Module::addConditionalSlider(bool condition, std::string text, std::string FlarialGUI::lerp(conditionalSliderAnims[sliderIndex], Constraints::RelativeConstraint(0.05f, "height", true), 0.25f * FlarialGUI::frameFactor); if (conditionalSliderAnims[sliderIndex] < Constraints::RelativeConstraint(0.0499f, "height", true)) { padding -= conditionalSliderAnims[sliderIndex]; - if (conditionalSliderAnims[sliderIndex] < Constraints::RelativeConstraint(0.045f, "height", true)) Module::addSlider(text, subtext, startingPoint, maxVal, minVal, zerosafe); - else padding += Constraints::RelativeConstraint(0.05f, "height", true); + Module::addSlider(text, subtext, startingPoint, maxVal, minVal, zerosafe); } } + + FlarialGUI::ResetOverrideAlphaValues(); } void Module::addElementText(std::string text, std::string subtext) {