Re: [AD] demo of new joystick API

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


Matthew Leverton wrote:

I think the joysticks of A4 is one of the sections that is the least
broken.


Agreed.

- Function: bool al_install_joystick_driver(void)

Is there only going to ever be one joystick driver per platform?

Well... Windows was the only one that had two joystick drivers. Someone might want to reintroduce the non-DX one, but I dunno why.

It could be al_install_joystick(), as we have install_mouse(),
install_keyboard(), etc in A4. I have nothing against verbose naming,
but as long as "install" is always used in context of an overall
driver - I'm not sure "driver" is needed in the function name.

Yeah, I'm not sure. But all the other al_install_*() functions look like they will be returning objects, like:

   AL_TIMER *al_install_timer();
   AL_KEYBOARD *al_install_keyboard();
   etc.

1. "request" & "release".  I'm not sure what to call them.
"acquire/release" was suggested but it sounds too much like

I think some of this will be more clear as the API evolves. I
personally would suggest the same naming convention. To me, the aspect
of grabbing a video bitmap or a joystick is similar enough that they
both could have the same prefix (acquire).

The thing is, you're not allowed to acquire_bitmap() for very long before doing a release_bitmap(). Whereas most programs would "request" a joystick for the entire duration of a game, and perhaps never release it (it is automatically released when Allegro shuts down). So it's like locking a mutex vs. opening a file. Maybe it should just be al_open_joystick()?

Other thoughts:

What about a al_joystick_name() which returns the name of the
joystick? I don't know on what platforms/devices that's possible, but
I know some games are able to detect my MS SideWinder as such. I don't
know how they do it, but just a thought...

I will look into it.

Also, has any thought been given on force-feedback support? I've
played around with Marcello's FF hack for A4, and it was interesting
to use.


Yes, FF would be great. I'm afraid that any API we come up with might be too closely tied to DirectInput though. What does MacOS X have? Linux has nothing standardised, AFAIK.

A possible approach would be to initially have a Windows-only extension to the joystick API that exposes DirectInput's abilities. When (and if) other OSes catch up, then we can try to find some common ground between them. The functions would be properly marked as platform-specific, like al_win_joystick_*().

Peter




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