Skip to content

Commit

Permalink
im done, im just gonna cry myself to sllep
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Dec 1, 2024
1 parent 91d8d91 commit 6fa6d3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions resources/midgahack.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ TitleBgCollapsed = $accent_colour
ModuleDisabled = #2A2A2AFF
ModuleDisabledHovered = #1B1B1BFF
ModuleDisabledActive = #0F0F0FFF
ModuleEnabled = #2A2A2AFF
ModuleEnabledHovered = #1B1B1BFF
ModuleEnabledActive = #0F0F0FFF

[WidgetSize]
Width = 186
Expand Down
22 changes: 14 additions & 8 deletions src/Client/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@

void Module::drawImGui()
{
bool f = false;
if (!enabled)
float sbarWidth = ImGui::GetScrollMaxY() > 0.0f ? ImGui::GetStyle().ScrollbarSize : 0;

if (enabled)
{
ImGui::PushStyleColor(ImGuiCol_Button, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabled", ccc4(40, 40, 40, 255))));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledHovered", ccc4(50, 50, 50, 255))));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledActive", ccc4(50, 50, 50, 255))));
ImGui::PushStyleColor(ImGuiCol_Text, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledText", Client::get()->accentColour)));
}
else
{
ImGui::PushStyleColor(ImGuiCol_Button, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabled", ccc4(40, 40, 40, 255))));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledHovered", ccc4(50, 50, 50, 255))));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledActive", ccc4(50, 50, 50, 255))));

f = true;
ImGui::PushStyleColor(ImGuiCol_Text, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledText", ccc4(255, 255, 255, 255))));
}

if (ImGui::Button(this->name.c_str(), ImVec2(Client::get()->widgetSize.x + (options.size() > 0 ? -Client::get()->widgetSize.y : 0), Client::get()->widgetSize.y)))
if (ImGui::Button(this->name.c_str(), ImVec2(Client::get()->widgetSize.x + (options.size() > 0 ? -Client::get()->widgetSize.y - sbarWidth : 0), Client::get()->widgetSize.y)))
{
onToggleAndroid(nullptr);
}
Expand Down Expand Up @@ -47,7 +54,7 @@ void Module::drawImGui()
{
float offset = Client::get()->ini->getKeyValueFloat("Offsets::ModuleBarOffset", "3");
auto optionBtn = enabled ? Client::get()->accentColour : Client::get()->getThemeColour("ModuleBarDeselected", ccc4(70, 70, 70, 255));
ImVec2 topRightPos = ImVec2(ImGui::GetWindowPos().x + ImGui::GetCursorPos().x + Client::get()->widgetSize.x - offset, ImGui::GetWindowPos().y + ImGui::GetCursorPos().y - Client::get()->widgetSize.y + offset);
ImVec2 topRightPos = ImVec2(ImGui::GetWindowPos().x + ImGui::GetCursorPos().x + Client::get()->widgetSize.x - offset - sbarWidth, ImGui::GetWindowPos().y + ImGui::GetCursorPos().y - Client::get()->widgetSize.y + offset);

ImGui::GetWindowDrawList()->AddRectFilled(topRightPos, ImVec2(topRightPos.x - Client::get()->ini->getKeyValueFloat("ModuleBarSize::Width", "3"), topRightPos.y + Client::get()->ini->getKeyValueFloat("ModuleBarSize::Height", "18")), ImColor(ccc4ToVec(optionBtn)));
}
Expand All @@ -57,8 +64,7 @@ void Module::drawImGui()
if (ImGui::GetMousePos().x >= ImGui::GetItemRectMin().x && ImGui::GetMousePos().y >= ImGui::GetItemRectMin().y && ImGui::GetMousePos().x <= ImGui::GetItemRectMax().x && ImGui::GetMousePos().y <= ImGui::GetItemRectMax().y)
Client::get()->hoveredModule = this;

if (f)
ImGui::PopStyleColor(3);
ImGui::PopStyleColor(4);
}

void Module::onOptionsAndroid(CCObject* sender)
Expand Down

0 comments on commit 6fa6d3f

Please sign in to comment.