<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Using 2 buffers</title>
		<link>http://www.allegro.cc/forums/view/590479</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 11 Mar 2007 06:42:19 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>hey, im  creating a pong clone</p><p>and for my menus im using guichan gui engine</p><p>ok so i have a main menu, options button and start game button</p><p>i have 2 pointers to container types</p><p>Container *top;</p><p>and</p><p>Container *top2;</p><p>and i have three 2 buffers...</p><p>the screen bufer, and the bg buffer</p><p>BITMAP *buffer;<br />BITMAP *bg; <i>*A backgroud image of stars for menus*</i></p><p>for guichan i have graphics pointing to the bg bitmap for drawing widgets</p><p>so in the options menu, i have gui-&gt;setTop(top); then the while  loop, insdie while loop is the code like the menu and buttons</p><p>anyway at the end of the while loop i have</p><div class="source-code snippet"><div class="inner"><pre>gui-&gt;draw<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>


<a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a><span class="k2">(</span>buffer2,bg,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>bg,buffer,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>buffer,<a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

and i have a button in this options menu, called back to main, in which if its pressed i return a value for the choice engine, which returns back to main menu</p><p>and for the start button code, when user presss start button</p><p>i do everything accordingly</p><p>so i </p><p>gui-&gt;setTop(top2);</p><p>before i go into while loop</p><p>which is the code for some more choices</p><p>at the end of this loop i have</p><div class="source-code snippet"><div class="inner"><pre> gui-&gt;draw<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>


    <a href="http://www.allegro.cc/manual/masked_blit" target="_blank"><span class="a">masked_blit</span></a><span class="k2">(</span>buffer2,bg,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>bg,buffer,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>buffer,<a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">0</span>,<span class="n">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

now if i go to options menu then click back to main then click start game the widgets from options menu is still showing</p><p>i tried putting clear_bitmap(buffer2) before gui-&gt;setTop(top2); but theres probs with that</p><p>how am i suposed to handle doing diferent widgets for different menus</p><p>i need to clear bg so the widgets wont show anymore, but it really doesn&#39;t work that well</p><p>pls help...if you want me to post my code i can, just ask me</p><p>but i kinda wanna do it myself, just wanted to know what the heck was wrong
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Money)</author>
		<pubDate>Sat, 10 Mar 2007 11:34:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
i tried putting clear_bitmap(buffer2) before gui-&gt;setTop(top2); but theres probs with that
</p></div></div><p>

In that case, you should go with that and solve those other problems instead.</p><p>What&#39;s likely going on is that buffer2 is retaining everything you&#39;ve drawn to it, so when you leave the options menu, everything that was drawn by it remains.</p><p>.<i>Any</i> solution you come up with will require you to redraw certain things that would&#39;ve been erased either by the elements drawn by the options menu, or erased calling clear_bitmap() on buffer2.</p><p>--- Kris Asick (Gemini)<br />--- <a href="http://www.pixelships.com">http://www.pixelships.com</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kris Asick)</author>
		<pubDate>Sun, 11 Mar 2007 06:42:19 +0000</pubDate>
	</item>
</rss>
