cocos2d-x-3.x 修改和纪录

cocos2d-x-3.x 修改和纪录,第1张

概述1.瓦格地图在程序中显示有缝隙  ccConfig.h 92行修改 #define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 1 2.修改cocostudio导出的动画png图片改成pvr.ccz格式  DataReaderHelper.ccp 1333行修改 filePath = filePath.erase(filePath.find_last_of("0"));

1.瓦格地图在程序中显示有缝隙

ccConfig.h 92行修改#define CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL 1



2.修改cocostudio导出的动画png图片改成pvr.ccz格式

DataReaderHelper.ccp 1333行修改

filePath = filePath.erase(filePath.find_last_of("0"));

std::string pListPath = filePath + ".pList";

std::string pngPath = filePath + ".pvr.ccz";

ArmatureDataManager::getInstance()->addSpriteFrameFromfile((dataInfo->basefilePath + pListPath).c_str(),(dataInfo->basefilePath + pngPath).c_str(),dataInfo->filename.c_str());

break;



3.子节点随父节点透明度变化

父节点设置setCascadeOpacityEnabled(true);



4.加载cocostudio2.x导出的csb文件,播放场景动画

auto cscene = csloader::createNode("map1.csb");

this->addChild(cscene);

cocostudio::timeline::ActionTimeline *action = csloader::createTimeline("map1.csb");

if (action) {//播放场景动画

action->gotoFrameAndplay(0);

cscene->runAction(action);

}

//帧事件监听

action->setFrameEventCallFunc(CC_CALLBACK_1(GameScene::onFrameEvent,this));


voIDGameScene::onFrameEvent(Frame*frame)//固定的格式

{

EventFrame*evnt=dynamic_cast<EventFrame*>(frame);

if(!evnt)

return;

std::stringstr=evnt->getEvent();

if(str=="action1")

{


}

}



5.ios保持屏幕常亮

AppController.mm 添加
[UIApplication sharedApplication].IDleTimerDisabled = YES;//保持屏幕常亮



6.安卓返回按键修改

Cocos2dxGLSurfaceVIEw.java 295行

Cocos2dxVIDeoHelper.mVIDeoHandler.sendEmptyMessage(Cocos2dxVIDeoHelper.KeyEventBack);

修改为

return super.onKeyDown(pKeyCode,pKeyEvent);



7.

-(voID) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis

dis = 0;

。原因:防止输入框控件在键盘位置之下会自动顶起 总结

以上是内存溢出为你收集整理的cocos2d-x-3.x 修改和纪录全部内容,希望文章能够帮你解决cocos2d-x-3.x 修改和纪录所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1029940.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存