Re: [AD] demo of new joystick API |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Peter Wang wrote:
Matthew Leverton wrote:I think the joysticks of A4 is one of the sections that is the least broken.Agreed.
I wouldn't say broken.. more like convoluted and confusing. What I have a problem with is the axis stuff.. I mean, you have no idea where the stick/axis's are on the joystick, so its near impossible to just throw joystick support in. You have to provide manual configuration in case the user's joystick doesn't match what the game expects.
Now, if we could map axis's to seperate analog buttons, that would be cool. Because them all you have to do is specify different button placements. Much easier than having to worry about stick/button placement and useage.
- 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.
I prefer having explicit install functions in case you want to introduce pre-installation options. Though I personally think the *_driver bit is too much.. al_install_joystick is good.
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.
Well, the timer is a different type of object. It's not an input object so it's behavior should be allowed to be slightly different. Though with the input objects, perhaps they could return the first/only device of that type? So
x = al_install_keyboard(); would be equivilant to al_install_keyboard_driver; x = al_get_keyboard(0);
1. "request" & "release". I'm not sure what to call them. "acquire/release" was suggested but it sounds too much likeI 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).
I'm not sure I like "request" either. When you request something (like request_video_bitmap), the program returns ASAP and does whatever in the background. What about "get"?
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()?
What about al_get_joystick? It gets a handle to the joystick number you pass (if available). The handle is then destroyed with the driver, so the handles you got just become invalid. I think that works..
- Kitty Cat
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |