HID Input Library - give me your wishlist

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
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. Wink
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #2
#include "GamepadLib.h"

InitGamepad();

ConfigureGamepad(n);

ButtonArray = GetGamepad(n);

that's all I want to see Smile
Quote this message in a reply
Member
Posts: 110
Joined: 2002.07
Post: #3
Zwilnik Wrote:#include "GamepadLib.h"

InitGamepad();

ConfigureGamepad(n);

ButtonArray = GetGamepad(n);

that's all I want to see Smile


i prefer

InitFrenchGamepad();

ConfigureCheeseGamepad(n);

ButtonArray = GetFroggyGamepad(n);

et voila LOL


its a good idea, remember to add the forcefeedback too
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2010.11
Post: #4
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.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #5
Support for multiple mice please!

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
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?
Quote this message in a reply
Member
Posts: 110
Joined: 2002.07
Post: #7
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
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #8
If I see the word Handle I'll hit someone Wink

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.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #9
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.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #10
I would rather see this as an OO thing rather than take the form of SDL like you suggested. Something more like this:

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.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #11
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!
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #12
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. Rasp

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #13
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
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #14
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 Smile

Games get designed to the minimum spec for controllers anyway, so there's no point in overcomplicating the API just to support wierd stuff.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #15
Awesome input (heh!) everyone, keep it coming. I might get this off the ground sooner than planned just because I'm so intrigued! Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Console-style gamepad/input library Carlos Camacho 9 5,578 Jan 8, 2007 04:20 PM
Last Post: OneSadCookie