PDA

View Full Version : Keys I Can Use In Games


Nick
2004.07.21, 01:41 PM
Are there any keys on the keyboard that I CANNOT use when assigning keys for controls in my game?

skyhawk
2004.07.21, 02:17 PM
power

Nick
2004.07.21, 02:20 PM
Very nice :). But seriously, am I able to use all the other buttons.

skyhawk
2004.07.21, 02:52 PM
as far as I am aware of

ERaZer
2004.07.21, 03:05 PM
But you should consider stuff like not using Fkeys(becouse of the powerbook thing), and not keys you easily do other stuff with(I remeber a FPS game where you ran with the command key and switched weapons with the Q buttonÖ It didn't work too good.)

Nick
2004.07.21, 03:07 PM
Alright thanks.

PowerMacX
2004.07.21, 04:11 PM
I read somewhere (here? CMG?) that Cocoa has problems if you press CMD+an arrow key (the arrow key gets "stuck")

skyhawk
2004.07.21, 04:14 PM
actually it is command and any key. but this is only a problem if you input keys a certain way (namely ignoring modifers). I believe arekkusu has the fix for said problem

JustinFic
2004.07.22, 11:43 PM
Some issues I've ran into:

Powerbooks also don't have a separate keypad. Yes, you can hit numlock and use 789-uio-jkl on your keyboard, but it doesn't feel right at all. If you map controls to the keypad, make sure you mirror them to the arrow keys (or just let the player change them.)

You can only have 2 keys pressed simultaneously on your keyboard. The third doesn't register at all. Keys that DON'T count toward this are F-keys, arrow keys and the keypad.

arekkusu
2004.07.23, 12:55 AM
You can fix the Cmd key problem in Cocoa if you subclass NSApp and override sendEvent. I think the thread for that got lost in the downtime, but the code is in Shoot Things if anyone needs it.

So, you can use any key, but you should be aware that not all keyboards have all keys. F13 F14 F15, for example. Or Ò is a key on a Spanish keyboard but a dead key combo on a US keyboard.

The number of simultaneous keypresses that register varies depending on the keyboard. It's two on old machines, eight on my powerbook.

AnotherJake
2004.07.23, 03:49 AM
You can fix the Cmd key problem in Cocoa if you subclass NSApp and override sendEvent. I think the thread for that got lost in the downtime, but the code is in Shoot Things if anyone needs it.
Yeah, I think that thread is toast. Here's a quick code snippet to fix the command key-up issue.

// -paste this anywhere in your Cocoa code
// -to override NSApplication use the Target's inspector to set Principle Class:
// to KeyUpOverride
// -return it to NSApplication if this is removed

@interface KeyUpOverride : NSApplication {
}

@end

@implementation KeyUpOverride

- (void)sendEvent:(NSEvent *)anEvent
{
if( [anEvent type] == NSKeyUp )
{
[[[self mainWindow] firstResponder] tryToPerform:@selector(keyUp:) with:anEvent];
return;
}
[super sendEvent:anEvent];
}

@end