iDevGames Forums
Simple CarbonEvent Question - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Simple CarbonEvent Question (/thread-4654.html)



Simple CarbonEvent Question - Abyssal - Jan 1, 2006 03:28 PM

Quote:case kEventRawKeyDown:
GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, nil,
sizeof(charCode), nil, &charCode);
gKeyState[charCode] = true;
break;


Sorry if im missing a really really easy answer but how do I tell if the return and enter keys have been pressed? I tried checking for "\n" and "\r"

Thanks


Simple CarbonEvent Question - kodex - Jan 1, 2006 04:08 PM

Try

#define returnKey 0x0D

if(charcode == returnKey)


Simple CarbonEvent Question - OneSadCookie - Jan 1, 2006 04:12 PM

uh, 0x0D is '\r'...


Simple CarbonEvent Question - radiance - Jan 1, 2006 09:53 PM

From events.h

Code:
kEnterCharCode = 3,
...
kReturnCharCode = 13,

and so...

Code:
char theChar;
GetEventParameter (event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &theChar);

if (theChar == (char)kReturnCharCode || theChar == (char)kEnterCharCode)
{
   ...
}