Re: Re[2]: [AD] Proposal for first step towards new api

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


Javier González <xaviergonz@xxxxxxxxxx> wrote:

> > We leave device specific functions.
> > Let's make device specific functions a bit simmilar like:
> > al_get_keyboard(device,key)
> > al_get_mouse_button(device,key)
> > al_get_mouse_axis(device,axis)
> > al_get_joy_button(device,key)
> > al_get_joy_axis(device,axis)
> > It would be easier for programmer who has never used joystick
> > functions (like me) to learn them. All API looks nicer anyway.
>
> or even merge button and axis in
> int al_get_mouse(device, part) where part could be left button, x axis...
> int al_get_joystick(device, part)

nah... if we merge the input subsystem, we should do a better job. as i see
it we can remove the distinctions between the various input devices. an
input device can have buttons and axis (which covers mouse wheels AFAIK).
axis can be analogue or digital. so that would leave us with:

AL_INPUT *al_poll_input(AL_INPUT_DEVICE *device, AL_CONTROLLER *controller);

where device->type can be AL_KEYBOARD, AL_MOUSE or AL_JOYSTICK.
controller->type can be AL_BUTTON or AL_AXIS. AL_INPUT would be a struct
containing a buffer for buttons, axis info for both analog and digital axes
and a type entry describing what info was fetched. this is just my idea so
far... i don't know what it would look like in the end. the goal would of
course be that it is equally simple to use as today's system and more
powerful. adding some inline functions for fetching info from AL_INPUT
structs will therefore be neccessary. pointers to callback routines can be
put in either AL_INPUT_DEVICE, AL_CONTROLLER or both.

we can support multiple keyboards, joysticks and mice this way too, which
ought to be nice. i strongly disagree with the people saying a common input
API is a bad idea, they are prejudging an API they haven't seen yet.

Sincerely Henrik Stokseth.
-----------------------------------------------------------------------
E-mail: hstokset@xxxxxxxxxx  Homepage: http://hstokset.n3.net





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