Fixed ImGui developer menu (#298)

Fixes the Auto Windows Opening that could cancel the menu by itself
This commit is contained in:
PurpleHato 2022-05-12 15:05:54 +02:00 committed by GitHub
parent 0adad641a6
commit e2c801a2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

View File

@ -106,7 +106,7 @@ void Console::Draw() {
if (!this->opened) return;
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
ImGui::Begin("Console", nullptr);
ImGui::Begin("Console", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
const ImVec2 pos = ImGui::GetWindowPos();
const ImVec2 size = ImGui::GetWindowSize();

View File

@ -417,6 +417,15 @@ namespace SohImGui {
}
}
void EnhancementButton(std::string text, std::string cvarName)
{
bool val = (bool)CVar_GetS32(cvarName.c_str(), 0);
if (ImGui::Button(text.c_str())) {
CVar_SetS32(cvarName.c_str(), !val);
needs_save = true;
}
}
void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format)
{
int val = CVar_GetS32(cvarName.c_str(), 0);
@ -725,10 +734,11 @@ namespace SohImGui {
if (ImGui::BeginMenu("Developer Tools"))
{
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
ImGui::Separator();
EnhancementCheckbox("Stats", "gStatsEnabled");
EnhancementCheckbox("Console", "gConsoleEnabled");
console->opened = CVar_GetS32("gConsoleEnabled", 0);
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
ImGui::EndMenu();
}
@ -745,6 +755,7 @@ namespace SohImGui {
}
ImGui::EndMenu();
}
}
ImGui::EndMenuBar();
@ -755,7 +766,7 @@ namespace SohImGui {
if (CVar_GetS32("gStatsEnabled", 0)) {
const float framerate = ImGui::GetIO().Framerate;
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_None);
ImGui::Begin("Debug Stats", nullptr, ImGuiWindowFlags_NoFocusOnAppearing);
#ifdef _WIN32
ImGui::Text("Platform: Windows");

View File

@ -97,7 +97,7 @@ void DrawColViewerWindow(bool& open) {
}
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Collision Viewer", &open)) {
if (!ImGui::Begin("Collision Viewer", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}

View File

@ -1540,7 +1540,7 @@ void DrawSaveEditor(bool& open) {
}
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Save Editor", &open)) {
if (!ImGui::Begin("Save Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}