加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 20:01:35 所属栏目:百科 来源:网络整理
导读: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::str

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;

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读