Translating HID keyboard events to unicode chars

elias
Unregistered
 
Post: #1
I want to access the mouse and keyboard through HID, and so far I have managed to get everything I need, except translated characters from the keyboard. I know about the function UCKeyTranslate, but it only takes virtual key codes, and I don't know a way to come from HID usage codes to virtual key codes.

Can it be done? I suspect a similar process is already done by the Mac kernel anyway, because it needs the characters from HID devices too.

- elias
Quote this message in a reply
Moderator
Posts: 435
Joined: 2002.09
Post: #2
Wish I could answer your question, but I don't know how it's done.

Perhaps you might consider creating your own game event type. This would isolate your game from caring about the source of the events. Then you just write constructors that would create your "game events" from an HID signal, NSEvent, network packet, or anything else that might supply information to your game.

This would work around your problem by allowing you to handle keyboard events as Cocoa/Carbon events (which give you unicode) but the gamepad/joystick signals could come from HID.

I suppose this suggestion might not help you if you are trying to handle multiple keyboards as separate devices... I'm not sure.

I don't know if Amelio uses unicode, but it does handle keyboards, mice, and gamepads side-by-side, so you might have a look at it. I don't have the link handy, but it was posted recently in the iDG forums message so a quick search will give it to you.

Just some suggestions...

Measure twice, cut once, curse three or four times.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Keyboard Handling skyhawk 10 6,638 Oct 26, 2010 08:47 AM
Last Post: skyhawk
  keyboard limitations daveh84 8 4,527 Feb 13, 2009 02:48 PM
Last Post: ferum
  What... the... heck? Const Char & Chars. Jones 6 3,621 Jun 12, 2006 03:54 PM
Last Post: akb825
  Cocoa Keyboard help Iceman 5 4,107 Aug 1, 2005 06:06 PM
Last Post: nabobnick
  Translating a window coordinate to a view coordinate emileej 3 2,966 Jun 20, 2005 11:25 AM
Last Post: emileej