Files
EGameTools/DL2GameOverhaulScript/source/menu/menu.cpp

36 lines
1.4 KiB
C++
Raw Normal View History

#include <Hotkey.h>
#include <imgui.h>
#include "menu.h"
2023-07-30 06:14:30 +03:00
namespace Menu {
static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
static const ImVec2 minWndSize = ImVec2(0.0f, 0.0f);
static const ImVec2 maxWndSize = ImVec2(900.0f, 675.0f);
2023-07-30 06:14:30 +03:00
KeyBindOption menuToggle = KeyBindOption(VK_F5);
float transparency = 99.0f;
2023-07-30 06:14:30 +03:00
void Render() {
ImGuiStyle* style = &ImGui::GetStyle();
style->Colors[ImGuiCol_WindowBg] = ImVec4(style->Colors[ImGuiCol_WindowBg].x, style->Colors[ImGuiCol_WindowBg].y, style->Colors[ImGuiCol_WindowBg].z, static_cast<float>(transparency) / 100.0f);
ImGui::SetNextWindowSizeConstraints(minWndSize, maxWndSize);
ImGui::Begin("EGameTools", &menuToggle.value, windowFlags); {
2023-07-30 06:14:30 +03:00
if (ImGui::BeginTabBar("##MainTabBar")) {
for (auto& tab : *MenuTab::GetInstances()) {
if (ImGui::BeginTabItem(tab.second->tabName.data())) {
tab.second->Render();
ImGui::EndTabItem();
}
2023-07-30 06:14:30 +03:00
}
ImGui::EndTabBar();
}
ImGui::Separator();
ImGui::Hotkey("Menu Toggle Key", menuToggle);
2024-01-09 02:23:28 +02:00
ImGui::SliderFloat("Menu Transparency", &transparency, 0.0f, 100.0f, "%.1f%%", ImGuiSliderFlags_AlwaysClamp);
ImGui::End();
}
2023-07-30 06:14:30 +03:00
}
}