Hi,
I am thinking about writing a GUI (Widget) Framework based on SFML. Since the GUI would be used in plugins (dynamic libaries), I can't diretly access the main thread but have to relly on calls from outside. Because of this, I am not sure if what I have in mind works both on Win and on Mac so I wanted to ask for your opinion about it.
The main issue seems to be that events should be polled in the same thread as the window creation (Win) and in case of Mac they have to be polled on the main thread. However, I thought that the whole painting and mouse / keyboard interaction should be handled in one thread so that events / painting can't collide. What I had in mind was this:
- create a Window in the main thread on Win and Mac
- create some kind of platform dependent timer that polls events in the main thread
- push these events in event queues which are evaluated in ...
- ... a main loop thread which handles painting directly and events with the queue
What do you think, is that a reasonable thing to do or is there a better approach? My solution might be really naive since I never wrote something similar.
Cheers!