[API] Memory editor extension (#110)
* Working on memory editor bindings for SpaiR/imgui-java#109 * Initial working implementation * Add mising entry for imgui_club in .gitmodules * Sorry, fixing readme link type and description for memory editor. * Rename .club package to .memedit * Rename _club.h to _memedit.h
This commit is contained in:
1 parent
9a5a1d2757
commit
fefac80157
9 files changed
+251
-1
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import imgui.extension.memedit.MemoryEditor;
|
||||
import imgui.flag.ImGuiCond;
|
||||
import imgui.internal.ImGui;
|
||||
import imgui.type.ImBoolean;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import java.awt.*;
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class ExampleImGuiMemoryEditor {
|
||||
private static final String URL = "https://github.com/ocornut/imgui_club";
|
||||
private static ByteBuffer demoData;
|
||||
private static MemoryEditor memoryEditor;
|
||||
private static ImBoolean showingMemoryEditor = new ImBoolean(false);
|
||||
|
||||
static {
|
||||
demoData = MemoryUtil.memASCII("Welcome to the demo for Dear ImGui Memory Editor." +
|
||||
"\n The git repo is located at " + URL + "." +
|
||||
"You can use this memory editor to view the raw memory values at some pointer location.");
|
||||
|
||||
memoryEditor = new MemoryEditor();
|
||||
}
|
||||
|
||||
public static void show(ImBoolean showImGuiMemoryEditor) {
|
||||
ImGui.setNextWindowSize(400, 200, ImGuiCond.Once);
|
||||
ImGui.setNextWindowPos(ImGui.getMainViewport().getPosX() + 100, ImGui.getMainViewport().getPosY() + 100, ImGuiCond.Once);
|
||||
if (ImGui.begin("ImGuiMemoryEditor Demo", showImGuiMemoryEditor)) {
|
||||
ImGui.text("This a demo for ImGui MemoryEditor");
|
||||
|
||||
ImGui.alignTextToFramePadding();
|
||||
ImGui.text("Repo:");
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(URL)) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(URL));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ImGui.checkbox("Memory Editor", showingMemoryEditor);
|
||||
if (showingMemoryEditor.get()) {
|
||||
memoryEditor.drawWindow("Example Data", MemoryUtil.memAddress(demoData), demoData.capacity());
|
||||
}
|
||||
}
|
||||
ImGui.end();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user