Game Controller input?

Looking to control an OF app by the two lil joysticks on a XBOX360 Wireless controller. I’ve found a 3rd party driver for the controller for OSX, and Jinput is allowing me to do some basic controller polling for Processing but I want to get similar functionality (cross platform) in OF.

Does anyone know of any lightweight particularly easy to use controller polling libraries? (one that can trigger the controller’s vibration motor is ++) that isn’t tangled to some other monolithic “game engine”

Any and all help appreciated!!

Danke
Lee

You could use HID (http://at.or.at/hans/pd/hid.html) for OSX or Linux in conjunction with Pure Data, using OSC to communicate with OF.

I also found this c++ library, but I’ve never used it:
http://home.gna.org/openinput/features.shtml

hope that’s of help!

hmm. I thought about just tunneling from processing with OSC but I would much rather this be selfcontained. Less pieces to break.

Thanks for the link to that lib. I’ll have to check it out. Hopefully it works on osx too!

Still hunting for the perfect lib…

Hi,

I’ve had a good experience with OIS for cross platform input handling under Ogre. However, it’s completely abstracted from the graphics library, you’ll only have to find a way to pass it a system-dependent window handle.

hth,
P.

Well, according to the development roadmap the OpenInput library has planned support for OSX in version 0.5.0. It’s currently at 0.2.3 however…and was last modified in 2006

Actually, the SDL library has good joystick support.
You could without too much trouble I think swap out GLUT for SDL.
The ability to decouple windowing systems from OF core would be a great feature for the future (and longevity of OF) I think. I’ve been hooking OF to another windowing system that I have to use and currently it’s quite doable but a little bit messy.

[quote author=“grimus”]Actually, the SDL library has good joystick support.
You could without too much trouble I think swap out GLUT for SDL.
The ability to decouple windowing systems from OF core would be a great feature for the future (and longevity of OF) I think. I’ve been hooking OF to another windowing system that I have to use and currently it’s quite doable but a little bit messy.[/quote]

I completely agre with this, there are times when you need to do something a bit exotic, which I would argue is probably why you are using C++ in the first place, and GLUT isn’t always the best choice.
I’ve used SDL for many years, but recently used SFML (http://www.sfml-dev.org/) on a project where I needed to do multiple windows. (Worked around it in the end)

I myself am just getting familiar with OF now, but will look into this when I have some time.

This would also help in terms of porting OF to other platforms where GLUT does not exists, like the iPhone, although I suppose those are actually quite rare.

/A

I just used SDL and it worked via:

  
SDL_JoystickUpdate();  
if (SDL_JoystickGetButton(joy,1)) {  
	printf("button 1 pressed\n");  
}  

Though it didn’t work using

  
SDLEvent event;  
while(SDL_PollEvent(&event)) {...}  

It never entered the while loop… anyone else ran into this? It doesn’t really matter because it works as mentioned on top of my post… but would be interesting.

Kind regards
Bernd

just a quick heads up that in the 0.06 development we have decoupled the window system from glut, and have OF running on glfw, gtk, iphone, etc. We do this via a base window class and window classes like glut, that extend the base. there are a few quirks we are working out, like keyboard definitions need to be remapped across window systems, but besides that, it’s working very well and let’s you use the simplicity of OF on different window systems.

take care!!
zach