<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro for D</title>
		<link>http://www.allegro.cc/forums/view/589597</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 20 Feb 2007 22:19:34 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In 2004, some guy posted a zip with the files needed to use allegro with the D programming language:<br /><a href="http://www.allegro.cc/forums/thread/354471/354474">http://www.allegro.cc/forums/thread/354471/354474</a></p><p>The file attachment was gone, so I&#39;ve uploaded it here:<br /><a href="http://torhus.googlepages.com/d-allegro-win32-1.0.zip">http://torhus.googlepages.com/d-allegro-win32-1.0.zip</a></p><p>I&#39;ve also started to do some improvements to his work, still for Allegro 4.0.<br /><a href="http://torhus.googlepages.com/d-allegro-win32-1.1-4.0.zip">http://torhus.googlepages.com/d-allegro-win32-1.1-4.0.zip</a></p><p>I&#39;m currently just checking out how to solve certain problem when converting C headers into D, so there&#39;s not much new yet.  But I thought I&#39;d post to see if there&#39;s any interest in this.</p><p>What&#39;s new in v1.1 is mostly that you can actually access allegro&#39;s globals directly now.  Like screen, font, gfx_driver, mouse_x, etc.  Version 1.0 replaces those with function calls like get_screen() and set_font().</p><p>I&#39;ve started work to convert the 4.2.1 headers into D, but if and when that will be finished, I&#39;m not sure yet.  I&#39;ll organize allegro.d with one section for each C header, so it&#39;s easier to update with new allegro releases.  You just go through each of the files in the order they are listed in allegro.h, and update allegro.d accordingly.</p><p>For people not familiar with D:<br /><a href="http://www.digitalmars.com/d/overview.html">http://www.digitalmars.com/d/overview.html</a><br /><a href="http://www.digitalmars.com/d/comparison.html">http://www.digitalmars.com/d/comparison.html</a></p><p>Downloads and installation instructions are here:<br /><a href="http://www.digitalmars.com/d/dcompiler.html">http://www.digitalmars.com/d/dcompiler.html</a></p><p>I can tell you right away that the main weakness of D is probably the poor debugger support.  You can use windbg to pinpoint access violations, but I haven&#39;t been able to use it for much more than that.  Hopefully, that will change. for now it&#39;s basically printf debugging and such.  If that is not an option for you, stick with C/C++.</p><p>But for those okay with not having great tools, D will be a relief, whether you compare it to C, or C++.  That&#39;s what I think, anyway. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Wed, 17 Jan 2007 01:47:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>D has changed alot over the past couple of years.  They added some really nice template syntax and the contracts thing is kinda interesting.  Must look into again sometime...</p><p>Keep us posted about your progress!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (nonnus29)</author>
		<pubDate>Wed, 17 Jan 2007 03:19:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m going to try it.</p><p>Right now, I have to get 4.0 because that&#39;s the version that you&#39;ve wrapped <img src="http://www.allegro.cc/forums/smileys/embarassed.gif" alt=":-[" /></p><p>Also, I&#39;m using Linux (in case you were wondering why I don&#39;t just use alleg.lib).</p><p>The source files compile well but it&#39;s the linking part that&#39;s giving problems.</p><p>[update]<br />I couldn&#39;t compile 4.0.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Archon)</author>
		<pubDate>Wed, 17 Jan 2007 13:27:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Great, thanks! I have a bunch of D-related stuff lurking around on my hard-disk, but I never really had the incentive to give it a try in a real application (just a bunch of very small projects playing around with the language&#39;s features). I guess it&#39;s time to get started. Once there&#39;s support for Allegro 4.2 <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>Keep it up! <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Indeterminatus)</author>
		<pubDate>Wed, 17 Jan 2007 23:31:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve ported enough of Allegro 4.2.1 to D to be able to actually start allegro and set the gfx mode.  Nothing else yet.  9 of 31 headers are more or less done.</p><p>So far it&#39;s been almost too easy.  I&#39;ll probably get stuck for weeks in some debugging nightmare or something soon. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>For the most part, C features map nicely to D.  Only a couple of things need to be worked around. I&#39;m trying to keep as close to C and the allegro manual as possible.  No D-ification of allegro is planned at the moment.  If someone wants to write wrappers, my work should make that pretty easy.</p><p>*** UPDATE ***</p><p>Here&#39;s a beta release, if anyone wants to try it out.<br /><a href="http://torhus.googlepages.com/dallegro_20_beta1.zip">http://torhus.googlepages.com/dallegro_20_beta1.zip</a></p><p>It&#39;s not completely done yet, but it&#39;s pretty close.</p><p>I&#39;ve ported 18 of allegro&#39;s examples so far, and they work just fine.  The only thing that worries me is that expal.d doesn&#39;t display the mouse pointer.  But the mouse works fine in the other examples.</p><p>One of the annoyances when using a C lib in with D is that arrays are not quite the same as C&#39;s, and that D&#39;s IO functions don&#39;t support null-terminated strings.  But you can just use C IO (import std.c.stdio;), or use toString() to convert.  The D language itself has good support for them, however.</p><p>If you give a char pointer to writefln(), it will actually print the address, instead of the contents.  Not very useful.</p><p>You can also get it wrong the other way around.  D&#39;s preferred string type is dynamic char arrays (char[]), which are &#39;fat pointers&#39;, or references.  Like this: struct CharArray { size_t length; char* data; }; If you give that to a variadic C function, it will print gibberish, since it will &#39;dereference&#39; the lenght field.  Or it might crash your game.  You can use the standard D function toStringz() to convert to a C string.  Using &quot;%*s&quot; as the format also works.</p><p>D has an array type (static arrays) that is binary compatible with C arrays.  Allegro has globals that are defined like &#39;char allegro_error[SOME_SIZE];&#39;.  Let&#39;s say you do this:</p><p>allegro_message(&quot;Unable to set any graphic mode\n%s\n&quot;, allegro_error);</p><p>Since the function is variadic, the compiler won&#39;t complain.  D does not verify variadic argument types during compilation, since it has it&#39;s own, typesafe variadic functions.  What happens here seems to be that allegro_error is converted into a dynamic array, since that&#39;s the only way to have the length follow the array into the function.  Which doesn&#39;t help in this case.</p><p>So D&#39;s static (fixed-length) arrays are not equivalent to pointers when used as arguments to variadic functions.  The solution is to just add &#39;.ptr&#39; to allegro_error, since in this case we know it&#39;s already null-terminated.  But I guess we are bound to forget this now and then.</p><p>Another issue is that functions that expect a static array, do not accept a pointer.  Take, for instance &#39;void set_palette(PALETTE p);&#39;, and &#39;alias RGB[256] PALETTE&#39;.  If you load a palette from a datafile, you get a pointer to 256 RGB structs.  And if set_palette is defined like that, it won&#39;t accept any pointer.  So you have to do something like this:</p><p>PALETTE r = (cast(RGB*)datafile[THE_PALETTE].dat)[0..PAL_SIZE];<br />set_palette(r);</p><p>Which is pretty ugly.  One option is to change set_palette() and similar functions to take an RGB* as their argument.  Or to make a function template to do the conversion, preferrable without copying.</p><p>But ok, let me know how it works out for you. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Thu, 18 Jan 2007 04:22:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>nice to see, this also gives me an excuse to play with D.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (juvinious)</author>
		<pubDate>Wed, 24 Jan 2007 15:23:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>And I <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />. D seems like a decent language.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AngelChild)</author>
		<pubDate>Wed, 24 Jan 2007 15:24:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Cookies goes to Tydr Schnubbis.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Archon)</author>
		<pubDate>Wed, 24 Jan 2007 17:29:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can we compile D and target it to ARM CPUs?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Thu, 25 Jan 2007 04:36:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>gdc is supposed to target anything gcc can. (The digital mars compiler itself only can target Windows and Linux I think.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 25 Jan 2007 04:43:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do you generate one that will target ARM7/9 then? Is there source someplace to compile a toolchain for it?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Thu, 25 Jan 2007 05:16:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The gdc readme mentions it from what I remember, didn&#39;t read too closely though. Or I think it just says something like &quot;If you need a D cross-compiler, do it like with a C++ crosscompiler.&quot; Anyway, googling for &quot;gdc arm&quot; seems to turn up some posts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 25 Jan 2007 05:26:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d assume it&#39;d worlk like normal, compile some D code: <i>gdc -target &lt;platform&gt; -arch &lt;whatever&gt; &lt;etc&gt;</i>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 25 Jan 2007 05:28:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>We are having trouble with dallegro on linux.  juvinious and I are looking into it.  We haven&#39;t tried gdc yet, just dmd.  Some examples still crash on linux.  I don&#39;t run linux, so if anyone feels like some debugging, we&#39;d be glad to get some help.</p><p>*** UPDATE ***</p><p>It&#39;s not crashing anymore!  Turns out I had had a small search-and-replace accident, which didn&#39;t matter on windows, but caused crashes on linux. Scary. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Thu, 25 Jan 2007 15:13:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Here&#39;s a beta release, if anyone wants to try it out.<br /><a href="http://torhus.googlepages.com/dallegro_20_beta1.zip">http://torhus.googlepages.com/dallegro_20_beta1.zip</a>
</p></div></div><p>

That zip file is broken.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Thu, 25 Jan 2007 16:28:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Broken how?  I just downloaded it, and it was fine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Fri, 26 Jan 2007 00:16:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For some reason, I can&#39;t unzip it.  Here&#39;s a transcript:</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>% md5sum dallegro_20_beta1.zip</td></tr><tr><td class="number">2</td><td><span class="n">9a89e8c2c31a870165dc9d05bc918216</span>  dallegro_20_beta1.zip</td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td>% unzip <span class="k3">-</span>l dallegro_20_beta1.zip</td></tr><tr><td class="number">5</td><td>Archive:  dallegro_20_beta1.zip</td></tr><tr><td class="number">6</td><td>  End-of-central-directory signature <span class="k1">not</span> found.  Either <span class="k1">this</span> file is <span class="k1">not</span></td></tr><tr><td class="number">7</td><td>  a zipfile, <span class="k1">or</span> it constitutes one disk of a multi-part archive.  In the</td></tr><tr><td class="number">8</td><td>  latter <span class="k1">case</span> the central directory <span class="k1">and</span> zipfile comment will be found on</td></tr><tr><td class="number">9</td><td>  the last disk<span class="k2">(</span>s<span class="k2">)</span> of <span class="k1">this</span> archive.</td></tr><tr><td class="number">10</td><td>unzip:  cannot find zipfile directory in one of dallegro_20_beta1.zip <span class="k1">or</span></td></tr><tr><td class="number">11</td><td>        dallegro_20_beta1.zip.zip, <span class="k1">and</span> cannot find dallegro_20_beta1.zip.ZIP, period.</td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td>% <span class="n">7</span>za l dallegro_20_beta1.zip</td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td><span class="n">7</span><span class="k3">-</span>Zip <span class="k2">(</span>A<span class="k2">)</span> <span class="n">4</span>.<span class="n">30</span> beta  Copyright <span class="k2">(</span>c<span class="k2">)</span> <span class="n">1999</span><span class="k3">-</span><span class="n">2005</span> Igor Pavlov  <span class="n">2005</span><span class="k3">-</span><span class="n">11</span><span class="k3">-</span><span class="n">18</span></td></tr><tr><td class="number">16</td><td>p7zip Version <span class="n">4</span>.<span class="n">30</span> <span class="k2">(</span>locale<span class="k3">=</span>en_AU.UTF-8,Utf16<span class="k3">=</span>on,HugeFiles<span class="k3">=</span>on<span class="k2">)</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>Error: dallegro_20_beta1.zip is <span class="k1">not</span> supported archive</td></tr></tbody></table></div></div><p>

I can unzip d-allegro-win32-1.1-4.0.zip though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Fri, 26 Jan 2007 04:18:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It worked fine for me, however, I <a href="http://www.allegro.cc/files/attachment/591081">recompressed it for you</a>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Fri, 26 Jan 2007 04:23:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks. It looks like my download stopped prematurely on three separate occasions (and I don&#39;t think it was due to the browser cache either). Sorry about that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Fri, 26 Jan 2007 04:30:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://torhus.googlepages.com/dallegro_20_beta2.zip">http://torhus.googlepages.com/dallegro_20_beta2.zip</a></p><p>New test version.  A couple of new examples, lots of bug fixes and cleanups.  And it includes a build script for linux, that also enables static linking.  If you&#39;ve previously tried this on linux and given up on it, please try again. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>allegro_error and cpu_vendor are now char pointers, like allegro_id already was.  Should make it harder to do the wrong thing when calling variadic C functions.</p><p>More volatile variables have been wrapped as properties.  Not sure how useful this is.</p><p><b>**EDIT</b>**</p><p>Question for you guys:  Is DAllegro a good name or not?  Anyone got better suggestions?  Doesn&#39;t matter much, I know. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>I should probably email the original dallegro guy and ask if he&#39;s okay with me stealing his project name.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Mon, 29 Jan 2007 21:00:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hm, SDL named their D wrapper &quot;derelict&quot;. But I think dallegro is a good name <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 29 Jan 2007 21:15:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d like to see D become an officially supported language for Allegro, either by bundling the bindings in the main package or as a separate download.  It would be nice to install it with just a &quot;make install-d&quot; command.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Tue, 30 Jan 2007 06:10:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve been offered svn hosting at tomasu.org.  That seems like a good place to set up shop if dallegro is to become an official part of or maybe just an &#39;offical add-on&#39; to allegro.</p><p>If you feel like adding dallegro support to the allegro makefiles, please do.  I haven&#39;t written a makefile in a few years.</p><p>Now I&#39;ve gotten the main test app to run (tests/test.c).  I&#39;ve run a couple of the benchmarks, and performance seems to be on par with the C version.</p><p>If anyone wants to help out, at the moment I&#39;m mostly interested in feedback about the design of dallegro.  What can be done to make using allegro with D smoother, how to help users avoid common pitfalls, etc.  How to best maintain portability when D gets ported to other platforms in the future, does dallegro need to support memory locking, etc.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Wed, 31 Jan 2007 00:00:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why not the Allegro SourceForge repository?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 31 Jan 2007 05:30:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Why not the Allegro SourceForge repository?
</p></div></div><p>Mine has better uptime?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 31 Jan 2007 05:34:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve not had any problems with SF recently, and I&#39;m pretty sure SF is faster for me.  Anyway, it doesn&#39;t matter unless we want to bundle the D bindings with the main download, in which case it would be easier if it was in the same repository.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 31 Jan 2007 05:43:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;ve not had any problems with SF recently
</p></div></div><p>In the past month or so I haven&#39;t seen any major problems, but I&#39;ve not been looking. Before that I&#39;d hear complaints with svn, cvs and the web sites all the time.</p><p>Oh, and I will be moving svn.tomasu.org to a higher bandwidth (10mbps vs 1mbps) server at some point. Initial setup fees suck.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 31 Jan 2007 05:51:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Anyway, it doesn&#39;t matter unless we want to bundle the D bindings with the main download
</p></div></div><p>

Hmm, and what about the other language bindings?  Aren&#39;t they good enough?</p><p>Sorry, it had to be said....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (nonnus29)</author>
		<pubDate>Wed, 31 Jan 2007 07:26:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Hmm, and what about the other language bindings? Aren&#39;t they good enough?
</p></div></div><p>
Well considering that syntactically, you will practically have all the original C functions intact unlike other bindings which usually resort to wrapping the C functions. I would say it would be a much more reasonable candidate to be included.<br />Here is what exhello looks like:
</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="c">/*</span></td></tr><tr><td class="number">2</td><td><span class="c"> *    Example program for the Allegro library, by Shawn Hargreaves.</span></td></tr><tr><td class="number">3</td><td><span class="c"> *</span></td></tr><tr><td class="number">4</td><td><span class="c"> *    This is a very simple program showing how to get into graphics</span></td></tr><tr><td class="number">5</td><td><span class="c"> *    mode and draw text onto the screen.</span></td></tr><tr><td class="number">6</td><td><span class="c"> */</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>import allegro.all<span class="k2">;</span></td></tr><tr><td class="number">10</td><td>import std.stdio<span class="k2">;</span></td></tr><tr><td class="number">11</td><td>&#160;</td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span></td></tr><tr><td class="number">14</td><td><span class="k2">{</span></td></tr><tr><td class="number">15</td><td>   <span class="c">/* you should always do this at the start of Allegro programs */</span></td></tr><tr><td class="number">16</td><td>   <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span></td></tr><tr><td class="number">17</td><td>      <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>&#160;</td></tr><tr><td class="number">19</td><td>   <span class="c">/* set up the keyboard handler */</span></td></tr><tr><td class="number">20</td><td>   <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> </td></tr><tr><td class="number">21</td><td>&#160;</td></tr><tr><td class="number">22</td><td>   <span class="c">/* set a graphics mode sized 320x200 */</span></td></tr><tr><td class="number">23</td><td>   <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT, <span class="n">320</span>, <span class="n">200</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">24</td><td>      <span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_SAFE, <span class="n">320</span>, <span class="n">200</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span> <span class="k3">!</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span> <span class="k2">{</span></td></tr><tr><td class="number">25</td><td>    <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_TEXT, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">26</td><td>    <a href="http://www.allegro.cc/manual/allegro_message" target="_blank"><span class="a">allegro_message</span></a><span class="k2">(</span><span class="s">"Unable to set any graphic mode\n%s\n"</span>, allegro_error.ptr<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>    <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span></td></tr><tr><td class="number">28</td><td>      <span class="k2">}</span></td></tr><tr><td class="number">29</td><td>   <span class="k2">}</span></td></tr><tr><td class="number">30</td><td>&#160;</td></tr><tr><td class="number">31</td><td>   <span class="c">/* set the color palette */</span></td></tr><tr><td class="number">32</td><td>   <a href="http://www.allegro.cc/manual/set_palette" target="_blank"><span class="a">set_palette</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/desktop_palette" target="_blank"><span class="a">desktop_palette</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">33</td><td>&#160;</td></tr><tr><td class="number">34</td><td>   <span class="c">/* clear the screen to white */</span></td></tr><tr><td class="number">35</td><td>   <a href="http://www.allegro.cc/manual/clear_to_color" target="_blank"><span class="a">clear_to_color</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, <a href="http://www.allegro.cc/manual/makecol" target="_blank"><span class="a">makecol</span></a><span class="k2">(</span><span class="n">255</span>, <span class="n">255</span>, <span class="n">255</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">36</td><td>   <span class="c">//clear_to_color(screen, makecol(255,0,255));</span></td></tr><tr><td class="number">37</td><td>&#160;</td></tr><tr><td class="number">38</td><td>   <span class="c">/* you don't need to do this, but on some platforms (eg. Windows) things</span></td></tr><tr><td class="number">39</td><td><span class="c">    * will be drawn more quickly if you always acquire the screen before</span></td></tr><tr><td class="number">40</td><td><span class="c">    * trying to draw onto it.</span></td></tr><tr><td class="number">41</td><td><span class="c">    */</span></td></tr><tr><td class="number">42</td><td>   <a href="http://www.allegro.cc/manual/acquire_screen" target="_blank"><span class="a">acquire_screen</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">43</td><td>&#160;</td></tr><tr><td class="number">44</td><td>   <span class="c">/* write some text to the screen with black letters and transparent background */</span></td></tr><tr><td class="number">45</td><td>   <a href="http://www.allegro.cc/manual/textout_centre_ex" target="_blank"><span class="a">textout_centre_ex</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a>, <span class="s">"Hello, world!"</span>, <a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a><span class="k3">/</span><span class="n">2</span>, <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><span class="k3">/</span><span class="n">2</span>, <a href="http://www.allegro.cc/manual/makecol" target="_blank"><span class="a">makecol</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">0</span>,<span class="n">0</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">46</td><td>&#160;</td></tr><tr><td class="number">47</td><td>   <span class="c">/* you must always release bitmaps before calling any input functions */</span></td></tr><tr><td class="number">48</td><td>   <a href="http://www.allegro.cc/manual/release_screen" target="_blank"><span class="a">release_screen</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">49</td><td>&#160;</td></tr><tr><td class="number">50</td><td>   <span class="c">/* wait for a keypress */</span></td></tr><tr><td class="number">51</td><td>   <a href="http://www.allegro.cc/manual/readkey" target="_blank"><span class="a">readkey</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">52</td><td>&#160;</td></tr><tr><td class="number">53</td><td>   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">54</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (juvinious)</author>
		<pubDate>Wed, 31 Jan 2007 07:40:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I knew this would come up.  I basically agree with juvinious.  If the bindings are basically a straight adaption of the C API to the target language (judgement call here), and the bindings are mature then I think they should be official.  A big problem that prevents people using language bindings are that they become unmaintained or just disappear off the net.  Who wants to write a serious program with a language binding under those conditions?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 31 Jan 2007 07:47:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That argument is somewhat circular. Something won&#39;t be well maintained or used until it becomes official.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Wed, 31 Jan 2007 11:11:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, C/C++/D are essentially the same language, or at least closer to each other than any other language - so that is some argument for giving D a special status. It&#39;s just a direct translation of the C headers into D headers, something quite different from a C++ or D wrapper which changes the API.</p><p>But most important, it seems several developers agree to maintain it, which is easiest if it&#39;s in the same repository - so e.g. adding a new symbol can be done in one commit.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 31 Jan 2007 17:11:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ll use svn on sourceforge, I didn&#39;t know that was the official repository. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>I guess I&#39;ll ask on the AD mailing list for access, where to put it in the tree etc?</p><p>I don&#39;t know for how long I&#39;ll be able to maintain this project.  But it should be easy for anyone to continue maintenance.</p><p>*** UPDATE ***<br />Since there&#39;s no svn yet, I&#39;ll release again.</p><p><a href="http://torhus.googlepages.com/dallegro_20_beta3.zip">http://torhus.googlepages.com/dallegro_20_beta3.zip</a></p><p>Rough changelog:<br />- more examples translated<br />- updated linux build script<br />- the big test app (test.c) is translated and seems to work<br />- added some more of allegro&#39;s #defines and platform macros, in the form of global constants or version id&#39;s.  See readme.txt.<br />- added EMPTY_STRING and _set_color()<br />- benchmarked fix point maths and selected the implementations that were the<br />fastest on my Athlon 1.4.  Not sure how smart that is.<br />- various fixes and cleanups</p><p>The new Tango library is supported, just apply tango.diff.  Only tested with dmd 1.0.</p><p>*** UPDATE 2 ***<br />The Allegro demo game (demo/demo.c) seems to work flawlessly with dallegro.  But I&#39;m wondering if someone can tell me why the global struct arrays &#39;star&#39; and &#39;asteroid&#39; are declared volatile.  They don&#39;t seem to be used by timer code or anything.  If there&#39;s no good reason, I won&#39;t bother to make them &#39;volatile&#39; in D, since that messes up the code a bit more than it does in C.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Sun, 04 Feb 2007 01:21:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just a guess, but they might have been volatile because at one point in development they were used in a timer, but now are not...</p><p>Also: Congrats on your progress/contributions with dallegro, I&#39;ll look forward to using it someday! <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Wed, 07 Feb 2007 05:22:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks.</p><p>From now on, this is the place to get the latest dallegro:</p><p><a href="https://alleg.svn.sourceforge.net/svnroot/alleg/bindings/dallegro/trunk/">https://alleg.svn.sourceforge.net/svnroot/alleg/bindings/dallegro/trunk/</a></p><p>I&#39;ll release zips occasionally, especially if people who are not familiar with svn request it. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>*** UPDATE ***</p><p>I&#39;m looking into porting allegroGL to D.  The smallest example compiles now, but I don&#39;t have a dmd-compatible agl.lib to link with.</p><p>So I&#39;ve tried to make a makefile to compile allegroGL with dmc.  The makefile seems to work, but there are problems with allegroGL macros.  I haven&#39;t looked into that yet.  So the makefile isn&#39;t enough to get it to compile, the source also needs to be adapted.</p><p>An easier solution, at least temporarily, might be to allow allegroGL to be compiled into A .dll.  Does anyone know how much work this would take?</p><p>Another possibility is to use a tool to convert msvc COFF into dmc OMF.  Does anyone know about a free tool to do that?  Digital Mars has got one called coff2omf, but it&#39;s not free.  And I don&#39;t know how up to date it is either.  I think Borland might have one, but I haven&#39;t looked into that yet.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Tue, 20 Feb 2007 22:19:34 +0000</pubDate>
	</item>
</rss>
