Esempio n. 1
0
	CCTMXLayer::~CCTMXLayer()
	{
		CC_SAFE_RELEASE(m_pTileSet);
		CC_SAFE_RELEASE(m_pReusedTile);
		CC_SAFE_RELEASE(m_pProperties);

		if( m_pAtlasIndexArray )
		{
			ccCArrayFree(m_pAtlasIndexArray);
			m_pAtlasIndexArray = NULL;
		}

		CC_SAFE_DELETE_ARRAY(m_pTiles);
	}
Esempio n. 2
0
void TMXLayer::releaseMap()
{
    if (_tiles)
    {
        delete [] _tiles;
        _tiles = nullptr;
    }

    if (_atlasIndexArray)
    {
        ccCArrayFree(_atlasIndexArray);
        _atlasIndexArray = nullptr;
    }
}
void CCTMXLayer::releaseMap()
{
    if (m_pTiles)
    {
        delete [] m_pTiles;
        m_pTiles = NULL;
    }

    if (m_pAtlasIndexArray)
    {
        ccCArrayFree(m_pAtlasIndexArray);
        m_pAtlasIndexArray = NULL;
    }
}
Esempio n. 4
0
CCTouchDispatcher::~CCTouchDispatcher(void)
{
	DEC_CCOBJ("CCTouchDispatcher");

// #if ND_MOD
// 	m_pHandlingTouch = NULL;
// #endif

	CC_SAFE_RELEASE (m_pTargetedHandlers);
	CC_SAFE_RELEASE (m_pStandardHandlers);
	CC_SAFE_RELEASE (m_pHandlersToAdd);

	ccCArrayFree (m_pHandlersToRemove);
	m_pHandlersToRemove = NULL;
}
Esempio n. 5
0
void CCTMXLayer::parseInternalProperties()
{
    // if cc_vertex=automatic, then tiles will be rendered using vertexz

    CCString *vertexz = propertyNamed("cc_vertexz");
    if (vertexz) 
    {
        // If "automatic" is on, then parse the "cc_alpha_func" too
        if (vertexz->m_sString == "automatic")
        {
            m_bUseAutomaticVertexZ = true;
            CCString *alphaFuncVal = propertyNamed("cc_alpha_func");
            float alphaFuncValue = 0.0f;
            if (alphaFuncVal != NULL)
            {
                alphaFuncValue = alphaFuncVal->floatValue();
            }
            setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColorAlphaTest));

            GLint alphaValueLocation = glGetUniformLocation(getShaderProgram()->getProgram(), kCCUniformAlphaTestValue);

            // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison
            getShaderProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue);
        }
        else
        {
            m_nVertexZvalue = vertexz->intValue();
        }
    }

	// if cc_zorder=automatic, then tiles will be rendered using in row order from top to bottom

	CCString *zorder = propertyNamed("useZOrderbyY");
    if (zorder) 
    {
		m_bUseZOrderByY = true;

		// delete AtlasIndexArray as we no longer can use quads in this mode
		// all tiles will be instantiated as sprites
		if (m_pAtlasIndexArray)
		{
			ccCArrayFree(m_pAtlasIndexArray);
			m_pAtlasIndexArray = NULL;
		}
	}
}