Add basic support of Java<->Native callbacks

Implement them for ImGuiIO::GetClipboardTextFn and ImGuiIO::SetClipboardTextFn
This commit is contained in:
SpaiR committed 2020-01-03 19:24:24 +03:00
1 parent 168c7602dd
commit 1c037e826a
9 files changed
+131 -3

No files matched your search

@@ -2,6 +2,8 @@ import imgui.ImBool;
import imgui.ImGui;
import imgui.ImGuiIO;
import imgui.ImString;
import imgui.callbacks.ImStrConsumer;
import imgui.callbacks.ImStrSupplier;
import imgui.enums.ImGuiBackendFlags;
import imgui.enums.ImGuiColorEditFlags;
import imgui.enums.ImGuiCond;
@@ -214,6 +216,20 @@ public final class ImGuiGlfwExample {
io.setMouseWheel(io.getMouseWheel() + (float) yOffset);
});
io.setSetClipboardTextFn(new ImStrConsumer() {
@Override
public void accept(final String s) {
glfwSetClipboardString(window, s);
}
});
io.setGetClipboardTextFn(new ImStrSupplier() {
@Override
public String get() {
return glfwGetClipboardString(window);
}
});
// Initialize renderer itself
imGuiGl3.init();
}