Skip to content

Commit ed3acd1

Browse files
committed
Add ImGuiOnceUponAFrame helper
1 parent b25b5d5 commit ed3acd1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package imgui;
2+
3+
/**
4+
* Helper: Execute a block of code at maximum once a frame.
5+
* Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
6+
* Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
7+
* <p>
8+
* BINDING NOTICE:
9+
* Java example: if (ImGuiOnceUponAFrame.get()) ImGui.text("This will be called only once per frame");
10+
*/
11+
public final class ImGuiOnceUponAFrame {
12+
private ImGuiOnceUponAFrame() {
13+
}
14+
15+
/*JNI
16+
#include <imgui.h>
17+
*/
18+
19+
public static native boolean get(); /*
20+
ImGuiOnceUponAFrame oaf;
21+
return (bool)oaf;
22+
*/
23+
}

0 commit comments

Comments
 (0)