Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Add tab icons #109
Browse files Browse the repository at this point in the history
  • Loading branch information
user-grinch committed Jun 30, 2023
1 parent 79d2874 commit a237642
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 124 deletions.
14 changes: 9 additions & 5 deletions include/imgui/toggle/imgui_toggle_presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ ImGuiToggleConfig ImGuiTogglePresets::MaterialStyle(float size_scale /*= 1.0f*/)
const ImVec2 material_size(37 * size_scale, 16 * size_scale);
const float material_inset = -2.5f * size_scale;

static ImGuiTogglePalette material_palette_on;
material_palette_on.Frame = {0.9411f, 0.1961f, 0.2588f, 1.00f};
material_palette_on.FrameHover = {0.8411f, 0.1961f, 0.2588f, 1.00f};
material_palette_on.Knob = White;
material_palette_on.KnobHover = White;
static ImGuiTogglePalette material_palette_on, material_palette_off;
material_palette_on.Frame = {0.9411f, 0.1961f, 0.2588f, 1.00f}; // red
material_palette_on.FrameHover = {0.8411f, 0.1961f, 0.2588f, 1.00f}; // red
material_palette_on.Knob = {1.0f, 1.0f, 1.0f, 1.0f};
material_palette_on.KnobHover = {1.0f, 1.0f, 1.0f, 1.0f};

material_palette_off.Frame = {0.1294f, 0.1333f, 0.1764f, 1.0f};
material_palette_off.FrameHover = {0.1176f, 0.1176f, 0.1569f, 1.0f};

// setup config
ImGuiToggleConfig config;
Expand All @@ -131,6 +134,7 @@ ImGuiToggleConfig ImGuiTogglePresets::MaterialStyle(float size_scale /*= 1.0f*/)
config.On.KnobInset = config.Off.KnobInset = material_inset;
config.On.KnobOffset = config.Off.KnobOffset = ImVec2(-material_inset, 0);
config.On.Palette = &material_palette_on;
config.Off.Palette = &material_palette_off;

return config;
}
Expand Down
2 changes: 2 additions & 0 deletions resource/common/locale/English.toml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ LightIntensity = "High light min intensity"
LightShadowStrength = "Light shadow strength"
LockWeather = "Lock weather"
Minute = "Minute"
Miscellaneous = "Miscellaneous"
MoneyColor = "Money color"
MoneyFontOutline = "Money font outline"
MoneyFontStyle = "Money font style"
Expand Down Expand Up @@ -845,6 +846,7 @@ ScenePage = "Scene"
SetValue = "Set value"
SpawnTab = "Spawn"
TeleportPage = "Teleport"
ToggleTab = "Toggle"
VehiclePage = "Vehicle"
VisualPage = "Visual"
WeaponPage = "Weapon"
3 changes: 3 additions & 0 deletions src/cheatmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ void CheatMenuMgr::ApplyStyle()
style->Colors[ImGuiCol_Button] = ImColor(33, 34, 45, 255);
style->Colors[ImGuiCol_ButtonActive] = ImColor(240, 50, 66, 255);
style->Colors[ImGuiCol_ButtonHovered] = ImColor(30, 30, 40, 255);
style->Colors[ImGuiCol_ScrollbarGrab] = ImColor(33, 34, 45, 255);
style->Colors[ImGuiCol_ScrollbarGrabActive] = ImColor(240, 50, 66, 255);
style->Colors[ImGuiCol_ScrollbarGrabHovered] = ImColor(30, 30, 40, 255);
style->Colors[ImGuiCol_FrameBg] = ImColor(33, 34, 45, 255);
style->Colors[ImGuiCol_FrameBgActive] = ImColor(240, 50, 66, 255);
style->Colors[ImGuiCol_FrameBgHovered] = ImColor(30, 30, 40, 255);
Expand Down
2 changes: 1 addition & 1 deletion src/custom/customskins_sa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void CustomSkinsMgr::Draw()
{
if (m_bInit)
{
Widget::Filter(TEXT("Window.Search"), m_Filter, std::format("{}{}", TEXT("Player.TotalSkins"), m_List.size()).c_str());
Widget::Filter(TEXT_ICON(ICON_FA_MAGNIFYING_GLASS, "Window.Search"), m_Filter, std::format("{}{}", TEXT("Player.TotalSkins"), m_List.size()).c_str());
Widget::Tooltip(TEXT("Player.CustomSkinsDirTip"));
ImGui::Spacing();
ImGui::TextWrapped(TEXT("Player.CustomSkinsTip"));
Expand Down
12 changes: 6 additions & 6 deletions src/pages/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void GamePage::Draw()

if (ImGui::BeginTabBar("Game", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
if (ImGui::BeginTabItem(TEXT("Window.CheckboxTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_TOGGLE_ON, "Window.ToggleTab")))
{
ImGui::BeginChild("##Checkbox");
ImGui::Spacing();
Expand Down Expand Up @@ -372,7 +372,7 @@ void GamePage::Draw()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Window.MenusTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_BARS, "Window.MenusTab")))
{
ImGui::Spacing();
ImGui::BeginChild("##Menus");
Expand Down Expand Up @@ -605,7 +605,7 @@ void GamePage::Draw()
ImGui::EndTabItem();
}
#ifdef GTASA
if (ImGui::BeginTabItem(TEXT("Game.Freecam")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_CAMERA, "Game.Freecam")))
{
ImGui::Spacing();
bool state = Freecam.GetState();
Expand Down Expand Up @@ -736,7 +736,7 @@ void GamePage::Draw()
ImGui::EndTabItem();
}
#endif
if (ImGui::BeginTabItem(TEXT("Game.Missions")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_LIST_OL, "Game.Missions")))
{
ImGui::Spacing();

Expand Down Expand Up @@ -767,7 +767,7 @@ void GamePage::Draw()
ImGui::EndTabItem();
}
#ifdef GTASA
if (ImGui::BeginTabItem(TEXT("Game.Stats")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_BARS_STAGGERED, "Game.Stats")))
{
ImGui::Spacing();

Expand Down Expand Up @@ -800,7 +800,7 @@ void GamePage::Draw()
Widget::DataList(m_StatData, nullptr, nullptr, true);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Game.RandomCheats")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_MASKS_THEATER, "Game.RandomCheats")))
{
ImGui::Spacing();
ImGui::Columns(2, NULL, false);
Expand Down
22 changes: 11 additions & 11 deletions src/pages/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void MenuPage::Draw()
{
if (ImGui::BeginTabBar("Menu", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
if (ImGui::BeginTabItem(TEXT("Menu.Config")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_GEAR, "Menu.Config")))
{
static int selected = Locale::GetCurrentLocaleIndex();
static std::vector<std::string>& vec = Locale::GetLocaleList();
Expand Down Expand Up @@ -61,15 +61,15 @@ void MenuPage::Draw()
}

ImGui::Spacing();
if (ImGui::Button(TEXT("Menu.ResetSize"), ImVec2(Widget::CalcSize(2))))
if (ImGui::Button(TEXT("Menu.ResetSize"), ImVec2(Widget::CalcSize(1))))
{
CheatMenu.ResetParams();
}
ImGui::SameLine();
if (ImGui::Button(TEXT("Menu.ReloadFonts"), ImVec2(Widget::CalcSize(2))))
{
FontMgr::SetFontReloadRequired(true);
}
// ImGui::SameLine();
// if (ImGui::Button(TEXT("Menu.ReloadFonts"), ImVec2(Widget::CalcSize(2))))
// {
// FontMgr::SetFontReloadRequired(true);
// }

ImGui::Spacing();

Expand Down Expand Up @@ -120,7 +120,7 @@ void MenuPage::Draw()

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Menu.Overlay")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_WINDOW_RESTORE, "Menu.Overlay")))
{
ImGui::Spacing();
ImGui::Spacing();
Expand Down Expand Up @@ -207,7 +207,7 @@ void MenuPage::Draw()

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Menu.Hotkeys")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_KEYBOARD, "Menu.Hotkeys")))
{
ImGui::Spacing();
ImGui::Text(TEXT("Menu.Usage"));
Expand Down Expand Up @@ -243,7 +243,7 @@ void MenuPage::Draw()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Menu.Commands")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_TERMINAL, "Menu.Commands")))
{
if (ImGui::BeginChild("CommandsChild"))
{
Expand Down Expand Up @@ -297,7 +297,7 @@ void MenuPage::Draw()
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Menu.About")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_INFO, "Menu.About")))
{
ImGui::Spacing();

Expand Down
14 changes: 7 additions & 7 deletions src/pages/ped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static const char* pedTypeList = "Civ Male\0Civ Female\0Cop\0Leones\0Triads\0Dia
PedPage &pedPage = PedPage::Get();

PedPage::PedPage()
: IPage<PedPage>(ePageID::Ped, ICON_FA_PEOPLE_ROBBERY, true)
: IPage<PedPage>(ePageID::Ped, ICON_FA_PEOPLE_GROUP, true)
{
/*
Taken from gta chaos mod by Lordmau5 & _AG
Expand Down Expand Up @@ -254,7 +254,7 @@ void PedPage::Draw()
{
if (ImGui::BeginTabBar("Ped", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
if (ImGui::BeginTabItem(TEXT("Window.CheckboxTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_TOGGLE_ON, "Window.ToggleTab")))
{
ImGui::BeginChild("CheckboxesChild");
ImGui::Spacing();
Expand Down Expand Up @@ -302,7 +302,7 @@ void PedPage::Draw()

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Window.MenusTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_BARS, "Window.MenusTab")))
{
ImGui::Spacing();
ImGui::BeginChild("MenusChild");
Expand Down Expand Up @@ -343,13 +343,13 @@ void PedPage::Draw()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Window.SpawnTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_PEOPLE_GROUP, "Window.SpawnTab")))
{
if (ImGui::BeginTabBar("SpawnPedBar"))
{
ImGui::Spacing();

if (ImGui::BeginTabItem(TEXT("Window.Search")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_MAGNIFYING_GLASS, "Window.Search")))
{
ImGui::Spacing();
#ifdef GTASA
Expand Down Expand Up @@ -439,7 +439,7 @@ void PedPage::Draw()
ImGui::EndTabItem();
}
#ifdef GTASA
if (ImGui::BeginTabItem(TEXT("Ped.GangWars")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_PERSON_RIFLE, "Ped.GangWars")))
{
ImGui::Spacing();
if (ImGui::Button(TEXT("Ped.StartWar"), ImVec2(Widget::CalcSize(2))))
Expand Down Expand Up @@ -496,7 +496,7 @@ void PedPage::Draw()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Ped.GangModelEditor")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_PEOPLE_ARROWS, "Ped.GangModelEditor")))
{
ImGui::Spacing();
if (ImGui::Button(TEXT("Ped.ResetModels"), Widget::CalcSize(1)))
Expand Down
82 changes: 38 additions & 44 deletions src/pages/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void PlayerPage::SetCloth(std::string& name)

void PlayerPage::RemoveClothesTab()
{
if (ImGui::BeginTabItem(TEXT("Player.RemoveClothesTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_TRASH_CAN, "Player.RemoveClothesTab")))
{
ImGui::TextWrapped(TEXT("Player.ClothesTip"));
ImGui::Spacing();
Expand Down Expand Up @@ -360,7 +360,7 @@ void PlayerPage::Draw()

if (ImGui::BeginTabBar("Player", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
if (ImGui::BeginTabItem(TEXT("Window.CheckboxTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_TOGGLE_ON, "Window.ToggleTab")))
{
ImGui::BeginChild("CheckboxesChild");
ImGui::Spacing();
Expand Down Expand Up @@ -650,7 +650,7 @@ void PlayerPage::Draw()
ImGui::EndTabItem();
}

if (ImGui::BeginTabItem(TEXT("Window.MenusTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_BARS, "Window.MenusTab")))
{
ImGui::BeginChild("PlayerMenus");

Expand Down Expand Up @@ -799,58 +799,52 @@ void PlayerPage::Draw()
}

#ifdef GTASA
if (ImGui::BeginTabItem(TEXT("Player.AppearanceTab")))
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_SHIRT, "Player.ClothesTab")))
{
if (ImGui::BeginTabBar("AppearanceTabBar"))
if (pPlayer->m_nModelIndex == 0)
{
if (ImGui::BeginTabItem(TEXT("Player.ClothesTab")))
Widget::ImageList(m_ClothData, fArgWrapper(playerPage.SetCloth),
[](std::string& str)
{
if (pPlayer->m_nModelIndex == 0)
{
Widget::ImageList(m_ClothData, fArgWrapper(playerPage.SetCloth),
[](std::string& str)
{
std::stringstream ss(str);
std::string temp;
std::stringstream ss(str);
std::string temp;

getline(ss, temp, '$');
getline(ss, temp, '$');
getline(ss, temp, '$');
getline(ss, temp, '$');

return temp;
}, nullptr, nullptr, nullptr, fArgNoneWrapper(playerPage.RemoveClothesTab));
}
else
{
ImGui::TextWrapped(TEXT("Player.NeedCJSkin"));
ImGui::Spacing();
return temp;
}, nullptr, nullptr, nullptr, fArgNoneWrapper(playerPage.RemoveClothesTab));
}
else
{
ImGui::TextWrapped(TEXT("Player.NeedCJSkin"));
ImGui::Spacing();

if (ImGui::Button(TEXT("Player.ChangeToCJ"), ImVec2(Widget::CalcSize(1))))
{
pPlayer->SetModelIndex(0);
Util::ClearCharTasksCarCheck(pPlayer);
}
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Player.PedSkinsTab")))
if (ImGui::Button(TEXT("Player.ChangeToCJ"), ImVec2(Widget::CalcSize(1))))
{
Widget::ImageList(pedPage.m_PedData, fArgWrapper(playerPage.SetModel),
[](std::string& str)
{
return pedPage.m_PedData.m_pData->Get(str.c_str(), "Unknown");
});
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT("Player.CustomSkinsTab")))
{
ImGui::Spacing();
CustomSkins.Draw();
ImGui::EndTabItem();
pPlayer->SetModelIndex(0);
Util::ClearCharTasksCarCheck(pPlayer);
}
ImGui::EndTabBar();
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_PERSON_MILITARY_TO_PERSON, "Player.PedSkinsTab")))
{
Widget::ImageList(pedPage.m_PedData, fArgWrapper(playerPage.SetModel),
[](std::string& str)
{
return pedPage.m_PedData.m_pData->Get(str.c_str(), "Unknown");
});
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(TEXT_ICON(ICON_FA_FOLDER_OPEN, "Player.CustomSkinsTab")))
{
ImGui::BeginChild("AAA");
ImGui::Spacing();
CustomSkins.Draw();
ImGui::EndChild();
ImGui::EndTabItem();
}
#else
if (ImGui::BeginTabItem(TEXT("Player.SkinsTab")))
{
Expand Down
Loading

0 comments on commit a237642

Please sign in to comment.