真心觉得Cocostudio导入资源坑爹!
Cocostudio目前的功能包括UI编辑器、动画编辑器、场景编辑器和数据编辑器。
UI编辑器导出的文件包括一个.ExportJson
文件,一个.pList
文件和一个.png
文件。Cocostudio中文官网中说的是touchGroup
,英文官网中是UILayer
,可是都已经不存在了。UILayer
变成了Layer
,现在也可以不创建Layer
,直接加到场景上面。所以代码可以这样:
Node *pNode = cocostudio::GUIReader::getInstance()->WidgetFromJsonfile("tauren.ExportJson");
this->addChild(pNode);
.app中需导入头文件
#include <cocostudio/CocoStudio.h>
此方法是查找其他大神博客得到的,但好像还是行不通,我自己的写法是 :
cocostudio::ArmatureDataManager::getInstance()->addArmaturefileInfo("tauren0.png","tauren0.pList","tauren.ExportJson");
armature = cocostudio::Armature::create("tauren");
armature->getAnimation()->playByIndex(0);
armature->setScale(1.0f);
armature->setposition(Vec2(150,150));
this->addChild(armature);
别忘了在.h 中加上
cocostudio::Armature *armature; 和 头文件 #include <cocostudio/CocoStudio.h>
总结以上是内存溢出为你收集整理的(5) Cocos2d-x 3.x开发——导入Cocostudio资源全部内容,希望文章能够帮你解决(5) Cocos2d-x 3.x开发——导入Cocostudio资源所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)