<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Lag when object follows mouse</title>
		<link>http://www.allegro.cc/forums/view/617380</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 25 Apr 2018 14:44:53 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In windows (and also linux)  when dragging an object is &quot;glued&quot; to the mousecursor. no matter how fast you move it stays on.</p><p>How is this achieved ?  when updating my object with mouse.dx and mouse.dy there is always some lag between mouse position and object position.</p><p>any ideas ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Wed, 18 Apr 2018 00:57:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m not sure, but are you redrawing every time the mouse position changes? Your mouse can probably move more granularly than 60 times a second. Just a hunch, but not sure it makes sense. I&#39;m assuming the mouse cursor is a hardware/system mouse.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Wed, 18 Apr 2018 01:49:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>True, but the windows ( in windows and in linux) stick nicely to the mousecursor when you drag them. So there has to be another way. <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Wed, 18 Apr 2018 10:09:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The window manager is responsible for drawing both window frames and &quot;system&quot; mouse cursor, so it has no problem synchronizing the two.</p><p>If the lag is distracting in your game, you may want to stop using the system mouse cursor, and draw your own during your draw step.</p><p>Another approach, to try reduce lag, is to peek the event queue for the latest mouse position (or call  al_get_mouse_state()), and use that to position the moving thing. It might save you half a frame worth of distance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Wed, 18 Apr 2018 14:53:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>First, you need to be more specific. What OS are you using? Are you using Allegro to draw a system cursor? Or are you drawing the mouse yourself? How are you monitoring the mouse position? On Windows, you can set a callback process that can process mouse moves.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 18 Apr 2018 17:47:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m making a GUI system for allegro, so it&#39;s the lag between the mouse event and the actual mouse position. Allegro is drawing the system cursor, and I&#39;&#39;m using the event system
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ariesnl)</author>
		<pubDate>Wed, 18 Apr 2018 18:34:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m currently making a missile defense game and I have zero lag with the mouse. I draw my own pointer. All I do is respond to ALLEGRO_EVENT_MOUSE_AXES events.</p><p>You should show code if possible.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 18 Apr 2018 18:48:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I had a similar situation <a href="https://www.allegro.cc/forums/thread/604376/871088">here</a>.  You may be looking for <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_mouse_cursor_position"><span class="a">al_get_mouse_cursor_position</span></a><span class="k2">(</span><span class="k2">)</span></span>?  In my case, my previous implementation wasn&#39;t setting the position to the actual mouse cursor at that exact moment, causing things to go crazy.  Maybe it&#39;s related.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 19 Apr 2018 00:01:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/617380/1036899#target">Ariesnl</a> said:</div><div class="quote"><p>I&#39;m making a GUI system for allegro, so it&#39;s the lag between the mouse event and the actual mouse position. Allegro is drawing the system cursor, and I&#39;&#39;m using the event system</p></div></div><p>
I did finished my own GUI system for the engine I&#39;m creating.  I wrote it in Object Pascal, I&#39;m drawing the mouse cursor by myself and I haven&#39;t such &quot;lag&quot; drawing the mouse.</p><p>My system is quite complex (mouse is an independent object and cursor is managed by GUI and everything is decoupled...) but in short is similar to this:
</p><div class="source-code snippet"><div class="inner"><pre>PROCEDURE RenderMouseCursor
VAR
    State: <a href="http://www.allegro.cc/manual/ALLEGRO_MOUSE_STATE"><span class="a">ALLEGRO_MOUSE_STATE</span></a><span class="k2">;</span>
BEGIN
    <a href="http://www.allegro.cc/manual/al_get_mouse_state"><span class="a">al_get_mouse_state</span></a> <span class="k2">(</span>State<span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/al_draw_bitmap"><span class="a">al_draw_bitmap</span></a> <span class="k2">(</span>
      MousCursorBmp,
      MouseOffsetX <span class="k3">+</span> State.X, MouseOffsetY <span class="k3">+</span> State.Y,
      <span class="n">0</span>
    <span class="k2">)</span>
END<span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Niunio)</author>
		<pubDate>Wed, 25 Apr 2018 14:44:53 +0000</pubDate>
	</item>
</rss>
