Re: [AD] New gfx api

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


Chris wrote:

Angelo Mottola wrote:

I was thinking about this whole events stuff... Currently, you have to create at least one event queue and attach event sources to it. Then you regularly query this queue for events.


I don't think I properly understand these event sources and queue stuff.


Their designs are documented at http://alleg.sourceforge.net/future/
in particular events.txt, evtqueue.txt, evtsrc.txt

The way I understand it, if you'd want to read the keyboard, you'd have to manually check for events and use them until the queue is empty (polling, in essence.. which I thought we didn't want).


The difference between polling (in my understanding) and events is that polling requires the user to *guess* when something has happened. On the other hand, events *tell* the user when something has happened, so is far more efficient.

I prefer the way Allegro currently does it, where the key[] array is updated asyncronously and holds the state of the keyboard keys at any given moment in time.


You'll be glad to know the input device designs support both models. See keyboard.txt, joystick.txt & pointer.txt (although the keyboard and pointer APIs require changes as they are a bit ugly in parts).

Peter




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