mirror of https://github.com/axmolengine/axmol.git
ccTouchDeletateAllBit -> ccTouchDelegateAllBit. I met this typo 3 days ago, then miss it. Thanks to Isaac Ashdown.
This commit is contained in:
parent
b3f76a81a4
commit
fa43292250
|
@ -34,7 +34,7 @@ typedef enum
|
|||
{
|
||||
ccTouchDelegateStandardBit = 1 << 0,
|
||||
ccTouchDelegateTargetedBit = 1 << 1,
|
||||
ccTouchDeletateAllBit = (ccTouchDelegateStandardBit | ccTouchDelegateTargetedBit),
|
||||
ccTouchDelegateAllBit = (ccTouchDelegateStandardBit | ccTouchDelegateTargetedBit),
|
||||
} ccTouchDelegateFlag;
|
||||
|
||||
class CCTouch;
|
||||
|
|
|
@ -38,7 +38,7 @@ CCLayer::CCLayer()
|
|||
,m_bIsAccelerometerEnabled(false)
|
||||
,m_bIsKeypadEnabled(false)
|
||||
{
|
||||
m_eTouchDelegateType = ccTouchDeletateAllBit;
|
||||
m_eTouchDelegateType = ccTouchDelegateAllBit;
|
||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||
m_bIsRelativeAnchorPoint = false;
|
||||
}
|
||||
|
@ -93,21 +93,21 @@ void CCLayer::keep(void)
|
|||
this->retain();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerDestroy(void)
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerDestroy(void)
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::AccelerometerKeep(void)
|
||||
{
|
||||
this->retain();
|
||||
}
|
||||
|
||||
void CCLayer::KeypadDestroy()
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::KeypadDestroy()
|
||||
{
|
||||
this->release();
|
||||
}
|
||||
|
||||
void CCLayer::KeypadKeep()
|
||||
{
|
||||
this->retain();
|
||||
|
@ -427,8 +427,8 @@ void CCLayerColor::draw()
|
|||
//
|
||||
// CCLayerGradient
|
||||
//
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end))
|
||||
{
|
||||
|
@ -436,11 +436,11 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
|||
return pLayer;
|
||||
}
|
||||
CC_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
||||
{
|
||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||
if( pLayer && pLayer->initWithColor(start, end, v))
|
||||
{
|
||||
|
@ -448,24 +448,24 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end,
|
|||
return pLayer;
|
||||
}
|
||||
CC_SAFE_DELETE(pLayer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
return initWithColor(start, end, ccp(0, -1));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
||||
{
|
||||
return initWithColor(start, end, ccp(0, -1));
|
||||
}
|
||||
|
||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
||||
{
|
||||
m_endColor.r = end.r;
|
||||
m_endColor.g = end.g;
|
||||
m_endColor.b = end.b;
|
||||
|
||||
m_cEndOpacity = end.a;
|
||||
m_cStartOpacity = start.a;
|
||||
m_AlongVector = v;
|
||||
|
||||
m_endColor.r = end.r;
|
||||
m_endColor.g = end.g;
|
||||
m_endColor.b = end.b;
|
||||
|
||||
m_cEndOpacity = end.a;
|
||||
m_cStartOpacity = start.a;
|
||||
m_AlongVector = v;
|
||||
|
||||
start.a = 255;
|
||||
return CCLayerColor::initWithColor(start);
|
||||
}
|
||||
|
@ -474,98 +474,98 @@ void CCLayerGradient::updateColor()
|
|||
{
|
||||
CCLayerColor::updateColor();
|
||||
|
||||
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
||||
if (h == 0)
|
||||
return;
|
||||
|
||||
double c = sqrt(2.0);
|
||||
CCPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
||||
|
||||
float opacityf = (float)m_cOpacity / 255.0f;
|
||||
|
||||
ccColor4B S = {
|
||||
(unsigned char) m_tColor.r,
|
||||
(unsigned char) m_tColor.g,
|
||||
(unsigned char) m_tColor.b,
|
||||
(unsigned char) (m_cStartOpacity * opacityf)
|
||||
};
|
||||
|
||||
ccColor4B E = {
|
||||
(unsigned char) m_endColor.r,
|
||||
(unsigned char) m_endColor.g,
|
||||
(unsigned char) m_endColor.b,
|
||||
(unsigned char) (m_cEndOpacity * opacityf)
|
||||
};
|
||||
|
||||
// (-1, -1)
|
||||
m_pSquareColors[0] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[1] = (GLubyte) (E.g + (S.g - E.g) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[2] = (GLubyte) (E.b + (S.b - E.b) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[3] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
// (1, -1)
|
||||
m_pSquareColors[4] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[5] = (GLubyte) (E.g + (S.g - E.g) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[6] = (GLubyte) (E.b + (S.b - E.b) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[7] = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
// (-1, 1)
|
||||
m_pSquareColors[8] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[9] = (GLubyte) (E.g + (S.g - E.g) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[10] = (GLubyte) (E.b + (S.b - E.b) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[11] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
// (1, 1)
|
||||
m_pSquareColors[12] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[13] = (GLubyte) (E.g + (S.g - E.g) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[14] = (GLubyte) (E.b + (S.b - E.b) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
||||
if (h == 0)
|
||||
return;
|
||||
|
||||
double c = sqrt(2.0);
|
||||
CCPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
||||
|
||||
float opacityf = (float)m_cOpacity / 255.0f;
|
||||
|
||||
ccColor4B S = {
|
||||
(unsigned char) m_tColor.r,
|
||||
(unsigned char) m_tColor.g,
|
||||
(unsigned char) m_tColor.b,
|
||||
(unsigned char) (m_cStartOpacity * opacityf)
|
||||
};
|
||||
|
||||
ccColor4B E = {
|
||||
(unsigned char) m_endColor.r,
|
||||
(unsigned char) m_endColor.g,
|
||||
(unsigned char) m_endColor.b,
|
||||
(unsigned char) (m_cEndOpacity * opacityf)
|
||||
};
|
||||
|
||||
// (-1, -1)
|
||||
m_pSquareColors[0] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[1] = (GLubyte) (E.g + (S.g - E.g) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[2] = (GLubyte) (E.b + (S.b - E.b) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[3] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c)));
|
||||
// (1, -1)
|
||||
m_pSquareColors[4] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[5] = (GLubyte) (E.g + (S.g - E.g) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[6] = (GLubyte) (E.b + (S.b - E.b) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
m_pSquareColors[7] = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c)));
|
||||
// (-1, 1)
|
||||
m_pSquareColors[8] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[9] = (GLubyte) (E.g + (S.g - E.g) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[10] = (GLubyte) (E.b + (S.b - E.b) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[11] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c)));
|
||||
// (1, 1)
|
||||
m_pSquareColors[12] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[13] = (GLubyte) (E.g + (S.g - E.g) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[14] = (GLubyte) (E.b + (S.b - E.b) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
m_pSquareColors[15] = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)));
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getStartColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getStartColor()
|
||||
{
|
||||
return m_tColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartColor(ccColor3B colors)
|
||||
{
|
||||
setColor(colors);
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndColor(ccColor3B colors)
|
||||
{
|
||||
m_endColor = colors;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getEndColor()
|
||||
{
|
||||
return m_endColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartOpacity(GLubyte o)
|
||||
{
|
||||
m_cStartOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getStartOpacity()
|
||||
{
|
||||
return m_cStartOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndOpacity(GLubyte o)
|
||||
{
|
||||
m_cEndOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getEndOpacity()
|
||||
{
|
||||
return m_cEndOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setVector(CCPoint var)
|
||||
{
|
||||
m_AlongVector = var;
|
||||
updateColor();
|
||||
void CCLayerGradient::setEndColor(ccColor3B colors)
|
||||
{
|
||||
m_endColor = colors;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
ccColor3B CCLayerGradient::getEndColor()
|
||||
{
|
||||
return m_endColor;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setStartOpacity(GLubyte o)
|
||||
{
|
||||
m_cStartOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getStartOpacity()
|
||||
{
|
||||
return m_cStartOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setEndOpacity(GLubyte o)
|
||||
{
|
||||
m_cEndOpacity = o;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
GLubyte CCLayerGradient::getEndOpacity()
|
||||
{
|
||||
return m_cEndOpacity;
|
||||
}
|
||||
|
||||
void CCLayerGradient::setVector(CCPoint var)
|
||||
{
|
||||
m_AlongVector = var;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
CCPoint CCLayerGradient::getVector()
|
||||
|
|
Loading…
Reference in New Issue