2021-10-25 10:03:27 -04:00
|
|
|
#include "pch.h"
|
2022-06-29 19:56:53 -04:00
|
|
|
#include "widget.h"
|
2021-09-20 08:41:40 -04:00
|
|
|
#include "updater.h"
|
2022-01-10 12:43:09 -05:00
|
|
|
#include "d3dhook.h"
|
2022-01-20 02:04:45 -05:00
|
|
|
#include "../depend/imgui/imgui_internal.h"
|
|
|
|
#include "util.h"
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
#include "animation.h"
|
|
|
|
#include "cheatmenu.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "ped.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "teleport.h"
|
|
|
|
#include "vehicle.h"
|
|
|
|
#include "visual.h"
|
|
|
|
#include "weapon.h"
|
2022-07-30 17:57:09 -04:00
|
|
|
#include "overlay.h"
|
2022-02-21 03:33:57 -05:00
|
|
|
|
2022-07-01 04:06:34 -04:00
|
|
|
static bool DrawTitleBar()
|
|
|
|
{
|
|
|
|
bool hovered, held;
|
|
|
|
ImGuiWindow *window = ImGui::GetCurrentWindow();
|
|
|
|
ImGuiStyle& Style = ImGui::GetStyle();
|
|
|
|
ImGuiID id = window->GetID("#CLOSE");
|
|
|
|
|
|
|
|
ImGui::PushFont(FontMgr::Get("title"));
|
|
|
|
Widget::TextCentered(MENU_TITLE);
|
|
|
|
|
|
|
|
// Return now, skip drawing close btn
|
|
|
|
if (!ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
|
|
|
| ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
|
|
|
{
|
|
|
|
ImGui::PopFont();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// init draw stuff
|
|
|
|
ImVec2 rectMin = ImGui::GetItemRectMin();
|
|
|
|
float fontSize = ImGui::GetFontSize();
|
|
|
|
ImRect titleRect = window->TitleBarRect();
|
|
|
|
float framePadding = Style.FramePadding.x;
|
|
|
|
ImVec2 pos = ImVec2(titleRect.Max.x - framePadding*2 - fontSize, titleRect.Min.y);
|
|
|
|
const ImRect bb(pos, pos + ImVec2(fontSize, fontSize) + Style.FramePadding * 2.0f);
|
|
|
|
ImRect bbInteract = bb;
|
|
|
|
const float areaVisibleRatio = window->OuterRectClipped.GetArea() / bb.GetArea();
|
|
|
|
if (areaVisibleRatio < 1.5f)
|
|
|
|
{
|
|
|
|
bbInteract.Expand(ImFloor(bbInteract.GetSize() * -0.25f));
|
|
|
|
}
|
|
|
|
bool pressed = ImGui::ButtonBehavior(bbInteract, id, &hovered, &held);
|
|
|
|
|
|
|
|
// drawing close button here
|
|
|
|
float cross_extent = (fontSize * 0.3f) - 1.0f;
|
|
|
|
ImVec2 closePos = ImVec2(bb.GetCenter().x - cross_extent, rectMin.y);
|
|
|
|
ImU32 closeCol = ImGui::GetColorU32(held || hovered ? ImVec4(0.80f, 0.0f, 0.0f, 1.0f) : ImVec4(0.80f, 0.80f, 0.80f, 1.00f));
|
|
|
|
window->DrawList->AddText(closePos, closeCol, "X");
|
|
|
|
ImGui::PopFont();
|
|
|
|
|
|
|
|
return pressed;
|
|
|
|
}
|
|
|
|
|
2021-02-25 17:45:41 -05:00
|
|
|
void CheatMenu::DrawWindow()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
|
static bool bRunning = true;
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-05-08 01:36:36 -04:00
|
|
|
if (FrontEndMenuManager.m_bMenuActive)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (bRunning)
|
|
|
|
{
|
2022-06-15 06:45:43 -04:00
|
|
|
gConfig.Save();
|
2022-01-07 03:18:00 -05:00
|
|
|
bRunning = false;
|
2022-01-10 12:43:09 -05:00
|
|
|
D3dHook::SetMouseState(false);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bRunning = true;
|
2022-07-30 17:57:09 -04:00
|
|
|
if (m_bShowMenu)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
ImGui::SetNextWindowSize(m_fMenuSize);
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-07-30 17:57:09 -04:00
|
|
|
if (ImGui::Begin(MENU_TITLE, NULL, ImGuiWindowFlags_NoCollapse || ImGuiWindowFlags_NoTitleBar))
|
|
|
|
{
|
|
|
|
m_bShowMenu = !DrawTitleBar();
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(250, 350));
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
|
|
|
ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200));
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-07-30 17:57:09 -04:00
|
|
|
ProcessPages();
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-07-30 17:57:09 -04:00
|
|
|
if (m_bSizeChangedExternal)
|
|
|
|
m_bSizeChangedExternal = false;
|
|
|
|
else
|
|
|
|
m_fMenuSize = ImGui::GetWindowSize();
|
2022-01-20 02:04:45 -05:00
|
|
|
|
2022-07-30 17:57:09 -04:00
|
|
|
gConfig.Set("Window.SizeX", m_fMenuSize.x);
|
|
|
|
gConfig.Set("Window.SizeY", m_fMenuSize.y);
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2022-07-30 17:57:09 -04:00
|
|
|
ImGui::PopStyleVar(2);
|
|
|
|
ImGui::End();
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-30 17:57:09 -04:00
|
|
|
Overlay::Draw();
|
2021-02-25 17:45:41 -05:00
|
|
|
}
|
|
|
|
|
2022-01-28 08:10:56 -05:00
|
|
|
void CheatMenu::ProcessPages()
|
2022-01-20 02:04:45 -05:00
|
|
|
{
|
|
|
|
static void* pCallback;
|
2022-06-29 19:56:53 -04:00
|
|
|
ImVec2 size = Widget::CalcSize(3, false);
|
2022-01-20 02:04:45 -05:00
|
|
|
ImGuiStyle &style = ImGui::GetStyle();
|
|
|
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
|
|
|
m_nMenuPage = Updater::IsUpdateAvailable() ? eMenuPages::UPDATE : m_nMenuPage;
|
|
|
|
|
|
|
|
// Check once if it's anniversary day
|
|
|
|
static bool aniCheckDone;
|
|
|
|
if (!aniCheckDone)
|
|
|
|
{
|
|
|
|
SYSTEMTIME st;
|
|
|
|
GetSystemTime(&st);
|
|
|
|
|
|
|
|
if (st.wMonth == 3 && st.wDay == 28)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We don't want to be annoying and
|
2022-06-12 14:01:43 -04:00
|
|
|
* show anniversary screen on every game start
|
2022-01-20 02:04:45 -05:00
|
|
|
*/
|
2022-06-16 06:40:46 -04:00
|
|
|
bool flag = gConfig.Get("Window.AnniversaryShown", false);
|
2022-01-20 02:04:45 -05:00
|
|
|
|
|
|
|
if (!flag)
|
|
|
|
{
|
2022-06-16 06:40:46 -04:00
|
|
|
gConfig.Set("Window.AnniversaryShown", true);
|
2022-01-20 02:04:45 -05:00
|
|
|
m_nMenuPage = eMenuPages::ANNIVERSARY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aniCheckDone = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImDrawList *pDrawList = ImGui::GetWindowDrawList();
|
|
|
|
for (size_t i = 0; i < m_headerList.size(); ++i)
|
|
|
|
{
|
|
|
|
/*
|
2022-01-21 12:33:31 -05:00
|
|
|
* For welcome & update pages
|
2022-01-20 02:04:45 -05:00
|
|
|
* They don't need to add item in the header list
|
|
|
|
*/
|
|
|
|
if (m_headerList[i].skipHeader)
|
|
|
|
{
|
|
|
|
if (m_nMenuPage == m_headerList[i].page)
|
2022-06-12 14:01:43 -04:00
|
|
|
{
|
2022-01-20 02:04:45 -05:00
|
|
|
pCallback = m_headerList[i].pFunc;
|
2022-06-12 14:01:43 -04:00
|
|
|
}
|
2022-01-20 02:04:45 -05:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* text = m_headerList[i].name.c_str();
|
|
|
|
|
|
|
|
ImVec4 color;
|
|
|
|
if (m_headerList[i].page == m_nMenuPage)
|
|
|
|
{
|
|
|
|
color = style.Colors[ImGuiCol_ButtonActive];
|
|
|
|
pCallback = m_headerList[i].pFunc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
color = style.Colors[ImGuiCol_Button];
|
|
|
|
|
|
|
|
if (ImGui::InvisibleButton(text, size))
|
|
|
|
{
|
|
|
|
m_nMenuPage = m_headerList[i].page;
|
|
|
|
size_t curPage = static_cast<size_t>(m_headerList[i].page);
|
2022-06-16 06:40:46 -04:00
|
|
|
gConfig.Set("Window.CurrentPage", curPage);
|
2022-01-20 02:04:45 -05:00
|
|
|
pCallback = m_headerList[i].pFunc;
|
|
|
|
Updater::ResetUpdaterState();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
color = style.Colors[ImGuiCol_ButtonHovered];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Window rounding flags
|
|
|
|
* TODO: hardcoded atm
|
|
|
|
*/
|
|
|
|
ImDrawFlags flags = ImDrawFlags_RoundCornersNone;
|
|
|
|
if (i == 0) flags = ImDrawFlags_RoundCornersTopLeft;
|
|
|
|
if (i == 2) flags = ImDrawFlags_RoundCornersTopRight;
|
|
|
|
if (i == 6) flags = ImDrawFlags_RoundCornersBottomLeft;
|
|
|
|
if (i == 8) flags = ImDrawFlags_RoundCornersBottomRight;
|
|
|
|
|
|
|
|
ImVec2 min = ImGui::GetItemRectMin();
|
|
|
|
ImVec2 max = ImGui::GetItemRectMax();
|
|
|
|
ImVec2 size = ImGui::CalcTextSize(text);
|
|
|
|
pDrawList->AddRectFilled(min, max, ImGui::GetColorU32(color), style.FrameRounding, flags);
|
|
|
|
ImGui::RenderTextClipped(min + style.FramePadding, max - style.FramePadding, text, NULL, &size, style.ButtonTextAlign);
|
|
|
|
|
|
|
|
if (i % 3 != 2)
|
2022-06-12 14:01:43 -04:00
|
|
|
{
|
2022-01-20 02:04:45 -05:00
|
|
|
ImGui::SameLine();
|
2022-06-12 14:01:43 -04:00
|
|
|
}
|
2022-01-20 02:04:45 -05:00
|
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::Dummy(ImVec2(0, 10));
|
|
|
|
|
|
|
|
if (pCallback != nullptr && ImGui::BeginChild("HEADERCONTENT"))
|
|
|
|
{
|
|
|
|
static_cast<void(*)()>(pCallback)();
|
|
|
|
ImGui::EndChild();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-22 02:44:33 -05:00
|
|
|
void CheatMenu::GenHeaderList()
|
|
|
|
{
|
|
|
|
CheatMenu::m_headerList =
|
|
|
|
{
|
|
|
|
{TEXT_S("Window.TeleportPage"), &Teleport::ShowPage, eMenuPages::TELEPORT},
|
|
|
|
{TEXT_S("Window.PlayerPage"), &Player::ShowPage, eMenuPages::PLAYER},
|
|
|
|
{TEXT_S("Window.PedPage"), &Ped::ShowPage, eMenuPages::PED},
|
|
|
|
{TEXT_S("Window.AnimationPage"), &Animation::ShowPage, eMenuPages::ANIMATION},
|
|
|
|
{TEXT_S("Window.VehiclePage"), &Vehicle::ShowPage, eMenuPages::VEHICLE},
|
|
|
|
{TEXT_S("Window.WeaponPage"), &Weapon::ShowPage, eMenuPages::WEAPON},
|
|
|
|
{TEXT_S("Window.GamePage"), &Game::ShowPage, eMenuPages::GAME},
|
|
|
|
{TEXT_S("Window.VisualPage"), &Visual::ShowPage, eMenuPages::VISUAL},
|
|
|
|
{TEXT_S("Window.MenuPage"), &Menu::ShowPage, eMenuPages::MENU},
|
|
|
|
{"Welcome", &ShowWelcomePage, eMenuPages::WELCOME, true},
|
|
|
|
{"Update", &ShowUpdatePage, eMenuPages::UPDATE, true},
|
|
|
|
{"Anniversary", &ShowAnniversaryPage, eMenuPages::ANNIVERSARY, true}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
void CheatMenu::Init()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-06-16 14:44:33 -04:00
|
|
|
if (!std::filesystem::exists(PLUGIN_PATH((char*)FILE_NAME)))
|
2022-06-12 14:01:43 -04:00
|
|
|
{
|
2022-06-15 06:45:43 -04:00
|
|
|
Log::Print<eLogLevel::Error>(TEXT("Menu.CheatMenuNoDir"));
|
2022-06-12 14:01:43 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-10 12:43:09 -05:00
|
|
|
if (!D3dHook::InjectHook(DrawWindow))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2022-01-13 08:57:08 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
// Load menu settings
|
2022-06-16 06:40:46 -04:00
|
|
|
m_nMenuPage = (eMenuPages)gConfig.Get("Window.CurrentPage", (size_t)eMenuPages::WELCOME);
|
|
|
|
m_fMenuSize.x = gConfig.Get("Window.SizeX", screen::GetScreenWidth() / 4.0f);
|
|
|
|
m_fMenuSize.y = gConfig.Get("Window.SizeY", screen::GetScreenHeight() / 1.2f);
|
2022-01-07 03:18:00 -05:00
|
|
|
srand(CTimer::m_snTimeInMilliseconds);
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-03-18 03:23:43 -04:00
|
|
|
ApplyStyle();
|
2022-06-16 14:44:33 -04:00
|
|
|
Locale::Init(FILE_NAME "/locale/", "English", "English");
|
2022-03-18 03:23:43 -04:00
|
|
|
GenHeaderList();
|
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
// Init menu parts
|
|
|
|
Animation::Init();
|
|
|
|
Game::Init();
|
|
|
|
Menu::Init();
|
|
|
|
Player::Init();
|
|
|
|
Ped::Init();
|
|
|
|
Teleport::Init();
|
|
|
|
Vehicle::Init();
|
|
|
|
Visual::Init();
|
|
|
|
Weapon::Init();
|
2022-07-30 17:57:09 -04:00
|
|
|
Overlay::Init();
|
2022-02-21 03:33:57 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
Events::processScriptsEvent += []()
|
|
|
|
{
|
2022-05-08 01:36:36 -04:00
|
|
|
if (!FrontEndMenuManager.m_bMenuActive)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
if (menuOpen.Pressed())
|
|
|
|
{
|
|
|
|
m_bShowMenu = !m_bShowMenu;
|
|
|
|
}
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
if (commandWindow.Pressed())
|
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
Overlay::m_bCmdBar = !Overlay::m_bCmdBar;
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-10 12:43:09 -05:00
|
|
|
bool mouseState = D3dHook::GetMouseState();
|
|
|
|
if (mouseState != m_bShowMenu)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-01-10 12:43:09 -05:00
|
|
|
if (mouseState) // Only write when the menu closes
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-15 06:45:43 -04:00
|
|
|
gConfig.Save();
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-10 12:43:09 -05:00
|
|
|
D3dHook::SetMouseState(m_bShowMenu);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-07-06 15:11:53 -04:00
|
|
|
|
2022-07-31 21:03:25 -04:00
|
|
|
if (Teleport::IsQuickTeleportActive() && quickTeleport.PressedRealtime())
|
2022-07-06 15:11:53 -04:00
|
|
|
{
|
|
|
|
D3dHook::SetMouseState(true);
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
};
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2022-01-20 02:04:45 -05:00
|
|
|
void CheatMenu::ShowAnniversaryPage()
|
|
|
|
{
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::TextCentered("Happy Anniversary!");
|
2022-01-20 02:04:45 -05:00
|
|
|
ImGui::NewLine();
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
ImGui::TextWrapped("On this day, in 2019, the first public version of menu was released in MixMods Forum."
|
2022-02-04 00:24:50 -05:00
|
|
|
" It's been a blast working on it and I've learned a lot in the process.\n\nThanks to you and everyone who used or"
|
|
|
|
" contributed to the modification in any form or shape.");
|
|
|
|
|
2022-06-28 16:23:03 -04:00
|
|
|
ImGui::NewLine();
|
|
|
|
ImGui::TextWrapped("Feel free to star the GitHub repo or join the discord server and provide feedback, ideas, or suggestions.");
|
|
|
|
ImGui::NewLine();
|
2022-02-04 00:24:50 -05:00
|
|
|
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(3))))
|
2022-06-28 16:23:03 -04:00
|
|
|
{
|
2022-08-03 16:15:42 -04:00
|
|
|
OPEN_LINK(DISCORD_INVITE);
|
2022-06-28 16:23:03 -04:00
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Widget::CalcSize(3))))
|
2022-06-28 16:23:03 -04:00
|
|
|
{
|
2022-08-03 16:15:42 -04:00
|
|
|
OPEN_LINK(GITHUB_LINK);
|
2022-02-04 00:24:50 -05:00
|
|
|
}
|
2022-01-20 02:04:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void CheatMenu::ShowWelcomePage()
|
2022-01-04 17:33:07 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NewLine();
|
2022-01-04 17:33:07 -05:00
|
|
|
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::TextCentered(TEXT("Menu.WelcomeMSG"));
|
|
|
|
Widget::TextCentered(std::format("{}: Grinch_",TEXT("Menu.Author")));
|
2022-01-04 17:33:07 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NewLine();
|
2022-05-08 01:36:36 -04:00
|
|
|
ImGui::TextWrapped(TEXT("Menu.EnsureLatest"));
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::NewLine();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(2))))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-08-03 16:15:42 -04:00
|
|
|
OPEN_LINK(DISCORD_INVITE);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.GitHubRepo"), ImVec2(Widget::CalcSize(2))))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-08-03 16:15:42 -04:00
|
|
|
OPEN_LINK(GITHUB_LINK);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
ImGui::NewLine();
|
2022-05-08 01:36:36 -04:00
|
|
|
ImGui::TextWrapped(TEXT("Menu.BugDisclaimer"));
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Dummy(ImVec2(0, 30));
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::TextCentered(TEXT("Menu.CopyrightDisclaimer"));
|
2022-01-04 17:33:07 -05:00
|
|
|
}
|
|
|
|
|
2022-01-20 02:04:45 -05:00
|
|
|
void CheatMenu::ShowUpdatePage()
|
2022-01-04 17:33:07 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
std::string ver = Updater::GetUpdateVersion();
|
|
|
|
ImGui::Dummy(ImVec2(0, 20));
|
2022-06-29 19:56:53 -04:00
|
|
|
Widget::TextCentered(TEXT("Menu.NewVersion"));
|
|
|
|
Widget::TextCentered(std::format("{}: {}", TEXT("Menu.CurrentVersion"), MENU_VERSION));
|
|
|
|
Widget::TextCentered(TEXT("Menu.LatestVersion") + ver);
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Dummy(ImVec2(0, 10));
|
2022-05-08 01:36:36 -04:00
|
|
|
ImGui::TextWrapped(TEXT("Menu.UpdaterInfo1"));
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Dummy(ImVec2(0, 10));
|
2022-05-08 01:36:36 -04:00
|
|
|
ImGui::TextWrapped(TEXT("Menu.UpdaterInfo2"));
|
2022-01-04 17:33:07 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Dummy(ImVec2(0, 5));
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.DiscordServer"), ImVec2(Widget::CalcSize(2))))
|
2022-05-08 01:36:36 -04:00
|
|
|
{
|
2022-08-03 16:15:42 -04:00
|
|
|
OPEN_LINK(DISCORD_INVITE);
|
2022-05-08 01:36:36 -04:00
|
|
|
}
|
2022-01-04 17:33:07 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::SameLine();
|
2022-01-04 17:33:07 -05:00
|
|
|
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Menu.DownloadPage"), Widget::CalcSize(2)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" +
|
|
|
|
ver).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
}
|
2022-01-04 17:33:07 -05:00
|
|
|
}
|
|
|
|
|
2022-03-09 17:23:08 -05:00
|
|
|
bool CheatMenu::IsMenuShown()
|
|
|
|
{
|
|
|
|
return m_bShowMenu;
|
|
|
|
}
|
|
|
|
|
2021-02-24 16:54:45 -05:00
|
|
|
void CheatMenu::ApplyStyle()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGuiStyle* style = &ImGui::GetStyle();
|
|
|
|
ImVec4* colors = style->Colors;
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
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;
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
style->ChildBorderSize = 0;
|
|
|
|
style->WindowBorderSize = 0;
|
|
|
|
style->FrameBorderSize = 0;
|
|
|
|
style->TabBorderSize = 0;
|
|
|
|
style->PopupBorderSize = 0;
|
2021-10-25 10:03:27 -04:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
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);
|
2021-02-24 16:54:45 -05:00
|
|
|
}
|
2021-12-16 15:17:49 -05:00
|
|
|
|
|
|
|
void CheatMenu::ResetMenuSize()
|
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
m_fMenuSize.x = screen::GetScreenWidth() / 4.0f;
|
|
|
|
m_fMenuSize.y = screen::GetScreenHeight() / 1.2f;
|
|
|
|
m_bSizeChangedExternal = true;
|
2021-12-16 15:17:49 -05:00
|
|
|
}
|