3 ms·
Events just get put into a queue, and somewhere in the guts of the application there will be a loop that does: while (stillRunning) { event = getEventOrW
by prewett 5y ago
Events just get put into a queue, and somewhere in the guts of the application there will be a loop that does:
while (stillRunning) {
event = getEventOrWait();
// handle event
}
(In macOS this is done inside [NSApp run], but Windows and Linux make the loop explicit.)
I think the 1000 Hz you are thinking of is the accuracy of the UI timers. Since you're just calling this in a loop, not waiting for a timer to fire, you can burn through a lot of events in one timeslice. And since most systems have multiple processors, it is reasonable for your game to be running continually, especially since modern OSes frequently prioritize certain kinds of programs (and a game might request prioritization if at all possible).