HID Input Library - give me your wishlist
Hi all,
Every now and then, people whine about Apple's HID (essentially gamepad/joystick) SDK support. The HID Manager isn't exactly straightforward, and while the HID Utilities are nice, they're just halfway towards being really good.
What I'm planning to do is to write a proper framework for handling gamepads and joysticks (with bindings in C++ and Obj-C) during the coming autumn, and I would love to hear some input on what you want it to do. So, all those things you never dared ask for goes here.
Every now and then, people whine about Apple's HID (essentially gamepad/joystick) SDK support. The HID Manager isn't exactly straightforward, and while the HID Utilities are nice, they're just halfway towards being really good.
What I'm planning to do is to write a proper framework for handling gamepads and joysticks (with bindings in C++ and Obj-C) during the coming autumn, and I would love to hear some input on what you want it to do. So, all those things you never dared ask for goes here.
#include "GamepadLib.h"
InitGamepad();
ConfigureGamepad(n);
ButtonArray = GetGamepad(n);
that's all I want to see
InitGamepad();
ConfigureGamepad(n);
ButtonArray = GetGamepad(n);
that's all I want to see
Zwilnik Wrote:#include "GamepadLib.h"
InitGamepad();
ConfigureGamepad(n);
ButtonArray = GetGamepad(n);
that's all I want to see
i prefer
InitFrenchGamepad();
ConfigureCheeseGamepad(n);
ButtonArray = GetFroggyGamepad(n);
et voila
its a good idea, remember to add the forcefeedback too
InitCanadianGamepad();
ConfigureCheeseGamepad(n);
ButtonArray = GetFroggyGamepad(n);
forceSomeFeedBack(n);
And poof! Force feedback.
Or you just use a big heavy bass and hope they have a nice sub-woofer.
ConfigureCheeseGamepad(n);
ButtonArray = GetFroggyGamepad(n);
forceSomeFeedBack(n);
And poof! Force feedback.
Or you just use a big heavy bass and hope they have a nice sub-woofer.
Support for multiple mice please!
Sir, e^iπ + 1 = 0, hence God exists; reply!
So basically, would a data structure that doesn't do much more than metadata (controller name/vendor and type), button state bit array, and normalized vectors for analog sticks be the preferred format?
Considering that HID presents most input elements in a tree structure, which is truly annoying, I'd like to flatten that into just such arrays as Zwilnik proposes. Is there a reason for anyone to keep the hierarchy alive in the framework?
Considering that HID presents most input elements in a tree structure, which is truly annoying, I'd like to flatten that into just such arrays as Zwilnik proposes. Is there a reason for anyone to keep the hierarchy alive in the framework?
just make it simple !
return all in c string or int or float
dont want to play with aother stupid tihng that eat time
for exemple you can create some fonction that return the gamepad name
gamepad_givename(gamepadID, &namethingy);
gamepad_howmanygamepadpluged();
gampad_button_1(gamepadID)
gampad_button_2(gamepadID)
gampad_button_3(gamepadID)
i think nobody care about the hierarchy
return all in c string or int or float
dont want to play with aother stupid tihng that eat time
for exemple you can create some fonction that return the gamepad name
gamepad_givename(gamepadID, &namethingy);
gamepad_howmanygamepadpluged();
gampad_button_1(gamepadID)
gampad_button_2(gamepadID)
gampad_button_3(gamepadID)
i think nobody care about the hierarchy
If I see the word Handle I'll hit someone 
Simple is definitely the way. If anyone wants some sort of extra uber complicated functionality they can bolt it on afterwards.
If the aim is to make a straightforward HID framework then the simplest common format is best. Ideally, make it so that 'Gamepad' is a common set of functions for reading an actual gamepad *as well* as keyboard.
As Dan suggested, duplicating the functionality of the array with straightforward button checking functions (button held or button pressed being particularly useful) would do no harm either.

Simple is definitely the way. If anyone wants some sort of extra uber complicated functionality they can bolt it on afterwards.
If the aim is to make a straightforward HID framework then the simplest common format is best. Ideally, make it so that 'Gamepad' is a common set of functions for reading an actual gamepad *as well* as keyboard.
As Dan suggested, duplicating the functionality of the array with straightforward button checking functions (button held or button pressed being particularly useful) would do no harm either.
I was quite fond of Amelio, but it never caught on. It could be used from carbon or cocoa. Worth taking a look at.
It had a seperate app that you could use to make graphical GUIs for your specific devices - so that the interface would have an image of your joypad and show you where the controls were. And when it started up it checked on the web for GUIs that anybody else had already created for your device. If it couldnt find a driver and you didnt want to create one it used a regular pull-down menu for whatever controls it could find.
It also let you calibrate your analog controls.
It used to be hosted here on idevgames.com, but has gone away.
It had a seperate app that you could use to make graphical GUIs for your specific devices - so that the interface would have an image of your joypad and show you where the controls were. And when it started up it checked on the web for GUIs that anybody else had already created for your device. If it couldnt find a driver and you didnt want to create one it used a regular pull-down menu for whatever controls it could find.
It also let you calibrate your analog controls.
It used to be hosted here on idevgames.com, but has gone away.
I would rather see this as an OO thing rather than take the form of SDL like you suggested. Something more like this:
I just believe that format is more appealing.
Code:
//choose your favorite method of creating the object
HIDGamePad *pad = HIDManager::getSingleton().createGamepad();
pad->isButtonDown(n);
float x = pad->getXAxis();I just believe that format is more appealing.
if a higher level OO structure would suit you better then it would probably make most sense to implement that yourself on top of an easy to use lower level structure.
Sir, e^iπ + 1 = 0, hence God exists; reply!
I kind of agree with unknown. An easy to use low level structure would be preferable. That way you could do whatever with it.
I'm fairly fond of SDL because it works with pretty much any input device. Being able to use input in a unified way from the keyboard, mouse and gamepads/joysticks is nice. It's event loop is also nice.
My wish-list:
* Joystick axes return floats. [-1, 1]
* State polling. (i.e. get_joystick_axis_value(joynum, axisnum) -> float)
* Support for event loops. get_events() -> a list of events since the last call
* C interface.
* keyboard values map to ASCII when possible. (really handy in SDL)
* Multithreaded support.
I'm fairly fond of SDL because it works with pretty much any input device. Being able to use input in a unified way from the keyboard, mouse and gamepads/joysticks is nice. It's event loop is also nice.
My wish-list:
* Joystick axes return floats. [-1, 1]
* State polling. (i.e. get_joystick_axis_value(joynum, axisnum) -> float)
* Support for event loops. get_events() -> a list of events since the last call
* C interface.
* keyboard values map to ASCII when possible. (really handy in SDL)
* Multithreaded support.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
What to do with out of spec devices? (Like mice that report 256 buttons...)
This has to be a easy to use low level C interface. It's the common denominator.
-Jon
This has to be a easy to use low level C interface. It's the common denominator.
-Jon
aarku Wrote:What to do with out of spec devices? (Like mice that report 256 buttons...)
This has to be a easy to use low level C interface. It's the common denominator.
-Jon
Totally. no point in doing a C++ only interface, might as well waste time with the Apple HID library for that.
As far as device spec. decide on a reasonable maximum number of buttons and controls and limit to that. If a controller is reporting more than 4 analog axis, a dpad and 16 buttons, just ignore the extras. That way it makes the interface (for both coder and player) more straightforward. If company x wants you to support their funky 256 button mouse they can write a driver for it

Games get designed to the minimum spec for controllers anyway, so there's no point in overcomplicating the API just to support wierd stuff.
Awesome input (heh!) everyone, keep it coming. I might get this off the ground sooner than planned just because I'm so intrigued!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Console-style gamepad/input library | Carlos Camacho | 9 | 5,272 |
Jan 8, 2007 04:20 PM Last Post: OneSadCookie |
|

