Fire bullets example
-
Thank you for this post.
-
[quote author="xsacha" date="1291475228"]I can see this being used in one of those 2D tower games.
I'm just wondering: shouldn't the timer be (less than?) 1/refresh rate rather than just 0.01s. To save unnecessary calculations and possibly remove tearing.[/quote]
Which is the game you are referring to? Is the code available.
-
Oh it's a classic game, repeated everywhere. I'm talking about Tower Defence.
Here's an opensource Qt version: http://gitorious.org/open-tower-defence
-
[quote author="xsacha" date="1291476247"]Oh it's a classic game, repeated everywhere. I'm talking about Tower Defence.
Here's an opensource Qt version: http://gitorious.org/open-tower-defence[/quote]
Thank you for the link. I was not aware of this.
-
[quote author="xsacha" date="1291475228"]I'm just wondering: shouldn't the timer be (less than?) 1/refresh rate rather than just 0.01s. To save unnecessary calculations and possibly remove tearing.[/quote]
Yes, you are right.
How do you retrieve the refresh rate with Qt ? -
Avoiding tearing in Qt by sticking with the screens refresh rate is discussed by Gunnar "here":http://labs.qt.nokia.com/2010/12/02/velvet-and-the-qml-scene-graph/
-
I read that post when it came out but it doesn't really explain the code behind it. I guess it's in the repository, but that's a fair bit of reading.
That blog was more about 'what not to do' really.I would be interested in finding out how to discover refresh rate in Qt. Is there something in Qt for system information?
Obviously using 16.66ms wasn't working in that QML Scene Graph example ;).