-
Notifications
You must be signed in to change notification settings - Fork 28
GDScript
Patrick Dawson edited this page Nov 19, 2024
·
6 revisions
The GDExtension offers partial bindings for GDScript, based on the official dear_bindings
. If there's an ImGui feature you want which isn't available in GDScript, please submit an issue.
Function names may differ slightly from the original C++ API. A complete list is available in the Godot editor (press F1 and search for ImGui or a method name).
Where the ImGui API uses pointers to pass a single variable by reference, the GDScript bindings use one-element arrays, similar to the progress
parameter in ResourceLoader.load_threaded_get_status
.
For example:
var mynum := [42]
func _process(_delta):
ImGui.Begin("window name")
ImGui.DragInt("my number", mynum)
ImGui.Text("number = %d" % mynum[0])
ImGui.End()
Note
When dealing with parameters like this, it's important to use an array variable, because it's the array that will be modified. This doesn't work:
# don't do this!
ImGui.DragInt("an integer", [an_integer])