<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>How to use acquire_bitmap</title>
		<link>http://www.allegro.cc/forums/view/588297</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 31 Oct 2006 20:26:47 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do you use the acquire_bitmap function so that it improves your gamespeed? <br />I&#39;m currently just putting acquire_bitmap int the beginning of my main draw loop, is that the best way?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Sylvarant)</author>
		<pubDate>Tue, 31 Oct 2006 19:12:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Adriaan Larmuseau said:</div><div class="quote"><p>
I&#39;m currently just putting acquire_bitmap int the beginning of my main draw loop, is that the best way?
</p></div></div><p>

</p><div class="quote_container"><div class="title">The Allegro Manual said:</div><div class="quote"><p>
These calls are not strictly required, because the drawing routines will automatically acquire the bitmap before accessing it, but locking a DirectDraw surface is very slow, <b>so you will get much better performance if you acquire the screen just once at the start of your main redraw function, and only release it when the drawing is completely finished.</b>
</p></div></div><p>
 </p><p>edit:</p><p>some pseudo-code:
</p><div class="source-code snippet"><div class="inner"><pre>While <span class="k2">(</span>game <span class="k1">not</span> over<span class="k2">)</span> <span class="k2">{</span>
    
    <span class="k1">do</span> logic<span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/acquire_bitmap" target="_blank"><span class="a">acquire_bitmap</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <span class="k1">do</span> drawing<span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/release_bitmap" target="_blank"><span class="a">release_bitmap</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>

<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 31 Oct 2006 19:24:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>note the acquiring the screen or a video bitmap will cause input and timers to stop temporarilly. The only thing you should have between acquire_bitmap and release_bitmap is code to draw to that bitmap (and even then, it&#39;s only beneficial if you do more than one drawing operation at a time; so doing it just to blit to the screen is wasteful).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Tue, 31 Oct 2006 20:26:47 +0000</pubDate>
	</item>
</rss>
