libui-ng / libui-ng

libui-ng: a portable GUI library for C. "libui for the next generation"
https://libui-ng.github.io/libui-ng/
MIT License
580 stars 51 forks source link

Can libui be used with a window/app created with SDL, GLFW, or similar toolkits? #283

Open cblc opened 2 weeks ago

cblc commented 2 weeks ago

If the question has a positive answer, it could probably fix https://github.com/libui-ng/libui-ng/issues/79

The idea would be that you use SDL2, GLFW, or a similar toolkit, for creating graphics windows, while libui would be used just for the menu and for dialogs (ie, no controls created on the graphics window, just on dialogs and on the menu bar).

Would it be necessary to patch SDL2/GLFW/etc for getting the (platform-dependent) graphics window pointer, or the app pointer? Or it wouldn't be necessary?

IMHO, this would be a great way of having graphics windows together with a libui gui. Graphics toolkits are complex enough, support many backends (Metal, Vulkan, OpenGL, etc), and I believe it makes sense to use them rather than to implement support for graphics windows in libui-ng.

ethindp commented 2 weeks ago

For SDL2, this is trivially resolved, I think, by the SDL_GetWindowWMInfo function.

rubyFeedback commented 1 week ago

cblc wrote:

IMHO, this would be a great way of having graphics windows together with a libui gui. Graphics toolkits are complex enough, support many backends

I agree.

We have had similar suggestions in the past - more recently the HaikuOS support request by someone else, and some time ago my musings about supporting small embedded systems too. (They could need a simple GUI too.)

Note that the libui-ng fork was mostly done for solving already provided patches to libui, which was (more or less) abandoned. So I think we have to expect a slow pace for libui-ng, as it is not a full time job for any dev. Best results for addition of code I saw through pull requests by people, and cody reviewing these. (There have been comments to make code changes easier; I am not one of the core devs, so I do not know how this went; I am mostly just focusing on ruby stuff in general. C and C++ is for the really clever people.)