<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Some questions</title>
		<link>http://www.allegro.cc/forums/view/553549</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 18 Dec 2005 04:32:30 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>OK, I have prepared some questions which all have something to do with the new release of Snake 256 (available under arcade\snakes under allegro.cc):</p><p>1. Do you know where to find some music and/or sound effects(screaming, ...) which fit to the game?<br />2. On (SuSE) Linux the game creates and reads the configuration file at/from /root.<br />If I start it in a console it does that in the working dir. Is there a way to make the game create it always in the directory of the game?<br />3. I compiled Allegro under SuSE Linux, will the game run on all other Linux systems, too?<br />4. Can I somehow replace Allegro&#39;s (hardware accelerated) circle function without having to recompile Allegro? If I have to, is that legal?<br />5. Is there a (very very) simple network library for Allegro which supports Linux and Windows and perhaps even both crossed (i.e. connect a Linux system with a Windows one)?</p><p>Thanks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (psycho)</author>
		<pubDate>Sat, 17 Dec 2005 21:32:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>1) You can always try <a href="http://www.modarchive.com">http://www.modarchive.com</a>. I would use Google if I were you.<br />2) Use the forum search! This has been discussed many times (<a href="http://www.allegro.cc/forums/thread/246330">this thread</a> for example)<br />3) If the executable is statically linked with Allegro and doesn&#39;t use any other external libraries, maybe...<br />4) Why replacing? Write your own function! To answer your question: No, Yes<br />5) I haven&#39;t used it yet, but <a href="http://enet.bespin.org/">enet</a> could be your choice. <a href="http://www.hawksoft.com/hawknl/">HawkNL</a> is also great, but maybe a bit too low-level for your purpose.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Simon Parzer)</author>
		<pubDate>Sat, 17 Dec 2005 22:46:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>1. Use the mighty google. There are tons of free music tracks and samples out there; whether they suit your needs and quality standards, is a different issue though.<br />2. get_executable_name()<br />3. For Linux, a source distribution is generally preferred (and why wouldn&#39;t you?)<br />4. You cannot replace it, but you can use your own function instead. But what&#39;s wrong with the allegro one? (It&#39;s not hw-accelerated btw, just some assembly iirc). Whatever you do is probably legal; allegro has one of the most liberal licenses I know of.<br />5. There are a few networking libraries available through allegro.cc. If you choose one that supports both linux and windows, and manage to get the two systems to connect through the same protocol, there is no reason why the two versions wouldn&#39;t be able to work together. Just don&#39;t do anything stupid like posting raw struct memory over the network.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sun, 18 Dec 2005 01:10:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
2. On (SuSE) Linux the game creates and reads the configuration file at/from /root.<br />If I start it in a console it does that in the working dir. Is there a way to make the game create it always in the directory of the game?
</p></div></div><p>

<img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /> <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /></p><p>It&#39;s generally considered as bad practice to create config files in another dir than /etc for system-wide config files and /home/&lt;username&gt; for user config files.</p><p>Also, on recent Windows systems you should NOT write your config files to the program&#39;s directory. When Vista (the new Windows version) will be released, you will have troubles if you ignore this advice.</p><p>I have solved the problem the way that I usually create a config file directory where all config files are written to.</p><p>My function for getting the path for the config files:</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>std::string als::get_options_path<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> progname<span class="k2">)</span></td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td><span class="p">#ifdef ALLEGRO_WINDOWS</span></td></tr><tr><td class="number">4</td><td>  <span class="c">// APPDATA is the environment variable on NT systems which points to the</span></td></tr><tr><td class="number">5</td><td>  <span class="c">// directory where programs should put their options</span></td></tr><tr><td class="number">6</td><td>  <span class="k1">if</span> <span class="k2">(</span>directory_exists<span class="k2">(</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_392.html" target="_blank">getenv</a><span class="k2">(</span><span class="s">"APPDATA"</span><span class="k2">)</span><span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">7</td><td>    <span class="k1">return</span> slashed<span class="k2">(</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_392.html" target="_blank">getenv</a><span class="k2">(</span><span class="s">"APPDATA"</span><span class="k2">)</span><span class="k2">)</span> <span class="k3">+</span> progname <span class="k3">+</span> <span class="s">'\\'</span><span class="k2">;</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>  <span class="c">// if APPDATA doesn't exist, put the options in the executable directory</span></td></tr><tr><td class="number">10</td><td>  <span class="k1">return</span> als::get_bin_path<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td><span class="p">#else</span></td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td>  <span class="c">// return the options path on Unix/Linux systems</span></td></tr><tr><td class="number">14</td><td>  <span class="k1">return</span> slashed<span class="k2">(</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_392.html" target="_blank">getenv</a><span class="k2">(</span><span class="s">"HOME"</span><span class="k2">)</span><span class="k2">)</span> <span class="k3">+</span> <span class="s">'.'</span> <span class="k3">+</span> progname <span class="k3">+</span> <span class="s">'/'</span><span class="k2">;</span></td></tr><tr><td class="number">15</td><td><span class="p">#endif</span></td></tr><tr><td class="number">16</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>


And the code for creating paths on Windows and other systems:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">bool</span> als::create_directory<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> directory<span class="k2">)</span>
<span class="k2">{</span>
<span class="p">#ifdef ALLEGRO_WINDOWS</span>
  <span class="k1">return</span> CreateDirectory<span class="k2">(</span>directory.c_str<span class="k2">(</span><span class="k2">)</span>, NULL<span class="k2">)</span><span class="k2">;</span>
<span class="p">#else</span>
  <span class="k1">return</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_570.html" target="_blank">mkdir</a><span class="k2">(</span>directory.c_str<span class="k2">(</span><span class="k2">)</span>, S_IRWXU <span class="k3">|</span>
         S_IRGRP <span class="k3">|</span> S_IXGRP <span class="k3">|</span>
         S_IROTH <span class="k3">|</span> S_IXOTH<span class="k2">)</span><span class="k2">;</span>
<span class="p">#endif</span>
<span class="k2">}</span>
</pre></div></div><p>

A bit more code needed by the code above:</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">bool</span> als::directory_exists<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_132.html" target="_blank">dirname</a><span class="k2">)</span></td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>  <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/file_exists" target="_blank"><span class="a">file_exists</span></a><span class="k2">(</span>dirname.c_str<span class="k2">(</span><span class="k2">)</span>, FA_DIREC, NULL<span class="k2">)</span><span class="k2">)</span></td></tr><tr><td class="number">4</td><td>    <span class="k1">return</span> <span class="k1">true</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  <span class="k1">return</span> <span class="k1">false</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k2">}</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td>std::string als::slashed<span class="k2">(</span><span class="k1">const</span> string<span class="k3">&amp;</span> unslashed<span class="k2">)</span></td></tr><tr><td class="number">9</td><td><span class="k2">{</span></td></tr><tr><td class="number">10</td><td>  <span class="c">// code taken from Allegro's file.c</span></td></tr><tr><td class="number">11</td><td>  <span class="c">// if the last character is '/', '\\', '#', or ':', return original path</span></td></tr><tr><td class="number">12</td><td>  <span class="k1">char</span> last <span class="k3">=</span> unslashed<span class="k2">[</span>unslashed.size<span class="k2">(</span><span class="k2">)</span> <span class="k3">-</span> <span class="n">1</span><span class="k2">]</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>  <span class="k1">if</span> <span class="k2">(</span>last <span class="k3">=</span><span class="k3">=</span> <span class="s">'/'</span> <span class="k3">|</span><span class="k3">|</span> last <span class="k3">=</span><span class="k3">=</span> <span class="s">'\\'</span> <span class="k3">|</span><span class="k3">|</span> last <span class="k3">=</span><span class="k3">=</span> <span class="s">'#'</span> <span class="k3">|</span><span class="k3">|</span> last <span class="k3">=</span><span class="k3">=</span> <span class="s">':'</span><span class="k2">)</span></td></tr><tr><td class="number">14</td><td>    <span class="k1">return</span> unslashed<span class="k2">;</span></td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td>  <span class="c">// else append the platform specific directory end character</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td><span class="p">#ifdef ALLEGRO_WINDOWS</span></td></tr><tr><td class="number">19</td><td>  <span class="k1">return</span> unslashed <span class="k3">+</span> <span class="s">'\\'</span><span class="k2">;</span></td></tr><tr><td class="number">20</td><td><span class="p">#else</span></td></tr><tr><td class="number">21</td><td>  <span class="k1">return</span> unslashed <span class="k3">+</span> <span class="s">'/'</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td><span class="p">#endif</span></td></tr><tr><td class="number">23</td><td>&#160;</td></tr><tr><td class="number">24</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>



I hope this helps you making a better program! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Faerber)</author>
		<pubDate>Sun, 18 Dec 2005 01:58:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
When Vista (the new Windows version) will be released, you will have troubles if you ignore this advice.
</p></div></div><p>
Way to go microsoft!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sun, 18 Dec 2005 02:38:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
When Vista (the new Windows version) will be released, you will have troubles if you ignore this advice.
</p></div></div><p>

<img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />   Safety for application data.  An excellent model... bring it on M$!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Sun, 18 Dec 2005 04:32:30 +0000</pubDate>
	</item>
</rss>
