Re: [AD] ALLEGRO_KEYBOARD_STATE improvement |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Coordination of admins/developers of the game programming library Allegro" <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] ALLEGRO_KEYBOARD_STATE improvement
- From: "Ryan Patterson" <cgamesplay@xxxxxxxxxx>
- Date: Sun, 12 Oct 2008 22:22:48 -0400
You can add wiggle room by manually increasing ALLEGRO_KEY_MAX.
On Sun, Oct 12, 2008 at 7:35 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> 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
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>
--
Regards,
Ryan Patterson <mailto:cgamesplay@xxxxxxxxxx>