Closed Haewen closed 4 months ago
When you're using an Array parameter that corresponds to a pointer in the original ImGui API, it's the Array itself that gets modified. So you typically want to store it as a member variable.
var win_open := [true]
func _process(delta: float) -> void:
if win_open[0]:
ImGui.Begin("a closeable window", win_open)
ImGui.End()
If you tried something like this:
# doesn't work
ImGui.Begin("a closeable window", [open_bool])
That creates a temporary array, and the bool variable is unmodified, because that's not possible.
It's a little clunky, but those are the limitations of GDScript.
Oh, that absolutely works. Never thought to check the first element of the array. Thank you!
I can't seem to find a way to make the built-in close buttons on the imgui windows usable.
It might be an issue with everything that uses the p_open parameter, as it's originally supposed to take a reference, but in the GDScript version it expects an array instead.
I can make the button show up, if I pass it an array with a
true
value in it, but even if it's a variable, it doesn't seem to get updated.