<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>ALlegro Threads.</title>
		<link>http://www.allegro.cc/forums/view/613060</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 02 Aug 2013 00:04:35 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, im new around here, so first of all HELLO <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>Well, i&#39;ve been using Threads lately, and right now i wanted to create a thread that diplays the FPS in-game. but im having some issues with the flip display. yes the thread runs, but the al_flip_display(); aint working properly, or so, not showing anything on screen. <br />if you dont trust the image:</p><p>static void *thdFPS (ALLEGRO_THREAD *thr, void *param)<br />{<br />	strJuego			objJuego = <b>((strJuego</b>) param);<br />	ALLEGRO_TIMER		*timer = al_create_timer( 1.0 / objJuego.FPS );<br />	ALLEGRO_EVENT_QUEUE *eventQueue = al_create_event_queue();<br />	al_register_event_source(eventQueue, al_get_timer_event_source(timer));<br />	ALLEGRO_FONT *font24 = al_load_ttf_font(&quot;blr.ttf&quot;, 24, 0);<br />	</p><p>	float fFPSCounter = 0.0;</p><p>	al_start_timer(timer);<br />		<br />	while(!al_get_thread_should_stop(thr))<br />	{</p><p>	<br />		//al_draw_textf(font24, al_map_rgb(255, 255, 255),1, 1, 0, &quot;Frames: %i&quot;);	<br />		al_flip_display();<br />	}</p><p>in the image you can clearly see, that in debug, the flip_display have already been called, but itsnot applying, no error messega shown whatsoever... </p><p>Any ideas?! thank you greatly . surri for vad ingrish!</p><p>uuu btw, if i call the flip function in the main() function, it applies the flip without any problem. but... just once, and i dont want to use a while(). <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (undertzolkin)</author>
		<pubDate>Thu, 01 Aug 2013 13:58:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You have to use all graphics related functions in the same thread that calls all_create_display, basically. The only exception is if you use al_set_target_bitmap, but that won&#39;t work in your case because only one thread at a time can have the display target. So basically - do all drawing including the FPS counter from your main thread.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 01 Aug 2013 14:08:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey! thanks for the Quick reply!</p><p>So basically a few more questions had popped out. </p><p>1) whhats the difference between a windows thread, and a allegro thread? is the allegro thread mainly for graphical purposes?</p><p>2) if I make my allegro thread, I would need to run all graphical process from here?<br />for example , I could make 2 threads, a windows(to support all programing) and a allegr thread(to support all graphics). is this really that necesarry?</p><p>3)if, what i said  about allegro&#39;s thread only caring about graphical calls is correct. would making a windows thread, to call several graphical outputs be wrong? and vice versa.</p><p>THANK YOU SO MUCH FOR YOUR TIME and ANSWER!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (undertzolkin)</author>
		<pubDate>Thu, 01 Aug 2013 21:23:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613060/988289#target">undertzolkin</a> said:</div><div class="quote"><p>1) whhats the difference between a windows thread, and a allegro thread? is the allegro thread mainly for graphical purposes?</p></div></div><p>
Allegro&#39;s thread API is the same on all platforms. Windows threads only work on Windows.</p><p>In fact, Allegro&#39;s thread API (probably) just calls the Windows thread API anyway.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>2) if I make my allegro thread, I would need to run all graphical process from here?</p></div></div><p>
No.<br />You cannot draw to the same display from multiple threads. This is independent of how you create the thread.</p><p>You should do all your graphics operations from one thread (say, the main thread). The other threads can then do whatever they like.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>3)if, what i said about allegro&#39;s thread only caring about graphical calls is correct.</p></div></div><p>
It&#39;s not.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>would making a windows thread, to call several graphical outputs be wrong?</p></div></div><p>Yes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 01 Aug 2013 23:22:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Alright! thank you for your answers. and also thank you for taking your time, ill try different approaches n.n!</p><p>and btw, im sorry posting this in the wrong section. I just noticed it right now u.u</p><p>Thanks again <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (undertzolkin)</author>
		<pubDate>Fri, 02 Aug 2013 00:04:35 +0000</pubDate>
	</item>
</rss>
