Simple CarbonEvent Question

Abyssal
Unregistered
 
Post: #1
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
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #2
Try

#define returnKey 0x0D

if(charcode == returnKey)

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
uh, 0x0D is '\r'...
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2004.07
Post: #4
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)
{
   ...
}

Take aquadot!red out for a spin
It sure ain't your grandpa's pacman!
www.angelFrogGames.com
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  simple question (private) imaumac 9 3,811 Oct 21, 2008 09:37 PM
Last Post: imaumac
  simple Question about movement bonanza 3 3,049 Oct 17, 2007 11:12 AM
Last Post: bonanza
  Really simple #pragma question WhatMeWorry 9 4,080 Dec 13, 2006 10:15 PM
Last Post: Nick
  Simple OpenGL/Xcode Question. loopfick 10 6,594 Sep 8, 2005 09:54 AM
Last Post: Volte
  Simple Animation Question KiroNeem 11 5,526 Nov 20, 2004 09:17 AM
Last Post: DoG