Add MemoryEditorPopup function
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include "app/gfx/snes_tile.h"
|
#include "app/gfx/snes_tile.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
#include "imgui/imgui_internal.h"
|
#include "imgui/imgui_internal.h"
|
||||||
|
#include "imgui_memory_editor.h"
|
||||||
|
|
||||||
template <class... Ts>
|
template <class... Ts>
|
||||||
struct overloaded : 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 gui
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ struct Layout {
|
|||||||
|
|
||||||
void RenderLayout(const Layout &layout);
|
void RenderLayout(const Layout &layout);
|
||||||
|
|
||||||
|
void MemoryEditorPopup(const std::string &label, std::span<uint8_t> memory);
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user