1
Window / Re: Wait for events in a real blocking way
« on: February 08, 2015, 12:28:37 am »Is there anything you have already tried/benchmarked, or are you just overthinking it?
I remember to have tried Sleep(0) on Windows and sched_yield() on Linux and they didn't work well. The "final" solution was this: https://github.com/aseprite/aseprite/blob/master/src/ui/message_loop.cpp#L35 (pretty close to what SFML does)
Anyway the CPU usage depends on the amount of work needed for the polling. I think that my case (checking some Allegro 4 structures, like an key[] array) is much worse than SFML (maybe a simple PeekMessage() and events.empty() check).
Usually, I would also answer that SFML is not the right library for such an application, and would advise to use Qt or similar. But I guess it would be hard to get that pixelated look that your application has.
Yeah. Anyway I think I'll have a hybrid solution in the future (parts of code with SFML/or other 2D library like Skia/Cinder + other native parts, e.g. Cocoa, Win32 controls, etc. Both interfaces: pixelated and native).
Thanks for your time!