On 06/28/15 21:07, Martin McDonough wrote:
> I'm working on an editor for a game that uses SDL. I really want to use an SDL window and an FLTK window at the same time, but this raises an issue. Much like FLTK, I can only check for window events in SDL on the main thread. My current method to run both windows at once is to use Fl::wait and Fl::add_timeout to call the SDL_PollEvent 60 times a second, which is non-blocking.
>
> This works fine, but it seems really inelegant to me. I realize I am trying to use two systems at the same time that are intended to do exactly the thing, but I was curious if it's possible in any way to basically add a checking function to Fl::wait, so that it will return immediately whenever that function returns true/1. Or is there another, better, way this kind of thing can be done?
Normally when I see a situation of competing GUI toolkits
I split the app into separate processes and use TCP or pipes
or some form of IPC between the two processes.
It's usually a big unknown when two libraries fight over
who gets what events within the same process.
There may be other solutions, but that's what I usually try
to do first, just to avoid any unknown or potentially unknown behavior.