From b49dd981e7d9996b6da160d25cc0db889a73eb02 Mon Sep 17 00:00:00 2001 From: kelson8 Date: Thu, 13 Mar 2025 06:52:59 -0400 Subject: [PATCH] Add ImGui style from Cheat Menu on the gta trilogy. Add credits to user-grinch for the style used in readme and in the code. Disable dll test code. --- README.md | 4 ++ src/Main.cpp | 5 +++ src/functions/imgui_functions.cpp | 68 +++++++++++++++++++++++++++++++ src/functions/imgui_functions.h | 1 + src/test/directx9_test.cpp | 4 ++ 5 files changed, 82 insertions(+) diff --git a/README.md b/README.md index ab763b4..a5a21b9 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,7 @@ Here are some images of what this ImGui test is so far ![Light Mode Toggle](/screenshots/LightModeToggle.png) --> +# Credits +Credit to user-grinch on github for the ImGui style that I am using. +The code for it is in imgui_functions.cpp under 'ImGuiFunctions::Main::ApplyStyle()' +* https://github.com/user-grinch/Cheat-Menu/blob/master/src/cheatmenu.cpp#L271-L335 \ No newline at end of file diff --git a/src/Main.cpp b/src/Main.cpp index 45eb6c9..5b46328 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -69,6 +69,8 @@ int main(int, char**) // I forgot about making a test DLL for this project. // DLL initialize + +#ifdef DLL_TEST HINSTANCE hinstDLL; DLLPROC HelloWorld; BOOL fFreeDLL; @@ -119,6 +121,9 @@ int main(int, char**) // End DLL initialize + +#endif //DLL_TEST + #endif //_DIRECTX9 #endif //_TEST1 diff --git a/src/functions/imgui_functions.cpp b/src/functions/imgui_functions.cpp index 8ce32be..e171a69 100644 --- a/src/functions/imgui_functions.cpp +++ b/src/functions/imgui_functions.cpp @@ -107,4 +107,72 @@ static void ImGuiFunctions::Main::HelpMarker(const char* desc) ImGui::PopTextWrapPos(); ImGui::EndTooltip(); } +} + +// Credit to user-grinch on github for the style code here. +// https://github.com/user-grinch/Cheat-Menu/blob/master/src/cheatmenu.cpp#L271-L335 +void ImGuiFunctions::Main::ApplyStyle() +{ + ImGuiStyle* style = &ImGui::GetStyle(); + ImVec4* colors = style->Colors; + + style->WindowPadding = ImVec2(8, 8); + style->WindowRounding = 5.0f; + style->FramePadding = ImVec2(8, 8); + style->FrameRounding = 5.0f; + style->PopupRounding = 5.0f; + style->ItemSpacing = ImVec2(7, 7); + style->ItemInnerSpacing = ImVec2(7, 7); + style->IndentSpacing = 25.0f; + style->ScrollbarSize = 12.0f; + style->ScrollbarRounding = 10.0f; + style->GrabMinSize = 5.0f; + style->GrabRounding = 3.0f; + + style->ChildBorderSize = 0; + style->WindowBorderSize = 0; + style->FrameBorderSize = 0; + style->TabBorderSize = 0; + style->PopupBorderSize = 0; + + style->Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f); + style->Colors[ImGuiCol_TextDisabled] = ImVec4(0.35f, 0.33f, 0.3f, 1.00f); + style->Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.06f, 0.95f); + style->Colors[ImGuiCol_ChildBg] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f); + style->Colors[ImGuiCol_PopupBg] = ImVec4(0.06f, 0.05f, 0.06f, 0.95f); + style->Colors[ImGuiCol_Border] = ImVec4(0.12f, 0.12f, 0.12f, 1.0f); + style->Colors[ImGuiCol_BorderShadow] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + style->Colors[ImGuiCol_FrameBg] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); + style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + style->Colors[ImGuiCol_TitleBg] = ImVec4(0.12f, 0.12f, 0.12f, 0.94f); + style->Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 0.98f, 0.95f, 0.75f); + style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f); + style->Colors[ImGuiCol_MenuBarBg] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.5f, 0.5f, 0.5f, 0.3f); + style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.7f, 0.7f, 0.7f, 0.3f); + style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.9f, 0.9f, 0.9f, 0.3f); + style->Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); + style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); + style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); + style->Colors[ImGuiCol_Separator] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_Button] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); + style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + style->Colors[ImGuiCol_Tab] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + style->Colors[ImGuiCol_TabHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); + style->Colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + style->Colors[ImGuiCol_Header] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f); + style->Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); + style->Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f); + style->Colors[ImGuiCol_ResizeGrip] = ImVec4(0.12f, 0.12f, 0.12f, 0.00f); + style->Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); + style->Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + style->Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f); + style->Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f); + style->Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f); + style->Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f); + style->Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.06f, 0.05f, 0.06f, 0.95f); + style->Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.6f); } \ No newline at end of file diff --git a/src/functions/imgui_functions.h b/src/functions/imgui_functions.h index a34a009..01193d1 100644 --- a/src/functions/imgui_functions.h +++ b/src/functions/imgui_functions.h @@ -13,6 +13,7 @@ namespace ImGuiFunctions { void ShowWindow(HWND hwnd); void ShutDown(); void DestroyWindow(HWND hwnd, WNDCLASSEXW wc); + void ApplyStyle(); } } diff --git a/src/test/directx9_test.cpp b/src/test/directx9_test.cpp index d1738d7..dc28d3d 100644 --- a/src/test/directx9_test.cpp +++ b/src/test/directx9_test.cpp @@ -202,6 +202,10 @@ void DirectX9Test::directX9Test() // Setup Dear ImGui style ImGui::StyleColorsDark(); + // Setup the style from the Cheat Menu + // https://github.com/user-grinch/Cheat-Menu + ImGuiFunctions::Main::ApplyStyle(); + //ImGui::StyleColorsLight(); // Setup Platform/Renderer backends