Jem
Jem

Reputation: 6406

ObjC Conditional compilation in Cocos2D

I'm trying to have a method behave differently between iOS and MacOS. I need this to process keyboard events on the MacOS platform.

Browsing the source code, I found the following macros in use. When running my code for the macos platform, I only get "begin" being output to console, as if the "_CC_PLATFORM_MAC" wasn't defined.

Am I doing this wrong?

-(void)processEvent:(NSEvent*)event{

    NSLog(@"begin");


#ifdef __CC_PLATFORM_IOS

    NSLog(@"nothing here");

#elif defined(__CC_PLATFORM_MAC)

    NSLog(@"process keyboard event");


#endif // __CC_PLATFORM_MAC

}

Thanks...

Upvotes: 0

Views: 104

Answers (1)

Jem
Jem

Reputation: 6406

The header was missing #import "cocos2d.h"

Upvotes: 1

Related Questions