Merge pull request #1028 from minggo/iss1292_moidify_function_name

issue #1292:make some function names more readable
This commit is contained in:
minggo 2012-06-15 00:14:13 -07:00
commit 266a5e5e66
88 changed files with 777 additions and 735 deletions

View File

@ -84,7 +84,7 @@ public:
/** sets the dirty value */
inline void setDirty(bool bValue) { m_bDirty = bValue; }
/** get the dirty value */
inline bool getDirty(void) { return m_bDirty; }
inline bool isDirty(void) { return m_bDirty; }
/** sets the camera in the default position */
void restore(void);

View File

@ -70,13 +70,13 @@ public:
@since v0.99.2
*/
inline bool isSupportsNPOT(void)
inline bool supportsNPOT(void)
{
return m_bSupportsNPOT;
}
/** Whether or not PVR Texture Compressed is supported */
inline bool isSupportsPVRTC(void)
inline bool supportsPVRTC(void)
{
return m_bSupportsPVRTC;
}
@ -84,7 +84,7 @@ public:
/** Whether or not BGRA8888 textures are supported.
@since v0.99.2
*/
inline bool isSupportsBGRA8888(void)
inline bool supportsBGRA8888(void)
{
return m_bSupportsBGRA8888;
}
@ -92,7 +92,7 @@ public:
/** Whether or not glDiscardFramebufferEXT is supported
@since v0.99.2
*/
inline bool isSupportsDiscardFramebuffer(void)
inline bool supportsDiscardFramebuffer(void)
{
return m_bSupportsDiscardFramebuffer;
}
@ -100,7 +100,7 @@ public:
/** Whether or not shareable VAOs are supported.
@since v2.0.0
*/
inline bool isSupportsShareableVAO(void)
inline bool supportsShareableVAO(void)
{
return m_bSupportsShareableVAO;
}

View File

@ -546,7 +546,7 @@ void CCDirector::popToRootScene(void)
while (c > 1)
{
CCScene *current = (CCScene*)m_pobScenesStack->lastObject();
if( current->getIsRunning() )
if( current->isRunning() )
{
current->onExit();
}

View File

@ -331,7 +331,7 @@ void CCFollow::step(float dt)
bool CCFollow::isDone()
{
return ( !m_pobFollowedNode->getIsRunning() );
return ( !m_pobFollowedNode->isRunning() );
}
void CCFollow::stop()

View File

@ -91,7 +91,7 @@ CCShow* CCShow::create()
void CCShow::update(float time) {
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(true);
m_pTarget->setVisible(true);
}
CCFiniteTimeAction* CCShow::reverse() {
@ -135,7 +135,7 @@ CCHide * CCHide::create()
void CCHide::update(float time) {
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(false);
m_pTarget->setVisible(false);
}
CCFiniteTimeAction *CCHide::reverse() {
@ -181,7 +181,7 @@ CCToggleVisibility * CCToggleVisibility::create()
void CCToggleVisibility::update(float time)
{
CC_UNUSED_PARAM(time);
m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
m_pTarget->setVisible(!m_pTarget->isVisible());
}
CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)

View File

@ -210,15 +210,11 @@ public:
CCCallFunc()
: m_pSelectorTarget(NULL)
, m_pCallFunc(NULL)
{
}
virtual ~CCCallFunc()
{
if (m_pSelectorTarget)
{
m_pSelectorTarget->release();
}
CC_SAFE_RELEASE(m_pSelectorTarget);
}
/** creates the action with the callback
@warning: This interface will be deprecated in future.
@ -252,17 +248,9 @@ public:
{
if (pSel != m_pSelectorTarget)
{
if (m_pSelectorTarget)
{
m_pSelectorTarget->release();
}
m_pSelectorTarget = pSel;
if (m_pSelectorTarget)
{
m_pSelectorTarget->retain();
}
CC_SAFE_RETAIN(pSel);
CC_SAFE_RELEASE(m_pSelectorTarget);
m_pSelectorTarget = pSel;
}
}

View File

@ -1722,7 +1722,7 @@ void CCBlink::update(float time)
{
float slice = 1.0f / m_nTimes;
float m = fmodf(time, slice);
m_pTarget->setIsVisible(m > slice / 2 ? true : false);
m_pTarget->setVisible(m > slice / 2 ? true : false);
}
}

View File

@ -184,21 +184,21 @@ void CCAtlasNode::setOpacity(GLubyte opacity)
this->setColor(m_tColorUnmodified);
}
void CCAtlasNode::setIsOpacityModifyRGB(bool bValue)
void CCAtlasNode::setOpacityModifyRGB(bool bValue)
{
ccColor3B oldColor = this->m_tColor;
m_bIsOpacityModifyRGB = bValue;
this->m_tColor = oldColor;
}
bool CCAtlasNode::getIsOpacityModifyRGB()
bool CCAtlasNode::isOpacityModifyRGB()
{
return m_bIsOpacityModifyRGB;
}
void CCAtlasNode::updateOpacityModifyRGB()
{
m_bIsOpacityModifyRGB = m_pTextureAtlas->getTexture()->getHasPremultipliedAlpha();
m_bIsOpacityModifyRGB = m_pTextureAtlas->getTexture()->hasPremultipliedAlpha();
}
// CCAtlasNode - CocosNodeTexture protocol
@ -215,7 +215,7 @@ void CCAtlasNode::setBlendFunc(ccBlendFunc blendFunc)
void CCAtlasNode::updateBlendFunc()
{
if( ! m_pTextureAtlas->getTexture()->getHasPremultipliedAlpha() ) {
if( ! m_pTextureAtlas->getTexture()->hasPremultipliedAlpha() ) {
m_tBlendFunc.src = GL_SRC_ALPHA;
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
}

View File

@ -63,7 +63,10 @@ protected:
CC_PROPERTY(CCTextureAtlas*, m_pTextureAtlas, TextureAtlas);
// protocol variables
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
bool m_bIsOpacityModifyRGB;
bool isOpacityModifyRGB();
void setOpacityModifyRGB(bool isOpacityModifyRGB);
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc);
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);

View File

@ -324,13 +324,13 @@ void CCNode::setGrid(CCGridBase* pGrid)
/// isVisible getter
bool CCNode::getIsVisible()
bool CCNode::isVisible()
{
return m_bIsVisible;
}
/// isVisible setter
void CCNode::setIsVisible(bool var)
void CCNode::setVisible(bool var)
{
m_bIsVisible = var;
}
@ -374,12 +374,11 @@ void CCNode::setContentSize(const CCSize& size)
}
// isRunning getter
bool CCNode::getIsRunning()
bool CCNode::isRunning()
{
return m_bIsRunning;
}
/// parent getter
CCNode * CCNode::getParent()
{
@ -392,12 +391,12 @@ void CCNode::setParent(CCNode * var)
}
/// isRelativeAnchorPoint getter
bool CCNode::getIgnoreAnchorPointForPosition()
bool CCNode::isIgnoreAnchorPointForPosition()
{
return m_bIgnoreAnchorPointForPosition;
}
/// isRelativeAnchorPoint setter
void CCNode::setIgnoreAnchorPointForPosition(bool newValue)
void CCNode::ignoreAnchorPointForPosition(bool newValue)
{
if (newValue != m_bIgnoreAnchorPointForPosition)
{

View File

@ -196,7 +196,9 @@ class CC_DLL CCNode : public CCObject
CC_PROPERTY(CCGridBase *, m_pGrid, Grid)
/** Whether of not the node is visible. Default is true */
CC_PROPERTY(bool, m_bIsVisible, IsVisible)
bool m_bIsVisible;
bool isVisible();
void setVisible(bool visible);
/** anchorPoint is the point around which all transformations and positioning manipulations take place.
It's like a pin in the node where it is "attached" to its parent.
@ -220,14 +222,17 @@ class CC_DLL CCNode : public CCObject
CC_PROPERTY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
/** whether or not the node is running */
CC_PROPERTY_READONLY(bool, m_bIsRunning, IsRunning)
bool m_bIsRunning;
bool isRunning();
/** A weak reference to the parent */
CC_PROPERTY(CCNode *, m_pParent, Parent)
// If ture, the Anchor Point will be (0,0) when you position the CCNode.
// Used by CCLayer and CCScene
CC_PROPERTY(bool, m_bIgnoreAnchorPointForPosition, IgnoreAnchorPointForPosition);
bool m_bIgnoreAnchorPointForPosition;
bool isIgnoreAnchorPointForPosition();
void ignoreAnchorPointForPosition(bool isIgnoreAnchorPointForPosition);
/** A tag used to identify the node easily */
CC_PROPERTY(int, m_nTag, Tag)

View File

@ -178,7 +178,7 @@ void CCGridBase::setActive(bool bActive)
}
}
void CCGridBase::setIsTextureFlipped(bool bFlipped)
void CCGridBase::setTextureFlipped(bool bFlipped)
{
if (m_bIsTextureFlipped != bFlipped)
{
@ -228,7 +228,7 @@ void CCGridBase::afterDraw(cocos2d::CCNode *pTarget)
CCDirector *director = CCDirector::sharedDirector();
director->setProjection(m_directorProjection);
if (pTarget->getCamera()->getDirty())
if (pTarget->getCamera()->isDirty())
{
const CCPoint& offset = pTarget->getAnchorPointInPoints();

View File

@ -64,7 +64,7 @@ public:
/** is texture flipped */
inline bool isTextureFlipped(void) { return m_bIsTextureFlipped; }
void setIsTextureFlipped(bool bFlipped);
void setTextureFlipped(bool bFlipped);
bool initWithSize(const ccGridSize& gridSize, CCTexture2D *pTexture, bool bFlipped);
bool initWithSize(const ccGridSize& gridSize);

View File

@ -14,9 +14,9 @@ CCLayer * CCLayerLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader)
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
((CCLayer *)pNode)->setIsTouchEnabled(pCheck);
((CCLayer *)pNode)->setTouchEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
((CCLayer *)pNode)->setIsAccelerometerEnabled(pCheck);
((CCLayer *)pNode)->setAccelerometerEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
// TODO XXX
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);

View File

@ -736,9 +736,9 @@ void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, co
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_VISIBLE) == 0) {
pNode->setIsVisible(pCheck);
pNode->setVisible(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
pNode->setIgnoreAnchorPointForPosition(pCheck);
pNode->ignoreAnchorPointForPosition(pCheck);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}

View File

@ -249,7 +249,7 @@ GLubyte CCControl::getOpacity()
}
void CCControl::setIsOpacityModifyRGB(bool opacityModifyRGB)
void CCControl::setOpacityModifyRGB(bool opacityModifyRGB)
{
m_bIsOpacityModifyRGB=opacityModifyRGB;
CCObject* child;
@ -259,12 +259,12 @@ void CCControl::setIsOpacityModifyRGB(bool opacityModifyRGB)
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
if (pNode)
{
pNode->setIsOpacityModifyRGB(opacityModifyRGB);
pNode->setOpacityModifyRGB(opacityModifyRGB);
}
}
}
bool CCControl::getIsOpacityModifyRGB()
bool CCControl::isOpacityModifyRGB()
{
return m_bIsOpacityModifyRGB;
}

View File

@ -84,7 +84,9 @@ class CC_DLL CCControl : public CCLayer, public CCRGBAProtocol
//CCRGBAProtocol
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color);
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB);
bool m_bIsOpacityModifyRGB;
bool isOpacityModifyRGB();
void setOpacityModifyRGB(bool isOpacityModifyRGB);
/** Changes the priority of the button. The lower the number, the higher the priority. */
CC_SYNTHESIZE(int, m_nDefaultTouchPriority, DefaultTouchPriority);

View File

@ -66,7 +66,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
CCRGBAProtocol* rgbaLabel = dynamic_cast<CCRGBAProtocol*>(node);
assert(label != NULL || rgbaLabel!=NULL || backgroundSprite != NULL);
setIsTouchEnabled(true);
setTouchEnabled(true);
pushed=false;
m_zoomOnTouchDown = true;
m_nState=CCControlStateInitial;
@ -81,7 +81,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
m_zoomOnTouchDown = true;
// Set the default anchor point
setIgnoreAnchorPointForPosition(false);
ignoreAnchorPointForPosition(false);
setAnchorPoint(ccp(0.5f, 0.5f));
// Set the nodes
@ -102,7 +102,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
// Set the default color and opacity
setColor(ccc3(255, 255, 255));
setOpacity(255);
setIsOpacityModifyRGB(true);
setOpacityModifyRGB(true);
// Initialize the dispatch table
@ -356,7 +356,7 @@ void CCControlButton::setTitleLabelForState(CCNode* titleLabel, CCControlState s
}
m_titleLabelDispatchTable->setObject(titleLabel, state);
titleLabel->setIsVisible(false);
titleLabel->setVisible(false);
titleLabel->setAnchorPoint(ccp(0.5f, 0.5f));
addChild(titleLabel, 1);
@ -458,7 +458,7 @@ void CCControlButton::setBackgroundSpriteForState(CCScale9Sprite* sprite, CCCont
}
m_backgroundSpriteDispatchTable->setObject(sprite, state);
sprite->setIsVisible(false);
sprite->setVisible(false);
sprite->setAnchorPoint(ccp(0.5f, 0.5f));
addChild(sprite);
@ -484,8 +484,8 @@ void CCControlButton::setBackgroundSpriteFrameForState(CCSpriteFrame * spriteFra
void CCControlButton::needsLayout()
{
// Hide the background and the label
m_titleLabel->setIsVisible(false);
m_backgroundSprite->setIsVisible(false);
m_titleLabel->setVisible(false);
m_backgroundSprite->setVisible(false);
// Update anchor of all labels
this->setLabelAnchorPoint(this->m_labelAnchorPoint);
@ -545,8 +545,8 @@ void CCControlButton::needsLayout()
m_backgroundSprite->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
// Make visible the background and the label
m_titleLabel->setIsVisible(true);
m_backgroundSprite->setIsVisible(true);
m_titleLabel->setVisible(true);
m_backgroundSprite->setVisible(true);
}

View File

@ -39,7 +39,7 @@ bool CCControlColourPicker::init()
{
if (CCControl::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
// Cache the sprites
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist");

View File

@ -56,7 +56,7 @@ bool CCControlHuePicker::initWithTargetAndPos(CCNode* target, CCPoint pos)
{
if (CCControl::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
// Add background and slider sprites
m_background=CCControlUtils::addSpriteToTargetWithPosAndAnchor("huePickerBackground.png", target, pos, ccp(0.0f, 0.0f));
m_slider=CCControlUtils::addSpriteToTargetWithPosAndAnchor("colourPicker.png", target, pos, ccp(0.5f, 0.5f));

View File

@ -42,7 +42,7 @@ bool CCControlSaturationBrightnessPicker::initWithTargetAndPos(CCNode* target, C
{
if (CCControl::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
// Add background and slider sprites
m_background=CCControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerBackground.png", target, pos, ccp(0.0f, 0.0f));
m_overlay=CCControlUtils::addSpriteToTargetWithPosAndAnchor("colourPickerOverlay.png", target, pos, ccp(0.0f, 0.0f));

View File

@ -78,8 +78,8 @@ CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite*
{
if (CCControl::init())
{
setIgnoreAnchorPointForPosition(false);
setIsTouchEnabled(true);
ignoreAnchorPointForPosition(false);
setTouchEnabled(true);
m_backgroundSprite=backgroundSprite;
m_progressSprite=progessSprite;
@ -215,7 +215,7 @@ void CCControlSlider::sliderMoved(CCPoint location)
void CCControlSlider::sliderEnded(CCPoint location)
{
if (m_thumbItem->getIsSelected())
if (m_thumbItem->isSelected())
{
m_thumbItem->unselected();
setValue(valueForLocation(m_thumbItem->getPosition()));

View File

@ -301,7 +301,7 @@ bool CCControlSwitch::initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSpri
CCAssert(offSprite, "offSprite must not be nil.");
CCAssert(thumbSprite, "thumbSprite must not be nil.");
setIsTouchEnabled(true);
setTouchEnabled(true);
m_bOn = true;
m_pSwitchSprite = new CCControlSwitchSprite();
@ -314,7 +314,7 @@ bool CCControlSwitch::initWithMaskSprite(CCSprite *maskSprite, CCSprite * onSpri
m_pSwitchSprite->setPosition(ccp (m_pSwitchSprite->getContentSize().width / 2, m_pSwitchSprite->getContentSize().height / 2));
addChild(m_pSwitchSprite);
setIgnoreAnchorPointForPosition(false);
ignoreAnchorPointForPosition(false);
setAnchorPoint(ccp (0.5f, 0.5f));
setContentSize(m_pSwitchSprite->getContentSize());
return true;

View File

@ -78,7 +78,7 @@ bool CCMenuPassive::initWithItems(CCNode* item, va_list args)
CCSize s = CCDirector::sharedDirector()->getWinSize();
// Set the default anchor point
setIgnoreAnchorPointForPosition(true);
ignoreAnchorPointForPosition(true);
setAnchorPoint(ccp(0.5f, 0.5f));
this->setContentSize(s);

View File

@ -72,8 +72,8 @@ public:
void alignItemsInRows(unsigned int rows, va_list args);
//RGBA protocol
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
};
NS_CC_EXT_END

View File

@ -570,7 +570,7 @@ void CCScale9Sprite::updateCapInset()
this->setCapInsets(insets);
}
void CCScale9Sprite::setIsOpacityModifyRGB(bool var)
void CCScale9Sprite::setOpacityModifyRGB(bool var)
{
m_bIsOpacityModifyRGB = var;
if (scale9Image->getChildren() && scale9Image->getChildren()->count() != 0)
@ -581,7 +581,7 @@ void CCScale9Sprite::setIsOpacityModifyRGB(bool var)
CCRGBAProtocol* pNode = dynamic_cast<CCRGBAProtocol*>(child);
if (pNode)
{
pNode->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
pNode->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
}
//CCNode* pNode = (CCNode*) child;
//if (pNode)
@ -595,7 +595,7 @@ void CCScale9Sprite::setIsOpacityModifyRGB(bool var)
}
}
}
bool CCScale9Sprite::getIsOpacityModifyRGB()
bool CCScale9Sprite::isOpacityModifyRGB()
{
return m_bIsOpacityModifyRGB;
}

View File

@ -363,12 +363,12 @@ public:
Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
@since v0.8
*/
virtual void setIsOpacityModifyRGB(bool bValue);
virtual void setOpacityModifyRGB(bool bValue);
/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
@since v0.8
*/
virtual bool getIsOpacityModifyRGB(void);
virtual bool isOpacityModifyRGB(void);
virtual bool updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, CCRect capInsets);

View File

@ -59,7 +59,7 @@ bool CCListView::initWithMode(CCListViewMode mode)
{
if (CCLayerColor::initWithColor(ccc4(255, 255, 255, 0), 0, 0))
{
setIsTouchEnabled(true);
setTouchEnabled(true);
m_nMode = mode;
m_layerPanel = CCLayer::create();
this->addChild(m_layerPanel);
@ -962,7 +962,7 @@ int CCListView::rowForTouch(cocos2d::CCTouch *touch)
CCARRAY_FOREACH(pChildren, pObject)
{
CCNode* pChild = (CCNode*) pObject;
if (pChild && pChild->getIsVisible())
if (pChild && pChild->isVisible())
{
CCPoint local = pChild->convertToNodeSpace(touchLocation);
CCRect r = CCRectZero;
@ -1869,7 +1869,7 @@ bool CCListView::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
CC_UNUSED_PARAM(event);
if (!isTouchInside(touch) || !getIsVisible() || !m_bIsEnabled)
if (!isTouchInside(touch) || !isVisible() || !m_bIsEnabled)
{
return false;
}

View File

@ -42,7 +42,7 @@ CCListViewCell::CCListViewCell(void)
:m_nSeparatorStyle(CCListViewCellSeparatorStyleNone)
,m_bIsSelected(false)
{
setIsTouchEnabled(true);
setTouchEnabled(true);
m_selectionColor = ccc4(0, 0, 255, 255);
m_separatorLineColor = ccc3(128, 128, 128);
}

View File

@ -63,12 +63,12 @@ public:
Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO
@since v0.8
*/
virtual void setIsOpacityModifyRGB(bool bValue) = 0;
virtual void setOpacityModifyRGB(bool bValue) = 0;
/** returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);
@since v0.8
*/
virtual bool getIsOpacityModifyRGB(void) = 0;
virtual bool isOpacityModifyRGB(void) = 0;
};
/**

View File

@ -85,7 +85,6 @@ public:
virtual void draw();
#endif
virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; }
protected:
// string to render
std::string m_sString;

View File

@ -718,9 +718,22 @@ void CCLabelBMFont::purgeCachedData()
FNTConfigRemoveCache();
}
CCLabelBMFont * CCLabelBMFont::node() { return CCLabelBMFont::create(); }
CCLabelBMFont * CCLabelBMFont::node()
{
return CCLabelBMFont::create();
}
CCLabelBMFont * CCLabelBMFont::create() { CCLabelBMFont * pRet = new CCLabelBMFont(); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CCLabelBMFont * CCLabelBMFont::create()
{
CCLabelBMFont * pRet = new CCLabelBMFont();
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile, float width/* = kCCLabelAutomaticWidth*/, CCTextAlignment alignment/* = kCCTextAlignmentLeft*/, CCPoint imageOffset/* = CCPointZero*/)
{
@ -784,7 +797,7 @@ bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile, f
m_cOpacity = 255;
m_tColor = ccWHITE;
m_tContentSize = CCSizeZero;
m_bIsOpacityModifyRGB = m_pobTextureAtlas->getTexture()->getHasPremultipliedAlpha();
m_bIsOpacityModifyRGB = m_pobTextureAtlas->getTexture()->hasPremultipliedAlpha();
this->setString(theString);
setAnchorPoint(ccp(0.5f, 0.5f));
return true;
@ -913,7 +926,7 @@ void CCLabelBMFont::createFontChars()
prev = c;
// Apply label properties
fontChar->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
fontChar->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
// Color MUST be set before opacity, since opacity might change color if OpacityModifyRGB is on
fontChar->setColor(m_tColor);
@ -962,7 +975,7 @@ void CCLabelBMFont::updateString(bool fromUpdate)
CCNode* pNode = (CCNode*) child;
if (pNode)
{
pNode->setIsVisible(false);
pNode->setVisible(false);
}
}
}
@ -1028,7 +1041,7 @@ GLubyte CCLabelBMFont::getOpacity()
{
return m_cOpacity;
}
void CCLabelBMFont::setIsOpacityModifyRGB(bool var)
void CCLabelBMFont::setOpacityModifyRGB(bool var)
{
m_bIsOpacityModifyRGB = var;
if (m_pChildren && m_pChildren->count() != 0)
@ -1042,13 +1055,13 @@ void CCLabelBMFont::setIsOpacityModifyRGB(bool var)
CCRGBAProtocol *pRGBAProtocol = dynamic_cast<CCRGBAProtocol*>(pNode);
if (pRGBAProtocol)
{
pRGBAProtocol->setIsOpacityModifyRGB(m_bIsOpacityModifyRGB);
pRGBAProtocol->setOpacityModifyRGB(m_bIsOpacityModifyRGB);
}
}
}
}
}
bool CCLabelBMFont::getIsOpacityModifyRGB()
bool CCLabelBMFont::isOpacityModifyRGB()
{
return m_bIsOpacityModifyRGB;
}
@ -1091,7 +1104,7 @@ void CCLabelBMFont::updateLabel()
while (!(characterSprite = (CCSprite*)this->getChildByTag(j + skip)))
skip++;
if (!characterSprite->getIsVisible()) continue;
if (!characterSprite->isVisible()) continue;
if (i >= stringLength)
break;
@ -1339,30 +1352,30 @@ float CCLabelBMFont::getLetterPosXRight( CCSprite* sp )
return sp->getPosition().x * m_fScaleX + (sp->getContentSize().width * m_fScaleX * sp->getAnchorPoint().x);
}
// LabelBMFont - FntFile
void CCLabelBMFont::setFntFile(const char* fntFile)
{
if (fntFile != NULL && strcmp(fntFile, m_sFntFile.c_str()) != 0 )
{
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
CCAssert( newConf, "CCLabelBMFont: Impossible to create font. Please check file");
m_sFntFile = fntFile;
CC_SAFE_RELEASE(m_pConfiguration);
CC_SAFE_RETAIN(newConf);
m_pConfiguration = newConf;
this->setTexture(CCTextureCache::sharedTextureCache()->addImage(m_pConfiguration->getAtlasName()));
this->createFontChars();
}
}
const char* CCLabelBMFont::getFntFile()
{
return m_sFntFile.c_str();
}
// LabelBMFont - FntFile
void CCLabelBMFont::setFntFile(const char* fntFile)
{
if (fntFile != NULL && strcmp(fntFile, m_sFntFile.c_str()) != 0 )
{
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
CCAssert( newConf, "CCLabelBMFont: Impossible to create font. Please check file");
m_sFntFile = fntFile;
CC_SAFE_RELEASE(m_pConfiguration);
CC_SAFE_RETAIN(newConf);
m_pConfiguration = newConf;
this->setTexture(CCTextureCache::sharedTextureCache()->addImage(m_pConfiguration->getAtlasName()));
this->createFontChars();
}
}
const char* CCLabelBMFont::getFntFile()
{
return m_sFntFile.c_str();
}
//LabelBMFont - Debug draw

View File

@ -164,7 +164,9 @@ class CC_DLL CCLabelBMFont : public CCSpriteBatchNode, public CCLabelProtocol, p
/** conforms to CCRGBAProtocol protocol */
CC_PROPERTY_PASS_BY_REF(ccColor3B, m_tColor, Color)
/** conforms to CCRGBAProtocol protocol */
CC_PROPERTY(bool, m_bIsOpacityModifyRGB, IsOpacityModifyRGB)
bool m_bIsOpacityModifyRGB;
bool isOpacityModifyRGB();
void setOpacityModifyRGB(bool isOpacityModifyRGB);
protected:
// string to render
unsigned short* m_sString;

View File

@ -144,12 +144,12 @@ int CCLayer::excuteScriptTouchHandler(int nEventType, CCSet *pTouches)
}
/// isTouchEnabled getter
bool CCLayer::getIsTouchEnabled()
bool CCLayer::isTouchEnabled()
{
return m_bIsTouchEnabled;
}
/// isTouchEnabled setter
void CCLayer::setIsTouchEnabled(bool enabled)
void CCLayer::setTouchEnabled(bool enabled)
{
if (m_bIsTouchEnabled != enabled)
{
@ -171,12 +171,12 @@ void CCLayer::setIsTouchEnabled(bool enabled)
}
/// isAccelerometerEnabled getter
bool CCLayer::getIsAccelerometerEnabled()
bool CCLayer::isAccelerometerEnabled()
{
return m_bIsAccelerometerEnabled;
}
/// isAccelerometerEnabled setter
void CCLayer::setIsAccelerometerEnabled(bool enabled)
void CCLayer::setAccelerometerEnabled(bool enabled)
{
if (enabled != m_bIsAccelerometerEnabled)
{
@ -198,12 +198,12 @@ void CCLayer::setIsAccelerometerEnabled(bool enabled)
}
/// isKeypadEnabled getter
bool CCLayer::getIsKeypadEnabled()
bool CCLayer::isKeypadEnabled()
{
return m_bIsKeypadEnabled;
}
/// isKeypadEnabled setter
void CCLayer::setIsKeypadEnabled(bool enabled)
void CCLayer::setKeypadEnabled(bool enabled)
{
if (enabled != m_bIsKeypadEnabled)
{

View File

@ -99,17 +99,25 @@ public:
Only the touches of this node will be affected. This "method" is not propagated to it's children.
@since v0.8.1
*/
CC_PROPERTY(bool, m_bIsTouchEnabled, IsTouchEnabled)
bool isTouchEnabled();
void setTouchEnabled(bool value);
/** whether or not it will receive Accelerometer events
You can enable / disable accelerometer events with this property.
@since v0.8.1
*/
CC_PROPERTY(bool, m_bIsAccelerometerEnabled, IsAccelerometerEnabled)
bool isAccelerometerEnabled();
void setAccelerometerEnabled(bool value);
/** whether or not it will receive keypad events
You can enable / disable accelerometer events with this property.
it's new in cocos2d-x
*/
CC_PROPERTY(bool, m_bIsKeypadEnabled, IsKeypadEnabled)
bool isKeypadEnabled();
void setKeypadEnabled(bool value);
protected:
bool m_bIsTouchEnabled;
bool m_bIsAccelerometerEnabled;
bool m_bIsKeypadEnabled;
private:
// Script touch events handler
@ -250,8 +258,8 @@ public:
/** BlendFunction. Conforms to CCBlendProtocol protocol */
CC_PROPERTY(ccBlendFunc, m_tBlendFunc, BlendFunc)
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
//@warning: This interface will be deprecated in future.
LAYER_CREATE_FUNC(CCLayerColor)
LAYER_NODE_FUNC(CCLayerColor)

View File

@ -123,13 +123,13 @@ void CCTransitionScene::draw()
void CCTransitionScene::finish()
{
// clean up
m_pInScene->setIsVisible(true);
m_pInScene->setVisible(true);
m_pInScene->setPosition(ccp(0,0));
m_pInScene->setScale(1.0f);
m_pInScene->setRotation(0.0f);
m_pInScene->getCamera()->restore();
m_pOutScene->setIsVisible(false);
m_pOutScene->setVisible(false);
m_pOutScene->setPosition(ccp(0,0));
m_pOutScene->setScale(1.0f);
m_pOutScene->setRotation(0.0f);
@ -154,13 +154,13 @@ void CCTransitionScene::setNewScene(float dt)
// enable events while transitions
director->getTouchDispatcher()->setDispatchEvents(true);
// issue #267
m_pOutScene->setIsVisible(true);
m_pOutScene->setVisible(true);
}
void CCTransitionScene::hideOutShowIn()
{
m_pInScene->setIsVisible(true);
m_pOutScene->setIsVisible(false);
m_pInScene->setVisible(true);
m_pOutScene->setVisible(false);
}
@ -607,7 +607,7 @@ void CCTransitionFlipX::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -677,7 +677,7 @@ void CCTransitionFlipY::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -748,7 +748,7 @@ void CCTransitionFlipAngular::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -817,7 +817,7 @@ void CCTransitionZoomFlipX::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -896,7 +896,7 @@ void CCTransitionZoomFlipY::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -975,7 +975,7 @@ void CCTransitionZoomFlipAngular::onEnter()
CCTransitionSceneOriented::onEnter();
CCActionInterval *inA, *outA;
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
float inDeltaZ, inAngleZ;
float outDeltaZ, outAngleZ;
@ -1086,7 +1086,7 @@ void CCTransitionFade :: onEnter()
CCTransitionScene::onEnter();
CCLayerColor* l = CCLayerColor::create(m_tColor);
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
addChild(l, 2, kSceneFade);
CCNode* f = getChildByTag(kSceneFade);
@ -1264,7 +1264,7 @@ CCTransitionSplitCols::~CCTransitionSplitCols()
void CCTransitionSplitCols::onEnter()
{
CCTransitionScene::onEnter();
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
CCActionInterval* split = action();
CCActionInterval* seq = (CCActionInterval*)CCSequence::create

View File

@ -106,7 +106,7 @@ void CCTransitionPageTurn::onEnter()
else
{
// to prevent initial flicker
m_pInScene->setIsVisible(false);
m_pInScene->setVisible(false);
m_pInScene->runAction
(
CCSequence::create

View File

@ -41,9 +41,9 @@ enum {
};
CCTransitionProgress::CCTransitionProgress()
: to_(0.0f)
, from_(0.0f)
, sceneToBeModified_(NULL)
: m_fTo(0.0f)
, m_fFrom(0.0f)
, m_pSceneToBeModified(NULL)
{
}
@ -68,12 +68,12 @@ void CCTransitionProgress::onEnter()
// render outScene to its texturebuffer
texture->clear(0, 0, 0, 1);
texture->begin();
sceneToBeModified_->visit();
m_pSceneToBeModified->visit();
texture->end();
// Since we've passed the outScene to the texture we don't need it.
if( sceneToBeModified_ == m_pOutScene )
if (m_pSceneToBeModified == m_pOutScene)
{
hideOutShowIn();
}
@ -82,7 +82,7 @@ void CCTransitionProgress::onEnter()
// create the blend action
CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create(
CCProgressFromTo::create(m_fDuration, from_, to_),
CCProgressFromTo::create(m_fDuration, m_fFrom, m_fTo),
CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)),
NULL);
// run the blend action
@ -107,9 +107,9 @@ void CCTransitionProgress::sceneOrder()
void CCTransitionProgress::setupTransition()
{
sceneToBeModified_ = m_pOutScene;
from_ = 100;
to_ = 0;
m_pSceneToBeModified = m_pOutScene;
m_fFrom = 100;
m_fTo = 0;
}
CCProgressTimer* CCTransitionProgress::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
@ -132,7 +132,7 @@ CCProgressTimer* CCTransitionProgressRadialCCW::progressTimerNodeWithRenderTextu
pNode->setType(kCCProgressTimerTypeRadial);
// Return the radial type that we want to use
pNode->setIsReverseDirection(false);
pNode->setReverseDirection(false);
pNode->setPercentage(100);
pNode->setPosition(ccp(size.width/2, size.height/2));
pNode->setAnchorPoint(ccp(0.5f,0.5f));
@ -153,7 +153,7 @@ CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTextur
pNode->setType( kCCProgressTimerTypeRadial );
// Return the radial type that we want to use
pNode->setIsReverseDirection(true);
pNode->setReverseDirection(true);
pNode->setPercentage(100);
pNode->setPosition(ccp(size.width/2, size.height/2));
pNode->setAnchorPoint(ccp(0.5f,0.5f));
@ -215,9 +215,9 @@ void CCTransitionProgressInOut::sceneOrder()
void CCTransitionProgressInOut::setupTransition()
{
sceneToBeModified_ = m_pInScene;
from_ = 0;
to_ = 100;
m_pSceneToBeModified = m_pInScene;
m_fFrom = 0;
m_fTo = 100;
}
CCProgressTimer* CCTransitionProgressInOut::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)

View File

@ -47,9 +47,9 @@ protected:
virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture);
virtual void setupTransition();
virtual void sceneOrder();
float to_;
float from_;
CCScene* sceneToBeModified_;
float m_fTo;
float m_fFrom;
CCScene* m_pSceneToBeModified;
};

View File

@ -144,13 +144,13 @@ bool CCMenu::initWithArray(CCArray* pArrayOfItems)
{
if (CCLayer::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
m_bEnabled = true;
// menu in the center of the screen
CCSize s = CCDirector::sharedDirector()->getWinSize();
this->setIgnoreAnchorPointForPosition(true);
this->ignoreAnchorPointForPosition(true);
setAnchorPoint(ccp(0.5f, 0.5f));
this->setContentSize(s);
@ -231,7 +231,7 @@ bool CCMenu::ccTouchBegan(CCTouch* touch, CCEvent* event)
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->getIsVisible() == false)
if (c->isVisible() == false)
{
return false;
}
@ -654,7 +654,7 @@ CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
CCARRAY_FOREACH(m_pChildren, pObject)
{
CCNode* pChild = dynamic_cast<CCNode*>(pObject);
if (pChild && pChild->getIsVisible() && ((CCMenuItem*)pChild)->getIsEnabled())
if (pChild && pChild->isVisible() && ((CCMenuItem*)pChild)->isEnabled())
{
CCPoint local = pChild->convertToNodeSpace(touchLocation);
CCRect r = ((CCMenuItem*)pChild)->rect();
@ -666,7 +666,6 @@ CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
}
}
}
}
return NULL;

View File

@ -54,7 +54,8 @@ class CC_DLL CCMenu : public CCLayer, public CCRGBAProtocol
/** Opacity: conforms with CCRGBAProtocol protocol */
CC_PROPERTY(GLubyte, m_cOpacity, Opacity);
/** whether or not the menu will receive events */
CC_SYNTHESIZE(bool, m_bEnabled, Enabled);
bool m_bEnabled;
public:
CCMenu()
: m_cOpacity(0)
@ -153,8 +154,11 @@ public:
*/
virtual void onExit();
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
virtual bool isEnabled() { return m_bEnabled; }
virtual void setEnabled(bool value) { m_bEnabled = value; };
protected:
CCMenuItem* itemForTouch(CCTouch * touch);

View File

@ -124,7 +124,7 @@ void CCMenuItem::setIsEnabled(bool enabled)
m_bIsEnabled = enabled;
}
bool CCMenuItem::getIsEnabled()
bool CCMenuItem::isEnabled()
{
return m_bIsEnabled;
}
@ -136,7 +136,7 @@ CCRect CCMenuItem::rect()
m_tContentSize.width, m_tContentSize.height);
}
bool CCMenuItem::getIsSelected()
bool CCMenuItem::isSelected()
{
return m_bIsSelected;
}
@ -624,17 +624,17 @@ void CCMenuItemSprite::selected()
{
if (m_pDisabledImage)
{
m_pDisabledImage->setIsVisible(false);
m_pDisabledImage->setVisible(false);
}
if (m_pSelectedImage)
{
m_pNormalImage->setIsVisible(false);
m_pSelectedImage->setIsVisible(true);
m_pNormalImage->setVisible(false);
m_pSelectedImage->setVisible(true);
}
else
{
m_pNormalImage->setIsVisible(true);
m_pNormalImage->setVisible(true);
}
}
}
@ -644,26 +644,26 @@ void CCMenuItemSprite::unselected()
CCMenuItem::unselected();
if (m_pNormalImage)
{
m_pNormalImage->setIsVisible(true);
m_pNormalImage->setVisible(true);
if (m_pSelectedImage)
{
m_pSelectedImage->setIsVisible(false);
m_pSelectedImage->setVisible(false);
}
if (m_pDisabledImage)
{
m_pDisabledImage->setIsVisible(false);
m_pDisabledImage->setVisible(false);
}
}
}
void CCMenuItemSprite::setIsEnabled(bool bEnabled)
{
if( m_bIsEnabled != bEnabled )
{
CCMenuItem::setIsEnabled(bEnabled);
this->updateImagesVisibility();
if( m_bIsEnabled != bEnabled )
{
CCMenuItem::setIsEnabled(bEnabled);
this->updateImagesVisibility();
}
}
@ -672,23 +672,23 @@ void CCMenuItemSprite::updateImagesVisibility()
{
if (m_bIsEnabled)
{
if (m_pNormalImage) m_pNormalImage->setIsVisible(true);
if (m_pSelectedImage) m_pSelectedImage->setIsVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setIsVisible(false);
if (m_pNormalImage) m_pNormalImage->setVisible(true);
if (m_pSelectedImage) m_pSelectedImage->setVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setVisible(false);
}
else
{
if (m_pDisabledImage)
{
if (m_pNormalImage) m_pNormalImage->setIsVisible(false);
if (m_pSelectedImage) m_pSelectedImage->setIsVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setIsVisible(true);
if (m_pNormalImage) m_pNormalImage->setVisible(false);
if (m_pSelectedImage) m_pSelectedImage->setVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setVisible(true);
}
else
{
if (m_pNormalImage) m_pNormalImage->setIsVisible(true);
if (m_pSelectedImage) m_pSelectedImage->setIsVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setIsVisible(false);
if (m_pNormalImage) m_pNormalImage->setVisible(true);
if (m_pSelectedImage) m_pSelectedImage->setVisible(false);
if (m_pDisabledImage) m_pDisabledImage->setVisible(false);
}
}
}

View File

@ -45,11 +45,12 @@ class CCSpriteFrame;
*/
class CC_DLL CCMenuItem : public CCNode
{
protected:
/** whether or not the item is selected
@since v0.8.2
*/
CC_PROPERTY_READONLY(bool, m_bIsSelected, IsSelected);
CC_PROPERTY(bool, m_bIsEnabled, IsEnabled);
bool m_bIsEnabled;
bool m_bIsSelected;
public:
CCMenuItem()
: m_bIsSelected(false)
@ -80,6 +81,10 @@ public:
virtual void registerScriptHandler(int nHandler);
virtual void unregisterScriptHandler(void);
bool isEnabled();
void setIsEnabled(bool value);
bool isSelected();
/** set the target/selector of the menu item*/
void setTarget(CCObject *rec, SEL_MenuHandler selector);
protected:
@ -138,8 +143,8 @@ public:
virtual void setColor(const ccColor3B& color);
virtual const ccColor3B& getColor();
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
protected:
ccColor3B m_tColorBackup;
float m_fOriginalScale;
@ -284,8 +289,8 @@ public:
virtual void unselected();
virtual void setIsEnabled(bool bEnabled);
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
protected:
virtual void updateImagesVisibility();
};
@ -405,8 +410,8 @@ public:
virtual void unselected();
virtual void setIsEnabled(bool var);
virtual void setIsOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool getIsOpacityModifyRGB(void) { return false;}
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;}
};
NS_CC_END

View File

@ -114,7 +114,7 @@ bool CCMotionStreak::initWithFade(float fade, float minSeg, float stroke, ccColo
{
CCNode::setPosition(CCPointZero);
setAnchorPoint(CCPointZero);
setIgnoreAnchorPointForPosition(true);
ignoreAnchorPointForPosition(true);
m_bStartingPositionInitialized = false;
m_tPositionR = CCPointZero;
@ -211,12 +211,12 @@ GLubyte CCMotionStreak::getOpacity(void)
return 0;
}
void CCMotionStreak::setIsOpacityModifyRGB(bool bValue)
void CCMotionStreak::setOpacityModifyRGB(bool bValue)
{
CC_UNUSED_PARAM(bValue);
}
bool CCMotionStreak::getIsOpacityModifyRGB(void)
bool CCMotionStreak::isOpacityModifyRGB(void)
{
return false;
}

View File

@ -80,8 +80,8 @@ public:
virtual const ccColor3B& getColor(void);
virtual GLubyte getOpacity(void);
virtual void setOpacity(GLubyte opacity);
virtual void setIsOpacityModifyRGB(bool bValue);
virtual bool getIsOpacityModifyRGB(void);
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
/** When fast mode is enbled, new points are added faster but with lower precision */
CC_SYNTHESIZE(bool, m_bFastMode, IsFastMode);

View File

@ -176,12 +176,12 @@ GLubyte CCProgressTimer::getOpacity(void)
return m_pSprite->getOpacity();
}
void CCProgressTimer::setIsOpacityModifyRGB(bool bValue)
void CCProgressTimer::setOpacityModifyRGB(bool bValue)
{
CC_UNUSED_PARAM(bValue);
}
bool CCProgressTimer::getIsOpacityModifyRGB(void)
bool CCProgressTimer::isOpacityModifyRGB(void)
{
return false;
}

View File

@ -75,8 +75,11 @@ public:
virtual const ccColor3B& getColor(void);
virtual GLubyte getOpacity(void);
virtual void setOpacity(GLubyte opacity);
virtual void setIsOpacityModifyRGB(bool bValue);
virtual bool getIsOpacityModifyRGB(void);
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
inline bool isReverseDirection() { return m_bReverseDirection; };
inline void setReverseDirection(bool value) { m_bReverseDirection = value; };
public:
/** Creates a progress timer with the sprite as the shape the timer goes through
@ -121,7 +124,7 @@ protected:
*/
CC_SYNTHESIZE(CCPoint, m_tBarChangeRate, BarChangeRate);
CC_SYNTHESIZE(bool ,m_bReverseDirection, IsReverseDirection);
bool m_bReverseDirection;
};
NS_CC_END

View File

@ -179,7 +179,7 @@ bool CCRenderTexture::initWithWidthAndHeight(int w, int h, CCTexture2DPixelForma
unsigned int powW = 0;
unsigned int powH = 0;
if( CCConfiguration::sharedConfiguration()->isSupportsNPOT() ) {
if( CCConfiguration::sharedConfiguration()->supportsNPOT() ) {
powW = w;
powH = h;
} else {

View File

@ -493,7 +493,7 @@ void CCParticleBatchNode::updateAllAtlasIndexes()
void CCParticleBatchNode::updateBlendFunc(void)
{
if( ! m_pTextureAtlas->getTexture()->getHasPremultipliedAlpha()) {
if( ! m_pTextureAtlas->getTexture()->hasPremultipliedAlpha()) {
m_tBlendFunc.src = GL_SRC_ALPHA;
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
}
@ -504,7 +504,7 @@ void CCParticleBatchNode::setTexture(CCTexture2D* texture)
m_pTextureAtlas->setTexture(texture);
// If the new texture has No premultiplied alpha, AND the blendFunc hasn't been changed, then update it
if( texture && ! texture->getHasPremultipliedAlpha() && ( m_tBlendFunc.src == CC_BLEND_SRC && m_tBlendFunc.dst == CC_BLEND_DST ) )
if( texture && ! texture->hasPremultipliedAlpha() && ( m_tBlendFunc.src == CC_BLEND_SRC && m_tBlendFunc.dst == CC_BLEND_DST ) )
{
m_tBlendFunc.src = GL_SRC_ALPHA;
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;

View File

@ -94,7 +94,7 @@ bool CCParticleFire::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(true);
this->setBlendAdditive(true);
return true;
}
return false;
@ -162,7 +162,7 @@ bool CCParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles)
m_fEndSize = kCCParticleStartSizeEqualToEndSize;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;
@ -175,7 +175,7 @@ bool CCParticleSun::initWithTotalParticles(unsigned int numberOfParticles)
if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
{
// additive
this->setIsBlendAdditive(true);
this->setBlendAdditive(true);
// duration
m_fDuration = kCCParticleDurationInfinity;
@ -307,7 +307,7 @@ bool CCParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(true);
this->setBlendAdditive(true);
return true;
}
return false;
@ -381,7 +381,7 @@ bool CCParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(true);
this->setBlendAdditive(true);
return true;
}
return false;
@ -454,7 +454,7 @@ bool CCParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(true);
this->setBlendAdditive(true);
return true;
}
return false;
@ -528,7 +528,7 @@ bool CCParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;
@ -601,7 +601,7 @@ bool CCParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;
@ -671,7 +671,7 @@ bool CCParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;
@ -744,7 +744,7 @@ bool CCParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;
@ -817,7 +817,7 @@ bool CCParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
m_tEndColorVar.a = 0.0f;
// additive
this->setIsBlendAdditive(false);
this->setBlendAdditive(false);
return true;
}
return false;

View File

@ -748,7 +748,7 @@ void CCParticleSystem::updateBlendFunc()
if(m_pTexture)
{
bool premultiplied = m_pTexture->getHasPremultipliedAlpha();
bool premultiplied = m_pTexture->hasPremultipliedAlpha();
m_bOpacityModifyRGB = false;
@ -773,7 +773,7 @@ CCTexture2D * CCParticleSystem::getTexture()
}
// ParticleSystem - Additive Blending
void CCParticleSystem::setIsBlendAdditive(bool additive)
void CCParticleSystem::setBlendAdditive(bool additive)
{
if( additive )
{
@ -782,7 +782,7 @@ void CCParticleSystem::setIsBlendAdditive(bool additive)
}
else
{
if( m_pTexture && ! m_pTexture->getHasPremultipliedAlpha() )
if( m_pTexture && ! m_pTexture->hasPremultipliedAlpha() )
{
m_tBlendFunc.src = GL_SRC_ALPHA;
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
@ -795,7 +795,7 @@ void CCParticleSystem::setIsBlendAdditive(bool additive)
}
}
bool CCParticleSystem::getIsBlendAdditive()
bool CCParticleSystem::isBlendAdditive()
{
return( m_tBlendFunc.src == GL_SRC_ALPHA && m_tBlendFunc.dst == GL_ONE);
}
@ -958,7 +958,7 @@ float CCParticleSystem::getRotatePerSecondVar()
return modeB.rotatePerSecondVar;
}
bool CCParticleSystem::getIsActive()
bool CCParticleSystem::isActive()
{
return m_bIsActive;
}

View File

@ -237,7 +237,7 @@ protected:
unsigned int m_uAllocatedParticles;
/** Is the emitter active */
CC_PROPERTY_READONLY(bool, m_bIsActive, IsActive)
bool m_bIsActive;
/** Quantity of particles that are being simulated at the moment */
CC_PROPERTY_READONLY(unsigned int, m_uParticleCount, ParticleCount)
/** How many seconds the emitter wil run. -1 means 'forever' */
@ -290,6 +290,10 @@ public:
virtual void setRotation(float newRotation);
virtual void setScaleX(float newScaleX);
virtual void setScaleY(float newScaleY);
virtual bool isActive();
virtual bool isBlendAdditive();
virtual void setBlendAdditive(bool value);
//////////////////////////////////////////////////////////////////////////
/** start size in pixels of each particle */
@ -334,7 +338,7 @@ public:
dest blend function = GL_ONE;
@endcode
*/
CC_PROPERTY(bool, m_bIsBlendAdditive, IsBlendAdditive)
bool m_bIsBlendAdditive;
/** particles movement type: Free or Grouped
@since v0.8
*/

View File

@ -852,15 +852,15 @@ void CCSprite::setAnchorPoint(const CCPoint& anchor)
SET_DIRTY_RECURSIVELY();
}
void CCSprite::setIgnoreAnchorPointForPosition(bool value)
void CCSprite::ignoreAnchorPointForPosition(bool value)
{
CCAssert(! m_pobBatchNode, "ignoreAnchorPointForPosition is invalid in CCSprite");
CCNode::setIgnoreAnchorPointForPosition(value);
CCNode::ignoreAnchorPointForPosition(value);
}
void CCSprite::setIsVisible(bool bVisible)
{
CCNode::setIsVisible(bVisible);
CCNode::setVisible(bVisible);
SET_DIRTY_RECURSIVELY();
}
@ -966,14 +966,14 @@ void CCSprite::setColor(const ccColor3B& color3)
updateColor();
}
void CCSprite::setIsOpacityModifyRGB(bool bValue)
void CCSprite::setOpacityModifyRGB(bool bValue)
{
ccColor3B oldColor = m_sColor;
m_bOpacityModifyRGB = bValue;
m_sColor = oldColor;
}
bool CCSprite::getIsOpacityModifyRGB(void)
bool CCSprite::isOpacityModifyRGB(void)
{
return m_bOpacityModifyRGB;
}
@ -1070,17 +1070,17 @@ void CCSprite::updateBlendFunc(void)
CCAssert (! m_pobBatchNode, "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a CCSpriteSheet");
// it is possible to have an untextured sprite
if (! m_pobTexture || ! m_pobTexture->getHasPremultipliedAlpha())
if (! m_pobTexture || ! m_pobTexture->hasPremultipliedAlpha())
{
m_sBlendFunc.src = GL_SRC_ALPHA;
m_sBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
setIsOpacityModifyRGB(false);
setOpacityModifyRGB(false);
}
else
{
m_sBlendFunc.src = CC_BLEND_SRC;
m_sBlendFunc.dst = CC_BLEND_DST;
setIsOpacityModifyRGB(true);
setOpacityModifyRGB(true);
}
}

View File

@ -221,7 +221,7 @@ public:
virtual void setScale(float fScale);
virtual void setVertexZ(float fVertexZ);
virtual void setAnchorPoint(const CCPoint& anchor);
virtual void setIgnoreAnchorPointForPosition(bool value);
virtual void ignoreAnchorPointForPosition(bool value);
virtual void setIsVisible(bool bVisible);
void setFlipX(bool bFlipX);
void setFlipY(bool bFlipY);
@ -245,8 +245,8 @@ public:
void updateColor(void);
// RGBAProtocol
/** opacity: conforms to CCRGBAProtocol protocol */
virtual void setIsOpacityModifyRGB(bool bValue);
virtual bool getIsOpacityModifyRGB(void);
virtual void setOpacityModifyRGB(bool bValue);
virtual bool isOpacityModifyRGB(void);
// CCTextureProtocol
virtual void setTexture(CCTexture2D *texture);

View File

@ -668,7 +668,7 @@ void CCSpriteBatchNode::removeSpriteFromAtlas(CCSprite *pobSprite)
void CCSpriteBatchNode::updateBlendFunc(void)
{
if (! m_pobTextureAtlas->getTexture()->getHasPremultipliedAlpha())
if (! m_pobTextureAtlas->getTexture()->hasPremultipliedAlpha())
{
m_blendFunc.src = GL_SRC_ALPHA;
m_blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;

View File

@ -171,7 +171,7 @@ void* CCTexture2D::keepData(void *data, unsigned int length)
return data;
}
bool CCTexture2D::getHasPremultipliedAlpha()
bool CCTexture2D::hasPremultipliedAlpha()
{
return m_bHasPremultipliedAlpha;
}
@ -530,7 +530,7 @@ void CCTexture2D::drawInRect(const CCRect& rect)
// implementation CCTexture2D (PVRTC);
bool CCTexture2D::initWithPVRTCData(const void *data, int level, int bpp, bool hasAlpha, int length, CCTexture2DPixelFormat pixelFormat)
{
if( !(CCConfiguration::sharedConfiguration()->isSupportsPVRTC()) )
if( !(CCConfiguration::sharedConfiguration()->supportsPVRTC()) )
{
CCLOG("cocos2d: WARNING: PVRTC images is not supported.");
this->release();
@ -617,6 +617,11 @@ void CCTexture2D::generateMipmap()
m_bHasMipmaps = true;
}
bool CCTexture2D::hasMipmaps()
{
return m_bHasMipmaps;
}
void CCTexture2D::setTexParameters(ccTexParams *texParams)
{
CCAssert( (m_uPixelsWide == ccNextPOT(m_uPixelsWide) || texParams->wrapS == GL_CLAMP_TO_EDGE) &&

View File

@ -235,6 +235,9 @@ public:
/** content size */
const CCSize& getContentSizeInPixels();
bool hasPremultipliedAlpha();
bool hasMipmaps();
private:
bool initPremultipliedATextureWithImage(CCImage * image, unsigned int pixelsWide, unsigned int pixelsHigh);
@ -259,9 +262,9 @@ private:
CC_PROPERTY_READONLY(CCSize, m_tContentSize, ContentSize)
/** whether or not the texture has their Alpha premultiplied */
CC_PROPERTY_READONLY(bool, m_bHasPremultipliedAlpha, HasPremultipliedAlpha);
bool m_bHasPremultipliedAlpha;
CC_SYNTHESIZE_READONLY(bool, m_bHasMipmaps, HasMipmaps);
bool m_bHasMipmaps;
/** shader program used by drawAtPoint and drawInRect */
CC_PROPERTY(CCGLProgram*, m_pShaderProgram, ShaderProgram);

View File

@ -191,7 +191,7 @@ bool CCTexturePVR::unpackPVRData(unsigned char* data, unsigned int len)
CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool");
}
if (! configuration->isSupportsNPOT() &&
if (! configuration->supportsNPOT() &&
(header->width != ccNextPOT(header->width) || header->height != ccNextPOT(header->height)))
{
CCLOG("cocos2d: ERROR: Loding an NPOT texture (%dx%d) but is not supported on this device", header->width, header->height);
@ -243,7 +243,7 @@ bool CCTexturePVR::unpackPVRData(unsigned char* data, unsigned int len)
heightBlocks = height / 4;
break;
case kPVRTexturePixelTypeBGRA_8888:
if (CCConfiguration::sharedConfiguration()->isSupportsBGRA8888() == false)
if (CCConfiguration::sharedConfiguration()->supportsBGRA8888() == false)
{
CCLOG("cocos2d: TexturePVR. BGRA8888 not supported on this device");
return false;
@ -343,7 +343,7 @@ bool CCTexturePVR::createGLTexture()
// Generate textures with mipmaps
for (unsigned int i = 0; i < m_uNumberOfMipmaps; ++i)
{
if (compressed && ! CCConfiguration::sharedConfiguration()->isSupportsPVRTC())
if (compressed && ! CCConfiguration::sharedConfiguration()->supportsPVRTC())
{
CCLOG("cocos2d: WARNING: PVRTC images are not supported");
return false;

View File

@ -1 +1 @@
2e55dcc2dc68c6b6b24af67634d5107fc04c35bf
e7a48f141ba644f5dc6c8d2f786899216a211a9a

View File

@ -32,7 +32,7 @@ void AccelerometerTest::onEnter()
{
CCLayer::onEnter();
setIsAccelerometerEnabled(true);
setAccelerometerEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();

View File

@ -34,7 +34,7 @@ CCAffineTransform PhysicsSprite::nodeToParentTransform(void)
float x = pos.x * PTM_RATIO;
float y = pos.y * PTM_RATIO;
if ( getIgnoreAnchorPointForPosition() ) {
if ( isIgnoreAnchorPointForPosition() ) {
x += m_tAnchorPointInPoints.x;
y += m_tAnchorPointInPoints.y;
}
@ -60,8 +60,8 @@ CCAffineTransform PhysicsSprite::nodeToParentTransform(void)
Box2DTestLayer::Box2DTestLayer()
: m_pSpriteTexture(NULL)
{
setIsTouchEnabled( true );
setIsAccelerometerEnabled( true );
setTouchEnabled( true );
setAccelerometerEnabled( true );
CCSize s = CCDirector::sharedDirector()->getWinSize();
// init physics

View File

@ -50,7 +50,7 @@ bool MenuLayer::initWithEntryID(int entryId)
m_entryID = entryId;
setIsTouchEnabled( true );
setTouchEnabled( true );
Box2DView* view = Box2DView::viewWithEntryID( entryId );
addChild(view, 0, kTagBox2DNode);
@ -172,7 +172,7 @@ Box2DView* Box2DView::viewWithEntryID(int entryId)
bool Box2DView::initWithEntryID(int entryId)
{
// setIsAccelerometerEnabled( true );
setIsTouchEnabled( true );
setTouchEnabled( true );
schedule( schedule_selector(Box2DView::tick) );

View File

@ -29,7 +29,7 @@ bool Bug1159Layer::init()
CCLayerColor *sprite_a = CCLayerColor::create(ccc4(255, 0, 0, 255), 700, 700);
sprite_a->setAnchorPoint(ccp(0.5f, 0.5f));
sprite_a->setIgnoreAnchorPointForPosition(false);
sprite_a->ignoreAnchorPointForPosition(false);
sprite_a->setPosition(ccp(0.0f, s.height/2));
addChild(sprite_a);
@ -40,7 +40,7 @@ bool Bug1159Layer::init()
CCLayerColor *sprite_b = CCLayerColor::create(ccc4(0, 0, 255, 255), 400, 400);
sprite_b->setAnchorPoint(ccp(0.5f, 0.5f));
sprite_b->setIgnoreAnchorPointForPosition(false);
sprite_b->ignoreAnchorPointForPosition(false);
sprite_b->setPosition(ccp(s.width/2, s.height/2));
addChild(sprite_b);

View File

@ -19,7 +19,7 @@ bool Bug624Layer::init()
label->setPosition(ccp(size.width/2, size.height/2));
addChild(label);
setIsAccelerometerEnabled(true);
setAccelerometerEnabled(true);
schedule(schedule_selector(Bug624Layer::switchLayer), 5.0f);
return true;
@ -56,7 +56,7 @@ bool Bug624Layer2::init()
label->setPosition(ccp(size.width/2, size.height/2));
addChild(label);
setIsAccelerometerEnabled(true);
setAccelerometerEnabled(true);
schedule(schedule_selector(Bug624Layer2::switchLayer), 5.0f);
return true;

View File

@ -30,7 +30,7 @@ bool Bug914Layer::init()
// Apple recommends to re-assign "self" with the "super" return value
if (BugsTestBaseLayer::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
// ask director the the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *layer;
@ -40,7 +40,7 @@ bool Bug914Layer::init()
layer->setContentSize(CCSizeMake(i*100, i*100));
layer->setPosition(ccp(size.width/2, size.height/2));
layer->setAnchorPoint(ccp(0.5f, 0.5f));
layer->setIgnoreAnchorPointForPosition(false);
layer->ignoreAnchorPointForPosition(false);
addChild(layer, -1-i);
}

View File

@ -64,7 +64,7 @@ void BugsTestMainLayer::onEnter()
m_pItmeMenu->setPosition(s_tCurPos);
addChild(m_pItmeMenu);
setIsTouchEnabled(true);
setTouchEnabled(true);
}
void BugsTestMainLayer::menuCallback(CCObject* pSender)

View File

@ -46,7 +46,7 @@ CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
CCFloat x = m_pBody->p.x;
CCFloat y = m_pBody->p.y;
if ( getIgnoreAnchorPointForPosition() ) {
if ( isIgnoreAnchorPointForPosition() ) {
x += m_tAnchorPointInPoints.x;
y += m_tAnchorPointInPoints.y;
}
@ -71,8 +71,8 @@ CCAffineTransform ChipmunkPhysicsSprite::nodeToParentTransform(void)
ChipmunkAccelTouchTestLayer::ChipmunkAccelTouchTestLayer()
{
// enable events
setIsTouchEnabled(true);
setIsAccelerometerEnabled(true);
setTouchEnabled(true);
setAccelerometerEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();

View File

@ -17,7 +17,7 @@ void ClickAndMoveTestScene::runThisTest()
MainLayer::MainLayer()
{
setIsTouchEnabled(true);
setTouchEnabled(true);
CCSprite* sprite = CCSprite::create(s_pPathGrossini);

View File

@ -73,7 +73,7 @@ m_nSoundId(0)
m_pItmeMenu->setPosition(CCPointZero);
addChild(m_pItmeMenu);
setIsTouchEnabled(true);
setTouchEnabled(true);
// preload background music and effect
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(MUSIC_FILE) );

View File

@ -10,7 +10,7 @@ CurlTest::CurlTest()
addChild(label, 0);
label->setPosition( ccp(s.width/2, s.height-50) );
setIsTouchEnabled(true);
setTouchEnabled(true);
// create a label to display the tip string
m_pLabel = CCLabelTTF::create("Touch the screen to connect", "Arial", 22);

View File

@ -24,23 +24,23 @@ static std::string fontList[] =
"fonts/Scissor Cuts.ttf",
};
static int fontCount = sizeof(fontList) / sizeof(*fontList);
static int vAlignIdx = 0;
static CCVerticalTextAlignment verticalAlignment[] =
{
kCCVerticalTextAlignmentTop,
kCCVerticalTextAlignmentCenter,
kCCVerticalTextAlignmentBottom,
};
static int fontCount = sizeof(fontList) / sizeof(*fontList);
static int vAlignIdx = 0;
static CCVerticalTextAlignment verticalAlignment[] =
{
kCCVerticalTextAlignmentTop,
kCCVerticalTextAlignmentCenter,
kCCVerticalTextAlignmentBottom,
};
static int vAlignCount = sizeof(verticalAlignment) / sizeof(*verticalAlignment);
static const char* nextAction(void)
{
fontIdx++;
if(fontIdx >= fontCount) {
fontIdx = 0;
vAlignIdx = (vAlignIdx + 1) % vAlignCount;
if(fontIdx >= fontCount) {
fontIdx = 0;
vAlignIdx = (vAlignIdx + 1) % vAlignCount;
}
return fontList[fontIdx].c_str();
}
@ -48,11 +48,11 @@ static const char* nextAction(void)
static const char* backAction(void)
{
fontIdx--;
if( fontIdx < 0 ) {
fontIdx = fontCount - 1;
vAlignIdx--;
if(vAlignIdx < 0)
vAlignIdx = vAlignCount - 1;
if( fontIdx < 0 ) {
fontIdx = fontCount - 1;
vAlignIdx--;
if(vAlignIdx < 0)
vAlignIdx = vAlignCount - 1;
}
return fontList[fontIdx].c_str();
@ -83,9 +83,9 @@ FontTest::FontTest()
void FontTest::showFont(const char *pFont)
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCSize blockSize = CCSizeMake(s.width/3, 200);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCSize blockSize = CCSizeMake(s.width/3, 200);
CCFloat fontSize = 26;
removeChildByTag(kTagLabel1, true);
@ -93,42 +93,42 @@ void FontTest::showFont(const char *pFont)
removeChildByTag(kTagLabel3, true);
removeChildByTag(kTagLabel4, true);
CCLabelTTF *top = CCLabelTTF::create(pFont, pFont, 24);
CCLabelTTF *left = CCLabelTTF::create("alignment left", blockSize, kCCTextAlignmentLeft, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLabelTTF *center = CCLabelTTF::create("alignment center", blockSize, kCCTextAlignmentCenter, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLabelTTF *right = CCLabelTTF::create("alignment right", blockSize, kCCTextAlignmentRight, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLayerColor *leftColor = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *centerColor = CCLayerColor::create(ccc4(200, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *rightColor = CCLayerColor::create(ccc4(100, 100, 200, 255), blockSize.width, blockSize.height);
leftColor->setIgnoreAnchorPointForPosition(false);
centerColor->setIgnoreAnchorPointForPosition(false);
rightColor->setIgnoreAnchorPointForPosition(false);
top->setAnchorPoint(ccp(0.5, 1));
left->setAnchorPoint(ccp(0,0.5));
leftColor->setAnchorPoint(ccp(0,0.5));
center->setAnchorPoint(ccp(0,0.5));
centerColor->setAnchorPoint(ccp(0,0.5));
right->setAnchorPoint(ccp(0,0.5));
rightColor->setAnchorPoint(ccp(0,0.5));
top->setPosition(ccp(s.width/2,s.height-20));
left->setPosition(ccp(0,s.height/2));
leftColor->setPosition(left->getPosition());
center->setPosition(ccp(blockSize.width, s.height/2));
centerColor->setPosition(center->getPosition());
right->setPosition(ccp(blockSize.width*2, s.height/2));
rightColor->setPosition(right->getPosition());
this->addChild(leftColor, -1);
this->addChild(left, 0, kTagLabel1);
this->addChild(rightColor, -1);
this->addChild(right, 0, kTagLabel2);
this->addChild(centerColor, -1);
this->addChild(center, 0, kTagLabel3);
CCLabelTTF *top = CCLabelTTF::create(pFont, pFont, 24);
CCLabelTTF *left = CCLabelTTF::create("alignment left", blockSize, kCCTextAlignmentLeft, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLabelTTF *center = CCLabelTTF::create("alignment center", blockSize, kCCTextAlignmentCenter, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLabelTTF *right = CCLabelTTF::create("alignment right", blockSize, kCCTextAlignmentRight, verticalAlignment[vAlignIdx], pFont, fontSize);
CCLayerColor *leftColor = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *centerColor = CCLayerColor::create(ccc4(200, 100, 100, 255), blockSize.width, blockSize.height);
CCLayerColor *rightColor = CCLayerColor::create(ccc4(100, 100, 200, 255), blockSize.width, blockSize.height);
leftColor->ignoreAnchorPointForPosition(false);
centerColor->ignoreAnchorPointForPosition(false);
rightColor->ignoreAnchorPointForPosition(false);
top->setAnchorPoint(ccp(0.5, 1));
left->setAnchorPoint(ccp(0,0.5));
leftColor->setAnchorPoint(ccp(0,0.5));
center->setAnchorPoint(ccp(0,0.5));
centerColor->setAnchorPoint(ccp(0,0.5));
right->setAnchorPoint(ccp(0,0.5));
rightColor->setAnchorPoint(ccp(0,0.5));
top->setPosition(ccp(s.width/2,s.height-20));
left->setPosition(ccp(0,s.height/2));
leftColor->setPosition(left->getPosition());
center->setPosition(ccp(blockSize.width, s.height/2));
centerColor->setPosition(center->getPosition());
right->setPosition(ccp(blockSize.width*2, s.height/2));
rightColor->setPosition(right->getPosition());
this->addChild(leftColor, -1);
this->addChild(left, 0, kTagLabel1);
this->addChild(rightColor, -1);
this->addChild(right, 0, kTagLabel2);
this->addChild(centerColor, -1);
this->addChild(center, 0, kTagLabel3);
this->addChild(top, 0, kTagLabel4);
}

View File

@ -8,7 +8,7 @@ KeypadTest::KeypadTest()
addChild(label, 0);
label->setPosition( ccp(s.width/2, s.height-50) );
setIsKeypadEnabled(true);
setKeypadEnabled(true);
// create a label to display the tip string
m_pLabel = CCLabelTTF::create("Please press any key...", "Arial", 22);

View File

@ -369,21 +369,21 @@ std::string LabelAtlasColorTest::subtitle()
//------------------------------------------------------------------
LabelTTFAlignment::LabelTTFAlignment()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* ttf0 = CCLabelTTF::create("Alignment 0\nnew line", CCSizeMake(256, 32), kCCTextAlignmentLeft, "Helvetica", 12);
ttf0->setPosition(ccp(s.width/2,(s.height/6)*2));
ttf0->setAnchorPoint(ccp(0.5f,0.5f));
this->addChild(ttf0);
CCLabelTTF* ttf1 = CCLabelTTF::create("Alignment 1\nnew line", CCSizeMake(245, 32), kCCTextAlignmentCenter, "Helvetica", 12);
ttf1->setPosition(ccp(s.width/2,(s.height/6)*3));
ttf1->setAnchorPoint(ccp(0.5f,0.5f));
this->addChild(ttf1);
CCLabelTTF* ttf2 = CCLabelTTF::create("Alignment 2\nnew line", CCSizeMake(245, 32), kCCTextAlignmentRight, "Helvetica", 12);
ttf2->setPosition(ccp(s.width/2,(s.height/6)*4));
ttf2->setAnchorPoint(ccp(0.5f,0.5f));
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* ttf0 = CCLabelTTF::create("Alignment 0\nnew line", CCSizeMake(256, 32), kCCTextAlignmentLeft, "Helvetica", 12);
ttf0->setPosition(ccp(s.width/2,(s.height/6)*2));
ttf0->setAnchorPoint(ccp(0.5f,0.5f));
this->addChild(ttf0);
CCLabelTTF* ttf1 = CCLabelTTF::create("Alignment 1\nnew line", CCSizeMake(245, 32), kCCTextAlignmentCenter, "Helvetica", 12);
ttf1->setPosition(ccp(s.width/2,(s.height/6)*3));
ttf1->setAnchorPoint(ccp(0.5f,0.5f));
this->addChild(ttf1);
CCLabelTTF* ttf2 = CCLabelTTF::create("Alignment 2\nnew line", CCSizeMake(245, 32), kCCTextAlignmentRight, "Helvetica", 12);
ttf2->setPosition(ccp(s.width/2,(s.height/6)*4));
ttf2->setAnchorPoint(ccp(0.5f,0.5f));
this->addChild(ttf2);
}
@ -947,38 +947,38 @@ void AtlasTestScene::runThisTest()
//------------------------------------------------------------------
LabelTTFTest::LabelTTFTest()
{
CCSize blockSize = CCSizeMake(200, 160);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *colorLayer = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
colorLayer->setAnchorPoint(ccp(0,0));
colorLayer->setPosition(ccp((s.width - blockSize.width) / 2, (s.height - blockSize.height) / 2));
this->addChild(colorLayer);
CCMenuItemFont::setFontSize(30);
CCMenu *menu = CCMenu::create(
CCMenuItemFont::create("Left", this, menu_selector(LabelTTFTest::setAlignmentLeft)),
CCMenuItemFont::create("Center", this, menu_selector(LabelTTFTest::setAlignmentCenter)),
CCMenuItemFont::create("Right", this, menu_selector(LabelTTFTest::setAlignmentRight)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(50, s.height / 2 - 20));
this->addChild(menu);
menu = CCMenu::create(
CCMenuItemFont::create("Top", this, menu_selector(LabelTTFTest::setAlignmentTop)),
CCMenuItemFont::create("Middle", this, menu_selector(LabelTTFTest::setAlignmentMiddle)),
CCMenuItemFont::create("Bottom", this, menu_selector(LabelTTFTest::setAlignmentBottom)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(s.width - 50, s.height / 2 - 20));
this->addChild(menu);
m_plabel = NULL;
m_eHorizAlign = kCCTextAlignmentLeft;
m_eVertAlign = kCCVerticalTextAlignmentTop;
CCSize blockSize = CCSizeMake(200, 160);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *colorLayer = CCLayerColor::create(ccc4(100, 100, 100, 255), blockSize.width, blockSize.height);
colorLayer->setAnchorPoint(ccp(0,0));
colorLayer->setPosition(ccp((s.width - blockSize.width) / 2, (s.height - blockSize.height) / 2));
this->addChild(colorLayer);
CCMenuItemFont::setFontSize(30);
CCMenu *menu = CCMenu::create(
CCMenuItemFont::create("Left", this, menu_selector(LabelTTFTest::setAlignmentLeft)),
CCMenuItemFont::create("Center", this, menu_selector(LabelTTFTest::setAlignmentCenter)),
CCMenuItemFont::create("Right", this, menu_selector(LabelTTFTest::setAlignmentRight)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(50, s.height / 2 - 20));
this->addChild(menu);
menu = CCMenu::create(
CCMenuItemFont::create("Top", this, menu_selector(LabelTTFTest::setAlignmentTop)),
CCMenuItemFont::create("Middle", this, menu_selector(LabelTTFTest::setAlignmentMiddle)),
CCMenuItemFont::create("Bottom", this, menu_selector(LabelTTFTest::setAlignmentBottom)),
NULL);
menu->alignItemsVerticallyWithPadding(4);
menu->setPosition(ccp(s.width - 50, s.height / 2 - 20));
this->addChild(menu);
m_plabel = NULL;
m_eHorizAlign = kCCTextAlignmentLeft;
m_eVertAlign = kCCVerticalTextAlignmentTop;
this->updateAlignment();
}
@ -987,89 +987,89 @@ LabelTTFTest::~LabelTTFTest()
CC_SAFE_RELEASE(m_plabel);
}
void LabelTTFTest::updateAlignment()
{
CCSize blockSize = CCSizeMake(200, 160);
CCSize s = CCDirector::sharedDirector()->getWinSize();
void LabelTTFTest::updateAlignment()
{
CCSize blockSize = CCSizeMake(200, 160);
CCSize s = CCDirector::sharedDirector()->getWinSize();
if (m_plabel)
{
m_plabel->removeFromParentAndCleanup(true);
}
m_plabel = CCLabelTTF::create(this->getCurrentAlignment(), blockSize, m_eHorizAlign, m_eVertAlign, "Marker Felt", 32);
m_plabel->retain();
m_plabel->setAnchorPoint(ccp(0,0));
m_plabel->setPosition(ccp((s.width - blockSize.width) / 2, (s.height - blockSize.height)/2 ));
this->addChild(m_plabel);
}
void LabelTTFTest::setAlignmentLeft(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentLeft;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentCenter(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentCenter;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentRight(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentRight;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentTop(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentTop;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentMiddle(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentCenter;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentBottom(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentBottom;
this->updateAlignment();
}
const char* LabelTTFTest::getCurrentAlignment()
{
const char* vertical = NULL;
const char* horizontal = NULL;
switch (m_eVertAlign) {
case kCCVerticalTextAlignmentTop:
vertical = "Top";
break;
case kCCVerticalTextAlignmentCenter:
vertical = "Middle";
break;
case kCCVerticalTextAlignmentBottom:
vertical = "Bottom";
break;
}
switch (m_eHorizAlign) {
case kCCTextAlignmentLeft:
horizontal = "Left";
break;
case kCCTextAlignmentCenter:
horizontal = "Center";
break;
case kCCTextAlignmentRight:
horizontal = "Right";
break;
}
return CCString::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString();
}
m_plabel = CCLabelTTF::create(this->getCurrentAlignment(), blockSize, m_eHorizAlign, m_eVertAlign, "Marker Felt", 32);
m_plabel->retain();
m_plabel->setAnchorPoint(ccp(0,0));
m_plabel->setPosition(ccp((s.width - blockSize.width) / 2, (s.height - blockSize.height)/2 ));
this->addChild(m_plabel);
}
void LabelTTFTest::setAlignmentLeft(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentLeft;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentCenter(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentCenter;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentRight(CCObject* pSender)
{
m_eHorizAlign = kCCTextAlignmentRight;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentTop(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentTop;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentMiddle(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentCenter;
this->updateAlignment();
}
void LabelTTFTest::setAlignmentBottom(CCObject* pSender)
{
m_eVertAlign = kCCVerticalTextAlignmentBottom;
this->updateAlignment();
}
const char* LabelTTFTest::getCurrentAlignment()
{
const char* vertical = NULL;
const char* horizontal = NULL;
switch (m_eVertAlign) {
case kCCVerticalTextAlignmentTop:
vertical = "Top";
break;
case kCCVerticalTextAlignmentCenter:
vertical = "Middle";
break;
case kCCVerticalTextAlignmentBottom:
vertical = "Bottom";
break;
}
switch (m_eHorizAlign) {
case kCCTextAlignmentLeft:
horizontal = "Left";
break;
case kCCTextAlignmentCenter:
horizontal = "Center";
break;
case kCCTextAlignmentRight:
horizontal = "Right";
break;
}
return CCString::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString();
}
string LabelTTFTest::title()
@ -1155,7 +1155,7 @@ static float alignmentItemPadding = 50;
static float menuItemPaddingCenter = 50;
BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
{
this->setIsTouchEnabled(true);
this->setTouchEnabled(true);
// ask director the the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();
@ -1419,24 +1419,24 @@ std::string BMFontUnicode::title()
std::string BMFontUnicode::subtitle()
{
return "You should see 3 differnt labels: In Spanish, Chinese and Korean";
}
// BMFontInit
BMFontInit::BMFontInit()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelBMFont* bmFont = new CCLabelBMFont();
bmFont->init();
bmFont->autorelease();
//CCLabelBMFont* bmFont = [CCLabelBMFont create:@"Foo" fntFile:@"arial-unicode-26.fnt"];
bmFont->setFntFile("fonts/helvetica-32.fnt");
bmFont->setString("It is working!");
this->addChild(bmFont);
bmFont->setPosition(ccp(s.width/2,s.height/4*2));
}
}
// BMFontInit
BMFontInit::BMFontInit()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelBMFont* bmFont = new CCLabelBMFont();
bmFont->init();
bmFont->autorelease();
//CCLabelBMFont* bmFont = [CCLabelBMFont create:@"Foo" fntFile:@"arial-unicode-26.fnt"];
bmFont->setFntFile("fonts/helvetica-32.fnt");
bmFont->setString("It is working!");
this->addChild(bmFont);
bmFont->setPosition(ccp(s.width/2,s.height/4*2));
}
std::string BMFontInit::title()
{
return "CCLabelBMFont init";
@ -1445,24 +1445,24 @@ std::string BMFontInit::title()
std::string BMFontInit::subtitle()
{
return "Test for support of init method without parameters.";
}
// TTFFontInit
TTFFontInit::TTFFontInit()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* font = new CCLabelTTF();
font->init();
font->autorelease();
font->setFontName("Marker Felt");
font->setFontSize(48);
font->setString("It is working!");
this->addChild(font);
font->setPosition(ccp(s.width/2,s.height/4*2));
}
}
// TTFFontInit
TTFFontInit::TTFFontInit()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* font = new CCLabelTTF();
font->init();
font->autorelease();
font->setFontName("Marker Felt");
font->setFontSize(48);
font->setString("It is working!");
this->addChild(font);
font->setPosition(ccp(s.width/2,s.height/4*2));
}
std::string TTFFontInit::title()
{
return "CCLabelTTF init";
@ -1472,25 +1472,25 @@ std::string TTFFontInit::subtitle()
{
return "Test for support of init method without parameters.";
}
// Issue1343
Issue1343::Issue1343()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelBMFont* bmFont = new CCLabelBMFont();
bmFont->init();
bmFont->setFntFile("fonts/font-issue1343.fnt");
bmFont->setString("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz.,'");
this->addChild(bmFont);
bmFont->release();
bmFont->setScale(0.3f);
bmFont->setPosition(ccp(s.width/2,s.height/4*2));
}
// Issue1343
Issue1343::Issue1343()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelBMFont* bmFont = new CCLabelBMFont();
bmFont->init();
bmFont->setFntFile("fonts/font-issue1343.fnt");
bmFont->setString("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz.,'");
this->addChild(bmFont);
bmFont->release();
bmFont->setScale(0.3f);
bmFont->setPosition(ccp(s.width/2,s.height/4*2));
}
std::string Issue1343::title()
{
return "Issue 1343";

View File

@ -152,12 +152,12 @@ void LayerTest1::onEnter()
{
LayerTest::onEnter();
setIsTouchEnabled(true);
setTouchEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor* layer = CCLayerColor::create( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200);
layer->setIgnoreAnchorPointForPosition(false);
layer->ignoreAnchorPointForPosition(false);
layer->setPosition( CCPointMake(s.width/2, s.height/2) );
addChild(layer, 1, kTagLayer);
}
@ -222,12 +222,12 @@ void LayerTest2::onEnter()
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor* layer1 = CCLayerColor::create( ccc4(255, 255, 0, 80), 100, 300);
layer1->setPosition(CCPointMake(s.width/3, s.height/2));
layer1->setIgnoreAnchorPointForPosition(false);
layer1->ignoreAnchorPointForPosition(false);
addChild(layer1, 1);
CCLayerColor* layer2 = CCLayerColor::create( ccc4(0, 0, 255, 255), 100, 300);
layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2));
layer2->setIgnoreAnchorPointForPosition(false);
layer2->ignoreAnchorPointForPosition(false);
addChild(layer2, 1);
CCActionInterval* actionTint = CCTintBy::create(2, -255, -127, 0);
@ -308,7 +308,7 @@ LayerGradient::LayerGradient()
CCLayerGradient* layer1 = CCLayerGradient::create(ccc4(255,0,0,255), ccc4(0,255,0,255), ccp(0.9f, 0.9f));
addChild(layer1, 0, kTagLayer);
setIsTouchEnabled(true);
setTouchEnabled(true);
CCLabelTTF *label1 = CCLabelTTF::create("Compressed Interpolation: Enabled", "Marker Felt", 26);
CCLabelTTF *label2 = CCLabelTTF::create("Compressed Interpolation: Disabled", "Marker Felt", 26);
@ -354,154 +354,154 @@ string LayerGradient::subtitle()
return "Touch the screen and move your finger";
}
// LayerIgnoreAnchorPointPos
#define kLayerIgnoreAnchorPoint 1000
void LayerIgnoreAnchorPointPos::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 150, 150);
l->setAnchorPoint(ccp(0.5f, 0.5f));
l->setPosition(ccp( s.width/2, s.height/2));
CCMoveBy *move = CCMoveBy::create(2, ccp(100,2));
CCMoveBy * back = (CCMoveBy *)move->reverse();
CCSequence *seq = (CCSequence *)CCSequence::create(move, back, NULL);
l->runAction(CCRepeatForever::create(seq));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointPos::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointPos::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->getIgnoreAnchorPointForPosition();
pLayer->setIgnoreAnchorPointForPosition(! ignore);
}
// LayerIgnoreAnchorPointPos
#define kLayerIgnoreAnchorPoint 1000
void LayerIgnoreAnchorPointPos::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 150, 150);
l->setAnchorPoint(ccp(0.5f, 0.5f));
l->setPosition(ccp( s.width/2, s.height/2));
CCMoveBy *move = CCMoveBy::create(2, ccp(100,2));
CCMoveBy * back = (CCMoveBy *)move->reverse();
CCSequence *seq = (CCSequence *)CCSequence::create(move, back, NULL);
l->runAction(CCRepeatForever::create(seq));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointPos::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointPos::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointPos::title()
{
return "IgnoreAnchorPoint - Position";
}
std::string LayerIgnoreAnchorPointPos::subtitle()
{
return "Ignoring Anchor Point for position";
}
// LayerIgnoreAnchorPointRot
void LayerIgnoreAnchorPointRot::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);
l->setAnchorPoint(ccp(0.5f, 0.5f));
l->setPosition(ccp( s.width/2, s.height/2));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCRotateBy *rot = CCRotateBy::create(2, 360);
l->runAction(CCRepeatForever::create(rot));
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointRot::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointRot::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->getIgnoreAnchorPointForPosition();
pLayer->setIgnoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointPos::subtitle()
{
return "Ignoring Anchor Point for position";
}
// LayerIgnoreAnchorPointRot
void LayerIgnoreAnchorPointRot::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);
l->setAnchorPoint(ccp(0.5f, 0.5f));
l->setPosition(ccp( s.width/2, s.height/2));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCRotateBy *rot = CCRotateBy::create(2, 360);
l->runAction(CCRepeatForever::create(rot));
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointRot::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointRot::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointRot::title()
{
return "IgnoreAnchorPoint - Rotation";
}
std::string LayerIgnoreAnchorPointRot::subtitle()
{
return "Ignoring Anchor Point for rotations";
}
// LayerIgnoreAnchorPointScale
void LayerIgnoreAnchorPointScale::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);
l->setAnchorPoint(ccp(0.5f, 1.0f));
l->setPosition(ccp( s.width/2, s.height/2));
CCScaleBy *scale = CCScaleBy::create(2, 2);
CCScaleBy* back = (CCScaleBy*)scale->reverse();
CCSequence *seq = (CCSequence*)CCSequence::create(scale, back, NULL);
l->runAction(CCRepeatForever::create(seq));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointScale::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointScale::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->getIgnoreAnchorPointForPosition();
pLayer->setIgnoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointRot::subtitle()
{
return "Ignoring Anchor Point for rotations";
}
// LayerIgnoreAnchorPointScale
void LayerIgnoreAnchorPointScale::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *l = CCLayerColor::create(ccc4(255, 0, 0, 255), 200, 200);
l->setAnchorPoint(ccp(0.5f, 1.0f));
l->setPosition(ccp( s.width/2, s.height/2));
CCScaleBy *scale = CCScaleBy::create(2, 2);
CCScaleBy* back = (CCScaleBy*)scale->reverse();
CCSequence *seq = (CCSequence*)CCSequence::create(scale, back, NULL);
l->runAction(CCRepeatForever::create(seq));
this->addChild(l, 0, kLayerIgnoreAnchorPoint);
CCSprite *child = CCSprite::create("Images/grossini.png");
l->addChild(child);
CCSize lsize = l->getContentSize();
child->setPosition(ccp(lsize.width/2, lsize.height/2));
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", this, menu_selector(LayerIgnoreAnchorPointScale::onToggle));
CCMenu *menu = CCMenu::create(item, NULL);
this->addChild(menu);
menu->setPosition(ccp(s.width/2, s.height/2));
}
void LayerIgnoreAnchorPointScale::onToggle(CCObject* pObject)
{
CCNode* pLayer = this->getChildByTag(kLayerIgnoreAnchorPoint);
bool ignore = pLayer->isIgnoreAnchorPointForPosition();
pLayer->ignoreAnchorPointForPosition(! ignore);
}
std::string LayerIgnoreAnchorPointScale::title()
{
return "IgnoreAnchorPoint - Scale";
}
std::string LayerIgnoreAnchorPointScale::subtitle()
{
return "Ignoring Anchor Point for scale";
std::string LayerIgnoreAnchorPointScale::subtitle()
{
return "Ignoring Anchor Point for scale";
}
void LayerTestScene::runThisTest()

View File

@ -28,7 +28,7 @@ MenuLayerMainMenu::MenuLayerMainMenu()
CCMenuItemFont::setFontSize( 30 );
CCMenuItemFont::setFontName("Courier New");
setIsTouchEnabled(true);
setTouchEnabled(true);
// Font Item
CCSprite* spriteNormal = CCSprite::create(s_MenuItem, CCRectMake(0,23*2,115,23));
@ -170,7 +170,7 @@ void MenuLayerMainMenu::menuCallbackDisabled(CCObject* sender)
void MenuLayerMainMenu::menuCallbackEnable(CCObject* sender)
{
m_disabledItem->setIsEnabled(! m_disabledItem->getIsEnabled() );
m_disabledItem->setIsEnabled(! m_disabledItem->isEnabled() );
}
void MenuLayerMainMenu::menuCallback2(CCObject* sender)
@ -361,7 +361,7 @@ void MenuLayer3::menuCallback(CCObject* sender)
void MenuLayer3::menuCallback2(CCObject* sender)
{
//UXLOG("Label clicked. Toogling AtlasSprite");
m_disabledItem->setIsEnabled( ! m_disabledItem->getIsEnabled() );
m_disabledItem->setIsEnabled( ! m_disabledItem->isEnabled() );
m_disabledItem->stopAllActions();
}

View File

@ -79,7 +79,7 @@ void MotionStreakTest2::onEnter()
{
MotionStreakTest::onEnter();
setIsTouchEnabled(true);
setTouchEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();

View File

@ -56,7 +56,7 @@ bool MutiTouchTestLayer::init()
{
if (CCLayer::init())
{
setIsTouchEnabled(true);
setTouchEnabled(true);
return true;
}
return false;

View File

@ -758,7 +758,7 @@ std::string CameraCenterTest::subtitle()
//------------------------------------------------------------------
ConvertToNode::ConvertToNode()
{
setIsTouchEnabled(true);
setTouchEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCRotateBy* rotate = CCRotateBy::create(10, 360);

View File

@ -87,7 +87,7 @@ std::string Parallax1::title()
Parallax2::Parallax2()
{
setIsTouchEnabled( true );
setTouchEnabled( true );
// Top Layer, a simple image
CCSprite* cocosImage = CCSprite::create(s_Power);

View File

@ -206,7 +206,7 @@ void DemoBigFlower::onEnter()
m_emitter->setEmissionRate(m_emitter->getTotalParticles()/m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive(true);
m_emitter->setBlendAdditive(true);
setEmitterPosition();
}
@ -291,7 +291,7 @@ void DemoRotFlower::onEnter()
m_emitter->setEmissionRate(m_emitter->getTotalParticles()/m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive(false);
m_emitter->setBlendAdditive(false);
setEmitterPosition();
}
@ -549,7 +549,7 @@ void DemoModernArt::onEnter()
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
// additive
m_emitter->setIsBlendAdditive(false);
m_emitter->setBlendAdditive(false);
setEmitterPosition();
}
@ -707,7 +707,7 @@ void RadiusMode1::onEnter()
m_emitter->setEmissionRate(m_emitter->getTotalParticles() / m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive(false);
m_emitter->setBlendAdditive(false);
}
std::string RadiusMode1::title()
@ -791,7 +791,7 @@ void RadiusMode2::onEnter()
m_emitter->setEmissionRate(m_emitter->getTotalParticles() / m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive(false);
m_emitter->setBlendAdditive(false);
}
std::string RadiusMode2::title()
@ -875,7 +875,7 @@ void Issue704::onEnter()
m_emitter->setEmissionRate(m_emitter->getTotalParticles() / m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive(false);
m_emitter->setBlendAdditive(false);
CCRotateBy* rot = CCRotateBy::create(16, 360);
m_emitter->runAction(CCRepeatForever::create(rot));
@ -1072,7 +1072,7 @@ void ParticleDemo::onEnter(void)
m_emitter = NULL;
setIsTouchEnabled( true );
setTouchEnabled( true );
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
@ -1339,13 +1339,13 @@ void ParticleReorder::onEnter()
CCParticleSystemQuad *emitter1 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
emitter1->setStartColor(ccc4f(1,0,0,1));
emitter1->setIsBlendAdditive(false);
emitter1->setBlendAdditive(false);
CCParticleSystemQuad *emitter2 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
emitter2->setStartColor(ccc4f(0,1,0,1));
emitter2->setIsBlendAdditive(false);
emitter2->setBlendAdditive(false);
CCParticleSystemQuad *emitter3 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
emitter3->setStartColor(ccc4f(0,0,1,1));
emitter3->setIsBlendAdditive(false);
emitter3->setBlendAdditive(false);
CCSize s = CCDirector::sharedDirector()->getWinSize();
@ -1422,7 +1422,7 @@ bool RainbowEffect::initWithTotalParticles(unsigned int numberOfParticles)
if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
{
// additive
setIsBlendAdditive(false);
setBlendAdditive(false);
// duration
setDuration(kCCParticleDurationInfinity);
@ -1859,73 +1859,73 @@ std::string ReorderParticleSystems::subtitle()
{
return "changes every 2 seconds";
}
// PremultipliedAlphaTest
// PremultipliedAlphaTest
std::string PremultipliedAlphaTest::title()
{
return "premultiplied alpha";
}
std::string PremultipliedAlphaTest::subtitle()
{
return "no black halo, particles should fade out";
}
void PremultipliedAlphaTest::onEnter()
{
ParticleDemo::onEnter();
this->setColor(ccBLUE);
this->removeChild(m_background, true);
m_background = NULL;
m_emitter = CCParticleSystemQuad::create("Particles/BoilingFoam.plist");
m_emitter->retain();
// Particle Designer "normal" blend func causes black halo on premul textures (ignores multiplication)
//this->emitter.blendFunc = (ccBlendFunc){ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
// Cocos2d "normal" blend func for premul causes alpha to be ignored (oversaturates colors)
ccBlendFunc tBlendFunc = { GL_ONE, GL_ONE_MINUS_SRC_ALPHA };
m_emitter->setBlendFunc(tBlendFunc);
CCAssert(m_emitter->getOpacityModifyRGB(), "Particle texture does not have premultiplied alpha, test is useless");
// Toggle next line to see old behavior
// this->emitter.opacityModifyRGB = NO;
m_emitter->setStartColor(ccc4f(1, 1, 1, 1));
m_emitter->setEndColor(ccc4f(1, 1, 1, 0));
m_emitter->setStartColorVar(ccc4f(0, 0, 0, 0));
m_emitter->setEndColorVar(ccc4f(0, 0, 0, 0));
this->addChild(m_emitter, 10);
}
// PremultipliedAlphaTest2
void PremultipliedAlphaTest2::onEnter()
{
ParticleDemo::onEnter();
this->setColor(ccBLACK);
this->removeChild(m_background, true);
m_background = NULL;
m_emitter = CCParticleSystemQuad::create("Particles/TestPremultipliedAlpha.plist");
m_emitter->retain();
this->addChild(m_emitter ,10);
}
std::string PremultipliedAlphaTest::subtitle()
{
return "no black halo, particles should fade out";
}
void PremultipliedAlphaTest::onEnter()
{
ParticleDemo::onEnter();
this->setColor(ccBLUE);
this->removeChild(m_background, true);
m_background = NULL;
m_emitter = CCParticleSystemQuad::create("Particles/BoilingFoam.plist");
m_emitter->retain();
// Particle Designer "normal" blend func causes black halo on premul textures (ignores multiplication)
//this->emitter.blendFunc = (ccBlendFunc){ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
// Cocos2d "normal" blend func for premul causes alpha to be ignored (oversaturates colors)
ccBlendFunc tBlendFunc = { GL_ONE, GL_ONE_MINUS_SRC_ALPHA };
m_emitter->setBlendFunc(tBlendFunc);
CCAssert(m_emitter->getOpacityModifyRGB(), "Particle texture does not have premultiplied alpha, test is useless");
// Toggle next line to see old behavior
// this->emitter.opacityModifyRGB = NO;
m_emitter->setStartColor(ccc4f(1, 1, 1, 1));
m_emitter->setEndColor(ccc4f(1, 1, 1, 0));
m_emitter->setStartColorVar(ccc4f(0, 0, 0, 0));
m_emitter->setEndColorVar(ccc4f(0, 0, 0, 0));
this->addChild(m_emitter, 10);
}
// PremultipliedAlphaTest2
void PremultipliedAlphaTest2::onEnter()
{
ParticleDemo::onEnter();
this->setColor(ccBLACK);
this->removeChild(m_background, true);
m_background = NULL;
m_emitter = CCParticleSystemQuad::create("Particles/TestPremultipliedAlpha.plist");
m_emitter->retain();
this->addChild(m_emitter ,10);
}
std::string PremultipliedAlphaTest2::title()
{
return "premultiplied alpha 2";
}
std::string PremultipliedAlphaTest2::subtitle()
{
return "Arrows should be faded";
}
std::string PremultipliedAlphaTest2::subtitle()
{
return "Arrows should be faded";
}
void ParticleTestScene::runThisTest()
{

View File

@ -349,7 +349,7 @@ void ParticlePerformTest1::doTest()
particleSystem->setStartSizeVar(0);
// additive
particleSystem->setIsBlendAdditive(false);
particleSystem->setBlendAdditive(false);
}
////////////////////////////////////////////////////////
@ -419,7 +419,7 @@ void ParticlePerformTest2::doTest()
particleSystem->setStartSizeVar(0);
// additive
particleSystem->setIsBlendAdditive(false);
particleSystem->setBlendAdditive(false);
}
////////////////////////////////////////////////////////
@ -489,7 +489,7 @@ void ParticlePerformTest3::doTest()
particleSystem->setStartSizeVar(0);
// additive
particleSystem->setIsBlendAdditive(false);
particleSystem->setBlendAdditive(false);
}
////////////////////////////////////////////////////////
@ -559,7 +559,7 @@ void ParticlePerformTest4::doTest()
particleSystem->setStartSizeVar(0);
// additive
particleSystem->setIsBlendAdditive(false);
particleSystem->setBlendAdditive(false);
}

View File

@ -89,7 +89,7 @@ std::string TouchesMainScene::title()
void TouchesPerformTest1::onEnter()
{
TouchesMainScene::onEnter();
setIsTouchEnabled(true);
setTouchEnabled(true);
}
std::string TouchesPerformTest1::title()
@ -132,7 +132,7 @@ void TouchesPerformTest1::ccTouchCancelled(CCTouch* touch, CCEvent* event)
void TouchesPerformTest2::onEnter()
{
TouchesMainScene::onEnter();
setIsTouchEnabled(true);
setTouchEnabled(true);
}
std::string TouchesPerformTest2::title()

View File

@ -142,7 +142,7 @@ RenderTextureSave::RenderTextureSave()
m_pBrush->retain();
m_pBrush->setColor(ccRED);
m_pBrush->setOpacity(20);
this->setIsTouchEnabled(true);
this->setTouchEnabled(true);
// Save Image menu
CCMenuItemFont::setFontSize(16);
@ -329,7 +329,7 @@ void RenderTextureScene::runThisTest()
RenderTextureZbuffer::RenderTextureZbuffer()
{
this->setIsTouchEnabled(true);
this->setTouchEnabled(true);
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLabelTTF *label = CCLabelTTF::create("vertexZ = 50", "Marker Felt", 64);
label->setPosition(ccp(size.width / 2, size.height * 0.25f));

View File

@ -108,7 +108,7 @@ void RotateWorldMainLayer::onEnter()
white->setScale(0.5f);
white->setPosition(ccp(x/4,y/4));
white->setIgnoreAnchorPointForPosition(false);
white->ignoreAnchorPointForPosition(false);
white->setPosition(ccp(x/4*3,y/4*3));
addChild(blue, -1);

View File

@ -1 +1 @@
23a3acf70514939732acc9dab32c55a9bfddbc46
7c5d19797ef70af4121f85f8e97926b1f42a3705

View File

@ -152,7 +152,7 @@ void TextInputTest::onEnter()
KeyboardNotificationLayer::KeyboardNotificationLayer()
: m_pTrackNode(0)
{
setIsTouchEnabled(true);
setTouchEnabled(true);
}
void KeyboardNotificationLayer::registerWithTouchDispatcher()

View File

@ -1429,7 +1429,7 @@ CCLayer* restartTileMapAction()
TileDemo::TileDemo(void)
{
setIsTouchEnabled( true );
setTouchEnabled( true );
CCSize s = CCDirector::sharedDirector()->getWinSize();

View File

@ -159,7 +159,7 @@ TestController::TestController()
m_pItemMenu->setPosition(s_tCurPos);
addChild(m_pItemMenu);
setIsTouchEnabled(true);
setTouchEnabled(true);
addChild(pMenu, 1);