By jlnr (dev)
Date 2017-10-21 16:33
update_interval
(both the constructor argument, and the r/w property) controls the target framerate of Gosu. However, because Gosu usually waits for a vsync each frame, higher values than 60 (or whatever your screen uses) don't work.
The vsync part is actually becoming a bit of an issue. When I first wrote Gosu, CRT screens started being replaced by TFT flatscreens which all had a 60 Hz refresh rate, and I hoped that 60 Hz would be *the* standard framerate for a long time. But I've now received issue reports on GitHub from users with 40 Hz(!) laptop screens, and many desktop screens are running at 75 Hz all the way up to 144 Hz. And some unlucky people probably run their computer at 30 Hz because their HDMI cable can't do 4K at 60 Hz etc... Gosu's model of always running at 60 FPS is sadly not flexible enough for the reality of today's screens.
If you want to work with delta time, I suggest you use a really small value for update_interval
, maybe 5, so that Gosu will max out the screen's Hz if possible. And then you measure the frame length yourself using Gosu.milliseconds
(from one update
call to the next), and move your objects accordingly.