<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Getting time between loops</title>
<description> I&amp;#039;m doing some physics programming and want to calculate displacement by distance over time rather than over loops as that can get rather messy, can I use the ticks_to_millisecs(gettime()) functions to calculate this?</description><link>http://forum.wiibrew.org/read.php?11,1923,1923#msg-1923</link><lastBuildDate>Sun, 19 Apr 2026 01:02:46 +0200</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,2045#msg-2045</guid>
<title>Re: Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,2045#msg-2045</link><description><![CDATA[ That is the main idea behind it, None of this was calcualted in the main loop, rather the first instance of old is declared in the enginers constructor and then the engine precedes to show a frame, get user input, then call another function to update the time since old has occured and then start again.]]></description>
<dc:creator>WiiPhlex</dc:creator>
<category>Coding</category><pubDate>Sat, 20 Sep 2008 08:49:10 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,2042#msg-2042</guid>
<title>Re: Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,2042#msg-2042</link><description><![CDATA[ User input should be processed in an interrupt or thread, not in the main loop. That way if the game lags and the frame rate drops, the controls remain responsive.]]></description>
<dc:creator>HyperHacker</dc:creator>
<category>Coding</category><pubDate>Sat, 20 Sep 2008 07:47:49 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,2037#msg-2037</guid>
<title>Re: Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,2037#msg-2037</link><description><![CDATA[ k well, I figured this out like a week ago, so for others who want to know here&#039;s the general idea behind it (thanks Dale)<br /><br />int old = ticks_to_millisecs(gettime())<br />while(1) {<br />showaframeandtakeuserinput();<br /><br />int new = ticks_to_millisecs(gettime())<br /><br />int elapsed = new-old;<br /><br />old=new;<br />updategamestate(elapsed);<br />}<br /><br />just divide elapsed by 1000 to get the number of seconds, that way most of the physics formula which use seconds will be much cleaner.]]></description>
<dc:creator>WiiPhlex</dc:creator>
<category>Coding</category><pubDate>Sat, 20 Sep 2008 04:07:39 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,1942#msg-1942</guid>
<title>Re: Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,1942#msg-1942</link><description><![CDATA[ cstdlib has some time functions (I think), I&#039;m not going to use loops, It&#039;s just too messy.]]></description>
<dc:creator>WiiPhlex</dc:creator>
<category>Coding</category><pubDate>Sun, 14 Sep 2008 03:57:03 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,1935#msg-1935</guid>
<title>Re: Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,1935#msg-1935</link><description><![CDATA[ I had the same problem getting my wiimote to rumble for half a second. Ended up resorting to looping.]]></description>
<dc:creator>Arikado</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Sep 2008 23:22:15 +0200</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,1923,1923#msg-1923</guid>
<title>Getting time between loops</title><link>http://forum.wiibrew.org/read.php?11,1923,1923#msg-1923</link><description><![CDATA[ I&#039;m doing some physics programming and want to calculate displacement by distance over time rather than over loops as that can get rather messy, can I use the ticks_to_millisecs(gettime()) functions to calculate this?]]></description>
<dc:creator>WiiPhlex</dc:creator>
<category>Coding</category><pubDate>Sat, 13 Sep 2008 10:11:38 +0200</pubDate></item>
</channel>
</rss>