• cocos2d-x 2.1.2 bug发现


    1.在做屏蔽触摸时发现

    extensions中的CCScrollView类

    void CCScrollView::registerWithTouchDispatcher()
    {
    CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 0, false);
    }
    应该改成
    void CCScrollView::registerWithTouchDispatcher()
    {
    CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, getTouchPriority(), false);
    }

    2.tile map 不支持获取折线点

    CCTMXXMLParser.cpp
    Line 677
    else if (elementName == "polyline")
        {
            // find parent object's dict and add polyline-points to it
            // CCTMXObjectGroup* objectGroup = (CCTMXObjectGroup*)m_pObjectGroups->lastObject();
            // CCDictionary* dict = (CCDictionary*)objectGroup->getObjects()->lastObject();
            // TODO: dict->setObject:[attributeDict objectForKey:@"points"] forKey:@"polylinePoints"];
            // find parent object's dict and add polygon-points to it
            CCTMXObjectGroup* objectGroup = (CCTMXObjectGroup*)m_pObjectGroups->lastObject();
            CCDictionary* dict = (CCDictionary*)objectGroup->getObjects()->lastObject();
    
            // get points value string
            const char* value = valueForKey("points", attributeDict);
            if(value)
            {
                CCArray* pPointsArray = new CCArray;
                // parse points string into a space-separated set of points
                stringstream pointsStream(value);
                string pointPair;
                while(std::getline(pointsStream, pointPair, ' '))
                {
                    // parse each point combo into a comma-separated x,y point
                    stringstream pointStream(pointPair);
                    string xStr,yStr;
                    char buffer[32] = {0};
                    CCDictionary* pPointDict = new CCDictionary;
                    // set x
                    if(std::getline(pointStream, xStr, ','))
                    {
                        int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x;
                        sprintf(buffer, "%d", x);
                        CCString* pStr = new CCString(buffer);
                        pStr->autorelease();
                        pPointDict->setObject(pStr, "x");
                    }
                    // set y
                    if(std::getline(pointStream, yStr, ','))
                    {
                        int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y;
                        sprintf(buffer, "%d", y);
                        CCString* pStr = new CCString(buffer);
                        pStr->autorelease();
                        pPointDict->setObject(pStr, "y");
                    }
                    // add to points array
                    pPointsArray->addObject(pPointDict);
                    pPointDict->release();
                }
                dict->setObject(pPointsArray, "points");
                pPointsArray->release();
            }
        }

    3.编辑器的UISlider在程序加载初始化时会产生一个内存泄露,cocos2dx version 2.2.1

    在GUIReader.cpp的WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary方法的最后一行加上CC_SAFE_DELETE(progressBarDic);
  • 相关阅读:
    MySQL 幻读详解
    vue-layer 弹窗z-index问题
    vue-cli 路径不变 改变参数 显示不同组件
    mysql ---- limit使用方式
    mysql ---- 官网的测试数据库
    2020年度总结和2021年目标
    校招(春招实习 + 秋招)总结感想
    Centos8和7的区别(参照redhat)
    centos8 网卡命令(centos7也可用)
    排查linux系统是否被入侵
  • 原文地址:https://www.cnblogs.com/hewei2012/p/3398840.html
Copyright © 2020-2023  润新知