Re: [AD] 4.3 Events and polling

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2006-08-09, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> On 8/9/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> > Not in the current implementation.  The API does not prevent it though,
> > but I would seriously reconsider whether polluting the implementation is
> > worth it.
> I suppose there would need to be a vtable in the event source object,
> but wouldn't there need to be one anyway to handle custom clean-up?

It's not that.  It's the mixing of polled and unpolled event sources in
blocking functions like al_wait_for_event() that I'm concerned about.
Essentially a blocking function needs to wake up every so often to do
the polling.  Then you have to consider that a single polled event
source could be registered with multiple event queues.

> > > This would be
> > > useful for a polling driver where it wouldn't make sense to get the
> > > value any more frequently than the game's main loop (I'm thinking of
> > > the joystick)
> >
> > This should not be necessary with modern OSes & joysticks.  Really the
> > gameport should be dropped.
> What do you mean by the gameport - do you mean the old DOS interface
> (port 201 or something was it?)

Yes.  http://en.wikipedia.org/wiki/Game_port

> Anyway, on OS X it's done via the USB HID manager, and the
> recommendation is to poll for the joystick position, although it is
> possible to set up an event queue for button presses. DirectInput (I
> looked at the 8.1 docs) says basically the same thing. (ie
> IDirectInputDevice8::Poll )

I don't understand why they would recommend polling over events.  Link?

For DirectInput, it says in [1]:

    The Poll method is technically optional as many devices are USB, and USB
    is an interrupt-driven bus. 

which leads me to think the Poll method is only to support gameport
joysticks, which IMHO are obsolete.  Further, [2] seems to suggest that
Poll is fast, so we shouldn't worry about a timer polling more
frequently than necessary.

Peter

[1] http://msdn.microsoft.com/library/en-us/dninput/html/directinputmapper.asp?frame=true

[2] http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_04/directx/input/using/devicedata/pollingeventnotification.asp





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/