<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro in the file management.</title>
		<link>http://www.allegro.cc/forums/view/617282</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 21 Feb 2018 21:25:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not quite understand how the location of resource files (such as pictures) is expressed?<br />For example: c / abc / img00.png and c / abc / img01.png<br />These two pictures in the same folder, but the citation is the time to write it?<br />c / abc
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (keprast)</author>
		<pubDate>Wed, 21 Feb 2018 18:17:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>// variable initialization<br />ALLEGRO_PATH *path;<br />ALLEGRO_BITMAP *image;</p><p>// get location of <br />path = al_get_standard_path ( ALLEGRO_RESOURCES_PATH ); // get location of your executable<br />al_append_path_component ( path, &quot;img&quot; );  // the folder containing your images<br />al_set_path_filename ( path, &quot;image.png&quot; );  // set the image name<br />image = al_load_bitmap ( al_path_cstr (path, ALLEGRO_NATIVE_PATH_SEP) );</p><p>// if you have only one image you can write as well (before al_load_bitmap)<br />al_set_path_filename ( path, &quot;img/image.png&quot; );
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (binary_brain)</author>
		<pubDate>Wed, 21 Feb 2018 18:34:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>@binary_brain</p><p>Thanks! <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /><br />However, the executable file location, do not need to set it?（.exe？.cpp？）</p><p>For example, I have a picture in c / abc, I need to set the file path to：<br />al_append_path_component (path, &quot;c/abc&quot;);<br />or<br />only one：<br />al_set_path_filename ( path, &quot;c/abc/image.png&quot; );</p><p>Is that right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (keprast)</author>
		<pubDate>Wed, 21 Feb 2018 19:56:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t really know what do you mean. However:</p><p>- you need the location of exacutable if you run your executable from another location than you&#39;re currently in. Providing that you have a folder &quot;./docs/c/games/_your_game_/_your_executable_&quot; than if you will be in <u>your_game</u> folder the default location will be the same as the location of executable - &quot;./img/_some_img_&quot; will become &quot;./docs/c/games/_your_game_/img/_some_img_&quot;, but if you were in ex. &quot;games&quot; folder your images simply won&#39;t load.</p><p>- al_set_path_filename ( path, &quot;img/image.png&quot; ) is kind of a trick and I cannot grant you that it will work on any supported OS.<br />It works simply because al_path_cstr will replace filename with directory and filename (it produces a simple char * (string)). However it is by no means recommended solution.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (binary_brain)</author>
		<pubDate>Wed, 21 Feb 2018 20:53:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>bb&#39;s code is what you need when the game file are stored like :<br />c:\projects\mygame\ <b>mygame.exe</b><br />c:\projects\mygame\ <b>img\image.png</b></p><p>(Here&#39;s the same code he posted, formatted for line numbers)
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="c">// variable initialization</span>
<span class="number">  2</span>ALLEGRO_PATH <span class="k3">*</span>path<span class="k2">;</span>
<span class="number">  3</span><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>image<span class="k2">;</span>
<span class="number">  4</span>
<span class="number">  5</span><span class="c">// get location of </span>
<span class="number">  6</span>path <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_get_standard_path"><span class="a">al_get_standard_path</span></a> <span class="k2">(</span> ALLEGRO_RESOURCES_PATH <span class="k2">)</span><span class="k2">;</span> <span class="c">// get location of your executable</span>
<span class="number">  7</span><a href="http://www.allegro.cc/manual/al_append_path_component"><span class="a">al_append_path_component</span></a> <span class="k2">(</span> path, <span class="s">"img"</span> <span class="k2">)</span><span class="k2">;</span> <span class="c">// the folder containing your images</span>
<span class="number">  8</span><a href="http://www.allegro.cc/manual/al_set_path_filename"><span class="a">al_set_path_filename</span></a> <span class="k2">(</span> path, <span class="s">"image.png"</span> <span class="k2">)</span><span class="k2">;</span> <span class="c">// set the image name</span>
<span class="number">  9</span>image <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a> <span class="k2">(</span> <a href="http://www.allegro.cc/manual/al_path_cstr"><span class="a">al_path_cstr</span></a> <span class="k2">(</span>path, ALLEGRO_NATIVE_PATH_SEP<span class="k2">)</span> <span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>
<span class="number"> 11</span><span class="c">// if you have only one image you can write as well (before al_load_bitmap)</span>
<span class="number"> 12</span><a href="http://www.allegro.cc/manual/al_set_path_filename"><span class="a">al_set_path_filename</span></a> <span class="k2">(</span> path, <span class="s">"img/image.png"</span> <span class="k2">)</span><span class="k2">;</span>
</div></div><p>
Beginning : path is an empty path<br />Line 6 : path is C:\projects\mygame\mygame.exe<br />Line 7 : path is C:\projects\mygame\ <b>img</b>\mygame.exe<br />Line 8 : path is c:\projects\mygame\img\ <b>image.png</b></p><p>Line 12 is a way to combine line 7 and 8, but it only works is path is the &quot;root&quot; of your game. Otherwise, it will create paths like &quot;img/img/img&quot;...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Wed, 21 Feb 2018 20:53:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So this is, I understand.<br />thank you for the help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (keprast)</author>
		<pubDate>Wed, 21 Feb 2018 21:25:09 +0000</pubDate>
	</item>
</rss>
