What is the best way to get a message for each loop? I want to use the loop to update my game engine.
What is the best way to get a message for each loop? I want to use the loop to update my game engine.
What if you used a QTimer, with a short timeout? Use a connection to the timeout signal as the trigger to update your engine.
That would probably not be a good idea. The game loop should be executed at constant intervals of time and event loop doesn't guarantee anything like that. Better calculate how many iterations per second you need and use an adaptive timer to trigger the game loop (you can use QTimer::singleShot() for that if you calculate corrections to the time in each interation or you can use QObject::startTimer() if you don't want your timer to be adaptive).
Bookmarks