<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>keeping track of time</title>
		<link>http://www.allegro.cc/forums/view/606052</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 13 Jan 2011 04:56:48 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does anyone know how to have it so you can keep track the time from a certain point? Like have it start at 0:00 then 0:01, 0:02, etc. I thought there would be in timer but i didnt see anything in it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Wed, 12 Jan 2011 08:24:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Set up a timer to tick once per second.</p><p>Either use its value directly or use it to monitor the current timestamp minus the timestamp you began. In Allegro 5:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">double</span> ts <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_time"><span class="a">al_get_time</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>

elapsed_time <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_time"><span class="a">al_get_time</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">-</span> ts<span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Wed, 12 Jan 2011 09:14:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It depends on whether you&#39;re using Allegro 4 or 5. If 4, then start a timer with <span class="source-code"><a href="http://www.allegro.cc/manual/install_int_ex"><span class="a">install_int_ex</span></a><span class="k2">(</span>TickerFunction , SECS_TO_TIMER<span class="k2">(</span><span class="n">1</span><span class="k2">)</span><span class="k2">)</span></span> and count the number of ticks. If 5, then use <span class="source-code"><a href="http://www.allegro.cc/manual/al_create_timer"><span class="a">al_create_timer</span></a></span>, <span class="source-code"><a href="http://www.allegro.cc/manual/al_start_timer"><span class="a">al_start_timer</span></a></span>, and <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_timer_count"><span class="a">al_get_timer_count</span></a></span>. With A5, you can also register an event source with the timer and check the events to see when the timer increments.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 12 Jan 2011 09:16:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you using AL4 or AL5?</p><p>In AL 5 you have to register your timer with the event queue, then you have to check for it in the ALLEGRO_EVENT_TIMER </p><p>if( event.timer.source == myTimer) {}</p><p>to do dynamic timers, I suggest you use a std::vector&lt;ALLEGRO_TIMER*&gt;
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Wed, 12 Jan 2011 09:18:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Matthew&#39;s method would probably prove to be the most accurate, since you don&#39;t have to worry whether your logic stutters if the computer lags. <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_time"><span class="a">al_get_time</span></a><span class="k2">(</span><span class="k2">)</span></span> will return the current time <b>now</b>, regardless of the speed of the processor.</p><p>That being said, you may also want to create a custom timer that includes the ability to pause.  You don&#39;t <b>have</b> to use the pause feature, but you don&#39;t have to reinvent any wheels as soon as you decide that you would like one. Just tell whichever time you&#39;re using to pause itself while the game is showing the menu, and then unpause itself when the game &quot;resumes&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (OnlineCop)</author>
		<pubDate>Wed, 12 Jan 2011 09:46:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>oh yeah I forgot to mention I&#39;m using allegro 4
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Wed, 12 Jan 2011 18:03:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It all depends on whether you actually want to use that time for any game logic or not. In the latter case, any method works (compare current time to starting time, one-second timer, etc). If the former (for example, a completion countdown), you want keep track of the number of elapsed logic ticks instead.</p><p>Also:
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/606052/898257#target">OnlineCop</a> said:</div><div class="quote"><p>if the computer <b>lags</b></p></div></div><p>
Stop misusing that word, people. <img src="http://www.allegro.cc/forums/smileys/angry.gif" alt="&gt;:(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 12 Jan 2011 18:19:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>its just there to keep track of long it took the player to do the mini game. then im going to save the time in a variable then send it to the fstream, so i can load it and keep track of the shortest time it took
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (shadyvillian)</author>
		<pubDate>Thu, 13 Jan 2011 04:56:48 +0000</pubDate>
	</item>
</rss>
