From d0f905992ae9f6e53005ae0961a420738c774231 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 15 Jun 2012 15:10:40 +0800 Subject: [PATCH] issue #1292:make some function names more readable --- cocos2dx/CCCamera.h | 2 +- cocos2dx/CCConfiguration.h | 10 +- cocos2dx/CCDirector.cpp | 2 +- cocos2dx/actions/CCAction.cpp | 2 +- cocos2dx/actions/CCActionInstant.cpp | 6 +- cocos2dx/actions/CCActionInstant.h | 20 +- cocos2dx/actions/CCActionInterval.cpp | 2 +- cocos2dx/base_nodes/CCAtlasNode.cpp | 8 +- cocos2dx/base_nodes/CCAtlasNode.h | 5 +- cocos2dx/base_nodes/CCNode.cpp | 11 +- cocos2dx/base_nodes/CCNode.h | 11 +- cocos2dx/effects/CCGrid.cpp | 4 +- cocos2dx/effects/CCGrid.h | 2 +- .../extensions/CCBReader/CCLayerLoader.cpp | 4 +- .../extensions/CCBReader/CCNodeLoader.cpp | 4 +- .../CCControlExtension/CCControl.cpp | 6 +- .../extensions/CCControlExtension/CCControl.h | 4 +- .../CCControlExtension/CCControlButton.cpp | 18 +- .../CCControlColourPicker.cpp | 2 +- .../CCControlExtension/CCControlHuePicker.cpp | 2 +- .../CCControlSaturationBrightnessPicker.cpp | 2 +- .../CCControlExtension/CCControlSlider.cpp | 6 +- .../CCControlExtension/CCControlSwitch.cpp | 4 +- .../CCControlExtension/CCMenuPassive.cpp | 2 +- .../CCControlExtension/CCMenuPassive.h | 4 +- .../CCControlExtension/CCScale9Sprite.cpp | 6 +- .../CCControlExtension/CCScale9Sprite.h | 4 +- cocos2dx/extensions/CCListView/CCListView.cpp | 6 +- .../extensions/CCListView/CCListViewCell.cpp | 2 +- cocos2dx/include/CCProtocols.h | 4 +- cocos2dx/label_nodes/CCLabelAtlas.h | 1 - cocos2dx/label_nodes/CCLabelBMFont.cpp | 79 ++-- cocos2dx/label_nodes/CCLabelBMFont.h | 4 +- .../CCLayer.cpp | 12 +- .../layers_scenes_transitions_nodes/CCLayer.h | 18 +- .../CCTransition.cpp | 26 +- .../CCTransitionPageTurn.cpp | 2 +- .../CCTransitionProgress.cpp | 28 +- .../CCTransitionProgress.h | 6 +- cocos2dx/menu_nodes/CCMenu.cpp | 9 +- cocos2dx/menu_nodes/CCMenu.h | 10 +- cocos2dx/menu_nodes/CCMenuItem.cpp | 44 +-- cocos2dx/menu_nodes/CCMenuItem.h | 21 +- cocos2dx/misc_nodes/CCMotionStreak.cpp | 6 +- cocos2dx/misc_nodes/CCMotionStreak.h | 4 +- cocos2dx/misc_nodes/CCProgressTimer.cpp | 4 +- cocos2dx/misc_nodes/CCProgressTimer.h | 9 +- cocos2dx/misc_nodes/CCRenderTexture.cpp | 2 +- .../particle_nodes/CCParticleBatchNode.cpp | 4 +- .../particle_nodes/CCParticleExamples.cpp | 22 +- cocos2dx/particle_nodes/CCParticleSystem.cpp | 10 +- cocos2dx/particle_nodes/CCParticleSystem.h | 8 +- cocos2dx/sprite_nodes/CCSprite.cpp | 16 +- cocos2dx/sprite_nodes/CCSprite.h | 6 +- cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 2 +- cocos2dx/textures/CCTexture2D.cpp | 9 +- cocos2dx/textures/CCTexture2D.h | 7 +- cocos2dx/textures/CCTexturePVR.cpp | 6 +- .../project.pbxproj.REMOVED.git-id | 2 +- .../AccelerometerTest/AccelerometerTest.cpp | 2 +- tests/tests/Box2DTest/Box2dTest.cpp | 6 +- tests/tests/Box2DTestBed/Box2dView.cpp | 4 +- tests/tests/BugsTest/Bug-1159.cpp | 4 +- tests/tests/BugsTest/Bug-624.cpp | 4 +- tests/tests/BugsTest/Bug-914.cpp | 4 +- tests/tests/BugsTest/BugsTest.cpp | 2 +- .../ChipmunkAccelTouchTest.cpp | 6 +- .../ClickAndMoveTest/ClickAndMoveTest.cpp | 2 +- .../CocosDenshionTest/CocosDenshionTest.cpp | 2 +- tests/tests/CurlTest/CurlTest.cpp | 2 +- tests/tests/FontTest/FontTest.cpp | 112 +++--- tests/tests/KeypadTest/KeypadTest.cpp | 2 +- tests/tests/LabelTest/LabelTest.cpp | 366 +++++++++--------- tests/tests/LayerTest/LayerTest.cpp | 276 ++++++------- tests/tests/MenuTest/MenuTest.cpp | 6 +- .../MotionStreakTest/MotionStreakTest.cpp | 2 +- tests/tests/MutiTouchTest/MutiTouchTest.cpp | 2 +- tests/tests/NodeTest/NodeTest.cpp | 2 +- tests/tests/ParallaxTest/ParallaxTest.cpp | 2 +- tests/tests/ParticleTest/ParticleTest.cpp | 136 +++---- .../PerformanceParticleTest.cpp | 8 +- .../PerformanceTouchesTest.cpp | 4 +- .../RenderTextureTest/RenderTextureTest.cpp | 4 +- .../tests/RotateWorldTest/RotateWorldTest.cpp | 2 +- .../SpriteTest/SpriteTest.cpp.REMOVED.git-id | 2 +- tests/tests/TextInputTest/TextInputTest.cpp | 2 +- tests/tests/TileMapTest/TileMapTest.cpp | 2 +- tests/tests/controller.cpp | 2 +- 88 files changed, 777 insertions(+), 735 deletions(-) diff --git a/cocos2dx/CCCamera.h b/cocos2dx/CCCamera.h index 76facc6091..a454320eed 100644 --- a/cocos2dx/CCCamera.h +++ b/cocos2dx/CCCamera.h @@ -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); diff --git a/cocos2dx/CCConfiguration.h b/cocos2dx/CCConfiguration.h index 5064765dbb..56199a52be 100644 --- a/cocos2dx/CCConfiguration.h +++ b/cocos2dx/CCConfiguration.h @@ -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; } diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 914af848b8..83a0e0f29a 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -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(); } diff --git a/cocos2dx/actions/CCAction.cpp b/cocos2dx/actions/CCAction.cpp index 05ae20b8f1..91398b6c1c 100644 --- a/cocos2dx/actions/CCAction.cpp +++ b/cocos2dx/actions/CCAction.cpp @@ -331,7 +331,7 @@ void CCFollow::step(float dt) bool CCFollow::isDone() { - return ( !m_pobFollowedNode->getIsRunning() ); + return ( !m_pobFollowedNode->isRunning() ); } void CCFollow::stop() diff --git a/cocos2dx/actions/CCActionInstant.cpp b/cocos2dx/actions/CCActionInstant.cpp index 0516d1466e..f2eaa36c70 100644 --- a/cocos2dx/actions/CCActionInstant.cpp +++ b/cocos2dx/actions/CCActionInstant.cpp @@ -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) diff --git a/cocos2dx/actions/CCActionInstant.h b/cocos2dx/actions/CCActionInstant.h index 14d0afaeba..bd9fa64204 100644 --- a/cocos2dx/actions/CCActionInstant.h +++ b/cocos2dx/actions/CCActionInstant.h @@ -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; } } diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index e250a4a996..f8b5de9005 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -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); } } diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index 455818a8de..deb87cc22b 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -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; } diff --git a/cocos2dx/base_nodes/CCAtlasNode.h b/cocos2dx/base_nodes/CCAtlasNode.h index 806ad8587d..ecd4231a38 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.h +++ b/cocos2dx/base_nodes/CCAtlasNode.h @@ -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); diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 656abf28fd..82f98cfeab 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -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) { diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 836ac2ee72..f5977ef97e 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -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) diff --git a/cocos2dx/effects/CCGrid.cpp b/cocos2dx/effects/CCGrid.cpp index f0901a8b82..c8326f765e 100644 --- a/cocos2dx/effects/CCGrid.cpp +++ b/cocos2dx/effects/CCGrid.cpp @@ -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(); diff --git a/cocos2dx/effects/CCGrid.h b/cocos2dx/effects/CCGrid.h index 422f9ea272..24946cc215 100644 --- a/cocos2dx/effects/CCGrid.h +++ b/cocos2dx/effects/CCGrid.h @@ -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); diff --git a/cocos2dx/extensions/CCBReader/CCLayerLoader.cpp b/cocos2dx/extensions/CCBReader/CCLayerLoader.cpp index f6942ef5af..025708bf01 100644 --- a/cocos2dx/extensions/CCBReader/CCLayerLoader.cpp +++ b/cocos2dx/extensions/CCBReader/CCLayerLoader.cpp @@ -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); diff --git a/cocos2dx/extensions/CCBReader/CCNodeLoader.cpp b/cocos2dx/extensions/CCBReader/CCNodeLoader.cpp index 98220ee25f..ffbd3082fa 100644 --- a/cocos2dx/extensions/CCBReader/CCNodeLoader.cpp +++ b/cocos2dx/extensions/CCBReader/CCNodeLoader.cpp @@ -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); } diff --git a/cocos2dx/extensions/CCControlExtension/CCControl.cpp b/cocos2dx/extensions/CCControlExtension/CCControl.cpp index 2b07a8d2aa..a11e5598a6 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControl.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControl.cpp @@ -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(child); if (pNode) { - pNode->setIsOpacityModifyRGB(opacityModifyRGB); + pNode->setOpacityModifyRGB(opacityModifyRGB); } } } -bool CCControl::getIsOpacityModifyRGB() +bool CCControl::isOpacityModifyRGB() { return m_bIsOpacityModifyRGB; } diff --git a/cocos2dx/extensions/CCControlExtension/CCControl.h b/cocos2dx/extensions/CCControlExtension/CCControl.h index 2c905aa6d5..620d29acd8 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControl.h +++ b/cocos2dx/extensions/CCControlExtension/CCControl.h @@ -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); diff --git a/cocos2dx/extensions/CCControlExtension/CCControlButton.cpp b/cocos2dx/extensions/CCControlExtension/CCControlButton.cpp index cf672b89ca..ac3005e8ff 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlButton.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlButton.cpp @@ -66,7 +66,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr CCRGBAProtocol* rgbaLabel = dynamic_cast(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); } diff --git a/cocos2dx/extensions/CCControlExtension/CCControlColourPicker.cpp b/cocos2dx/extensions/CCControlExtension/CCControlColourPicker.cpp index c0192c43dd..cd0717c447 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlColourPicker.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlColourPicker.cpp @@ -39,7 +39,7 @@ bool CCControlColourPicker::init() { if (CCControl::init()) { - setIsTouchEnabled(true); + setTouchEnabled(true); // Cache the sprites CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("extensions/CCControlColourPickerSpriteSheet.plist"); diff --git a/cocos2dx/extensions/CCControlExtension/CCControlHuePicker.cpp b/cocos2dx/extensions/CCControlExtension/CCControlHuePicker.cpp index a2ff8c2d22..e2ea4cf85d 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlHuePicker.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlHuePicker.cpp @@ -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)); diff --git a/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index 36b998fdcf..c37ee8373d 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -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)); diff --git a/cocos2dx/extensions/CCControlExtension/CCControlSlider.cpp b/cocos2dx/extensions/CCControlExtension/CCControlSlider.cpp index 6f4609f25f..f309d038e2 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlSlider.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlSlider.cpp @@ -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())); diff --git a/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp b/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp index 2e6b1bd030..2260ef67bc 100644 --- a/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCControlSwitch.cpp @@ -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; diff --git a/cocos2dx/extensions/CCControlExtension/CCMenuPassive.cpp b/cocos2dx/extensions/CCControlExtension/CCMenuPassive.cpp index 6661c3a228..13a3713527 100644 --- a/cocos2dx/extensions/CCControlExtension/CCMenuPassive.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCMenuPassive.cpp @@ -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); diff --git a/cocos2dx/extensions/CCControlExtension/CCMenuPassive.h b/cocos2dx/extensions/CCControlExtension/CCMenuPassive.h index 65d95709ac..e4beb6036f 100644 --- a/cocos2dx/extensions/CCControlExtension/CCMenuPassive.h +++ b/cocos2dx/extensions/CCControlExtension/CCMenuPassive.h @@ -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 diff --git a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp index 97fc0b06dc..13129f0654 100644 --- a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp +++ b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.cpp @@ -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(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; } diff --git a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.h b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.h index cf34fd83d5..0e1a5a8c93 100644 --- a/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.h +++ b/cocos2dx/extensions/CCControlExtension/CCScale9Sprite.h @@ -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); diff --git a/cocos2dx/extensions/CCListView/CCListView.cpp b/cocos2dx/extensions/CCListView/CCListView.cpp index 4f6afda652..8402fdc00a 100644 --- a/cocos2dx/extensions/CCListView/CCListView.cpp +++ b/cocos2dx/extensions/CCListView/CCListView.cpp @@ -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; } diff --git a/cocos2dx/extensions/CCListView/CCListViewCell.cpp b/cocos2dx/extensions/CCListView/CCListViewCell.cpp index a16864e230..43f15491a7 100644 --- a/cocos2dx/extensions/CCListView/CCListViewCell.cpp +++ b/cocos2dx/extensions/CCListView/CCListViewCell.cpp @@ -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); } diff --git a/cocos2dx/include/CCProtocols.h b/cocos2dx/include/CCProtocols.h index 7f6bfee32a..476697a61a 100755 --- a/cocos2dx/include/CCProtocols.h +++ b/cocos2dx/include/CCProtocols.h @@ -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; }; /** diff --git a/cocos2dx/label_nodes/CCLabelAtlas.h b/cocos2dx/label_nodes/CCLabelAtlas.h index 17ed42e037..93c7089fd4 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.h +++ b/cocos2dx/label_nodes/CCLabelAtlas.h @@ -85,7 +85,6 @@ public: virtual void draw(); #endif - virtual CCLabelProtocol* convertToLabelProtocol() { return (CCLabelProtocol*)this; } protected: // string to render std::string m_sString; diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index adc0c48eaf..5b46a69768 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -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(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 diff --git a/cocos2dx/label_nodes/CCLabelBMFont.h b/cocos2dx/label_nodes/CCLabelBMFont.h index b0e0f5eb1d..667271fd89 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.h +++ b/cocos2dx/label_nodes/CCLabelBMFont.h @@ -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; diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 07191e751c..3889bd96a6 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -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) { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index 645d01eaf7..6e596864ed 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -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) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp index 8c2d266717..c22ff9d45d 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp @@ -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 diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp index ac6ec99b1f..d39178f438 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp @@ -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 diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp index 8afb04835b..0b6f6c870c 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp @@ -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) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h index 060b11dbf8..df8c990dab 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h @@ -46,9 +46,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; }; diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index f40c026ee7..7bd15a97c5 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -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(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; diff --git a/cocos2dx/menu_nodes/CCMenu.h b/cocos2dx/menu_nodes/CCMenu.h index 5d0a4c2e4f..77b5833338 100644 --- a/cocos2dx/menu_nodes/CCMenu.h +++ b/cocos2dx/menu_nodes/CCMenu.h @@ -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); diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index 5765cf5bc7..54618528be 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -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); } } } diff --git a/cocos2dx/menu_nodes/CCMenuItem.h b/cocos2dx/menu_nodes/CCMenuItem.h index 726e012095..7a947b7f9f 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.h +++ b/cocos2dx/menu_nodes/CCMenuItem.h @@ -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 diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index 881989dd8c..35eaaafbfb 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -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; } diff --git a/cocos2dx/misc_nodes/CCMotionStreak.h b/cocos2dx/misc_nodes/CCMotionStreak.h index 4253408b8c..e66ed3ade9 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.h +++ b/cocos2dx/misc_nodes/CCMotionStreak.h @@ -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); diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index 63a92d60c1..d53063cc42 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -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; } diff --git a/cocos2dx/misc_nodes/CCProgressTimer.h b/cocos2dx/misc_nodes/CCProgressTimer.h index a0f1171e83..263dcfaa76 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.h +++ b/cocos2dx/misc_nodes/CCProgressTimer.h @@ -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 diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index bedc7b8362..3b167fabdd 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -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 { diff --git a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp index 5ee0f4eb54..dabedb6f10 100644 --- a/cocos2dx/particle_nodes/CCParticleBatchNode.cpp +++ b/cocos2dx/particle_nodes/CCParticleBatchNode.cpp @@ -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; diff --git a/cocos2dx/particle_nodes/CCParticleExamples.cpp b/cocos2dx/particle_nodes/CCParticleExamples.cpp index af96a3ed65..c9603fef91 100644 --- a/cocos2dx/particle_nodes/CCParticleExamples.cpp +++ b/cocos2dx/particle_nodes/CCParticleExamples.cpp @@ -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; diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index 69d68b6295..53c66cb460 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -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; } diff --git a/cocos2dx/particle_nodes/CCParticleSystem.h b/cocos2dx/particle_nodes/CCParticleSystem.h index 61ab337c77..cdbe7bd227 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.h +++ b/cocos2dx/particle_nodes/CCParticleSystem.h @@ -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 */ diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index 930726ce15..f1ffd31921 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -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); } } diff --git a/cocos2dx/sprite_nodes/CCSprite.h b/cocos2dx/sprite_nodes/CCSprite.h index ae7ded7499..a71e3b4944 100644 --- a/cocos2dx/sprite_nodes/CCSprite.h +++ b/cocos2dx/sprite_nodes/CCSprite.h @@ -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); diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 5140a5ee3a..77334eb979 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -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; diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index 13b14656cb..43bf1b4025 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -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) && diff --git a/cocos2dx/textures/CCTexture2D.h b/cocos2dx/textures/CCTexture2D.h index 6ae56e19b0..4885f4e56a 100644 --- a/cocos2dx/textures/CCTexture2D.h +++ b/cocos2dx/textures/CCTexture2D.h @@ -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); diff --git a/cocos2dx/textures/CCTexturePVR.cpp b/cocos2dx/textures/CCTexturePVR.cpp index 6349353a81..0028e2b34f 100755 --- a/cocos2dx/textures/CCTexturePVR.cpp +++ b/cocos2dx/textures/CCTexturePVR.cpp @@ -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; diff --git a/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id b/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id index 2896a3bec7..96bd907819 100644 --- a/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -2e55dcc2dc68c6b6b24af67634d5107fc04c35bf \ No newline at end of file +e7a48f141ba644f5dc6c8d2f786899216a211a9a \ No newline at end of file diff --git a/tests/tests/AccelerometerTest/AccelerometerTest.cpp b/tests/tests/AccelerometerTest/AccelerometerTest.cpp index 0b951f2485..18e148507e 100644 --- a/tests/tests/AccelerometerTest/AccelerometerTest.cpp +++ b/tests/tests/AccelerometerTest/AccelerometerTest.cpp @@ -32,7 +32,7 @@ void AccelerometerTest::onEnter() { CCLayer::onEnter(); - setIsAccelerometerEnabled(true); + setAccelerometerEnabled(true); CCSize s = CCDirector::sharedDirector()->getWinSize(); diff --git a/tests/tests/Box2DTest/Box2dTest.cpp b/tests/tests/Box2DTest/Box2dTest.cpp index b74632336c..e3df477b90 100644 --- a/tests/tests/Box2DTest/Box2dTest.cpp +++ b/tests/tests/Box2DTest/Box2dTest.cpp @@ -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 diff --git a/tests/tests/Box2DTestBed/Box2dView.cpp b/tests/tests/Box2DTestBed/Box2dView.cpp index 24e1f909be..42b95ee702 100644 --- a/tests/tests/Box2DTestBed/Box2dView.cpp +++ b/tests/tests/Box2DTestBed/Box2dView.cpp @@ -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) ); diff --git a/tests/tests/BugsTest/Bug-1159.cpp b/tests/tests/BugsTest/Bug-1159.cpp index 8cdc4bfb7f..e1a9a6cc17 100644 --- a/tests/tests/BugsTest/Bug-1159.cpp +++ b/tests/tests/BugsTest/Bug-1159.cpp @@ -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); diff --git a/tests/tests/BugsTest/Bug-624.cpp b/tests/tests/BugsTest/Bug-624.cpp index 0ba9dd5176..1f06faafca 100644 --- a/tests/tests/BugsTest/Bug-624.cpp +++ b/tests/tests/BugsTest/Bug-624.cpp @@ -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; diff --git a/tests/tests/BugsTest/Bug-914.cpp b/tests/tests/BugsTest/Bug-914.cpp index 117e059dd0..c06c4048b3 100644 --- a/tests/tests/BugsTest/Bug-914.cpp +++ b/tests/tests/BugsTest/Bug-914.cpp @@ -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); } diff --git a/tests/tests/BugsTest/BugsTest.cpp b/tests/tests/BugsTest/BugsTest.cpp index 0db9e76fda..3ce7c7c1e9 100644 --- a/tests/tests/BugsTest/BugsTest.cpp +++ b/tests/tests/BugsTest/BugsTest.cpp @@ -64,7 +64,7 @@ void BugsTestMainLayer::onEnter() m_pItmeMenu->setPosition(s_tCurPos); addChild(m_pItmeMenu); - setIsTouchEnabled(true); + setTouchEnabled(true); } void BugsTestMainLayer::menuCallback(CCObject* pSender) diff --git a/tests/tests/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp b/tests/tests/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp index 62c9951f0d..94a5563888 100644 --- a/tests/tests/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp +++ b/tests/tests/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp @@ -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(); diff --git a/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp b/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp index 78f5621fe0..ddedc25961 100644 --- a/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/tests/tests/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -17,7 +17,7 @@ void ClickAndMoveTestScene::runThisTest() MainLayer::MainLayer() { - setIsTouchEnabled(true); + setTouchEnabled(true); CCSprite* sprite = CCSprite::create(s_pPathGrossini); diff --git a/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp b/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp index 304765fcd4..f07806b843 100644 --- a/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/tests/CocosDenshionTest/CocosDenshionTest.cpp @@ -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) ); diff --git a/tests/tests/CurlTest/CurlTest.cpp b/tests/tests/CurlTest/CurlTest.cpp index 8121dae18f..e4d47265ec 100644 --- a/tests/tests/CurlTest/CurlTest.cpp +++ b/tests/tests/CurlTest/CurlTest.cpp @@ -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); diff --git a/tests/tests/FontTest/FontTest.cpp b/tests/tests/FontTest/FontTest.cpp index 05a87c2857..62b854677f 100644 --- a/tests/tests/FontTest/FontTest.cpp +++ b/tests/tests/FontTest/FontTest.cpp @@ -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); } diff --git a/tests/tests/KeypadTest/KeypadTest.cpp b/tests/tests/KeypadTest/KeypadTest.cpp index b59b3b66c1..9720f7c165 100644 --- a/tests/tests/KeypadTest/KeypadTest.cpp +++ b/tests/tests/KeypadTest/KeypadTest.cpp @@ -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); diff --git a/tests/tests/LabelTest/LabelTest.cpp b/tests/tests/LabelTest/LabelTest.cpp index 21e21dd7ef..77f3db398d 100644 --- a/tests/tests/LabelTest/LabelTest.cpp +++ b/tests/tests/LabelTest/LabelTest.cpp @@ -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"; diff --git a/tests/tests/LayerTest/LayerTest.cpp b/tests/tests/LayerTest/LayerTest.cpp index ea19200183..7057c5ca47 100644 --- a/tests/tests/LayerTest/LayerTest.cpp +++ b/tests/tests/LayerTest/LayerTest.cpp @@ -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() diff --git a/tests/tests/MenuTest/MenuTest.cpp b/tests/tests/MenuTest/MenuTest.cpp index fabae6e55e..6346a0bebf 100644 --- a/tests/tests/MenuTest/MenuTest.cpp +++ b/tests/tests/MenuTest/MenuTest.cpp @@ -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(); } diff --git a/tests/tests/MotionStreakTest/MotionStreakTest.cpp b/tests/tests/MotionStreakTest/MotionStreakTest.cpp index 5b00c582b5..d64b9a6ada 100644 --- a/tests/tests/MotionStreakTest/MotionStreakTest.cpp +++ b/tests/tests/MotionStreakTest/MotionStreakTest.cpp @@ -79,7 +79,7 @@ void MotionStreakTest2::onEnter() { MotionStreakTest::onEnter(); - setIsTouchEnabled(true); + setTouchEnabled(true); CCSize s = CCDirector::sharedDirector()->getWinSize(); diff --git a/tests/tests/MutiTouchTest/MutiTouchTest.cpp b/tests/tests/MutiTouchTest/MutiTouchTest.cpp index d30d696695..0e9d4c7eed 100644 --- a/tests/tests/MutiTouchTest/MutiTouchTest.cpp +++ b/tests/tests/MutiTouchTest/MutiTouchTest.cpp @@ -56,7 +56,7 @@ bool MutiTouchTestLayer::init() { if (CCLayer::init()) { - setIsTouchEnabled(true); + setTouchEnabled(true); return true; } return false; diff --git a/tests/tests/NodeTest/NodeTest.cpp b/tests/tests/NodeTest/NodeTest.cpp index 6aa50c812b..4a425606b3 100644 --- a/tests/tests/NodeTest/NodeTest.cpp +++ b/tests/tests/NodeTest/NodeTest.cpp @@ -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); diff --git a/tests/tests/ParallaxTest/ParallaxTest.cpp b/tests/tests/ParallaxTest/ParallaxTest.cpp index 13b7bcbd3a..36cdd028e3 100644 --- a/tests/tests/ParallaxTest/ParallaxTest.cpp +++ b/tests/tests/ParallaxTest/ParallaxTest.cpp @@ -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); diff --git a/tests/tests/ParticleTest/ParticleTest.cpp b/tests/tests/ParticleTest/ParticleTest.cpp index 29a5d1a9d6..e2389d8efa 100644 --- a/tests/tests/ParticleTest/ParticleTest.cpp +++ b/tests/tests/ParticleTest/ParticleTest.cpp @@ -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() { diff --git a/tests/tests/PerformanceTest/PerformanceParticleTest.cpp b/tests/tests/PerformanceTest/PerformanceParticleTest.cpp index b62ec0352e..758ea6a1f6 100644 --- a/tests/tests/PerformanceTest/PerformanceParticleTest.cpp +++ b/tests/tests/PerformanceTest/PerformanceParticleTest.cpp @@ -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); } diff --git a/tests/tests/PerformanceTest/PerformanceTouchesTest.cpp b/tests/tests/PerformanceTest/PerformanceTouchesTest.cpp index 8624102397..7219e54e09 100644 --- a/tests/tests/PerformanceTest/PerformanceTouchesTest.cpp +++ b/tests/tests/PerformanceTest/PerformanceTouchesTest.cpp @@ -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() diff --git a/tests/tests/RenderTextureTest/RenderTextureTest.cpp b/tests/tests/RenderTextureTest/RenderTextureTest.cpp index 86c78cbf84..b156546d3f 100644 --- a/tests/tests/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/tests/RenderTextureTest/RenderTextureTest.cpp @@ -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)); diff --git a/tests/tests/RotateWorldTest/RotateWorldTest.cpp b/tests/tests/RotateWorldTest/RotateWorldTest.cpp index da77ac5535..db97d16360 100644 --- a/tests/tests/RotateWorldTest/RotateWorldTest.cpp +++ b/tests/tests/RotateWorldTest/RotateWorldTest.cpp @@ -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); diff --git a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id index 9ee094da2e..5667da698f 100644 --- a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -23a3acf70514939732acc9dab32c55a9bfddbc46 \ No newline at end of file +7c5d19797ef70af4121f85f8e97926b1f42a3705 \ No newline at end of file diff --git a/tests/tests/TextInputTest/TextInputTest.cpp b/tests/tests/TextInputTest/TextInputTest.cpp index 388f764f58..741be22ec3 100644 --- a/tests/tests/TextInputTest/TextInputTest.cpp +++ b/tests/tests/TextInputTest/TextInputTest.cpp @@ -152,7 +152,7 @@ void TextInputTest::onEnter() KeyboardNotificationLayer::KeyboardNotificationLayer() : m_pTrackNode(0) { - setIsTouchEnabled(true); + setTouchEnabled(true); } void KeyboardNotificationLayer::registerWithTouchDispatcher() diff --git a/tests/tests/TileMapTest/TileMapTest.cpp b/tests/tests/TileMapTest/TileMapTest.cpp index aee87bfff1..334ccddbc6 100644 --- a/tests/tests/TileMapTest/TileMapTest.cpp +++ b/tests/tests/TileMapTest/TileMapTest.cpp @@ -1429,7 +1429,7 @@ CCLayer* restartTileMapAction() TileDemo::TileDemo(void) { - setIsTouchEnabled( true ); + setTouchEnabled( true ); CCSize s = CCDirector::sharedDirector()->getWinSize(); diff --git a/tests/tests/controller.cpp b/tests/tests/controller.cpp index b69ebac2b8..d5d3ebddeb 100644 --- a/tests/tests/controller.cpp +++ b/tests/tests/controller.cpp @@ -159,7 +159,7 @@ TestController::TestController() m_pItemMenu->setPosition(s_tCurPos); addChild(m_pItemMenu); - setIsTouchEnabled(true); + setTouchEnabled(true); addChild(pMenu, 1);