现在的位置: 首页 > 综合 > 正文

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

2013年10月10日 ⁄ 综合 ⁄ 共 292字 ⁄ 字号 评论关闭

在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
};

抱歉!评论已关闭.