<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>bitmap layering</title>
		<link>http://www.allegro.cc/forums/view/612474</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 24 Apr 2013 21:28:20 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello there fellow allegroids!</p><p>I was wondering if you could clear a couple of things up for me - firstly, is there a way to chose what layer your bitmap is on, so can I set it so that a certain bitmap is shown above another which is called later on in the program? - I ask this because as part of my game half way through I clear a bitmap to transparent colour, only problem is when objects go over this space the objects are going behind the white colour instead of infront!</p><p>A second query I have is the following - Is there a way when blitting multiple of the same bitmaps to set it so that each different blit is defined to it&#39;s own value so that the you can destroy one but not the other.</p><p>For example if I was to do the following:</p><div class="source-code snippet"><div class="inner"><pre>         <a href="http://www.allegro.cc/manual/blit"><span class="a">blit</span></a><span class="k2">(</span> image, buffer, <span class="n">0</span>, <span class="n">0</span>, <span class="n">500</span>, <span class="n">200</span>, image-&gt;w, image-&gt;h <span class="k2">)</span><span class="k2">;</span>
         <a href="http://www.allegro.cc/manual/blit"><span class="a">blit</span></a><span class="k2">(</span> image, buffer, <span class="n">0</span>, <span class="n">0</span>, <span class="n">500</span>, <span class="n">400</span>, image-&gt;w, image-&gt;h <span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

and I was then to call <span class="source-code"> <a href="http://www.allegro.cc/manual/destroy_bitmap"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>image<span class="k2">)</span><span class="k2">;</span></span> both images would be destroyed.</p><p>I would like it so that they can be each individually assigned so I can do different things to them whilst using the same bitmap.</p><p>Thank you in advance and I apologise if that was a really over explained version of a simple question!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ioncherry)</author>
		<pubDate>Wed, 24 Apr 2013 06:34:02 +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/612474/981404#target">ioncherry</a> said:</div><div class="quote"><p> is there a way to chose what layer your bitmap is on, so can I set it so that a certain bitmap is shown above another which is called later on in the program?</p></div></div><p>Bitmaps are drawn in the order you call <span class="source-code"><a href="http://www.allegro.cc/manual/blit"><span class="a">blit</span></a></span>. So for that, I&#39;d implement a deferred drawing system. Instead of calling <span class="source-code"><a href="http://www.allegro.cc/manual/blit"><span class="a">blit</span></a></span> like you normally would, you&#39;d push some object representing the draw into a sorted list. Then you just iterate through the list. If your objects aren&#39;t going to be changing layers, then you won&#39;t need to update these list every tick, only when things should be removed/added.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> Is there a way when blitting multiple of the same bitmaps to set it so that each different blit is defined to it&#39;s own value so that the you can destroy one but not the other.</p></div></div><p>No... but you could load the same bitmap twice for some reason? If you want to not draw one of them, then don&#39;t draw one of them, <span class="source-code"><a href="http://www.allegro.cc/manual/destroy_bitmap"><span class="a">destroy_bitmap</span></a></span> does not erase a bitmap from the screen.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jeff Bernard)</author>
		<pubDate>Wed, 24 Apr 2013 08:23:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you for the reply,</p><p>Ahh okay - well I&#39;ve sorted the layering now so thank you!</p><p>Does this mean I&#39;m going to have to make multiple of the same bitmap files and rename them differently and blit them all seperately then if I want to do different things to them?</p><p>Cheers
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ioncherry)</author>
		<pubDate>Wed, 24 Apr 2013 17:42:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Nope. Have 1 bitmap file on your computer, and load it into as many different ALLEGRO_BITMAPS as you want!</p><div class="source-code snippet"><div class="inner"><pre>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapA <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapB <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapC <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapD <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapE <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>bitmapF <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp"><span class="a">load_bmp</span></a><span class="k2">(</span><span class="s">"myOneBitmap.bmp"</span>, NULL<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 24 Apr 2013 18:24:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Or load once and then <span class="source-code"><a href="http://www.allegro.cc/manual/al_clone_bitmap"><span class="a">al_clone_bitmap</span></a></span>...or whatever your resource management style implies. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>(Of course this post <s>and Dizzy&#39;s</s> refer(s) to Allegro5 API. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> ..gotta check beter next time).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Wed, 24 Apr 2013 19:09:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks so much guys! Dizzy got it spot on <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /> - Also thank you pkrcel - it&#39;s my fault I didn&#39;t mention that I&#39;m using allegro 4, otherwise that would of been perfect as well!! Cheers all
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ioncherry)</author>
		<pubDate>Wed, 24 Apr 2013 21:28:20 +0000</pubDate>
	</item>
</rss>
