Skip to content

v1.81.2

Compare
Choose a tag to compare
@SpaiR SpaiR released this 09 Mar 16:53

Refactored Drag & Drop API

The original Dear ImGui uses raw byte arrays as a payload data. This is fine for C++, yet unacceptable for Java.
Binding has a method setDragDropPayloadObject(), which is able to take a Java object as a payload.
Now it's the only available method and it was renamed to setDragDropPayload().

API itself was extended, so now you can pass any payload, without passing String data type.
Binding will take payload class as an identifier. For example, now you can write:

static CustomClass PAYLOAD = new CustomClass();

ImGui.setDragDropPayload(PAYLOAD);
...and later...
CustomClass payload = ImGui.acceptDragDropPayload(CustomClass.class);

Binding will do a proper typecasting automatically.