Skip to content

Commit

Permalink
modified a color theme of ImGui
Browse files Browse the repository at this point in the history
I added a class which is responsible for color theme of ImGui.
It has LoadTheme and LoadFont function. What they do is straightforward.
  • Loading branch information
vxcall committed Jul 31, 2020
1 parent c07b5ea commit b2fd02e
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ link_directories(${CMAKE_SOURCE_DIR}/Dependencies/MSDetour/binary)
#imGUI
include_directories(${CMAKE_SOURCE_DIR}/Dependencies/imGUI)
set(IMGUI_FILE_PATH ${CMAKE_SOURCE_DIR}/Dependencies/imGUI)
set(IMGUI_FILES ${IMGUI_FILE_PATH}/imconfig.h ${IMGUI_FILE_PATH}/imgui.cpp ${IMGUI_FILE_PATH}/imgui.h ${IMGUI_FILE_PATH}/imgui_demo.cpp ${IMGUI_FILE_PATH}/imgui_draw.cpp ${IMGUI_FILE_PATH}/imgui_impl_dx9.cpp ${IMGUI_FILE_PATH}/imgui_impl_dx9.h ${IMGUI_FILE_PATH}/imgui_impl_win32.cpp ${IMGUI_FILE_PATH}/imgui_impl_win32.h ${IMGUI_FILE_PATH}/imgui_internal.h ${IMGUI_FILE_PATH}/imgui_widgets.cpp ${IMGUI_FILE_PATH}/imstb_rectpack.h ${IMGUI_FILE_PATH}/imstb_textedit.h ${IMGUI_FILE_PATH}/imstb_truetype.h)
set(IMGUI_FILES ${IMGUI_FILE_PATH}/imconfig.h ${IMGUI_FILE_PATH}/imgui.cpp ${IMGUI_FILE_PATH}/imgui.h ${IMGUI_FILE_PATH}/imgui_demo.cpp ${IMGUI_FILE_PATH}/imgui_draw.cpp ${IMGUI_FILE_PATH}/imgui_impl_dx9.cpp ${IMGUI_FILE_PATH}/imgui_impl_dx9.h ${IMGUI_FILE_PATH}/imgui_impl_win32.cpp ${IMGUI_FILE_PATH}/imgui_impl_win32.h ${IMGUI_FILE_PATH}/imgui_internal.h ${IMGUI_FILE_PATH}/imgui_widgets.cpp ${IMGUI_FILE_PATH}/imstb_rectpack.h ${IMGUI_FILE_PATH}/imstb_textedit.h ${IMGUI_FILE_PATH}/imstb_truetype.h ImGuiTheme.cpp ImGuiTheme.h)

#toml11
include_directories(${CMAKE_SOURCE_DIR}/Dependencies/toml11)
Expand Down
4 changes: 4 additions & 0 deletions GraphicHook.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "pch.h"
#include "ImGuiTheme.h"
#include "GraphicHook.h"
#include "LocalPlayer.h"

Expand Down Expand Up @@ -50,6 +51,7 @@ void InitImGui(IDirect3DDevice9* pDevice)
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
LoadFont(io);

ImGui::StyleColorsDark();

Expand Down Expand Up @@ -147,6 +149,8 @@ HRESULT __stdcall hookedEndScene(IDirect3DDevice9* pDevice) //A function contain
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

LoadTheme();

ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar;
ImGui::Begin("HACK4CSGO", &g_ShowMenu, window_flags);

Expand Down
63 changes: 63 additions & 0 deletions ImGuiTheme.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// Created by PC on 2020/07/31.
//
#include "pch.h"

void LoadTheme() {
ImGuiStyle * style = &ImGui::GetStyle();

style->WindowPadding = ImVec2(15, 15);
style->WindowRounding = 5.0f;
style->FramePadding = ImVec2(5, 5);
style->FrameRounding = 4.0f;
style->ItemSpacing = ImVec2(12, 8);
style->ItemInnerSpacing = ImVec2(8, 6);
style->IndentSpacing = 25.0f;
style->ScrollbarSize = 15.0f;
style->ScrollbarRounding = 9.0f;
style->GrabMinSize = 5.0f;
style->GrabRounding = 3.0f;

style->Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
style->Colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style->Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style->Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
style->Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
style->Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
style->Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style->Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style->Colors[ImGuiCol_FrameBgActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style->Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
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.10f, 0.09f, 0.12f, 1.00f);
style->Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
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.06f, 0.05f, 0.07f, 1.00f);
style->Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style->Colors[ImGuiCol_ButtonHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style->Colors[ImGuiCol_ButtonActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style->Colors[ImGuiCol_Header] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style->Colors[ImGuiCol_HeaderHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style->Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style->Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
style->Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style->Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 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.25f, 1.00f, 0.00f, 0.43f);
style->Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
}

void LoadFont(ImGuiIO io) {
io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/calibrib.ttf", 13);
io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/calibrib.ttf", 11);
io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/calibrib.ttf", 15);
io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/calibrib.ttf", 19);
}
8 changes: 8 additions & 0 deletions ImGuiTheme.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Created by PC on 2020/07/31.
//

#include "imgui.h"

void LoadTheme();
void LoadFont(ImGuiIO io);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Copy and Paste contents in `offset.h` from mine to yours. Or if mine doesn't loo
You're accessible to the hack menu by pressing **INSERT** key on your keyboard.
**But you're allowed to access it only when you're in game. Even though you press INSERT when you are in main menu, nothing happens.**

![Hack menu](https://user-images.githubusercontent.com/33578715/88986783-800fb900-d306-11ea-9797-0cc5a504b01a.png)
![Hack menu](https://user-images.githubusercontent.com/33578715/88990443-8a36b500-d310-11ea-8f41-17ef9d8c0156.png)

You can toggle on/off and tweak parameters in the tabs with the name of each hack.

Expand Down
5 changes: 5 additions & 0 deletions pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
#include <Windows.h>
#include <d3d9.h>
#include <detours.h>

//my header
#include "framework.h"
#include "ImGuiTheme.h"
#include "vector3.h"
#include "offsets.h"

//external library
#include "imgui.h"
#include "imgui_impl_dx9.h"
#include "imgui_impl_win32.h"
Expand Down

0 comments on commit b2fd02e

Please sign in to comment.