您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CC_SAFE_FREE函数代码示例

51自学网 2021-06-01 19:57:48
  C++
这篇教程C++ CC_SAFE_FREE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CC_SAFE_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_SAFE_FREE函数的具体用法?C++ CC_SAFE_FREE怎么用?C++ CC_SAFE_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CC_SAFE_FREE函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CC_SAFE_FREE

CCParticleSystemQuad::~CCParticleSystemQuad(){    if (NULL == m_pBatchNode)    {        CC_SAFE_FREE(m_pQuads);        CC_SAFE_FREE(m_pIndices);        glDeleteBuffers(2, &m_pBuffersVBO[0]);#if CC_TEXTURE_ATLAS_USE_VAO        glDeleteVertexArrays(1, &m_uVAOname);#endif    }        extension::CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, EVNET_COME_TO_FOREGROUND);}
开发者ID:BellyWong,项目名称:CutCutCut2dx,代码行数:14,


示例2: CC_SAFE_RETAIN

bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity){//    CCAssert(texture != NULL, "texture should not be null");    m_uCapacity = capacity;    m_uTotalQuads = 0;    // retained in property    this->m_pTexture = texture;    CC_SAFE_RETAIN(m_pTexture);    // Re-initialization is not allowed    CCAssert(m_pQuads == NULL && m_pIndices == NULL, "");    m_pQuads = (ccV3F_C4B_T2F_Quad*)malloc( m_uCapacity * sizeof(ccV3F_C4B_T2F_Quad) );    m_pIndices = (GLushort *)malloc( m_uCapacity * 6 * sizeof(GLushort) );        if( ! ( m_pQuads && m_pIndices) && m_uCapacity > 0)     {        //CCLOG("cocos2d: CCTextureAtlas: not enough memory");        CC_SAFE_FREE(m_pQuads);        CC_SAFE_FREE(m_pIndices);        // release texture, should set it to null, because the destruction will        // release it too. see cocos2d-x issue #484        CC_SAFE_RELEASE_NULL(m_pTexture);        return false;    }    memset( m_pQuads, 0, m_uCapacity * sizeof(ccV3F_C4B_T2F_Quad) );    memset( m_pIndices, 0, m_uCapacity * 6 * sizeof(GLushort) );        // listen the event when app go to background    extension::CCNotificationCenter::sharedNotificationCenter()->addObserver(this,                                                           callfuncO_selector(CCTextureAtlas::listenBackToForeground),                                                           EVNET_COME_TO_FOREGROUND,                                                           NULL);    this->setupIndices();#if CC_TEXTURE_ATLAS_USE_VAO    setupVBOandVAO();    #else        setupVBO();#endif    m_bDirty = true;    return true;}
开发者ID:136446529,项目名称:book-code,代码行数:49,


示例3: ccArrayFree

void CCActionManager::deleteHashElement(tHashElement *&pElement){    ccArrayFree(pElement->actions);    HASH_DEL(m_pTargets, pElement);    pElement->target->release();    CC_SAFE_FREE(pElement);}
开发者ID:joewan,项目名称:cocos2d-x,代码行数:7,


示例4: getContext

jobject CCUtilsAndroid::newIntent(const char* activityName) {    // get context    jobject context = getContext();        // find constructor    JniMethodInfo t;    JniHelper::getMethodInfo(t, "android/content/Intent", "<init>", "(Landroid/content/Context;Ljava/lang/Class;)V");        // create activity name    size_t len = strlen(activityName);    char* jniName = (char*)calloc(len + 1, sizeof(char));    for(int i = 0; i < len; i++) {        if(activityName[i] == '.')            jniName[i] = '/';        else            jniName[i] = activityName[i];    }    jclass actClass = t.env->FindClass(jniName);        // new intent    jobject intent = t.env->NewObject(t.classID, t.methodID, context, actClass);        // clear    t.env->DeleteLocalRef(actClass);    t.env->DeleteLocalRef(context);    CC_SAFE_FREE(jniName);    t.env->DeleteLocalRef(t.classID);        return intent;}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:30,


示例5: CCLOGINFO

CCTextureAtlas::~CCTextureAtlas(){    CCLOGINFO("cocos2d: CCTextureAtlas deallocing %p.", this);    CC_SAFE_FREE(m_pQuads);    CC_SAFE_FREE(m_pIndices);    glDeleteBuffers(2, m_pBuffersVBO);#if CC_TEXTURE_ATLAS_USE_VAO    glDeleteVertexArrays(1, &m_uVAOname);#endif    CC_SAFE_RELEASE(m_pTexture);        extension::CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, EVNET_COME_TO_FOREGROUND);}
开发者ID:136446529,项目名称:book-code,代码行数:16,


示例6: initWithBuff

bool ImageAlphaLut::initWithFile(const std::string file){//    // 打开文件//    auto fp = fopen(FileUtils::getInstance()->fullPathForFilename(file).c_str(), "rb");//    // 获取文件大小//    fseek(fp, 0, SEEK_END);//    long fs = ftell(fp);//    rewind(fp);    auto data = FileUtils::getInstance()->getDataFromFile(file);    auto buff = data.getBytes();    data.fastSet(nullptr, 0);    // 分配文件头信息 BUFF//    unsigned char * buff = (unsigned char *)malloc(fs);    // 读取文件头信息//    size_t rs = fread(buff, sizeof(unsigned char), fs, fp);//    CCASSERT(rs == fs, "Read file info error");//    fclose(fp);    int * p = (int *)buff;    bool b = initWithBuff(++p);    CC_SAFE_FREE(buff);    return b;}
开发者ID:Pythians,项目名称:PixelTest-File,代码行数:30,


示例7: memset

void ImageAlphaLut::moveBuffer(){    // Move buffer    // new buffef    auto buff = static_cast<unsigned char *>(malloc(getBufferSize()));    memset(buff, 0, getBufferSize());    // 计算前面的偏移    auto offsetBuff = _width * _offsetY + _offsetX;    for (int i = 0; i < _offsetHeight; ++i)    {        for (int j = 0; j < _offsetWidth; ++j)        {            // 复制信息            if (getPixelAlpha(offsetBuff + i * _width + j)) {                copyPixelAlpha(i * _offsetWidth + j, buff);            }        }    }    // 删除原 BUFF    CC_SAFE_FREE(_alphaLut);    // 指向偏移 BUFF    _alphaLut = buff;    buff = nullptr;}
开发者ID:Pythians,项目名称:PixelTest-File,代码行数:25,


示例8: HASH_ITER

void CC3BitmapFontConfiguration::purgeCharDefDictionary(){	CC3BitmapCharDefHashElement *current, *tmp;	HASH_ITER(hh, m_charDefDictionary, current, tmp) 	{		HASH_DEL(m_charDefDictionary, current);		CC_SAFE_FREE(current);	}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:8,


示例9: CC_SAFE_FREE

ParticleSystemQuad::~ParticleSystemQuad(){    if (NULL == _batchNode)    {        CC_SAFE_FREE(_quads);        CC_SAFE_FREE(_indices);        glDeleteBuffers(2, &_buffersVBO[0]);#if CC_TEXTURE_ATLAS_USE_VAO        glDeleteVertexArrays(1, &_VAOname);        GL::bindVAO(0);#endif    }    #if CC_ENABLE_CACHE_TEXTURE_DATA    NotificationCenter::getInstance()->removeObserver(this, EVNET_COME_TO_FOREGROUND);#endif}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:17,


示例10: CC_SAFE_FREE

bool CNData::init(void){	CC_SAFE_FREE(m_pDataBuffer);	m_pDataBuffer = NULL;	m_iBufferLength = 0;	m_bIsDataValid = false;	return true;}
开发者ID:moky,项目名称:SpriteForest,代码行数:8,


示例11: allocMemory

void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode){    if( _batchNode != batchNode )    {        ParticleBatchNode* oldBatch = _batchNode;        ParticleSystem::setBatchNode(batchNode);        // NEW: is self render ?        if( ! batchNode )        {            allocMemory();            initIndices();            setTexture(oldBatch->getTexture());            if (Configuration::getInstance()->supportsShareableVAO())            {                setupVBOandVAO();            }            else            {                setupVBO();            }        }        // OLD: was it self render ? cleanup        else if( !oldBatch )        {            // copy current state to batch            V3F_C4B_T2F_Quad *batchQuads = _batchNode->getTextureAtlas()->getQuads();            V3F_C4B_T2F_Quad *quad = &(batchQuads[_atlasIndex] );            memcpy( quad, _quads, _totalParticles * sizeof(_quads[0]) );            CC_SAFE_FREE(_quads);            CC_SAFE_FREE(_indices);            glDeleteBuffers(2, &_buffersVBO[0]);            memset(_buffersVBO, 0, sizeof(_buffersVBO));            if (Configuration::getInstance()->supportsShareableVAO())            {                glDeleteVertexArrays(1, &_VAOname);                GL::bindVAO(0);                _VAOname = 0;            }        }    }}
开发者ID:253056965,项目名称:cocos2d-x-lite,代码行数:45,


示例12: CC_SAFE_FREE

void ImageAlphaLut::resetBuffer(){    // 清除之前的 BUFF    CC_SAFE_FREE(_alphaLut);    // 重新分配 BUFF    _alphaLut = static_cast<unsigned char*>(malloc( getBufferSize() ));    // 初始化为 0    memset(_alphaLut, 0, getBufferSize());}
开发者ID:Pythians,项目名称:PixelTest-File,代码行数:9,


示例13: CC_SAFE_FREE

void PRFilledPolygon::setPoints(Vector2dVector &points) {        CC_SAFE_FREE(areaTrianglePoints);    CC_SAFE_FREE(textureCoordinates);        Vector2dVector triangulatedPoints = PRRatcliffTriangulator::triangulateVertices(points);        areaTrianglePointCount = triangulatedPoints.size();    areaTrianglePoints = (CCPoint*) malloc(sizeof(CCPoint) * areaTrianglePointCount);    textureCoordinates = (CCPoint*) malloc(sizeof(CCPoint) * areaTrianglePointCount);        for (int i = 0; i < areaTrianglePointCount; i++) {        Vector2d v = (Vector2d)triangulatedPoints.at(i);        areaTrianglePoints[i] = CCPointMake(v.GetX(), v.GetY());    }        calculateTextureCoordinates();}
开发者ID:asurada,项目名称:SGLegend,代码行数:18,


示例14: CCLOGINFO

TextureAtlas::~TextureAtlas(){    CCLOGINFO("cocos2d: TextureAtlas deallocing %p.", this);    CC_SAFE_FREE(_quads);    CC_SAFE_FREE(_indices);    glDeleteBuffers(2, _buffersVBO);#if CC_TEXTURE_ATLAS_USE_VAO    glDeleteVertexArrays(1, &_VAOname);    GL::bindVAO(0);#endif    CC_SAFE_RELEASE(_texture);    #if CC_ENABLE_CACHE_TEXTURE_DATA    NotificationCenter::getInstance()->removeObserver(this, EVNET_COME_TO_FOREGROUND);#endif}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:19,


示例15: CC_SAFE_FREE

void ProgressTimer::setReverseProgress(bool reverse){    if( _reverseDirection != reverse ) {        _reverseDirection = reverse;        //    release all previous information        CC_SAFE_FREE(_vertexData);        _vertexDataCount = 0;    }}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:10,


示例16: CC_SAFE_FREE

void CCProgressTimer::setReverseProgress(bool reverse){    if( m_bReverseDirection != reverse ) {        m_bReverseDirection = reverse;        //    release all previous information        CC_SAFE_FREE(m_pVertexData);        m_nVertexDataCount = 0;    }}
开发者ID:csdnnet,项目名称:hiygame,代码行数:10,


示例17: lua_cocos2dx_physics_PhysicsShapePolygon_calculateArea

int lua_cocos2dx_physics_PhysicsShapePolygon_calculateArea(lua_State* tolua_S){    int argc = 0;    bool ok  = true;    #if COCOS2D_DEBUG >= 1    tolua_Error tolua_err;#endif    #if COCOS2D_DEBUG >= 1    if (!tolua_isusertable(tolua_S,1,"cc.PhysicsShapePolygon",0,&tolua_err)) goto tolua_lerror;#endif        argc = lua_gettop(tolua_S) - 1;        if (argc == 1)    {        cocos2d::Point* arg0;        int arg1 = 0;        do {            ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1);            if (nullptr == arg0){                LUA_PRECONDITION( arg0, "Invalid Native Object");            }} while (0);        if(!ok)        {            CC_SAFE_FREE(arg0);            return 0;        }        double ret = cocos2d::PhysicsShapePolygon::calculateArea(arg0, arg1);        CC_SAFE_FREE(arg0);        tolua_pushnumber(tolua_S,(lua_Number)ret);        return 1;    }    CCLOG("%s has wrong number of arguments: %d, was expecting %d/n ", "calculateArea",argc, 2);    return 0;#if COCOS2D_DEBUG >= 1tolua_lerror:    tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsShapePolygon_calculateArea'.",&tolua_err);#endif    return 0;}
开发者ID:8823-scholar,项目名称:cocos-book,代码行数:42,


示例18: CC_SAFE_FREE

void EventDataManager::deleteTalkMap(){    for (std::map<int,stTalk *>::iterator _iter = mTalkMap.begin(); _iter != mTalkMap.end() ; _iter++ )    {        stTalk *tmpTalk = _iter->second;                CC_SAFE_FREE(tmpTalk);    }        mTalkMap.clear();}
开发者ID:CommonSenseLies,项目名称:LuckyCat,代码行数:11,


示例19: DO_ASSERT

std::string CCBuffer::readString(unsigned int u_len){	DO_ASSERT(LD(u_len, 0), "LD(u_len, 0)");	std::string str;	DO_ASSIGN(char* p_data, (char*)malloc(CA(u_len, 1)));	readData(p_data, u_len);	DO_ASSIGN(p_data[u_len], 0);	str.assign(p_data);	CC_SAFE_FREE(p_data);	return str;}
开发者ID:Ajention,项目名称:codestore,代码行数:11,


示例20: create

 static ForceSettingLayer* create(GMXLayer& layer) {     auto ret = new (std::nothrow) ForceSettingLayer(layer);     if ( ret && ret->init() )     {         ret->autorelease();         return ret;     }     CC_SAFE_FREE(ret);     return nullptr; }
开发者ID:Realtrick-Games,项目名称:DeadForest,代码行数:11,


示例21: CCLOGINFO

CCTextureAtlas::~CCTextureAtlas ( KDvoid ){	CCLOGINFO ( "XMCocos2D : deallocing CCTextureAtlas = %p.", this );	CC_SAFE_FREE ( m_pQuads );	CC_SAFE_FREE ( m_pIndices );	glDeleteBuffers ( 2, m_pBuffersVBO ); #if CC_TEXTURE_ATLAS_USE_VAO    glDeleteVertexArrays ( 1, &m_uVAOname );	ccGLBindVAO ( 0 );#endif	CC_SAFE_RELEASE ( m_pTexture );#if CC_ENABLE_CACHE_TEXTURE_DATA	CCNotificationCenter::sharedNotificationCenter ( )->removeObserver ( this, EVENT_COME_TO_FOREGROUND );#endif}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:20,


示例22: CCLOGINFO

TextureAtlas::~TextureAtlas(){    CCLOGINFO("deallocing TextureAtlas: %p", this);    CC_SAFE_FREE(_quads);    CC_SAFE_FREE(_indices);    glDeleteBuffers(2, _buffersVBO);    if (Configuration::getInstance()->supportsShareableVAO())    {        glDeleteVertexArrays(1, &_VAOname);        GL::bindVAO(0);    }    CC_SAFE_RELEASE(_texture);    #if CC_ENABLE_CACHE_TEXTURE_DATA    Director::getInstance()->getEventDispatcher()->removeEventListener(_rendererRecreatedListener);#endif}
开发者ID:akinlin,项目名称:PowerOfTheMind,代码行数:20,


示例23: GetModuleFileName

std::string SimulatorWin::getApplicationExePath(){    TCHAR szFileName[MAX_PATH];    GetModuleFileName(NULL, szFileName, MAX_PATH);    std::u16string u16ApplicationName;    char *applicationExePath = convertTCharToUtf8(szFileName);    std::string path(applicationExePath);    CC_SAFE_FREE(applicationExePath);    return path;}
开发者ID:hugohuang1111,项目名称:Bird,代码行数:11,


示例24: CC_SAFE_FREE

void EasyPolygon::setPoints(Vector2dVector &points) {        if (points.size() <= 0) {        areaTrianglePointCount = 0;        return;    }        CC_SAFE_FREE(areaTrianglePoints);    CC_SAFE_FREE(textureCoordinates);        /*Vector2dVector triangulatedPoints = PRRatcliffTriangulator::triangulateVertices(points);        areaTrianglePointCount = (int)triangulatedPoints.size();    areaTrianglePoints = (Point*) malloc(sizeof(Point) * areaTrianglePointCount);    textureCoordinates = (Point*) malloc(sizeof(Point) * areaTrianglePointCount);        for (int i = 0; i < areaTrianglePointCount; i++) {        Vector2d v = (Vector2d)triangulatedPoints.at(i);        areaTrianglePoints[i] = Point(v.GetX(), v.GetY());       // printf("x = %f, y = %f/n", v.GetX, v.GetY);    }*/    areaTrianglePointCount = 6;    areaTrianglePoints = (Point*) malloc(sizeof(Point) * areaTrianglePointCount);    textureCoordinates = (Point*) malloc(sizeof(Point) * areaTrianglePointCount);        Vector2d v = points.at(0);    areaTrianglePoints[0] = Point(v.GetX(), v.GetY());    v = points.at(3);    areaTrianglePoints[1] = Point(v.GetX(), v.GetY());    v = points.at(2);    areaTrianglePoints[2] = Point(v.GetX(), v.GetY());    v = points.at(2);    areaTrianglePoints[3] = Point(v.GetX(), v.GetY());    v = points.at(1);    areaTrianglePoints[4] = Point(v.GetX(), v.GetY());    v = points.at(0);    areaTrianglePoints[5] = Point(v.GetX(), v.GetY());        calculateTextureCoordinates();}
开发者ID:gouri34,项目名称:heist,代码行数:41,


示例25: allocMemory

void CCParticleSystemQuad::setBatchNode(CCParticleBatchNode * batchNode){    if( m_pBatchNode != batchNode )     {        CCParticleBatchNode* oldBatch = m_pBatchNode;        CCParticleSystem::setBatchNode(batchNode);        // NEW: is self render ?        if( ! batchNode )         {            allocMemory();            initIndices();            setTexture(oldBatch->getTexture());#if CC_TEXTURE_ATLAS_USE_VAO            setupVBOandVAO();#else            setupVBO();#endif        }        // OLD: was it self render ? cleanup        else if( !oldBatch )        {            // copy current state to batch            ccV3F_C4B_T2F_Quad *batchQuads = m_pBatchNode->getTextureAtlas()->getQuads();            ccV3F_C4B_T2F_Quad *quad = &(batchQuads[m_uAtlasIndex] );            memcpy( quad, m_pQuads, m_uTotalParticles * sizeof(m_pQuads[0]) );            CC_SAFE_FREE(m_pQuads);            CC_SAFE_FREE(m_pIndices);            glDeleteBuffers(2, &m_pBuffersVBO[0]);            memset(m_pBuffersVBO, 0, sizeof(m_pBuffersVBO));#if CC_TEXTURE_ATLAS_USE_VAO            glDeleteVertexArrays(1, &m_uVAOname);            ccGLBindVAO(0);            m_uVAOname = 0;#endif        }    }}
开发者ID:caoguoping,项目名称:warCraft,代码行数:41,


示例26: malloc

CCString * CCBReader::concat(CCString * pStringA, CCString * pStringB) {    int concatenatedLength = pStringA->length() + pStringB->length();    char* concatenated = (char*) malloc(concatenatedLength+1);    CCString* pRet = NULL;    strcpy(concatenated, pStringA->getCString());    strcat(concatenated, pStringB->getCString());    concatenated[concatenatedLength] = '/0';    pRet = CCString::create(concatenated);    CC_SAFE_FREE(concatenated);    return pRet;}
开发者ID:rohankuruvilla,项目名称:cocos2dx-chipmunk-js,代码行数:12,


示例27: CC_SAFE_FREE

bool CCParticleSystem::initWithTotalParticles(unsigned int numberOfParticles){    m_uTotalParticles = numberOfParticles;    CC_SAFE_FREE(m_pParticles);        m_pParticles = (tCCParticle*)calloc(m_uTotalParticles, sizeof(tCCParticle));    if( ! m_pParticles )    {        CCLOG("Particle system: not enough memory");        this->release();        return false;    }    m_uAllocatedParticles = numberOfParticles;    if (m_pBatchNode)    {        for (int i = 0; i < m_uTotalParticles; i++)        {            m_pParticles[i].atlasIndex=i;        }    }    // default, active    m_bIsActive = true;    // default blend function    m_tBlendFunc.src = CC_BLEND_SRC;    m_tBlendFunc.dst = CC_BLEND_DST;    // default movement type;    m_ePositionType = kCCPositionTypeFree;    // by default be in mode A:    m_nEmitterMode = kCCParticleModeGravity;    // default: modulate    // XXX: not used    //    colorModulate = YES;    m_bIsAutoRemoveOnFinish = false;    // Optimization: compile udpateParticle method    //updateParticleSel = @selector(updateQuadWithParticle:newPosition:);    //updateParticleImp = (CC_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel];    //for batchNode    m_bTransformSystemDirty = false;    // udpate after action in run!    this->scheduleUpdateWithPriority(1);    return true;}
开发者ID:Aaron-Teng,项目名称:AnalyticX,代码行数:52,


示例28: CC_SAFE_RELEASE

TMXLayer::~TMXLayer(){    CC_SAFE_RELEASE(_tileSet);    CC_SAFE_RELEASE(_reusedTile);    if (_atlasIndexArray)    {        ccCArrayFree(_atlasIndexArray);        _atlasIndexArray = nullptr;    }    CC_SAFE_FREE(_tiles);}
开发者ID:FenneX,项目名称:FenneXEmptyProject,代码行数:13,



注:本文中的CC_SAFE_FREE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CC_SAFE_RELEASE函数代码示例
C++ CC_SAFE_DELETE_ARRAY函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。