Add MemoryEditorPopup function

This commit is contained in:
scawful
2025-05-10 09:43:45 -04:00
parent a2af47fd0a
commit 4b7bbfaf1c
2 changed files with 16 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include "app/gfx/snes_tile.h"
#include "imgui/imgui.h"
#include "imgui/imgui_internal.h"
#include "imgui_memory_editor.h"
template <class... Ts>
struct overloaded : Ts... {
@@ -442,5 +443,18 @@ void RenderLayout(const Layout& layout) {
}
}
void MemoryEditorPopup(const std::string& label, std::span<uint8_t> memory) {
static bool open = false;
static MemoryEditor editor;
if (ImGui::Button("View Data")) {
open = true;
}
if (open) {
ImGui::Begin(label.c_str(), &open);
editor.DrawContents(memory.data(), memory.size());
ImGui::End();
}
}
} // namespace gui
} // namespace yaze