yhzjut
1
I am reading the extention code. I have some doubt about m_pSquareColors. In CCLayerColor, m_pSquareColors [4] is a array of length 4.

so,I cant understand these codes for( unsigned int i=0; i < 4; i*+ )

{

m_pSquareColors[i \* 4].r = m_tColor.r;

m_pSquareColors[i \* 4* 1].g = m_tColor.g;

m_pSquareColors[i \* 4 + 2].b = m_tColor.b;

m_pSquareColors[i \* 4 + 3].a = m_cOpacity;

}

when i reached 3, why m_pSquareColors [15] have not oversteps the boundary.

help

walzer
2
OK, It’s a problem.

The extension sources are right because CCLayerColor::m_pSquareColors in v0.8.5 is still

GLubyte m_pSquareColor[4*4]

But it was changed to

ccColor4B m_pSquareColors [4];

in this commit https://github.com/cocos2d/cocos2d-x/blob/4b138b34529227d75eca857ed356f845af98cc0b/cocos2dx/include/CCLayer.h, issue #558

So the NdControls extension can not compatible with the last version now.

yhzjut
3
ok,but Could you explain the function of m_pSquareColors? m_tColor and m_cOpacity has the same information.

yhzjut
4
I got it ，these colors are four direction colors ，these will change from one to another gradually