Re: [AD] ALLEGRO_KEYBOARD_STATE improvement

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


On 2008-10-13, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > On Sun, Oct 12, 2008 at 10:59 AM, Ryan Patterson
> > <cgamesplay@xxxxxxxxxx> wrote:
> > >
> > > Obviously, AL_KEY_MAX isn't the right symbol to use. However, since
> > > ALLEGRO_KEY_MAX is no longer a preprocessor symbol at all, that error
> > > will never get triggered. I've written a patch that changes the size
> > > of the array to be statically calculated using the value of
> > > ALLEGRO_KEY_MAX:
> > >
> > > typedef struct ALLEGRO_KEYBOARD_STATE
> > > {
> > >   struct ALLEGRO_DISPLAY *display;  /* public */
> > >   unsigned int __key_down__internal__[(ALLEGRO_KEY_MAX + 7) / 8 /
> > > sizeof(unsigned int)]; /* internal */
> > >   /* Was using uint32_t, but some machines don't have stdint.h. */
> > > } ALLEGRO_KEYBOARD_STATE;
> 
> Thanks.

Well, there was one slight advantage to how we were doing it before: we
could control how much padding to reserve such that we could add more
key codes without breaking ABI compatibility.  Now, we still have some
wriggle room but not as much.

Peter





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