Refactor code & add stuff

This commit is contained in:
Grinch_ 2022-01-20 13:04:45 +06:00
parent fe979d413f
commit 7995ca7614
26 changed files with 246 additions and 146 deletions

View File

@ -245,7 +245,7 @@ Animation::Animation()
#endif #endif
} }
void Animation::Draw() void Animation::ShowPage()
{ {
if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) if (ImGui::BeginTabBar("Animation", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{ {

View File

@ -48,5 +48,5 @@ private:
public: public:
Animation(); Animation();
static void Draw(); static void ShowPage();
}; };

View File

@ -4,6 +4,8 @@
#include "ui.h" #include "ui.h"
#include "updater.h" #include "updater.h"
#include "d3dhook.h" #include "d3dhook.h"
#include "../depend/imgui/imgui_internal.h"
#include "util.h"
void CheatMenu::DrawWindow() void CheatMenu::DrawWindow()
{ {
@ -35,28 +37,13 @@ void CheatMenu::DrawWindow()
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200)); ImVec2(ImGui::GetWindowWidth() / 85, ImGui::GetWindowHeight() / 200));
if (Updater::IsUpdateAvailable()) ProcessMenuPages();
{
ShowUpdateScreen();
}
else
{
Ui::DrawHeaders(header);
if (Ui::m_HeaderId == -1)
{
ShowWelcomeScreen();
}
}
if (m_bSizeChangedExternal) if (m_bSizeChangedExternal)
{
m_bSizeChangedExternal = false; m_bSizeChangedExternal = false;
}
else else
{
m_fMenuSize = ImGui::GetWindowSize(); m_fMenuSize = ImGui::GetWindowSize();
}
gConfig.SetValue("window.sizeX", m_fMenuSize.x); gConfig.SetValue("window.sizeX", m_fMenuSize.x);
gConfig.SetValue("window.sizeY", m_fMenuSize.y); gConfig.SetValue("window.sizeY", m_fMenuSize.y);
@ -75,6 +62,108 @@ void CheatMenu::DrawWindow()
DrawOverlay(); DrawOverlay();
} }
void CheatMenu::ProcessMenuPages()
{
static void* pCallback;
ImVec2 size = Ui::GetSize(3, false);
ImGuiStyle &style = ImGui::GetStyle();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
ImGui::PushFont(FontMgr::GetFont("header"));
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
* show anniversary screen on every game start
*/
bool flag = gConfig.GetValue("window.anniversaryShown", false);
if (!flag)
{
gConfig.SetValue("window.anniversaryShown", true);
m_nMenuPage = eMenuPages::ANNIVERSARY;
}
}
aniCheckDone = true;
}
ImDrawList *pDrawList = ImGui::GetWindowDrawList();
for (size_t i = 0; i < m_headerList.size(); ++i)
{
/*
* For Welcome & Update pages
* They don't need to add item in the header list
*/
if (m_headerList[i].skipHeader)
{
if (m_nMenuPage == m_headerList[i].page)
pCallback = m_headerList[i].pFunc;
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);
gConfig.SetValue("window.idnum", curPage);
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)
ImGui::SameLine();
}
ImGui::PopFont();
ImGui::PopStyleVar();
ImGui::Dummy(ImVec2(0, 10));
if (pCallback != nullptr && ImGui::BeginChild("HEADERCONTENT"))
{
static_cast<void(*)()>(pCallback)();
ImGui::EndChild();
}
}
CheatMenu::CheatMenu() CheatMenu::CheatMenu()
{ {
if (!D3dHook::InjectHook(DrawWindow)) if (!D3dHook::InjectHook(DrawWindow))
@ -85,7 +174,7 @@ CheatMenu::CheatMenu()
ApplyStyle(); ApplyStyle();
// Load menu settings // Load menu settings
Ui::m_HeaderId = gConfig.GetValue("window.idnum", -1); m_nMenuPage = (eMenuPages)gConfig.GetValue("window.idnum", (size_t)eMenuPages::WELCOME);
m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f); m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f); m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
srand(CTimer::m_snTimeInMilliseconds); srand(CTimer::m_snTimeInMilliseconds);
@ -128,9 +217,79 @@ CheatMenu::~CheatMenu()
D3dHook::RemoveHook(); D3dHook::RemoveHook();
} }
void CheatMenu::ShowWelcomeScreen() /*
* YIKES YOU AREN"T SUPPOSED TO FIND THIS YOU KNOW!!!
* Probably a good easter egg for the upcoming anniversary ;)
*/
void CheatMenu::ShowAnniversaryPage()
{
Ui::CenterdText("Happy Anniversary!");
ImGui::NewLine();
ImGui::TextWrapped("On this day, in 2019, the first public version of menu was released in MixMods Forum."
" 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.");
ImGui::NewLine();
ImGui::TextWrapped("Feel free to star the GitHub repo or join the discord server and provide feedback, ideas, or suggestions.");
ImGui::NewLine();
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2))))
{
ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL);
}
ImGui::SameLine();
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(2))))
{
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
}
ImGui::NewLine();
static bool showHistory = false;
ImGui::Checkbox("Show backstory", &showHistory);
if (showHistory)
{
ImGui::BeginChild("BACKSTORY");
ImGui::TextWrapped("I wanted to share the backstory behind the initial idea or plan behind the menu."
" This is gonna be long so feel free to skip it if you're not interested.");
ImGui::NewLine();
ImGui::TextWrapped("The original idea of the menu comes way back from 2016! The inspiration for the menu"
" is from the 'CheatMenu by UNRATED69'. I wanted something that had some more features and worked with SAxVCxLC."
" But there not being any other CheatMenu's back then, I wanted to make something myself but lacked the knowledge to do so.");
ImGui::NewLine();
ImGui::TextWrapped("In 2018, I finally got an opportunity to learn CLEO or GTA3Script after Junior released"
" his tutorial. I started from basics but it soon became apparent that due to the limitations of CLEO, creating menus were"
"really tedious.");
ImGui::NewLine();
ImGui::TextWrapped("Later that year I found Moonloader, which had ImGui support. Meaning I could make menus"
" without brainfucking myself (kudos to everyone who writes 100s of lines in CLEO). I recall starting working on"
" the menu in October/November that same year.");
ImGui::NewLine();
ImGui::TextWrapped("I had high hopes the mod would succeed and the menu was nowhere near the state I wanted"
" it to be. But over a hot conversation with KKJJ, I finally decided to add the absolute bare minimum of features and"
" see what happens. And to my surprise, it even surpassed all of my expectations and became my most popular mod to this day.");
ImGui::NewLine();
ImGui::TextWrapped("A part of me is already cringing telling the story but it is what it is. I've learned"
" a lot working on this mod and I'm grateful. If you made it through all this way, kudos, you're awesome.");
ImGui::NewLine();
ImGui::TextWrapped("Again, thanks to you and everyone who used or helped me along the way. Enjoy ;)");
ImGui::EndChild();
}
}
void CheatMenu::ShowWelcomePage()
{ {
ImGui::BeginChild("WelcomeScreen");
ImGui::NewLine(); ImGui::NewLine();
Ui::CenterdText("Welcome to Cheat Menu"); Ui::CenterdText("Welcome to Cheat Menu");
@ -155,45 +314,33 @@ void CheatMenu::ShowWelcomeScreen()
ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)"); ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)");
ImGui::Dummy(ImVec2(0, 30)); ImGui::Dummy(ImVec2(0, 30));
Ui::CenterdText("Copyright Grinch_ 2019-2022. All rights reserved."); Ui::CenterdText("Copyright Grinch_ 2019-2022. All rights reserved.");
ImGui::EndChild();
} }
void CheatMenu::ShowUpdateScreen() void CheatMenu::ShowUpdatePage()
{ {
ImGui::BeginChild("UPdateScreen");
std::string ver = Updater::GetUpdateVersion(); std::string ver = Updater::GetUpdateVersion();
ImGui::Dummy(ImVec2(0, 20)); ImGui::Dummy(ImVec2(0, 20));
Ui::CenterdText("A new version of the mod is available."); Ui::CenterdText("A new version of the menu is available.");
Ui::CenterdText(std::string("Current version: ") + MENU_VERSION); Ui::CenterdText(std::string("Current version: ") + MENU_VERSION);
Ui::CenterdText("Latest version: " + ver); Ui::CenterdText("Latest version: " + ver);
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
ImGui::TextWrapped("In order to keep using the menu, you need to update to the latest version." ImGui::TextWrapped("It's highly recommanded to update to the latest version."
" This is to ensure everything is using the most up-to-date version."); " Newer versions may contain new features and bug fixes.");
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
ImGui::TextWrapped("To know what changes are made or to download, click on the \"Download page\" button." ImGui::TextWrapped("To know what changes are made or to download, click on the 'Download page' button."
" Follow the instructions there. If you're still having issues, let me know on discord."); " Follow the instructions there. If you're still having issues, let me know on discord.");
ImGui::Dummy(ImVec2(0, 5)); ImGui::Dummy(ImVec2(0, 5));
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(3)))) if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(2))))
{
ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL); ShellExecute(NULL, "open", DISCORD_INVITE, NULL, NULL, SW_SHOWNORMAL);
}
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Download page", Ui::GetSize(3))) if (ImGui::Button("Download page", Ui::GetSize(2)))
{ {
ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" + ShellExecute(NULL, "open", std::string("https://github.com/user-grinch/Cheat-Menu/releases/tag/" +
ver).c_str(), NULL, NULL, SW_SHOWNORMAL); ver).c_str(), NULL, NULL, SW_SHOWNORMAL);
} }
ImGui::SameLine();
if (ImGui::Button("Hide page", Ui::GetSize(3)))
{
Updater::ResetUpdaterState();
}
ImGui::EndChild();
} }
void CheatMenu::ApplyStyle() void CheatMenu::ApplyStyle()

View File

@ -22,21 +22,45 @@
class CheatMenu : Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon class CheatMenu : Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
{ {
private: private:
enum class eMenuPages
{
ANIMATION, ANNIVERSARY, GAME, MENU, NONE, PED, PLAYER, TELEPORT, UPDATE, VEHICLE, VISUAL, WEAPON, WELCOME
};
struct HeaderData
{
std::string name;
void *pFunc;
eMenuPages page;
bool skipHeader = false;
};
static inline eMenuPages m_nMenuPage = eMenuPages::WELCOME;
static inline bool m_bShowMenu = false; static inline bool m_bShowMenu = false;
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2); static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
static inline bool m_bSizeChangedExternal = false; static inline bool m_bSizeChangedExternal = false;
static inline CallbackTable header
{
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
{"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
};
static void ApplyStyle(); static void ApplyStyle();
static void DrawWindow(); static void DrawWindow();
static void ShowUpdateScreen(); static void ShowAnniversaryPage();
static void ShowWelcomeScreen(); static void ShowUpdatePage();
static void ShowWelcomePage();
static void ProcessMenuPages();
static inline std::vector<HeaderData> m_headerList
{
{"Teleport", &Teleport::ShowPage, eMenuPages::TELEPORT},
{"Player", &Player::ShowPage, eMenuPages::PLAYER},
{"Ped", &Ped::ShowPage, eMenuPages::PED},
{"Animation", &Animation::ShowPage, eMenuPages::ANIMATION},
{"Vehicle", &Vehicle::ShowPage, eMenuPages::VEHICLE},
{"Weapon", &Weapon::ShowPage, eMenuPages::WEAPON},
{"Game", &Game::ShowPage, eMenuPages::GAME},
{"Visual", &Visual::ShowPage, eMenuPages::VISUAL},
{"Menu", &Menu::ShowPage, eMenuPages::MENU},
{"Welcome", &ShowWelcomePage, eMenuPages::WELCOME, true},
{"Update", &ShowUpdatePage, eMenuPages::UPDATE, true},
{"Anniversary", &ShowAnniversaryPage, eMenuPages::ANNIVERSARY, true}
};
public: public:
CheatMenu(); CheatMenu();

View File

@ -63,12 +63,12 @@ void MenuThread(void* param)
// Checking for updates once a day // Checking for updates once a day
time_t now = time(0); SYSTEMTIME st;
struct tm tstruct = *localtime(&now); GetSystemTime(&st);
if (gConfig.GetValue("config.update_date", 0) != tstruct.tm_mday) if (gConfig.GetValue("config.update_date", 0) != st.wDay)
{ {
Updater::CheckUpdate(); Updater::CheckUpdate();
gConfig.SetValue("config.update_date", tstruct.tm_mday); gConfig.SetValue("config.update_date", st.wDay);
} }
while (true) while (true)

View File

@ -400,9 +400,9 @@ void Game::ClearFreecamStuff()
patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_Freecam::m_bRadarState); // radar patch::Set<BYTE>(BY_GAME(0xBA676C, 0xA10AB6, NULL), m_Freecam::m_bRadarState); // radar
#ifdef GTA3 #ifdef GTA3
CPad::GetPad(0)->m_bDisablePlayerControls = false; CPad::GetPad(0)->m_bDisablePlayerControls = false;
#else #else
CPad::GetPad(0)->DisablePlayerControls = false; CPad::GetPad(0)->DisablePlayerControls = false;
#endif #endif
Command<Commands::DELETE_CHAR>(m_Freecam::m_nPed); Command<Commands::DELETE_CHAR>(m_Freecam::m_nPed);
@ -414,7 +414,7 @@ void Game::ClearFreecamStuff()
Command<Commands::RESTORE_CAMERA_JUMPCUT>(); Command<Commands::RESTORE_CAMERA_JUMPCUT>();
} }
void Game::Draw() void Game::ShowPage()
{ {
ImGui::Spacing(); ImGui::Spacing();
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();

View File

@ -63,6 +63,6 @@ public:
static inline bool m_bSyncTime; static inline bool m_bSyncTime;
Game(); Game();
static void Draw(); static void ShowPage();
}; };

View File

@ -75,7 +75,7 @@ public:
Example: "Menu.Window.X" Example: "Menu.Window.X"
*/ */
template <typename T> template <typename T>
void SetValue(std::string&& key, T& val) void SetValue(std::string&& key, const T& val)
{ {
std::stringstream ss(key); std::stringstream ss(key);
std::string line; std::string line;
@ -100,7 +100,7 @@ public:
} }
template <> template <>
void SetValue(std::string&& key, std::string& val) void SetValue(std::string&& key, const std::string& val)
{ {
std::stringstream ss(key); std::stringstream ss(key);
std::string line; std::string line;

View File

@ -348,7 +348,7 @@ void Menu::ProcessCommands()
#endif #endif
} }
void Menu::Draw() void Menu::ShowPage()
{ {
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::Button("Reset config", ImVec2(Ui::GetSize(2)))) if (ImGui::Button("Reset config", ImVec2(Ui::GetSize(2))))

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "pch.h"
class Menu class Menu
{ {
@ -45,7 +46,7 @@ public:
}; };
Menu(); Menu();
static void Draw(); static void ShowPage();
static void DrawOverlay(); static void DrawOverlay();
static void DrawShortcutsWindow(); static void DrawShortcutsWindow();
static void ProcessCommands(); static void ProcessCommands();

View File

@ -74,7 +74,6 @@
#include "resourcestore.h" #include "resourcestore.h"
#include "fontmgr.h" #include "fontmgr.h"
using CallbackTable = std::vector<std::pair<std::string, void(*)()>>;
using namespace plugin; using namespace plugin;
enum eRenderer enum eRenderer

View File

@ -166,7 +166,7 @@ void Ped::SpawnPed(std::string& cat, std::string& name, std::string& model)
} }
} }
void Ped::Draw() void Ped::ShowPage()
{ {
if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{ {

View File

@ -59,5 +59,5 @@ public:
Ped(); Ped();
~Ped(); ~Ped();
static void Draw(); static void ShowPage();
}; };

View File

@ -360,7 +360,7 @@ void Player::ChangePlayerModel(std::string& cat, std::string& key, std::string&
} }
#endif #endif
void Player::Draw() void Player::ShowPage()
{ {
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
int hplayer = CPools::GetPedRef(pPlayer); int hplayer = CPools::GetPedRef(pPlayer);

View File

@ -53,5 +53,5 @@ private:
public: public:
Player(); Player();
static void Draw(); static void ShowPage();
}; };

View File

@ -188,7 +188,7 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
} }
} }
void Teleport::Draw() void Teleport::ShowPage()
{ {
if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{ {

View File

@ -39,5 +39,5 @@ public:
Teleport(); Teleport();
static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0, 0, 0), int interior_id = 0); static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0, 0, 0), int interior_id = 0);
static void Draw(); static void ShowPage();
}; };

View File

@ -224,75 +224,6 @@ void Ui::CenterdText(const std::string& text)
ImGui::Text(text.c_str()); ImGui::Text(text.c_str());
} }
void Ui::DrawHeaders(CallbackTable& data)
{
static void* pCallback;
ImVec2 size = GetSize(3, false);
ImGuiStyle &style = ImGui::GetStyle();
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
ImGui::PushFont(FontMgr::GetFont("header"));
ImDrawList *pDrawList = ImGui::GetWindowDrawList();
for (size_t i = 0; i < data.size(); ++i)
{
const char* btn_text = data[i].first.c_str();
ImVec4 color;
if (i == m_HeaderId)
{
color = style.Colors[ImGuiCol_ButtonActive];
pCallback = data[i].second;
}
else
{
color = style.Colors[ImGuiCol_Button];
}
if (ImGui::InvisibleButton(btn_text, size))
{
m_HeaderId = i;
gConfig.SetValue("window.idnum", m_HeaderId);
pCallback = data[i].second;
}
if (ImGui::IsItemHovered())
{
color = style.Colors[ImGuiCol_ButtonHovered];
}
// hardcoded
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(btn_text);
pDrawList->AddRectFilled(min, max, ImGui::GetColorU32(color), style.FrameRounding, flags);
ImGui::RenderTextClipped(min + style.FramePadding, max - style.FramePadding, btn_text, NULL, &size, style.ButtonTextAlign);
if (i % 3 != 2)
{
ImGui::SameLine();
}
}
ImGui::PopFont();
ImGui::PopStyleVar();
ImGui::Dummy(ImVec2(0, 10));
if (m_HeaderId != -1)
{
if (pCallback != nullptr && ImGui::BeginChild("TABSBAR"))
{
static_cast<void(*)()>(pCallback)();
ImGui::EndChild();
}
}
}
void Ui::ShowTooltip(const char* text) void Ui::ShowTooltip(const char* text)
{ {
ImGui::SameLine(); ImGui::SameLine();

View File

@ -48,7 +48,6 @@ public:
const char* hint = nullptr); const char* hint = nullptr);
static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr); static bool CheckboxBitFlag(const char* label, uint flag, const char* hint = nullptr);
static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false); static bool CheckboxWithHint(const char* label, bool* state, const char* hint = nullptr, bool is_disabled = false);
static void DrawHeaders(CallbackTable& data);
static void DrawJSON(ResourceStore& data, static void DrawJSON(ResourceStore& data,
std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_left_click,

View File

@ -19,7 +19,6 @@ public:
static void ClearCharTasksVehCheck(CPed* ped); static void ClearCharTasksVehCheck(CPed* ped);
static int GetLargestGangInZone(); static int GetLargestGangInZone();
#endif #endif
static void SetCarForwardSpeed(CVehicle *pVeh, float speed); static void SetCarForwardSpeed(CVehicle *pVeh, float speed);
static CPed* GetClosestPed(); static CPed* GetClosestPed();
static CVehicle* GetClosestVehicle(); static CVehicle* GetClosestVehicle();

View File

@ -558,7 +558,7 @@ int Vehicle::GetModelFromName(const char* name)
} }
} }
void Vehicle::Draw() void Vehicle::ShowPage()
{ {
ImGui::Spacing(); ImGui::Spacing();
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();

View File

@ -100,5 +100,5 @@ public:
#endif #endif
static std::string GetNameFromModel(int model); static std::string GetNameFromModel(int model);
static int GetModelFromName(const char* name); static int GetModelFromName(const char* name);
static void Draw(); static void ShowPage();
}; };

View File

@ -346,7 +346,7 @@ bool Visual::TimeCycColorEdit4(const char* label, T* r, T* g, T* b, T* a, ImGuiC
return rtn; return rtn;
} }
void Visual::Draw() void Visual::ShowPage()
{ {
if (ImGui::BeginTabBar("Visual", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll)) if (ImGui::BeginTabBar("Visual", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{ {

View File

@ -41,5 +41,5 @@ private:
public: public:
Visual(); Visual();
static void Draw(); static void ShowPage();
}; };

View File

@ -225,7 +225,7 @@ void Weapon::GiveWeaponToPlayer(std::string& rootkey, std::string& name, std::st
} }
#endif #endif
void Weapon::Draw() void Weapon::ShowPage()
{ {
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
uint hplayer = CPools::GetPedRef(pPlayer); uint hplayer = CPools::GetPedRef(pPlayer);

View File

@ -53,5 +53,5 @@ public:
#endif #endif
Weapon(); Weapon();
static void Draw(); static void ShowPage();
}; };