How to support gamepad/joystick
What is the best way to add support for joysticks/gamepad to a mac game...
I can't seem to find any apple sample code that demonstrates support....
I can't seem to find any apple sample code that demonstrates support....
With pain, suffering, hair-pulling, bloodied keyboard, and the HID Manager.
The HID Manager has two interfaces; the new one added in 10.5 is a bit nicer than the old, but either way, you're left on your own with respect to calibration, element naming, etc.
The HID Manager has two interfaces; the new one added in 10.5 is a bit nicer than the old, but either way, you're left on your own with respect to calibration, element naming, etc.
OSC - Is there any sample code that you know of that supports a hid usb gamepad?
You can try ddhidlib I suppose. I haven't messed with it lately, but I don't think it supports the new API so there may be issues with that.
I haven't seen the sample code show up at Apple yet, although I haven't looked recently, but George Warner has some sample code for it on his iDisk. The file you'll want to download is LeopardHID.zip
Here's a relevant technote.
I haven't seen the sample code show up at Apple yet, although I haven't looked recently, but George Warner has some sample code for it on his iDisk. The file you'll want to download is LeopardHID.zip
Here's a relevant technote.
If you don't mind ignoring the extra bloat that SDL has in terms of useless built in graphics and sound functionality, it has a nice cross platform event system including auto calibrated joystick input. It's a very simple and low level event system, but that makes it better suited to games anyway.
While you can't get mouse and keyboard input from SDL without creating and using an SDL window, I'm pretty sure you can use joystick input separately.
While you can't get mouse and keyboard input from SDL without creating and using an SDL window, I'm pretty sure you can use joystick input separately.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Thanks for the replies - I am making a sample project to demonstrate using a USB HID joystick that I will post shortly...
Quick question:
Should I process events using a registered callback from the HID manager or is it better to poll the device every frame?
Thanks for any feedback...
Quick question:
Should I process events using a registered callback from the HID manager or is it better to poll the device every frame?
Thanks for any feedback...
You can poll analog inputs like sticks, but it's safest to queue momentary input like buttons.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Advice on coding of On-Screen Controls ( Joystick and multiple buttons) | Elphaba | 5 | 2,635 |
Aug 10, 2009 11:02 PM Last Post: Elphaba |
|
| Mouse button enabler, like GamePad Companion | setera | 4 | 3,879 |
Apr 30, 2006 06:32 PM Last Post: setera |
|

