博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cocos2d-x之Node移除HelloWorld节点
阅读量:7219 次
发布时间:2019-06-29

本文共 593 字,大约阅读时间需要 1 分钟。

cocos2d-x之Node移除HelloWorld节点

    
    设置HelloWorld标签的标记:
        auto label = LabelTTF::create("Hello World", "Arial", 24);
        label->setTag(12);//为HelloWorld标签添加标记
        
    修改关闭按钮的方法

1 void HelloWorld::menuCloseCallback(Object* pSender) 2 { 3     //Director::getInstance()->end(); 4     do{ 5         Node *pNode = this->getChildByTag(12);//获取HelloWorld标签 6         CC_BREAK_IF(!pNode);//判断pNode是否存在,如果不存在跳出循环 7         pNode->removeFromParentAndCleanup(true);//移除标签 8     }while (0); 9 10 11 12 #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)13     exit(0);14 #endif15 }

 

转载于:https://www.cnblogs.com/dudu580231/p/4386341.html

你可能感兴趣的文章
group by 与 order by 一起使用的时候
查看>>
HTML+CSS
查看>>
链接服务器创建
查看>>
用Vue的方式实现复选框
查看>>
mac下安装xampp、及其之上的组件安装
查看>>
C++内存对齐总结
查看>>
Web设计的速查卡(转)
查看>>
数据结构之哈夫曼树
查看>>
hdu1038
查看>>
CentOS 6.4下Zabbix的安装配置
查看>>
前端开发注意的问题 ,浏览器兼容性
查看>>
centos和redhat下 uwsgi配置
查看>>
Markdown 学习笔记
查看>>
vue-element-admin 多层路由问题
查看>>
Css问题 margin float 文档流 背景图底部充满
查看>>
JS match() 方法 使用
查看>>
关于shopee平台接口(php)对接示例
查看>>
BNU OJ 51000 BQG's Random String
查看>>
PAT (Advanced Level) 1044. Shopping in Mars (25)
查看>>
hdu 1531 King
查看>>