diff --git a/AUTHORS b/AUTHORS index 7f4a8df7fe..3d3f2cf4fa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -763,6 +763,7 @@ Developers: wefiends s3tc compressed textures with no mipmaps fail to be loaded. + Added createWithFullscreen overloaded method that sets video mode floatinghotpot Fixed a bug that no callback is invoked when websocket connection fails @@ -815,6 +816,13 @@ Developers: iSevenDays Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG + Fixed a potential memory leak in CCEditBoxImplIOS.mm + + ololomax + Fixed a potential crash in SceneReader::createNodeWithSceneFile + + gaoxiaosong + Fixed a warning in cpCollision.c Retired Core Developers: WenSheng Yang diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index 32bb75daf7..3607a60ba8 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -334022fee8065e04cd3ba41672900023d8b45e35 \ No newline at end of file +3dec43835640892d3595d2063489624cf216dd73 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 286c388803..2de7f38a62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/cocos/2d/renderer ${CMAKE_CURRENT_SOURCE_DIR}/cocos/2d/platform ${CMAKE_CURRENT_SOURCE_DIR}/cocos/base + ${CMAKE_CURRENT_SOURCE_DIR}/cocos/deprecated ${CMAKE_CURRENT_SOURCE_DIR}/cocos/physics ${CMAKE_CURRENT_SOURCE_DIR}/cocos/editor-support ${CMAKE_CURRENT_SOURCE_DIR}/cocos/math/kazmath diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 57b2e4ef22..0ff0627dee 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -cf0dc94fe4553bcd4fc0066a938f41610b2617ea \ No newline at end of file +b5b636c8bcca1ce239847cab19cfafedf83ca250 \ No newline at end of file diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_tests.xcodeproj/project.pbxproj.REMOVED.git-id index 221482b30c..4fb484e365 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -f884da8d42063a506285854e6309a5003507da3a \ No newline at end of file +20d3130f1f163df349f4503d05a21797039f1b40 \ No newline at end of file diff --git a/cocos/2d/Android.mk b/cocos/2d/Android.mk index 019cc3323f..e79ad3db42 100644 --- a/cocos/2d/Android.mk +++ b/cocos/2d/Android.mk @@ -30,7 +30,6 @@ CCClippingNode.cpp \ CCComponent.cpp \ CCComponentContainer.cpp \ CCConfiguration.cpp \ -CCDeprecated.cpp \ CCDirector.cpp \ CCDrawingPrimitives.cpp \ CCDrawNode.cpp \ @@ -71,7 +70,6 @@ CCMenu.cpp \ CCMenuItem.cpp \ CCMotionStreak.cpp \ CCNode.cpp \ -CCNotificationCenter.cpp \ CCParallaxNode.cpp \ CCParticleBatchNode.cpp \ CCParticleExamples.cpp \ @@ -128,20 +126,22 @@ renderer/CCRenderer.cpp \ renderer/CCRenderMaterial.cpp \ ../base/atitc.cpp \ ../base/CCAffineTransform.cpp \ -../base/CCArray.cpp \ ../base/CCAutoreleasePool.cpp \ ../base/CCConsole.cpp \ ../base/CCData.cpp \ ../base/CCDataVisitor.cpp \ -../base/CCDictionary.cpp \ ../base/CCGeometry.cpp \ ../base/CCNS.cpp \ ../base/CCRef.cpp \ -../base/CCSet.cpp \ -../base/CCString.cpp \ ../base/CCValue.cpp \ ../base/etc1.cpp \ ../base/s3tc.cpp \ +../deprecated/CCArray.cpp \ +../deprecated/CCSet.cpp \ +../deprecated/CCString.cpp \ +../deprecated/CCDictionary.cpp \ +../deprecated/CCDeprecated.cpp \ +../deprecated/CCNotificationCenter.cpp \ ../math/kazmath/kazmath/aabb.c \ ../math/kazmath/kazmath/mat3.c \ ../math/kazmath/kazmath/mat4.c \ @@ -174,22 +174,26 @@ renderer/CCRenderMaterial.cpp \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \ + $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/renderer \ $(LOCAL_PATH)/../math/kazmath \ platform/android \ $(LOCAL_PATH)/../physics \ $(LOCAL_PATH)/../base \ + $(LOCAL_PATH)/../deprecated \ $(LOCAL_PATH)/../../external/tinyxml2 \ $(LOCAL_PATH)/../../external/unzip \ $(LOCAL_PATH)/../../external/chipmunk/include/chipmunk \ $(LOCAL_PATH)/../../external/xxhash LOCAL_C_INCLUDES := $(LOCAL_PATH) \ + $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/renderer \ $(LOCAL_PATH)/../math/kazmath \ $(LOCAL_PATH)/platform/android \ $(LOCAL_PATH)/../physics \ $(LOCAL_PATH)/../base \ + $(LOCAL_PATH)/../deprecated \ $(LOCAL_PATH)/../../external/tinyxml2 \ $(LOCAL_PATH)/../../external/unzip \ $(LOCAL_PATH)/../../external/chipmunk/include/chipmunk \ diff --git a/cocos/2d/CCAction.cpp b/cocos/2d/CCAction.cpp index 0ae3428605..0d758cc7f7 100644 --- a/cocos/2d/CCAction.cpp +++ b/cocos/2d/CCAction.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. #include "CCActionInterval.h" #include "CCNode.h" #include "CCDirector.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN // diff --git a/cocos/2d/CCActionCatmullRom.cpp b/cocos/2d/CCActionCatmullRom.cpp index 1dcb626c73..d3cb607857 100644 --- a/cocos/2d/CCActionCatmullRom.cpp +++ b/cocos/2d/CCActionCatmullRom.cpp @@ -131,7 +131,7 @@ void PointArray::insertControlPoint(Point &controlPoint, ssize_t index) Point PointArray::getControlPointAtIndex(ssize_t index) { - index = MIN(_controlPoints->size()-1, MAX(index, 0)); + index = MIN(static_cast(_controlPoints->size())-1, MAX(index, 0)); return *(_controlPoints->at(index)); } diff --git a/cocos/2d/CCActionManager.cpp b/cocos/2d/CCActionManager.cpp index f1cf8f8c9c..642e0dc6db 100644 --- a/cocos/2d/CCActionManager.cpp +++ b/cocos/2d/CCActionManager.cpp @@ -32,7 +32,6 @@ THE SOFTWARE. #include "ccMacros.h" #include "ccCArray.h" #include "uthash.h" -#include "CCSet.h" NS_CC_BEGIN // diff --git a/cocos/2d/CCAnimation.h b/cocos/2d/CCAnimation.h index 5cf4bb1d90..5f4299dd5e 100644 --- a/cocos/2d/CCAnimation.h +++ b/cocos/2d/CCAnimation.h @@ -29,7 +29,6 @@ THE SOFTWARE. #include "CCPlatformConfig.h" #include "CCRef.h" -#include "CCArray.h" #include "CCValue.h" #include "CCGeometry.h" #include "CCSpriteFrame.h" diff --git a/cocos/2d/CCAnimationCache.cpp b/cocos/2d/CCAnimationCache.cpp index d16a92e8a5..fa5c1594f2 100644 --- a/cocos/2d/CCAnimationCache.cpp +++ b/cocos/2d/CCAnimationCache.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. #include "CCAnimation.h" #include "CCSpriteFrame.h" #include "CCSpriteFrameCache.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "platform/CCFileUtils.h" using namespace std; diff --git a/cocos/2d/CCConfiguration.cpp b/cocos/2d/CCConfiguration.cpp index 7adcea90db..7df26cec97 100644 --- a/cocos/2d/CCConfiguration.cpp +++ b/cocos/2d/CCConfiguration.cpp @@ -28,13 +28,8 @@ THE SOFTWARE. #include #include "ccMacros.h" #include "ccConfig.h" -#include "CCDictionary.h" -#include "CCInteger.h" -#include "CCBool.h" #include "platform/CCFileUtils.h" -using namespace std; - NS_CC_BEGIN extern const char* cocos2dVersion(); @@ -179,7 +174,7 @@ void Configuration::purgeConfiguration() } -bool Configuration::checkForGLExtension(const string &searchName) const +bool Configuration::checkForGLExtension(const std::string &searchName) const { return (_glExtensions && strstr(_glExtensions, searchName.c_str() ) ) ? true : false; } diff --git a/cocos/2d/CCConfiguration.h b/cocos/2d/CCConfiguration.h index 653031f43b..d3fd097cba 100644 --- a/cocos/2d/CCConfiguration.h +++ b/cocos/2d/CCConfiguration.h @@ -29,7 +29,6 @@ THE SOFTWARE. #include "CCRef.h" #include "CCGL.h" -#include "CCString.h" #include "CCValue.h" #include diff --git a/cocos/2d/CCDirector.cpp b/cocos/2d/CCDirector.cpp index 3ca022104e..e7ccbd72aa 100644 --- a/cocos/2d/CCDirector.cpp +++ b/cocos/2d/CCDirector.cpp @@ -35,7 +35,6 @@ THE SOFTWARE. #include "CCDrawingPrimitives.h" #include "CCNS.h" #include "CCScene.h" -#include "CCArray.h" #include "CCScheduler.h" #include "ccMacros.h" #include "CCTransition.h" diff --git a/cocos/2d/CCEventDispatcher.cpp b/cocos/2d/CCEventDispatcher.cpp index f2297e6e0d..e5fca539c4 100644 --- a/cocos/2d/CCEventDispatcher.cpp +++ b/cocos/2d/CCEventDispatcher.cpp @@ -1371,6 +1371,13 @@ void EventDispatcher::setDirtyForNode(Node* node) { _dirtyNodes.insert(node); } + + // Also set the dirty flag for node's children + const auto& children = node->getChildren(); + for (const auto& child : children) + { + setDirtyForNode(child); + } } void EventDispatcher::setDirty(const EventListener::ListenerID& listenerID, DirtyFlag flag) diff --git a/cocos/2d/CCFontFNT.cpp b/cocos/2d/CCFontFNT.cpp index cbc66fa32e..560a8d1fc0 100644 --- a/cocos/2d/CCFontFNT.cpp +++ b/cocos/2d/CCFontFNT.cpp @@ -29,7 +29,7 @@ #include "CCDirector.h" #include "CCFontAtlas.h" #include "CCMap.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCTextureCache.h" #include "ccUTF8.h" #include "platform/CCFileUtils.h" diff --git a/cocos/2d/CCGLProgram.cpp b/cocos/2d/CCGLProgram.cpp index 0dab9895cf..6b1c3d9663 100644 --- a/cocos/2d/CCGLProgram.cpp +++ b/cocos/2d/CCGLProgram.cpp @@ -32,7 +32,7 @@ THE SOFTWARE. #include "ccMacros.h" #include "platform/CCFileUtils.h" #include "uthash.h" -#include "CCString.h" +#include "deprecated/CCString.h" // extern #include "kazmath/GL/matrix.h" #include "kazmath/kazmath.h" diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 8a7325fc47..67de55513f 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -38,6 +38,7 @@ #include "CCEventType.h" #include "CCEventCustom.h" #include "platform/CCFileUtils.h" +#include "deprecated/CCString.h" NS_CC_BEGIN @@ -47,176 +48,142 @@ Label* Label::create() { auto ret = new Label(); - if (!ret) - return nullptr; - - ret->autorelease(); - - return ret; -} - -Label* Label::createWithFontDefinition(const std::string& text, const FontDefinition &textDefinition) -{ - auto ret = new Label(); - if (ret) { - ret->setFontDefinition(textDefinition); - ret->setString(text); ret->autorelease(); } return ret; } -Label* Label::create(const std::string& text, const std::string& fontName, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) +Label* Label::create(const std::string& text, const std::string& font, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) +{ + if (FileUtils::getInstance()->isFileExist(font)) + { + return createWithTTF(text,font,fontSize,dimensions,hAlignment,vAlignment); + } + else + { + return createWithSystemFont(text,font,fontSize,dimensions,hAlignment,vAlignment); + } +} + +Label* Label::createWithSystemFont(const std::string& text, const std::string& font, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) { auto ret = new Label(nullptr,hAlignment,vAlignment); if (ret) { - do - { - if (FileUtils::getInstance()->isFileExist(fontName)) - { - TTFConfig ttfConfig(fontName.c_str(),fontSize,GlyphCollection::DYNAMIC); - if (ret->setTTFConfig(ttfConfig)) - { - break; - } - } - - FontDefinition fontDef; - fontDef._fontName = fontName; - fontDef._fontSize = fontSize; - fontDef._dimensions = dimensions; - fontDef._alignment = hAlignment; - fontDef._vertAlignment = vAlignment; - ret->setFontDefinition(fontDef); - } while (0); - - ret->setDimensions(dimensions.width,dimensions.height); + ret->setSystemFontName(font); + ret->setSystemFontSize(fontSize); + ret->setDimensions(dimensions.width, dimensions.height); ret->setString(text); - ret->autorelease(); - } - return ret; + ret->autorelease(); + + return ret; + } + + delete ret; + return nullptr; +} + +Label* Label::createWithTTF(const std::string& text, const std::string& fontFile, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) +{ + auto ret = new Label(nullptr,hAlignment,vAlignment); + + if (ret && FileUtils::getInstance()->isFileExist(fontFile)) + { + TTFConfig ttfConfig(fontFile.c_str(),fontSize,GlyphCollection::DYNAMIC); + if (ret->setTTFConfig(ttfConfig)) + { + ret->setDimensions(dimensions.width,dimensions.height); + ret->setString(text); + + ret->autorelease(); + + return ret; + } + } + + delete ret; + return nullptr; } Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment /* = TextHAlignment::CENTER */, int maxLineWidth /* = 0 */) { auto ret = new Label(nullptr,alignment); - if (!ret) + if (ret && FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig)) { - return nullptr; + ret->setMaxLineWidth(maxLineWidth); + ret->setString(text); + ret->autorelease(); + + return ret; } - do - { - if( FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig)) - { - break; - } - - FontDefinition fontDef; - fontDef._fontName = ttfConfig.fontFilePath; - fontDef._fontSize = ttfConfig.fontSize; - fontDef._dimensions = Size::ZERO; - fontDef._alignment = alignment; - fontDef._vertAlignment = TextVAlignment::TOP; - ret->setFontDefinition(fontDef); - } while (0); - - ret->setMaxLineWidth(maxLineWidth); - ret->setString(text); - ret->autorelease(); - - return ret; -} - -Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int maxLineWidth /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */) -{ - TTFConfig ttfConfig(fontFilePath.c_str(),fontSize,glyphs,customGlyphs,useDistanceField); - return createWithTTF(ttfConfig,text,alignment,maxLineWidth); + delete ret; + return nullptr; } Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment /* = TextHAlignment::LEFT */, int maxLineWidth /* = 0 */, const Point& imageOffset /* = Point::ZERO */) { auto ret = new Label(nullptr,alignment); - if (!ret) - return nullptr; - - if (ret->setBMFontFilePath(bmfontFilePath,imageOffset)) + if (ret && ret->setBMFontFilePath(bmfontFilePath,imageOffset)) { ret->setMaxLineWidth(maxLineWidth); ret->setString(text); ret->autorelease(); + return ret; } - else - { - delete ret; - return nullptr; - } + + delete ret; + return nullptr; } Label* Label::createWithCharMap(const std::string& plistFile) { auto ret = new Label(); - if (!ret) - return nullptr; - - if (ret->setCharMap(plistFile)) + if (ret && ret->setCharMap(plistFile)) { ret->autorelease(); return ret; } - else - { - delete ret; - return nullptr; - } + + delete ret; + return nullptr; } Label* Label::createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap) { auto ret = new Label(); - if (!ret) - return nullptr; - - if (ret->setCharMap(texture,itemWidth,itemHeight,startCharMap)) + if (ret && ret->setCharMap(texture,itemWidth,itemHeight,startCharMap)) { ret->autorelease(); return ret; } - else - { - delete ret; - return nullptr; - } + + delete ret; + return nullptr; } Label* Label::createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) { auto ret = new Label(); - if (!ret) - return nullptr; - - if (ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap)) + if (ret && ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap)) { ret->autorelease(); return ret; } - else - { - delete ret; - return nullptr; - } + + delete ret; + return nullptr; } bool Label::setCharMap(const std::string& plistFile) @@ -296,11 +263,22 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te reset(); #if CC_ENABLE_CACHE_TEXTURE_DATA - auto toBackgroundListener = EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, CC_CALLBACK_1(Label::listenToBackground, this)); + auto toBackgroundListener = EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){ + if (_fontAtlas && _currentLabelType == LabelType::TTF) + { + _batchNodes.clear(); + _batchNodes.push_back(this); + Node::removeAllChildrenWithCleanup(true); + } + }); _eventDispatcher->addEventListenerWithSceneGraphPriority(toBackgroundListener, this); #endif - - auto purgeTextureListener = EventListenerCustom::create(FontAtlas::EVENT_PURGE_TEXTURES, CC_CALLBACK_1(Label::listenToFontAtlasPurge, this)); + auto purgeTextureListener = EventListenerCustom::create(FontAtlas::EVENT_PURGE_TEXTURES, [this](EventCustom* event){ + if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas) + { + alignText(); + } + }); _eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this); } @@ -323,14 +301,9 @@ void Label::reset() TTFConfig temp; _fontConfig = temp; - _fontDefinition._fontName = "Helvetica"; - _fontDefinition._fontSize = 12; - _fontDefinition._alignment = _hAlignment; - _fontDefinition._vertAlignment = _vAlignment; - _fontDirty = false; - _fontName = "Helvetica"; - _fontSize = 12; + _systemFont = "Helvetica"; + _systemFontSize = 12; _batchNodes.clear(); _batchNodes.push_back(this); @@ -476,9 +449,6 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) } } - _fontDefinition._shadow._shadowEnabled = false; - _fontDefinition._stroke._strokeEnabled = false; - return true; } @@ -498,27 +468,6 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& im return true; } -void Label::setFontDefinition(const FontDefinition& textDefinition) -{ - reset(); - _fontDefinition = textDefinition; - _fontName = textDefinition._fontName; - _fontSize = textDefinition._fontSize; - - _shadowEnabled = textDefinition._shadow._shadowEnabled; - if (_shadowEnabled) - { - enableShadow(Color4B::BLACK,_fontDefinition._shadow._shadowOffset,_fontDefinition._shadow._shadowBlur); - } - - _textColor = Color4B(_fontDefinition._fontFillColor); - _textColorF.r = _textColor.r / 255.0f; - _textColorF.g = _textColor.g / 255.0f; - _textColorF.b = _textColor.b / 255.0f; - _textColorF.a = _textColor.a / 255.0f; - _contentDirty = true; -} - void Label::setString(const std::string& text) { _originalUTF8String = text; @@ -529,9 +478,6 @@ void Label::setAlignment(TextHAlignment hAlignment,TextVAlignment vAlignment) { if (hAlignment != _hAlignment || vAlignment != _vAlignment) { - _fontDefinition._alignment = hAlignment; - _fontDefinition._vertAlignment = vAlignment; - _hAlignment = hAlignment; _vAlignment = vAlignment; @@ -552,9 +498,6 @@ void Label::setDimensions(unsigned int width,unsigned int height) { if (height != _labelHeight || width != _labelWidth) { - _fontDefinition._dimensions.width = width; - _fontDefinition._dimensions.height = height; - _labelWidth = width; _labelHeight = height; _labelDimensions.width = width; @@ -802,27 +745,6 @@ void Label::sortAllChildren() // Label ignore sort children } -void Label::setLabelEffect(LabelEffect effect,const Color3B& effectColor) -{ - switch (effect) - { - case cocos2d::LabelEffect::NORMAL: - disableEffect(); - break; - case cocos2d::LabelEffect::OUTLINE: - enableOutline(Color4B(effectColor)); - break; - case cocos2d::LabelEffect::SHADOW: - enableShadow(Color4B(effectColor)); - break; - case cocos2d::LabelEffect::GLOW: - enableGlow(Color4B(effectColor)); - break; - default: - break; - } -} - void Label::enableGlow(const Color4B& glowColor) { if(! _useDistanceField) @@ -846,6 +768,7 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */ if (outlineSize > 0) { + _outlineSize = outlineSize; if (_currentLabelType == LabelType::TTF) { if (_fontConfig.outlineSize != outlineSize) @@ -856,9 +779,6 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */ updateShaderProgram(); } } - _fontDefinition._stroke._strokeEnabled = true; - _fontDefinition._stroke._strokeSize = outlineSize; - _fontDefinition._stroke._strokeColor = Color3B(outlineColor.r,outlineColor.g,outlineColor.b); _currLabelEffect = LabelEffect::OUTLINE; _contentDirty = true; @@ -868,7 +788,6 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */ void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const Size &offset /* = Size(2 ,-2)*/, int blurRadius /* = 0 */) { _shadowEnabled = true; - _fontDefinition._shadow._shadowEnabled = false; _shadowDirty = true; _shadowColor.r = shadowColor.r; @@ -991,15 +910,8 @@ void Label::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpda void Label::createSpriteWithFontDefinition() { _currentLabelType = LabelType::STRING_TEXTURE; + auto texture = new Texture2D; -#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) - if (_fontDefinition._shadow._shadowEnabled || _fontDefinition._stroke._strokeEnabled) - { - CCLOGERROR("Currently only supported on iOS and Android!"); - } - _fontDefinition._shadow._shadowEnabled = false; - _fontDefinition._stroke._strokeEnabled = false; -#endif texture->initWithString(_originalUTF8String.c_str(),_fontDefinition); _textSprite = Sprite::createWithTexture(texture); @@ -1016,11 +928,29 @@ void Label::createSpriteWithFontDefinition() _textSprite->updateDisplayedColor(_displayedColor); } +void Label::setFontDefinition(const FontDefinition& textDefinition) +{ + _fontDefinition = textDefinition; +#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) + if (_fontDefinition._stroke._strokeEnabled) + { + CCLOGERROR("Currently only supported on iOS and Android!"); + } + _fontDefinition._stroke._strokeEnabled = false; +#endif + if (_fontDefinition._shadow._shadowEnabled) + { + _fontDefinition._shadow._shadowEnabled = false; + enableShadow(Color4B(0,0,0,255 * _fontDefinition._shadow._shadowOpacity),_fontDefinition._shadow._shadowOffset,_fontDefinition._shadow._shadowBlur); + } +} + void Label::updateContent() { auto utf16String = cc_utf8_to_utf16(_originalUTF8String.c_str()); setCurrentString(utf16String); setOriginalString(utf16String); + if (_textSprite) { Node::removeChild(_textSprite,true); @@ -1031,16 +961,49 @@ void Label::updateContent() _shadowNode = nullptr; } } + if (_fontAtlas) { alignText(); } else { + _fontDefinition._fontName = _systemFont; + _fontDefinition._fontSize = _systemFontSize; + + _fontDefinition._alignment = _hAlignment; + _fontDefinition._vertAlignment = _vAlignment; + + _fontDefinition._dimensions.width = _labelWidth; + _fontDefinition._dimensions.height = _labelHeight; + _fontDefinition._fontFillColor.r = _textColor.r; _fontDefinition._fontFillColor.g = _textColor.g; _fontDefinition._fontFillColor.b = _textColor.b; + _fontDefinition._shadow._shadowEnabled = false; + + if (_currLabelEffect == LabelEffect::OUTLINE && _outlineSize > 0) + { + _fontDefinition._stroke._strokeEnabled = true; + _fontDefinition._stroke._strokeSize = _outlineSize; + _fontDefinition._stroke._strokeColor.r = _effectColor.r; + _fontDefinition._stroke._strokeColor.g = _effectColor.g; + _fontDefinition._stroke._strokeColor.b = _effectColor.b; + } + else + { + _fontDefinition._stroke._strokeEnabled = false; + } + +#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) + if (_fontDefinition._stroke._strokeEnabled) + { + CCLOGERROR("Currently only supported on iOS and Android!"); + } + _fontDefinition._stroke._strokeEnabled = false; +#endif + createSpriteWithFontDefinition(); } _contentDirty = false; @@ -1048,14 +1011,15 @@ void Label::updateContent() void Label::updateFont() { - if (FileUtils::getInstance()->isFileExist(_fontName)) + if (_fontAtlas) { - _fontConfig.fontFilePath = _fontName; - _fontConfig.fontSize = _fontSize; - setTTFConfig(_fontConfig); + _batchNodes.clear(); + _batchNodes.push_back(this); + + FontAtlasCache::releaseFontAtlas(_fontAtlas); + _fontAtlas = nullptr; } - _fontDefinition._fontName = _fontName; - _fontDefinition._fontSize = _fontSize; + _contentDirty = true; _fontDirty = false; } @@ -1064,18 +1028,7 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated) { if (_fontDefinition._fontFillColor != _textColor) { - Node::removeChild(_textSprite,true); - _textSprite = nullptr; - if (_shadowNode) - { - Node::removeChild(_shadowNode,true); - _shadowNode = nullptr; - } - - _fontDefinition._fontFillColor.r = _textColor.r; - _fontDefinition._fontFillColor.g = _textColor.g; - _fontDefinition._fontFillColor.b = _textColor.b; - createSpriteWithFontDefinition(); + updateContent(); } if (_shadowEnabled && _shadowNode == nullptr) @@ -1084,8 +1037,9 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated) if (_shadowNode) { if (_blendFuncDirty) + { _shadowNode->setBlendFunc(_blendFunc); - + } _shadowNode->setAnchorPoint(Point::ANCHOR_BOTTOM_LEFT); _shadowNode->setColor(_shadowColor); _shadowNode->setOpacity(_shadowOpacity * _displayedOpacity); @@ -1158,41 +1112,33 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent setOrderOfArrival(0); } -void Label::setFontName(const std::string& fontName) +void Label::setSystemFontName(const std::string& systemFont) { - if (fontName != _fontName) + if (systemFont != _systemFont) { - _fontName = fontName; + _systemFont = systemFont; _fontDirty = true; } } -const std::string& Label::getFontName() const +void Label::setSystemFontSize(float fontSize) { - return _fontName; -} - -void Label::setFontSize(float fontSize) -{ - if (_fontSize != fontSize) + if (_systemFontSize != fontSize) { - _fontSize = fontSize; + _systemFontSize = fontSize; _fontDirty = true; } } -float Label::getFontSize() const -{ - return _fontSize; -} - ///// PROTOCOL STUFF Sprite * Label::getLetter(int letterIndex) { if (_fontDirty) { updateFont(); + return nullptr; } + if (_contentDirty) { updateContent(); @@ -1381,26 +1327,6 @@ Rect Label::getBoundingBox() const return Node::getBoundingBox(); } -void Label::listenToBackground(EventCustom *event) -{ -#if CC_ENABLE_CACHE_TEXTURE_DATA - if (_fontAtlas && _currentLabelType == LabelType::TTF) - { - _batchNodes.clear(); - _batchNodes.push_back(this); - Node::removeAllChildrenWithCleanup(true); - } -#endif -} - -void Label::listenToFontAtlasPurge(EventCustom *event) -{ - if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas) - { - alignText(); - } -} - void Label::setBlendFunc(const BlendFunc &blendFunc) { _blendFunc = blendFunc; diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 1dcab8ea88..2905addf52 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -82,18 +82,26 @@ public: static Label* create(); - /** creates a Label from a font name, horizontal alignment, dimension in points, and font size in points. - * @warning It will generate texture by the platform-dependent code if [fontName] not a font file. + /** Creates a label with an initial string,font[font name or font file],font size, dimension in points, horizontal alignment and vertical alignment. + * @warning It will generate texture by the platform-dependent code */ - static Label * create(const std::string& text, const std::string& fontName, float fontSize, + static Label* createWithSystemFont(const std::string& text, const std::string& font, float fontSize, const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, TextVAlignment vAlignment = TextVAlignment::TOP); - /** create a label with TTF configuration - * It will generate texture of character by freetype. + /** Creates a label with an initial string,font file,font size, dimension in points, horizontal alignment and vertical alignment. + * @warning Not support font name. + */ + static Label * createWithTTF(const std::string& text, const std::string& fontFile, float fontSize, + const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, + TextVAlignment vAlignment = TextVAlignment::TOP); + + /** Create a label with TTF configuration + * @warning Not support font name. */ static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment = TextHAlignment::LEFT, int maxLineWidth = 0); + /* Creates a label with an FNT file,an initial string,horizontal alignment,max line width and the offset of image*/ static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text, const TextHAlignment& alignment = TextHAlignment::LEFT, int maxLineWidth = 0, const Point& imageOffset = Point::ZERO); @@ -102,14 +110,9 @@ public: static Label * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); static Label * createWithCharMap(const std::string& plistFile); - /** create a lable with string and a font definition - * @warning It will generate texture by the platform-dependent code and create Sprite for show text. - * To obtain better performance use createWithTTF/createWithBMFont/createWithCharMap - */ - static Label * createWithFontDefinition(const std::string& text, const FontDefinition &textDefinition); - /** set TTF configuration for Label */ virtual bool setTTFConfig(const TTFConfig& ttfConfig); + virtual const TTFConfig& getTTFConfig() const { return _fontConfig;} virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset = Point::ZERO); const std::string& getBMFontFilePath() const { return _bmFontPath;} @@ -118,13 +121,13 @@ public: virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); virtual bool setCharMap(const std::string& plistFile); - /** set the text definition used by this label - * It will create Sprite for show text if you haven't set up using TTF/BMFont/CharMap. - */ - virtual void setFontDefinition(const FontDefinition& textDefinition); + /* Sets the system font[font name or font file] of label*/ + virtual void setSystemFontName(const std::string& systemFont); + virtual const std::string& getSystemFontName() const { return _systemFont;} - /** get the text definition used by this label */ - const FontDefinition& getFontDefinition() const { return _fontDefinition; } + /* Sets the system font size of label.*/ + virtual void setSystemFontSize(float fontSize); + virtual float getSystemFontSize() const { return _systemFontSize;} /** changes the string to render * @warning It is as expensive as changing the string if you haven't set up TTF/BMFont/CharMap for the label. @@ -190,12 +193,6 @@ public: /** update content immediately.*/ virtual void updateContent(); - virtual void setFontName(const std::string& fontName); - virtual const std::string& getFontName() const; - - virtual void setFontSize(float fontSize); - virtual float getFontSize() const; - /** Sets the text color * */ @@ -243,22 +240,13 @@ public: virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; - /** Listen "come to background" message - It only has effect on Android. - */ - void listenToBackground(EventCustom *event); + CC_DEPRECATED_ATTRIBUTE static Label* create(const std::string& text, const std::string& font, float fontSize, + const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, + TextVAlignment vAlignment = TextVAlignment::TOP); - /** Listen "FontAtlas purge textures" message - */ - void listenToFontAtlasPurge(EventCustom *event); + CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition); + CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; } - CC_DEPRECATED_ATTRIBUTE static Label* createWithTTF(const std::string& label, const std::string& fontFilePath, - int fontSize, int maxLineWidth = 0, TextHAlignment alignment = TextHAlignment::LEFT, - GlyphCollection glyphs = GlyphCollection::DYNAMIC, const char *customGlyphs = 0, bool useDistanceField = false); - - CC_DEPRECATED_ATTRIBUTE int getStringLenght() const { return getStringLength(); } - - CC_DEPRECATED_ATTRIBUTE void setLabelEffect(LabelEffect effect,const Color3B& effectColor); protected: void onDraw(const kmMat4& transform, bool transformUpdated); @@ -322,9 +310,10 @@ protected: bool _isOpacityModifyRGB; bool _contentDirty; + bool _fontDirty; - std::string _fontName; - float _fontSize; + std::string _systemFont; + float _systemFontSize; LabelType _currentLabelType; std::vector _batchNodes; @@ -380,6 +369,8 @@ protected: float _shadowOpacity; Sprite* _shadowNode; + int _outlineSize; + Color4B _textColor; Color4F _textColorF; diff --git a/cocos/2d/CCLabelAtlas.cpp b/cocos/2d/CCLabelAtlas.cpp index 1917ea4537..5af71f5d0b 100644 --- a/cocos/2d/CCLabelAtlas.cpp +++ b/cocos/2d/CCLabelAtlas.cpp @@ -34,11 +34,10 @@ THE SOFTWARE. #include "ccGLStateCache.h" #include "CCDirector.h" #include "TransformUtils.h" -#include "CCInteger.h" #include "platform/CCFileUtils.h" // external #include "kazmath/GL/matrix.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN diff --git a/cocos/2d/CCLabelBMFont.cpp b/cocos/2d/CCLabelBMFont.cpp index 6f6b5b950d..1ce6e4708d 100644 --- a/cocos/2d/CCLabelBMFont.cpp +++ b/cocos/2d/CCLabelBMFont.cpp @@ -33,7 +33,7 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only) ****************************************************************************/ #include "CCLabelBMFont.h" #include "CCDrawingPrimitives.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCSprite.h" using namespace std; diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 581d52274b..88603a215a 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -25,7 +25,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCLabelTTF.h" #include "CCLabel.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN @@ -97,10 +97,10 @@ bool LabelTTF::initWithString(const std::string& string, const std::string& font TextVAlignment vAlignment) { _renderLabel->setString(string); - _renderLabel->setFontSize(fontSize); + _renderLabel->setSystemFontSize(fontSize); _renderLabel->setDimensions(dimensions.width,dimensions.height); _renderLabel->setAlignment(hAlignment,vAlignment); - _renderLabel->setFontName(fontName); + _renderLabel->setSystemFontName(fontName); _contentDirty = true; return true; @@ -128,7 +128,7 @@ const std::string& LabelTTF::getString() const std::string LabelTTF::getDescription() const { - return StringUtils::format("", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str()); + return StringUtils::format("", _renderLabel->getSystemFontName().c_str(), _renderLabel->getSystemFontSize(), _renderLabel->getString().c_str()); } TextHAlignment LabelTTF::getHorizontalAlignment() const @@ -166,23 +166,23 @@ void LabelTTF::setDimensions(const Size &dim) float LabelTTF::getFontSize() const { - return _renderLabel->getFontSize(); + return _renderLabel->getSystemFontSize(); } void LabelTTF::setFontSize(float fontSize) { - _renderLabel->setFontSize(fontSize); + _renderLabel->setSystemFontSize(fontSize); _contentDirty = true; } const std::string& LabelTTF::getFontName() const { - return _renderLabel->getFontName(); + return _renderLabel->getSystemFontName(); } void LabelTTF::setFontName(const std::string& fontName) { - _renderLabel->setFontName(fontName); + _renderLabel->setSystemFontName(fontName); _contentDirty = true; } diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index c2f93c2243..98c0ee6edc 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -46,7 +46,7 @@ THE SOFTWARE. #include "CCScene.h" #include "renderer/CCCustomCommand.h" #include "renderer/CCRenderer.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN diff --git a/cocos/2d/CCLayer.h b/cocos/2d/CCLayer.h index fbc4285b70..a97f4771a5 100644 --- a/cocos/2d/CCLayer.h +++ b/cocos/2d/CCLayer.h @@ -45,6 +45,7 @@ NS_CC_BEGIN * @{ */ +class __Set; class TouchScriptHandlerEntry; class EventListenerTouch; @@ -77,10 +78,10 @@ public: CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesEnded(__Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesCancelled(__Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);} - /* Callback function should not be deprecated, it will generate lots of warnings. - Since 'setTouchEnabled' was deprecated, it will make warnings if developer overrides onTouchXXX and invokes setTouchEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX. + /* Callback function should not be deprecated, it will generate lots of warnings. + Since 'setTouchEnabled' was deprecated, it will make warnings if developer overrides onTouchXXX and invokes setTouchEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX. */ - virtual bool onTouchBegan(Touch *touch, Event *unused_event); + virtual bool onTouchBegan(Touch *touch, Event *unused_event); virtual void onTouchMoved(Touch *touch, Event *unused_event); virtual void onTouchEnded(Touch *touch, Event *unused_event); virtual void onTouchCancelled(Touch *touch, Event *unused_event); diff --git a/cocos/2d/CCMenu.cpp b/cocos/2d/CCMenu.cpp index da226b8d28..8192f9a18d 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -28,9 +28,8 @@ THE SOFTWARE. #include "CCApplication.h" #include "CCTouch.h" #include "CCStdC.h" -#include "CCInteger.h" #include "CCEventListenerTouch.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include #include diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 3615905f6b..32cc63fb73 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -31,6 +31,7 @@ THE SOFTWARE. #include "CCLabelAtlas.h" #include "CCLabel.h" #include "CCScriptSupport.h" +#include "deprecated/CCString.h" #include #include @@ -439,7 +440,7 @@ bool MenuItemFont::initWithString(const std::string& value, const ccMenuCallback _fontName = _globalFontName; _fontSize = _globalFontSize; - Label *label = Label::create(value, _fontName, _fontSize); + Label *label = Label::createWithSystemFont(value, _fontName, _fontSize); if (MenuItemLabel::initWithLabel(label, callback)) { // do something ? @@ -450,7 +451,7 @@ bool MenuItemFont::initWithString(const std::string& value, const ccMenuCallback void MenuItemFont::setFontSizeObj(int s) { _fontSize = s; - dynamic_cast(_label)->setFontSize(_fontSize); + dynamic_cast(_label)->setSystemFontSize(_fontSize); this->setContentSize(dynamic_cast(_label)->getContentSize()); } @@ -462,7 +463,7 @@ int MenuItemFont::getFontSizeObj() const void MenuItemFont::setFontNameObj(const std::string& name) { _fontName = name; - dynamic_cast(_label)->setFontName(_fontName); + dynamic_cast(_label)->setSystemFontName(_fontName); this->setContentSize(dynamic_cast(_label)->getContentSize()); } diff --git a/cocos/2d/CCMenuItem.h b/cocos/2d/CCMenuItem.h index 9233921202..cc85ae34b8 100644 --- a/cocos/2d/CCMenuItem.h +++ b/cocos/2d/CCMenuItem.h @@ -34,7 +34,6 @@ THE SOFTWARE. // cocos2d includes #include "CCNode.h" #include "CCProtocols.h" -#include "CCArray.h" NS_CC_BEGIN diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 76e8c678e0..5970b52c8a 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. #include -#include "CCString.h" +#include "deprecated/CCString.h" #include "ccCArray.h" #include "TransformUtils.h" #include "CCGrid.h" diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 8ed0a06032..743c4f338a 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -31,7 +31,6 @@ #include "ccMacros.h" #include "CCAffineTransform.h" -#include "CCArray.h" #include "CCGL.h" #include "ccGLStateCache.h" #include "CCGLProgram.h" diff --git a/cocos/2d/CCParticleSystem.h b/cocos/2d/CCParticleSystem.h index 9cd9823b70..cf1d30e36b 100644 --- a/cocos/2d/CCParticleSystem.h +++ b/cocos/2d/CCParticleSystem.h @@ -30,7 +30,7 @@ THE SOFTWARE. #include "CCProtocols.h" #include "CCNode.h" #include "CCValue.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index a03a1b0fbc..9b5069d5f8 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -31,6 +31,7 @@ THE SOFTWARE. #include "CCSprite.h" #include "CCSpriteBatchNode.h" #include "CCPhysicsWorld.h" +#include "deprecated/CCString.h" NS_CC_BEGIN diff --git a/cocos/2d/CCScheduler.cpp b/cocos/2d/CCScheduler.cpp index 094ab23a37..8369088b7d 100644 --- a/cocos/2d/CCScheduler.cpp +++ b/cocos/2d/CCScheduler.cpp @@ -30,7 +30,6 @@ THE SOFTWARE. #include "CCDirector.h" #include "utlist.h" #include "ccCArray.h" -#include "CCArray.h" #include "CCScriptSupport.h" NS_CC_BEGIN diff --git a/cocos/2d/CCScriptSupport.h b/cocos/2d/CCScriptSupport.h index c24f41fdd5..feebdde34d 100644 --- a/cocos/2d/CCScriptSupport.h +++ b/cocos/2d/CCScriptSupport.h @@ -33,7 +33,6 @@ #include "CCTouch.h" #include "CCEventTouch.h" #include "CCEventKeyboard.h" -#include "CCSet.h" #include #include #include diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index e688b35668..fd60eca586 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -24,14 +24,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ - +#include "CCSprite.h" #include "CCSpriteBatchNode.h" -#include -#include #include "CCAnimation.h" #include "CCAnimationCache.h" #include "ccConfig.h" -#include "CCSprite.h" #include "CCSpriteFrame.h" #include "CCSpriteFrameCache.h" #include "CCTextureCache.h" @@ -52,9 +49,10 @@ THE SOFTWARE. // external #include "kazmath/GL/matrix.h" #include "kazmath/kazmath.h" +#include "deprecated/CCString.h" - -using namespace std; +#include +#include NS_CC_BEGIN diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h index d117f78435..8321412551 100644 --- a/cocos/2d/CCSprite.h +++ b/cocos/2d/CCSprite.h @@ -32,7 +32,6 @@ THE SOFTWARE. #include "CCProtocols.h" #include "CCTextureAtlas.h" #include "ccTypes.h" -#include "CCDictionary.h" #include #ifdef EMSCRIPTEN #include "CCGLBufferedNode.h" diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index aae535904a..edeca1948d 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -27,9 +27,6 @@ THE SOFTWARE. ****************************************************************************/ #include "CCSpriteBatchNode.h" - -#include - #include "ccConfig.h" #include "CCSprite.h" #include "CCGrid.h" @@ -48,6 +45,10 @@ THE SOFTWARE. // external #include "kazmath/GL/matrix.h" +#include "deprecated/CCString.h" // For StringUtils::format + +#include + NS_CC_BEGIN /* diff --git a/cocos/2d/CCSpriteBatchNode.h b/cocos/2d/CCSpriteBatchNode.h index b35b0fe610..708012176f 100644 --- a/cocos/2d/CCSpriteBatchNode.h +++ b/cocos/2d/CCSpriteBatchNode.h @@ -77,28 +77,7 @@ public: The file will be loaded using the TextureMgr. */ static SpriteBatchNode* create(const std::string& fileImage, ssize_t capacity = DEFAULT_CAPACITY); - /** - * @js ctor - */ - SpriteBatchNode(); - /** - * @js NA - * @lua NA - */ - virtual ~SpriteBatchNode(); - /** initializes a SpriteBatchNode with a texture2d and capacity of children. - The capacity will be increased in 33% in runtime if it run out of space. - */ - bool initWithTexture(Texture2D *tex, ssize_t capacity); - /** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children. - The capacity will be increased in 33% in runtime if it run out of space. - The file will be loaded using the TextureMgr. - * @js init - * @lua init - */ - bool initWithFile(const std::string& fileImage, ssize_t capacity); - bool init(); /** returns the TextureAtlas object */ inline TextureAtlas* getTextureAtlas(void) { return _textureAtlas; } @@ -176,6 +155,31 @@ public: It add the sprite to the children and descendants array, but it doesn't update add it to the texture atlas */ SpriteBatchNode * addSpriteWithoutQuad(Sprite *child, int z, int aTag); + +CC_CONSTRUCTOR_ACCESS: + /** + * @js ctor + */ + SpriteBatchNode(); + /** + * @js NA + * @lua NA + */ + virtual ~SpriteBatchNode(); + + /** initializes a SpriteBatchNode with a texture2d and capacity of children. + The capacity will be increased in 33% in runtime if it run out of space. + */ + bool initWithTexture(Texture2D *tex, ssize_t capacity); + /** initializes a SpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and a capacity of children. + The capacity will be increased in 33% in runtime if it run out of space. + The file will be loaded using the TextureMgr. + * @js init + * @lua init + */ + bool initWithFile(const std::string& fileImage, ssize_t capacity); + bool init(); + protected: /** Updates a quad at a certain index into the texture atlas. The Sprite won't be added into the children array. This method should be called only when you are dealing with very big AtlasSrite and when most of the Sprite won't be updated. diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index bc89ef1b69..91b49259c8 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -35,9 +35,7 @@ THE SOFTWARE. #include "CCSprite.h" #include "TransformUtils.h" #include "platform/CCFileUtils.h" -#include "CCString.h" -#include "CCArray.h" -#include "CCDictionary.h" +#include "deprecated/CCString.h" #include "CCDirector.h" #include diff --git a/cocos/2d/CCTMXLayer.cpp b/cocos/2d/CCTMXLayer.cpp index 983d7e9d14..06ca065b2f 100644 --- a/cocos/2d/CCTMXLayer.cpp +++ b/cocos/2d/CCTMXLayer.cpp @@ -34,6 +34,8 @@ THE SOFTWARE. #include "ccCArray.h" #include "CCDirector.h" +#include "deprecated/CCString.h" // For StringUtils::format + NS_CC_BEGIN diff --git a/cocos/2d/CCTMXTiledMap.cpp b/cocos/2d/CCTMXTiledMap.cpp index bd42a02bb8..19a909de31 100644 --- a/cocos/2d/CCTMXTiledMap.cpp +++ b/cocos/2d/CCTMXTiledMap.cpp @@ -28,6 +28,8 @@ THE SOFTWARE. #include "CCTMXXMLParser.h" #include "CCTMXLayer.h" #include "CCSprite.h" +#include "deprecated/CCString.h" // For StringUtils::format + #include NS_CC_BEGIN diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index b12bd2dd8a..bcf71bf3ab 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -111,8 +111,8 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz { _placeHolder = placeholder; setDimensions(dimensions.width,dimensions.height); - setFontName(fontName); - setFontSize(fontSize); + setSystemFontName(fontName); + setSystemFontSize(fontSize); setAlignment(alignment,TextVAlignment::CENTER); Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); @@ -122,8 +122,8 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize) { _placeHolder = std::string(placeholder); - setFontName(fontName); - setFontSize(fontSize); + setSystemFontName(fontName); + setSystemFontSize(fontSize); Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); diff --git a/cocos/2d/CCTexture2D.cpp b/cocos/2d/CCTexture2D.cpp index e8235d614a..8e2181e32d 100644 --- a/cocos/2d/CCTexture2D.cpp +++ b/cocos/2d/CCTexture2D.cpp @@ -44,6 +44,7 @@ THE SOFTWARE. #include "ccGLStateCache.h" #include "CCShaderCache.h" #include "platform/CCDevice.h" +#include "deprecated/CCString.h" #if CC_ENABLE_CACHE_TEXTURE_DATA #include "CCTextureCache.h" diff --git a/cocos/2d/CCTextureAtlas.cpp b/cocos/2d/CCTextureAtlas.cpp index 208cc24329..ed091744c1 100644 --- a/cocos/2d/CCTextureAtlas.cpp +++ b/cocos/2d/CCTextureAtlas.cpp @@ -39,7 +39,7 @@ THE SOFTWARE. // support #include "CCTexture2D.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include #include "CCEventDispatcher.h" #include "CCEventListenerCustom.h" diff --git a/cocos/2d/CCTextureCache.cpp b/cocos/2d/CCTextureCache.cpp index eb7d443349..029df4218a 100644 --- a/cocos/2d/CCTextureCache.cpp +++ b/cocos/2d/CCTextureCache.cpp @@ -37,7 +37,7 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "ccUtils.h" #include "CCScheduler.h" -#include "CCString.h" +#include "deprecated/CCString.h" #ifdef EMSCRIPTEN diff --git a/cocos/2d/CCTileMapAtlas.cpp b/cocos/2d/CCTileMapAtlas.cpp index 17dd396116..c608596c71 100644 --- a/cocos/2d/CCTileMapAtlas.cpp +++ b/cocos/2d/CCTileMapAtlas.cpp @@ -29,9 +29,8 @@ THE SOFTWARE. #include "CCTextureAtlas.h" #include "TGAlib.h" #include "ccConfig.h" -#include "CCInteger.h" #include "CCDirector.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include NS_CC_BEGIN diff --git a/cocos/2d/CCTransition.cpp b/cocos/2d/CCTransition.cpp index 0777474369..cadcd6ca51 100644 --- a/cocos/2d/CCTransition.cpp +++ b/cocos/2d/CCTransition.cpp @@ -42,12 +42,18 @@ NS_CC_BEGIN const unsigned int kSceneFade = 0xFADEFADE; TransitionScene::TransitionScene() +: _inScene(nullptr) +, _outScene(nullptr) +, _duration(0.0f) +, _isInSceneOnTop(false) +, _isSendCleanupToScene(false) { } + TransitionScene::~TransitionScene() { - _inScene->release(); - _outScene->release(); + CC_SAFE_RELEASE(_inScene); + CC_SAFE_RELEASE(_outScene); } TransitionScene * TransitionScene::create(float t, Scene *scene) diff --git a/cocos/2d/CMakeLists.txt b/cocos/2d/CMakeLists.txt index feea51634c..b9bb67b0ec 100644 --- a/cocos/2d/CMakeLists.txt +++ b/cocos/2d/CMakeLists.txt @@ -103,7 +103,6 @@ set(COCOS2D_SRC base64.cpp ccUtils.cpp CCVertex.cpp - CCNotificationCenter.cpp TGAlib.cpp ZipUtils.cpp ccCArray.cpp @@ -130,13 +129,11 @@ set(COCOS2D_SRC ccFPSImages.c ccTypes.cpp cocos2d.cpp - CCDeprecated.cpp platform/CCSAXParser.cpp platform/CCThread.cpp platform/CCGLViewProtocol.cpp platform/CCFileUtils.cpp platform/CCImage.cpp - ../../external/edtaa3func/edtaa3func.cpp renderer/CCCustomCommand.cpp renderer/CCFrustum.cpp renderer/CCGroupCommand.cpp @@ -146,6 +143,9 @@ set(COCOS2D_SRC renderer/CCRenderCommand.cpp renderer/CCRenderer.cpp renderer/CCRenderMaterial.cpp + ../deprecated/CCDeprecated.cpp + ../deprecated/CCNotificationCenter.cpp + ../../external/edtaa3func/edtaa3func.cpp ) include(../physics/CMakeLists.txt) diff --git a/cocos/2d/ccCArray.cpp b/cocos/2d/ccCArray.cpp index c73a0ced26..560da53d51 100644 --- a/cocos/2d/ccCArray.cpp +++ b/cocos/2d/ccCArray.cpp @@ -26,11 +26,10 @@ THE SOFTWARE. #include "ccCArray.h" #include "CCRef.h" +#include "ccTypes.h" NS_CC_BEGIN -const ssize_t CC_INVALID_INDEX = -1; - /** Allocates and initializes a new array with specified capacity */ ccArray* ccArrayNew(ssize_t capacity) { diff --git a/cocos/2d/ccCArray.h b/cocos/2d/ccCArray.h index a40f696d79..1e7541df72 100644 --- a/cocos/2d/ccCArray.h +++ b/cocos/2d/ccCArray.h @@ -52,8 +52,6 @@ THE SOFTWARE. NS_CC_BEGIN -extern const ssize_t CC_INVALID_INDEX; - // Easy integration #define CCARRAYDATA_FOREACH(__array__, __object__) \ __object__=__array__->arr[0]; for(ssize_t i=0, num=__array__->num; iarr[i]) \ diff --git a/cocos/2d/ccTypes.cpp b/cocos/2d/ccTypes.cpp index 11b995efd5..10b0efd5d2 100644 --- a/cocos/2d/ccTypes.cpp +++ b/cocos/2d/ccTypes.cpp @@ -28,7 +28,9 @@ Copyright (c) 2013-2014 Chukong Technologies Inc. #include "ccTypes.h" NS_CC_BEGIN + const std::string STD_STRING_EMPTY(""); +const ssize_t CC_INVALID_INDEX = -1; /** * Color3B diff --git a/cocos/2d/ccTypes.h b/cocos/2d/ccTypes.h index 98219eaddf..d0b72bc662 100644 --- a/cocos/2d/ccTypes.h +++ b/cocos/2d/ccTypes.h @@ -473,6 +473,7 @@ public: }; extern const std::string STD_STRING_EMPTY; +extern const ssize_t CC_INVALID_INDEX; NS_CC_END diff --git a/cocos/2d/cocos2d.cpp b/cocos/2d/cocos2d.cpp index 0a346a7af5..bc28f52742 100644 --- a/cocos/2d/cocos2d.cpp +++ b/cocos/2d/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "3.0-rc1"; + return "3.0"; } NS_CC_END diff --git a/cocos/2d/cocos2d.h b/cocos/2d/cocos2d.h index e1699ab5af..fe8606c2ce 100644 --- a/cocos/2d/cocos2d.h +++ b/cocos/2d/cocos2d.h @@ -59,19 +59,11 @@ THE SOFTWARE. // cocoa #include "CCAffineTransform.h" -#include "CCDictionary.h" #include "CCRef.h" -#include "CCArray.h" #include "CCVector.h" #include "CCMap.h" #include "CCGeometry.h" -#include "CCSet.h" #include "CCAutoreleasePool.h" -#include "CCInteger.h" -#include "CCFloat.h" -#include "CCDouble.h" -#include "CCBool.h" -#include "CCString.h" #include "CCNS.h" #include "CCData.h" #include "CCValue.h" @@ -96,6 +88,7 @@ THE SOFTWARE. #include "CCLabelTTF.h" #include "CCLabelBMFont.h" #include "CCLabel.h" +#include "CCFontFNT.h" // layers_scenes_transitions_nodes #include "CCLayer.h" @@ -230,7 +223,6 @@ THE SOFTWARE. // support #include "ccUTF8.h" -#include "CCNotificationCenter.h" #include "CCProfiling.h" #include "CCConsole.h" #include "CCUserDefault.h" @@ -277,7 +269,18 @@ THE SOFTWARE. #include "CCComponentContainer.h" // Deprecated include -#include "CCDeprecated.h" +#include "deprecated/CCDictionary.h" +#include "deprecated/CCArray.h" +#include "deprecated/CCSet.h" +#include "deprecated/CCInteger.h" +#include "deprecated/CCFloat.h" +#include "deprecated/CCDouble.h" +#include "deprecated/CCBool.h" +#include "deprecated/CCString.h" +#include "deprecated/CCNotificationCenter.h" +// CCDeprecated.h must be included at the end +#include "deprecated/CCDeprecated.h" + NS_CC_BEGIN diff --git a/cocos/2d/cocos2d.vcxproj b/cocos/2d/cocos2d.vcxproj index 6f7782d2f2..c85504a2bb 100644 --- a/cocos/2d/cocos2d.vcxproj +++ b/cocos/2d/cocos2d.vcxproj @@ -171,20 +171,22 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou - - - - + + + + + + @@ -231,7 +233,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou - @@ -271,7 +272,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou - @@ -341,28 +341,30 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou - - - - - - - - + + + + + + + + + + @@ -455,7 +457,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou - diff --git a/cocos/2d/cocos2d.vcxproj.filters b/cocos/2d/cocos2d.vcxproj.filters index fd26164515..786611b56d 100644 --- a/cocos/2d/cocos2d.vcxproj.filters +++ b/cocos/2d/cocos2d.vcxproj.filters @@ -106,6 +106,9 @@ {b4e2b1e5-2d79-44a3-af45-728d47b7bdb2} + + {0b1152b1-c732-4560-8629-87843b0fbd7c} + @@ -394,7 +397,6 @@ tilemap_parallax_nodes - @@ -403,9 +405,6 @@ support - - support - support @@ -448,9 +447,6 @@ base - - base - base @@ -460,9 +456,6 @@ base - - base - base @@ -472,12 +465,6 @@ base - - base - - - base - support @@ -596,6 +583,24 @@ xxhash + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + @@ -980,9 +985,6 @@ support - - support - support @@ -1034,48 +1036,24 @@ base - - base - base - - base - base base - - base - - - base - - - base - base - - base - base base - - base - - - base - event_dispatcher @@ -1203,6 +1181,36 @@ xxhash + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + diff --git a/cocos/2d/cocos2d_headers.props b/cocos/2d/cocos2d_headers.props index 9e64903d6a..76fa51e023 100644 --- a/cocos/2d/cocos2d_headers.props +++ b/cocos/2d/cocos2d_headers.props @@ -7,7 +7,7 @@ - $(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\gui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)cocos\2d\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES + $(EngineRoot)cocos;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)cocos\2d\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES _VARIADIC_MAX=10;%(PreprocessorDefinitions) diff --git a/cocos/2d/cocos2d_winrt_headers.props b/cocos/2d/cocos2d_winrt_headers.props index 682d31f725..a15b97b395 100644 --- a/cocos/2d/cocos2d_winrt_headers.props +++ b/cocos/2d/cocos2d_winrt_headers.props @@ -7,7 +7,7 @@ - $(EngineRoot)cocos\2d\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\gui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath\include;$(GeneratedFilesDir) + $(EngineRoot)cocos;$(EngineRoot)cocos\2d\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath\include;$(GeneratedFilesDir) diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index a5e060c98b..e06f7e17a0 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -210,20 +210,22 @@ - - - - + + + + + + false false @@ -560,7 +562,6 @@ - @@ -617,7 +618,6 @@ - @@ -698,28 +698,30 @@ - - - - - - - - + + + + + + + + + + @@ -769,7 +771,6 @@ - @@ -812,7 +813,6 @@ - diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index 42ed545af3..6427cee862 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -103,6 +103,9 @@ {a36c6808-a8d6-43f4-bfb0-e08ee2747a21} + + {5598fb0c-c012-45b6-8e43-447e7891b61d} + @@ -376,7 +379,6 @@ tilemap_parallax_nodes - @@ -385,9 +387,6 @@ support - - support - support @@ -430,9 +429,6 @@ base - - base - base @@ -442,9 +438,6 @@ base - - base - base @@ -454,12 +447,6 @@ base - - base - - - base - support @@ -611,6 +598,24 @@ xxhash + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + @@ -679,9 +684,6 @@ include - - include - include @@ -980,9 +982,6 @@ support - - support - support @@ -1034,48 +1033,24 @@ base - - base - base - - base - base base - - base - - - base - - - base - base - - base - base base - - base - - - base - event_dispatcher @@ -1239,5 +1214,35 @@ xxhash + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + \ No newline at end of file diff --git a/cocos/2d/cocos2d_wp8_headers.props b/cocos/2d/cocos2d_wp8_headers.props index 08825273b2..94b1e4f489 100644 --- a/cocos/2d/cocos2d_wp8_headers.props +++ b/cocos/2d/cocos2d_wp8_headers.props @@ -7,7 +7,7 @@ - $(EngineRoot)cocos\2d\platform\wp8;$(EngineRoot)cocos\2d\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\gui;$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external;$(EngineRoot)cocos\editor-support;$(EngineRoot);$(EngineRoot)cocos\math\kazmath\include;$(GeneratedFilesDir) + $(EngineRoot)cocos\2d\platform\wp8;$(EngineRoot)cocos\2d\platform\winrt;$(EngineRoot)\external\winrt-specific\angle\include;$(EngineRoot)\external\winrt-specific;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\ui;$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external;$(EngineRoot)cocos\editor-support;$(EngineRoot);$(EngineRoot)cocos\math\kazmath\include;$(EngineRoot)cocos\deprecated;$(GeneratedFilesDir) _VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true true diff --git a/cocos/2d/platform/CCFileUtils.cpp b/cocos/2d/platform/CCFileUtils.cpp index 16cc6cf415..225b713989 100644 --- a/cocos/2d/platform/CCFileUtils.cpp +++ b/cocos/2d/platform/CCFileUtils.cpp @@ -500,9 +500,10 @@ void FileUtils::purgeCachedEntries() static Data getData(const std::string& filename, bool forString) { - // getData is used indirectly in Image::initWithImageFileThreadSafe(), but CCASSERT is not thread-safe -// CCASSERT(!filename.empty(), "Invalid filename!"); - assert(!(filename.empty())); + if (filename.empty()) + { + return Data::Null; + } Data ret; unsigned char* buffer = nullptr; @@ -556,6 +557,7 @@ std::string FileUtils::getStringFromFile(const std::string& filename) Data data = getData(filename, true); if (data.isNull()) return ""; + std::string ret((const char*)data.getBytes()); return ret; } diff --git a/cocos/2d/platform/CCGLViewProtocol.cpp b/cocos/2d/platform/CCGLViewProtocol.cpp index 2a2ac08506..e7c22aa1ad 100644 --- a/cocos/2d/platform/CCGLViewProtocol.cpp +++ b/cocos/2d/platform/CCGLViewProtocol.cpp @@ -26,10 +26,8 @@ THE SOFTWARE. #include "CCGLViewProtocol.h" #include "CCTouch.h" #include "CCDirector.h" -#include "CCSet.h" #include "CCEventDispatcher.h" - NS_CC_BEGIN namespace { @@ -369,7 +367,7 @@ void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, } else { - CCLOG("Ending touches with id: %ld error", id); + CCLOG("Ending touches with id: %ld error", static_cast(id)); return; } diff --git a/cocos/2d/platform/android/Android.mk b/cocos/2d/platform/android/Android.mk index 0dc5a9cb13..6ac94dbb80 100644 --- a/cocos/2d/platform/android/Android.mk +++ b/cocos/2d/platform/android/Android.mk @@ -26,6 +26,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_C_INCLUDES := $(LOCAL_PATH) \ $(LOCAL_PATH)/../.. \ + $(LOCAL_PATH)/../../.. \ $(LOCAL_PATH)/../../../base \ $(LOCAL_PATH)/../../../math/kazmath \ $(LOCAL_PATH)/../../../physics diff --git a/cocos/2d/platform/android/CCDevice.cpp b/cocos/2d/platform/android/CCDevice.cpp index f58c71dc30..9d441995c9 100644 --- a/cocos/2d/platform/android/CCDevice.cpp +++ b/cocos/2d/platform/android/CCDevice.cpp @@ -70,7 +70,7 @@ class BitmapDC public: BitmapDC() - : _data(NULL) + : _data(nullptr) , _width(0) , _height(0) { diff --git a/cocos/2d/platform/android/CCFileUtilsAndroid.cpp b/cocos/2d/platform/android/CCFileUtilsAndroid.cpp index adda78bcb6..ad9518fc91 100644 --- a/cocos/2d/platform/android/CCFileUtilsAndroid.cpp +++ b/cocos/2d/platform/android/CCFileUtilsAndroid.cpp @@ -243,6 +243,9 @@ Data FileUtilsAndroid::getData(const std::string& filename, bool forString) std::string FileUtilsAndroid::getStringFromFile(const std::string& filename) { Data data = getData(filename, true); + if (data.isNull()) + return ""; + std::string ret((const char*)data.getBytes()); return ret; } diff --git a/cocos/2d/platform/android/CCGLView.cpp b/cocos/2d/platform/android/CCGLView.cpp index 2f826d6782..3015993c0b 100644 --- a/cocos/2d/platform/android/CCGLView.cpp +++ b/cocos/2d/platform/android/CCGLView.cpp @@ -27,7 +27,6 @@ THE SOFTWARE. #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #include "CCGLView.h" -#include "CCSet.h" #include "CCDirector.h" #include "ccMacros.h" #include "jni/IMEJni.h" diff --git a/cocos/2d/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos/2d/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index 0f5cfa6b12..20313d6cc5 100644 --- a/cocos/2d/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos/2d/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. #include "JniHelper.h" #include "CCFileUtilsAndroid.h" #include "android/asset_manager_jni.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "Java_org_cocos2dx_lib_Cocos2dxHelper.h" #define LOG_TAG "Java_org_cocos2dx_lib_Cocos2dxHelper.cpp" diff --git a/cocos/2d/platform/android/jni/TouchesJni.cpp b/cocos/2d/platform/android/jni/TouchesJni.cpp index 296927f53b..d6c33ad564 100644 --- a/cocos/2d/platform/android/jni/TouchesJni.cpp +++ b/cocos/2d/platform/android/jni/TouchesJni.cpp @@ -21,7 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "CCSet.h" #include "CCDirector.h" #include "CCEventKeyboard.h" #include "CCGLView.h" diff --git a/cocos/2d/platform/apple/CCFileUtilsApple.mm b/cocos/2d/platform/apple/CCFileUtilsApple.mm index 1267fecce3..23fe27f883 100644 --- a/cocos/2d/platform/apple/CCFileUtilsApple.mm +++ b/cocos/2d/platform/apple/CCFileUtilsApple.mm @@ -27,7 +27,7 @@ THE SOFTWARE. #include #include -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCFileUtils.h" #include "CCDirector.h" #include "CCSAXParser.h" diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 91d4b6e000..6e54d2a174 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -24,17 +24,15 @@ THE SOFTWARE. ****************************************************************************/ #include "CCGLView.h" - -#include - #include "CCDirector.h" -#include "CCSet.h" #include "CCTouch.h" #include "CCEventDispatcher.h" #include "CCEventKeyboard.h" #include "CCEventMouse.h" #include "CCIMEDispatcher.h" +#include + NS_CC_BEGIN // GLFWEventHandler @@ -260,7 +258,7 @@ GLView::GLView() , _retinaFactor(1) , _frameZoomFactor(1.0f) , _mainWindow(nullptr) -, _primaryMonitor(nullptr) +, _monitor(nullptr) , _mouseX(0.0f) , _mouseY(0.0f) { @@ -317,6 +315,18 @@ GLView* GLView::createWithFullScreen(const std::string& viewName) return nullptr; } +GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor) +{ + auto ret = new GLView(); + if(ret && ret->initWithFullscreen(viewName, videoMode, monitor)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + + bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) { setViewName(viewName); @@ -328,7 +338,7 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo _mainWindow = glfwCreateWindow(rect.size.width * _frameZoomFactor, rect.size.height * _frameZoomFactor, _viewName.c_str(), - _primaryMonitor, + _monitor, nullptr); glfwMakeContextCurrent(_mainWindow); @@ -366,14 +376,31 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo bool GLView::initWithFullScreen(const std::string& viewName) { - _primaryMonitor = glfwGetPrimaryMonitor(); - if (nullptr == _primaryMonitor) + //Create fullscreen window on primary monitor at its current video mode. + _monitor = glfwGetPrimaryMonitor(); + if (nullptr == _monitor) return false; - const GLFWvidmode* videoMode = glfwGetVideoMode(_primaryMonitor); + const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor); return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f); } +bool GLView::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor) +{ + //Create fullscreen on specified monitor at the specified video mode. + _monitor = monitor; + if (nullptr == _monitor) + return false; + + //These are soft contraints. If the video mode is retrieved at runtime, the resulting window and context should match these exactly. If invalid attribs are passed (eg. from an outdated cache), window creation will NOT fail but the actual window/context may differ. + glfwWindowHint(GLFW_REFRESH_RATE, videoMode.refreshRate); + glfwWindowHint(GLFW_RED_BITS, videoMode.redBits); + glfwWindowHint(GLFW_BLUE_BITS, videoMode.blueBits); + glfwWindowHint(GLFW_GREEN_BITS, videoMode.greenBits); + + return initWithRect(viewname, Rect(0, 0, videoMode.width, videoMode.height), 1.0f); +} + bool GLView::isOpenGLReady() { return nullptr != _mainWindow; diff --git a/cocos/2d/platform/desktop/CCGLView.h b/cocos/2d/platform/desktop/CCGLView.h index afd6fc8920..2db232e724 100644 --- a/cocos/2d/platform/desktop/CCGLView.h +++ b/cocos/2d/platform/desktop/CCGLView.h @@ -39,6 +39,7 @@ public: static GLView* create(const std::string& viewName); static GLView* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f); static GLView* createWithFullScreen(const std::string& viewName); + static GLView* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor); /* *frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. @@ -82,6 +83,7 @@ protected: bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor); bool initWithFullScreen(const std::string& viewName); + bool initWithFullscreen(const std::string& viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor); bool initGlew(); @@ -107,7 +109,7 @@ protected: float _frameZoomFactor; GLFWwindow* _mainWindow; - GLFWmonitor* _primaryMonitor; + GLFWmonitor* _monitor; float _mouseX; float _mouseY; diff --git a/cocos/2d/platform/linux/CCFileUtilsLinux.cpp b/cocos/2d/platform/linux/CCFileUtilsLinux.cpp index a2c4cb30ad..8bfd43534b 100644 --- a/cocos/2d/platform/linux/CCFileUtilsLinux.cpp +++ b/cocos/2d/platform/linux/CCFileUtilsLinux.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. #include "platform/CCCommon.h" #include "ccMacros.h" #include "CCApplication.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include #include #include diff --git a/cocos/2d/platform/linux/CCPlatformDefine.h b/cocos/2d/platform/linux/CCPlatformDefine.h index 77f17916da..8a42c196dc 100644 --- a/cocos/2d/platform/linux/CCPlatformDefine.h +++ b/cocos/2d/platform/linux/CCPlatformDefine.h @@ -31,11 +31,7 @@ THE SOFTWARE. #include -#if defined(_USRDLL) -#define CC_DLL __attribute__ ((visibility ("default"))) -#else /* use a DLL library */ -#define CC_DLL __attribute__ ((visibility ("default"))) -#endif +#define CC_DLL #include #define CC_ASSERT(cond) assert(cond) diff --git a/cocos/2d/platform/linux/CCStdC.h b/cocos/2d/platform/linux/CCStdC.h index 4941bbe66b..8a33ef8ec4 100644 --- a/cocos/2d/platform/linux/CCStdC.h +++ b/cocos/2d/platform/linux/CCStdC.h @@ -40,6 +40,7 @@ THE SOFTWARE. #include #include #include +#include #ifndef MIN #define MIN(x,y) (((x) > (y)) ? (y) : (x)) diff --git a/cocos/2d/platform/win32/CCApplication.cpp b/cocos/2d/platform/win32/CCApplication.cpp index 6a9dc89a2f..0d13650263 100644 --- a/cocos/2d/platform/win32/CCApplication.cpp +++ b/cocos/2d/platform/win32/CCApplication.cpp @@ -43,10 +43,10 @@ NS_CC_BEGIN Application * Application::sm_pSharedApplication = 0; Application::Application() -: _instance(NULL) -, _accelTable(NULL) +: _instance(nullptr) +, _accelTable(nullptr) { - _instance = GetModuleHandle(NULL); + _instance = GetModuleHandle(nullptr); _animationInterval.QuadPart = 0; CC_ASSERT(! sm_pSharedApplication); sm_pSharedApplication = this; diff --git a/cocos/2d/platform/win32/CCDevice.cpp b/cocos/2d/platform/win32/CCDevice.cpp index b0d5260457..d10cfa559f 100644 --- a/cocos/2d/platform/win32/CCDevice.cpp +++ b/cocos/2d/platform/win32/CCDevice.cpp @@ -56,10 +56,10 @@ class BitmapDC { public: BitmapDC(HWND hWnd = NULL) - : _DC(NULL) - , _bmp(NULL) + : _DC(nullptr) + , _bmp(nullptr) , _font((HFONT)GetStockObject(DEFAULT_GUI_FONT)) - , _wnd(NULL) + , _wnd(nullptr) { _wnd = hWnd; HDC hdc = GetDC(hWnd); diff --git a/cocos/2d/platform/win32/CCFileUtilsWin32.cpp b/cocos/2d/platform/win32/CCFileUtilsWin32.cpp index b8a1b8f4d3..f978fecc32 100644 --- a/cocos/2d/platform/win32/CCFileUtilsWin32.cpp +++ b/cocos/2d/platform/win32/CCFileUtilsWin32.cpp @@ -131,8 +131,13 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) const static Data getData(const std::string& filename, bool forString) { + if (filename.empty()) + { + return Data::Null; + } + unsigned char *buffer = nullptr; - CCASSERT(!filename.empty(), "Invalid parameters."); + size_t size = 0; do { @@ -195,6 +200,7 @@ std::string FileUtilsWin32::getStringFromFile(const std::string& filename) { return ""; } + std::string ret((const char*)data.getBytes()); return ret; } diff --git a/cocos/2d/platform/win32/CCFileUtilsWin32.h b/cocos/2d/platform/win32/CCFileUtilsWin32.h index 650e44492a..a0bb847dfc 100644 --- a/cocos/2d/platform/win32/CCFileUtilsWin32.h +++ b/cocos/2d/platform/win32/CCFileUtilsWin32.h @@ -64,7 +64,7 @@ protected: * @return Upon success, a pointer to the data is returned, otherwise NULL. * @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned. */ - CC_DEPRECATED_ATTRIBUTE virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t * size) override; + virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t * size) override; /** * Gets string from a file. diff --git a/cocos/2d/platform/win32/CCStdC.h b/cocos/2d/platform/win32/CCStdC.h index cdac427c5b..9121c3d3de 100644 --- a/cocos/2d/platform/win32/CCStdC.h +++ b/cocos/2d/platform/win32/CCStdC.h @@ -29,10 +29,11 @@ THE SOFTWARE. #include "CCPlatformConfig.h" #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 -//typedef SSIZE_T ssize_t; -// ssize_t was redefined as int in libwebsockets.h. -// Therefore, to avoid conflict, we needs the same definition. -typedef int ssize_t; +#include +#ifndef __SSIZE_T +#define __SSIZE_T +typedef SSIZE_T ssize_t; +#endif // __SSIZE_T #include "CCPlatformMacros.h" #include diff --git a/cocos/2d/platform/winrt/CCStdC.h b/cocos/2d/platform/winrt/CCStdC.h index 806802d345..99992001ba 100644 --- a/cocos/2d/platform/winrt/CCStdC.h +++ b/cocos/2d/platform/winrt/CCStdC.h @@ -32,11 +32,12 @@ THE SOFTWARE. #include "CCPlatformMacros.h" #include +#include -//typedef SSIZE_T ssize_t; -// ssize_t was redefined as int in libwebsockets.h. -// Therefore, to avoid conflict, we needs the same definition. -typedef int ssize_t; +#ifndef __SSIZE_T +#define __SSIZE_T +typedef SSIZE_T ssize_t; +#endif // __SSIZE_T // for math.h on win32 platform diff --git a/cocos/2d/renderer/CCQuadCommand.cpp b/cocos/2d/renderer/CCQuadCommand.cpp index 29576bc7fb..48d5bdc911 100644 --- a/cocos/2d/renderer/CCQuadCommand.cpp +++ b/cocos/2d/renderer/CCQuadCommand.cpp @@ -36,11 +36,12 @@ static void convertIntToByteArray(int value, int* output) } QuadCommand::QuadCommand() -:_textureID(0) -,_blendType(BlendFunc::DISABLE) -,_quadsCount(0) +:_materialID(0) +,_textureID(0) ,_shader(nullptr) +,_blendType(BlendFunc::DISABLE) ,_quads(nullptr) +,_quadsCount(0) { _type = RenderCommand::Type::QUAD_COMMAND; } @@ -49,21 +50,18 @@ void QuadCommand::init(float globalOrder, GLuint textureID, GLProgram* shader, B { _globalOrder = globalOrder; - _textureID = textureID; - _blendType = blendType; - _shader = shader; - _quadsCount = quadCount; _quads = quad; _mv = mv; - if( _textureID != _lastTextureID || _blendType.src != _lastBlendType.src || _blendType.dst != _lastBlendType.dst || _shader != _lastShader) { + if( _textureID != textureID || _blendType.src != blendType.src || _blendType.dst != blendType.dst || _shader != shader) { + + _textureID = textureID; + _blendType = blendType; + _shader = shader; + generateMaterialID(); - - _lastShader = _shader; - _lastBlendType = _blendType; - _lastTextureID = _textureID; } } diff --git a/cocos/2d/renderer/CCQuadCommand.h b/cocos/2d/renderer/CCQuadCommand.h index 48f513fae8..34fde0485e 100644 --- a/cocos/2d/renderer/CCQuadCommand.h +++ b/cocos/2d/renderer/CCQuadCommand.h @@ -73,13 +73,10 @@ protected: uint32_t _materialID; GLuint _textureID; - GLuint _lastTextureID; GLProgram* _shader; - GLProgram* _lastShader; BlendFunc _blendType; - BlendFunc _lastBlendType; V3F_C4B_T2F_Quad* _quads; ssize_t _quadsCount; diff --git a/cocos/2d/renderer/CCRenderer.cpp b/cocos/2d/renderer/CCRenderer.cpp index b0dd1ded15..42606a8172 100644 --- a/cocos/2d/renderer/CCRenderer.cpp +++ b/cocos/2d/renderer/CCRenderer.cpp @@ -68,17 +68,17 @@ void RenderQueue::sort() RenderCommand* RenderQueue::operator[](ssize_t index) const { - if(index < _queueNegZ.size()) + if(index < static_cast(_queueNegZ.size())) return _queueNegZ[index]; index -= _queueNegZ.size(); - if(index < _queue0.size()) + if(index < static_cast(_queue0.size())) return _queue0[index]; index -= _queue0.size(); - if(index < _queuePosZ.size()) + if(index < static_cast(_queuePosZ.size())) return _queuePosZ[index]; CCASSERT(false, "invalid index"); diff --git a/cocos/audio/android/Android.mk b/cocos/audio/android/Android.mk index 136e0fc3b2..099f4bd016 100644 --- a/cocos/audio/android/Android.mk +++ b/cocos/audio/android/Android.mk @@ -12,6 +12,7 @@ LOCAL_SRC_FILES := cddSimpleAudioEngine.cpp \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \ + $(LOCAL_PATH)/../.. \ $(LOCAL_PATH)/../../math/kazmath \ $(LOCAL_PATH)/../../2d \ $(LOCAL_PATH)/../../2d/platform/android \ diff --git a/cocos/audio/android/ccdandroidUtils.cpp b/cocos/audio/android/ccdandroidUtils.cpp index 3a8e8a462f..f167bbe1c6 100644 --- a/cocos/audio/android/ccdandroidUtils.cpp +++ b/cocos/audio/android/ccdandroidUtils.cpp @@ -39,9 +39,9 @@ namespace CocosDenshion { // Removing `assets` since it isn't needed for the API of playing sound. size_t pos = fullPath.find("assets/"); if (pos == 0) - { - fullPath = fullPath.substr(strlen("assets/")); - } + { + fullPath = fullPath.substr(strlen("assets/")); + } return fullPath; } } diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 0a7dc8dabe..fc0c599990 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #endif #include "CCDirector.h" @@ -650,7 +651,7 @@ void Console::commandTouch(int fd, const std::string& args) float x = std::atof(argv[1].c_str()); float y = std::atof(argv[2].c_str()); - srand ((unsigned)time(NULL)); + srand ((unsigned)time(nullptr)); _touchId = rand(); Scheduler *sched = Director::getInstance()->getScheduler(); sched->performFunctionInCocosThread( [&](){ @@ -678,7 +679,7 @@ void Console::commandTouch(int fd, const std::string& args) float x2 = std::atof(argv[3].c_str()); float y2 = std::atof(argv[4].c_str()); - srand ((unsigned)time(NULL)); + srand ((unsigned)time(nullptr)); _touchId = rand(); Scheduler *sched = Director::getInstance()->getScheduler(); @@ -844,7 +845,8 @@ void Console::commandUpload(int fd) ssize_t Console::readBytes(int fd, char* buffer, size_t maxlen, bool* more) { - ssize_t n, rc; + size_t n; + int rc; char c, *ptr = buffer; *more = false; for( n = 0; n < maxlen; n++ ) { @@ -927,7 +929,7 @@ bool Console::parseCommand(int fd) if(it != _commands.end()) { std::string args2; - for(int i = 1; i < args.size(); ++i) + for(size_t i = 1; i < args.size(); ++i) { if(i > 1) { @@ -954,7 +956,8 @@ bool Console::parseCommand(int fd) ssize_t Console::readline(int fd, char* ptr, size_t maxlen) { - ssize_t n, rc; + size_t n; + int rc; char c; for( n = 0; n < maxlen - 1; n++ ) { @@ -1056,6 +1059,19 @@ void Console::loop() for(const auto &fd: _fds) { if(FD_ISSET(fd,©_set)) { + //fix Bug #4302 Test case ConsoleTest--ConsoleUploadFile crashed on Linux + //On linux, if you send data to a closed socket, the sending process will + //receive a SIGPIPE, which will cause linux system shutdown the sending process. + //Add this ioctl code to check if the socket has been closed by peer. +#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) + int n = 0; + ioctl(fd, FIONREAD, &n); + if(n == 0) + { + //no data received, or fd is closed + continue; + } +#endif if( ! parseCommand(fd) ) { to_remove.push_back(fd); diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index d278f31775..515bb7c499 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -29,10 +29,12 @@ #if defined(_MSC_VER) || defined(__MINGW32__) #include #include -//typedef SSIZE_T ssize_t; -// ssize_t was redefined as int in libwebsockets.h. -// Therefore, to avoid conflict, we needs the same definition. -typedef int ssize_t; + +#ifndef __SSIZE_T +#define __SSIZE_T +typedef SSIZE_T ssize_t; +#endif // __SSIZE_T + #else #include #endif diff --git a/cocos/base/CCDataVisitor.cpp b/cocos/base/CCDataVisitor.cpp index a908ead8bd..e0073cdea4 100644 --- a/cocos/base/CCDataVisitor.cpp +++ b/cocos/base/CCDataVisitor.cpp @@ -23,14 +23,14 @@ ****************************************************************************/ #include "CCRef.h" -#include "CCBool.h" -#include "CCInteger.h" -#include "CCFloat.h" -#include "CCDouble.h" -#include "CCString.h" -#include "CCArray.h" -#include "CCDictionary.h" -#include "CCSet.h" +#include "deprecated/CCBool.h" +#include "deprecated/CCInteger.h" +#include "deprecated/CCFloat.h" +#include "deprecated/CCDouble.h" +#include "deprecated/CCString.h" +#include "deprecated/CCArray.h" +#include "deprecated/CCDictionary.h" +#include "deprecated/CCSet.h" NS_CC_BEGIN diff --git a/cocos/base/CMakeLists.txt b/cocos/base/CMakeLists.txt index 451beec101..14047942b1 100644 --- a/cocos/base/CMakeLists.txt +++ b/cocos/base/CMakeLists.txt @@ -1,13 +1,13 @@ set(COCOS_BASE_SRC + ../deprecated/CCSet.cpp + ../deprecated/CCArray.cpp + ../deprecated/CCDictionary.cpp + ../deprecated/CCString.cpp CCAffineTransform.cpp CCAutoreleasePool.cpp CCGeometry.cpp CCNS.cpp CCRef.cpp - CCSet.cpp - CCArray.cpp - CCDictionary.cpp - CCString.cpp CCDataVisitor.cpp CCData.cpp CCValue.cpp diff --git a/cocos/base/CCArray.cpp b/cocos/deprecated/CCArray.cpp similarity index 99% rename from cocos/base/CCArray.cpp rename to cocos/deprecated/CCArray.cpp index 62af0b697e..80118faa74 100644 --- a/cocos/base/CCArray.cpp +++ b/cocos/deprecated/CCArray.cpp @@ -25,7 +25,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCArray.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "platform/CCFileUtils.h" NS_CC_BEGIN @@ -37,7 +37,7 @@ NS_CC_BEGIN // ---------------------------------------------------------------------------------- __Array::__Array() -: data(NULL) +: data(nullptr) { init(); } diff --git a/cocos/base/CCArray.h b/cocos/deprecated/CCArray.h similarity index 100% rename from cocos/base/CCArray.h rename to cocos/deprecated/CCArray.h diff --git a/cocos/base/CCBool.h b/cocos/deprecated/CCBool.h similarity index 100% rename from cocos/base/CCBool.h rename to cocos/deprecated/CCBool.h diff --git a/cocos/2d/CCDeprecated.cpp b/cocos/deprecated/CCDeprecated.cpp similarity index 100% rename from cocos/2d/CCDeprecated.cpp rename to cocos/deprecated/CCDeprecated.cpp diff --git a/cocos/2d/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h similarity index 100% rename from cocos/2d/CCDeprecated.h rename to cocos/deprecated/CCDeprecated.h diff --git a/cocos/base/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp similarity index 99% rename from cocos/base/CCDictionary.cpp rename to cocos/deprecated/CCDictionary.cpp index 9c4dfb791c..96ae7dcc7a 100644 --- a/cocos/base/CCDictionary.cpp +++ b/cocos/deprecated/CCDictionary.cpp @@ -24,10 +24,10 @@ ****************************************************************************/ #include "CCDictionary.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCInteger.h" #include "platform/CCFileUtils.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCBool.h" #include "CCInteger.h" #include "CCFloat.h" @@ -77,7 +77,7 @@ DictElement::~DictElement() // __Dictionary __Dictionary::__Dictionary() -: _elements(NULL) +: _elements(nullptr) , _dictType(kDictUnknown) { diff --git a/cocos/base/CCDictionary.h b/cocos/deprecated/CCDictionary.h similarity index 99% rename from cocos/base/CCDictionary.h rename to cocos/deprecated/CCDictionary.h index 343fd05520..e105c295ed 100644 --- a/cocos/base/CCDictionary.h +++ b/cocos/deprecated/CCDictionary.h @@ -29,7 +29,7 @@ THE SOFTWARE. #include "uthash.h" #include "CCRef.h" #include "CCArray.h" -#include "CCString.h" +#include "deprecated/CCString.h" NS_CC_BEGIN diff --git a/cocos/base/CCDouble.h b/cocos/deprecated/CCDouble.h similarity index 100% rename from cocos/base/CCDouble.h rename to cocos/deprecated/CCDouble.h diff --git a/cocos/base/CCFloat.h b/cocos/deprecated/CCFloat.h similarity index 100% rename from cocos/base/CCFloat.h rename to cocos/deprecated/CCFloat.h diff --git a/cocos/base/CCInteger.h b/cocos/deprecated/CCInteger.h similarity index 100% rename from cocos/base/CCInteger.h rename to cocos/deprecated/CCInteger.h diff --git a/cocos/2d/CCNotificationCenter.cpp b/cocos/deprecated/CCNotificationCenter.cpp similarity index 99% rename from cocos/2d/CCNotificationCenter.cpp rename to cocos/deprecated/CCNotificationCenter.cpp index c6cccb2f12..9fee5f76b4 100644 --- a/cocos/2d/CCNotificationCenter.cpp +++ b/cocos/deprecated/CCNotificationCenter.cpp @@ -25,7 +25,7 @@ THE SOFTWARE. ****************************************************************************/ #include "CCNotificationCenter.h" -#include "CCArray.h" +#include "deprecated/CCArray.h" #include "CCScriptSupport.h" #include diff --git a/cocos/2d/CCNotificationCenter.h b/cocos/deprecated/CCNotificationCenter.h similarity index 99% rename from cocos/2d/CCNotificationCenter.h rename to cocos/deprecated/CCNotificationCenter.h index a675459981..fa763b7969 100644 --- a/cocos/2d/CCNotificationCenter.h +++ b/cocos/deprecated/CCNotificationCenter.h @@ -28,12 +28,13 @@ THE SOFTWARE. #define __CCNOTIFICATIONCENTER_H__ #include "CCRef.h" -#include "CCArray.h" #include "ccTypes.h" NS_CC_BEGIN +class __Array; class ScriptHandlerMgr; + class CC_DLL __NotificationCenter : public Ref { friend class ScriptHandlerMgr; diff --git a/cocos/base/CCSet.cpp b/cocos/deprecated/CCSet.cpp similarity index 100% rename from cocos/base/CCSet.cpp rename to cocos/deprecated/CCSet.cpp diff --git a/cocos/base/CCSet.h b/cocos/deprecated/CCSet.h similarity index 100% rename from cocos/base/CCSet.h rename to cocos/deprecated/CCSet.h diff --git a/cocos/base/CCString.cpp b/cocos/deprecated/CCString.cpp similarity index 99% rename from cocos/base/CCString.cpp rename to cocos/deprecated/CCString.cpp index 7298023df3..34194426e7 100644 --- a/cocos/base/CCString.cpp +++ b/cocos/deprecated/CCString.cpp @@ -23,7 +23,7 @@ Copyright (c) 2013-2014 Chukong Technologies THE SOFTWARE. ****************************************************************************/ -#include "CCString.h" +#include "deprecated/CCString.h" #include "platform/CCFileUtils.h" #include "ccMacros.h" #include diff --git a/cocos/base/CCString.h b/cocos/deprecated/CCString.h similarity index 100% rename from cocos/base/CCString.h rename to cocos/deprecated/CCString.h diff --git a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp index 53507b16ec..7c914765f0 100644 --- a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp +++ b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp @@ -4,11 +4,13 @@ #include "CCBReader.h" #include "CCBKeyframe.h" #include "CCNode+CCBRelativePositioning.h" -#include -#include #include "SimpleAudioEngine.h" #include "CCBSelectorResolver.h" +#include +#include +#include + using namespace cocos2d; using namespace std; using namespace cocos2d::extension; diff --git a/cocos/editor-support/cocosbuilder/CCBReader.cpp b/cocos/editor-support/cocosbuilder/CCBReader.cpp index c915518788..ff535a213c 100644 --- a/cocos/editor-support/cocosbuilder/CCBReader.cpp +++ b/cocos/editor-support/cocosbuilder/CCBReader.cpp @@ -16,14 +16,12 @@ #include "CCBAnimationManager.h" #include "CCBSequenceProperty.h" #include "CCBKeyframe.h" +#include - - -using namespace std; using namespace cocos2d; using namespace cocos2d::extension; -namespace cocosbuilder {; +namespace cocosbuilder { /************************************************************************* Implementation of CCBFile @@ -182,12 +180,12 @@ CCBSelectorResolver * CCBReader::getCCBSelectorResolver() { return this->_CCBSelectorResolver; } -set* CCBReader::getAnimatedProperties() +std::set* CCBReader::getAnimatedProperties() { return _animatedProps; } -set& CCBReader::getLoadedSpriteSheet() +std::set& CCBReader::getLoadedSpriteSheet() { return _loadedSpriteSheets; } @@ -551,7 +549,7 @@ Node * CCBReader::readNodeGraph(Node * pParent) // Read animated properties std::unordered_map> seqs; - _animatedProps = new set(); + _animatedProps = new std::set(); int numSequence = readInt(false); for (int i = 0; i < numSequence; ++i) diff --git a/cocos/editor-support/cocosbuilder/CCBSequence.cpp b/cocos/editor-support/cocosbuilder/CCBSequence.cpp index 20a7c49ab0..3496c3e857 100644 --- a/cocos/editor-support/cocosbuilder/CCBSequence.cpp +++ b/cocos/editor-support/cocosbuilder/CCBSequence.cpp @@ -11,8 +11,8 @@ CCBSequence::CCBSequence() , _name("") , mSequenceId(0) , mChainedSequenceId(0) -, mCallbackChannel(NULL) -, mSoundChannel(NULL) +, mCallbackChannel(nullptr) +, mSoundChannel(nullptr) {} CCBSequence::~CCBSequence() { diff --git a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp index 5cb003b629..985c528c85 100644 --- a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp @@ -40,7 +40,7 @@ void LabelTTFLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, con void LabelTTFLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) { - ((Label *)pNode)->setFontName(pFontTTF); + ((Label *)pNode)->setSystemFontName(pFontTTF); } else { NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader); } @@ -56,7 +56,7 @@ void LabelTTFLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const ch void LabelTTFLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) { - ((Label *)pNode)->setFontSize(pFloatScale); + ((Label *)pNode)->setSystemFontSize(pFloatScale); } else { NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, ccbReader); } diff --git a/cocos/editor-support/cocostudio/CCDatas.cpp b/cocos/editor-support/cocostudio/CCDatas.cpp index 9c7454abf9..b1f718f6a0 100644 --- a/cocos/editor-support/cocostudio/CCDatas.cpp +++ b/cocos/editor-support/cocostudio/CCDatas.cpp @@ -251,7 +251,7 @@ FrameData::FrameData(void) , duration(1) , tweenEasing(cocos2d::tweenfunc::Linear) , easingParamNumber(0) - , easingParams(NULL) + , easingParams(nullptr) , isTween(true) , displayIndex(0) , blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED) diff --git a/cocos/editor-support/cocostudio/CCInputDelegate.h b/cocos/editor-support/cocostudio/CCInputDelegate.h index 258be8466d..a17440b96c 100644 --- a/cocos/editor-support/cocostudio/CCInputDelegate.h +++ b/cocos/editor-support/cocostudio/CCInputDelegate.h @@ -31,7 +31,10 @@ THE SOFTWARE. #include "ccTypes.h" #include "CCEventKeyboard.h" #include "CCEventListener.h" -#include "CCSet.h" + +namespace cocos2d { + class __Set; +} namespace cocostudio { diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.cpp b/cocos/editor-support/cocostudio/CCSSceneReader.cpp index c46c5c6c1e..278b09691a 100644 --- a/cocos/editor-support/cocostudio/CCSSceneReader.cpp +++ b/cocos/editor-support/cocostudio/CCSSceneReader.cpp @@ -56,6 +56,7 @@ const char* SceneReader::sceneReaderVersion() cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName, AttachComponentType attachComponent /*= AttachComponentType::EMPTY_NODE*/) { + _node = nullptr; rapidjson::Document jsonDict; do { CC_BREAK_IF(!readJson(fileName, jsonDict)); diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index cc0b2ccfcd..192167d68a 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -43,7 +43,6 @@ #include "chipmunk/CCPhysicsHelper_chipmunk.h" #include "CCDrawNode.h" -#include "CCArray.h" #include "CCScene.h" #include "CCDirector.h" #include "CCEventDispatcher.h" diff --git a/cocos/scripting/lua-bindings/auto/api/Console.lua b/cocos/scripting/lua-bindings/auto/api/Console.lua new file mode 100644 index 0000000000..8e1e152828 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/Console.lua @@ -0,0 +1,26 @@ + +-------------------------------- +-- @module Console + +-------------------------------- +-- @function [parent=#Console] stop +-- @param self + +-------------------------------- +-- @function [parent=#Console] listenOnTCP +-- @param self +-- @param #int int +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#Console] listenOnFileDescriptor +-- @param self +-- @param #int int +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#Console] log +-- @param self +-- @param #char char + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Label.lua b/cocos/scripting/lua-bindings/auto/api/Label.lua index c923a84da5..1b293d2e66 100644 --- a/cocos/scripting/lua-bindings/auto/api/Label.lua +++ b/cocos/scripting/lua-bindings/auto/api/Label.lua @@ -18,16 +18,16 @@ -- @param #unsigned int int -- @param #unsigned int int --------------------------------- --- @function [parent=#Label] getFontSize --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Label] getString -- @param self -- @return string#string ret (return value: string) +-------------------------------- +-- @function [parent=#Label] getHeight +-- @param self +-- @return unsigned int#unsigned int ret (return value: unsigned int) + -------------------------------- -- @function [parent=#Label] disableEffect -- @param self @@ -47,11 +47,6 @@ -- @param self -- @param #unsigned int int --------------------------------- --- @function [parent=#Label] setFontName --- @param self --- @param #string str - -------------------------------- -- @function [parent=#Label] getMaxLineWidth -- @param self @@ -73,9 +68,9 @@ -- @param #string str -------------------------------- --- @function [parent=#Label] getHeight +-- @function [parent=#Label] setSystemFontName -- @param self --- @return unsigned int#unsigned int ret (return value: unsigned int) +-- @param #string str -------------------------------- -- @function [parent=#Label] setBMFontFilePath @@ -90,14 +85,9 @@ -- @return FontAtlas#FontAtlas ret (return value: cc.FontAtlas) -------------------------------- --- @function [parent=#Label] getFontDefinition +-- @function [parent=#Label] setSystemFontSize -- @param self --- @return FontDefinition#FontDefinition ret (return value: cc.FontDefinition) - --------------------------------- --- @function [parent=#Label] getFontName --- @param self --- @return string#string ret (return value: string) +-- @param #float float -------------------------------- -- @function [parent=#Label] updateContent @@ -149,15 +139,20 @@ -- @param self -- @param #unsigned int int +-------------------------------- +-- @function [parent=#Label] getSystemFontName +-- @param self +-- @return string#string ret (return value: string) + -------------------------------- -- @function [parent=#Label] setVerticalAlignment -- @param self -- @param #cc.TextVAlignment textvalignment -------------------------------- --- @function [parent=#Label] setFontSize +-- @function [parent=#Label] getTTFConfig -- @param self --- @param #float float +-- @return _ttfConfig#_ttfConfig ret (return value: cc._ttfConfig) -------------------------------- -- @function [parent=#Label] getVerticalAlignment @@ -190,6 +185,11 @@ -- @param #int int -- @return Sprite#Sprite ret (return value: cc.Sprite) +-------------------------------- +-- @function [parent=#Label] getSystemFontSize +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Label] getTextAlignment -- @param self @@ -205,11 +205,6 @@ -- @param self -- @param #cc.TextHAlignment texthalignment --------------------------------- --- @function [parent=#Label] setFontDefinition --- @param self --- @param #cc.FontDefinition fontdefinition - -------------------------------- -- overload function: setAlignment(cc.TextHAlignment, cc.TextVAlignment) -- @@ -231,20 +226,10 @@ -- @return Label#Label ret (return value: cc.Label) -------------------------------- --- overload function: create(string, string, float, size_table, cc.TextHAlignment, cc.TextVAlignment) --- --- overload function: create() --- --- @function [parent=#Label] create +-- @function [parent=#Label] create -- @param self --- @param #string str --- @param #string str --- @param #float float --- @param #size_table size --- @param #cc.TextHAlignment texthalignment --- @param #cc.TextVAlignment textvalignment --- @return Label#Label ret (retunr value: cc.Label) - +-- @return Label#Label ret (return value: cc.Label) + -------------------------------- -- overload function: createWithCharMap(cc.Texture2D, int, int, int) -- @@ -261,10 +246,14 @@ -- @return Label#Label ret (retunr value: cc.Label) -------------------------------- --- @function [parent=#Label] createWithFontDefinition +-- @function [parent=#Label] createWithSystemFont -- @param self -- @param #string str --- @param #cc.FontDefinition fontdefinition +-- @param #string str +-- @param #float float +-- @param #size_table size +-- @param #cc.TextHAlignment texthalignment +-- @param #cc.TextVAlignment textvalignment -- @return Label#Label ret (return value: cc.Label) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/api/Scheduler.lua b/cocos/scripting/lua-bindings/auto/api/Scheduler.lua index 70b3d2a20f..c8a85b0373 100644 --- a/cocos/scripting/lua-bindings/auto/api/Scheduler.lua +++ b/cocos/scripting/lua-bindings/auto/api/Scheduler.lua @@ -8,11 +8,6 @@ -- @param self -- @param #float float --------------------------------- --- @function [parent=#Scheduler] performFunctionInCocosThread --- @param self --- @param #function func - -------------------------------- -- @function [parent=#Scheduler] getTimeScale -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua b/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua index 2a7a74fef6..3853f289c5 100644 --- a/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua @@ -8,32 +8,6 @@ -- @param self -- @param #cc.Sprite sprite --------------------------------- --- @function [parent=#SpriteBatchNode] reorderBatch --- @param self --- @param #bool bool - --------------------------------- --- @function [parent=#SpriteBatchNode] getTexture --- @param self --- @return Texture2D#Texture2D ret (return value: cc.Texture2D) - --------------------------------- --- @function [parent=#SpriteBatchNode] setTexture --- @param self --- @param #cc.Texture2D texture2d - --------------------------------- --- @function [parent=#SpriteBatchNode] removeChildAtIndex --- @param self --- @param #long long --- @param #bool bool - --------------------------------- --- @function [parent=#SpriteBatchNode] removeSpriteFromAtlas --- @param self --- @param #cc.Sprite sprite - -------------------------------- -- @function [parent=#SpriteBatchNode] addSpriteWithoutQuad -- @param self @@ -43,56 +17,58 @@ -- @return SpriteBatchNode#SpriteBatchNode ret (return value: cc.SpriteBatchNode) -------------------------------- --- @function [parent=#SpriteBatchNode] atlasIndexForChild +-- @function [parent=#SpriteBatchNode] reorderBatch -- @param self --- @param #cc.Sprite sprite --- @param #int int --- @return long#long ret (return value: long) - --------------------------------- --- @function [parent=#SpriteBatchNode] increaseAtlasCapacity --- @param self - --------------------------------- --- overload function: init() --- --- overload function: init(string, long) --- --- @function [parent=#SpriteBatchNode] init --- @param self --- @param #string str --- @param #long long --- @return bool#bool ret (retunr value: bool) - --------------------------------- --- @function [parent=#SpriteBatchNode] lowestAtlasIndexInChild --- @param self --- @param #cc.Sprite sprite --- @return long#long ret (return value: long) - --------------------------------- --- @function [parent=#SpriteBatchNode] initWithTexture --- @param self --- @param #cc.Texture2D texture2d --- @param #long long --- @return bool#bool ret (return value: bool) - --------------------------------- --- @function [parent=#SpriteBatchNode] setTextureAtlas --- @param self --- @param #cc.TextureAtlas textureatlas +-- @param #bool bool -------------------------------- -- @function [parent=#SpriteBatchNode] removeAllChildrenWithCleanup -- @param self -- @param #bool bool +-------------------------------- +-- @function [parent=#SpriteBatchNode] lowestAtlasIndexInChild +-- @param self +-- @param #cc.Sprite sprite +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#SpriteBatchNode] atlasIndexForChild +-- @param self +-- @param #cc.Sprite sprite +-- @param #int int +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#SpriteBatchNode] setTextureAtlas +-- @param self +-- @param #cc.TextureAtlas textureatlas + +-------------------------------- +-- @function [parent=#SpriteBatchNode] getTexture +-- @param self +-- @return Texture2D#Texture2D ret (return value: cc.Texture2D) + +-------------------------------- +-- @function [parent=#SpriteBatchNode] increaseAtlasCapacity +-- @param self + +-------------------------------- +-- @function [parent=#SpriteBatchNode] getTextureAtlas +-- @param self +-- @return TextureAtlas#TextureAtlas ret (return value: cc.TextureAtlas) + -------------------------------- -- @function [parent=#SpriteBatchNode] insertQuadFromSprite -- @param self -- @param #cc.Sprite sprite -- @param #long long +-------------------------------- +-- @function [parent=#SpriteBatchNode] setTexture +-- @param self +-- @param #cc.Texture2D texture2d + -------------------------------- -- @function [parent=#SpriteBatchNode] rebuildIndexInOrder -- @param self @@ -100,17 +76,23 @@ -- @param #long long -- @return long#long ret (return value: long) --------------------------------- --- @function [parent=#SpriteBatchNode] getTextureAtlas --- @param self --- @return TextureAtlas#TextureAtlas ret (return value: cc.TextureAtlas) - -------------------------------- -- @function [parent=#SpriteBatchNode] highestAtlasIndexInChild -- @param self -- @param #cc.Sprite sprite -- @return long#long ret (return value: long) +-------------------------------- +-- @function [parent=#SpriteBatchNode] removeChildAtIndex +-- @param self +-- @param #long long +-- @param #bool bool + +-------------------------------- +-- @function [parent=#SpriteBatchNode] removeSpriteFromAtlas +-- @param self +-- @param #cc.Sprite sprite + -------------------------------- -- @function [parent=#SpriteBatchNode] create -- @param self @@ -167,8 +149,4 @@ -- @param #cc.Node node -- @param #int int --------------------------------- --- @function [parent=#SpriteBatchNode] SpriteBatchNode --- @param self - return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 9d744bb31f..aa6badd186 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -6,6 +6,11 @@ -- @field [parent=#cc] Ref#Ref Ref preloaded module +-------------------------------------------------------- +-- the cc Console +-- @field [parent=#cc] Console#Console Console preloaded module + + -------------------------------------------------------- -- the cc Action -- @field [parent=#cc] Action#Action Action preloaded module diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id index 1e41284f45..97ed386aba 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -0df0891de897f9c846c5a731531bc371604ad381 \ No newline at end of file +877f92ef1788ddee60729373e99035e25a6cdb5c \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp b/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp index d0e9eefc94..62999bead9 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp @@ -26,8 +26,6 @@ #include "CCLuaEngine.h" #include "tolua_fix.h" #include "cocos2d.h" -#include "CCArray.h" -#include "CCScheduler.h" #include "extensions/GUI/CCControlExtension/CCControl.h" #include "LuaOpengl.h" #include "lua_cocos2dx_manual.hpp" @@ -37,7 +35,7 @@ NS_CC_BEGIN -LuaEngine* LuaEngine::_defaultEngine = NULL; +LuaEngine* LuaEngine::_defaultEngine = nullptr; LuaEngine* LuaEngine::getInstance(void) { @@ -52,7 +50,7 @@ LuaEngine* LuaEngine::getInstance(void) LuaEngine::~LuaEngine(void) { CC_SAFE_RELEASE(_stack); - _defaultEngine = NULL; + _defaultEngine = nullptr; } bool LuaEngine::init(void) diff --git a/cocos/scripting/lua-bindings/manual/CCLuaEngine.h b/cocos/scripting/lua-bindings/manual/CCLuaEngine.h index 197a05b94d..2633234547 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaEngine.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaEngine.h @@ -131,7 +131,7 @@ public: virtual int handleEvent(ScriptHandlerMgr::HandlerType type, void* data, int numResults, const std::function& func); private: LuaEngine(void) - : _stack(NULL) + : _stack(nullptr) { } bool init(void); diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.h b/cocos/scripting/lua-bindings/manual/CCLuaStack.h index 5f89ad4a15..566dbe8e30 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.h @@ -131,7 +131,7 @@ public: protected: LuaStack(void) - : _state(NULL) + : _state(nullptr) , _callFromLua(0) { } diff --git a/cocos/scripting/lua-bindings/manual/CCLuaValue.h b/cocos/scripting/lua-bindings/manual/CCLuaValue.h index 2a915789f6..16d757822c 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaValue.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaValue.h @@ -90,7 +90,7 @@ public: LuaValue(void) : _type(LuaValueTypeInt) - , _ccobjectType(NULL) + , _ccobjectType(nullptr) { memset(&_field, 0, sizeof(_field)); } diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp.REMOVED.git-id index 42a8fbc2d5..c6600f056d 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp.REMOVED.git-id @@ -1 +1 @@ -48b548727f5f4ae9112bdb75069ad09641dcf643 \ No newline at end of file +468c9e8472db4be2923ca63484bc72ba2a30ae88 \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index 1343c3b7c0..92750fe0e5 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -852,7 +852,7 @@ USE_FILE32API, "CC_ENABLE_CHIPMUNK_INTEGRATION=1", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -868,7 +868,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua"; }; name = Debug; }; @@ -886,6 +886,7 @@ NDEBUG, USE_FILE32API, ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -900,7 +901,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua"; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/cocos/ui/GUIDefine.h b/cocos/ui/GUIDefine.h index 58fd787fbc..0fcdccc8a0 100644 --- a/cocos/ui/GUIDefine.h +++ b/cocos/ui/GUIDefine.h @@ -70,10 +70,4 @@ cocostudio::ObjectFactory::TInfo(#className, &className::createInstance) \ - - - -//#define CUSTOM_GUI_PARSE_FUNCTION(className, functionName) \ -// className::functionName \ - #endif /* defined(__TestCpp__GUIDefine__) */ diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 7db30e09ff..cff34e84ec 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -689,22 +689,22 @@ const Color3B& Button::getTitleColor() const void Button::setTitleFontSize(float size) { - _titleRenderer->setFontSize(size); + _titleRenderer->setSystemFontSize(size); } float Button::getTitleFontSize() const { - return _titleRenderer->getFontSize(); + return _titleRenderer->getSystemFontSize(); } void Button::setTitleFontName(const std::string& fontName) { - _titleRenderer->setFontName(fontName); + _titleRenderer->setSystemFontName(fontName); } const std::string& Button::getTitleFontName() const { - return _titleRenderer->getFontName(); + return _titleRenderer->getSystemFontName(); } std::string Button::getDescription() const diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 178ca2870e..a3dc6a0245 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -126,11 +126,9 @@ bool RichElementCustomNode::init(int tag, const Color3B &color, GLubyte opacity, RichText::RichText(): _formatTextDirty(true), -_richElements(NULL), -_elementRenders(NULL), _leftSpaceWidth(0.0f), _verticalSpace(0.0f), -_elementRenderersContainer(NULL) +_elementRenderersContainer(nullptr) { } @@ -210,7 +208,15 @@ void RichText::formatText() case RICH_TEXT: { RichElementText* elmtText = static_cast(element); - elementRenderer = Label::create(elmtText->_text.c_str(), elmtText->_fontName.c_str(), elmtText->_fontSize); + if (FileUtils::getInstance()->isFileExist(elmtText->_fontName)) + { + elementRenderer = Label::createWithTTF(elmtText->_text.c_str(), elmtText->_fontName, elmtText->_fontSize); + } + else + { + elementRenderer = Label::createWithSystemFont(elmtText->_text.c_str(), elmtText->_fontName, elmtText->_fontSize); + } + break; } case RICH_IMAGE: @@ -272,7 +278,16 @@ void RichText::formatText() void RichText::handleTextRenderer(const char *text, const char *fontName, float fontSize, const Color3B &color, GLubyte opacity) { - Label* textRenderer = Label::create(text, fontName, fontSize); + auto fileExist = FileUtils::getInstance()->isFileExist(fontName); + Label* textRenderer = nullptr; + if (fileExist) + { + textRenderer = Label::createWithTTF(text, fontName, fontSize); + } + else + { + textRenderer = Label::createWithSystemFont(text, fontName, fontSize); + } float textRendererWidth = textRenderer->getContentSize().width; _leftSpaceWidth -= textRendererWidth; if (_leftSpaceWidth < 0.0f) @@ -285,10 +300,21 @@ void RichText::handleTextRenderer(const char *text, const char *fontName, float std::string cutWords = curText.substr(leftLength, curText.length()-1); if (leftLength > 0) { - Label* leftRenderer = Label::create(leftWords.substr(0, leftLength).c_str(), fontName, fontSize); - leftRenderer->setColor(color); - leftRenderer->setOpacity(opacity); - pushToContainer(leftRenderer); + Label* leftRenderer = nullptr; + if (fileExist) + { + leftRenderer = Label::createWithTTF(leftWords.substr(0, leftLength).c_str(), fontName, fontSize); + } + else + { + leftRenderer = Label::createWithSystemFont(leftWords.substr(0, leftLength).c_str(), fontName, fontSize); + } + if (leftRenderer) + { + leftRenderer->setColor(color); + leftRenderer->setOpacity(opacity); + pushToContainer(leftRenderer); + } } addNewLine(); diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 1e504a52e7..d1e3d711b2 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -120,7 +120,7 @@ ssize_t Text::getStringLength() void Text::setFontSize(int size) { _fontSize = size; - _labelRenderer->setFontSize(size); + _labelRenderer->setSystemFontSize(size); labelScaleChangedWithSize(); } @@ -132,7 +132,7 @@ int Text::getFontSize() void Text::setFontName(const std::string& name) { _fontName = name; - _labelRenderer->setFontName(name); + _labelRenderer->setSystemFontName(name); labelScaleChangedWithSize(); } @@ -314,7 +314,7 @@ void Text::copySpecialProperties(Widget *widget) if (label) { setFontName(label->_fontName); - setFontSize(label->_labelRenderer->getFontSize()); + setFontSize(label->_labelRenderer->getSystemFontSize()); setText(label->getStringValue()); setTouchScaleChangeEnabled(label->_touchScaleChangeEnabled); setTextHorizontalAlignment(label->_labelRenderer->getHorizontalAlignment()); diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index b9878a20d4..b96ef54dae 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -531,24 +531,24 @@ const std::string& TextField::getPlaceHolder() void TextField::setFontSize(int size) { - _textFieldRenderer->setFontSize(size); + _textFieldRenderer->setSystemFontSize(size); textfieldRendererScaleChangedWithSize(); } int TextField::getFontSize() { - return _textFieldRenderer->getFontSize(); + return _textFieldRenderer->getSystemFontSize(); } void TextField::setFontName(const std::string& name) { - _textFieldRenderer->setFontName(name); + _textFieldRenderer->setSystemFontName(name); textfieldRendererScaleChangedWithSize(); } const std::string& TextField::getFontName() { - return _textFieldRenderer->getFontName(); + return _textFieldRenderer->getSystemFontName(); } void TextField::didNotSelectSelf() @@ -806,8 +806,8 @@ void TextField::copySpecialProperties(Widget *widget) { setText(textField->_textFieldRenderer->getString()); setPlaceHolder(textField->getStringValue()); - setFontSize(textField->_textFieldRenderer->getFontSize()); - setFontName(textField->_textFieldRenderer->getFontName().c_str()); + setFontSize(textField->_textFieldRenderer->getSystemFontSize()); + setFontName(textField->_textFieldRenderer->getSystemFontName()); setMaxLengthEnabled(textField->isMaxLengthEnabled()); setMaxLength(textField->getMaxLength()); setPasswordEnabled(textField->isPasswordEnabled()); diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index b491ba674a..bdd2adcbfe 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -64,7 +64,7 @@ ControlButton::~ControlButton() bool ControlButton::init() { - return this->initWithLabelAndBackgroundSprite(Label::create("", "Helvetica", 12), Scale9Sprite::create()); + return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), Scale9Sprite::create()); } bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* backgroundSprite) @@ -131,8 +131,7 @@ ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize) { - Label *label = Label::create(title, fontName, fontSize); - return initWithLabelAndBackgroundSprite(label, Scale9Sprite::create()); + return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), Scale9Sprite::create()); } ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize) @@ -145,7 +144,7 @@ ControlButton* ControlButton::create(const std::string& title, const std::string bool ControlButton::initWithBackgroundSprite(Scale9Sprite* sprite) { - Label *label = Label::create("", "Arial", 30);// + Label *label = Label::createWithSystemFont("", "Arial", 30);// return initWithLabelAndBackgroundSprite(label, sprite); } @@ -359,10 +358,9 @@ void ControlButton::setTitleLabelForState(Node* titleLabel, State state) } } -void ControlButton::setTitleTTFForState(const std::string& fntFile, State state) +void ControlButton::setTitleTTFForState(const std::string& fontName, State state) { - std::string title = this->getTitleForState(state); - this->setTitleLabelForState(Label::create(title, fntFile, 12), state); + this->setTitleLabelForState(Label::createWithSystemFont(getTitleForState(state), fontName, 12), state); } const std::string& ControlButton::getTitleTTFForState(State state) @@ -371,7 +369,7 @@ const std::string& ControlButton::getTitleTTFForState(State state) Label* labelTTF = dynamic_cast(label); if(labelTTF != 0) { - return labelTTF->getFontName(); + return labelTTF->getSystemFontName(); } static std::string ret(""); @@ -386,7 +384,7 @@ void ControlButton::setTitleTTFSizeForState(float size, State state) Label* labelTTF = dynamic_cast(label); if(labelTTF != 0) { - return labelTTF->setFontSize(size); + return labelTTF->setSystemFontSize(size); } } } @@ -397,7 +395,7 @@ float ControlButton::getTitleTTFSizeForState(State state) Label* labelTTF = dynamic_cast(label); if(labelTTF != 0) { - return labelTTF->getFontSize(); + return labelTTF->getSystemFontSize(); } else { diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp index b88561ab17..2a258340e9 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp @@ -36,9 +36,9 @@ NS_CC_EXT_BEGIN ControlColourPicker::ControlColourPicker() -: _colourPicker(NULL) -, _huePicker(NULL) -, _background(NULL) +: _colourPicker(nullptr) +, _huePicker(nullptr) +, _background(nullptr) { } diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index 6e5600edf0..46e6af7172 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -36,8 +36,8 @@ NS_CC_EXT_BEGIN ControlHuePicker::ControlHuePicker() : _hue(0.0f) , _huePercentage(0.0f) -, _background(NULL) -, _slider(NULL) +, _background(nullptr) +, _slider(nullptr) { } diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp index b813750887..c11eb6933f 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp @@ -33,8 +33,8 @@ ControlPotentiometer::ControlPotentiometer() : _value(0.0f) , _minimumValue(0.0f) , _maximumValue(0.0f) -, _thumbSprite(NULL) -, _progressTimer(NULL) +, _thumbSprite(nullptr) +, _progressTimer(nullptr) { } diff --git a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index 4d59fca00d..e51015219a 100644 --- a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -36,10 +36,10 @@ NS_CC_EXT_BEGIN ControlSaturationBrightnessPicker::ControlSaturationBrightnessPicker() : _saturation(0.0f) , _brightness(0.0f) -, _background(NULL) -, _overlay(NULL) -, _shadow(NULL) -, _slider(NULL) +, _background(nullptr) +, _overlay(nullptr) +, _shadow(nullptr) +, _slider(nullptr) , boxPos(0) , boxSize(0) { diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/extensions/GUI/CCControlExtension/CCControlSlider.cpp index ace6ef2cec..9d82407262 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -39,10 +39,10 @@ ControlSlider::ControlSlider() , _maximumValue(0.0f) , _minimumAllowedValue(0.0f) , _maximumAllowedValue(0.0f) -, _thumbSprite(NULL) -, _selectedThumbSprite(NULL) -, _progressSprite(NULL) -, _backgroundSprite(NULL) +, _thumbSprite(nullptr) +, _selectedThumbSprite(nullptr) +, _progressSprite(nullptr) +, _backgroundSprite(nullptr) { } diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f299cc0bc9..5000951e3e 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -49,10 +49,10 @@ ControlStepper::ControlStepper() , _touchInsideFlag(false) , _touchedPart(Part::NONE) , _autorepeatCount(0) -, _minusSprite(NULL) -, _plusSprite(NULL) -, _minusLabel(NULL) -, _plusLabel(NULL) +, _minusSprite(nullptr) +, _plusSprite(nullptr) +, _minusLabel(nullptr) +, _plusLabel(nullptr) { } @@ -89,7 +89,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit _minusSprite->setPosition( Point(minusSprite->getContentSize().width / 2, minusSprite->getContentSize().height / 2) ); this->addChild(_minusSprite); - this->setMinusLabel( Label::create("-", ControlStepperLabelFont, 40)); + this->setMinusLabel( Label::createWithSystemFont("-", ControlStepperLabelFont, 40)); _minusLabel->setColor(ControlStepperLabelColorDisabled); _minusLabel->setAnchorPoint(Point::ANCHOR_MIDDLE); _minusLabel->setPosition(Point(_minusSprite->getContentSize().width / 2, _minusSprite->getContentSize().height / 2) ); @@ -101,7 +101,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit minusSprite->getContentSize().height / 2) ); this->addChild(_plusSprite); - this->setPlusLabel( Label::create("+", ControlStepperLabelFont, 40 )); + this->setPlusLabel( Label::createWithSystemFont("+", ControlStepperLabelFont, 40 )); _plusLabel->setColor( ControlStepperLabelColorEnabled ); _plusLabel->setAnchorPoint(Point::ANCHOR_MIDDLE); _plusLabel->setPosition( Point(_plusSprite->getContentSize().width / 2, _plusSprite->getContentSize().height / 2) ); diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp index ec8253e7bf..1504a42cbd 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp @@ -139,14 +139,14 @@ ControlSwitchSprite::ControlSwitchSprite() : _sliderXPosition(0.0f) , _onPosition(0.0f) , _offPosition(0.0f) -, _maskTexture(NULL) +, _maskTexture(nullptr) , _textureLocation(0) , _maskLocation(0) -, _onSprite(NULL) -, _offSprite(NULL) -, _thumbSprite(NULL) -, _onLabel(NULL) -, _offLabel(NULL) +, _onSprite(nullptr) +, _offSprite(nullptr) +, _thumbSprite(nullptr) +, _onLabel(nullptr) +, _offLabel(nullptr) , _clipperStencil(nullptr) { @@ -276,7 +276,7 @@ float ControlSwitchSprite::offSideWidth() // ControlSwitch ControlSwitch::ControlSwitch() -: _switchSprite(NULL) +: _switchSprite(nullptr) , _initialTouchXPosition(0.0f) , _moved(false) , _on(false) diff --git a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp index 2f8437cd19..07273bc782 100644 --- a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp +++ b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp @@ -49,16 +49,16 @@ Scale9Sprite::Scale9Sprite() : _spritesGenerated(false) , _spriteFrameRotated(false) , _positionsAreDirty(false) -, _scale9Image(NULL) -, _topLeft(NULL) -, _top(NULL) -, _topRight(NULL) -, _left(NULL) -, _centre(NULL) -, _right(NULL) -, _bottomLeft(NULL) -, _bottom(NULL) -, _bottomRight(NULL) +, _scale9Image(nullptr) +, _topLeft(nullptr) +, _top(nullptr) +, _topRight(nullptr) +, _left(nullptr) +, _centre(nullptr) +, _right(nullptr) +, _bottomLeft(nullptr) +, _bottom(nullptr) +, _bottomRight(nullptr) , _opacityModifyRGB(false) , _insetLeft(0) , _insetTop(0) diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index 32f37f6e4f..cc6c0edfb4 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -31,8 +31,8 @@ NS_CC_EXT_BEGIN static const float CHECK_EDITBOX_POSITION_INTERVAL = 0.1f; EditBox::EditBox(void) -: _editBoxImpl(NULL) -, _delegate(NULL) +: _editBoxImpl(nullptr) +, _delegate(nullptr) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(KeyboardReturnType::DEFAULT) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImpl.h b/extensions/GUI/CCEditBox/CCEditBoxImpl.h index b066ac7550..91b229cf0a 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImpl.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImpl.h @@ -38,7 +38,7 @@ public: /** * @js NA */ - EditBoxImpl(EditBox* pEditBox) : _delegate(NULL),_editBox(pEditBox) {} + EditBoxImpl(EditBox* pEditBox) : _delegate(nullptr),_editBox(pEditBox) {} /** * @js NA * @lua NA diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index f46499e44c..173c32b994 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -41,8 +41,8 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) EditBoxImplAndroid::EditBoxImplAndroid(EditBox* pEditText) : EditBoxImpl(pEditText) -, _label(NULL) -, _labelPlaceHolder(NULL) +, _label(nullptr) +, _labelPlaceHolder(nullptr) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) @@ -69,7 +69,7 @@ bool EditBoxImplAndroid::initWithSize(const Size& size) { int fontSize = getFontSizeAccordingHeightJni(size.height-12); _label = Label::create(); - _label->setFontSize(size.height-12); + _label->setSystemFontSize(size.height-12); // align the text vertically center _label->setAnchorPoint(Point(0, 0.5f)); _label->setPosition(Point(CC_EDIT_BOX_PADDING, size.height / 2.0f)); @@ -77,7 +77,7 @@ bool EditBoxImplAndroid::initWithSize(const Size& size) _editBox->addChild(_label); _labelPlaceHolder = Label::create(); - _labelPlaceHolder->setFontSize(size.height-12); + _labelPlaceHolder->setSystemFontSize(size.height-12); // align the text vertically center _labelPlaceHolder->setAnchorPoint(Point(0, 0.5f)); _labelPlaceHolder->setPosition(Point(CC_EDIT_BOX_PADDING, size.height / 2.0f)); @@ -92,13 +92,13 @@ bool EditBoxImplAndroid::initWithSize(const Size& size) void EditBoxImplAndroid::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setFontName(pFontName); - _label->setFontSize(fontSize); + _label->setSystemFontName(pFontName); + _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFontName(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } @@ -111,8 +111,8 @@ void EditBoxImplAndroid::setFontColor(const Color3B& color) void EditBoxImplAndroid::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFontName(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index d2ba95be02..2befae216a 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -68,12 +68,11 @@ static const int CC_EDIT_BOX_PADDING = 5; { self = [super init]; - do + if (self) { - if (self == nil) break; editState_ = NO; self.textField = [[[CCCustomUITextField alloc] initWithFrame: frameRect] autorelease]; - if (!textField_) break; + [textField_ setTextColor:[UIColor whiteColor]]; textField_.font = [UIFont systemFontOfSize:frameRect.size.height*2/3]; //TODO need to delete hard code here. textField_.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; @@ -84,13 +83,9 @@ static const int CC_EDIT_BOX_PADDING = 5; textField_.returnKeyType = UIReturnKeyDefault; [textField_ addTarget:self action:@selector(textChanged) forControlEvents:UIControlEventEditingChanged]; self.editBox = editBox; - - - - return self; - }while(0); + } - return nil; + return self; } -(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance @@ -273,10 +268,10 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText) : EditBoxImpl(pEditText) -, _label(NULL) -, _labelPlaceHolder(NULL) +, _label(nullptr) +, _labelPlaceHolder(nullptr) , _anchorPoint(Point(0.5f, 0.5f)) -, _systemControl(NULL) +, _systemControl(nullptr) , _maxTextLength(-1) { auto view = cocos2d::Director::getInstance()->getOpenGLView(); @@ -395,10 +390,10 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) [_systemControl.textField setFont:textFont]; } - _label->setFontName(pFontName); - _label->setFontSize(fontSize); - _labelPlaceHolder->setFontName(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _label->setSystemFontName(pFontName); + _label->setSystemFontSize(fontSize); + _labelPlaceHolder->setSystemFontName(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } void EditBoxImplIOS::setFontColor(const Color3B& color) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 7cf83aa07e..3af3c7448f 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -254,7 +254,7 @@ EditBoxImplMac::EditBoxImplMac(EditBox* pEditText) : EditBoxImpl(pEditText) , _anchorPoint(Point(0.5f, 0.5f)) , _maxTextLength(-1) -, _sysEdit(NULL) +, _sysEdit(nullptr) { //! TODO: Retina on Mac //! _inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index b532285370..421296dce0 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -47,8 +47,8 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) : EditBoxImpl(pEditText) -, _label(NULL) -, _labelPlaceHolder(NULL) +, _label(nullptr) +, _labelPlaceHolder(nullptr) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) @@ -71,7 +71,7 @@ bool EditBoxImplWin::initWithSize(const Size& size) { //! int fontSize = getFontSizeAccordingHeightJni(size.height-12); _label = Label::create(); - _label->setFontSize(size.height-12); + _label->setSystemFontSize(size.height-12); // align the text vertically center _label->setAnchorPoint(Point(0, 0.5f)); _label->setPosition(Point(5, size.height / 2.0f)); @@ -79,7 +79,7 @@ bool EditBoxImplWin::initWithSize(const Size& size) _editBox->addChild(_label); _labelPlaceHolder = Label::create(); - _labelPlaceHolder->setFontSize(size.height-12); + _labelPlaceHolder->setSystemFontSize(size.height-12); // align the text vertically center _labelPlaceHolder->setAnchorPoint(Point(0, 0.5f)); _labelPlaceHolder->setPosition(Point(5, size.height / 2.0f)); @@ -94,13 +94,13 @@ bool EditBoxImplWin::initWithSize(const Size& size) void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setFontName(pFontName); - _label->setFontSize(fontSize); + _label->setSystemFontName(pFontName); + _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFontName(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } @@ -113,8 +113,8 @@ void EditBoxImplWin::setFontColor(const Color3B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFontName(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index 167967e312..64adbb080f 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -96,14 +96,14 @@ void CCEditBoxImplWp8::openKeyboard() bool CCEditBoxImplWp8::initWithSize( const Size& size ) { //! int fontSize = getFontSizeAccordingHeightJni(size.height-12); - m_pLabel = LabelTTF::create("", "", size.height-12); + m_pLabel = Label::createWithSystemFont("", "", size.height-12); // align the text vertically center m_pLabel->setAnchorPoint(Point(0.0f, 0.5f)); m_pLabel->setPosition(Point(5.0, size.height / 2.0f)); m_pLabel->setColor(m_colText); _editBox->addChild(m_pLabel); - m_pLabelPlaceHolder = LabelTTF::create("", "", size.height-12); + m_pLabelPlaceHolder = Label::createWithSystemFont("", "", size.height-12); // align the text vertically center m_pLabelPlaceHolder->setAnchorPoint(Point(0.0f, 0.5f)); m_pLabelPlaceHolder->setPosition(Point(5.0f, size.height / 2.0f)); @@ -118,13 +118,13 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size ) void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize ) { if(m_pLabel != NULL) { - m_pLabel->setFontName(pFontName); - m_pLabel->setFontSize(fontSize); + m_pLabel->setSystemFontName(pFontName); + m_pLabel->setSystemFontSize(fontSize); } if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setFontName(pFontName); - m_pLabelPlaceHolder->setFontSize(fontSize); + m_pLabelPlaceHolder->setSystemFontName(pFontName); + m_pLabelPlaceHolder->setSystemFontSize(fontSize); } } @@ -137,8 +137,8 @@ void CCEditBoxImplWp8::setFontColor( const Color3B& color ) void CCEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize ) { if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setFontName(pFontName); - m_pLabelPlaceHolder->setFontSize(fontSize); + m_pLabelPlaceHolder->setSystemFontName(pFontName); + m_pLabelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h index 4ca838fdd7..a1534d1942 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h @@ -66,8 +66,8 @@ private: std::string PlatformStringTostring(Platform::String^ strSrc); private: - LabelTTF* m_pLabel; - LabelTTF* m_pLabelPlaceHolder; + Label* m_pLabel; + Label* m_pLabelPlaceHolder; EditBox::InputMode m_eEditBoxInputMode; EditBox::InputFlag m_eEditBoxInputFlag; (EditBox::KeyboardReturnType m_eKeyboardReturnType; diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index 51aba846bb..637cd18c98 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -83,9 +83,9 @@ AssetsManager::AssetsManager(const char* packageUrl/* =NULL */, const char* vers , _packageUrl(packageUrl) , _versionFileUrl(versionFileUrl) , _downloadedVersion("") -, _curl(NULL) +, _curl(nullptr) , _connectionTimeout(0) -, _delegate(NULL) +, _delegate(nullptr) , _isDownloading(false) , _shouldDeleteDelegateWhenExit(false) { diff --git a/external/chipmunk/src/cpCollision.c b/external/chipmunk/src/cpCollision.c index 3474dc6700..3b3e4e1138 100644 --- a/external/chipmunk/src/cpCollision.c +++ b/external/chipmunk/src/cpCollision.c @@ -241,9 +241,9 @@ ClosestPointsNew(const struct MinkowskiPoint v0, const struct MinkowskiPoint v1) return points; } else { cpFloat d2 = cpvlength(p); - cpVect n = cpvmult(p, 1.0f/(d2 + CPFLOAT_MIN)); + cpVect n2 = cpvmult(p, 1.0f/(d2 + CPFLOAT_MIN)); - struct ClosestPoints points = {pa, pb, n, d2, id}; + struct ClosestPoints points = {pa, pb, n2, d2, id}; return points; } } diff --git a/external/websockets/include/win32/libwebsockets.h b/external/websockets/include/win32/libwebsockets.h index 001f682528..55d239c269 100644 --- a/external/websockets/include/win32/libwebsockets.h +++ b/external/websockets/include/win32/libwebsockets.h @@ -42,8 +42,6 @@ extern "C" { #define strcasecmp stricmp #define getdtablesize() 30000 -typedef int ssize_t; - #define LWS_VISIBLE #ifdef LWS_DLL diff --git a/external/websockets/include/wp8/libwebsockets.h b/external/websockets/include/wp8/libwebsockets.h index 2f9349d99f..4f4089d773 100644 --- a/external/websockets/include/wp8/libwebsockets.h +++ b/external/websockets/include/wp8/libwebsockets.h @@ -42,7 +42,12 @@ extern "C" { #define strcasecmp stricmp #define getdtablesize() 30000 -typedef int ssize_t; +#include + +#ifndef __SSIZE_T +#define __SSIZE_T + typedef SSIZE_T ssize_t; +#endif // __SSIZE_T #define LWS_VISIBLE diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index a44122a495..3a1d65b0f7 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -31d62e35548799d9402b2c5d8038d2f4313a19a5 \ No newline at end of file +33a592c87db605bac0a2234df142f1dc3222e88f \ No newline at end of file diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt index 39ede511ff..36b268df56 100644 --- a/templates/cpp-template-default/CMakeLists.txt +++ b/templates/cpp-template-default/CMakeLists.txt @@ -58,6 +58,7 @@ include_directories( ${COCOS2D_ROOT}/cocos/2d/platform/desktop ${COCOS2D_ROOT}/cocos/2d/platform/linux ${COCOS2D_ROOT}/cocos/base + ${COCOS2D_ROOT}/cocos/deprecated ${COCOS2D_ROOT}/cocos/physics ${COCOS2D_ROOT}/cocos/editor-support ${COCOS2D_ROOT}/cocos/math/kazmath diff --git a/templates/lua-template-default/frameworks/CMakeLists.txt b/templates/lua-template-default/frameworks/CMakeLists.txt index 79594bf201..82ff1f4fa4 100644 --- a/templates/lua-template-default/frameworks/CMakeLists.txt +++ b/templates/lua-template-default/frameworks/CMakeLists.txt @@ -64,6 +64,7 @@ include_directories( ${COCOS2D_ROOT}/cocos/2d/platform/desktop ${COCOS2D_ROOT}/cocos/2d/platform/linux ${COCOS2D_ROOT}/cocos/base + ${COCOS2D_ROOT}/cocos/deprecated ${COCOS2D_ROOT}/cocos/physics ${COCOS2D_ROOT}/cocos/editor-support ${COCOS2D_ROOT}/cocos/math/kazmath diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp index 9cbdf390e4..fe8e833fff 100644 --- a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp +++ b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp @@ -37,7 +37,7 @@ void AccelerometerTest::onEnter() auto listener = EventListenerAcceleration::create(CC_CALLBACK_2(AccelerometerTest::onAcceleration, this)); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32.0f); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32.0f); addChild(label, 1); label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) ); diff --git a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp index 12dce24a8a..68fa57d999 100644 --- a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp +++ b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp @@ -198,7 +198,7 @@ void PauseTest::onEnter() ActionManagerTest::onEnter(); - auto l = Label::create("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f); + auto l = Label::createWithTTF("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f); addChild(l); l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-75) ); @@ -240,7 +240,7 @@ void StopActionTest::onEnter() { ActionManagerTest::onEnter(); - auto l = Label::create("Should not crash", "fonts/Thonburi.ttf", 16.0f); + auto l = Label::createWithTTF("Should not crash", "fonts/Thonburi.ttf", 16.0f); addChild(l); l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 75) ); @@ -281,7 +281,7 @@ void ResumeTest::onEnter() { ActionManagerTest::onEnter(); - auto l = Label::create("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f); + auto l = Label::createWithTTF("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f); addChild(l); l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 75)); diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp index a68ca11aef..df7e3d380f 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -388,7 +388,7 @@ void SpriteProgressBarTintAndFade::onEnter() left->runAction(RepeatForever::create(to->clone())); left->runAction(RepeatForever::create(tint->clone())); - left->addChild(Label::create("Tint", "fonts/Marker Felt.ttf", 20.0f)); + left->addChild(Label::createWithTTF("Tint", "fonts/Marker Felt.ttf", 20.0f)); auto middle = ProgressTimer::create(Sprite::create(s_pathSister2)); middle->setType(ProgressTimer::Type::BAR); @@ -401,7 +401,7 @@ void SpriteProgressBarTintAndFade::onEnter() middle->runAction(RepeatForever::create(to->clone())); middle->runAction(RepeatForever::create(fade->clone())); - middle->addChild(Label::create("Fade", "fonts/Marker Felt.ttf", 20.0f)); + middle->addChild(Label::createWithTTF("Fade", "fonts/Marker Felt.ttf", 20.0f)); auto right = ProgressTimer::create(Sprite::create(s_pathSister2)); right->setType(ProgressTimer::Type::BAR); @@ -415,7 +415,7 @@ void SpriteProgressBarTintAndFade::onEnter() right->runAction(RepeatForever::create(tint->clone())); right->runAction(RepeatForever::create(fade->clone())); - right->addChild(Label::create("Tint and Fade", "fonts/Marker Felt.ttf", 20.0f)); + right->addChild(Label::createWithTTF("Tint and Fade", "fonts/Marker Felt.ttf", 20.0f)); } std::string SpriteProgressBarTintAndFade::subtitle() const diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 9f9d7e1f7c..8718175947 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -398,7 +398,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() box->setPosition(Point(s.width/2, s.height - 100 - box->getContentSize().height/2)); this->addChild(box); - auto label = Label::create("Standard cocos2d Skew", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("Standard cocos2d Skew", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point(s.width/2, s.height - 100 + label->getContentSize().height)); this->addChild(label); @@ -414,7 +414,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() box->setPosition(Point(s.width/2, s.height - 250 - box->getContentSize().height/2)); this->addChild(box); - label = Label::create("Rotational Skew", "fonts/Marker Felt.ttf", 16.0f); + label = Label::createWithTTF("Rotational Skew", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point(s.width/2, s.height - 250 + label->getContentSize().height/2)); this->addChild(label); auto actionTo2 = RotateBy::create(2, 360, 0); @@ -811,7 +811,7 @@ void ActionSequence2::onEnter() void ActionSequence2::callback1() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 1 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 1 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*1,s.height/2)); addChild(label); @@ -820,7 +820,7 @@ void ActionSequence2::callback1() void ActionSequence2::callback2(Node* sender) { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 2 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 2 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*2,s.height/2)); addChild(label); @@ -829,7 +829,7 @@ void ActionSequence2::callback2(Node* sender) void ActionSequence2::callback3(Node* sender, long data) { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*3,s.height/2)); addChild(label); @@ -962,7 +962,7 @@ void ActionCallFunction::onEnter() // lambda [&](){ auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*1,s.height/2-40)); this->addChild(label); } ), @@ -989,7 +989,7 @@ void ActionCallFunction::onEnter() void ActionCallFunction::callback1() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 1 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 1 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*1,s.height/2)); addChild(label); @@ -998,7 +998,7 @@ void ActionCallFunction::callback1() void ActionCallFunction::callback2(Node* sender) { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 2 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 2 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*2,s.height/2)); addChild(label); @@ -1009,7 +1009,7 @@ void ActionCallFunction::callback2(Node* sender) void ActionCallFunction::callback3(Node* sender, long data) { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); + auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); label->setPosition(Point( s.width/4*3,s.height/2)); addChild(label); diff --git a/tests/cpp-tests/Classes/BaseTest.cpp b/tests/cpp-tests/Classes/BaseTest.cpp index 08fbfe4733..66062bb961 100644 --- a/tests/cpp-tests/Classes/BaseTest.cpp +++ b/tests/cpp-tests/Classes/BaseTest.cpp @@ -71,7 +71,7 @@ void BaseTest::onEnter() void BaseTest::onExit() { AppDelegate* app = (AppDelegate *)Application::getInstance(); - app->setCurrentTest(NULL); + app->setCurrentTest(nullptr); Layer::onExit(); } diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 7b615f539c..e3268a564a 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -13,8 +13,8 @@ enum { }; Box2DTestLayer::Box2DTestLayer() -: _spriteTexture(NULL) -, world(NULL) +: _spriteTexture(nullptr) +, world(nullptr) { #if CC_ENABLE_BOX2D_INTEGRATION auto dispatcher = Director::getInstance()->getEventDispatcher(); @@ -43,14 +43,14 @@ Box2DTestLayer::Box2DTestLayer() addNewSpriteAtPosition(VisibleRect::center()); - auto label = Label::create("Tap screen", "fonts/Marker Felt.ttf", 32.0f); + auto label = Label::createWithTTF("Tap screen", "fonts/Marker Felt.ttf", 32.0f); addChild(label, 0); label->setColor(Color3B(0,0,255)); label->setPosition(Point( VisibleRect::center().x, VisibleRect::top().y-50)); scheduleUpdate(); #else - auto label = Label::create("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case", + auto label = Label::createWithTTF("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case", "fonts/arial.ttf", 18); auto size = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp index 86924143ad..3f3f8ffb94 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp @@ -59,7 +59,7 @@ bool MenuLayer::initWithEntryID(int entryId) view->setScale(15); view->setAnchorPoint( Point(0,0) ); view->setPosition( Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3) ); - auto label = Label::create(view->title().c_str(), "fonts/arial.ttf", 28); + auto label = Label::createWithTTF(view->title().c_str(), "fonts/arial.ttf", 28); addChild(label, 1); label->setPosition( Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50) ); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp index e6bd2a83e1..3594283259 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp @@ -45,7 +45,7 @@ bool Bug1159Layer::init() sprite_b->setPosition(Point(s.width/2, s.height/2)); addChild(sprite_b); - auto label = MenuItemLabel::create(Label::create("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) ); + auto label = MenuItemLabel::create(Label::createWithSystemFont("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) ); auto menu = Menu::create(label, NULL); menu->setPosition(Point(s.width - 200.0f, 50.0f)); addChild(menu); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp index b108ec225d..e330cd72f0 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp @@ -9,7 +9,7 @@ bool QuestionContainerSprite::init() if (Sprite::init()) { //Add label - auto label = Label::create("Answer 1", "fonts/arial.ttf", 12); + auto label = Label::createWithTTF("Answer 1", "fonts/arial.ttf", 12); label->setTag(100); //Add the background diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-624.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-624.cpp index 237087b370..296de5c4c7 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-624.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-624.cpp @@ -20,7 +20,7 @@ bool Bug624Layer::init() if(BugsTestBaseLayer::init()) { auto size = Director::getInstance()->getWinSize(); - auto label = Label::create("Layer1", "fonts/Marker Felt.ttf", 36.0f); + auto label = Label::createWithTTF("Layer1", "fonts/Marker Felt.ttf", 36.0f); label->setPosition(Point(size.width/2, size.height/2)); addChild(label); @@ -66,7 +66,7 @@ bool Bug624Layer2::init() if(BugsTestBaseLayer::init()) { auto size = Director::getInstance()->getWinSize(); - auto label = Label::create("Layer2", "fonts/Marker Felt.ttf", 36.0f); + auto label = Label::createWithTTF("Layer2", "fonts/Marker Felt.ttf", 36.0f); label->setPosition(Point(size.width/2, size.height/2)); addChild(label); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp index 25c712b854..1ede898f21 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp @@ -49,7 +49,7 @@ bool Bug914Layer::init() } // create and initialize a Label - auto label = Label::create("Hello World", "fonts/Marker Felt.ttf", 64.0f); + auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 64.0f); auto item1 = MenuItemFont::create("restart", CC_CALLBACK_1(Bug914Layer::restart, this)); auto menu = Menu::create(item1, NULL); diff --git a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp index 0f2a1e3b7b..614b4fad64 100644 --- a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp +++ b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp @@ -31,7 +31,7 @@ ChipmunkTestLayer::ChipmunkTestLayer() _eventDispatcher->addEventListenerWithSceneGraphPriority(accListener, this); // title - auto label = Label::create("Multi touch the screen", "fonts/Marker Felt.ttf", 36.0f); + auto label = Label::createWithTTF("Multi touch the screen", "fonts/Marker Felt.ttf", 36.0f); label->setPosition(cocos2d::Point( VisibleRect::center().x, VisibleRect::top().y - 30)); this->addChild(label, -1); @@ -64,7 +64,7 @@ ChipmunkTestLayer::ChipmunkTestLayer() scheduleUpdate(); #else - auto label = Label::create("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case", + auto label = Label::createWithTTF("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case", "fonts/arial.ttf", 18); auto size = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index 8ceea7225c..fbffe6048b 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -827,7 +827,7 @@ void RawStencilBufferTest6::setup() glClear(GL_STENCIL_BUFFER_BIT); glFlush(); glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits); - auto clearToZeroLabel = Label::create(String::createWithFormat("00=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20); + auto clearToZeroLabel = Label::createWithTTF(String::createWithFormat("00=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20); clearToZeroLabel->setPosition( Point((winPoint.x / 3) * 1, winPoint.y - 10) ); this->addChild(clearToZeroLabel); glStencilMask(0x0F); @@ -835,7 +835,7 @@ void RawStencilBufferTest6::setup() glClear(GL_STENCIL_BUFFER_BIT); glFlush(); glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits); - auto clearToMaskLabel = Label::create(String::createWithFormat("0a=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20); + auto clearToMaskLabel = Label::createWithTTF(String::createWithFormat("0a=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20); clearToMaskLabel->setPosition( Point((winPoint.x / 3) * 2, winPoint.y - 10) ); this->addChild(clearToMaskLabel); #endif diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index e8171ad08b..1da2650003 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -66,7 +66,7 @@ public: private: Button() - : _child(NULL) + : _child(nullptr) { // Director::getInstance()->getTouchDispatcher()->addTargetedDelegate(this, 100, true); @@ -91,7 +91,7 @@ private: bool initTextButton(const char *text) { - _child = Label::create(text, "fonts/arial.ttf", 16); + _child = Label::createWithTTF(text, "fonts/arial.ttf", 16); addChild(_child); return true; } @@ -172,7 +172,7 @@ public: sprintf(buffer, "%.2f", minValue); if (!_lblMinValue) { - _lblMinValue = Label::create(buffer, "fonts/arial.ttf", 8); + _lblMinValue = Label::createWithTTF(buffer, "fonts/arial.ttf", 8); addChild(_lblMinValue); if (_direction == Vertical) _lblMinValue->setPosition(Point(12.0, -50.0)); @@ -184,7 +184,7 @@ public: sprintf(buffer, "%.2f", maxValue); if (!_lblMaxValue) { - _lblMaxValue = Label::create(buffer, "fonts/arial.ttf", 8); + _lblMaxValue = Label::createWithTTF(buffer, "fonts/arial.ttf", 8); addChild(_lblMaxValue); if (_direction == Vertical) _lblMaxValue->setPosition(Point(12.0, 50.0)); @@ -198,9 +198,9 @@ public: private: AudioSlider(Direction direction) : _direction(direction) - , _slider(NULL) - , _lblMinValue(NULL) - , _lblMaxValue(NULL) + , _slider(nullptr) + , _lblMinValue(nullptr) + , _lblMaxValue(nullptr) { } @@ -224,11 +224,11 @@ CocosDenshionTest::CocosDenshionTest() : _soundId(0), _musicVolume(1), _effectsVolume(1), -_sliderPitch(NULL), -_sliderPan(NULL), -_sliderGain(NULL), -_sliderEffectsVolume(NULL), -_sliderMusicVolume(NULL) +_sliderPitch(nullptr), +_sliderPan(nullptr), +_sliderGain(nullptr), +_sliderEffectsVolume(nullptr), +_sliderMusicVolume(nullptr) { addButtons(); addSliders(); @@ -256,7 +256,7 @@ void CocosDenshionTest::onExit() void CocosDenshionTest::addButtons() { - auto lblMusic = Label::create("Control Music", "fonts/arial.ttf", 24); + auto lblMusic = Label::createWithTTF("Control Music", "fonts/arial.ttf", 24); addChildAt(lblMusic, 0.25f, 0.9f); Button *btnPlay = Button::createWithText("play"); @@ -298,7 +298,7 @@ void CocosDenshionTest::addButtons() }); addChildAt(btnIsPlayingMusic, 0.4f, 0.65f); - auto lblSound = Label::create("Control Effects", "fonts/arial.ttf", 24); + auto lblSound = Label::createWithTTF("Control Effects", "fonts/arial.ttf", 24); addChildAt(lblSound, 0.75f, 0.9f); Button *btnPlayEffect = Button::createWithText("play"); @@ -364,31 +364,31 @@ void CocosDenshionTest::addButtons() void CocosDenshionTest::addSliders() { - auto lblPitch = Label::create("Pitch", "fonts/arial.ttf", 14); + auto lblPitch = Label::createWithTTF("Pitch", "fonts/arial.ttf", 14); addChildAt(lblPitch, 0.67f, 0.4f); _sliderPitch = AudioSlider::create(AudioSlider::Horizontal); _sliderPitch->setValue(0.5, 2, 1); addChildAt(_sliderPitch, 0.85f, 0.4f); - auto lblPan = Label::create("Pan", "fonts/arial.ttf", 14); + auto lblPan = Label::createWithTTF("Pan", "fonts/arial.ttf", 14); addChildAt(lblPan, 0.67f, 0.3f); _sliderPan = AudioSlider::create(AudioSlider::Horizontal); _sliderPan->setValue(-1, 1, 0); addChildAt(_sliderPan, 0.85f, 0.3f); - auto lblGain = Label::create("Gain", "fonts/arial.ttf", 14); + auto lblGain = Label::createWithTTF("Gain", "fonts/arial.ttf", 14); addChildAt(lblGain, 0.67f, 0.2f); _sliderGain = AudioSlider::create(AudioSlider::Horizontal); _sliderGain->setValue(0, 1, 1); addChildAt(_sliderGain, 0.85f, 0.2f); - auto lblEffectsVolume = Label::create("Effects Volume", "fonts/arial.ttf", 14); + auto lblEffectsVolume = Label::createWithTTF("Effects Volume", "fonts/arial.ttf", 14); addChildAt(lblEffectsVolume, 0.62f, 0.5f); _sliderEffectsVolume = AudioSlider::create(AudioSlider::Horizontal); _sliderEffectsVolume->setValue(0, 1, 1); addChildAt(_sliderEffectsVolume, 0.85f, 0.5f); - auto lblMusicVolume = Label::create("Music Volume", "fonts/arial.ttf", 14); + auto lblMusicVolume = Label::createWithTTF("Music Volume", "fonts/arial.ttf", 14); addChildAt(lblMusicVolume, 0.12f, 0.5f); _sliderMusicVolume = AudioSlider::create(AudioSlider::Horizontal); _sliderMusicVolume->setValue(0, 1, 1); diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index b4fcab3577..70647f5dad 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -180,14 +180,15 @@ std::string ConsoleCustomCommand::subtitle() const ConsoleUploadFile::ConsoleUploadFile() { - srand ((unsigned)time(NULL)); + srand ((unsigned)time(nullptr)); int _id = rand()%100000; char buf[32]; sprintf(buf, "%d", _id); _target_file_name = std::string("grossini") + buf; - _src_file_path = FileUtils::getInstance()->fullPathForFilename(s_pathGrossini); - _thread = std::thread( &ConsoleUploadFile::uploadFile, this); + _src_file_path = FileUtils::getInstance()->fullPathForFilename(s_pathGrossini); + std::thread t = std::thread( &ConsoleUploadFile::uploadFile, this); + t.detach(); } void ConsoleUploadFile::onEnter() @@ -198,7 +199,7 @@ void ConsoleUploadFile::onEnter() ConsoleUploadFile::~ConsoleUploadFile() { - _thread.join(); + } void ConsoleUploadFile::uploadFile() diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h index e188228ed2..7d1758273d 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h @@ -83,7 +83,6 @@ protected: void uploadFile(); std::string _src_file_path; std::string _target_file_name; - std::thread _thread; private: CC_DISALLOW_COPY_AND_ASSIGN(ConsoleUploadFile); }; diff --git a/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp b/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp index 4e6573d649..ab6810e17f 100644 --- a/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp +++ b/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp @@ -5,7 +5,7 @@ CurlTest::CurlTest() { - auto label = Label::create("Curl Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("Curl Test", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) ); @@ -14,7 +14,7 @@ CurlTest::CurlTest() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); // create a label to display the tip string - _label = Label::create("Touch the screen to connect", "fonts/arial.ttf", 22); + _label = Label::createWithTTF("Touch the screen to connect", "fonts/arial.ttf", 22); _label->setPosition(VisibleRect::center()); addChild(_label, 0); diff --git a/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp b/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp index 9f985d7a5c..11d85613f1 100644 --- a/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp +++ b/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp @@ -2,11 +2,11 @@ CurrentLanguageTest::CurrentLanguageTest() { - auto label = Label::create("Current language Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("Current language Test", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) ); - auto labelLanguage = Label::create("", "fonts/arial.ttf", 20); + auto labelLanguage = Label::createWithTTF("", "fonts/arial.ttf", 20); labelLanguage->setPosition(VisibleRect::center()); LanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage(); diff --git a/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp b/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp index 7299fa5941..3886d9c2c1 100644 --- a/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp +++ b/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp @@ -39,14 +39,14 @@ void PrettyPrinterDemo::onEnter() Layer::onEnter(); auto s = Director::getInstance()->getWinSize(); - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 28); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 28); label->setPosition( Point(s.width/2, s.height * 4/5) ); this->addChild(label, 1); std::string strSubtitle = subtitle(); if(strSubtitle.empty() == false) { - auto subLabel = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); + auto subLabel = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); subLabel->setPosition( Point(s.width/2, s.height * 3/5) ); this->addChild(subLabel, 1); } diff --git a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp index 6c594d5d3d..0f6b6d0435 100644 --- a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -146,7 +146,7 @@ public: private: Lens3DTarget() - : _lens3D(NULL) + : _lens3D(nullptr) {} Lens3D* _lens3D; diff --git a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index ed39dd9c57..698f37e98f 100644 --- a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp +++ b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp @@ -366,7 +366,7 @@ TextLayer::TextLayer(void) auto sc2_back = sc2->reverse(); tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL)) ); - auto label = Label::create((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32); + auto label = Label::createWithTTF((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32); label->setPosition( Point(VisibleRect::center().x,VisibleRect::top().y-80) ); addChild(label); @@ -379,7 +379,7 @@ void TextLayer::checkAnim(float dt) { //auto s2 = getChildByTag(kTagBackground); if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != NULL) - _gridNodeTarget->setGrid(NULL);; + _gridNodeTarget->setGrid(nullptr);; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 6be259f49d..bff720784c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -160,7 +160,7 @@ void ArmatureTestLayer::onEnter() // add title and subtitle std::string str = title(); const char *pTitle = str.c_str(); - auto label = Label::create(pTitle, "fonts/arial.ttf", 18); + auto label = Label::createWithTTF(pTitle, "fonts/arial.ttf", 18); label->setColor(Color3B::BLACK); addChild(label, 1, 10000); label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) ); @@ -168,7 +168,7 @@ void ArmatureTestLayer::onEnter() std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { - auto l = Label::create(strSubtitle.c_str(), "fonts/arial.ttf", 18); + auto l = Label::createWithTTF(strSubtitle.c_str(), "fonts/arial.ttf", 18); l->setColor(Color3B::BLACK); addChild(l, 1, 10001); l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) ); @@ -703,7 +703,7 @@ void TestUseMutiplePicture::onEnter() // armature->getBone("weapon")->addDisplay(&displayData, i); // } - auto l = Label::create("This is a weapon!", "fonts/arial.ttf", 18); + auto l = Label::createWithTTF("This is a weapon!", "fonts/arial.ttf", 18); l->setAnchorPoint(Point(0.2f, 0.5f)); armature->getBone("weapon")->addDisplay(l, 7); } @@ -1275,7 +1275,7 @@ void TestArmatureNesting2::onEnter() touchedMenu = false; - auto label = Label::create("Change Mount", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Change Mount", "fonts/arial.ttf", 20); MenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CC_CALLBACK_1(TestArmatureNesting2::changeMountCallback, this)); Menu* pMenu =Menu::create(pMenuItem, nullptr); @@ -1464,6 +1464,7 @@ void TestChangeAnimationInternal::onEnter() void TestChangeAnimationInternal::onExit() { Director::getInstance()->setAnimationInterval(1/60.0f); + ArmatureTestLayer::onExit(); } std::string TestChangeAnimationInternal::title() const { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp index 6021f53404..9f9e0d6085 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp @@ -60,7 +60,7 @@ bool GameOverLayer::init() if ( LayerColor::initWithColor( Color4B(255,255,255,255) ) ) { auto winSize = Director::getInstance()->getWinSize(); - this->_label = Label::create("","fonts/arial.ttf", 32); + this->_label = Label::createWithTTF("","fonts/arial.ttf", 32); _label->retain(); _label->setColor( Color3B(0, 0, 0) ); _label->setPosition( Point(winSize.width/2, winSize.height/2) ); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocoStudioGUITest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocoStudioGUITest.cpp index 5d88853afc..cb69624345 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocoStudioGUITest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocoStudioGUITest.cpp @@ -133,7 +133,7 @@ void CocoStudioGUITestScene::onEnter() { CCScene::onEnter(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocoStudioGUITestScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocosGUIScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocosGUIScene.cpp index 64e67b3027..734fc1636c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocosGUIScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CocosGUIScene.cpp @@ -348,7 +348,7 @@ void CocosGUITestScene::onEnter() { Scene::onEnter(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); //#endif auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocosGUITestScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomGUIScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomGUIScene.cpp index 0e552843e0..02b59b1509 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomGUIScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomGUIScene.cpp @@ -118,7 +118,7 @@ void CustomGUITestScene::onEnter() { CCScene::onEnter(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomGUITestScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp index 7e2067694c..6db8a43f61 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp @@ -36,7 +36,7 @@ void CustomImageScene::onEnter() { CCScene::onEnter(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomImageScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp index bceed480e9..2ba4e19263 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp @@ -50,7 +50,7 @@ void CustomParticleWidgetScene::onEnter() addChild(pLayer); pLayer->release(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomParticleWidgetScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp index 87321545bd..fc78edbcec 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp @@ -6,7 +6,7 @@ USING_NS_CC; using namespace ui; CustomImageView::CustomImageView() -: _label(NULL) +: _label(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp index 3518d7e6d3..127b40a2ad 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp @@ -12,7 +12,7 @@ USING_NS_CC; using namespace ui; CustomParticleWidget::CustomParticleWidget() -: _emitter(NULL) +: _emitter(nullptr) , _emitterPlist("") { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp index e3fad5940c..8bb950c945 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp @@ -333,7 +333,7 @@ void GUIEditorTestScene::onEnter() { Scene::onEnter(); - auto label = Label::create("Back", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20); auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(GUIEditorTestScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp index 1cae9528cd..b75ef53d5f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp @@ -6,7 +6,7 @@ // UIButtonTest_Editor UIButtonTest_Editor::UIButtonTest_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp index f67009ee0a..38a8e00384 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp @@ -6,7 +6,7 @@ // UICheckBoxTest_Editor UICheckBoxTest_Editor::UICheckBoxTest_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp index 89c2954979..0a8ca52ac0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIListViewTest/UIListViewTest_Editor.cpp @@ -5,7 +5,7 @@ // UIListViewTest_Vertical_Editor UIListViewTest_Vertical_Editor::UIListViewTest_Vertical_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } @@ -64,7 +64,7 @@ bool UIListViewTest_Vertical_Editor::init() // UIListViewTest_Horizontal_Editor UIListViewTest_Horizontal_Editor::UIListViewTest_Horizontal_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 01d9e7d41c..7b5697ccb0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -5,7 +5,7 @@ // UIPageViewTest UIPageViewTest::UIPageViewTest() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp index 427b847820..9ea7d955a9 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest_Editor.cpp @@ -6,7 +6,7 @@ // UIPageViewTest_Editor UIPageViewTest_Editor::UIPageViewTest_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIScene_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIScene_Editor.cpp index 889a182c0e..2480dfc3ba 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIScene_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UIScene_Editor.cpp @@ -7,9 +7,9 @@ UIScene_Editor::UIScene_Editor() -: _sceneTitle(NULL) -, _touchGroup(NULL) -, _layout(NULL) +: _sceneTitle(nullptr) +, _touchGroup(nullptr) +, _layout(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp index 20dcf31e26..693c203611 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp @@ -6,7 +6,7 @@ // UISliderTest_Editor UISliderTest_Editor::UISliderTest_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp index caea297d54..7c5db2e9b8 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp @@ -245,7 +245,7 @@ void UITextFieldTest_Password::textFieldEvent(Ref *pSender, TextFiledEventType t // UITextFieldTest_LineWrap UITextFieldTest_LineWrap::UITextFieldTest_LineWrap() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp index 76ed026964..3253e109cd 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp @@ -6,7 +6,7 @@ // UITextFieldTest_Editor UITextFieldTest_Editor::UITextFieldTest_Editor() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index 43430fc1a1..6950b2e928 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp @@ -114,7 +114,7 @@ void SceneEditorTestLayer::onEnter() // add title and subtitle std::string str = title(); const char *pTitle = str.c_str(); - auto label = Label::create(pTitle, "fonts/arial.ttf", 18); + auto label = Label::createWithTTF(pTitle, "fonts/arial.ttf", 18); label->setTextColor(Color4B::WHITE); addChild(label, 1, 10000); label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) ); @@ -122,7 +122,7 @@ void SceneEditorTestLayer::onEnter() std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { - auto l = Label::create(strSubtitle.c_str(), "fonts/arial.ttf", 18); + auto l = Label::createWithTTF(strSubtitle.c_str(), "fonts/arial.ttf", 18); l->setTextColor(Color4B::BLACK); addChild(l, 1, 10001); l->setPosition(Point(VisibleRect::center().x, VisibleRect::top().y - 60) ); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp index 02ef579e92..951d775e66 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp @@ -5,7 +5,7 @@ USING_NS_CC_EXT; using namespace cocosbuilder; AnimationsTestLayer::AnimationsTestLayer() -: mAnimationManager(NULL) +: mAnimationManager(nullptr) {} AnimationsTestLayer::~AnimationsTestLayer() diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp index 3bb5964491..30eb172d8b 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp @@ -5,7 +5,7 @@ USING_NS_CC_EXT; using namespace cocosbuilder; ButtonTestLayer::ButtonTestLayer() -: mControlEventLabel(NULL) +: mControlEventLabel(nullptr) {} ButtonTestLayer::~ButtonTestLayer() diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp index dfec4d2ebc..36a83eb5cc 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp @@ -15,8 +15,8 @@ USING_NS_CC_EXT; using namespace cocosbuilder; HelloCocosBuilderLayer::HelloCocosBuilderLayer() -: mBurstSprite(NULL) -, mTestTitleLabelTTF(NULL) +: mBurstSprite(nullptr) +, mTestTitleLabelTTF(nullptr) {} HelloCocosBuilderLayer::~HelloCocosBuilderLayer() diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp index 2a719f1ab6..f2f7634705 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp @@ -6,7 +6,7 @@ USING_NS_CC_EXT; using namespace cocosbuilder; TimelineCallbackTestLayer::TimelineCallbackTestLayer() -: _helloLabel(NULL) +: _helloLabel(nullptr) {} TimelineCallbackTestLayer::~TimelineCallbackTestLayer() diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp index e629274003..11f74caed4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp @@ -94,7 +94,7 @@ ControlButton *ControlButtonTest_HelloVariableSize::standardButtonWithTitle(cons auto backgroundButton = Scale9Sprite::create("extensions/button.png"); auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png"); - auto titleButton = Label::create(title, "fonts/Marker Felt.ttf", 30); + auto titleButton = Label::createWithTTF(title, "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); @@ -106,8 +106,8 @@ ControlButton *ControlButtonTest_HelloVariableSize::standardButtonWithTitle(cons } ControlButtonTest_Event::ControlButtonTest_Event() -: _displayValueLabel(NULL) -, _displayBitmaskLabel(NULL) +: _displayValueLabel(nullptr) +, _displayBitmaskLabel(nullptr) { } @@ -125,12 +125,12 @@ bool ControlButtonTest_Event::init() auto screenSize = Director::getInstance()->getWinSize(); // Add a label in which the button events will be displayed - setDisplayValueLabel(Label::create("No Event", "fonts/Marker Felt.ttf", 32)); + setDisplayValueLabel(Label::createWithTTF("No Event", "fonts/Marker Felt.ttf", 32)); _displayValueLabel->setAnchorPoint(Point(0.5f, -1)); _displayValueLabel->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f)); addChild(_displayValueLabel, 1); - setDisplayBitmaskLabel(Label::create("No bitmask event", "fonts/Marker Felt.ttf", 24)); + setDisplayBitmaskLabel(Label::createWithTTF("No bitmask event", "fonts/Marker Felt.ttf", 24)); _displayBitmaskLabel->setAnchorPoint(Point(0.5f, -1)); Point bitmaskLabelPos = _displayValueLabel->getPosition() - Point(0, _displayBitmaskLabel->getBoundingBox().size.height); _displayBitmaskLabel->setPosition(bitmaskLabelPos); @@ -140,7 +140,7 @@ bool ControlButtonTest_Event::init() auto backgroundButton = Scale9Sprite::create("extensions/button.png"); auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png"); - auto titleButton = Label::create("Touch Me!", "fonts/Marker Felt.ttf", 30); + auto titleButton = Label::createWithTTF("Touch Me!", "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); @@ -278,7 +278,7 @@ ControlButton *ControlButtonTest_Styling::standardButtonWithTitle(const char *ti auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png"); backgroundHighlightedButton->setPreferredSize(Size(45, 45)); // Set the prefered size - auto titleButton = Label::create(title, "fonts/Marker Felt.ttf", 30); + auto titleButton = Label::createWithTTF(title, "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp index 6ab21b1a2a..fef27e3b2f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp @@ -66,7 +66,7 @@ bool ControlColourPickerTest::init() layer_width += background->getContentSize().width; - _colorLabel = Label::create("#color", "fonts/Marker Felt.ttf", 30); + _colorLabel = Label::createWithTTF("#color", "fonts/Marker Felt.ttf", 30); _colorLabel->retain(); _colorLabel->setPosition(background->getPosition()); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp index 50bcd87502..5a707ca585 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp @@ -25,7 +25,7 @@ #include "CCControlPotentiometerTest.h" ControlPotentiometerTest::ControlPotentiometerTest() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } @@ -55,7 +55,7 @@ bool ControlPotentiometerTest::init() layer_width += background->getContentSize().width; - this->setDisplayValueLabel(Label::create("", "HelveticaNeue-Bold", 30)); + this->setDisplayValueLabel(Label::createWithSystemFont("", "HelveticaNeue-Bold", 30)); _displayValueLabel->setPosition(background->getPosition()); layer->addChild(_displayValueLabel); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp index 5f42dc43d4..3abea7102a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -28,7 +28,7 @@ #include "../ExtensionsTest.h" ControlScene::ControlScene() -: _sceneTitleLabel(NULL) +: _sceneTitleLabel(nullptr) { } @@ -60,7 +60,7 @@ bool ControlScene::init() addChild(ribbon); // Add the title - setSceneTitleLabel(Label::create("Title", "fonts/arial.ttf", 12)); + setSceneTitleLabel(Label::createWithTTF("Title", "fonts/arial.ttf", 12)); _sceneTitleLabel->setPosition(Point (VisibleRect::center().x, VisibleRect::top().y - _sceneTitleLabel->getContentSize().height / 2 - 5)); addChild(_sceneTitleLabel, 1); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp index e905a3962e..f4a251be3d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp @@ -43,7 +43,7 @@ bool ControlSliderTest::init() auto screenSize = Director::getInstance()->getWinSize(); // Add a label in which the slider value will be displayed - _displayValueLabel = Label::create("Move the slider thumb!\nThe lower slider is restricted." ,"fonts/Marker Felt.ttf", 32); + _displayValueLabel = Label::createWithTTF("Move the slider thumb!\nThe lower slider is restricted." ,"fonts/Marker Felt.ttf", 32); _displayValueLabel->retain(); _displayValueLabel->setAnchorPoint(Point(0.5f, -1.0f)); _displayValueLabel->setPosition(Point(screenSize.width / 1.7f, screenSize.height / 2.0f)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp index 29767e7349..a5fa795fe8 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp @@ -26,7 +26,7 @@ #include "CCControlStepperTest.h" ControlStepperTest::ControlStepperTest() -: _displayValueLabel(NULL) +: _displayValueLabel(nullptr) { } @@ -54,7 +54,7 @@ bool ControlStepperTest::init() background->setPosition(Point(layer_width + background->getContentSize().width / 2.0f, 0)); layer->addChild(background); - this->setDisplayValueLabel(Label::create("0", "HelveticaNeue-Bold", 30)); + this->setDisplayValueLabel(Label::createWithSystemFont("0", "HelveticaNeue-Bold", 30)); _displayValueLabel->setPosition(background->getPosition()); layer->addChild(_displayValueLabel); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp index ccc76afae8..4c1c925517 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp @@ -51,7 +51,7 @@ bool ControlSwitchTest::init() layer_width += background->getContentSize().width; - _displayValueLabel = Label::create("#color" ,"fonts/Marker Felt.ttf" ,30); + _displayValueLabel = Label::createWithTTF("#color" ,"fonts/Marker Felt.ttf" ,30); _displayValueLabel->retain(); _displayValueLabel->setPosition(background->getPosition()); @@ -64,8 +64,8 @@ bool ControlSwitchTest::init() Sprite::create("extensions/switch-on.png"), Sprite::create("extensions/switch-off.png"), Sprite::create("extensions/switch-thumb.png"), - Label::create("On", "Arial-BoldMT", 16), - Label::create("Off", "Arial-BoldMT", 16) + Label::createWithSystemFont("On", "Arial-BoldMT", 16), + Label::createWithSystemFont("Off", "Arial-BoldMT", 16) ); switchControl->setPosition(Point(layer_width + 10 + switchControl->getContentSize().width / 2, 0)); layer->addChild(switchControl); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index ed24585037..bf6b44db6a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -23,7 +23,7 @@ EditBoxTest::EditBoxTest() pBg->setPosition(Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); addChild(pBg); - _TTFShowEditReturn = Label::create("No edit control return!", "", 30); + _TTFShowEditReturn = Label::createWithSystemFont("No edit control return!", "", 30); _TTFShowEditReturn->setPosition(Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50)); addChild(_TTFShowEditReturn); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp index 5fc2de984b..b5899f7cd4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp @@ -18,7 +18,7 @@ #include "NetworkTest/SocketIOTest.h" #endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #include "EditBoxTest/EditBoxTest.h" #endif @@ -68,7 +68,7 @@ static struct { { "SocketIOTest", [](Ref *sender){ runSocketIOTest();} }, #endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) { "EditBoxTest", [](Ref *sender){ runEditBoxTest();} }, #endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index ac5310ca12..41f7cdcbb5 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -7,14 +7,14 @@ USING_NS_CC_EXT; using namespace cocos2d::network; HttpClientTest::HttpClientTest() -: _labelStatusCode(NULL) +: _labelStatusCode(nullptr) { auto winSize = Director::getInstance()->getWinSize(); const int MARGIN = 40; const int SPACE = 35; - auto label = Label::create("Http Request Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("Http Request Test", "fonts/arial.ttf", 28); label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN)); addChild(label, 0); @@ -23,37 +23,37 @@ HttpClientTest::HttpClientTest() addChild(menuRequest); // Get - auto labelGet = Label::create("Test Get", "fonts/arial.ttf", 22); + auto labelGet = Label::createWithTTF("Test Get", "fonts/arial.ttf", 22); auto itemGet = MenuItemLabel::create(labelGet, CC_CALLBACK_1(HttpClientTest::onMenuGetTestClicked, this)); itemGet->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - SPACE)); menuRequest->addChild(itemGet); // Post - auto labelPost = Label::create("Test Post", "fonts/arial.ttf", 22); + auto labelPost = Label::createWithTTF("Test Post", "fonts/arial.ttf", 22); auto itemPost = MenuItemLabel::create(labelPost, CC_CALLBACK_1(HttpClientTest::onMenuPostTestClicked, this)); itemPost->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE)); menuRequest->addChild(itemPost); // Post Binary - auto labelPostBinary = Label::create("Test Post Binary", "fonts/arial.ttf", 22); + auto labelPostBinary = Label::createWithTTF("Test Post Binary", "fonts/arial.ttf", 22); auto itemPostBinary = MenuItemLabel::create(labelPostBinary, CC_CALLBACK_1(HttpClientTest::onMenuPostBinaryTestClicked, this)); itemPostBinary->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 3 * SPACE)); menuRequest->addChild(itemPostBinary); // Put - auto labelPut = Label::create("Test Put", "fonts/arial.ttf", 22); + auto labelPut = Label::createWithTTF("Test Put", "fonts/arial.ttf", 22); auto itemPut = MenuItemLabel::create(labelPut, CC_CALLBACK_1(HttpClientTest::onMenuPutTestClicked, this)); itemPut->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 4 * SPACE)); menuRequest->addChild(itemPut); // Delete - auto labelDelete = Label::create("Test Delete", "fonts/arial.ttf", 22); + auto labelDelete = Label::createWithTTF("Test Delete", "fonts/arial.ttf", 22); auto itemDelete = MenuItemLabel::create(labelDelete, CC_CALLBACK_1(HttpClientTest::onMenuDeleteTestClicked, this)); itemDelete->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 5 * SPACE)); menuRequest->addChild(itemDelete); // Response Code Label - _labelStatusCode = Label::create("HTTP Status Code", "fonts/arial.ttf", 22); + _labelStatusCode = Label::createWithTTF("HTTP Status Code", "fonts/arial.ttf", 22); _labelStatusCode->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 6 * SPACE)); addChild(_labelStatusCode); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 9e32839fc6..ba2fd28fb8 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -15,8 +15,8 @@ USING_NS_CC_EXT; using namespace cocos2d::network; SocketIOTestLayer::SocketIOTestLayer(void) - : _sioClient(NULL) - , _sioEndpoint(NULL) + : _sioClient(nullptr) + , _sioEndpoint(nullptr) { //set the clients to NULL until we are ready to connect @@ -25,7 +25,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) const int MARGIN = 40; const int SPACE = 35; - auto label = Label::create("SocketIO Extension Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("SocketIO Extension Test", "fonts/arial.ttf", 28); label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN)); addChild(label, 0); @@ -34,55 +34,55 @@ SocketIOTestLayer::SocketIOTestLayer(void) addChild(menuRequest); // Test to create basic client in the default namespace - auto labelSIOClient = Label::create("Open SocketIO Client", "fonts/arial.ttf", 22); + auto labelSIOClient = Label::createWithTTF("Open SocketIO Client", "fonts/arial.ttf", 22); auto itemSIOClient = MenuItemLabel::create(labelSIOClient, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOClientClicked, this)); itemSIOClient->setPosition(Point(VisibleRect::left().x + labelSIOClient->getContentSize().width / 2 + 5, winSize.height - MARGIN - SPACE)); menuRequest->addChild(itemSIOClient); // Test to create a client at the endpoint '/testpoint' - auto labelSIOEndpoint = Label::create("Open SocketIO Endpoint", "fonts/arial.ttf", 22); + auto labelSIOEndpoint = Label::createWithTTF("Open SocketIO Endpoint", "fonts/arial.ttf", 22); auto itemSIOEndpoint = MenuItemLabel::create(labelSIOEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOEndpointClicked, this)); itemSIOEndpoint->setPosition(Point(VisibleRect::right().x - labelSIOEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - SPACE)); menuRequest->addChild(itemSIOEndpoint); // Test sending message to default namespace - auto labelTestMessage = Label::create("Send Test Message", "fonts/arial.ttf", 22); + auto labelTestMessage = Label::createWithTTF("Send Test Message", "fonts/arial.ttf", 22); auto itemTestMessage = MenuItemLabel::create(labelTestMessage, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageClicked, this)); itemTestMessage->setPosition(Point(VisibleRect::left().x + labelTestMessage->getContentSize().width / 2 + 5, winSize.height - MARGIN - 2 * SPACE)); menuRequest->addChild(itemTestMessage); // Test sending message to the endpoint '/testpoint' - auto labelTestMessageEndpoint = Label::create("Test Endpoint Message", "fonts/arial.ttf", 22); + auto labelTestMessageEndpoint = Label::createWithTTF("Test Endpoint Message", "fonts/arial.ttf", 22); auto itemTestMessageEndpoint = MenuItemLabel::create(labelTestMessageEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageEndpointClicked, this)); itemTestMessageEndpoint->setPosition(Point(VisibleRect::right().x - labelTestMessageEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 2 * SPACE)); menuRequest->addChild(itemTestMessageEndpoint); // Test sending event 'echotest' to default namespace - auto labelTestEvent = Label::create("Send Test Event", "fonts/arial.ttf", 22); + auto labelTestEvent = Label::createWithTTF("Send Test Event", "fonts/arial.ttf", 22); auto itemTestEvent = MenuItemLabel::create(labelTestEvent, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventClicked, this)); itemTestEvent->setPosition(Point(VisibleRect::left().x + labelTestEvent->getContentSize().width / 2 + 5, winSize.height - MARGIN - 3 * SPACE)); menuRequest->addChild(itemTestEvent); // Test sending event 'echotest' to the endpoint '/testpoint' - auto labelTestEventEndpoint = Label::create("Test Endpoint Event", "fonts/arial.ttf", 22); + auto labelTestEventEndpoint = Label::createWithTTF("Test Endpoint Event", "fonts/arial.ttf", 22); auto itemTestEventEndpoint = MenuItemLabel::create(labelTestEventEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventEndpointClicked, this)); itemTestEventEndpoint->setPosition(Point(VisibleRect::right().x - labelTestEventEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 3 * SPACE)); menuRequest->addChild(itemTestEventEndpoint); // Test disconnecting basic client - auto labelTestClientDisconnect = Label::create("Disconnect Socket", "fonts/arial.ttf", 22); + auto labelTestClientDisconnect = Label::createWithTTF("Disconnect Socket", "fonts/arial.ttf", 22); auto itemClientDisconnect = MenuItemLabel::create(labelTestClientDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestClientDisconnectClicked, this)); itemClientDisconnect->setPosition(Point(VisibleRect::left().x + labelTestClientDisconnect->getContentSize().width / 2 + 5, winSize.height - MARGIN - 4 * SPACE)); menuRequest->addChild(itemClientDisconnect); // Test disconnecting the endpoint '/testpoint' - auto labelTestEndpointDisconnect = Label::create("Disconnect Endpoint", "fonts/arial.ttf", 22); + auto labelTestEndpointDisconnect = Label::createWithTTF("Disconnect Endpoint", "fonts/arial.ttf", 22); auto itemTestEndpointDisconnect = MenuItemLabel::create(labelTestEndpointDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEndpointDisconnectClicked, this)); itemTestEndpointDisconnect->setPosition(Point(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE)); menuRequest->addChild(itemTestEndpointDisconnect); // Sahred Status Label - _sioClientStatus = Label::create("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT); + _sioClientStatus = Label::createWithTTF("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT); _sioClientStatus->setAnchorPoint(Point(0, 0)); _sioClientStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y)); this->addChild(_sioClientStatus); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp index bb6f88302b..77ee75533e 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -13,12 +13,12 @@ USING_NS_CC; USING_NS_CC_EXT; WebSocketTestLayer::WebSocketTestLayer() -: _wsiSendText(NULL) -, _wsiSendBinary(NULL) -, _wsiError(NULL) -, _sendTextStatus(NULL) -, _sendBinaryStatus(NULL) -, _errorStatus(NULL) +: _wsiSendText(nullptr) +, _wsiSendBinary(nullptr) +, _wsiError(nullptr) +, _sendTextStatus(nullptr) +, _sendBinaryStatus(nullptr) +, _errorStatus(nullptr) , _sendTextTimes(0) , _sendBinaryTimes(0) { @@ -27,7 +27,7 @@ WebSocketTestLayer::WebSocketTestLayer() const int MARGIN = 40; const int SPACE = 35; - auto label = Label::create("WebSocket Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("WebSocket Test", "fonts/arial.ttf", 28); label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN)); addChild(label, 0); @@ -36,32 +36,32 @@ WebSocketTestLayer::WebSocketTestLayer() addChild(menuRequest); // Send Text - auto labelSendText = Label::create("Send Text", "fonts/arial.ttf", 22); + auto labelSendText = Label::createWithTTF("Send Text", "fonts/arial.ttf", 22); auto itemSendText = MenuItemLabel::create(labelSendText, CC_CALLBACK_1(WebSocketTestLayer::onMenuSendTextClicked, this)); itemSendText->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - SPACE)); menuRequest->addChild(itemSendText); // Send Binary - auto labelSendBinary = Label::create("Send Binary", "fonts/arial.ttf", 22); + auto labelSendBinary = Label::createWithTTF("Send Binary", "fonts/arial.ttf", 22); auto itemSendBinary = MenuItemLabel::create(labelSendBinary, CC_CALLBACK_1(WebSocketTestLayer::onMenuSendBinaryClicked, this)); itemSendBinary->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE)); menuRequest->addChild(itemSendBinary); // Send Text Status Label - _sendTextStatus = Label::create("Send Text WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); + _sendTextStatus = Label::createWithTTF("Send Text WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); _sendTextStatus->setAnchorPoint(Point(0, 0)); _sendTextStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y + 25)); this->addChild(_sendTextStatus); // Send Binary Status Label - _sendBinaryStatus = Label::create("Send Binary WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); + _sendBinaryStatus = Label::createWithTTF("Send Binary WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); _sendBinaryStatus->setAnchorPoint(Point(0, 0)); _sendBinaryStatus->setPosition(Point(VisibleRect::left().x + 160, VisibleRect::rightBottom().y + 25)); this->addChild(_sendBinaryStatus); // Error Label - _errorStatus = Label::create("Error WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); + _errorStatus = Label::createWithTTF("Error WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP); _errorStatus->setAnchorPoint(Point(0, 0)); _errorStatus->setPosition(Point(VisibleRect::left().x + 320, VisibleRect::rightBottom().y + 25)); this->addChild(_errorStatus); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp index 33b8ccbce8..fe7ca92622 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -1,6 +1,5 @@ #include "NotificationCenterTest.h" #include "../ExtensionsTest.h" -#include "CCNotificationCenter.h" #define kTagLight 100 #define kTagConnect 200 @@ -88,8 +87,8 @@ NotificationCenterTest::NotificationCenterTest() pBackMenu->setPosition( Point::ZERO ); addChild(pBackMenu); - auto label1 = Label::create("switch off", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::create("switch on", "fonts/Marker Felt.ttf", 26); + auto label1 = Label::createWithTTF("switch off", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithTTF("switch on", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, NULL); @@ -110,8 +109,8 @@ NotificationCenterTest::NotificationCenterTest() light->setPosition(Point(100, s.height/4*i)); addChild(light); - auto label1 = Label::create("not connected", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::create("connected", "fonts/Marker Felt.ttf", 26); + auto label1 = Label::createWithTTF("not connected", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithTTF("connected", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, NULL); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index d703062c4c..290c77163d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -80,7 +80,7 @@ TableViewCell* TableViewTestLayer::tableCellAtIndex(TableView *table, ssize_t id sprite->setPosition(Point(0, 0)); cell->addChild(sprite); - auto label = Label::create(string->getCString(), "Helvetica", 20.0); + auto label = Label::createWithSystemFont(string->getCString(), "Helvetica", 20.0); label->setPosition(Point::ZERO); label->setAnchorPoint(Point::ZERO); label->setTag(123); diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index ec83d4e4a2..084ab51e6c 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -276,12 +276,12 @@ void TestIsFileExist::onEnter() isExist = sharedFileUtils->isFileExist("Images/grossini.png"); - pTTF = Label::create(isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20); + pTTF = Label::createWithSystemFont(isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20); pTTF->setPosition(Point(s.width/2, s.height/3)); this->addChild(pTTF); isExist = sharedFileUtils->isFileExist("Images/grossini.xcf"); - pTTF = Label::create(isExist ? "Images/grossini.xcf exists" : "Images/grossini.xcf doesn't exist", "", 20); + pTTF = Label::createWithSystemFont(isExist ? "Images/grossini.xcf exists" : "Images/grossini.xcf doesn't exist", "", 20); pTTF->setPosition(Point(s.width/2, s.height/3*2)); this->addChild(pTTF); } @@ -363,7 +363,7 @@ void TextWritePlist::onEnter() else log("write plist file failed"); - auto label = Label::create(fullPath.c_str(), "fonts/Thonburi.ttf", 6); + auto label = Label::createWithTTF(fullPath.c_str(), "fonts/Thonburi.ttf", 6); this->addChild(label); auto winSize = Director::getInstance()->getWinSize(); label->setPosition(Point(winSize.width/2, winSize.height/3)); diff --git a/tests/cpp-tests/Classes/FontTest/FontTest.cpp b/tests/cpp-tests/Classes/FontTest/FontTest.cpp index fa562cfc3a..c4fc6a7a98 100644 --- a/tests/cpp-tests/Classes/FontTest/FontTest.cpp +++ b/tests/cpp-tests/Classes/FontTest/FontTest.cpp @@ -97,12 +97,12 @@ void FontTest::showFont(const char *pFont) removeChildByTag(kTagColor2, true); removeChildByTag(kTagColor3, true); - auto top = Label::create(pFont, pFont, 24); - auto left = Label::create("alignment left", pFont, fontSize, + auto top = Label::createWithSystemFont(pFont, pFont, 24); + auto left = Label::createWithSystemFont("alignment left", pFont, fontSize, blockSize, TextHAlignment::LEFT, verticalAlignment[vAlignIdx]); - auto center = Label::create("alignment center", pFont, fontSize, + auto center = Label::createWithSystemFont("alignment center", pFont, fontSize, blockSize, TextHAlignment::CENTER, verticalAlignment[vAlignIdx]); - auto right = Label::create("alignment right", pFont, fontSize, + auto right = Label::createWithSystemFont("alignment right", pFont, fontSize, blockSize, TextHAlignment::RIGHT, verticalAlignment[vAlignIdx]); auto leftColor = LayerColor::create(Color4B(100, 100, 100, 255), blockSize.width, blockSize.height); diff --git a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp index 9e52c63fe9..5431e5ca5b 100644 --- a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp +++ b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp @@ -3,17 +3,17 @@ MouseTest::MouseTest() { auto s = Director::getInstance()->getWinSize(); - auto title = Label::create("Mouse Test", "fonts/arial.ttf", 28); + auto title = Label::createWithTTF("Mouse Test", "fonts/arial.ttf", 28); addChild(title, 0); title->setPosition( Point(s.width/2, s.height-50) ); //Create a label to display the mouse action - _labelAction = Label::create("Click mouse button and see this change", "fonts/arial.ttf", 22); + _labelAction = Label::createWithTTF("Click mouse button and see this change", "fonts/arial.ttf", 22); _labelAction->setPosition(Point(s.width/2, s.height*2/3)); addChild(_labelAction, 0); //Create a label to display the mouse position - _labelPosition = Label::create("Mouse not supported on this device", "fonts/arial.ttf", 22); + _labelPosition = Label::createWithTTF("Mouse not supported on this device", "fonts/arial.ttf", 22); _labelPosition->setPosition(Point(s.width/2, s.height/3)); addChild(_labelPosition); diff --git a/tests/cpp-tests/Classes/KeyboardTest/KeyboardTest.cpp b/tests/cpp-tests/Classes/KeyboardTest/KeyboardTest.cpp index d930f49982..c67dc71c30 100644 --- a/tests/cpp-tests/Classes/KeyboardTest/KeyboardTest.cpp +++ b/tests/cpp-tests/Classes/KeyboardTest/KeyboardTest.cpp @@ -3,7 +3,7 @@ KeyboardTest::KeyboardTest() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("Keyboard Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("Keyboard Test", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(s.width/2, s.height-50) ); @@ -14,7 +14,7 @@ KeyboardTest::KeyboardTest() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); // create a label to display the tip string - _label = Label::create("Please press any key and see console log...", "fonts/arial.ttf", 22); + _label = Label::createWithTTF("Please press any key and see console log...", "fonts/arial.ttf", 22); _label->setPosition(Point(s.width / 2, s.height / 2)); addChild(_label, 0); diff --git a/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp b/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp index 627eaa3b08..771ddfb947 100644 --- a/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp +++ b/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp @@ -3,7 +3,7 @@ KeypadTest::KeypadTest() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("Keypad Test", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("Keypad Test", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(s.width/2, s.height-50) ); @@ -13,7 +13,7 @@ KeypadTest::KeypadTest() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); // create a label to display the tip string - _label = Label::create("Please press any key...", "fonts/arial.ttf", 22); + _label = Label::createWithTTF("Please press any key...", "fonts/arial.ttf", 22); _label->setPosition(Point(s.width / 2, s.height / 2)); addChild(_label, 0); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index f7c3bf99db..32daeb2a9e 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -1503,7 +1503,7 @@ LabelTTFOldNew::LabelTTFOldNew() auto s = Director::getInstance()->getWinSize(); float delta = s.height/4; - auto label1 = Label::create("Cocos2d-x Label Test", "arial", 24); + auto label1 = Label::createWithSystemFont("Cocos2d-x Label Test", "arial", 24); addChild(label1, 0, kTagBitmapAtlas1); label1->setPosition(Point(s.width/2, delta * 2)); label1->setColor(Color3B::RED); @@ -1582,14 +1582,7 @@ LabelFontNameTest::LabelFontNameTest() label1->setPosition( Point(size.width/2, size.height * 0.7) ); addChild(label1); - FontDefinition fontDef; - fontDef._fontName = "fonts/Marker Felt.ttf"; - fontDef._fontSize = 32; - auto label2 = Label::createWithFontDefinition("Create with FontDefinition",fontDef); - label2->setPosition( Point(size.width/2, size.height * 0.6) ); - addChild(label2); - - auto label3 = Label::create("fonts/Marker Felt.ttf","fonts/Marker Felt.ttf",32); + auto label3 = Label::createWithSystemFont("Marker Felt","Marker Felt",32); label3->setPosition( Point(size.width/2, size.height * 0.5) ); addChild(label3); } diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index d0dd03bbf6..7f7044f4ef 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -588,8 +588,8 @@ LayerGradientTest::LayerGradientTest() listener->onTouchesMoved = CC_CALLBACK_2(LayerGradientTest::onTouchesMoved, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - auto label1 = Label::create("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::create("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26); + auto label1 = Label::createWithTTF("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithTTF("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, NULL); diff --git a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp index 816e4c440b..ce8d2ee288 100644 --- a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp +++ b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp @@ -509,7 +509,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("click item and move, should not crash", "fonts/arial.ttf", 20); + auto label = Label::createWithTTF("click item and move, should not crash", "fonts/arial.ttf", 20); label->setPosition(Point(s.width/2, s.height - 30)); addChild(label); diff --git a/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp b/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp index 7ef9fa89ab..3af3ab5d74 100644 --- a/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp +++ b/tests/cpp-tests/Classes/MutiTouchTest/MutiTouchTest.cpp @@ -62,7 +62,7 @@ bool MutiTouchTestLayer::init() listener->onTouchesEnded = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - auto title = Label::create("Please touch the screen!", "", 24); + auto title = Label::createWithSystemFont("Please touch the screen!", "", 24); title->setPosition(VisibleRect::top()+Point(0, -40)); addChild(title); diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 337a8164a2..2dfaafe4ec 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -131,9 +131,11 @@ void TouchableSpriteTest::onEnter() Point origin = Director::getInstance()->getVisibleOrigin(); Size size = Director::getInstance()->getVisibleSize(); + auto containerForSprite1 = Node::create(); auto sprite1 = Sprite::create("Images/CyanSquare.png"); sprite1->setPosition(origin+Point(size.width/2, size.height/2) + Point(-80, 80)); - addChild(sprite1, 10); + containerForSprite1->addChild(sprite1); + addChild(containerForSprite1, 10); auto sprite2 = Sprite::create("Images/MagentaSquare.png"); sprite2->setPosition(origin+Point(size.width/2, size.height/2)); @@ -174,11 +176,11 @@ void TouchableSpriteTest::onEnter() target->setOpacity(255); if (target == sprite2) { - sprite1->setLocalZOrder(100); + containerForSprite1->setLocalZOrder(100); } else if(target == sprite1) { - sprite1->setLocalZOrder(0); + containerForSprite1->setLocalZOrder(0); } }; @@ -384,7 +386,7 @@ void RemoveListenerWhenDispatching::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, sprite1); - auto statusLabel = Label::create("The sprite could be touched!", "", 20); + auto statusLabel = Label::createWithSystemFont("The sprite could be touched!", "", 20); statusLabel->setPosition(origin + Point(size.width/2, size.height-90)); addChild(statusLabel); std::shared_ptr enable(new bool(true)); @@ -433,7 +435,7 @@ void CustomEventTest::onEnter() MenuItemFont::setFontSize(20); - auto statusLabel = Label::create("No custom event 1 received!", "", 20); + auto statusLabel = Label::createWithSystemFont("No custom event 1 received!", "", 20); statusLabel->setPosition(origin + Point(size.width/2, size.height-90)); addChild(statusLabel); @@ -459,7 +461,7 @@ void CustomEventTest::onEnter() }); sendItem->setPosition(origin + Point(size.width/2, size.height/2)); - auto statusLabel2 = Label::create("No custom event 2 received!", "", 20); + auto statusLabel2 = Label::createWithSystemFont("No custom event 2 received!", "", 20); statusLabel2->setPosition(origin + Point(size.width/2, size.height-120)); addChild(statusLabel2); @@ -516,7 +518,7 @@ void LabelKeyboardEventTest::onEnter() Point origin = Director::getInstance()->getVisibleOrigin(); Size size = Director::getInstance()->getVisibleSize(); - auto statusLabel = Label::create("No keyboard event received!", "", 20); + auto statusLabel = Label::createWithSystemFont("No keyboard event received!", "", 20); statusLabel->setPosition(origin + Point(size.width/2, size.height/2)); addChild(statusLabel); @@ -1189,7 +1191,7 @@ Issue4129::Issue4129() { _customlistener = _eventDispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){ - auto label = Label::create("Yeah, this issue was fixed.", "", 20); + auto label = Label::createWithSystemFont("Yeah, this issue was fixed.", "", 20); label->setAnchorPoint(Point(0, 0.5f)); label->setPosition(Point(VisibleRect::left())); this->addChild(label); diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 5a91345e1a..251eeaac60 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -729,7 +729,7 @@ void CameraCenterTest::onEnter() void CameraCenterTest::onExit() { - TestCocosNodeDemo::onEnter(); + TestCocosNodeDemo::onExit(); Director::getInstance()->setProjection(_preProjection); } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp index ad0e8d754a..1b67bf3f8d 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp @@ -94,7 +94,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -102,7 +102,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1); l->setPosition(Point(s.width/2, s.height-80)); } @@ -142,7 +142,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height/2-15)); addChild(infoLabel, 1, kTagInfoLayer); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp index 64df9e671f..1b2c749321 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp @@ -96,7 +96,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1, TAG_TITLE); label->setPosition(Point(s.width/2, s.height-50)); @@ -104,7 +104,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1, TAG_SUBTITLE); l->setPosition(Point(s.width/2, s.height-80)); } @@ -147,7 +147,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height/2-15)); addChild(infoLabel, 1, kTagInfoLayer); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp index e49e02bb19..0c4f75edde 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp @@ -94,7 +94,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1, TAG_TITLE); label->setPosition(Point(s.width/2, s.height-50)); @@ -102,7 +102,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1, TAG_SUBTITLE); l->setPosition(Point(s.width/2, s.height-80)); } @@ -145,7 +145,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); - auto infoLabel = Label::create("0 listeners", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 listeners", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height/2-15)); addChild(infoLabel, 1, kTagInfoLayer); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp index f979917439..693dc0ce31 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp @@ -102,7 +102,7 @@ void LabelMainScene::initWithSubTest(int nodes) menu->setPosition(Point(s.width/2, s.height-65)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height-90)); addChild(infoLabel, 1, kTagInfoLayer); @@ -136,7 +136,7 @@ void LabelMainScene::initWithSubTest(int nodes) menuAutoTest->addChild(autoTestItem); addChild( menuAutoTest, 3, kTagAutoTestMenu ); - _title = Label::create(title().c_str(), "fonts/arial.ttf", 32); + _title = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(_title, 1); _title->setPosition(Point(s.width/2, s.height-50)); @@ -194,7 +194,7 @@ void LabelMainScene::onIncrease(Ref* sender) case kCaseLabelTTFUpdate: for( int i=0;i< kNodesIncrease;i++) { - auto label = Label::create("LabelTTF", "Marker Felt", 30); + auto label = Label::createWithSystemFont("LabelTTF", "Marker Felt", 30); label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50))); _labelContainer->addChild(label, 1, _quantityNodes); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index f1d36680da..956e8c0f55 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -123,7 +123,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -131,7 +131,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1); l->setPosition(Point(s.width/2, s.height-80)); } @@ -171,7 +171,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height/2-15)); addChild(infoLabel, 1, kTagInfoLayer); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp index 8b53cb93ae..74df7c9101 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp @@ -103,7 +103,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height - 90)); addChild(infoLabel, 1, kTagInfoLayer); @@ -142,7 +142,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) pSubMenu->setPosition(Point(s.width/2, 80)); addChild(pSubMenu, 2); - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp index bfeec52d6f..f91f4f0b93 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp @@ -38,7 +38,7 @@ void ScenarioMenuLayer::onEnter() auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -46,7 +46,7 @@ void ScenarioMenuLayer::onEnter() std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1); l->setPosition(Point(s.width/2, s.height-80)); } @@ -154,19 +154,19 @@ void ScenarioTest::performTests() // add tip labels - _spriteLabel = Label::create("Sprites : 0", "fonts/arial.ttf", 15); + _spriteLabel = Label::createWithTTF("Sprites : 0", "fonts/arial.ttf", 15); _spriteLabel->setAnchorPoint(Point(0.0f, 0.5f)); addChild(_spriteLabel, 10); _spriteLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 70)); char str[32] = { 0 }; sprintf(str, "Particles : %d", _particleNumber); - _particleLabel = Label::create(str, "fonts/arial.ttf", 15); + _particleLabel = Label::createWithTTF(str, "fonts/arial.ttf", 15); _particleLabel->setAnchorPoint(Point(0.0f, 0.5f)); addChild(_particleLabel, 10); _particleLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 45)); - _parsysLabel = Label::create("Particle System : 0", "fonts/arial.ttf", 15); + _parsysLabel = Label::createWithTTF("Particle System : 0", "fonts/arial.ttf", 15); _parsysLabel->setAnchorPoint(Point(0.0f, 0.5f)); addChild(_parsysLabel, 10); _parsysLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 20)); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp index 98cc8550ec..8131d5dc09 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp @@ -391,7 +391,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) menu->setPosition(Point(s.width/2, s.height-65)); addChild(menu, 1); - auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30); + auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height-90)); addChild(infoLabel, 1, kTagInfoLayer); @@ -450,7 +450,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) addChild(subMenu, 2); // add title label - auto label = Label::create(title(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -459,7 +459,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { - auto l = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 9999); l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) ); } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp index 311eeb1491..48f80acaf7 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp @@ -48,7 +48,7 @@ void TextureMenuLayer::onEnter() auto s = Director::getInstance()->getWinSize(); // Title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -56,7 +56,7 @@ void TextureMenuLayer::onEnter() std::string strSubTitle = subtitle(); if(strSubTitle.length()) { - auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); + auto l = Label::createWithTTF(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16); addChild(l, 1); l->setPosition(Point(s.width/2, s.height-80)); } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp index 4ea2806152..5d36b2149c 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp @@ -73,7 +73,7 @@ void TouchesMainScene::onEnter() auto s = Director::getInstance()->getWinSize(); // add title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -223,7 +223,7 @@ void TouchesPerformTest3::onEnter() auto s = Director::getInstance()->getWinSize(); // add title - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); @@ -248,7 +248,7 @@ void TouchesPerformTest3::onEnter() layer->release(); } - auto emitEventlabel = Label::create("Emit Touch Event", "", 24); + auto emitEventlabel = Label::createWithSystemFont("Emit Touch Event", "", 24); auto menuItem = MenuItemLabel::create(emitEventlabel, [this](Ref* sender){ CC_PROFILER_PURGE_ALL(); diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index 9f5bcf1f8f..9013f42930 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -86,7 +86,7 @@ void PhysicsTestScene::toggleDebug() #if CC_USE_PHYSICS == 0 void PhysicsDemoDisabled::onEnter() { - auto label = Label::create("Should define CC_USE_PHYSICS\n to run this test case", + auto label = Label::createWithTTF("Should define CC_USE_PHYSICS\n to run this test case", "fonts/arial.ttf", 18); auto size = Director::getInstance()->getWinSize(); @@ -1310,7 +1310,7 @@ void PhysicsContactTest::onEnter() menu1->setPosition(Point(s.width/2, s.height-50)); addChild(menu1, 1); - auto label = Label::create("yellow box", "fonts/arial.ttf", 32); + auto label = Label::createWithTTF("yellow box", "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2 - 150, s.height-50)); @@ -1326,7 +1326,7 @@ void PhysicsContactTest::onEnter() menu2->setPosition(Point(s.width/2, s.height-90)); addChild(menu2, 1); - label = Label::create("blue box", "fonts/arial.ttf", 32); + label = Label::createWithTTF("blue box", "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2 - 150, s.height-90)); @@ -1342,7 +1342,7 @@ void PhysicsContactTest::onEnter() menu3->setPosition(Point(s.width/2, s.height-130)); addChild(menu3, 1); - label = Label::create("yellow triangle", "fonts/arial.ttf", 32); + label = Label::createWithTTF("yellow triangle", "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2 - 150, s.height-130)); @@ -1358,7 +1358,7 @@ void PhysicsContactTest::onEnter() menu4->setPosition(Point(s.width/2, s.height-170)); addChild(menu4, 1); - label = Label::create("blue triangle", "fonts/arial.ttf", 32); + label = Label::createWithTTF("blue triangle", "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Point(s.width/2 - 150, s.height-170)); @@ -1425,22 +1425,22 @@ void PhysicsContactTest::resetTest() char buffer[10]; sprintf(buffer, "%d", _yellowBoxNum); - auto label = Label::create(buffer, "fonts/arial.ttf", 32); + auto label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); label->setPosition(Point(s.width/2, s.height-50)); sprintf(buffer, "%d", _blueBoxNum); - label = Label::create(buffer, "fonts/arial.ttf", 32); + label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); label->setPosition(Point(s.width/2, s.height-90)); sprintf(buffer, "%d", _yellowTriangleNum); - label = Label::create(buffer, "fonts/arial.ttf", 32); + label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); label->setPosition(Point(s.width/2, s.height-130)); sprintf(buffer, "%d", _blueTriangleNum); - label = Label::create(buffer, "fonts/arial.ttf", 32); + label = Label::createWithTTF(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); label->setPosition(Point(s.width/2, s.height-170)); @@ -1618,7 +1618,7 @@ void PhysicsSetGravityEnableTest::onEnter() // wall auto wall = Node::create(); - wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1, 1, 0.0))); + wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1.0f, 0.0f))); wall->setPosition(VisibleRect::center()); addChild(wall); diff --git a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp index 80fc376d80..d5f5f27349 100644 --- a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp +++ b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp @@ -25,7 +25,7 @@ private: void ReleasePoolTestScene::runThisTest() { // title - auto label = Label::create("AutoreasePool Test", "fonts/arial.ttf", 32); + auto label = Label::createWithTTF("AutoreasePool Test", "fonts/arial.ttf", 32); addChild(label, 9999); label->setPosition(Point(VisibleRect::center().x, VisibleRect::top().y - 30)); diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index 66ebf1ae28..91c1751931 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -297,15 +297,15 @@ RenderTextureZbuffer::RenderTextureZbuffer() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); auto size = Director::getInstance()->getWinSize(); - auto label = Label::create("vertexZ = 50", "fonts/Marker Felt.ttf", 64); + auto label = Label::createWithTTF("vertexZ = 50", "fonts/Marker Felt.ttf", 64); label->setPosition(Point(size.width / 2, size.height * 0.25f)); this->addChild(label); - auto label2 = Label::create("vertexZ = 0", "fonts/Marker Felt.ttf", 64); + auto label2 = Label::createWithTTF("vertexZ = 0", "fonts/Marker Felt.ttf", 64); label2->setPosition(Point(size.width / 2, size.height * 0.5f)); this->addChild(label2); - auto label3 = Label::create("vertexZ = -50", "fonts/Marker Felt.ttf", 64); + auto label3 = Label::createWithTTF("vertexZ = -50", "fonts/Marker Felt.ttf", 64); label3->setPosition(Point(size.width / 2, size.height * 0.75f)); this->addChild(label3); diff --git a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp index b89d857f71..8317d9559c 100644 --- a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp +++ b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp @@ -19,7 +19,7 @@ void TestLayer::onEnter() //auto array = [UIFont familyNames]; //for( String *s in array ) // NSLog( s ); - auto label = Label::create("cocos2d", "Tahoma", 64); + auto label = Label::createWithSystemFont("cocos2d", "Tahoma", 64); label->setPosition( Point(x/2,y/2) ); diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp index 259ba79ef6..5c3f703cb8 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp @@ -136,7 +136,7 @@ bool ShaderNode::initWithVertex(const char *vert, const char *frag) { #if CC_ENABLE_CACHE_TEXTURE_DATA auto listener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom* event){ - this->setShaderProgram(NULL); + this->setShaderProgram(nullptr); loadShaderVertex(_vertFileName.c_str(), _fragFileName.c_str()); }); @@ -479,7 +479,7 @@ bool SpriteBlur::initWithTexture(Texture2D* texture, const Rect& rect) { #if CC_ENABLE_CACHE_TEXTURE_DATA auto listener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, [this](EventCustom* event){ - setShaderProgram(NULL); + setShaderProgram(nullptr); initProgram(); }); @@ -677,7 +677,7 @@ void ShaderBlur::sliderAction(Ref* sender, Control::EventType controlEvent) // ShaderRetroEffect ShaderRetroEffect::ShaderRetroEffect() -: _label(NULL) +: _label(nullptr) , _accum(0.0f) { init(); diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index 3d73f7816a..fd1b326b2a 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -371,7 +371,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const } // create a insert text sprite and do some action - auto label = Label::create(text, FONT_NAME, FONT_SIZE); + auto label = Label::createWithSystemFont(text, FONT_NAME, FONT_SIZE); this->addChild(label); Color3B color(226, 121, 7); label->setColor(color); @@ -404,7 +404,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, size_t nLen) { // create a delete text sprite and do some action - auto label = Label::create(delText, FONT_NAME, FONT_SIZE); + auto label = Label::createWithSystemFont(delText, FONT_NAME, FONT_SIZE); this->addChild(label); // move the sprite to fly out diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 16d1f1db44..d1da2a049d 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -1520,7 +1520,7 @@ void TextureAsync::onEnter() auto size = Director::getInstance()->getWinSize(); - auto label = Label::create("Loading...", "fonts/Marker Felt.ttf", 32); + auto label = Label::createWithTTF("Loading...", "fonts/Marker Felt.ttf", 32); label->setPosition(Point( size.width/2, size.height/2)); addChild(label, 10); diff --git a/tests/cpp-tests/Classes/TextureCacheTest/TextureCacheTest.cpp b/tests/cpp-tests/Classes/TextureCacheTest/TextureCacheTest.cpp index 59b9aa4a6e..3174cf391a 100644 --- a/tests/cpp-tests/Classes/TextureCacheTest/TextureCacheTest.cpp +++ b/tests/cpp-tests/Classes/TextureCacheTest/TextureCacheTest.cpp @@ -12,8 +12,8 @@ TextureCacheTest::TextureCacheTest() { auto size = Director::getInstance()->getWinSize(); - _labelLoading = Label::create("loading...", "fonts/arial.ttf", 15); - _labelPercent = Label::create("%0", "fonts/arial.ttf", 15); + _labelLoading = Label::createWithTTF("loading...", "fonts/arial.ttf", 15); + _labelPercent = Label::createWithTTF("%0", "fonts/arial.ttf", 15); _labelLoading->setPosition(Point(size.width / 2, size.height / 2 - 20)); _labelPercent->setPosition(Point(size.width / 2, size.height / 2 + 20)); diff --git a/tests/cpp-tests/Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp b/tests/cpp-tests/Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp index 0e7f9fbd67..61170b8b2d 100644 --- a/tests/cpp-tests/Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp +++ b/tests/cpp-tests/Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp @@ -18,14 +18,14 @@ void TextureAtlasEncryptionDemo::onEnter() auto s = Director::getInstance()->getWinSize(); - auto label = Label::create(title().c_str(), "fonts/arial.ttf", 28); + auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 28); label->setPosition( Point(s.width/2, s.height * 0.75f) ); this->addChild(label, 1); std::string strSubtitle = subtitle(); if(strSubtitle.empty() == false) { - auto subLabel = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); + auto subLabel = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); subLabel->setPosition( Point(s.width/2, s.height-80) ); this->addChild(subLabel, 1); } @@ -38,7 +38,7 @@ void TextureAtlasEncryptionDemo::onEnter() nonencryptedSprite->setPosition(Point(s.width * 0.25f, s.height * 0.5f)); this->addChild(nonencryptedSprite); - auto nonencryptedSpriteLabel = Label::create("non-encrypted", "fonts/arial.ttf", 28); + auto nonencryptedSpriteLabel = Label::createWithTTF("non-encrypted", "fonts/arial.ttf", 28); nonencryptedSpriteLabel->setPosition(Point(s.width * 0.25f, nonencryptedSprite->getBoundingBox().getMinY() - nonencryptedSprite->getContentSize().height/2)); this->addChild(nonencryptedSpriteLabel, 1); @@ -65,7 +65,7 @@ void TextureAtlasEncryptionDemo::onEnter() encryptedSprite->setPosition(Point(s.width * 0.75f, s.height * 0.5f)); this->addChild(encryptedSprite); - auto encryptedSpriteLabel = Label::create("encrypted", "fonts/arial.ttf", 28); + auto encryptedSpriteLabel = Label::createWithTTF("encrypted", "fonts/arial.ttf", 28); encryptedSpriteLabel->setPosition(Point(s.width * 0.75f, encryptedSprite->getBoundingBox().getMinY() - encryptedSpriteLabel->getContentSize().height/2)); this->addChild(encryptedSpriteLabel, 1); } diff --git a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp index 68dcaabc80..53d1faf8fc 100644 --- a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp +++ b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp @@ -266,12 +266,12 @@ TestLayer1::TestLayer1(void) bg1->setPosition( Point(size.width/2, size.height/2) ); addChild(bg1, -1); - auto title = Label::create( (transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 ); + auto title = Label::createWithTTF( (transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 ); addChild(title); title->setColor( Color3B(255,32,32) ); title->setPosition( Point(x/2, y-100) ); - auto label = Label::create("SCENE 1", "fonts/Marker Felt.ttf", 38); + auto label = Label::createWithTTF("SCENE 1", "fonts/Marker Felt.ttf", 38); label->setColor( Color3B(16,16,255)); label->setPosition( Point(x/2,y/2)); addChild( label); @@ -395,12 +395,12 @@ TestLayer2::TestLayer2() bg1->setPosition( Point(size.width/2, size.height/2) ); addChild(bg1, -1); - auto title = Label::create((transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 ); + auto title = Label::createWithTTF((transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 ); addChild(title); title->setColor( Color3B(255,32,32) ); title->setPosition( Point(x/2, y-100) ); - auto label = Label::create("SCENE 2", "fonts/Marker Felt.ttf", 38); + auto label = Label::createWithTTF("SCENE 2", "fonts/Marker Felt.ttf", 38); label->setColor( Color3B(16,16,255)); label->setPosition( Point(x/2,y/2)); addChild( label); diff --git a/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp b/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp index 45fb612c12..956647076a 100644 --- a/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp +++ b/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp @@ -8,7 +8,7 @@ UserDefaultTest::UserDefaultTest() { auto s = Director::getInstance()->getWinSize(); - auto label = Label::create("CCUserDefault test see log", "fonts/arial.ttf", 28); + auto label = Label::createWithTTF("CCUserDefault test see log", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(s.width/2, s.height-50) ); diff --git a/tests/lua-tests/src/ActionsTest/ActionsTest.lua b/tests/lua-tests/src/ActionsTest/ActionsTest.lua index 6b7d856dec..72728dae45 100644 --- a/tests/lua-tests/src/ActionsTest/ActionsTest.lua +++ b/tests/lua-tests/src/ActionsTest/ActionsTest.lua @@ -184,7 +184,7 @@ local function ActionRotationalSkewVSStandardSkew() box:ignoreAnchorPointForPosition(false); box:setPosition(cc.p(s.width/2, s.height - 100 - box:getContentSize().height/2)); layer:addChild(box); - local label = cc.Label:create("Standard cocos2d Skew", s_MarkerFeltFontPath, 16); + local label = cc.Label:create("Standard cocos2d Skew", s_markerFeltFontPath, 16); label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(cc.p(s.width/2, s.height - 100 + label:getContentSize().height)); layer:addChild(label); @@ -200,7 +200,7 @@ local function ActionRotationalSkewVSStandardSkew() box:ignoreAnchorPointForPosition(false); box:setPosition(cc.p(s.width/2, s.height - 250 - box:getContentSize().height/2)); layer:addChild(box); - label = cc.Label:create("Rotational Skew", s_MarkerFeltFontPath, 16); + label = cc.Label:create("Rotational Skew", s_markerFeltFontPath, 16); label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(cc.p(s.width/2, s.height - 250 + label:getContentSize().height/2)); layer:addChild(label); @@ -590,7 +590,7 @@ end local actionSequenceLayer = nil local function ActionSequenceCallback1() - local label = cc.Label:create("callback 1 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 1 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(size.width / 4, size.height / 2) @@ -598,7 +598,7 @@ local function ActionSequenceCallback1() end local function ActionSequenceCallback2(sender) - local label = cc.Label:create("callback 2 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 2 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(cc.p(size.width / 4 * 2, size.height / 2)) @@ -606,7 +606,7 @@ local function ActionSequenceCallback2(sender) end local function ActionSequenceCallback3(sender) - local label = cc.Label:create("callback 3 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 3 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(cc.p(size.width / 4 * 3, size.height / 2)) @@ -789,7 +789,7 @@ end local callFuncLayer = nil local function CallFucnCallback1() - local label = cc.Label:create("callback 1 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 1 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(size.width / 4, size.height / 2) @@ -797,7 +797,7 @@ local function CallFucnCallback1() end local function CallFucnCallback2(sender) - local label = cc.Label:create("callback 2 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 2 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(size.width / 4 * 2, size.height / 2) @@ -805,7 +805,7 @@ local function CallFucnCallback2(sender) end local function CallFucnCallback3(sender) - local label = cc.Label:create("callback 3 called", s_MarkerFeltFontPath, 16) + local label = cc.Label:create("callback 3 called", s_markerFeltFontPath, 16) label:setAnchorPoint(cc.p(0.5, 0.5)) label:setPosition(size.width / 4 * 3, size.height / 2) diff --git a/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua b/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua index fe69156e73..1ffa74d8a6 100644 --- a/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua +++ b/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua @@ -151,7 +151,7 @@ end -- private: -- Lens3DTarget() --- : m_pLens3D(NULL) +-- : m_pLens3D(nullptr) -- {} -- cc.Lens3D* m_pLens3D diff --git a/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua b/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua index 28ad613486..27130654a9 100644 --- a/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua +++ b/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua @@ -1478,13 +1478,6 @@ function LabelFontNameTest.create() label1:setPosition( cc.p(size.width/2, size.height * 0.7) ) layer:addChild(label1) - local fontDef = {} - fontDef.fontName = "fonts/Marker Felt.ttf" - fontDef.fontSize = 32 - local label2 = cc.Label:createWithFontDefinition("Create with FontDefinition",fontDef) - label2:setPosition( cc.p(size.width/2, size.height * 0.6) ) - layer:addChild(label2) - local label3 = cc.Label:create("fonts/Marker Felt.ttf","fonts/Marker Felt.ttf",32) label3:setPosition( cc.p(size.width/2, size.height * 0.5) ) layer:addChild(label3) diff --git a/tests/lua-tests/src/RenderTextureTest/RenderTextureTest.lua b/tests/lua-tests/src/RenderTextureTest/RenderTextureTest.lua index d44a4a677a..cf5674efa8 100644 --- a/tests/lua-tests/src/RenderTextureTest/RenderTextureTest.lua +++ b/tests/lua-tests/src/RenderTextureTest/RenderTextureTest.lua @@ -475,7 +475,7 @@ end -- -- SpriteRenderTextureBug --- local function SimpleSprite() : rt(NULL) {} +-- local function SimpleSprite() : rt(nullptr) {} -- local function SimpleSprite* SpriteRenderTextureBug:SimpleSprite:create(const char* filename, const cc.rect &rect) diff --git a/tools/jenkins-scripts/cocos-console-test.py b/tools/jenkins-scripts/cocos-console-test.py index 2535daaacb..7e8d7e0b28 100755 --- a/tools/jenkins-scripts/cocos-console-test.py +++ b/tools/jenkins-scripts/cocos-console-test.py @@ -137,7 +137,8 @@ def getAndroidDevices(): del arrDevices[0] count = 0 for device in arrDevices: - if len(device) > 0: + # e.g: emulator-5554 device, contains 'device', so, min length is len('device') + if len(device) > len('device') and (device.find('device') >= 0): count += 1 return count @@ -207,6 +208,7 @@ def cocos_project(level): appendToResult(' '+cmd +': ' + str(not info_cmd) + ".\n\r\t") else: if runSupport[curPlat][phone]: + print 'in desploy or run:', phone, getAndroidDevices() if phone == 'android' and getAndroidDevices() == 0: strInfo = 'no android device, please checkout the device is running ok.' print strInfo diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index b59892321b..23d7680442 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -13,7 +13,7 @@ android_flags = -D_SIZE_T_DEFINED_ clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include clang_flags = -nostdinc -x c++ -std=c++11 -cocos_headers = -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT cxxgenerator_headers = @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/2d/cocos2d.h %(cocosdir)s/cocos/audio/include/Simpl # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewProtocol GLView Image Event(?!.*(Physics).*).* Component ProtectedNode +classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewProtocol GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -98,7 +98,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS CatmullRom.*::[create actionWithDuration], Bezier.*::[create actionWithDuration], CardinalSpline.*::[create actionWithDuration setPoints], - Scheduler::[pause resume unschedule schedule update isTargetPaused isScheduled], + Scheduler::[pause resume unschedule schedule update isTargetPaused isScheduled performFunctionInCocosThread], TextureCache::[addPVRTCImage addImageAsync], Timer::[getSelector createWithScriptHandler], *::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener], @@ -116,7 +116,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS TMXTiledMap::[getPropertiesForGID], EventDispatcher::[dispatchCustomEvent], EventCustom::[getUserData setUserData], - Component::[serialize] + Component::[serialize], + Console::[addCommand] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], ProgressTimer::[setReverseProgress=setReverseDirection], @@ -147,7 +148,7 @@ base_classes_to_skip = Clonable # classes that create no constructor # Set is special and we will use a hand-written constructor -abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label GLViewProtocol GLView EventAcceleration DisplayLinkDirector Component +abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label GLViewProtocol GLView EventAcceleration DisplayLinkDirector Component Console # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. script_control_cpp = no diff --git a/tools/tolua/cocos2dx_physics.ini b/tools/tolua/cocos2dx_physics.ini index 468d545e6f..85bf2b2643 100644 --- a/tools/tolua/cocos2dx_physics.ini +++ b/tools/tolua/cocos2dx_physics.ini @@ -13,7 +13,7 @@ android_flags = -D_SIZE_T_DEFINED_ clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include clang_flags = -nostdinc -x c++ -std=c++11 -cocos_headers = -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath -I%(cocosdir)s/cocos/physics +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath -I%(cocosdir)s/cocos/physics cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT -DCC_USE_PHYSICS=1 cxxgenerator_headers =