Cocos2d-x游戏开发之代码如何识别ios平台与android并分开处理

在Cocos2dx有条简单的预处理语句,用于代码中如何就不同平台执行相应的代码

void CppSprite::myInit(){

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    //ios
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"森" message:@"C++与Oc互调" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    [alert autorelease];
    [alert show];
#else
    //adroid
#endif
};


猜你喜欢

转载自blog.csdn.net/CJsen/article/details/9529517