Re: [AD] keyboard buffer (proposal)

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


On Sat, Dec 20, 2008 at 3:06 PM, Elias Pschernig
<elias.pschernig@xxxxxxxxxx> wrote:
> My vote is to completely remove ALLEGRO_KEYBOARD_STATE and al_key_down.
>
> It's not easier to use than events, and means you randomly lose key
> presses whenever the user starts typing/playing fast. So basically as
> soon as you use them, your game is broken. There's simply no reason at
> all to ever use them.
>
I disagree. And plus, as SiegeLord pointed out, using events could
break your game too.

However, I wouldn't mind removing ALLEGRO_KEYBOARD_STATE from the
programmer's view. How would people use it, other than:

al_poll_keyboard();
if (al_key_down(ALLEGRO_KEY_LEFT)) p.x--;

i.e., is that sufficient, or is there a good reason to expose
ALLEGRO_KEYBOARD_STATE?

On Sat, Dec 20, 2008 at 4:06 PM, Paul Suntsov
<siegelords_abode@xxxxxxxxxx> wrote:
> I personally find it annoying when a game gets out of synch with the hardware like that, so as a user, I'd prefer to have buffer nonetheless.
>
To be clear, my proposed 'buffer' is nothing but a simple event queue
that Allegro manages for the keyboard. It's meant as an easy way to
get the next key like in Allegro 4 without having to manage a queue.
No buffer will prevent the problem you are describing anyway... if the
OS doesn't notify you, your key can just as easily get stuck down in
the buffer.

However, the polling API (al_key_down) would prevent that problem,
since (as far as I know) it actually reads the current key state.

--
Matthew Leverton




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