<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>how to display file_select_ex on a BITMAP</title>
		<link>http://www.allegro.cc/forums/view/588404</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 07 Nov 2006 12:19:08 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>hi,</p><p>     Sorry for repeating this question.</p><p>      I want to display the file choosing element using file_select_ex on a bitmap that is refreshed indefinitely until a user selection.</p><p>       When i using it, it comes in a new blank window. Pls help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Mon, 06 Nov 2006 21:00:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Show your current code, please.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Mon, 06 Nov 2006 22:15:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>sorry for the delay. I had to go.</p><p>char fname[480]= &quot;C:/Dir&quot;;<br /> while(1)<br />    {<br />            <br />           draw_sprite(screen, buffer, 0, 0);<br />           draw_sprite(buffer, opening,0,0);<br />          <br />           // some other images here<br />           <br />           ret = file_select_ex(&quot;Please pick a file&quot;, fname, &quot;PCX;GIF&quot;, PATH_MAX, 200, 100);<br />           if(ret)<br />           {<br />               // some function calls<br />               break;<br />           } <br />           // some other code</p><p> <br />    }
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Tue, 07 Nov 2006 10:05:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try swapping the order of these two lines:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/draw_sprite" target="_blank"><span class="a">draw_sprite</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, buffer, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/draw_sprite" target="_blank"><span class="a">draw_sprite</span></a><span class="k2">(</span>buffer, opening,<span class="n">0</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

At the moment, you&#39;re blitting the buffer to the screen before you blit your sprite to the buffer.</p><p>edit:</p><p>Oh, and for compatibilty reasons, you shouldn&#39;t used fixed pathnames like &quot;c:/dir&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 07 Nov 2006 10:41:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can you please expand on what&#39;s happening in your program.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
When i using it, it comes in a new blank window. Pls help.
</p></div></div><p>
Do you mean your screen is just blank, or the File select menu is blank?<br />Right now from my knowledge you are drawing a blank buffer onto the screen, then drawing a blank opening bitmap onto buffer.  (Both which will draw nothing to the screen)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Dalrymple)</author>
		<pubDate>Tue, 07 Nov 2006 10:43:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>a blank screen (black background) with only file select box appears also it does not enable the particular element to choose drives(c: ,d:, etc).</p><p> I think the drawing on the buffer is the bone of contention. I draw a image on the whole screen and then put the file selection box on it (that image is refreshed infinitely). Here &quot;opening&quot; is that image. it is of full screen size(800,600).</p><p> I&#39;m probably confused with the images. I usually draw a full screen image on the screen as u can see in code. Then draw other images on the buffer like</p><p>draw_sprite(buffer, classic, 180, 230);</p><p>I display the file select box after the above statement.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Tue, 07 Nov 2006 10:50:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try what LennyLen suggested and see what happens.  About the path names, changing <span class="source-code"><span class="k1">char</span> fname<span class="k2">[</span><span class="n">480</span><span class="k2">]</span><span class="k3">=</span> <span class="s">"C:/Dir"</span><span class="k2">;</span></span> to <span class="source-code"><span class="k1">char</span> fname<span class="k2">[</span><span class="n">480</span><span class="k2">]</span><span class="k3">=</span> <span class="s">""</span><span class="k2">;</span></span> will give you your current directory.  From there you can use relative pathnames to get to your resource folder.  This way you can pack up and move your project without having to fix fname.<br />Example: <span class="source-code"> <span class="k1">char</span> fname<span class="k2">[</span><span class="n">480</span><span class="k2">]</span><span class="k3">=</span> <span class="s">"resources\\"</span><span class="k2">;</span></span><br />Also suggesting you use backslashes instead of your forward slash method.  As I believe forward slashes are a Windows only directory method.</p><p>EDIT:  Ohh tag before your tag :-P
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Dalrymple)</author>
		<pubDate>Tue, 07 Nov 2006 10:56:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think the drawing on the buffer is the bone of contention. I draw a image on the whole screen and then put the file selection box on it (that image is refreshed infinitely). Here &quot;opening&quot; is that image. it is of full screen size(800,600).
</p></div></div><p>

Well, as both Matthew and I have already pointed out, this actually isn&#39;t what you are doing. Or rather you are doing it incorrectly.</p><p>edit: It seems Matthew and I are playing tag. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 07 Nov 2006 11:00:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok len,</p><p>       I&#39;ll try what u&#39;ve said. I&#39;ve got another doubt.</p><p>       How to display variable sized windows.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Tue, 07 Nov 2006 11:04:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>file_select and file_select_ex are blocking. You can&#39;t put them on top of animated backgrounds since the function won&#39;t return until a selection is made.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Tue, 07 Nov 2006 11:11:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Also suggesting you use backslashes instead of your forward slash method. As I believe forward slashes are a Windows only directory method.
</p></div></div><p>

Better still, use <a href="http://www.allegro.cc/manual/api/file-and-compression-routines/fix_filename_slashes">fix_filename_slashes()</a>, to convert filenames to the correct format on all platforms supported by Allegro.</p><p>edit: Oh, and it&#39;s DOS/Windows that use backslashes.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
How to display variable sized windows.
</p></div></div><p>

This isn&#39;t possible using Allegro alone, and you won&#39;t be able to find a cross-platform method of doing it (to my knowledge).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 07 Nov 2006 11:16:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>len,</p><p>   what is openGL? Is it more sophisticated than allegro in doing things.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Tue, 07 Nov 2006 11:18:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is this the jist of what you&#39;re trying to do?<br />Draws the selected image to the screen, and then asks for a new one?
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k1">int</span> ret<span class="k2">;</span></td></tr><tr><td class="number">2</td><td><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> buffer<span class="k2">;</span></td></tr><tr><td class="number">3</td><td>buffer <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span><span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">4</td><td><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> opening<span class="k2">;</span></td></tr><tr><td class="number">5</td><td><a href="http://www.allegro.cc/manual/PALETTE" target="_blank"><span class="a">PALETTE</span></a> palette<span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k1">char</span> fname<span class="k2">[</span><span class="n">480</span><span class="k2">]</span><span class="k3">=</span> <span class="s">"resources/"</span><span class="k2">;</span></td></tr><tr><td class="number">7</td><td><span class="k1">while</span><span class="k2">(</span><span class="n">1</span><span class="k2">)</span></td></tr><tr><td class="number">8</td><td><span class="k2">{</span></td></tr><tr><td class="number">9</td><td>     ret <span class="k3">=</span> <a href="http://www.allegro.cc/manual/file_select_ex" target="_blank"><span class="a">file_select_ex</span></a><span class="k2">(</span><span class="s">"Please pick a file"</span>, fname, <span class="s">"BMP"</span>, PATH_MAX, <span class="n">200</span>, <span class="n">100</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>     <span class="k1">if</span><span class="k2">(</span>ret<span class="k2">)</span></td></tr><tr><td class="number">11</td><td>     <span class="k2">{</span></td></tr><tr><td class="number">12</td><td>          opening <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bitmap" target="_blank"><span class="a">load_bitmap</span></a><span class="k2">(</span>fname, palette<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>     <span class="k2">}</span></td></tr><tr><td class="number">14</td><td>     <span class="k1">else</span></td></tr><tr><td class="number">15</td><td>     <span class="k2">{</span></td></tr><tr><td class="number">16</td><td>          <span class="k1">break</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>     <span class="k2">}</span></td></tr><tr><td class="number">18</td><td>     <a href="http://www.allegro.cc/manual/draw_sprite" target="_blank"><span class="a">draw_sprite</span></a><span class="k2">(</span>buffer, opening, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>     <a href="http://www.allegro.cc/manual/draw_sprite" target="_blank"><span class="a">draw_sprite</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, buffer, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Dalrymple)</author>
		<pubDate>Tue, 07 Nov 2006 11:22:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
what is openGL?
</p></div></div><p>

OpenGL is a cross-platform graphics API. It&#39;s mainly used for 3D graphics, but can be used for 2D as well.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Is it more sophisticated than allegro in doing things.
</p></div></div><p>

I&#39;ve never used it myself, but I really doubt it has functions like file_select_ex(). <a href="http://sourceforge.net/projects/openlayer">OpenLayer</a>, which is an extension to Allegro that exposes OGL possibly does though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 07 Nov 2006 11:25:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OpenGL is graphics only, and pretty complicated. Stick with Allegro for now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Tue, 07 Nov 2006 11:51:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Matthew,</p><p>        it is not that &quot;opening&quot; is the image to be loaded.</p><p>        But, it is full screen image(800*600) that is drawn on the screen buffer.</p><p>        file_select box is to be drawn on that image.</p><p>        when the file_select returns, I&#39;ll use another bitmap to load the selected image.</p><p>        I think u understand the problem in my code now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (raja peter)</author>
		<pubDate>Tue, 07 Nov 2006 12:19:08 +0000</pubDate>
	</item>
</rss>
