InputSprocket to HID Manager

Oldtimer
Posts: 834
Joined: 2002.09
Post: #16
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! Smile
Quote this message in a reply
isgoed
Unregistered
 
Post: #17
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]

laters,
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #18
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?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #19
No, you're not. Smile 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. Sad I'm available for any questions though.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #20
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.
Quote this message in a reply
isgoed
Unregistered
 
Post: #21
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.
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #22
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...)
Quote this message in a reply
Member
Posts: 28
Joined: 2003.10
Post: #23
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.

-- Giles Williams
Oolite - retro space-sim agogo
Quote this message in a reply
anonuser
Unregistered
 
Post: #24
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 .
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How to write a custom memory manager Malarkey 3 3,624 Oct 27, 2005 09:52 AM
Last Post: aqua_scummm
  Do you use HID Manager in your games? Andrew 10 4,856 Aug 14, 2005 01:00 PM
Last Post: wadesworld
  Bundles with Carbon File Manager... BinarySpike 2 3,174 Apr 25, 2005 03:36 PM
Last Post: BinarySpike