I’ve got my App almost fully running on Mac (and on Linux, iOS, QNX, Win32…. great framework !). On Mac I can’t get the input fields to function properly (they don’t funtion at all). How can I enable keyboard input in CCTextFieldTTF in Mac ?
Solved it. Change keyDown in EAGLView.cpp to:
- (void)keyDown:(NSEvent )theEvent
{
#if 0
DISPATCH_EVENT;
#else
NSString theEventCharacters = [theEvent charactersIgnoringModifiers];
if ([theEventCharacters length] > 0)
{
unichar theChar = [theEventCharacters characterAtIndex:0];
if ( ([theEvent modifierFlags] & NSShiftKeyMask) && (theChar NSF1FunctionKey) ) {
cocos2d::CCDirector::sharedDirector()-\>getKeypadDispatcher()-\>dispatchKeypadMSG(cocos2d::kTypeBackClicked);
} else if ( ([theEvent modifierFlags] & NSShiftKeyMask) && (theChar NSF2FunctionKey) ) {
cocos2d::CCDirector::sharedDirector()->getKeypadDispatcher()->dispatchKeypadMSG(cocos2d::kTypeMenuClicked);
} else if (theChar NSDeleteFunctionKey || theChar 127) { // 127 is the backspace code
cocos2d::CCIMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
} else {
char typedChar = [theEventCharacters characterAtIndex:0];
cocos2d::CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(&typedChar, 1);
}
}
#endif
// DISPATCH_EVENT(theEvent, _cmd);
// pass the event along to the next responder (like your NSWindow subclass)
// [super keyDown:theEvent];
}