<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Chainging timer value in the middle of my game loop</title>
		<link>http://www.allegro.cc/forums/view/615133</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 26 Feb 2015 13:06:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello!<br />My question is simple: How can i change my game loop&#39;s one ( or more of the timer i use ) without getting out of the game loop?</p><p>I was thinking of something like this:</p><p>if(ShouldChangeTimer){<br />al_stop_timer(timer);<br />al_destroy_timer(timer);<br />timer=al_create_timer(NewTimerValue);<br />al_start_timer(timer);<br />}</p><p>But do i need to unregister and register the event source once the timer has changed?<br />Something like:</p><p>if(ShouldChangeTimer){<br />al_stop_timer(timer);<br />al_unregister_event_source(event_queue,al_get_timer_event_source(timer));<br />al_destroy_timer(timer);<br />timer=al_create_timer(NewTimerValue);<br />al_register_event_source(event_queue,al_get_timer_event_source(timer));<br />al_start_timer(timer);<br />}</p><p>Is this the correct way to change a timer in the middle of my game? What do you suggest for chainging timer values?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeachMeHowToPro)</author>
		<pubDate>Thu, 26 Feb 2015 12:54:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_set_timer_speed"><span class="a">al_set_timer_speed</span></a></span> will do what you want.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 26 Feb 2015 13:06:09 +0000</pubDate>
	</item>
</rss>
