<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Lagging Input Problem</title>
		<link>http://www.allegro.cc/forums/view/587880</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 10 Oct 2006 01:08:15 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>One of the users of my program is having a problem I can&#39;t seem to duplicate, so I&#39;m not sure what&#39;s wrong, and I don&#39;t even know where to start looking.</p><p>Occasionally, the program appears to loose input from the mouse and keyboard and the mouse pointer &quot;freezes&quot; even though the program continues to run otherwise normally (the sprites continue to move, etc). Futhermore, whenever the mouse and keyboard &quot;come back,&quot; it acts as if their button states have been constant the whole time they were gone (for example, just typing a single &quot;m&quot; into a text box at the same moment the input stops, when it comes back, suddenly there&#39;s a whole row of m&#39;s).</p><p>Is this just a common hardware issue, and if so, is there a work around? No one else appears to be having any problem.</p><p>(If you need any more information, please ask, and I&#39;ll try to post it.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Thu, 05 Oct 2006 02:49:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Do you use any kind of polling on the mouse/keyboard?  Do you know what kind of mouse/keyboard your friend has?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Onewing)</author>
		<pubDate>Thu, 05 Oct 2006 02:53:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I use poll_mouse() every frame, if that&#39;s what you mean.</p><p>As for what kind, I&#39;ll have to ask him.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Thu, 05 Oct 2006 03:01:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try not calling poll_mouse
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Thu, 05 Oct 2006 03:28:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Allegro Manual said:</div><div class="quote"><p>

Wherever possible, Allegro will read the mouse input asynchronously (ie. from inside an interrupt handler), but on some platforms that may not be possible, in which case you must call this routine at regular intervals to update the mouse state variables. To help you test your mouse polling code even if you are programming on a platform that doesn&#39;t require it, after the first time that you call this function Allegro will switch into polling mode, so from that point onwards you will have to call this routine in order to get any mouse input at all, regardless of whether the current driver actually needs to be polled or not.
</p></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kibiz0r)</author>
		<pubDate>Thu, 05 Oct 2006 06:41:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I use poll_mouse() every frame, if that&#39;s what you mean.
</p></div></div><p>
How often do you read input? If you don&#39;t poll but do read, the behavior you describe is what I&#39;d expect.</p><p>Anyway, don&#39;t use the poll_* functions. Ever.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 05 Oct 2006 19:07:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Like I said, I poll every time the screen displays.  If the display is updating, it should be still be polling, correct?  In any case, I nuked the poll_mouse() function.  The manual gave me the impression that even if I didn&#39;t neccissarily need it, I should use it anyway to make it easier to port the code.</p><p>I&#39;ll see if that helps any.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Fri, 06 Oct 2006 02:03:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I poll every time the screen displays. If the display is updating, it should be still be polling, correct?
</p></div></div><p>
Yes, but if you&#39;re frame skipping, the input state is not updated and input functions read back the old state.<br />If you do poll, you should always poll at the start of your input cycle, not during your graphics update cycle.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
In any case, I nuked the poll_mouse() function. The manual gave me the impression that even if I didn&#39;t neccissarily need it, I should use it anyway to make it easier to port the code.
</p></div></div><p>
That&#39;s from back when we thought we would maybe need to support platforms that requierd polling at some point in the future. However, if ever we do need such a system, we can do the polling in the background from an alternate thread...<br />Certainly no current platform requires it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Fri, 06 Oct 2006 13:12:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does that user have a bluetooth keyboard and mouse?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve++)</author>
		<pubDate>Fri, 06 Oct 2006 22:51:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Does that user have a bluetooth keyboard and mouse?
</p></div></div><p>

No, the mouse is USB and the keyboard is PS/2.</p><p>EDIT: I removed the poll_mouse() function, but apparently the problem persists.  Perhaps it&#39;s a driver conflict and out of my hands to fix?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Sat, 07 Oct 2006 01:28:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I had exactly the same problem:<br />mouse (_x, _y and _b) and keyboard (key[]) stopped being updated for a second, just as if the allegro interrupt handler was no longer called.<br />In the mean time, my custom interruption kept being updated regularly.</p><p>I couldn&#39;t find what caused it. Win98, allegro42. It happened with the mingw version, I think.</p><p>These times, I started coding again (same game, but developping in MSVC) and I don&#39;t see the problem again (yet).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Audric)</author>
		<pubDate>Sat, 07 Oct 2006 19:37:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So, it may be a Mingw issue?  Ouch...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dale M.A. Johnson)</author>
		<pubDate>Tue, 10 Oct 2006 01:08:15 +0000</pubDate>
	</item>
</rss>
