Re: [AD] keypresses

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


On Fri, Jan 04, 2002 at 12:56:56PM +0100, Lo'oRiS il Kabukimono wrote:
> > int al_key_down(int);
> 
> i really don't like using functions for such a thing, IMVHO here globals
> are cleaner and nicer. anyway if u want to put a function to do this
> u should also give the possibility to use globals like key[KEY_WHATEVER]
> 
> but it looks like everybody wants functions, so...

I can't remember if I said this before, but why don't mix the key
retrieving with the poll_keyboard call?

void al_poll_keyboard(unsigned char *key_array);

optionally with an unsigned long array_size value in case Allegro has
to grow the key array. This would translate the key array from internal
Allegro space to user space, where you can do anything with it, without
thinking about function calls slowing you down (besides the fractal you
are showing real time, of course).

The only bad thing is this practically imposes polling on the user, which
OTOH is good, given Shawn's answer about automatic locking surfaces...

-- 
 Grzegorz Adam Hankiewicz   gradha@xxxxxxxxxx   http://gradha.infierno.org/



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