mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-12 05:28:43 -04:00
Allow imgui windows to be toggled
This commit is contained in:
+22
-5
@@ -2,10 +2,7 @@
|
||||
#include "imgui/imgui.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <fmt/format.h>
|
||||
#include <imgui.h>
|
||||
#include <numeric>
|
||||
#include <thread>
|
||||
@@ -14,10 +11,30 @@
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
static bool ImguiHidden = false;
|
||||
|
||||
void imgui_main(const AuroraInfo *info)
|
||||
{
|
||||
DuskImguiDebugOverlay(info);
|
||||
DuskImguiProcesses();
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F1)) {
|
||||
ImguiHidden = !ImguiHidden;
|
||||
}
|
||||
|
||||
if (ImguiHidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::BeginMainMenuBar()) {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Hide UI", "F1", &ImguiHidden);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
DuskImguiDebugOverlay(info);
|
||||
DuskImguiProcesses();
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Limiter
|
||||
|
||||
@@ -66,7 +66,23 @@ static std::string BytesToString(size_t bytes)
|
||||
return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]);
|
||||
}
|
||||
|
||||
static bool DebugOverlayActive = false;
|
||||
|
||||
void DuskImguiDebugOverlay(const AuroraInfo *info) {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Debug overlay", "F3", &DebugOverlayActive);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F3)) {
|
||||
DebugOverlayActive = !DebugOverlayActive;
|
||||
}
|
||||
|
||||
if (!DebugOverlayActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration |
|
||||
ImGuiWindowFlags_AlwaysAutoResize |
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
|
||||
inline const char* MenuView = "View";
|
||||
|
||||
void DuskImguiDebugOverlay(const AuroraInfo *info);
|
||||
void DuskImguiProcesses();
|
||||
|
||||
|
||||
@@ -76,7 +76,22 @@ static int ShowCreateRequest(void* p, void*) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool Visible = false;
|
||||
|
||||
void DuskImguiProcesses() {
|
||||
if (ImGui::BeginMenu(MenuView)) {
|
||||
ImGui::MenuItem("Process management", "F2", &Visible);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_F2)) {
|
||||
Visible = !Visible;
|
||||
}
|
||||
|
||||
if (!Visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui::Begin("Processes")) {
|
||||
if (ImGui::BeginTabBar("Tabs")) {
|
||||
showTreeRecursive = true;
|
||||
@@ -102,9 +117,4 @@ void DuskImguiProcesses() {
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
/*
|
||||
bool open = true;
|
||||
ImGui::ShowDemoWindow(&open);
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user