[API] Include ImPlot (#56)

* Add implot submodule.

* Add implot to generateLibs

* Add _implot.h

* Add placeholder ImPlot java classes.

* Create demo window.

* Try to show the ImPlot demo in the window.

* Create ImPlot context.

* Fix final check.

* Implement ImPlotFlags.

* Implement the rest of the enums.

* Make classes final.

* Implement ImPlotContext and related methods

* Added more methods to ImPlot wrapper (mostly plot utils)

* Implement ImPlotPoint

* Implement ImPlotRange

* Switch native method to static in ImPlotPoint

* Implement ImPlotLimits

* Finish ImPlot Plot Utils bindings

* Implement more ImPlot methods (Miscellaneous)

* Implement more ImPlot methods (Legend utils/tools)

* Implement more ImPlot methods (Drag and drop utils)

* Implement more ImPlot methods (Plot tools)

* Implement more ImPlot methods (most plot items)

* Fix compile error (casting to double and not Double)

* Fix ImDrawData.getCmdListCmdBufferTextureId()

* Implement more ImPlot methods (rest of plot items)
(except for PlotImage, which is not currently supported)

* Fix ImGui binding problems due to API changes

* Adhere to style guidelines.

* Fix imguizmo submodule

* Fix API

* Implement ImPlotStyle

* Implement more ImPlot methods (Plot and Item styling)

* Implement remainder of ImPlot methods (Colormaps)

* Modify ImPlot example program

* Fix ImPlot example program bug

* ImPlot bugfixes

* Update ImPlot Demo

* Revert merge errors.

* Make the submodules the version on master.

* Fix URL/style in ExampleImPlot

* Fix merge conflicts with example ImPlot context creation

* Remove unneccesary static block for field declarations

* Revert libimgui-java64.so

* Change construction to use define (vs passing a pointer)

* Fixed memory leaks
Changed ImPlotLimits, ImPlotRange, and ImPlotPoint to extend ImGuiStructDestroyable instead of ImGuiStruct so user-created instances can be destroyed. Methods that create instances that must be destroyed manually specify this in the docs.

* Fix style violations

* Fix compile error

* Replace exception type

Co-authored-by: Perry MacMurray <perrymacmurray@gmail.com>
Co-authored-by: Perry <pmacmurray@ihmc.org>
Co-authored-by: SpaiR <klimbetoo@gmail.com>
This commit is contained in:
authored and GitHub committed 2021-06-21 16:07:16 +03:00
1 parent 2c6f52a73f
commit 92fa416657
23 files changed
+2931 -1

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
import imgui.extension.implot.ImPlot;
import imgui.extension.implot.ImPlotContext;
import imgui.flag.ImGuiCond;
import imgui.internal.ImGui;
import imgui.type.ImBoolean;
import java.awt.*;
import java.net.URI;
public class ExampleImPlot {
private static final String URL = "https://github.com/epezent/implot/tree/555ff68";
private static final ImBoolean showDemo = new ImBoolean(false);
private static final Integer[] xs = {0, 1, 2, 3, 4, 5};
private static final Integer[] ys = {0, 1, 2, 3, 4, 5};
private final static ImPlotContext IMPLOT_CONTEXT;
static {
IMPLOT_CONTEXT = ImPlot.createContext();
}
public static void show(ImBoolean showImPlotWindow) {
ImGui.setNextWindowSize(500, 400, ImGuiCond.Once);
ImGui.setNextWindowPos(ImGui.getMainViewport().getPosX() + 100, ImGui.getMainViewport().getPosY() + 100, ImGuiCond.Once);
if (ImGui.begin("ImPlot Demo", showImPlotWindow)) {
ImGui.text("This a demo for ImPlot");
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("Show ImPlot Built-In Demo", showDemo);
if (ImPlot.beginPlot("Example Plot")) {
ImPlot.plotLine("Line", xs, ys);
ImPlot.plotBars("Bars", xs, ys);
ImPlot.endPlot();
}
if (ImPlot.beginPlot("Example Scatterplot")) {
ImPlot.plotScatter("Scatter", xs, ys);
ImPlot.endPlot();
}
if (showDemo.get()) {
ImPlot.showDemoWindow(showDemo);
}
}
ImGui.end();
}
}
+6
View File
@@ -7,6 +7,7 @@ public class Extra {
private static final ImBoolean SHOW_IMNODES_DEMO_WINDOW = new ImBoolean(false);
private static final ImBoolean SHOW_IMGUI_NODE_EDITOR_DEMO_WINDOW = new ImBoolean(false);
private static final ImBoolean SHOW_DRAG_N_DROP_WINDOW = new ImBoolean(false);
private static final ImBoolean SHOW_IMPLOT_DEMO_WINDOW = new ImBoolean(false);
private static final ImBoolean SHOW_IMGUIZMO_DEMO = new ImBoolean(false);
private static final Graph GRAPH = new Graph();
@@ -17,6 +18,7 @@ public class Extra {
ImGui.checkbox("Show ImNodes Demo Window", SHOW_IMNODES_DEMO_WINDOW);
ImGui.checkbox("Show imgui-node-editor Demo Window", SHOW_IMGUI_NODE_EDITOR_DEMO_WINDOW);
ImGui.checkbox("Show Drag'N'Drop Demo Window", SHOW_DRAG_N_DROP_WINDOW);
ImGui.checkbox("Show ImPlot Demo Window", SHOW_IMPLOT_DEMO_WINDOW);
ImGui.checkbox("Show ImGuizmo Demo Window", SHOW_IMGUIZMO_DEMO);
if (SHOW_DEMO_WINDOW.get()) {
@@ -38,5 +40,9 @@ public class Extra {
if (SHOW_DRAG_N_DROP_WINDOW.get()) {
ExampleDragAndDrop.show(SHOW_DRAG_N_DROP_WINDOW);
}
if (SHOW_IMPLOT_DEMO_WINDOW.get()) {
ExampleImPlot.show(SHOW_IMPLOT_DEMO_WINDOW);
}
}
}
+2
View File
@@ -2,6 +2,8 @@ import imgui.*;
import imgui.app.Application;
import imgui.app.Configuration;
import imgui.extension.imnodes.ImNodes;
import imgui.extension.implot.ImPlot;
import imgui.extension.implot.ImPlotContext;
import imgui.flag.ImGuiConfigFlags;
import imgui.flag.ImGuiInputTextFlags;
import imgui.type.ImString;