Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/flarialmc/dll
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBarii committed Aug 4, 2024
2 parents 0fe9003 + 8a55962 commit 1d71fee
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 32 deletions.
5 changes: 0 additions & 5 deletions src/Client/GUI/Engine/Elements/Control/Slider/Slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
#define o_colors_secondary7 clickgui->settings.getSettingByName<float>("o_colors_secondary7")->value
#define colors_secondary7_rgb clickgui->settings.getSettingByName<bool>("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;
Expand Down
13 changes: 3 additions & 10 deletions src/Client/GUI/Engine/Elements/Control/TextBox/TextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ std::string FlarialGUI::TextBoxVisual(int index, std::string &text, int limit, f
}

if (FlarialGUI::TextBoxes[index].isActive) {
if (FlarialGUI::TextBoxes[index].isAt1)
FlarialGUI::lerp(FlarialGUI::TextBoxes[index].cursorOpac, -1.0f, 0.05f * FlarialGUI::frameFactor);
if (FlarialGUI::TextBoxes[index].isAt1) FlarialGUI::lerp(FlarialGUI::TextBoxes[index].cursorOpac, -1.0f, 0.05f * FlarialGUI::frameFactor);
else FlarialGUI::lerp(FlarialGUI::TextBoxes[index].cursorOpac, 2.0f, 0.05f * FlarialGUI::frameFactor);
} else FlarialGUI::TextBoxes[index].cursorOpac = 0;

Expand All @@ -65,6 +64,8 @@ std::string FlarialGUI::TextBoxVisual(int index, std::string &text, int limit, f
const float textWidth = Constraints::RelativeConstraint(0.12, "height", true);
const float percHeight = Constraints::RelativeConstraint(0.035, "height", true);

y -= percHeight / 2.0f;

if (isAdditionalY) UnSetIsInAdditionalYMode();

text = FlarialGUI::TextBox(index, text, limit, x, y, Constraints::SpacingConstraint(1.55, textWidth), percHeight);
Expand All @@ -85,14 +86,6 @@ std::string FlarialGUI::TextBoxVisual(int index, std::string &text, int limit, f
Constraints::SpacingConstraint(1.55, textWidth), percHeight,
DWRITE_TEXT_ALIGNMENT_LEADING, textSize, DWRITE_FONT_WEIGHT_NORMAL);



//IDWriteTextFormat* textFormat;
//FlarialGUI::writeFactory->CreateTextFormat(LClient::settings.getSettingByName<std::string>("fontname")->value, NULL, DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, Constraints::FontScaler(textSize), L"", &textFormat);

// textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); !!!
//textLayout->Release();

D2D1_COLOR_F cursorCol = colors_primary2_rgb ? rgbColor : colors_primary2;
cursorCol.a = o_colors_primary2;

Expand Down
128 changes: 128 additions & 0 deletions src/Client/GUI/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
#define o_colors_text clickgui->settings.getSettingByName<float>("o_colors_text")->value
#define colors_text_rgb clickgui->settings.getSettingByName<bool>("colors_text_rgb")->value

#define colors_enabled HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_enabled")->value)
#define o_colors_enabled clickgui->settings.getSettingByName<float>("o_colors_enabled")->value
#define colors_enabled_rgb clickgui->settings.getSettingByName<bool>("colors_enabled_rgb")->value

#define colors_disabled HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_disabled")->value)
#define o_colors_disabled clickgui->settings.getSettingByName<float>("o_colors_disabled")->value
#define colors_disabled_rgb clickgui->settings.getSettingByName<bool>("colors_disabled_rgb")->value

#define colors_primary1 HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_primary1")->value)
#define o_colors_primary1 clickgui->settings.getSettingByName<float>("o_colors_primary1")->value
#define colors_primary1_rgb clickgui->settings.getSettingByName<bool>("colors_primary1_rgb")->value
Expand All @@ -58,10 +66,46 @@
#define o_colors_secondary2 clickgui->settings.getSettingByName<float>("o_colors_secondary2")->value
#define colors_secondary2_rgb clickgui->settings.getSettingByName<bool>("colors_secondary2_rgb")->value

#define colors_secondary3 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary4")->value)
#define o_colors_secondary3 clickgui->settings.getSettingByName<float>("o_colors_secondary3")->value
#define colors_secondary3_rgb clickgui->settings.getSettingByName<bool>("colors_secondary4_rgb")->value

#define colors_secondary4 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary3")->value)
#define o_colors_secondary4 clickgui->settings.getSettingByName<float>("o_colors_secondary4")->value
#define colors_secondary4_rgb clickgui->settings.getSettingByName<bool>("colors_secondary3_rgb")->value

#define colors_secondary5 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary5")->value)
#define o_colors_secondary5 clickgui->settings.getSettingByName<float>("o_colors_secondary5")->value
#define colors_secondary5_rgb clickgui->settings.getSettingByName<bool>("colors_secondary5_rgb")->value

#define colors_secondary6 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary6")->value)
#define o_colors_secondary6 clickgui->settings.getSettingByName<float>("o_colors_secondary6")->value
#define colors_secondary6_rgb clickgui->settings.getSettingByName<bool>("colors_secondary6_rgb")->value

#define colors_secondary7 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary7")->value)
#define o_colors_secondary7 clickgui->settings.getSettingByName<float>("o_colors_secondary7")->value
#define colors_secondary7_rgb clickgui->settings.getSettingByName<bool>("colors_secondary7_rgb")->value

#define colors_secondary8 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_secondary8")->value)
#define o_colors_secondary8 clickgui->settings.getSettingByName<float>("o_colors_secondary8")->value
#define colors_secondary8_rgb clickgui->settings.getSettingByName<bool>("colors_secondary8_rgb")->value

#define colors_mod1 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_mod1")->value)
#define o_colors_mod1 clickgui->settings.getSettingByName<float>("o_colors_mod1")->value
#define colors_mod1_rgb clickgui->settings.getSettingByName<bool>("colors_mod1_rgb")->value

#define colors_mod2 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_mod2")->value)
#define o_colors_mod2 clickgui->settings.getSettingByName<float>("o_colors_mod2")->value
#define colors_mod2_rgb clickgui->settings.getSettingByName<bool>("colors_mod2_rgb")->value

#define colors_mod3 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_mod3")->value)
#define o_colors_mod3 clickgui->settings.getSettingByName<float>("o_colors_mod3")->value
#define colors_mod3_rgb clickgui->settings.getSettingByName<bool>("colors_mod3_rgb")->value

#define colors_mod4 FlarialGUI::HexToColorF(clickgui->settings.getSettingByName<std::string>("colors_mod4")->value)
#define o_colors_mod4 clickgui->settings.getSettingByName<float>("o_colors_mod4")->value
#define colors_mod4_rgb clickgui->settings.getSettingByName<bool>("colors_mod4_rgb")->value

std::map<std::string, ID2D1Bitmap *> ImagesClass::eimages;
std::map<int, ID2D1Bitmap *> ImagesClass::images;

Expand All @@ -86,6 +130,90 @@ std::unordered_map<int, float> FlarialGUI::additionalY;
//std::unordered_map<std::string, winrt::com_ptr<ID2D1GradientStopCollection>> FlarialGUI::gradientStopCache;
LRUCache<uint64_t, winrt::com_ptr<ID2D1LinearGradientBrush>> FlarialGUI::gradientBrushCache(300);

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<uint8_t>(color.r * 255.0f);
auto g = static_cast<uint8_t>(color.g * 255.0f);
Expand Down
7 changes: 5 additions & 2 deletions src/Client/GUI/Engine/Engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ namespace FlarialGUI {

void NotifyHeartbeat();

std::string
TextBoxVisual(int index, std::string &text, int limit, float x, float y, const std::string &real = "Text Format");
std::string TextBoxVisual(int index, std::string& text, int limit, float x, float y, const std::string& real = "");

winrt::com_ptr<ID2D1SolidColorBrush> getBrush(D2D1_COLOR_F color);

Expand Down Expand Up @@ -361,4 +360,8 @@ namespace FlarialGUI {
const float imageHeight);

ImColor D2DColorToImColor(D2D1_COLOR_F color);

void OverrideAlphaValues(float percent);

void ResetOverrideAlphaValues();
}
2 changes: 1 addition & 1 deletion src/Client/Module/Modules/ClickGUI/ClickGUIRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 4 additions & 5 deletions src/Client/Module/Modules/ComboCounter/ComboCounter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ class ComboCounter : public Module {
Constraints::RelativeConstraint(1.0f, "height"));

this->addHeader("Module UI");

this->addSlider("UI Scale", "", this->settings.getSettingByName<float>("uiscale")->value, 2.0f);

this->addToggle("Border", "im just trolling", settings.getSettingByName<bool>("border")->value);

this->addToggle("Border", "", settings.getSettingByName<bool>("border")->value);
this->addConditionalSlider(settings.getSettingByName<bool>("border")->value, "Border Width", "", settings.getSettingByName<float>("borderWidth")->value, 4.0f);
this->addSlider("Rounding", "", this->settings.getSettingByName<float>("rounding")->value);
this->addToggle("Translucency", "", this->settings.getSettingByName<bool>("BlurEffect")->value);
this->addTextBox("Text Format", "", settings.getSettingByName<std::string>("text")->value);

this->addToggle("NO MORE TROLLING.....", "", settings.getSettingByName<bool>("reversepaddingx")->value);

this->extraPadding();

Expand Down
30 changes: 23 additions & 7 deletions src/Client/Module/Modules/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,37 @@ void Module::addHeader(std::string text) {
padding += Constraints::RelativeConstraint(0.055f, "height", true);
}

void Module::addConditionalSlider(bool condition, std::string text, std::string subtext, float& startingPoint, float maxVal, float minVal, bool zerosafe) {
void Module::addTextBox(std::string text, std::string subtext, std::string& value) {
float x = Constraints::PercentageConstraint(0.019, "left");
float elementX = Constraints::PercentageConstraint(0.285f, "right");
float y = Constraints::PercentageConstraint(0.10, "top") + padding;

FlarialGUI::TextBoxVisual(textboxIndex, settings.getSettingByName<std::string>("text")->value, 16, elementX , y);

Module::addElementText(text, subtext);

padding += Constraints::RelativeConstraint(0.05f, "height", true);
textboxIndex++;
}

void Module::addConditionalSlider(bool condition, std::string text, std::string subtext, float& value, 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);
Module::addSlider(text, subtext, startingPoint, maxVal, minVal, zerosafe);
Module::addSlider(text, subtext, value, maxVal, minVal, zerosafe);
}
else {
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, value, maxVal, minVal, zerosafe);
}
}

FlarialGUI::ResetOverrideAlphaValues();
}

void Module::addElementText(std::string text, std::string subtext) {
Expand All @@ -254,12 +271,11 @@ void Module::addElementText(std::string text, std::string subtext) {
if (!subtext.empty()) FlarialGUI::FlarialTextWithFont(x, subtextY, FlarialGUI::to_wide(subtext).c_str(), 200, 0, DWRITE_TEXT_ALIGNMENT_LEADING, fontSize2, DWRITE_FONT_WEIGHT_MEDIUM, FlarialGUI::HexToColorF("473b3d"), false);
}

void Module::addSlider(std::string text, std::string subtext, float& startingPoint, float maxVal, float minVal, bool zerosafe) {
float x = Constraints::PercentageConstraint(0.019, "left");
void Module::addSlider(std::string text, std::string subtext, float& value, float maxVal, float minVal, bool zerosafe) {
float elementX = Constraints::PercentageConstraint(0.33f, "right");
float y = Constraints::PercentageConstraint(0.10, "top") + padding;

FlarialGUI::Slider(sliderIndex, elementX, y, startingPoint, maxVal, minVal, zerosafe);
FlarialGUI::Slider(sliderIndex, elementX, y, value, maxVal, minVal, zerosafe);

Module::addElementText(text, subtext);

Expand Down
5 changes: 3 additions & 2 deletions src/Client/Module/Modules/Module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class Module {
void extraPadding();
void addElementText(std::string text, std::string subtext = "");
void addHeader(std::string text);
void addConditionalSlider(bool condition, std::string text, std::string subtext, float& startingPoint, float maxVal = 100.0f, float minVal = 0.0f, bool zerosafe = true);
void addSlider(std::string text, std::string subtext, float& startingPoint, float maxVal = 100.0f, float minVal = 0.0f, bool zerosafe = true);
void addConditionalSlider(bool condition, std::string text, std::string subtext, float& value, float maxVal = 100.0f, float minVal = 0.0f, bool zerosafe = true);
void addSlider(std::string text, std::string subtext, float& value, float maxVal = 100.0f, float minVal = 0.0f, bool zerosafe = true);
void addToggle(std::string text, std::string subtext, bool& value);
void addTextBox(std::string text, std::string subtext, std::string& value);
virtual void loadDefaults();
void saveSettings() const;
void loadSettings();
Expand Down

0 comments on commit 1d71fee

Please sign in to comment.