Skip to content

Commit 6fa6d3f

Browse files
committed
im done, im just gonna cry myself to sllep
1 parent 91d8d91 commit 6fa6d3f

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

resources/midgahack.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TitleBgCollapsed = $accent_colour
55
ModuleDisabled = #2A2A2AFF
66
ModuleDisabledHovered = #1B1B1BFF
77
ModuleDisabledActive = #0F0F0FFF
8+
ModuleEnabled = #2A2A2AFF
9+
ModuleEnabledHovered = #1B1B1BFF
10+
ModuleEnabledActive = #0F0F0FFF
811

912
[WidgetSize]
1013
Width = 186

src/Client/Module.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@
66

77
void Module::drawImGui()
88
{
9-
bool f = false;
10-
if (!enabled)
9+
float sbarWidth = ImGui::GetScrollMaxY() > 0.0f ? ImGui::GetStyle().ScrollbarSize : 0;
10+
11+
if (enabled)
12+
{
13+
ImGui::PushStyleColor(ImGuiCol_Button, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabled", ccc4(40, 40, 40, 255))));
14+
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledHovered", ccc4(50, 50, 50, 255))));
15+
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledActive", ccc4(50, 50, 50, 255))));
16+
ImGui::PushStyleColor(ImGuiCol_Text, ccc4ToVec(Client::get()->getThemeColour("ModuleEnabledText", Client::get()->accentColour)));
17+
}
18+
else
1119
{
1220
ImGui::PushStyleColor(ImGuiCol_Button, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabled", ccc4(40, 40, 40, 255))));
1321
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledHovered", ccc4(50, 50, 50, 255))));
1422
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledActive", ccc4(50, 50, 50, 255))));
15-
16-
f = true;
23+
ImGui::PushStyleColor(ImGuiCol_Text, ccc4ToVec(Client::get()->getThemeColour("ModuleDisabledText", ccc4(255, 255, 255, 255))));
1724
}
1825

19-
if (ImGui::Button(this->name.c_str(), ImVec2(Client::get()->widgetSize.x + (options.size() > 0 ? -Client::get()->widgetSize.y : 0), Client::get()->widgetSize.y)))
26+
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)))
2027
{
2128
onToggleAndroid(nullptr);
2229
}
@@ -47,7 +54,7 @@ void Module::drawImGui()
4754
{
4855
float offset = Client::get()->ini->getKeyValueFloat("Offsets::ModuleBarOffset", "3");
4956
auto optionBtn = enabled ? Client::get()->accentColour : Client::get()->getThemeColour("ModuleBarDeselected", ccc4(70, 70, 70, 255));
50-
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);
57+
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);
5158

5259
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)));
5360
}
@@ -57,8 +64,7 @@ void Module::drawImGui()
5764
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)
5865
Client::get()->hoveredModule = this;
5966

60-
if (f)
61-
ImGui::PopStyleColor(3);
67+
ImGui::PopStyleColor(4);
6268
}
6369

6470
void Module::onOptionsAndroid(CCObject* sender)

0 commit comments

Comments
 (0)