Re: [AD] mouse_api branch

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


On 9/1/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
On 2006-09-01, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> On 9/1/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> > How's that?
> >
Would it help to think that most of the keyboard API and the mouse API
functions take AL_KEYBOARD* and AL_MOUSE* arguments, but, as a
convenience, they are implied?
Yes that's good

Of course you're right that AL_KEYBOARD and AL_MOUSE are only there now
to hook up the keyboard and mouse APIs to the event subsytem.
You're wondering if we should replace al_get_keyboard() with:

   AL_EVENT_SOURCE *al_get_keyboard_event_source(),

and similarly for the mouse, right?  That makes sense now.  I suppose
we'd need:

   AL_EVENT_SOURCE *al_joystick_get_event_source(AL_JOYSTICK *)
   AL_EVENT_SOURCE *al_display_get_event_source(AL_DISPLAY *)
   etc.

to keep things similar.  It avoids the typecasts of the current API at
least, but is even more verbose.
1. I think it would give us more flexibility if we avoided direct
structure access and used functions instead.
2. On verbosity, let's see how it shapes up, but I can imagine a
convenience function that works a bit like SDL_Init - it takes some
flags, initialises the relevant subsystem(s) and connects it to a
default event queue. This would probably be OK for most uses.
e.g

event_queue = al_install_events(AL_KEYBOARD|AL_MOUSE|AL_DISPLAY);

Pete




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