InputSprocket to HID Manager
Oh, sweet things, it completely slipped my mind. It's up at http://www.rusted.se/hiddialognib.zip
Sorry about the delay, and keep asking questions as they arise!
Sorry about the delay, and keep asking questions as they arise!
Fenris Wrote:If anyone's interested, I've got a C++ class hierarchy that (needing a little cleanup, though) correctly handles InputSprocket and HID, with fallbacks to GetKeys completely transparently. Sound off, and I'll pack it up for you.Well, I got your code compiled today. I could not get it to run properly. It still crashes because there were still dependencies on your classes, headers and resources. Your code did lead me to the apple source code, which was real usefull. I suggest everybody look at it. It's at: http://developer.apple.com/samplecode/Ha...-date.html
. I made my own sample code based on apple. It works stand alone check it out at:
HID Sample Code: "Control HID input" at http://www.revaro.net/developer/
here is a snap:
![[Image: HID_Control_Input.jpg]](http://www.revaro.net/developer/images/HID_Control_Input.jpg)
laters,
isgoed Wrote:HID Sample Code: "Control HID input" at http://www.revaro.net/developer/
Ok, I would really like to pick this apart (Fenris' too), but what's with the missing code?
Am I the only programmer alive that likes to have a complete, working, well presented example where I can click "build" and it works?
No, you're not.
However, you may be the only programmer alive with the time to do it. I'm mentally thinking about writing a HID tutorial, but I've got to fix my book reviews for IDG and then fix my school assignments. However, they way I learned it was to pick apart George Warner's HID Utilities example from developer.apple.com, but I don't think that's around anymore. ...
No, it's there: http://developer.apple.com/samplecode/HI...ource.html Also look at the other HID examples and pick them apart too. I'm sorry about my lacking support here, but I hardly have the time to even log on to here anymore.
I'm available for any questions though.
However, you may be the only programmer alive with the time to do it. I'm mentally thinking about writing a HID tutorial, but I've got to fix my book reviews for IDG and then fix my school assignments. However, they way I learned it was to pick apart George Warner's HID Utilities example from developer.apple.com, but I don't think that's around anymore. ...No, it's there: http://developer.apple.com/samplecode/HI...ource.html Also look at the other HID examples and pick them apart too. I'm sorry about my lacking support here, but I hardly have the time to even log on to here anymore.
I'm available for any questions though.
Sorry, the HID utilities is just an abstraction layer to the 'real' HID stuff. It's great, but it's not a learning source. HID Explorer is what you want to look at.
FreakSoftware Wrote:Ok, I would really like to pick this apart (Fenris' too), but what's with the missing code?Sorry,
I just put a corrected example online (it's version 1.0.1 now). http://www.revaro.net/developer
You wouldn't believe how I hated xcode just now. First it takes a minute to launch (normally 15 secs or so). Than it gives weird error messags, it's abnormaly slow, it crashes on me when I was nearly finished and then it doesn't want to copy the new dylib. Well I hope it works now for you.
You should now be able to just build it. Putting sample code and working applications online almost never works the first time.
isgoed Wrote:Sorry,
I just put a corrected example online (it's version 1.0.1 now). http://www.revaro.net/developer
Cool beans, I'll look at that now. Thanks. (Waiting for Brian's book...)
Brian Greenstone's new book Pangea Software's Ultimate Game Programming Guide for Mac OS X has a great chapter (12) dealing with HID, and spilling all the code for Nanosaur 2's HID interface.
Although I've only glanced at it for 15mins or so (it arrived this morning) I'd recommend it.
Although I've only glanced at it for 15mins or so (it arrived this morning) I'd recommend it.
well you can do this, I don't reccomend this. but you can get a key press based on an event.
this is if you're using the Carbon Event Manager.
to your Event Type Spec add this a kEventClassKeyboard, and a kEventRawKeyDown. This will allow you to test for keyboard events when a key is down. However you're limited in the fact modifier keys won't work of the bat but it is really easy to get the key pressed.
sample Event Type Spec:
EventTypeSpec mainSpec[] = {
{ kEventClassCommand, kEventCommandProcess },
{ kEventClassMouse, kEventMouseDown },
{ kEventClassControl, kEventControlHit },
{ kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassWindow, kEventWindowClose },
{ kEventClassKeyboard, kEventRawKeyDown},
{ kEventClassKeyboard, kEventRawKeyRepeat }
};
just add this when you're testing if a key was pressed to get the pressed key.
char macKey;
GetEventParameter(event,kEventParamKeyMacCharCodes,typeChar,NULL,sizeof(macKey),NULL,&macKey);
that'll get you you're key, provided your event handler is setup correctly .
this is if you're using the Carbon Event Manager.
to your Event Type Spec add this a kEventClassKeyboard, and a kEventRawKeyDown. This will allow you to test for keyboard events when a key is down. However you're limited in the fact modifier keys won't work of the bat but it is really easy to get the key pressed.
sample Event Type Spec:
EventTypeSpec mainSpec[] = {
{ kEventClassCommand, kEventCommandProcess },
{ kEventClassMouse, kEventMouseDown },
{ kEventClassControl, kEventControlHit },
{ kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassWindow, kEventWindowClose },
{ kEventClassKeyboard, kEventRawKeyDown},
{ kEventClassKeyboard, kEventRawKeyRepeat }
};
just add this when you're testing if a key was pressed to get the pressed key.
char macKey;
GetEventParameter(event,kEventParamKeyMacCharCodes,typeChar,NULL,sizeof(macKey),NULL,&macKey);
that'll get you you're key, provided your event handler is setup correctly .
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| How to write a custom memory manager | Malarkey | 3 | 3,340 |
Oct 27, 2005 09:52 AM Last Post: aqua_scummm |
|
| Do you use HID Manager in your games? | Andrew | 10 | 4,464 |
Aug 14, 2005 01:00 PM Last Post: wadesworld |
|
| Bundles with Carbon File Manager... | BinarySpike | 2 | 2,886 |
Apr 25, 2005 03:36 PM Last Post: BinarySpike |
|

