InputSprocket to HID Manager
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 .
| Messages In This Thread |
|
InputSprocket to HID Manager - SethWillits - Jan 18, 2004, 01:06 AM
InputSprocket to HID Manager - SethWillits - Jan 18, 2004, 04:54 AM
InputSprocket to HID Manager - isgoed - Sep 2, 2004, 12:01 PM
InputSprocket to HID Manager - isgoed - Sep 2, 2004, 12:15 PM
InputSprocket to HID Manager - aarku - Sep 2, 2004, 12:41 PM
InputSprocket to HID Manager - SethWillits - Sep 2, 2004, 12:53 PM
InputSprocket to HID Manager - Fenris - Sep 2, 2004, 01:07 PM
InputSprocket to HID Manager - isgoed - Sep 2, 2004, 02:07 PM
InputSprocket to HID Manager - aarku - Sep 2, 2004, 02:10 PM
InputSprocket to HID Manager - ThemsAllTook - Sep 2, 2004, 02:20 PM
InputSprocket to HID Manager - Fenris - Sep 2, 2004, 11:43 PM
InputSprocket to HID Manager - isgoed - Sep 3, 2004, 02:19 AM
InputSprocket to HID Manager - Fenris - Sep 3, 2004, 01:57 PM
InputSprocket to HID Manager - isgoed - Sep 20, 2004, 09:05 AM
InputSprocket to HID Manager - SethWillits - Sep 21, 2004, 08:20 AM
InputSprocket to HID Manager - Fenris - Oct 4, 2004, 01:07 PM
InputSprocket to HID Manager - isgoed - Oct 7, 2004, 11:22 AM
InputSprocket to HID Manager - SethWillits - Oct 9, 2004, 02:01 PM
InputSprocket to HID Manager - Fenris - Oct 9, 2004, 02:35 PM
InputSprocket to HID Manager - Fenris - Oct 9, 2004, 02:36 PM
InputSprocket to HID Manager - isgoed - Oct 10, 2004, 02:50 AM
InputSprocket to HID Manager - SethWillits - Oct 11, 2004, 04:49 PM
InputSprocket to HID Manager - aegidian - Oct 12, 2004, 04:52 AM
InputSprocket to HID Manager - anonuser - Oct 12, 2004 03:55 PM
|
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 |
|

