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,
|
ccTouchDelegateStandardBit = 1 << 0,
|
||||||
ccTouchDelegateTargetedBit = 1 << 1,
|
ccTouchDelegateTargetedBit = 1 << 1,
|
||||||
ccTouchDeletateAllBit = (ccTouchDelegateStandardBit | ccTouchDelegateTargetedBit),
|
ccTouchDelegateAllBit = (ccTouchDelegateStandardBit | ccTouchDelegateTargetedBit),
|
||||||
} ccTouchDelegateFlag;
|
} ccTouchDelegateFlag;
|
||||||
|
|
||||||
class CCTouch;
|
class CCTouch;
|
||||||
|
|
|
@ -38,7 +38,7 @@ CCLayer::CCLayer()
|
||||||
,m_bIsAccelerometerEnabled(false)
|
,m_bIsAccelerometerEnabled(false)
|
||||||
,m_bIsKeypadEnabled(false)
|
,m_bIsKeypadEnabled(false)
|
||||||
{
|
{
|
||||||
m_eTouchDelegateType = ccTouchDeletateAllBit;
|
m_eTouchDelegateType = ccTouchDelegateAllBit;
|
||||||
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
m_tAnchorPoint = ccp(0.5f, 0.5f);
|
||||||
m_bIsRelativeAnchorPoint = false;
|
m_bIsRelativeAnchorPoint = false;
|
||||||
}
|
}
|
||||||
|
@ -93,21 +93,21 @@ void CCLayer::keep(void)
|
||||||
this->retain();
|
this->retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayer::AccelerometerDestroy(void)
|
void CCLayer::AccelerometerDestroy(void)
|
||||||
{
|
{
|
||||||
this->release();
|
this->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayer::AccelerometerKeep(void)
|
void CCLayer::AccelerometerKeep(void)
|
||||||
{
|
{
|
||||||
this->retain();
|
this->retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayer::KeypadDestroy()
|
void CCLayer::KeypadDestroy()
|
||||||
{
|
{
|
||||||
this->release();
|
this->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayer::KeypadKeep()
|
void CCLayer::KeypadKeep()
|
||||||
{
|
{
|
||||||
this->retain();
|
this->retain();
|
||||||
|
@ -427,8 +427,8 @@ void CCLayerColor::draw()
|
||||||
//
|
//
|
||||||
// CCLayerGradient
|
// CCLayerGradient
|
||||||
//
|
//
|
||||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||||
{
|
{
|
||||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||||
if( pLayer && pLayer->initWithColor(start, end))
|
if( pLayer && pLayer->initWithColor(start, end))
|
||||||
{
|
{
|
||||||
|
@ -436,11 +436,11 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end)
|
||||||
return pLayer;
|
return pLayer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(pLayer);
|
CC_SAFE_DELETE(pLayer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
||||||
{
|
{
|
||||||
CCLayerGradient * pLayer = new CCLayerGradient();
|
CCLayerGradient * pLayer = new CCLayerGradient();
|
||||||
if( pLayer && pLayer->initWithColor(start, end, v))
|
if( pLayer && pLayer->initWithColor(start, end, v))
|
||||||
{
|
{
|
||||||
|
@ -448,24 +448,24 @@ CCLayerGradient* CCLayerGradient::layerWithColor(ccColor4B start, ccColor4B end,
|
||||||
return pLayer;
|
return pLayer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(pLayer);
|
CC_SAFE_DELETE(pLayer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end)
|
||||||
{
|
{
|
||||||
return initWithColor(start, end, ccp(0, -1));
|
return initWithColor(start, end, ccp(0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
bool CCLayerGradient::initWithColor(ccColor4B start, ccColor4B end, CCPoint v)
|
||||||
{
|
{
|
||||||
m_endColor.r = end.r;
|
m_endColor.r = end.r;
|
||||||
m_endColor.g = end.g;
|
m_endColor.g = end.g;
|
||||||
m_endColor.b = end.b;
|
m_endColor.b = end.b;
|
||||||
|
|
||||||
m_cEndOpacity = end.a;
|
m_cEndOpacity = end.a;
|
||||||
m_cStartOpacity = start.a;
|
m_cStartOpacity = start.a;
|
||||||
m_AlongVector = v;
|
m_AlongVector = v;
|
||||||
|
|
||||||
start.a = 255;
|
start.a = 255;
|
||||||
return CCLayerColor::initWithColor(start);
|
return CCLayerColor::initWithColor(start);
|
||||||
}
|
}
|
||||||
|
@ -474,98 +474,98 @@ void CCLayerGradient::updateColor()
|
||||||
{
|
{
|
||||||
CCLayerColor::updateColor();
|
CCLayerColor::updateColor();
|
||||||
|
|
||||||
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
float h = sqrtf(m_AlongVector.x * m_AlongVector.x + m_AlongVector.y * m_AlongVector.y);
|
||||||
if (h == 0)
|
if (h == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double c = sqrt(2.0);
|
double c = sqrt(2.0);
|
||||||
CCPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
CCPoint u = ccp(m_AlongVector.x / h, m_AlongVector.y / h);
|
||||||
|
|
||||||
float opacityf = (float)m_cOpacity / 255.0f;
|
float opacityf = (float)m_cOpacity / 255.0f;
|
||||||
|
|
||||||
ccColor4B S = {
|
ccColor4B S = {
|
||||||
(unsigned char) m_tColor.r,
|
(unsigned char) m_tColor.r,
|
||||||
(unsigned char) m_tColor.g,
|
(unsigned char) m_tColor.g,
|
||||||
(unsigned char) m_tColor.b,
|
(unsigned char) m_tColor.b,
|
||||||
(unsigned char) (m_cStartOpacity * opacityf)
|
(unsigned char) (m_cStartOpacity * opacityf)
|
||||||
};
|
};
|
||||||
|
|
||||||
ccColor4B E = {
|
ccColor4B E = {
|
||||||
(unsigned char) m_endColor.r,
|
(unsigned char) m_endColor.r,
|
||||||
(unsigned char) m_endColor.g,
|
(unsigned char) m_endColor.g,
|
||||||
(unsigned char) m_endColor.b,
|
(unsigned char) m_endColor.b,
|
||||||
(unsigned char) (m_cEndOpacity * opacityf)
|
(unsigned char) (m_cEndOpacity * opacityf)
|
||||||
};
|
};
|
||||||
|
|
||||||
// (-1, -1)
|
// (-1, -1)
|
||||||
m_pSquareColors[0] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x + u.y) / (2.0f * c)));
|
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[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[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)));
|
m_pSquareColors[3] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x + u.y) / (2.0f * c)));
|
||||||
// (1, -1)
|
// (1, -1)
|
||||||
m_pSquareColors[4] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x + u.y) / (2.0f * c)));
|
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[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[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)));
|
m_pSquareColors[7] = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x + u.y) / (2.0f * c)));
|
||||||
// (-1, 1)
|
// (-1, 1)
|
||||||
m_pSquareColors[8] = (GLubyte) (E.r + (S.r - E.r) * ((c + u.x - u.y) / (2.0f * c)));
|
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[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[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)));
|
m_pSquareColors[11] = (GLubyte) (E.a + (S.a - E.a) * ((c + u.x - u.y) / (2.0f * c)));
|
||||||
// (1, 1)
|
// (1, 1)
|
||||||
m_pSquareColors[12] = (GLubyte) (E.r + (S.r - E.r) * ((c - u.x - u.y) / (2.0f * c)));
|
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[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[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)));
|
m_pSquareColors[15] = (GLubyte) (E.a + (S.a - E.a) * ((c - u.x - u.y) / (2.0f * c)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ccColor3B CCLayerGradient::getStartColor()
|
ccColor3B CCLayerGradient::getStartColor()
|
||||||
{
|
{
|
||||||
return m_tColor;
|
return m_tColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayerGradient::setStartColor(ccColor3B colors)
|
void CCLayerGradient::setStartColor(ccColor3B colors)
|
||||||
{
|
{
|
||||||
setColor(colors);
|
setColor(colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayerGradient::setEndColor(ccColor3B colors)
|
void CCLayerGradient::setEndColor(ccColor3B colors)
|
||||||
{
|
{
|
||||||
m_endColor = colors;
|
m_endColor = colors;
|
||||||
updateColor();
|
updateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
ccColor3B CCLayerGradient::getEndColor()
|
ccColor3B CCLayerGradient::getEndColor()
|
||||||
{
|
{
|
||||||
return m_endColor;
|
return m_endColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayerGradient::setStartOpacity(GLubyte o)
|
void CCLayerGradient::setStartOpacity(GLubyte o)
|
||||||
{
|
{
|
||||||
m_cStartOpacity = o;
|
m_cStartOpacity = o;
|
||||||
updateColor();
|
updateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLubyte CCLayerGradient::getStartOpacity()
|
GLubyte CCLayerGradient::getStartOpacity()
|
||||||
{
|
{
|
||||||
return m_cStartOpacity;
|
return m_cStartOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayerGradient::setEndOpacity(GLubyte o)
|
void CCLayerGradient::setEndOpacity(GLubyte o)
|
||||||
{
|
{
|
||||||
m_cEndOpacity = o;
|
m_cEndOpacity = o;
|
||||||
updateColor();
|
updateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLubyte CCLayerGradient::getEndOpacity()
|
GLubyte CCLayerGradient::getEndOpacity()
|
||||||
{
|
{
|
||||||
return m_cEndOpacity;
|
return m_cEndOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCLayerGradient::setVector(CCPoint var)
|
void CCLayerGradient::setVector(CCPoint var)
|
||||||
{
|
{
|
||||||
m_AlongVector = var;
|
m_AlongVector = var;
|
||||||
updateColor();
|
updateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCPoint CCLayerGradient::getVector()
|
CCPoint CCLayerGradient::getVector()
|
||||||
|
|
Loading…
Reference in New Issue