From ed3acd1716309d96d87841a2b1a2a0d8373b90ad Mon Sep 17 00:00:00 2001 From: SpaiR Date: Sun, 7 Jun 2020 18:26:43 +0300 Subject: [PATCH] Add ImGuiOnceUponAFrame helper --- .../main/java/imgui/ImGuiOnceUponAFrame.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 imgui-binding/src/main/java/imgui/ImGuiOnceUponAFrame.java diff --git a/imgui-binding/src/main/java/imgui/ImGuiOnceUponAFrame.java b/imgui-binding/src/main/java/imgui/ImGuiOnceUponAFrame.java new file mode 100644 index 0000000..de93a1e --- /dev/null +++ b/imgui-binding/src/main/java/imgui/ImGuiOnceUponAFrame.java @@ -0,0 +1,23 @@ +package imgui; + +/** + * Helper: Execute a block of code at maximum once a frame. + * Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. + * Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame"); + *

+ * BINDING NOTICE: + * Java example: if (ImGuiOnceUponAFrame.get()) ImGui.text("This will be called only once per frame"); + */ +public final class ImGuiOnceUponAFrame { + private ImGuiOnceUponAFrame() { + } + + /*JNI + #include + */ + + public static native boolean get(); /* + ImGuiOnceUponAFrame oaf; + return (bool)oaf; + */ +}