rs = room_speed, polygone.
Sleep(1000/room_speed) assumes ideal framerate; it pretends that no time at all was consumed between the end of that frame and the frame before.
I realize now that it should be handled instead by a timer, at the beginning of the frame. Should the frame take longer than 1/room_speed seconds, the timer would fire before its completion, harmlessly posting an event in the queue to be handled. Upon completing that frame, the event code will be received, and the next frame will fire, immediately setting the timer to 1/room_speed again. I may need to use a thread for it on Linux, but on Windows, it's simple and the best way. Meaning I'm going to make someone else do it. Maybe.
|