<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>vsynv() and mouse?</title>
		<link>http://www.allegro.cc/forums/view/556417</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 31 Dec 2005 09:55:50 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have a problem with my mouse cursor again.</p><p>I have this peace of code:
</p><div class="source-code snippet"><div class="inner"><pre>  <span class="k1">if</span> <span class="k2">(</span>do_vsync <span class="k3">=</span><span class="k3">=</span> <span class="n">1</span><span class="k2">)</span> <a href="http://www.allegro.cc/manual/vsync" target="_blank"><span class="a">vsync</span></a><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>temp, <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">800</span>,<span class="n">600</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>

If do_vsync is != 1 and no vsync() is done then it works fine.</p><p>But if do_vsync = 1 then the mouse cursor will flicker at the TOP of the screen (don&#39;t know. Maybe 20 pixels of the top screen).</p><p>This happens only at the top of the screen and when vsync is enabled.</p><p>I searched for this problem and found out that spellcaster mentioned this problem in 2003 in this thread <a href="http://www.allegro.cc/forums/thread/240147#post_240147">http://www.allegro.cc/forums/thread/240147#post_240147</a>.</p><p>The quistion was not solved in this thread.</p><p>Is there no way to use allegros mouse functions when using vsync since allegro version 4.0.3 (beta1)??</p><p>So the mouse functions are useless if used together with vsync?<br />Or is there a solution to this problem I didn&#39;t found?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Fri, 30 Dec 2005 23:18:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Actually, you should blit your mouse into the <i>temp</i> bitmap, like:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">if</span> <span class="k2">(</span>do_vsync <span class="k3">=</span><span class="k3">=</span> <span class="n">1</span><span class="k2">)</span>
    <a href="http://www.allegro.cc/manual/vsync" target="_blank"><span class="a">vsync</span></a><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>temp<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>temp, <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">800</span>,<span class="n">600</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

I have only used the <b>scare</b> functions inside dialogs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Fri, 30 Dec 2005 23:36:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm.. In a discussion in another thread we came to the point, that blitting the mouse somewere else then the screen is not a good idea.</p><p>read it here:<br /><a href="http://www.allegro.cc/forums/thread/555441#target">http://www.allegro.cc/forums/thread/555441#target</a></p><p>So I don&#39;t want to do that. If I HAVE TO blit the mousepointer to my buffer, then indeed the mouse functions of allegro where kind of pointless.</p><p>No other solution?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Fri, 30 Dec 2005 23:44:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Use a hardware/OS cursor. After setting it, you can check if it was actually enabled and just double buffer the pointer if not.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 31 Dec 2005 08:38:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How do I use a hardware/os cursor?<br />Will this not be affected by the vsync problem?</p><p>Thanks!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Sat, 31 Dec 2005 09:01:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It should &quot;fix&quot; the mouse problem, if the problem isn&#39;t that the mouse_x/y values get foobar&#39;d.
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// At startup:</span>
<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>
<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>
<span class="c">// Make sure a hardware cursor is set. if not, double</span>
<span class="c">// buffer the mouse</span>
<span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/gfx_capabilities" target="_blank"><span class="a">gfx_capabilities</span></a><span class="k3">&amp;</span>GFX_HW_MOUSE<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>NULL<span class="k2">)</span><span class="k2">;</span>

<span class="c">// In display loop, before blitting to screen:</span>
<span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/gfx_capabilities" target="_blank"><span class="a">gfx_capabilities</span></a><span class="k3">&amp;</span>GFX_HW_MOUSE<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>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>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 31 Dec 2005 09:30:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you very much! It did work.</p><p>But I had to change GFX_HW_MOUSE to GFX_HW_CURSOR. <br />Is this right? GFX_HW_MOUSE was unknown to the compiler.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Sat, 31 Dec 2005 09:39:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, sorry. I mistyped it even after looking at the docs. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 31 Dec 2005 09:52:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No problem.<br />There should be at least a little work for me even if someone else is doing the real job <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (count)</author>
		<pubDate>Sat, 31 Dec 2005 09:55:50 +0000</pubDate>
	</item>
</rss>
