转载请说明出处:http://www.jb51.cc/article/p-skioadww-hx.html
http://www.jb51.cc/article/p-skioaDWw-hx.HTML
[cpp] view plain copy std::stringfullPath=CCfileUtils::sharedfileUtils()->fullPathFromrelativePath("images.Json"); unsignedlongsize; unsignedchar*file=CCfileUtils::sharedfileUtils()->getfileData(fullPath.c_str(),"rt+",&size); std::stringstr=""; for(inti=0;i<size;i++) { str+=file[i]; } std::stringerror; b2dJsonjson; world=Json.readFromString(str,error); b2dJsonImage*image1_=Json.getimageByname("image1"); CCSprite*image1=CCSprite::create("images/mcclory.png"); image1->setScale((image1_->scale*PTM_RATIO)/image1->getTexture()->getPixelsHigh()); image1Body->SetUserData(image1); this->addChild(image1,0);
注意在编辑的时候 图片的中心一定要和刚体的位置重合
软件地址:https://www.iforce2d.net/rube/
总结以上是内存溢出为你收集整理的cocos2d-x用rube box2d editor当关卡编辑器写游戏全部内容,希望文章能够帮你解决cocos2d-x用rube box2d editor当关卡编辑器写游戏所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)