Tweaks & fixes
This commit is contained in:
parent
ca4cbcb663
commit
21fa5545b4
@ -72,8 +72,9 @@ void CheatMenu::DrawWindow()
|
||||
|
||||
CheatMenu::CheatMenu()
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
ApplyStyle();
|
||||
windowCallback = std::bind(&DrawWindow);
|
||||
pCallbackFunc = std::bind(&DrawWindow);
|
||||
|
||||
// Load menu settings
|
||||
Ui::m_HeaderId = gConfig.GetValue("window.id", std::string(""));
|
||||
@ -152,9 +153,9 @@ void CheatMenu::ApplyStyle()
|
||||
style->Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
|
||||
style->Colors[ImGuiCol_MenuBarBg] = ImVec4(0.12f, 0.12f, 0.12f, 1.00f);
|
||||
style->Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.12f, 0.12f, 0.12f, 1.00f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.16f, 0.16f, 0.16f, 1.00f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.8f, 0.8f, 0.8f, 0.3f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.5f, 0.5f, 0.5f, 0.3f);
|
||||
style->Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.2f, 0.2f, 0.2f, 1.00f);
|
||||
style->Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
|
||||
style->Colors[ImGuiCol_SliderGrab] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||
style->Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||
|
11
src/hook.cpp
11
src/hook.cpp
@ -35,7 +35,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
{
|
||||
if (!ImGui::GetCurrentContext())
|
||||
{
|
||||
return;
|
||||
ImGui::CreateContext();
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
@ -45,7 +45,7 @@ void Hook::RenderFrame(void* ptr)
|
||||
{
|
||||
ShowMouse(m_bShowMouse);
|
||||
|
||||
// handle window scaling here
|
||||
// Scale the menu if game resolution changed
|
||||
static ImVec2 fScreenSize = ImVec2(-1, -1);
|
||||
ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
|
||||
if (fScreenSize.x != size.x && fScreenSize.y != size.y)
|
||||
@ -86,9 +86,9 @@ void Hook::RenderFrame(void* ptr)
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
if (windowCallback != nullptr)
|
||||
if (pCallbackFunc != nullptr)
|
||||
{
|
||||
windowCallback();
|
||||
pCallbackFunc();
|
||||
}
|
||||
|
||||
ImGui::EndFrame();
|
||||
@ -106,7 +106,6 @@ void Hook::RenderFrame(void* ptr)
|
||||
else
|
||||
{
|
||||
bInit = true;
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGui_ImplWin32_Init(RsGlobal.ps->window);
|
||||
|
||||
#ifdef GTASA
|
||||
@ -139,7 +138,6 @@ void Hook::RenderFrame(void* ptr)
|
||||
io.LogFilename = nullptr;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
||||
|
||||
style.WindowTitleAlign = ImVec2(0.5, 0.5);
|
||||
oWndProc = (WNDPROC)SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)WndProc);
|
||||
}
|
||||
}
|
||||
@ -243,7 +241,6 @@ void Hook::ShowMouse(bool state)
|
||||
|
||||
Hook::Hook()
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
|
||||
// Nvidia Overlay crash fix
|
||||
if (init(kiero::RenderType::D3D9) == kiero::Status::Success)
|
||||
|
@ -25,7 +25,7 @@ private:
|
||||
|
||||
public:
|
||||
static inline bool m_bShowMouse = false;
|
||||
static inline std::function<void()> windowCallback = nullptr;
|
||||
static inline std::function<void()> pCallbackFunc = nullptr;
|
||||
|
||||
#ifdef GTASA
|
||||
static void ApplyMouseFix();
|
||||
|
@ -61,7 +61,7 @@ bool Hotkey::DrawUI(const char* label)
|
||||
}
|
||||
|
||||
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(),
|
||||
ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
|
||||
ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight()*1.35f)))
|
||||
{
|
||||
if (!active)
|
||||
{
|
||||
|
@ -189,18 +189,26 @@ bool Ui::ListBoxCustomNames(const char* label, std::vector<std::string>& all_ite
|
||||
ImVec2 Ui::GetSize(short count, bool spacing)
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
spacing = false;
|
||||
}
|
||||
|
||||
float factor = ImGui::GetStyle().ItemSpacing.x / 2.0f;
|
||||
float x;
|
||||
|
||||
if (count == 3)
|
||||
{
|
||||
factor = ImGui::GetStyle().ItemSpacing.x / 1.403f;
|
||||
}
|
||||
|
||||
if (spacing)
|
||||
{
|
||||
x = ImGui::GetWindowContentRegionWidth() / count - factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = ImGui::GetWindowContentRegionWidth() / count;
|
||||
}
|
||||
|
||||
return ImVec2(x, ImGui::GetFrameHeight() * 1.3f);
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
----------------------------
|
||||
-- Project Generator
|
||||
-- Premake Project Generator
|
||||
----------------------------
|
||||
|
||||
-- Environment vars
|
||||
----------------------------
|
||||
-- Should get picked up automatically if you installed them properly
|
||||
PSDK_DIR = os.getenv("PLUGIN_SDK_DIR")
|
||||
DX9SDK_DIR = os.getenv("DIRECTX9_SDK_DIR")
|
||||
GTASA_DIR = "F:/GTASanAndreas"
|
||||
GTAVC_DIR = "E:/GTA Vice City"
|
||||
GTA3_DIR = "E:/GTA3"
|
||||
|
||||
if (DX9SDK_DIR == nil) then
|
||||
error("DIRECTX9_SDK_DIR environment variable not set")
|
||||
@ -16,6 +16,13 @@ end
|
||||
if (PSDK_DIR == nil) then
|
||||
error("PLUGIN_SDK_DIR environment variable not set")
|
||||
end
|
||||
|
||||
-- Build directories
|
||||
----------------------------
|
||||
GTASA_DIR = "F:/GTASanAndreas"
|
||||
GTAVC_DIR = "E:/GTA Vice City"
|
||||
GTA3_DIR = "E:/GTA3"
|
||||
|
||||
----------------------------
|
||||
|
||||
workspace "CheatMenu"
|
||||
|
Loading…
Reference in New Issue
Block a user