kotlin-graphics / imgui

Bloat-free Immediate Mode Graphical User interface for JVM with minimal dependencies (rewrite of dear imgui)
MIT License
605 stars 36 forks source link

how to set open to null in java? #144

Closed gurachan closed 4 years ago

gurachan commented 4 years ago
boolean[] open = new boolean[]{false};
imgui.begin("Hello", open, 0);

in kotlin its fine to set it as null but in java .. it says ambiguous and crashing. it seems i can only set boolean ..

if I force it on runtime tho

java.lang.IllegalArgumentException: Parameter specified as non-null is null: method imgui.ImGui.begin, parameter pOpen

I just want to disable the close button. i get the idea of the closing on this

https://github.com/kotlin-graphics/imgui/blob/b7a66f442544e32f38fb8f9b8a798154031ff7ad/imgui-core/src/main/kotlin/imgui/demo/ExampleApp.kt#L114-L121

elect86 commented 4 years ago

Use fun begin(name: String, pOpen: BooleanArray?, index: Int, flags: WindowFlags) by calling it as

begin(name, close, 0, flags)

gurachan commented 4 years ago

ow thanks it works

imgui.begin("test", null,0, WindowFlag.AlwaysAutoResize.i + WindowFlag.NoResize.i)

i dint know theres another begin one

elect86 commented 4 years ago

It's not the best in terms of elegance, but it's the best compromise I could have found

If you have a better idea don't hesitate