<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>allegro mouse distortion question</title>
		<link>http://www.allegro.cc/forums/view/586801</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 04 Aug 2006 14:06:52 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am a complete Allegro newbie and I am trying to start making a simple Solitaire card game just to have some fun with Allegro.  Anyway, I am having some troubles with the mouse cursor in Allegro.  I have a simple program that just displays a screen with a black background and a green box.  If I move the mouse cursor over the box the box gets erased by the mouse cursor, and turns black (which is the color of the area behind the box).</p><p>I was thinking that the problem was that I wasn&#39;t hiding the mouse cursor properly, but I think I am doing it correctly.  Here is my code:</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="p">#include &lt;pc.h&gt;</span></td></tr><tr><td class="number">2</td><td><span class="p">#include &lt;allegro.h&gt;</span></td></tr><tr><td class="number">3</td><td><span class="k1">using</span> <span class="k1">namespace</span> std<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>&#160;</td></tr><tr><td class="number">5</td><td><span class="k1">int</span> main<span class="k2">(</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>  <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">8</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">16</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">9</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">10</td><td>  <a href="http://www.allegro.cc/manual/install_timer" target="_blank"><span class="a">install_timer</span></a><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/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">12</td><td>  <a href="http://www.allegro.cc/manual/select_mouse_cursor" target="_blank"><span class="a">select_mouse_cursor</span></a><span class="k2">(</span>MOUSE_CURSOR_ARROW<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">13</td><td>  <a href="http://www.allegro.cc/manual/enable_hardware_cursor" target="_blank"><span class="a">enable_hardware_cursor</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td>  <a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a> <span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td>&#160;</td></tr><tr><td class="number">17</td><td>  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> bmp <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><span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</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>bmp, <a href="http://www.allegro.cc/manual/makecol16" target="_blank"><span class="a">makecol16</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="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">19</td><td>&#160;</td></tr><tr><td class="number">20</td><td>&#160;</td></tr><tr><td class="number">21</td><td>  <a href="http://www.allegro.cc/manual/rectfill" target="_blank"><span class="a">rectfill</span></a><span class="k2">(</span>bmp, <span class="n">150</span>, <span class="n">400</span>, <span class="n">230</span>, <span class="n">450</span>, <a href="http://www.allegro.cc/manual/makecol16" target="_blank"><span class="a">makecol16</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">255</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>  <a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a><span class="k2">(</span><span class="n">0</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>  <a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>bmp, <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>, <span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">24</td><td>  <a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">25</td><td>&#160;</td></tr><tr><td class="number">26</td><td>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_731.html" target="_blank">sleep</a><span class="k2">(</span><span class="n">5</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">27</td><td>&#160;</td></tr><tr><td class="number">28</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>


I am using the sleep function just to have the graphics run for a few seconds so I can test the mouse out.  It&#39;s not necessary at all.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Wed, 02 Aug 2006 08:02:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The mouse will be hidden automatically if it needs to be. Once you call <tt>show_mouse(screen);</tt> you can&#39;t call <tt>show_mouse</tt> again without losing the hardware cursor.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 02 Aug 2006 08:15:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>When I try it without the show_mouse(0) it makes it worse, and the mouse messes up even more.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Wed, 02 Aug 2006 15:48:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Change the last part of your code to this:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/show_mouse" target="_blank"><span class="a">show_mouse</span></a> <span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</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> bmp <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><span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/clear_to_color" target="_blank"><span class="a">clear_to_color</span></a> <span class="k2">(</span>bmp, <a href="http://www.allegro.cc/manual/makecol16" target="_blank"><span class="a">makecol16</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="k2">)</span><span class="k2">;</span>

<a href="http://www.allegro.cc/manual/rectfill" target="_blank"><span class="a">rectfill</span></a><span class="k2">(</span>bmp, <span class="n">150</span>, <span class="n">400</span>, <span class="n">230</span>, <span class="n">450</span>, <a href="http://www.allegro.cc/manual/makecol16" target="_blank"><span class="a">makecol16</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">255</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>

<a href="http://www.allegro.cc/manual/scare_mouse" target="_blank"><span class="a">scare_mouse</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>bmp, <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>, <span class="n">640</span>, <span class="n">480</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/unscare_mouse" target="_blank"><span class="a">unscare_mouse</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 02 Aug 2006 16:01:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
#include &lt;pc.h&gt;
</p></div></div><p>
What compiler are you using?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 02 Aug 2006 16:04:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am using DJGPP.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Thu, 03 Aug 2006 00:13:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>DJGPP doesn&#39;t work right under Windows XP.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 03 Aug 2006 00:21:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I fixed the problem.  I didn&#39;t know about the individual graphics drivers you could load up, only the GFX_AUTODETECT.  I did some searching and found out about the selection of video drivers for each platform.  I tried loading up the GFX_VESA1 driver and now the mouse corruption problem went away.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Thu, 03 Aug 2006 03:39:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You worked around the problem for your installation of XP on your hardware, which is far from fixing it. If you plan to let other people running Windows XP use your project, then you need to switch to a Windows compiler.</p><p>DOS applications can be coaxed to run on Windows XP, but usually not very well. They won&#39;t work at all on 64-bit versions.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Thu, 03 Aug 2006 04:12:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I use DJGPP because my university computer science classes/professors use DJGPP actually.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Thu, 03 Aug 2006 05:17:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You should use Mingw.<br />It´s a windows compiler.</p><p>djgpp = gcc for dos<br />Mingw = gcc for windows</p><p>IIRC. So it won´t be much of a change, but your games will work correct under windows
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Thu, 03 Aug 2006 19:36:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
my university computer science classes/professors use DJGPP
</p></div></div><p>You sure that they&#39;re really professors, and not just some random guy with a fake beard?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kauhiz)</author>
		<pubDate>Thu, 03 Aug 2006 21:13:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, we haven&#39;t needed anything else really besides DJGPP.  For instance, if you are doing data structures like trees, linked lists, basic AI stuff like searching through mazes, sorting, hash functions, etc, you don&#39;t need fancy graphics or capabilities.</p><p>Anyway, I took the time tonight to get MINGW installed, as I had some problems when I tried to get allegro working with it in the past.  Well, I got Allegro successfully working with MINGW now so I will continue my solitaire game development using MINGW instead of djgpp.</p><p><b>*EDIT</b>*</p><p>I have a Windows related question.  If I want to run a Windows based Allegro program on another computer, what do I need to do?  Is the Allegro library statically linked into the program or do I need to include a DLL if I want to run the program on another PC?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kholdstayr)</author>
		<pubDate>Fri, 04 Aug 2006 05:18:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Depends on the way you compiled allegro.<br />I guess you compiled it the way you have to include the dll.<br />Which is the way to go, IMO.</p><p>If you make one change to your exefile, people only have to download the small exe file, because they already have the dll.</p><p>Otherwise your exe will be bigger and the people will redownload the dll (in the exe) everytime they download the exe.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Fri, 04 Aug 2006 14:06:52 +0000</pubDate>
	</item>
</rss>
