<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro Crash...</title>
		<link>http://www.allegro.cc/forums/view/590525</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 14 Mar 2007 04:25:19 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey!</p><p>I am getting really frustrated about allegro crashing all the time. Can`t find no reason. Using Dev c++, 4.9.9.2. Take a look at the code below please...</p><p>The thing is, if I remove all textout calls, then it crashes only very few times. If I add textout lines it will start but crash soon after (after having worked correctly for some seconds). If I do double buffering like in the example below, it will crash imidiatelly at start, without working at all. </p><p>What is the problem, any ideas?<br />here is the code:</p><p>int main(){<br />    BITMAP *buffer;<br />    <br />    allegro_init();<br />    install_keyboard();<br />    install_mouse();<br />    set_color_depth(32);<br />    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);<br />    <br />    acquire_screen();</p><p>    std::string output1;<br />    std::string output2;<br />   <br />    while( !key[KEY_ESC]){<br />           output1=IntToString(mouse_x);<br />           output2=IntToString(mouse_y);<br />           textout_ex( buffer, font, output1.c_str(), 10, 10, makecol( 255, 0, 0), makecol( 0, 0, 200));<br />           textout_ex( screen, font, output2.c_str(), 10, 30, makecol( 255, 0, 0), makecol( 0, 0, 200));<br />           show_mouse(buffer);<br />           draw_sprite( screen, buffer, 0, 0);<br />    }</p><p>    release_screen();</p><p>    return 0;<br />}   <br />END_OF_MAIN();
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deck42)</author>
		<pubDate>Tue, 13 Mar 2007 16:56:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to initialize the buffer to point to a BITMAP that you create. It should be the size of the screen. Also there are several other small and non-critical errors in your code...</p><p>EDIT: Also you should RTFM before you go and reinvent the wheel (e.g. for printing numbers). Usually the preexisting wheel works just fine and often your own turns out square. Just an advice...</p><p>EDIT2: Your code should look like this:</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> main<span class="k2">(</span><span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">2</td><td>   <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="k2">;</span></td></tr><tr><td class="number">3</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">4</td><td>   <a href="http://www.allegro.cc/manual/install_mouse" target="_blank"><span class="a">install_mouse</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>   <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">32</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</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_AUTODETECT, <span class="n">640</span>, <span class="n">480</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">7</td><td>&#160;</td></tr><tr><td class="number">8</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="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a>, <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</td><td>&#160;</td></tr><tr><td class="number">10</td><td>   <span class="k1">while</span><span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_ESC<span class="k2">]</span><span class="k2">)</span><span class="k2">{</span></td></tr><tr><td class="number">11</td><td>      <a href="http://www.allegro.cc/manual/textprintf_ex" target="_blank"><span class="a">textprintf_ex</span></a><span class="k2">(</span>buffer, <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a>, <span class="n">10</span>, <span class="n">10</span>, <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">0</span>, <span class="n">0</span><span class="k2">)</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">200</span><span class="k2">)</span>, <span class="s">"%d, %d"</span>, <a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a>, <a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">12</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, <a href="http://www.allegro.cc/manual/mouse_sprite" target="_blank"><span class="a">mouse_sprite</span></a>, <a href="http://www.allegro.cc/manual/mouse_x" target="_blank"><span class="a">mouse_x</span></a>, <a href="http://www.allegro.cc/manual/mouse_y" target="_blank"><span class="a">mouse_y</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>      <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>buffer, <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">0</span>, <a href="http://www.allegro.cc/manual/SCREEN_W" target="_blank"><span class="a">SCREEN_W</span></a>, <a href="http://www.allegro.cc/manual/SCREEN_H" target="_blank"><span class="a">SCREEN_H</span></a><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>&#160;</td></tr><tr><td class="number">16</td><td>   <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>buffer<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td>   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td><span class="k2">}</span></td></tr><tr><td class="number">20</td><td><a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

You should also do error checking....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 13 Mar 2007 17:02:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah sorry forgot and justed added that, now it seems to run. But still it`s not clear to me why it crashed when I was drawing directly to the screen...</p><p>what other errors do you see?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deck42)</author>
		<pubDate>Tue, 13 Mar 2007 17:06:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is not Allegro&#39;s fault, it&#39;s your fault.</p><p>Use <a href="http://www.allegro.cc/mockup.html">code tags</a>.</p><p>Read the documentation for show_mouse:<span class="source-code"><a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a></span></p><p>They say that you have to install_timer in order to show_mouse. The docs also say not to draw to the bitmap while it has show_mouse called on it. Read the docs to find out how to fix.</p><p>IntToString is probably causing your crash, by the way.</p><p>[append]<br />Oh, or buffer not being initialized...</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
But still it`s not clear to me why it crashed when I was drawing directly to the screen...
</p></div></div><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/textout_ex" target="_blank"><span class="a">textout_ex</span></a><span class="k2">(</span> buffer, <a href="http://www.allegro.cc/manual/font" target="_blank"><span class="a">font</span></a>, output1.c_str<span class="k2">(</span><span class="k2">)</span>, <span class="n">10</span>, <span class="n">10</span>, <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">0</span>, <span class="n">0</span><span class="k2">)</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">200</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a><span class="k2">(</span>buffer<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> <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>
</pre></div></div><p>
</p></div></div><p>All 3 of those will crash.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Tue, 13 Mar 2007 17:06:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I edited my previous post while you were typing...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 13 Mar 2007 17:09:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well thx alot, but now I got an even more intersting question. :-)<br />What does &quot;RTFM&quot; mean? I mean what &quot;wheel&quot; were you refering to for printing numbers, I was searching for hours and hours for such a &quot;wheel&quot; before I did my own...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deck42)</author>
		<pubDate>Tue, 13 Mar 2007 17:28:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
What does &quot;RTFM&quot; mean?
</p></div></div><p>
<a href="http://www.acronymfinder.com">http://www.acronymfinder.com</a></p><p>EDIT: Scratch that, acronymfinder doesn&#39;t even have the right definition... <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I mean what &quot;wheel&quot; were you refering to for printing numbers, I was searching for hours and hours for such a &quot;wheel&quot; before I did my own...
</p></div></div><p>
<span class="source-code"><a href="http://www.allegro.cc/manual/textprintf_ex" target="_blank"><span class="a">textprintf_ex</span></a><span class="k2">(</span><span class="k2">)</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Tue, 13 Mar 2007 17:32:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thx! Really funny: I found that function yesterday myself but didn`t get how its meant to draw numbers... now I see. :-)</p><p>Everything runs smooth now thx
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (deck42)</author>
		<pubDate>Tue, 13 Mar 2007 17:39:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Miran said:</div><div class="quote"><p>

acronymfinder doesn&#39;t even have the right definition...
</p></div></div><p>

<u>Actually, they do:</u></p><p>[quote ]<br />******    	 RTFM  	Read The Friendly Manual (polite form) 	<br />******   	 RTFM 	Read the Fine Manual 	<br />*****   	 RTFM 	Read The Freaking Manual (polite form) <br />****   	 RTFM 	Read The Flaming Manual 	<br />****   	 RTFM 	Read The Fantastic Manual 	<br />****   	 RTFM 	Read The Flipping Manual 	<br />****   	 RTFM 	Realtime Traffic Flow Measurement (Internet RFCs 2720-2724) 	<br />****   	 RTFM 	Read The Fine Material 	<br />****   	 RTFM 	Read The Fscking Manual (Fsck is a Unix filesystem checker) 	****   	 RTFM 	Read The Forgotten Manual<br />***   	 RTFM 	Read The Furnished Manual<br />***   	 RTFM 	Read the Famous Manual (polite form)<br />***   	 RTFM 	Read the Field Manual<br />***   	 RTFM 	Read the Factory Manual<br />***   	 RTFM 	Read This For More<br />&lt;/quote&gt;</p><p><img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>But here at allegro.cc, it is more <b>Read The &#39;F ucking&#39; Manual</b> <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>_
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Tue, 13 Mar 2007 18:32:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Read The Fu..err..Free Manual!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Tue, 13 Mar 2007 18:38:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, I always thought it meant, &quot;Rotting Tomatoes For Me.&quot;  <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Tue, 13 Mar 2007 20:19:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That it does! <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kikaru)</author>
		<pubDate>Wed, 14 Mar 2007 04:25:19 +0000</pubDate>
	</item>
</rss>
