mirror of https://github.com/axmolengine/axmol.git
fixed #1686:finish updating
This commit is contained in:
parent
0070371045
commit
63e4091bfa
|
@ -789,15 +789,11 @@ void CCDirector::getFPSImageData(unsigned char** datapointer, unsigned int* leng
|
||||||
|
|
||||||
void CCDirector::createStatsLabel()
|
void CCDirector::createStatsLabel()
|
||||||
{
|
{
|
||||||
CCTexture2D *texture;
|
|
||||||
CCTextureCache *textureCache = CCTextureCache::sharedTextureCache();
|
|
||||||
|
|
||||||
if( m_pFPSLabel && m_pSPFLabel )
|
if( m_pFPSLabel && m_pSPFLabel )
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(m_pFPSLabel);
|
CC_SAFE_RELEASE_NULL(m_pFPSLabel);
|
||||||
CC_SAFE_RELEASE_NULL(m_pSPFLabel);
|
CC_SAFE_RELEASE_NULL(m_pSPFLabel);
|
||||||
CC_SAFE_RELEASE_NULL(m_pDrawsLabel);
|
CC_SAFE_RELEASE_NULL(m_pDrawsLabel);
|
||||||
textureCache->removeTextureForKey("cc_fps_images");
|
|
||||||
CCFileUtils::sharedFileUtils()->purgeCachedEntries();
|
CCFileUtils::sharedFileUtils()->purgeCachedEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,11 +807,11 @@ void CCDirector::createStatsLabel()
|
||||||
fontSize = (int)(m_obWinSizeInPoints.width / 320.0f * 24);
|
fontSize = (int)(m_obWinSizeInPoints.width / 320.0f * 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pFPSLabel = CCLabelAtlas::create("00.0", texture, 12, 32, '.');
|
m_pFPSLabel = CCLabelTTF::create("00.0", "Arial", fontSize);
|
||||||
m_pFPSLabel->retain();
|
m_pFPSLabel->retain();
|
||||||
m_pSPFLabel = CCLabelAtlas::create("0.000", texture, 12, 32, '.');
|
m_pSPFLabel = CCLabelTTF::create("0.000", "Arial", fontSize);
|
||||||
m_pSPFLabel->retain();
|
m_pSPFLabel->retain();
|
||||||
m_pDrawsLabel = CCLabelAtlas::create("000", texture, 12, 32, '.');
|
m_pDrawsLabel = CCLabelTTF::create("000", "Arial", fontSize);
|
||||||
m_pDrawsLabel->retain();
|
m_pDrawsLabel->retain();
|
||||||
|
|
||||||
CCSize contentSize = m_pDrawsLabel->getContentSize();
|
CCSize contentSize = m_pDrawsLabel->getContentSize();
|
||||||
|
|
|
@ -357,9 +357,9 @@ protected:
|
||||||
float m_fAccumDt;
|
float m_fAccumDt;
|
||||||
float m_fFrameRate;
|
float m_fFrameRate;
|
||||||
|
|
||||||
CCLabelAtlas *m_pFPSLabel;
|
CCLabelTTF *m_pFPSLabel;
|
||||||
CCLabelAtlas *m_pSPFLabel;
|
CCLabelTTF *m_pSPFLabel;
|
||||||
CCLabelAtlas *m_pDrawsLabel;
|
CCLabelTTF *m_pDrawsLabel;
|
||||||
|
|
||||||
/** Whether or not the Director is paused */
|
/** Whether or not the Director is paused */
|
||||||
bool m_bPaused;
|
bool m_bPaused;
|
||||||
|
|
|
@ -26,6 +26,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "CCAtlasNode.h"
|
#include "CCAtlasNode.h"
|
||||||
#include "textures/CCTextureAtlas.h"
|
#include "textures/CCTextureAtlas.h"
|
||||||
|
#include "textures/CCTextureCache.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "shaders/CCGLProgram.h"
|
#include "shaders/CCGLProgram.h"
|
||||||
#include "shaders/CCShaderCache.h"
|
#include "shaders/CCShaderCache.h"
|
||||||
|
@ -136,7 +137,7 @@ void CCAtlasNode::draw(void)
|
||||||
|
|
||||||
ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
|
ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
|
||||||
|
|
||||||
GLfloat colors[4] = {m_tColor.r / 255.0f, m_tColor.g / 255.0f, m_tColor.b / 255.0f, m_cOpacity / 255.0f};
|
GLfloat colors[4] = {_displayedColor.r / 255.0f, _displayedColor.g / 255.0f, _displayedColor.b / 255.0f, _displayedOpacity / 255.0f};
|
||||||
getShaderProgram()->setUniformLocationWith4fv(m_nUniformColor, colors, 1);
|
getShaderProgram()->setUniformLocationWith4fv(m_nUniformColor, colors, 1);
|
||||||
|
|
||||||
m_pTextureAtlas->drawNumberOfQuads(m_uQuadsToDraw, 0);
|
m_pTextureAtlas->drawNumberOfQuads(m_uQuadsToDraw, 0);
|
||||||
|
@ -144,7 +145,7 @@ void CCAtlasNode::draw(void)
|
||||||
|
|
||||||
// CCAtlasNode - RGBA protocol
|
// CCAtlasNode - RGBA protocol
|
||||||
|
|
||||||
const ccColor3B& CCAtlasNode:: getColor()
|
const ccColor3B& CCAtlasNode::getColor()
|
||||||
{
|
{
|
||||||
if(m_bIsOpacityModifyRGB)
|
if(m_bIsOpacityModifyRGB)
|
||||||
{
|
{
|
||||||
|
@ -160,9 +161,9 @@ void CCAtlasNode::setColor(const ccColor3B& color3)
|
||||||
|
|
||||||
if( m_bIsOpacityModifyRGB )
|
if( m_bIsOpacityModifyRGB )
|
||||||
{
|
{
|
||||||
tmp.r = tmp.r * m_displayedOpacity/255;
|
tmp.r = tmp.r * _displayedOpacity/255;
|
||||||
tmp.g = tmp.g * m_displayedOpacity/255;
|
tmp.g = tmp.g * _displayedOpacity/255;
|
||||||
tmp.b = tmp.b * m_displayedOpacity/255;
|
tmp.b = tmp.b * _displayedOpacity/255;
|
||||||
}
|
}
|
||||||
CCNodeRGBA::setColor(tmp);
|
CCNodeRGBA::setColor(tmp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,6 @@ protected:
|
||||||
|
|
||||||
// protocol variables
|
// protocol variables
|
||||||
bool m_bIsOpacityModifyRGB;
|
bool m_bIsOpacityModifyRGB;
|
||||||
bool isOpacityModifyRGB();
|
|
||||||
void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
|
||||||
|
|
||||||
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
|
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
|
||||||
|
|
||||||
|
@ -106,6 +104,12 @@ public:
|
||||||
/** sets a new texture. it will be retained*/
|
/** sets a new texture. it will be retained*/
|
||||||
virtual void setTexture(CCTexture2D *texture);
|
virtual void setTexture(CCTexture2D *texture);
|
||||||
|
|
||||||
|
virtual bool isOpacityModifyRGB();
|
||||||
|
virtual void setOpacityModifyRGB(bool isOpacityModifyRGB);
|
||||||
|
virtual const ccColor3B& getColor(void);
|
||||||
|
virtual void setColor(const ccColor3B& color);
|
||||||
|
virtual void setOpacity(GLubyte opacity);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
void calculateMaxItems();
|
void calculateMaxItems();
|
||||||
void updateBlendFunc();
|
void updateBlendFunc();
|
||||||
|
|
|
@ -1267,8 +1267,8 @@ void CCNode::updateTransform()
|
||||||
|
|
||||||
// CCNodeRGBA
|
// CCNodeRGBA
|
||||||
CCNodeRGBA::CCNodeRGBA()
|
CCNodeRGBA::CCNodeRGBA()
|
||||||
: _displayedOpacity (0)
|
: _displayedOpacity (255)
|
||||||
, _realOpacity(0)
|
, _realOpacity(255)
|
||||||
, _displayedColor(ccc3(0,0,0))
|
, _displayedColor(ccc3(0,0,0))
|
||||||
, _realColor(ccc3(0,0,0))
|
, _realColor(ccc3(0,0,0))
|
||||||
, _cascadeColorEnabled(false)
|
, _cascadeColorEnabled(false)
|
||||||
|
@ -1366,7 +1366,7 @@ void CCNodeRGBA::setColor(const ccColor3B& color)
|
||||||
parentColor = parent->getDisplayedColor();
|
parentColor = parent->getDisplayedColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCRGBAProtocol::updateDisplayedColor(parentColor);
|
updateDisplayedColor(parentColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "CCLabelAtlas.h"
|
#include "CCLabelAtlas.h"
|
||||||
#include "textures/CCTextureAtlas.h"
|
#include "textures/CCTextureAtlas.h"
|
||||||
|
#include "textures/CCTextureCache.h"
|
||||||
#include "support/CCPointExtension.h"
|
#include "support/CCPointExtension.h"
|
||||||
#include "draw_nodes/CCDrawingPrimitives.h"
|
#include "draw_nodes/CCDrawingPrimitives.h"
|
||||||
#include "ccConfig.h"
|
#include "ccConfig.h"
|
||||||
|
@ -165,7 +166,7 @@ void CCLabelAtlas::updateAtlasValues()
|
||||||
quad.tr.vertices.y = (float)(m_uItemHeight);
|
quad.tr.vertices.y = (float)(m_uItemHeight);
|
||||||
quad.tr.vertices.z = 0.0f;
|
quad.tr.vertices.z = 0.0f;
|
||||||
|
|
||||||
ccColor4B c = { m_tDisplayedColor.r, m_tDisplayedColor.g, m_tDisplayedColor.b, m_cDisplayedOpacity };
|
ccColor4B c = { _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity };
|
||||||
quad.tl.colors = c;
|
quad.tl.colors = c;
|
||||||
quad.tr.colors = c;
|
quad.tr.colors = c;
|
||||||
quad.bl.colors = c;
|
quad.bl.colors = c;
|
||||||
|
|
|
@ -82,6 +82,7 @@ public:
|
||||||
virtual void updateAtlasValues();
|
virtual void updateAtlasValues();
|
||||||
virtual void setString(const char *label);
|
virtual void setString(const char *label);
|
||||||
virtual const char* getString(void);
|
virtual const char* getString(void);
|
||||||
|
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if CC_LABELATLAS_DEBUG_DRAW
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -489,6 +489,16 @@ void CCLayer::ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LayerRGBA
|
// LayerRGBA
|
||||||
|
CCLayerRGBA::CCLayerRGBA()
|
||||||
|
: _displayedOpacity(255)
|
||||||
|
, _realOpacity (255)
|
||||||
|
, _displayedColor(ccWHITE)
|
||||||
|
, _realColor(ccWHITE)
|
||||||
|
, _cascadeColorEnabled(false)
|
||||||
|
, _cascadeOpacityEnabled(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
CCLayerRGBA::~CCLayerRGBA() {}
|
||||||
|
|
||||||
bool CCLayerRGBA::init()
|
bool CCLayerRGBA::init()
|
||||||
{
|
{
|
||||||
|
@ -530,7 +540,7 @@ void CCLayerRGBA::setOpacity(GLubyte opacity)
|
||||||
{
|
{
|
||||||
parentOpacity = parent->getDisplayedOpacity();
|
parentOpacity = parent->getDisplayedOpacity();
|
||||||
}
|
}
|
||||||
CCRGBAProtocol::updateDisplayedOpacity(parentOpacity);
|
updateDisplayedOpacity(parentOpacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +567,7 @@ void CCLayerRGBA::setColor(const ccColor3B& color)
|
||||||
parentColor = parent->getDisplayedColor();
|
parentColor = parent->getDisplayedColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCRGBAProtocol::updateDisplayedColor(parentColor);
|
updateDisplayedColor(parentColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,6 +609,26 @@ void CCLayerRGBA::updateDisplayedColor(const ccColor3B& parentColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCLayerRGBA::isCascadeOpacityEnabled()
|
||||||
|
{
|
||||||
|
return _cascadeOpacityEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCLayerRGBA::setCascadeOpacityEnabled(bool cascadeOpacityEnabled)
|
||||||
|
{
|
||||||
|
_cascadeOpacityEnabled = cascadeOpacityEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCLayerRGBA::isCascadeColorEnabled()
|
||||||
|
{
|
||||||
|
return _cascadeColorEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCLayerRGBA::setCascadeColorEnabled(bool cascadeColorEnabled)
|
||||||
|
{
|
||||||
|
_cascadeColorEnabled = cascadeColorEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// CCLayerColor
|
/// CCLayerColor
|
||||||
|
|
||||||
CCLayerColor::CCLayerColor()
|
CCLayerColor::CCLayerColor()
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool CCParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupIndices();
|
initIndices();
|
||||||
#if CC_TEXTURE_ATLAS_USE_VAO
|
#if CC_TEXTURE_ATLAS_USE_VAO
|
||||||
setupVBOandVAO();
|
setupVBOandVAO();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -56,7 +56,6 @@ bool CCTileMapAtlas::initWithTileFile(const char *tile, const char *mapFile, int
|
||||||
|
|
||||||
if( CCAtlasNode::initWithTileFile(tile, tileWidth, tileHeight, m_nItemsToRender) )
|
if( CCAtlasNode::initWithTileFile(tile, tileWidth, tileHeight, m_nItemsToRender) )
|
||||||
{
|
{
|
||||||
m_tColor = ccWHITE;
|
|
||||||
m_pPosToAtlasIndex = new CCDictionary();
|
m_pPosToAtlasIndex = new CCDictionary();
|
||||||
this->updateAtlasValues();
|
this->updateAtlasValues();
|
||||||
this->setContentSize(CCSizeMake((float)(m_pTGAInfo->width*m_uItemWidth),
|
this->setContentSize(CCSizeMake((float)(m_pTGAInfo->width*m_uItemWidth),
|
||||||
|
@ -221,7 +220,7 @@ void CCTileMapAtlas::updateAtlasValueAt(const CCPoint& pos, const ccColor3B& val
|
||||||
quad.tr.vertices.y = (float)(y * m_uItemHeight + m_uItemHeight);
|
quad.tr.vertices.y = (float)(y * m_uItemHeight + m_uItemHeight);
|
||||||
quad.tr.vertices.z = 0.0f;
|
quad.tr.vertices.z = 0.0f;
|
||||||
|
|
||||||
ccColor4B color = { m_tColor.r, m_tColor.g, m_tColor.b, m_cOpacity };
|
ccColor4B color = { _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity };
|
||||||
quad.tr.colors = color;
|
quad.tr.colors = color;
|
||||||
quad.tl.colors = color;
|
quad.tl.colors = color;
|
||||||
quad.br.colors = color;
|
quad.br.colors = color;
|
||||||
|
|
|
@ -36,9 +36,7 @@
|
||||||
NS_CC_EXT_BEGIN
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
CCControl::CCControl()
|
CCControl::CCControl()
|
||||||
: m_cOpacity(0)
|
: m_bIsOpacityModifyRGB(false)
|
||||||
, m_tColor(ccBLACK)
|
|
||||||
, m_bIsOpacityModifyRGB(false)
|
|
||||||
, m_nDefaultTouchPriority(0)
|
, m_nDefaultTouchPriority(0)
|
||||||
, m_eState(CCControlStateNormal)
|
, m_eState(CCControlStateNormal)
|
||||||
, m_hasVisibleParents(false)
|
, m_hasVisibleParents(false)
|
||||||
|
@ -224,50 +222,6 @@ void CCControl::removeTargetWithActionForControlEvent(CCObject* target, SEL_CCCo
|
||||||
|
|
||||||
|
|
||||||
//CRGBA protocol
|
//CRGBA protocol
|
||||||
void CCControl::setColor(const ccColor3B& color)
|
|
||||||
{
|
|
||||||
m_tColor=color;
|
|
||||||
CCObject* child;
|
|
||||||
CCArray* children=getChildren();
|
|
||||||
CCARRAY_FOREACH(children, child)
|
|
||||||
{
|
|
||||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
|
||||||
if (pNode)
|
|
||||||
{
|
|
||||||
pNode->setColor(m_tColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ccColor3B& CCControl::getColor(void)
|
|
||||||
{
|
|
||||||
return m_tColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CCControl::setOpacity(GLubyte opacity)
|
|
||||||
{
|
|
||||||
m_cOpacity = opacity;
|
|
||||||
|
|
||||||
CCObject* child;
|
|
||||||
CCArray* children=getChildren();
|
|
||||||
CCARRAY_FOREACH(children, child)
|
|
||||||
{
|
|
||||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
|
||||||
if (pNode)
|
|
||||||
{
|
|
||||||
pNode->setOpacity(opacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GLubyte CCControl::getOpacity()
|
|
||||||
{
|
|
||||||
return m_cOpacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CCControl::setOpacityModifyRGB(bool bOpacityModifyRGB)
|
void CCControl::setOpacityModifyRGB(bool bOpacityModifyRGB)
|
||||||
{
|
{
|
||||||
m_bIsOpacityModifyRGB=bOpacityModifyRGB;
|
m_bIsOpacityModifyRGB=bOpacityModifyRGB;
|
||||||
|
|
|
@ -85,15 +85,11 @@ typedef unsigned int CCControlState;
|
||||||
*
|
*
|
||||||
* To use the CCControl you have to subclass it.
|
* To use the CCControl you have to subclass it.
|
||||||
*/
|
*/
|
||||||
class CCControl : public CCLayer, public CCRGBAProtocol
|
class CCControl : public CCLayerRGBA
|
||||||
{
|
{
|
||||||
|
|
||||||
//CCRGBAProtocol
|
//CCRGBAProtocol
|
||||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
|
|
||||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
|
|
||||||
bool m_bIsOpacityModifyRGB;
|
bool m_bIsOpacityModifyRGB;
|
||||||
bool isOpacityModifyRGB();
|
|
||||||
void setOpacityModifyRGB(bool bOpacityModifyRGB);
|
|
||||||
|
|
||||||
/** Changes the priority of the button. The lower the number, the higher the priority. */
|
/** Changes the priority of the button. The lower the number, the higher the priority. */
|
||||||
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority);
|
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority);
|
||||||
|
@ -120,6 +116,9 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void needsLayout();
|
virtual void needsLayout();
|
||||||
|
|
||||||
|
virtual bool isOpacityModifyRGB();
|
||||||
|
virtual void setOpacityModifyRGB(bool bOpacityModifyRGB);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_bEnabled;
|
bool m_bEnabled;
|
||||||
bool m_bSelected;
|
bool m_bSelected;
|
||||||
|
|
|
@ -689,18 +689,20 @@ void CCControlButton::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
|
||||||
|
|
||||||
void CCControlButton::setOpacity(GLubyte opacity)
|
void CCControlButton::setOpacity(GLubyte opacity)
|
||||||
{
|
{
|
||||||
m_cOpacity = opacity;
|
// XXX fixed me if not correct
|
||||||
|
CCControl::setOpacity(opacity);
|
||||||
CCObject* child;
|
// m_cOpacity = opacity;
|
||||||
CCArray* children=getChildren();
|
//
|
||||||
CCARRAY_FOREACH(children, child)
|
// CCObject* child;
|
||||||
{
|
// CCArray* children=getChildren();
|
||||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
// CCARRAY_FOREACH(children, child)
|
||||||
if (pNode)
|
// {
|
||||||
{
|
// CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
||||||
pNode->setOpacity(opacity);
|
// if (pNode)
|
||||||
}
|
// {
|
||||||
}
|
// pNode->setOpacity(opacity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
CCDictElement * item = NULL;
|
CCDictElement * item = NULL;
|
||||||
CCDICT_FOREACH(m_backgroundSpriteDispatchTable, item)
|
CCDICT_FOREACH(m_backgroundSpriteDispatchTable, item)
|
||||||
{
|
{
|
||||||
|
@ -711,7 +713,7 @@ void CCControlButton::setOpacity(GLubyte opacity)
|
||||||
|
|
||||||
GLubyte CCControlButton::getOpacity()
|
GLubyte CCControlButton::getOpacity()
|
||||||
{
|
{
|
||||||
return m_cOpacity;
|
return _realOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCControlButton::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent)
|
void CCControlButton::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent)
|
||||||
|
|
|
@ -134,7 +134,8 @@ CCControlColourPicker* CCControlColourPicker::create()
|
||||||
|
|
||||||
void CCControlColourPicker::setColor(const ccColor3B& color)
|
void CCControlColourPicker::setColor(const ccColor3B& color)
|
||||||
{
|
{
|
||||||
m_tColor = color;
|
// XXX fixed me if not correct
|
||||||
|
CCControl::setColor(color);
|
||||||
|
|
||||||
RGBA rgba;
|
RGBA rgba;
|
||||||
rgba.r = color.r / 255.0f;
|
rgba.r = color.r / 255.0f;
|
||||||
|
@ -181,7 +182,8 @@ void CCControlColourPicker::hueSliderValueChanged(CCObject * sender, CCControlEv
|
||||||
|
|
||||||
// Update the value
|
// Update the value
|
||||||
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
||||||
m_tColor= ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
// XXX fixed me if not correct
|
||||||
|
CCControl::setColor(ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f)));
|
||||||
|
|
||||||
// Send CCControl callback
|
// Send CCControl callback
|
||||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||||
|
@ -196,7 +198,8 @@ void CCControlColourPicker::colourSliderValueChanged(CCObject * sender, CCContro
|
||||||
|
|
||||||
// Update the value
|
// Update the value
|
||||||
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
RGBA rgb = CCControlUtils::RGBfromHSV(m_hsv);
|
||||||
m_tColor=ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f));
|
// XXX fixed me if not correct
|
||||||
|
CCControl::setColor(ccc3((GLubyte)(rgb.r * 255.0f), (GLubyte)(rgb.g * 255.0f), (GLubyte)(rgb.b * 255.0f)));
|
||||||
|
|
||||||
// Send CCControl callback
|
// Send CCControl callback
|
||||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||||
|
|
|
@ -47,7 +47,6 @@ CCScale9Sprite::CCScale9Sprite()
|
||||||
, m_insetTop(0)
|
, m_insetTop(0)
|
||||||
, m_insetRight(0)
|
, m_insetRight(0)
|
||||||
, m_insetBottom(0)
|
, m_insetBottom(0)
|
||||||
, m_cOpacity(0)
|
|
||||||
, m_bSpritesGenerated(false)
|
, m_bSpritesGenerated(false)
|
||||||
, m_bSpriteFrameRotated(false)
|
, m_bSpriteFrameRotated(false)
|
||||||
, m_positionsAreDirty(false)
|
, m_positionsAreDirty(false)
|
||||||
|
@ -110,8 +109,8 @@ bool CCScale9Sprite::initWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect
|
||||||
|
|
||||||
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
|
||||||
{
|
{
|
||||||
GLubyte opacity = m_cOpacity;
|
GLubyte opacity = getOpacity();
|
||||||
ccColor3B color = m_tColor;
|
ccColor3B color = getColor();
|
||||||
|
|
||||||
// Release old sprites
|
// Release old sprites
|
||||||
this->removeAllChildrenWithCleanup(true);
|
this->removeAllChildrenWithCleanup(true);
|
||||||
|
@ -636,56 +635,10 @@ CCScale9Sprite* CCScale9Sprite::create()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//LabelBMFont - CCRGBAProtocol protocol
|
|
||||||
void CCScale9Sprite::setColor(const ccColor3B& color3)
|
|
||||||
{
|
|
||||||
m_tColor = color3;
|
|
||||||
if (scale9Image->getChildren() && scale9Image->getChildren()->count() != 0)
|
|
||||||
{
|
|
||||||
CCObject* child;
|
|
||||||
CCARRAY_FOREACH(scale9Image->getChildren(), child)
|
|
||||||
{
|
|
||||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
|
||||||
if (pNode)
|
|
||||||
{
|
|
||||||
pNode->setColor(m_tColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ccColor3B& CCScale9Sprite::getColor(void)
|
|
||||||
{
|
|
||||||
return m_tColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCScale9Sprite::setOpacity(GLubyte var)
|
|
||||||
{
|
|
||||||
m_cOpacity = var;
|
|
||||||
|
|
||||||
if (scale9Image->getChildren() && scale9Image->getChildren()->count() != 0)
|
|
||||||
{
|
|
||||||
CCObject* child;
|
|
||||||
CCARRAY_FOREACH(scale9Image->getChildren(), child)
|
|
||||||
{
|
|
||||||
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
|
|
||||||
if (pNode)
|
|
||||||
{
|
|
||||||
pNode->setOpacity(m_cOpacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** sets the opacity.
|
/** sets the opacity.
|
||||||
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
|
@warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed.
|
||||||
Values goes from 0 to 255, where 255 means fully opaque.
|
Values goes from 0 to 255, where 255 means fully opaque.
|
||||||
*/
|
*/
|
||||||
GLubyte CCScale9Sprite::getOpacity()
|
|
||||||
{
|
|
||||||
return m_cOpacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCScale9Sprite::setPreferredSize(CCSize preferedSize)
|
void CCScale9Sprite::setPreferredSize(CCSize preferedSize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ NS_CC_EXT_BEGIN
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CCScale9Sprite : public CCNode, public CCRGBAProtocol
|
class CCScale9Sprite : public CCNodeRGBA
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCScale9Sprite();
|
CCScale9Sprite();
|
||||||
|
@ -68,11 +68,6 @@ public:
|
||||||
/** Sets the bottom side inset */
|
/** Sets the bottom side inset */
|
||||||
CC_PROPERTY(float, m_insetBottom, InsetBottom);
|
CC_PROPERTY(float, m_insetBottom, InsetBottom);
|
||||||
|
|
||||||
/** Opacity: conforms to CCRGBAProtocol protocol */
|
|
||||||
CC_PROPERTY(GLubyte, m_cOpacity, Opacity)
|
|
||||||
/** Color: conforms to CCRGBAProtocol protocol */
|
|
||||||
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_bSpritesGenerated;
|
bool m_bSpritesGenerated;
|
||||||
CCRect m_spriteRect;
|
CCRect m_spriteRect;
|
||||||
|
|
Loading…
Reference in New Issue