Closed xiejiangzhi closed 2 years ago
I like the idea of adding support for user callbacks, but I don't think using FFI callbacks is the best approach. The callbacks are not called by imgui, but by the rendering function which is written in Lua—it doesn't make much sense to create a C function pointer of a lua function just to pass it a lua function and call it from there.
I'll look into options. I could either add a imgui.love.AddCallback function that takes Lua functions as inputs (instead of C function pointers) or do something similar to the way textures are passed to imgui.AddImage.
I added support for AddCallback. Lua functions can be passed direct;y, but FFI callbacks are also accepted. Thanks for the suggestion!
Cool, directly use Lua function is easier.
For AddCallback feature