SpaiR / imgui-java

JNI based binding for Dear ImGui
MIT License
551 stars 90 forks source link

Wrapping existing variables with ImGui widgets #138

Open calvertdw opened 1 year ago

calvertdw commented 1 year ago

Currently, a lot of the API accepts ImFloat or float[] and the cooresponding types. It does this so ImGui can have a setter and a getter to that variable. However, the ImFloat, etc. are implemented as final class. It would be more convenient if the ImGui API instead accepted an interface instead, with get, set, etc. such that one could wrap existing variables with ImGui widgets. I believe this is frequently done in the C++ version and one of the best ways to use ImGui.

@SpaiR what do you think about this? For now I will just sync manually before and after the ImGui calls.

SpaiR commented 1 year ago

🤔 Sounds like a good idea. Can you provide an example of how the API may look?