<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Black screen of DOOM</title>
		<link>http://www.allegro.cc/forums/view/590708</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 25 Mar 2007 23:49:15 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Whenever I try to draw from a datafile, nothing happens. Just nothing- the screen stays black. However, it worked in a test file. This is the relevant code:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include "ZomOn.h"</span>
<a href="http://www.allegro.cc/manual/DATAFILE" target="_blank"><span class="a">DATAFILE</span></a> <span class="k3">*</span>zombo <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_datafile" target="_blank"><span class="a">load_datafile</span></a><span class="k2">(</span><span class="s">"ZomOn.dat"</span><span class="k2">)</span><span class="k2">;</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span><span class="k2">{</span>
  <span class="c">//init stuff here</span>
  <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span><span class="k2">)</span>zombo<span class="k2">[</span>hud_back<span class="k2">]</span>.dat, <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">480</span>, <span class="n">480</span>, <span class="n">60</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

This doesn&#39;t work. It just stays black (the screen). Why?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SkaxCo)</author>
		<pubDate>Sun, 25 Mar 2007 22:41:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can&#39;t load datafiles in the global scope. You don&#39;t error check. Oh, and <i>your example omits a hell of a lot of code of interest, making it impossible to say for certain what your problem is.</i></p><p>In the future, please show <i>actual</i> problem code, instead of made-up or completely gutted examples.</p><p>[EDIT]<br />And don&#39;t <a href="http://www.allegro.cc/forums/thread/590707">double post</a>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Sun, 25 Mar 2007 22:45:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The rest is ALL game logic. All of it. I pretty much cut the program down to those few lines.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SkaxCo)</author>
		<pubDate>Sun, 25 Mar 2007 22:48:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No, it&#39;s not.<br />There&#39;s no initialization. Whatsoever. Meaning you could be doing about a thousand things wrong before even touching the datafile.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Sun, 25 Mar 2007 22:53:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The init stuff is fine. The game worked fine until I started using the datafile. I started out using all bmps, I just added the dat and replaced all of the blit stuff. But here:</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//there was the code here but I took it out.</span>
</pre></div></div><p>

EDIT: Thanks for the datafile info, its now locally made. Now I just need to work out a few kinks.</p><p>EDIT2: If you can&#39;t have a global datafile, what is the best way to draw a bmp from the file in a function?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SkaxCo)</author>
		<pubDate>Sun, 25 Mar 2007 22:59:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can have a global datafile. You just can&#39;t <i>load</i> it in the global scope.</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/DATAFILE" target="_blank"><span class="a">DATAFILE</span></a> <span class="k3">*</span>foo<span class="k2">;</span>

<span class="k1">void</span> bar<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="k2">{</span>
 foo <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_datafile" target="_blank"><span class="a">load_datafile</span></a><span class="k2">(</span><span class="s">"fnord.dat"</span><span class="k2">)</span><span class="k2">;</span>
 <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>foo<span class="k2">)</span>
    die_horrible_death<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Sun, 25 Mar 2007 23:10:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, like bitmaps.<br />Thanks!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SkaxCo)</author>
		<pubDate>Sun, 25 Mar 2007 23:18:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can <i>have</i> a global datafile, you just can&#39;t <i>initialize</i> globally.</p><p>The reason why you can&#39;t is because when load_datafile() is processed at program startup, you still have yet to call allegro_init(), thus load_datafile() doesn&#39;t work properly.</p><p>Before you use ANY Allegro commands, you should always call allegro_init() first, which means any global pointers to Allegro objects cannot be initialized at global scope.</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, 25 Mar 2007 23:19:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You should probably brush up on your C/C++ a bit :/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Sun, 25 Mar 2007 23:26:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You should probably brush up on your C/C++ a bit :/
</p></div></div><p>

Yeah, I do...I started C++ like...5 months ago?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SkaxCo)</author>
		<pubDate>Sun, 25 Mar 2007 23:49:15 +0000</pubDate>
	</item>
</rss>
