iDevGames Forums
Carbon Key / Char Codes - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Carbon Key / Char Codes (/thread-4996.html)



Carbon Key / Char Codes - dave05 - Sep 25, 2005 08:41 AM

Just in case anyone other than me still uses carbon events rather than NSevents (I plan to make the change soon-ish), here's how I figured out character codes for non-ascii characters:

the user presses a key, then:

Code:
GetEventParameter(event,
        kEventParamKeyMacCharCodes,
        typeChar, nil,
        sizeof(charCode), nil,
        &charCode);

printf("%d\n", (int)charCode);

if anyone's interested, here are a few:

#define key_UpArrow 30
#define key_DownArrow 31
#define key_LeftArrow 28
#define key_RightArrow 29
#define key_ForwardDelete 127