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

45 lines
1.7 KiB
C++
Raw Normal View History

#include <imgui.h>
#include <Hotkey.h>
2023-07-30 06:14:30 +03:00
#include "camera.h"
#include "player.h"
#include "world.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
KeyBindToggle toggleKey = KeyBindToggle(KeyBind::F5);
2023-07-30 06:14:30 +03:00
bool isOpen = false;
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", &Menu::isOpen, windowFlags); {
2023-07-30 06:14:30 +03:00
if (ImGui::BeginTabBar("##MainTabBar")) {
if (ImGui::BeginTabItem("Player")) {
Menu::Player::Render();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Camera")) {
Menu::Camera::Render();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("World")) {
Menu::World::Render();
2023-07-30 06:14:30 +03:00
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::Separator();
ImGui::Hotkey("Menu Toggle Key", toggleKey);
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
}
}