NogginBops / ImGui.NET_OpenTK_Sample

A sample project showing an ImGui (using ImGui.NET) renderer for OpenTK in C#
109 stars 26 forks source link

Possible optimization on UpdateInguiInput Method #22

Open valentimarco opened 2 years ago

valentimarco commented 2 years ago

Hi, i am using your library for a SteamVR overlay and had trouble syncing the left mouse click from VR to the ImGui controller. After a very long troubleshooting i finded some methods from ImGuiIOPtr class that are Events: AddMouseButtonEvent,AddMousePosEvent, etc. So i think that instead of doing what you are doing, you can use this events and reduce the code! (I don't know if you are doing this only for optimization).

i apologize in advance for my bad english ;(

NogginBops commented 2 years ago

These events are parts of one of the newer versions of ImGui which wasn't released at the time I wrote this sample code. I could add something for doing event based stuff, but handling interop of delegates with unmanaged code is often messy, so it won't be less code for me.

We'll see if I decide implementing event based input code is worth it in the future.