From e03ef10809188400e55634ceba061aba1055a8d9 Mon Sep 17 00:00:00 2001 From: ololomax Date: Thu, 3 Apr 2014 03:06:08 +0300 Subject: [PATCH 01/65] set _node to null in createNodeWithSceneFile _node was being set to null only in constructor, so when we call method createNodeWithSceneFile with path to existing file and then call it again with path to missing file (not calling destroyInstance method), it returns a pointer to previously created node, what may lead to a crash. --- cocos/editor-support/cocostudio/CCSSceneReader.cpp | 1 + 1 file changed, 1 insertion(+) 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)); From 58224d9b233f9c0999432fc8c35648c53d9a76f9 Mon Sep 17 00:00:00 2001 From: Nick Barrios Date: Fri, 4 Apr 2014 06:02:29 -0400 Subject: [PATCH 02/65] CCGLView: Add createWithFullscreen overloaded method that allows passing in Size, to set video mode. --- cocos/2d/platform/desktop/CCGLView.cpp | 21 +++++++++++++++++++++ cocos/2d/platform/desktop/CCGLView.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 91d4b6e000..34444d2fd5 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -317,6 +317,18 @@ GLView* GLView::createWithFullScreen(const std::string& viewName) return nullptr; } +GLView* GLView::createWithFullScreen(const std::string& viewName, Size size, float frameZoomFactor) +{ + auto ret = new GLView(); + if(ret && ret->initWithFullScreen(viewName, size, frameZoomFactor)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + + bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) { setViewName(viewName); @@ -374,6 +386,15 @@ bool GLView::initWithFullScreen(const std::string& viewName) return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f); } +bool GLView::initWithFullScreen(const std::string &viewName, cocos2d::Size size, float frameZoomFactor) +{ + _primaryMonitor = glfwGetPrimaryMonitor(); + if (nullptr == _primaryMonitor) + return false; + + return initWithRect(viewName, Rect(0, 0, size.width, size.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..77c7554a43 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, Size size, float frameZoomFactor = 1.0f); /* *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, Size rect, float frameZoomFactor); bool initGlew(); From eae1ccb279a9f704db38e2dbb7ca0e493b4e7c5c Mon Sep 17 00:00:00 2001 From: Nick Barrios Date: Fri, 4 Apr 2014 06:26:00 -0400 Subject: [PATCH 03/65] CCGLView: Remove frameZoomFactor param from createWithFullScreen overload. --- cocos/2d/platform/desktop/CCGLView.cpp | 6 +++--- cocos/2d/platform/desktop/CCGLView.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 34444d2fd5..4f29628566 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -317,10 +317,10 @@ GLView* GLView::createWithFullScreen(const std::string& viewName) return nullptr; } -GLView* GLView::createWithFullScreen(const std::string& viewName, Size size, float frameZoomFactor) +GLView* GLView::createWithFullScreen(const std::string& viewName, Size size) { auto ret = new GLView(); - if(ret && ret->initWithFullScreen(viewName, size, frameZoomFactor)) { + if(ret && ret->initWithFullScreen(viewName, size)) { ret->autorelease(); return ret; } @@ -386,7 +386,7 @@ bool GLView::initWithFullScreen(const std::string& viewName) return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f); } -bool GLView::initWithFullScreen(const std::string &viewName, cocos2d::Size size, float frameZoomFactor) +bool GLView::initWithFullScreen(const std::string &viewName, cocos2d::Size size) { _primaryMonitor = glfwGetPrimaryMonitor(); if (nullptr == _primaryMonitor) diff --git a/cocos/2d/platform/desktop/CCGLView.h b/cocos/2d/platform/desktop/CCGLView.h index 77c7554a43..92902c4262 100644 --- a/cocos/2d/platform/desktop/CCGLView.h +++ b/cocos/2d/platform/desktop/CCGLView.h @@ -39,7 +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, Size size, float frameZoomFactor = 1.0f); + static GLView* createWithFullScreen(const std::string& viewName, Size size); /* *frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. @@ -83,7 +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, Size rect, float frameZoomFactor); + bool initWithFullScreen(const std::string& viewName, Size rect); bool initGlew(); From 3703c6f73a49b8403c5058b8bb06a97fb9507467 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 8 Apr 2014 18:14:46 +0800 Subject: [PATCH 04/65] update version --- cocos/2d/cocos2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 6b8d5dd090bd09c1f56c50e808e0b534724ff14b Mon Sep 17 00:00:00 2001 From: Nick Barrios Date: Tue, 8 Apr 2014 13:33:24 -0400 Subject: [PATCH 05/65] CCGLView: Add support for specifying video mode and monitor for fullscreen window creation. --- cocos/2d/platform/desktop/CCGLView.cpp | 43 +++++++++++++++++++++----- cocos/2d/platform/desktop/CCGLView.h | 4 ++- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 4f29628566..06d6170887 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -260,7 +260,7 @@ GLView::GLView() , _retinaFactor(1) , _frameZoomFactor(1.0f) , _mainWindow(nullptr) -, _primaryMonitor(nullptr) +, _monitor(nullptr) , _mouseX(0.0f) , _mouseY(0.0f) { @@ -328,6 +328,17 @@ GLView* GLView::createWithFullScreen(const std::string& viewName, Size size) 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) { @@ -340,7 +351,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); @@ -378,23 +389,41 @@ 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, cocos2d::Size size) { - _primaryMonitor = glfwGetPrimaryMonitor(); - if (nullptr == _primaryMonitor) + //Create fullscreen window on primary monitor with the video mode closest to the specified size (refresh rate and bit depth will be at GLFW defaults). + _monitor = glfwGetPrimaryMonitor(); + if (nullptr == _monitor) return false; return initWithRect(viewName, Rect(0, 0, size.width, size.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 92902c4262..89031ed1c7 100644 --- a/cocos/2d/platform/desktop/CCGLView.h +++ b/cocos/2d/platform/desktop/CCGLView.h @@ -40,6 +40,7 @@ public: 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, Size size); + 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. @@ -84,6 +85,7 @@ protected: bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor); bool initWithFullScreen(const std::string& viewName); bool initWithFullScreen(const std::string& viewName, Size rect); + bool initWithFullscreen(const std::string& viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor); bool initGlew(); @@ -109,7 +111,7 @@ protected: float _frameZoomFactor; GLFWwindow* _mainWindow; - GLFWmonitor* _primaryMonitor; + GLFWmonitor* _monitor; float _mouseX; float _mouseY; From 9c2a14825688e3be6bcc8655fdcf4f3d4d1e2d1f Mon Sep 17 00:00:00 2001 From: Nick Barrios Date: Tue, 8 Apr 2014 14:02:36 -0400 Subject: [PATCH 06/65] CCGLView: Remove createWithFullScreen(const std::string& viewName, Size size) overload. Use more specific createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor) instead. --- cocos/2d/platform/desktop/CCGLView.cpp | 21 --------------------- cocos/2d/platform/desktop/CCGLView.h | 1 - 2 files changed, 22 deletions(-) diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 06d6170887..b52fe35ae2 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -317,17 +317,6 @@ GLView* GLView::createWithFullScreen(const std::string& viewName) return nullptr; } -GLView* GLView::createWithFullScreen(const std::string& viewName, Size size) -{ - auto ret = new GLView(); - if(ret && ret->initWithFullScreen(viewName, size)) { - ret->autorelease(); - return ret; - } - - return nullptr; -} - GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor) { auto ret = new GLView(); @@ -398,16 +387,6 @@ bool GLView::initWithFullScreen(const std::string& viewName) return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f); } -bool GLView::initWithFullScreen(const std::string &viewName, cocos2d::Size size) -{ - //Create fullscreen window on primary monitor with the video mode closest to the specified size (refresh rate and bit depth will be at GLFW defaults). - _monitor = glfwGetPrimaryMonitor(); - if (nullptr == _monitor) - return false; - - return initWithRect(viewName, Rect(0, 0, size.width, size.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. diff --git a/cocos/2d/platform/desktop/CCGLView.h b/cocos/2d/platform/desktop/CCGLView.h index 89031ed1c7..afe45a214b 100644 --- a/cocos/2d/platform/desktop/CCGLView.h +++ b/cocos/2d/platform/desktop/CCGLView.h @@ -84,7 +84,6 @@ protected: bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor); bool initWithFullScreen(const std::string& viewName); - bool initWithFullScreen(const std::string& viewName, Size rect); bool initWithFullscreen(const std::string& viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor); bool initGlew(); From e98e4c403fde04b8d6a09f36336a43ec0da6e002 Mon Sep 17 00:00:00 2001 From: Anton Sokolchenko Date: Wed, 9 Apr 2014 12:00:15 +0300 Subject: [PATCH 07/65] Potential leak of an object stored into "self" 1. By executing 314: _systemControl = [[CCEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this]; 2. We entered to the function 67: -(id) initWithFrame: (CGRect) frameRect editBox: (void*) editBox 3. Then 69: "self = [super init];" returns object with +1 retain count 4. 93: "return nil" Potential leak of an object stored into "self". --- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index d2ba95be02..bd41fea92d 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -67,13 +67,11 @@ static const int CC_EDIT_BOX_PADDING = 5; -(id) initWithFrame: (CGRect) frameRect editBox: (void*) editBox { self = [super init]; - - do - { - if (self == nil) break; + if(self){ editState_ = NO; self.textField = [[[CCCustomUITextField alloc] initWithFrame: frameRect] autorelease]; - if (!textField_) break; + //TODO: what is the line below doing? + //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 +82,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 From 67652357e1799f19a761895869e371920983c268 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 9 Apr 2014 21:35:08 +0800 Subject: [PATCH 08/65] 1.Makes the create functions of Label clear. --- cocos/2d/CCLabel.cpp | 352 +++++++----------- cocos/2d/CCLabel.h | 62 ++- cocos/2d/CCLabelTTF.cpp | 8 +- cocos/2d/CCMenuItem.cpp | 4 +- cocos/2d/CCTextFieldTTF.cpp | 4 +- .../cocosbuilder/CCLabelTTFLoader.cpp | 2 +- cocos/ui/UIButton.cpp | 4 +- cocos/ui/UIRichText.cpp | 6 +- cocos/ui/UIText.cpp | 2 +- cocos/ui/UITextField.cpp | 6 +- .../CCControlExtension/CCControlButton.cpp | 14 +- .../CCControlExtension/CCControlStepper.cpp | 4 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 6 +- .../AccelerometerTest/AccelerometerTest.cpp | 2 +- .../ActionManagerTest/ActionManagerTest.cpp | 6 +- .../ActionsProgressTest.cpp | 6 +- .../Classes/ActionsTest/ActionsTest.cpp | 18 +- .../cpp-tests/Classes/Box2DTest/Box2dTest.cpp | 4 +- .../Classes/Box2DTestBed/Box2dView.cpp | 2 +- tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp | 2 +- .../Bug-458/QuestionContainerSprite.cpp | 2 +- tests/cpp-tests/Classes/BugsTest/Bug-624.cpp | 4 +- tests/cpp-tests/Classes/BugsTest/Bug-914.cpp | 2 +- .../Classes/ChipmunkTest/ChipmunkTest.cpp | 4 +- .../ClippingNodeTest/ClippingNodeTest.cpp | 4 +- .../CocosDenshionTest/CocosDenshionTest.cpp | 20 +- tests/cpp-tests/Classes/CurlTest/CurlTest.cpp | 4 +- .../CurrentLanguageTest.cpp | 4 +- .../DataVisitorTest/DataVisitorTest.cpp | 4 +- .../Classes/EffectsTest/EffectsTest.cpp | 2 +- .../CocoStudioArmatureTest/ArmatureScene.cpp | 8 +- .../GameOverScene.cpp | 2 +- .../CocoStudioGUITest/CocoStudioGUITest.cpp | 2 +- .../CocoStudioGUITest/CocosGUIScene.cpp | 2 +- .../CocoStudioGUITest/CustomGUIScene.cpp | 2 +- .../CustomImageTest/CustomImageTest.cpp | 2 +- .../CustomParticleWidgetTest.cpp | 2 +- .../CocoStudioGUITest/GUIEditorTest.cpp | 2 +- .../CocoStudioSceneTest/SceneEditorTest.cpp | 4 +- .../CCControlButtonTest.cpp | 10 +- .../CCControlColourPickerTest.cpp | 2 +- .../CCControlPotentiometerTest.cpp | 2 +- .../ControlExtensionTest/CCControlScene.cpp | 2 +- .../CCControlSliderTest.cpp | 2 +- .../CCControlStepperTest.cpp | 2 +- .../CCControlSwitchTest.cpp | 6 +- .../EditBoxTest/EditBoxTest.cpp | 2 +- .../NetworkTest/HttpClientTest.cpp | 14 +- .../NetworkTest/SocketIOTest.cpp | 20 +- .../NetworkTest/WebSocketTest.cpp | 12 +- .../NotificationCenterTest.cpp | 8 +- .../TableViewTest/TableViewTestScene.cpp | 2 +- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 6 +- tests/cpp-tests/Classes/FontTest/FontTest.cpp | 8 +- .../cpp-tests/Classes/InputTest/MouseTest.cpp | 6 +- .../Classes/KeyboardTest/KeyboardTest.cpp | 4 +- .../Classes/KeypadTest/KeypadTest.cpp | 4 +- .../Classes/LabelTest/LabelTestNew.cpp | 11 +- .../cpp-tests/Classes/LayerTest/LayerTest.cpp | 4 +- tests/cpp-tests/Classes/MenuTest/MenuTest.cpp | 2 +- .../Classes/MutiTouchTest/MutiTouchTest.cpp | 2 +- .../NewEventDispatcherTest.cpp | 10 +- .../PerformanceTest/PerformanceAllocTest.cpp | 6 +- .../PerformanceContainerTest.cpp | 6 +- .../PerformanceEventDispatcherTest.cpp | 6 +- .../PerformanceTest/PerformanceLabelTest.cpp | 6 +- .../PerformanceNodeChildrenTest.cpp | 6 +- .../PerformanceParticleTest.cpp | 4 +- .../PerformanceScenarioTest.cpp | 10 +- .../PerformanceTest/PerformanceSpriteTest.cpp | 6 +- .../PerformanceTextureTest.cpp | 4 +- .../PerformanceTouchesTest.cpp | 6 +- .../Classes/PhysicsTest/PhysicsTest.cpp | 18 +- .../ReleasePoolTest/ReleasePoolTest.cpp | 2 +- .../RenderTextureTest/RenderTextureTest.cpp | 6 +- .../RotateWorldTest/RotateWorldTest.cpp | 2 +- .../Classes/TextInputTest/TextInputTest.cpp | 4 +- .../Classes/Texture2dTest/Texture2dTest.cpp | 2 +- .../TextureCacheTest/TextureCacheTest.cpp | 4 +- .../TextureAtlasEncryptionTest.cpp | 8 +- .../TransitionsTest/TransitionsTest.cpp | 8 +- .../UserDefaultTest/UserDefaultTest.cpp | 2 +- 82 files changed, 381 insertions(+), 466 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 8a7325fc47..54920ec205 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -47,176 +47,133 @@ 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::createWithFont(const std::string& text, const std::string& fontNameOrFontFile, 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(fontNameOrFontFile)) { - if (FileUtils::getInstance()->isFileExist(fontName)) + TTFConfig ttfConfig(fontNameOrFontFile.c_str(),fontSize,GlyphCollection::DYNAMIC); + if (ret->setTTFConfig(ttfConfig)) { - TTFConfig ttfConfig(fontName.c_str(),fontSize,GlyphCollection::DYNAMIC); - if (ret->setTTFConfig(ttfConfig)) - { - break; - } + ret->setDimensions(dimensions.width,dimensions.height); + ret->setString(text); + + ret->autorelease(); + + return ret; } + } + else + { + ret->setFont(fontNameOrFontFile); + ret->setFontSize(fontSize); + ret->setDimensions(dimensions.width, dimensions.height); + ret->setString(text); - FontDefinition fontDef; - fontDef._fontName = fontName; - fontDef._fontSize = fontSize; - fontDef._dimensions = dimensions; - fontDef._alignment = hAlignment; - fontDef._vertAlignment = vAlignment; - ret->setFontDefinition(fontDef); - } while (0); + ret->autorelease(); - ret->setDimensions(dimensions.width,dimensions.height); - ret->setString(text); - ret->autorelease(); - } + return ret; + } + } - 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; + delete ret; + return nullptr; } -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 */) +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 */) { - TTFConfig ttfConfig(fontFilePath.c_str(),fontSize,glyphs,customGlyphs,useDistanceField); - return createWithTTF(ttfConfig,text,alignment,maxLineWidth); + if (FileUtils::getInstance()->isFileExist(fontFile)) + { + return createWithFont(text, fontFile, fontSize, dimensions, hAlignment, vAlignment); + } + 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 +253,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,13 +291,8 @@ void Label::reset() TTFConfig temp; _fontConfig = temp; - _fontDefinition._fontName = "Helvetica"; - _fontDefinition._fontSize = 12; - _fontDefinition._alignment = _hAlignment; - _fontDefinition._vertAlignment = _vAlignment; - _fontDirty = false; - _fontName = "Helvetica"; + _fontNameOrFontFile = "Helvetica"; _fontSize = 12; _batchNodes.clear(); @@ -476,9 +439,6 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) } } - _fontDefinition._shadow._shadowEnabled = false; - _fontDefinition._stroke._strokeEnabled = false; - return true; } @@ -498,27 +458,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 +468,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 +488,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 +735,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 +758,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 +769,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 +778,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 +900,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 +918,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 +951,49 @@ void Label::updateContent() _shadowNode = nullptr; } } + if (_fontAtlas) { alignText(); } else { + _fontDefinition._fontName = _fontNameOrFontFile; + _fontDefinition._fontSize = _fontSize; + + _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 +1001,21 @@ void Label::updateContent() void Label::updateFont() { - if (FileUtils::getInstance()->isFileExist(_fontName)) + if (FileUtils::getInstance()->isFileExist(_fontNameOrFontFile)) { - _fontConfig.fontFilePath = _fontName; + _fontConfig.fontFilePath = _fontNameOrFontFile; _fontConfig.fontSize = _fontSize; setTTFConfig(_fontConfig); } - _fontDefinition._fontName = _fontName; - _fontDefinition._fontSize = _fontSize; + else if (_fontAtlas) + { + _batchNodes.clear(); + _batchNodes.push_back(this); + + FontAtlasCache::releaseFontAtlas(_fontAtlas); + _fontAtlas = nullptr; + } + _contentDirty = true; _fontDirty = false; } @@ -1064,18 +1024,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 +1033,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,18 +1108,18 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent setOrderOfArrival(0); } -void Label::setFontName(const std::string& fontName) +void Label::setFont(const std::string& fontNameOrFileFile) { - if (fontName != _fontName) + if (fontNameOrFileFile != _fontNameOrFontFile) { - _fontName = fontName; + _fontNameOrFontFile = fontNameOrFileFile; _fontDirty = true; } } -const std::string& Label::getFontName() const +const std::string& Label::getFont() const { - return _fontName; + return _fontNameOrFontFile; } void Label::setFontSize(float fontSize) @@ -1381,26 +1331,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..984bfa9349 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -82,18 +82,19 @@ 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. + * */ - static Label * create(const std::string& text, const std::string& fontName, float fontSize, + static Label * createWithFont(const std::string& text, const std::string& fontNameOrFontFile, 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. + /** Create a label with TTF configuration + * It 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,12 +103,6 @@ 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); @@ -118,14 +113,6 @@ 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); - - /** get the text definition used by this label */ - const FontDefinition& getFontDefinition() const { return _fontDefinition; } - /** 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,8 +177,8 @@ public: /** update content immediately.*/ virtual void updateContent(); - virtual void setFontName(const std::string& fontName); - virtual const std::string& getFontName() const; + virtual void setFont(const std::string& fontNameOrFileFile); + virtual const std::string& getFont() const; virtual void setFontSize(float fontSize); virtual float getFontSize() const; @@ -243,22 +230,25 @@ 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. + CC_DEPRECATED_ATTRIBUTE static Label * create(const std::string& text, const std::string& fontNameOrFontFile, float fontSize, + const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, + TextVAlignment vAlignment = TextVAlignment::TOP) { + return createWithFont(text, fontNameOrFontFile, fontSize, dimensions, hAlignment, vAlignment); + } + + /** 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. */ - void listenToBackground(EventCustom *event); + CC_DEPRECATED_ATTRIBUTE 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); - /** Listen "FontAtlas purge textures" message - */ - void listenToFontAtlasPurge(EventCustom *event); + CC_DEPRECATED_ATTRIBUTE virtual void setFontName(const std::string& fontName) { setFont(fontName);} + CC_DEPRECATED_ATTRIBUTE virtual const std::string& getFontName() const { return getFont();} - 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 virtual void setFontDefinition(const FontDefinition& textDefinition); + CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; } - 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); @@ -318,12 +308,14 @@ protected: void updateFont(); void reset(); + + std::string _bmFontPath; bool _isOpacityModifyRGB; bool _contentDirty; bool _fontDirty; - std::string _fontName; + std::string _fontNameOrFontFile; float _fontSize; LabelType _currentLabelType; @@ -380,6 +372,8 @@ protected: float _shadowOpacity; Sprite* _shadowNode; + int _outlineSize; + Color4B _textColor; Color4F _textColorF; diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 581d52274b..3aa946022c 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -100,7 +100,7 @@ bool LabelTTF::initWithString(const std::string& string, const std::string& font _renderLabel->setFontSize(fontSize); _renderLabel->setDimensions(dimensions.width,dimensions.height); _renderLabel->setAlignment(hAlignment,vAlignment); - _renderLabel->setFontName(fontName); + _renderLabel->setFont(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->getFont().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str()); } TextHAlignment LabelTTF::getHorizontalAlignment() const @@ -177,12 +177,12 @@ void LabelTTF::setFontSize(float fontSize) const std::string& LabelTTF::getFontName() const { - return _renderLabel->getFontName(); + return _renderLabel->getFont(); } void LabelTTF::setFontName(const std::string& fontName) { - _renderLabel->setFontName(fontName); + _renderLabel->setFont(fontName); _contentDirty = true; } diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 3615905f6b..1b6fe8a657 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -439,7 +439,7 @@ bool MenuItemFont::initWithString(const std::string& value, const ccMenuCallback _fontName = _globalFontName; _fontSize = _globalFontSize; - Label *label = Label::create(value, _fontName, _fontSize); + Label *label = Label::createWithFont(value, _fontName, _fontSize); if (MenuItemLabel::initWithLabel(label, callback)) { // do something ? @@ -462,7 +462,7 @@ int MenuItemFont::getFontSizeObj() const void MenuItemFont::setFontNameObj(const std::string& name) { _fontName = name; - dynamic_cast(_label)->setFontName(_fontName); + dynamic_cast(_label)->setFont(_fontName); this->setContentSize(dynamic_cast(_label)->getContentSize()); } diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index b12bd2dd8a..fdb1a1cbf5 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -111,7 +111,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz { _placeHolder = placeholder; setDimensions(dimensions.width,dimensions.height); - setFontName(fontName); + setFont(fontName); setFontSize(fontSize); setAlignment(alignment,TextVAlignment::CENTER); Label::setTextColor(_colorSpaceHolder); @@ -122,7 +122,7 @@ 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); + setFont(fontName); setFontSize(fontSize); Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); diff --git a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp index 5cb003b629..fb1e405dee 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)->setFont(pFontTTF); } else { NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader); } diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 7db30e09ff..22ccadfb07 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -699,12 +699,12 @@ float Button::getTitleFontSize() const void Button::setTitleFontName(const std::string& fontName) { - _titleRenderer->setFontName(fontName); + _titleRenderer->setFont(fontName); } const std::string& Button::getTitleFontName() const { - return _titleRenderer->getFontName(); + return _titleRenderer->getFont(); } std::string Button::getDescription() const diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 178ca2870e..a617d422f8 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -210,7 +210,7 @@ void RichText::formatText() case RICH_TEXT: { RichElementText* elmtText = static_cast(element); - elementRenderer = Label::create(elmtText->_text.c_str(), elmtText->_fontName.c_str(), elmtText->_fontSize); + elementRenderer = Label::createWithFont(elmtText->_text.c_str(), elmtText->_fontName.c_str(), elmtText->_fontSize); break; } case RICH_IMAGE: @@ -272,7 +272,7 @@ 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); + Label* textRenderer = Label::createWithFont(text, fontName, fontSize); float textRendererWidth = textRenderer->getContentSize().width; _leftSpaceWidth -= textRendererWidth; if (_leftSpaceWidth < 0.0f) @@ -285,7 +285,7 @@ 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); + Label* leftRenderer = Label::createWithFont(leftWords.substr(0, leftLength).c_str(), fontName, fontSize); leftRenderer->setColor(color); leftRenderer->setOpacity(opacity); pushToContainer(leftRenderer); diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 1e504a52e7..ba47a4c9e6 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -132,7 +132,7 @@ int Text::getFontSize() void Text::setFontName(const std::string& name) { _fontName = name; - _labelRenderer->setFontName(name); + _labelRenderer->setFont(name); labelScaleChangedWithSize(); } diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index b9878a20d4..cbacc93f0e 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -542,13 +542,13 @@ int TextField::getFontSize() void TextField::setFontName(const std::string& name) { - _textFieldRenderer->setFontName(name); + _textFieldRenderer->setFont(name); textfieldRendererScaleChangedWithSize(); } const std::string& TextField::getFontName() { - return _textFieldRenderer->getFontName(); + return _textFieldRenderer->getFont(); } void TextField::didNotSelectSelf() @@ -807,7 +807,7 @@ void TextField::copySpecialProperties(Widget *widget) setText(textField->_textFieldRenderer->getString()); setPlaceHolder(textField->getStringValue()); setFontSize(textField->_textFieldRenderer->getFontSize()); - setFontName(textField->_textFieldRenderer->getFontName().c_str()); + setFontName(textField->_textFieldRenderer->getFont().c_str()); 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..73db73499f 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::createWithFont("", "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::createWithFont(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::createWithFont("", "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::createWithFont(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->getFont(); } static std::string ret(""); diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f299cc0bc9..be079b2e28 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -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::createWithFont("-", 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::createWithFont("+", 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/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index b532285370..4fad732b34 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -94,12 +94,12 @@ bool EditBoxImplWin::initWithSize(const Size& size) void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setFontName(pFontName); + _label->setFont(pFontName); _label->setFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); + _labelPlaceHolder->setFont(pFontName); _labelPlaceHolder->setFontSize(fontSize); } } @@ -113,7 +113,7 @@ void EditBoxImplWin::setFontColor(const Color3B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); + _labelPlaceHolder->setFont(pFontName); _labelPlaceHolder->setFontSize(fontSize); } } diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp index 9cbdf390e4..545ec5fa2e 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::createWithFont(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..7d369a0d29 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::createWithFont("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::createWithFont("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::createWithFont("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..7cee0a8ebd 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::createWithFont("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::createWithFont("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::createWithFont("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..4f7fe2ab7f 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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 7b615f539c..795c22fbbd 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -43,14 +43,14 @@ Box2DTestLayer::Box2DTestLayer() addNewSpriteAtPosition(VisibleRect::center()); - auto label = Label::create("Tap screen", "fonts/Marker Felt.ttf", 32.0f); + auto label = Label::createWithFont("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::createWithFont("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..bdf57dc550 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::createWithFont(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..71a36cbcc5 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::createWithFont("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..8750897485 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::createWithFont("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..89aaaca7dd 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::createWithFont("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::createWithFont("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..bda3f87cac 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::createWithFont("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..982b36101e 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::createWithFont("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::createWithFont("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..85409006db 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::createWithFont(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::createWithFont(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..8534c3eca5 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -91,7 +91,7 @@ private: bool initTextButton(const char *text) { - _child = Label::create(text, "fonts/arial.ttf", 16); + _child = Label::createWithFont(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::createWithFont(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::createWithFont(buffer, "fonts/arial.ttf", 8); addChild(_lblMaxValue); if (_direction == Vertical) _lblMaxValue->setPosition(Point(12.0, 50.0)); @@ -256,7 +256,7 @@ void CocosDenshionTest::onExit() void CocosDenshionTest::addButtons() { - auto lblMusic = Label::create("Control Music", "fonts/arial.ttf", 24); + auto lblMusic = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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/CurlTest/CurlTest.cpp b/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp index 4e6573d649..7bb462968b 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::createWithFont("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::createWithFont("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..cc620f33d6 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::createWithFont("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::createWithFont("", "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..f475038ac7 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::createWithFont(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::createWithFont(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/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index ed39dd9c57..3fcd8e1fba 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::createWithFont((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32); label->setPosition( Point(VisibleRect::center().x,VisibleRect::top().y-80) ); addChild(label); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 6be259f49d..2270cc07b1 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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont("Change Mount", "fonts/arial.ttf", 20); MenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CC_CALLBACK_1(TestArmatureNesting2::changeMountCallback, this)); Menu* pMenu =Menu::create(pMenuItem, nullptr); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp index 6021f53404..835ac39780 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::createWithFont("","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..adcf2333cd 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::createWithFont("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..debff2e2f8 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::createWithFont("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..7dd00b886c 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::createWithFont("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..bdd3c5f96b 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::createWithFont("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..b2b19b2a92 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::createWithFont("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/GUIEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp index e3fad5940c..7269a58822 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::createWithFont("Back", "fonts/arial.ttf", 20); auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(GUIEditorTestScene::BackCallback, this)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index 43430fc1a1..4a395ca53d 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::createWithFont(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::createWithFont(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/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp index e629274003..0a4953f14e 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::createWithFont(title, "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); @@ -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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont(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..1d00b2d160 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::createWithFont("#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..7ae9750b85 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp @@ -55,7 +55,7 @@ bool ControlPotentiometerTest::init() layer_width += background->getContentSize().width; - this->setDisplayValueLabel(Label::create("", "HelveticaNeue-Bold", 30)); + this->setDisplayValueLabel(Label::createWithFont("", "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..07f7c7a701 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -60,7 +60,7 @@ bool ControlScene::init() addChild(ribbon); // Add the title - setSceneTitleLabel(Label::create("Title", "fonts/arial.ttf", 12)); + setSceneTitleLabel(Label::createWithFont("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..9315c12858 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::createWithFont("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..d994263a07 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp @@ -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::createWithFont("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..83c8727032 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::createWithFont("#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::createWithFont("On", "Arial-BoldMT", 16), + Label::createWithFont("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..17b192a462 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::createWithFont("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/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index ac5310ca12..680e4342d0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -14,7 +14,7 @@ HttpClientTest::HttpClientTest() const int MARGIN = 40; const int SPACE = 35; - auto label = Label::create("Http Request Test", "fonts/arial.ttf", 28); + auto label = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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..66d3f0427b 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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..9755baf243 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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..a596448c96 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -88,8 +88,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::createWithFont("switch off", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithFont("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 +110,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::createWithFont("not connected", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithFont("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..c4a142ef0f 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::createWithFont(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..76cf3fe293 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::createWithFont(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::createWithFont(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::createWithFont(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..eb6ab4f87c 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::createWithFont(pFont, pFont, 24); + auto left = Label::createWithFont("alignment left", pFont, fontSize, blockSize, TextHAlignment::LEFT, verticalAlignment[vAlignIdx]); - auto center = Label::create("alignment center", pFont, fontSize, + auto center = Label::createWithFont("alignment center", pFont, fontSize, blockSize, TextHAlignment::CENTER, verticalAlignment[vAlignIdx]); - auto right = Label::create("alignment right", pFont, fontSize, + auto right = Label::createWithFont("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..d40e3ac0e5 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::createWithFont("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::createWithFont("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::createWithFont("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..fa5a74a2aa 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::createWithFont("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::createWithFont("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..fd58498754 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::createWithFont("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::createWithFont("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..874e51e23f 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::createWithFont("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::createWithFont("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..101f759966 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::createWithFont("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26); + auto label2 = Label::createWithFont("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..5c59b3bca3 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::createWithFont("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..0fa06262f0 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::createWithFont("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..d09a6bb261 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -384,7 +384,7 @@ void RemoveListenerWhenDispatching::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, sprite1); - auto statusLabel = Label::create("The sprite could be touched!", "", 20); + auto statusLabel = Label::createWithFont("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 +433,7 @@ void CustomEventTest::onEnter() MenuItemFont::setFontSize(20); - auto statusLabel = Label::create("No custom event 1 received!", "", 20); + auto statusLabel = Label::createWithFont("No custom event 1 received!", "", 20); statusLabel->setPosition(origin + Point(size.width/2, size.height-90)); addChild(statusLabel); @@ -459,7 +459,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::createWithFont("No custom event 2 received!", "", 20); statusLabel2->setPosition(origin + Point(size.width/2, size.height-120)); addChild(statusLabel2); @@ -516,7 +516,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::createWithFont("No keyboard event received!", "", 20); statusLabel->setPosition(origin + Point(size.width/2, size.height/2)); addChild(statusLabel); @@ -1189,7 +1189,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::createWithFont("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/PerformanceTest/PerformanceAllocTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp index ad0e8d754a..7e6978bc8f 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::createWithFont(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::createWithFont(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::createWithFont("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..e2c829759d 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::createWithFont(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::createWithFont(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::createWithFont("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..8543ce95e2 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::createWithFont(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::createWithFont(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::createWithFont("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..2fc8f76b35 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::createWithFont("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::createWithFont(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::createWithFont("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..f5efa8a635 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::createWithFont(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::createWithFont(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::createWithFont("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..3ab33a4b59 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::createWithFont("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::createWithFont(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..383bfdf603 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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont(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::createWithFont("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..90c76f4230 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::createWithFont("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::createWithFont(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::createWithFont(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..57b814c3bc 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::createWithFont(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::createWithFont(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..7d04fae0e2 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::createWithFont(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::createWithFont(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::createWithFont("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..cccc2b7c98 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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont(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::createWithFont(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::createWithFont(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::createWithFont(buffer, "fonts/arial.ttf", 32); root->addChild(label, 1); label->setPosition(Point(s.width/2, s.height-170)); diff --git a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp index 80fc376d80..1e34e7c3bd 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::createWithFont("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..2bb6695046 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::createWithFont("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::createWithFont("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::createWithFont("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..0590532a6d 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::createWithFont("cocos2d", "Tahoma", 64); label->setPosition( Point(x/2,y/2) ); diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index 3d73f7816a..d42d5ab741 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::createWithFont(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::createWithFont(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..e6f6e9772d 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::createWithFont("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..1bbc93f567 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::createWithFont("loading...", "fonts/arial.ttf", 15); + _labelPercent = Label::createWithFont("%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..58daa5c992 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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont("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..3cb9c20ef8 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::createWithFont( (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::createWithFont("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::createWithFont((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::createWithFont("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..54d1940051 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::createWithFont("CCUserDefault test see log", "fonts/arial.ttf", 28); addChild(label, 0); label->setPosition( Point(s.width/2, s.height-50) ); From 76689cda1a99b2a69684d32f4b35c14e83420522 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 9 Apr 2014 21:40:10 +0800 Subject: [PATCH 09/65] fixed compile errors. --- extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 6 +++--- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index f46499e44c..29438c81f0 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -92,12 +92,12 @@ bool EditBoxImplAndroid::initWithSize(const Size& size) void EditBoxImplAndroid::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setFontName(pFontName); + _label->setFont(pFontName); _label->setFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); + _labelPlaceHolder->setFont(pFontName); _labelPlaceHolder->setFontSize(fontSize); } } @@ -111,7 +111,7 @@ void EditBoxImplAndroid::setFontColor(const Color3B& color) void EditBoxImplAndroid::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFontName(pFontName); + _labelPlaceHolder->setFont(pFontName); _labelPlaceHolder->setFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index d2ba95be02..264a3efb24 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -395,9 +395,9 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) [_systemControl.textField setFont:textFont]; } - _label->setFontName(pFontName); + _label->setFont(pFontName); _label->setFontSize(fontSize); - _labelPlaceHolder->setFontName(pFontName); + _labelPlaceHolder->setFont(pFontName); _labelPlaceHolder->setFontSize(fontSize); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index 167967e312..a16f47e87d 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -118,12 +118,12 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size ) void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize ) { if(m_pLabel != NULL) { - m_pLabel->setFontName(pFontName); + m_pLabel->setFont(pFontName); m_pLabel->setFontSize(fontSize); } if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setFontName(pFontName); + m_pLabelPlaceHolder->setFont(pFontName); m_pLabelPlaceHolder->setFontSize(fontSize); } } @@ -137,7 +137,7 @@ void CCEditBoxImplWp8::setFontColor( const Color3B& color ) void CCEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize ) { if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setFontName(pFontName); + m_pLabelPlaceHolder->setFont(pFontName); m_pLabelPlaceHolder->setFontSize(fontSize); } } From 05b8123803328ebcb8135d0d30e7de319a394fec Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 9 Apr 2014 23:31:05 +0800 Subject: [PATCH 10/65] Label:Makes the create functions of Label just do one thing. --- cocos/2d/CCLabel.cpp | 87 ++++++++----------- cocos/2d/CCLabel.h | 49 +++++------ cocos/2d/CCLabelTTF.cpp | 14 +-- cocos/2d/CCMenuItem.cpp | 6 +- cocos/2d/CCTextFieldTTF.cpp | 8 +- .../cocosbuilder/CCLabelTTFLoader.cpp | 4 +- cocos/ui/UIButton.cpp | 8 +- cocos/ui/UIRichText.cpp | 40 +++++++-- cocos/ui/UIText.cpp | 6 +- cocos/ui/UITextField.cpp | 12 +-- .../CCControlExtension/CCControlButton.cpp | 14 +-- .../CCControlExtension/CCControlStepper.cpp | 4 +- .../GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 16 ++-- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 8 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 16 ++-- extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp | 12 +-- .../AccelerometerTest/AccelerometerTest.cpp | 2 +- .../ActionManagerTest/ActionManagerTest.cpp | 6 +- .../ActionsProgressTest.cpp | 6 +- .../Classes/ActionsTest/ActionsTest.cpp | 18 ++-- .../cpp-tests/Classes/Box2DTest/Box2dTest.cpp | 4 +- .../Classes/Box2DTestBed/Box2dView.cpp | 2 +- tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp | 2 +- .../Bug-458/QuestionContainerSprite.cpp | 2 +- tests/cpp-tests/Classes/BugsTest/Bug-624.cpp | 4 +- tests/cpp-tests/Classes/BugsTest/Bug-914.cpp | 2 +- .../Classes/ChipmunkTest/ChipmunkTest.cpp | 4 +- .../ClippingNodeTest/ClippingNodeTest.cpp | 4 +- .../CocosDenshionTest/CocosDenshionTest.cpp | 20 ++--- tests/cpp-tests/Classes/CurlTest/CurlTest.cpp | 4 +- .../CurrentLanguageTest.cpp | 4 +- .../DataVisitorTest/DataVisitorTest.cpp | 4 +- .../Classes/EffectsTest/EffectsTest.cpp | 2 +- .../CocoStudioArmatureTest/ArmatureScene.cpp | 8 +- .../GameOverScene.cpp | 2 +- .../CocoStudioGUITest/CocoStudioGUITest.cpp | 2 +- .../CocoStudioGUITest/CocosGUIScene.cpp | 2 +- .../CocoStudioGUITest/CustomGUIScene.cpp | 2 +- .../CustomImageTest/CustomImageTest.cpp | 2 +- .../CustomParticleWidgetTest.cpp | 2 +- .../CocoStudioGUITest/GUIEditorTest.cpp | 2 +- .../CocoStudioSceneTest/SceneEditorTest.cpp | 4 +- .../CCControlButtonTest.cpp | 10 +-- .../CCControlColourPickerTest.cpp | 2 +- .../CCControlPotentiometerTest.cpp | 2 +- .../ControlExtensionTest/CCControlScene.cpp | 2 +- .../CCControlSliderTest.cpp | 2 +- .../CCControlStepperTest.cpp | 2 +- .../CCControlSwitchTest.cpp | 6 +- .../EditBoxTest/EditBoxTest.cpp | 2 +- .../NetworkTest/HttpClientTest.cpp | 14 +-- .../NetworkTest/SocketIOTest.cpp | 20 ++--- .../NetworkTest/WebSocketTest.cpp | 12 +-- .../NotificationCenterTest.cpp | 8 +- .../TableViewTest/TableViewTestScene.cpp | 2 +- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 6 +- tests/cpp-tests/Classes/FontTest/FontTest.cpp | 8 +- .../cpp-tests/Classes/InputTest/MouseTest.cpp | 6 +- .../Classes/KeyboardTest/KeyboardTest.cpp | 4 +- .../Classes/KeypadTest/KeypadTest.cpp | 4 +- .../Classes/LabelTest/LabelTestNew.cpp | 4 +- .../cpp-tests/Classes/LayerTest/LayerTest.cpp | 4 +- tests/cpp-tests/Classes/MenuTest/MenuTest.cpp | 2 +- .../Classes/MutiTouchTest/MutiTouchTest.cpp | 2 +- .../NewEventDispatcherTest.cpp | 10 +-- .../PerformanceTest/PerformanceAllocTest.cpp | 6 +- .../PerformanceContainerTest.cpp | 6 +- .../PerformanceEventDispatcherTest.cpp | 6 +- .../PerformanceTest/PerformanceLabelTest.cpp | 6 +- .../PerformanceNodeChildrenTest.cpp | 6 +- .../PerformanceParticleTest.cpp | 4 +- .../PerformanceScenarioTest.cpp | 10 +-- .../PerformanceTest/PerformanceSpriteTest.cpp | 6 +- .../PerformanceTextureTest.cpp | 4 +- .../PerformanceTouchesTest.cpp | 6 +- .../Classes/PhysicsTest/PhysicsTest.cpp | 18 ++-- .../ReleasePoolTest/ReleasePoolTest.cpp | 2 +- .../RenderTextureTest/RenderTextureTest.cpp | 6 +- .../RotateWorldTest/RotateWorldTest.cpp | 2 +- .../Classes/TextInputTest/TextInputTest.cpp | 4 +- .../Classes/Texture2dTest/Texture2dTest.cpp | 2 +- .../TextureCacheTest/TextureCacheTest.cpp | 4 +- .../TextureAtlasEncryptionTest.cpp | 8 +- .../TransitionsTest/TransitionsTest.cpp | 8 +- .../UserDefaultTest/UserDefaultTest.cpp | 2 +- 85 files changed, 336 insertions(+), 334 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 54920ec205..c1facf2cbb 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -55,30 +55,36 @@ Label* Label::create() return ret; } -Label* Label::createWithFont(const std::string& text, const std::string& fontNameOrFontFile, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) +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) { - if (FileUtils::getInstance()->isFileExist(fontNameOrFontFile)) - { - TTFConfig ttfConfig(fontNameOrFontFile.c_str(),fontSize,GlyphCollection::DYNAMIC); - if (ret->setTTFConfig(ttfConfig)) - { - ret->setDimensions(dimensions.width,dimensions.height); - ret->setString(text); + ret->setSystemFont(font); + ret->setSystemFontSize(fontSize); + ret->setDimensions(dimensions.width, dimensions.height); + ret->setString(text); - ret->autorelease(); + ret->autorelease(); - return ret; - } - } - else + 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->setFont(fontNameOrFontFile); - ret->setFontSize(fontSize); - ret->setDimensions(dimensions.width, dimensions.height); + ret->setDimensions(dimensions.width,dimensions.height); ret->setString(text); ret->autorelease(); @@ -108,15 +114,6 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, 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 */) -{ - if (FileUtils::getInstance()->isFileExist(fontFile)) - { - return createWithFont(text, fontFile, fontSize, dimensions, hAlignment, vAlignment); - } - 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); @@ -292,8 +289,8 @@ void Label::reset() _fontConfig = temp; _fontDirty = false; - _fontNameOrFontFile = "Helvetica"; - _fontSize = 12; + _systemFont = "Helvetica"; + _systemFontSize = 12; _batchNodes.clear(); _batchNodes.push_back(this); @@ -958,8 +955,8 @@ void Label::updateContent() } else { - _fontDefinition._fontName = _fontNameOrFontFile; - _fontDefinition._fontSize = _fontSize; + _fontDefinition._fontName = _systemFont; + _fontDefinition._fontSize = _systemFontSize; _fontDefinition._alignment = _hAlignment; _fontDefinition._vertAlignment = _vAlignment; @@ -1001,13 +998,7 @@ void Label::updateContent() void Label::updateFont() { - if (FileUtils::getInstance()->isFileExist(_fontNameOrFontFile)) - { - _fontConfig.fontFilePath = _fontNameOrFontFile; - _fontConfig.fontSize = _fontSize; - setTTFConfig(_fontConfig); - } - else if (_fontAtlas) + if (_fontAtlas) { _batchNodes.clear(); _batchNodes.push_back(this); @@ -1108,41 +1099,33 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent setOrderOfArrival(0); } -void Label::setFont(const std::string& fontNameOrFileFile) +void Label::setSystemFont(const std::string& systemFont) { - if (fontNameOrFileFile != _fontNameOrFontFile) + if (systemFont != _systemFont) { - _fontNameOrFontFile = fontNameOrFileFile; + _systemFont = systemFont; _fontDirty = true; } } -const std::string& Label::getFont() const +void Label::setSystemFontSize(float fontSize) { - return _fontNameOrFontFile; -} - -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(); diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 984bfa9349..86a4eb0f45 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -83,14 +83,21 @@ public: static Label* create(); /** 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 * createWithFont(const std::string& text, const std::string& fontNameOrFontFile, 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); + + /** 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 - * It not support font name. + * @warning Not support font name. */ static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment = TextHAlignment::LEFT, int maxLineWidth = 0); @@ -105,6 +112,7 @@ public: /** set TTF configuration for Label */ virtual bool setTTFConfig(const TTFConfig& ttfConfig); + virtual TTFConfig& getTTFConfig() { return _fontConfig;} virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset = Point::ZERO); const std::string& getBMFontFilePath() const { return _bmFontPath;} @@ -113,6 +121,12 @@ public: virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); virtual bool setCharMap(const std::string& plistFile); + virtual void setSystemFont(const std::string& systemFont); + virtual const std::string& getSystemFont() const { return _systemFont;} + + 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. */ @@ -177,12 +191,6 @@ public: /** update content immediately.*/ virtual void updateContent(); - virtual void setFont(const std::string& fontNameOrFileFile); - virtual const std::string& getFont() const; - - virtual void setFontSize(float fontSize); - virtual float getFontSize() const; - /** Sets the text color * */ @@ -230,22 +238,6 @@ public: virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; - CC_DEPRECATED_ATTRIBUTE static Label * create(const std::string& text, const std::string& fontNameOrFontFile, float fontSize, - const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, - TextVAlignment vAlignment = TextVAlignment::TOP) { - return createWithFont(text, fontNameOrFontFile, fontSize, dimensions, hAlignment, vAlignment); - } - - /** 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. - */ - CC_DEPRECATED_ATTRIBUTE 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); - - CC_DEPRECATED_ATTRIBUTE virtual void setFontName(const std::string& fontName) { setFont(fontName);} - CC_DEPRECATED_ATTRIBUTE virtual const std::string& getFontName() const { return getFont();} - CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition); CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; } @@ -308,15 +300,14 @@ protected: void updateFont(); void reset(); - - std::string _bmFontPath; bool _isOpacityModifyRGB; bool _contentDirty; + bool _fontDirty; - std::string _fontNameOrFontFile; - float _fontSize; + std::string _systemFont; + float _systemFontSize; LabelType _currentLabelType; std::vector _batchNodes; diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 3aa946022c..1b19af4655 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -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->setFont(fontName); + _renderLabel->setSystemFont(fontName); _contentDirty = true; return true; @@ -128,7 +128,7 @@ const std::string& LabelTTF::getString() const std::string LabelTTF::getDescription() const { - return StringUtils::format("", _renderLabel->getFont().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str()); + return StringUtils::format("", _renderLabel->getSystemFont().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->getFont(); + return _renderLabel->getSystemFont(); } void LabelTTF::setFontName(const std::string& fontName) { - _renderLabel->setFont(fontName); + _renderLabel->setSystemFont(fontName); _contentDirty = true; } diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 1b6fe8a657..9ed034371e 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -439,7 +439,7 @@ bool MenuItemFont::initWithString(const std::string& value, const ccMenuCallback _fontName = _globalFontName; _fontSize = _globalFontSize; - Label *label = Label::createWithFont(value, _fontName, _fontSize); + Label *label = Label::createWithSystemFont(value, _fontName, _fontSize); if (MenuItemLabel::initWithLabel(label, callback)) { // do something ? @@ -450,7 +450,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 +462,7 @@ int MenuItemFont::getFontSizeObj() const void MenuItemFont::setFontNameObj(const std::string& name) { _fontName = name; - dynamic_cast(_label)->setFont(_fontName); + dynamic_cast(_label)->setSystemFont(_fontName); this->setContentSize(dynamic_cast(_label)->getContentSize()); } diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index fdb1a1cbf5..3d81de0cba 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); - setFont(fontName); - setFontSize(fontSize); + setSystemFont(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); - setFont(fontName); - setFontSize(fontSize); + setSystemFont(fontName); + setSystemFontSize(fontSize); Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); diff --git a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp index fb1e405dee..a07300dd94 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)->setFont(pFontTTF); + ((Label *)pNode)->setSystemFont(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/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 22ccadfb07..ea4f7189a9 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->setFont(fontName); + _titleRenderer->setSystemFont(fontName); } const std::string& Button::getTitleFontName() const { - return _titleRenderer->getFont(); + return _titleRenderer->getSystemFont(); } std::string Button::getDescription() const diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index a617d422f8..6cd6206ded 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -210,7 +210,15 @@ void RichText::formatText() case RICH_TEXT: { RichElementText* elmtText = static_cast(element); - elementRenderer = Label::createWithFont(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 +280,16 @@ void RichText::formatText() void RichText::handleTextRenderer(const char *text, const char *fontName, float fontSize, const Color3B &color, GLubyte opacity) { - Label* textRenderer = Label::createWithFont(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 +302,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::createWithFont(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 ba47a4c9e6..aabfe39b5a 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->setFont(name); + _labelRenderer->setSystemFont(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 cbacc93f0e..7df2a3a36f 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->setFont(name); + _textFieldRenderer->setSystemFont(name); textfieldRendererScaleChangedWithSize(); } const std::string& TextField::getFontName() { - return _textFieldRenderer->getFont(); + return _textFieldRenderer->getSystemFont(); } 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->getFont().c_str()); + setFontSize(textField->_textFieldRenderer->getSystemFontSize()); + setFontName(textField->_textFieldRenderer->getSystemFont()); setMaxLengthEnabled(textField->isMaxLengthEnabled()); setMaxLength(textField->getMaxLength()); setPasswordEnabled(textField->isPasswordEnabled()); diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index 73db73499f..b5d6a13f48 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::createWithFont("", "Helvetica", 12), Scale9Sprite::create()); + return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), Scale9Sprite::create()); } bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* backgroundSprite) @@ -131,7 +131,7 @@ ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize) { - return initWithLabelAndBackgroundSprite(Label::createWithFont(title, fontName, fontSize), Scale9Sprite::create()); + return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), Scale9Sprite::create()); } ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize) @@ -144,7 +144,7 @@ ControlButton* ControlButton::create(const std::string& title, const std::string bool ControlButton::initWithBackgroundSprite(Scale9Sprite* sprite) { - Label *label = Label::createWithFont("", "Arial", 30);// + Label *label = Label::createWithSystemFont("", "Arial", 30);// return initWithLabelAndBackgroundSprite(label, sprite); } @@ -360,7 +360,7 @@ void ControlButton::setTitleLabelForState(Node* titleLabel, State state) void ControlButton::setTitleTTFForState(const std::string& fontName, State state) { - this->setTitleLabelForState(Label::createWithFont(getTitleForState(state), fontName, 12), state); + this->setTitleLabelForState(Label::createWithSystemFont(getTitleForState(state), fontName, 12), state); } const std::string& ControlButton::getTitleTTFForState(State state) @@ -369,7 +369,7 @@ const std::string& ControlButton::getTitleTTFForState(State state) Label* labelTTF = dynamic_cast(label); if(labelTTF != 0) { - return labelTTF->getFont(); + return labelTTF->getSystemFont(); } static std::string ret(""); @@ -384,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); } } } @@ -395,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/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index be079b2e28..a064a6454d 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -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::createWithFont("-", 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::createWithFont("+", 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/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 29438c81f0..03e5c0c59c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -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->setFont(pFontName); - _label->setFontSize(fontSize); + _label->setSystemFont(pFontName); + _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFont(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFont(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->setFont(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 264a3efb24..3b2771f034 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -395,10 +395,10 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) [_systemControl.textField setFont:textFont]; } - _label->setFont(pFontName); - _label->setFontSize(fontSize); - _labelPlaceHolder->setFont(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _label->setSystemFont(pFontName); + _label->setSystemFontSize(fontSize); + _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } void EditBoxImplIOS::setFontColor(const Color3B& color) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index 4fad732b34..d7ceb063d1 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -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->setFont(pFontName); - _label->setFontSize(fontSize); + _label->setSystemFont(pFontName); + _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setFont(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFont(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->setFont(pFontName); - _labelPlaceHolder->setFontSize(fontSize); + _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index a16f47e87d..2da62c6eb1 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -118,13 +118,13 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size ) void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize ) { if(m_pLabel != NULL) { - m_pLabel->setFont(pFontName); - m_pLabel->setFontSize(fontSize); + m_pLabel->setSystemFont(pFontName); + m_pLabel->setSystemFontSize(fontSize); } if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setFont(pFontName); - m_pLabelPlaceHolder->setFontSize(fontSize); + m_pLabelPlaceHolder->setSystemFont(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->setFont(pFontName); - m_pLabelPlaceHolder->setFontSize(fontSize); + m_pLabelPlaceHolder->setSystemFont(pFontName); + m_pLabelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp index 545ec5fa2e..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::createWithFont(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 7d369a0d29..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::createWithFont("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::createWithFont("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::createWithFont("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 7cee0a8ebd..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::createWithFont("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::createWithFont("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::createWithFont("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 4f7fe2ab7f..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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 795c22fbbd..12c90d8c75 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -43,14 +43,14 @@ Box2DTestLayer::Box2DTestLayer() addNewSpriteAtPosition(VisibleRect::center()); - auto label = Label::createWithFont("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::createWithFont("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 bdf57dc550..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::createWithFont(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 71a36cbcc5..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::createWithFont("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 8750897485..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::createWithFont("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 89aaaca7dd..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::createWithFont("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::createWithFont("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 bda3f87cac..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::createWithFont("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 982b36101e..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::createWithFont("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::createWithFont("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 85409006db..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::createWithFont(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::createWithFont(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 8534c3eca5..6bdb1d393a 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -91,7 +91,7 @@ private: bool initTextButton(const char *text) { - _child = Label::createWithFont(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::createWithFont(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::createWithFont(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)); @@ -256,7 +256,7 @@ void CocosDenshionTest::onExit() void CocosDenshionTest::addButtons() { - auto lblMusic = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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/CurlTest/CurlTest.cpp b/tests/cpp-tests/Classes/CurlTest/CurlTest.cpp index 7bb462968b..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::createWithFont("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::createWithFont("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 cc620f33d6..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::createWithFont("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::createWithFont("", "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 f475038ac7..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::createWithFont(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::createWithFont(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/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index 3fcd8e1fba..2364519aed 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::createWithFont((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); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 2270cc07b1..0d37c0284d 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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont("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); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp index 835ac39780..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::createWithFont("","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 adcf2333cd..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::createWithFont("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 debff2e2f8..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::createWithFont("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 7dd00b886c..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::createWithFont("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 bdd3c5f96b..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::createWithFont("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 b2b19b2a92..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::createWithFont("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/GUIEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp index 7269a58822..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::createWithFont("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/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index 4a395ca53d..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::createWithFont(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::createWithFont(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/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp index 0a4953f14e..6dd2639348 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::createWithFont(title, "fonts/Marker Felt.ttf", 30); + auto titleButton = Label::createWithTTF(title, "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); @@ -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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont(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 1d00b2d160..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::createWithFont("#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 7ae9750b85..7dc7291448 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp @@ -55,7 +55,7 @@ bool ControlPotentiometerTest::init() layer_width += background->getContentSize().width; - this->setDisplayValueLabel(Label::createWithFont("", "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 07f7c7a701..af279fadb5 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -60,7 +60,7 @@ bool ControlScene::init() addChild(ribbon); // Add the title - setSceneTitleLabel(Label::createWithFont("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 9315c12858..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::createWithFont("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 d994263a07..7bcfb9fe92 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp @@ -54,7 +54,7 @@ bool ControlStepperTest::init() background->setPosition(Point(layer_width + background->getContentSize().width / 2.0f, 0)); layer->addChild(background); - this->setDisplayValueLabel(Label::createWithFont("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 83c8727032..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::createWithFont("#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::createWithFont("On", "Arial-BoldMT", 16), - Label::createWithFont("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 17b192a462..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::createWithFont("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/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 680e4342d0..f44208cd2a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -14,7 +14,7 @@ HttpClientTest::HttpClientTest() const int MARGIN = 40; const int SPACE = 35; - auto label = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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 66d3f0427b..344d856a61 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -25,7 +25,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) const int MARGIN = 40; const int SPACE = 35; - auto label = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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 9755baf243..aba4c3770d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -27,7 +27,7 @@ WebSocketTestLayer::WebSocketTestLayer() const int MARGIN = 40; const int SPACE = 35; - auto label = Label::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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 a596448c96..348f101b60 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -88,8 +88,8 @@ NotificationCenterTest::NotificationCenterTest() pBackMenu->setPosition( Point::ZERO ); addChild(pBackMenu); - auto label1 = Label::createWithFont("switch off", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::createWithFont("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 +110,8 @@ NotificationCenterTest::NotificationCenterTest() light->setPosition(Point(100, s.height/4*i)); addChild(light); - auto label1 = Label::createWithFont("not connected", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::createWithFont("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 c4a142ef0f..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::createWithFont(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 76cf3fe293..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::createWithFont(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::createWithFont(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::createWithFont(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 eb6ab4f87c..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::createWithFont(pFont, pFont, 24); - auto left = Label::createWithFont("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::createWithFont("alignment center", pFont, fontSize, + auto center = Label::createWithSystemFont("alignment center", pFont, fontSize, blockSize, TextHAlignment::CENTER, verticalAlignment[vAlignIdx]); - auto right = Label::createWithFont("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 d40e3ac0e5..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::createWithFont("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::createWithFont("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::createWithFont("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 fa5a74a2aa..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::createWithFont("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::createWithFont("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 fd58498754..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::createWithFont("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::createWithFont("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 874e51e23f..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::createWithFont("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,7 +1582,7 @@ LabelFontNameTest::LabelFontNameTest() label1->setPosition( Point(size.width/2, size.height * 0.7) ); addChild(label1); - auto label3 = Label::createWithFont("Marker Felt","Marker Felt",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 101f759966..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::createWithFont("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26); - auto label2 = Label::createWithFont("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 5c59b3bca3..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::createWithFont("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 0fa06262f0..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::createWithFont("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 d09a6bb261..6a53ab245b 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -384,7 +384,7 @@ void RemoveListenerWhenDispatching::onEnter() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, sprite1); - auto statusLabel = Label::createWithFont("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 +433,7 @@ void CustomEventTest::onEnter() MenuItemFont::setFontSize(20); - auto statusLabel = Label::createWithFont("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 +459,7 @@ void CustomEventTest::onEnter() }); sendItem->setPosition(origin + Point(size.width/2, size.height/2)); - auto statusLabel2 = Label::createWithFont("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 +516,7 @@ void LabelKeyboardEventTest::onEnter() Point origin = Director::getInstance()->getVisibleOrigin(); Size size = Director::getInstance()->getVisibleSize(); - auto statusLabel = Label::createWithFont("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 +1189,7 @@ Issue4129::Issue4129() { _customlistener = _eventDispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){ - auto label = Label::createWithFont("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/PerformanceTest/PerformanceAllocTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp index 7e6978bc8f..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::createWithFont(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::createWithFont(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::createWithFont("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 e2c829759d..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::createWithFont(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::createWithFont(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::createWithFont("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 8543ce95e2..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::createWithFont(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::createWithFont(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::createWithFont("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 2fc8f76b35..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::createWithFont("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::createWithFont(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::createWithFont("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 f5efa8a635..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::createWithFont(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::createWithFont(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::createWithFont("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 3ab33a4b59..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::createWithFont("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::createWithFont(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 383bfdf603..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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont(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::createWithFont("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 90c76f4230..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::createWithFont("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::createWithFont(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::createWithFont(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 57b814c3bc..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::createWithFont(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::createWithFont(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 7d04fae0e2..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::createWithFont(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::createWithFont(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::createWithFont("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 cccc2b7c98..9d5dee2626 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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont("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::createWithFont(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::createWithFont(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::createWithFont(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::createWithFont(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)); diff --git a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp index 1e34e7c3bd..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::createWithFont("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 2bb6695046..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::createWithFont("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::createWithFont("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::createWithFont("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 0590532a6d..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::createWithFont("cocos2d", "Tahoma", 64); + auto label = Label::createWithSystemFont("cocos2d", "Tahoma", 64); label->setPosition( Point(x/2,y/2) ); diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index d42d5ab741..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::createWithFont(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::createWithFont(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 e6f6e9772d..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::createWithFont("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 1bbc93f567..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::createWithFont("loading...", "fonts/arial.ttf", 15); - _labelPercent = Label::createWithFont("%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 58daa5c992..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::createWithFont(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::createWithFont(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::createWithFont("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::createWithFont("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 3cb9c20ef8..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::createWithFont( (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::createWithFont("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::createWithFont((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::createWithFont("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 54d1940051..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::createWithFont("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) ); From 64fc13cae219c32ce47f6f3ec6a885647c250c2f Mon Sep 17 00:00:00 2001 From: Nick Barrios Date: Wed, 9 Apr 2014 12:15:24 -0400 Subject: [PATCH 11/65] CCGLView.h: Remove createWithFullscreen declaration. --- cocos/2d/platform/desktop/CCGLView.h | 1 - 1 file changed, 1 deletion(-) diff --git a/cocos/2d/platform/desktop/CCGLView.h b/cocos/2d/platform/desktop/CCGLView.h index afe45a214b..2db232e724 100644 --- a/cocos/2d/platform/desktop/CCGLView.h +++ b/cocos/2d/platform/desktop/CCGLView.h @@ -39,7 +39,6 @@ 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, Size size); static GLView* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor); /* From 5b296a62e91bf643f769527a8e7f621cdb031fe0 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 20:57:35 +0800 Subject: [PATCH 12/65] issue #4729: Moved deprecated classes to 'cocos/deprecated' folder --- cocos/{base => deprecated}/CCArray.cpp | 0 cocos/{base => deprecated}/CCArray.h | 0 cocos/{base => deprecated}/CCBool.h | 0 cocos/{2d => deprecated}/CCDeprecated.cpp | 0 cocos/{2d => deprecated}/CCDeprecated.h | 0 cocos/{base => deprecated}/CCDictionary.cpp | 0 cocos/{base => deprecated}/CCDictionary.h | 0 cocos/{base => deprecated}/CCDouble.h | 0 cocos/{base => deprecated}/CCFloat.h | 0 cocos/{base => deprecated}/CCInteger.h | 0 cocos/{base => deprecated}/CCSet.cpp | 0 cocos/{base => deprecated}/CCSet.h | 0 cocos/{base => deprecated}/CCString.cpp | 0 cocos/{base => deprecated}/CCString.h | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename cocos/{base => deprecated}/CCArray.cpp (100%) rename cocos/{base => deprecated}/CCArray.h (100%) rename cocos/{base => deprecated}/CCBool.h (100%) rename cocos/{2d => deprecated}/CCDeprecated.cpp (100%) rename cocos/{2d => deprecated}/CCDeprecated.h (100%) rename cocos/{base => deprecated}/CCDictionary.cpp (100%) rename cocos/{base => deprecated}/CCDictionary.h (100%) rename cocos/{base => deprecated}/CCDouble.h (100%) rename cocos/{base => deprecated}/CCFloat.h (100%) rename cocos/{base => deprecated}/CCInteger.h (100%) rename cocos/{base => deprecated}/CCSet.cpp (100%) rename cocos/{base => deprecated}/CCSet.h (100%) rename cocos/{base => deprecated}/CCString.cpp (100%) rename cocos/{base => deprecated}/CCString.h (100%) diff --git a/cocos/base/CCArray.cpp b/cocos/deprecated/CCArray.cpp similarity index 100% rename from cocos/base/CCArray.cpp rename to cocos/deprecated/CCArray.cpp 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 100% rename from cocos/base/CCDictionary.cpp rename to cocos/deprecated/CCDictionary.cpp diff --git a/cocos/base/CCDictionary.h b/cocos/deprecated/CCDictionary.h similarity index 100% rename from cocos/base/CCDictionary.h rename to cocos/deprecated/CCDictionary.h 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/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 100% rename from cocos/base/CCString.cpp rename to cocos/deprecated/CCString.cpp 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 From 2fc6c0150cddf25b888e57d9085675e8925e8620 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 21:18:37 +0800 Subject: [PATCH 13/65] issue #4729: iOS/Mac works fine --- .../cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- .../cocos2d_tests.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- cocos/2d/cocos2d.h | 2 +- .../cocos2d_lua_bindings.xcodeproj/project.pbxproj | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 57b2e4ef22..863965217f 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 +556cab1bf9592b9d686c86e779989bbf1b0e22c3 \ 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/cocos2d.h b/cocos/2d/cocos2d.h index e1699ab5af..6ed03d1961 100644 --- a/cocos/2d/cocos2d.h +++ b/cocos/2d/cocos2d.h @@ -277,7 +277,7 @@ THE SOFTWARE. #include "CCComponentContainer.h" // Deprecated include -#include "CCDeprecated.h" +#include "deprecated/CCDeprecated.h" NS_CC_BEGIN 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; From 43d6e1176a31a477d6111505b20888d599561014 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 21:32:06 +0800 Subject: [PATCH 14/65] issue #4729: Compilation error fixes for linux --- CMakeLists.txt | 1 + cocos/2d/Android.mk | 14 +++++++++----- cocos/2d/CCNode.h | 1 - cocos/2d/CMakeLists.txt | 4 ++-- cocos/base/CMakeLists.txt | 8 ++++---- templates/cpp-template-default/CMakeLists.txt | 1 + .../lua-template-default/frameworks/CMakeLists.txt | 1 + 7 files changed, 18 insertions(+), 12 deletions(-) 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/cocos/2d/Android.mk b/cocos/2d/Android.mk index 019cc3323f..d082c6cdd0 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 \ @@ -128,20 +127,21 @@ 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 \ ../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/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/CMakeLists.txt b/cocos/2d/CMakeLists.txt index feea51634c..48d08535d4 100644 --- a/cocos/2d/CMakeLists.txt +++ b/cocos/2d/CMakeLists.txt @@ -130,13 +130,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 +144,8 @@ set(COCOS2D_SRC renderer/CCRenderCommand.cpp renderer/CCRenderer.cpp renderer/CCRenderMaterial.cpp + ../deprecated/CCDeprecated.cpp + ../../external/edtaa3func/edtaa3func.cpp ) include(../physics/CMakeLists.txt) 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/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 From a2a712bc176ea36b8ba1b2139a317cd0f189681e Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 21:32:53 +0800 Subject: [PATCH 15/65] issue #4729: Updates tools/tolua/cocos2dx.ini --- tools/tolua/cocos2dx.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index b59892321b..8dd5dcd7da 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 = From 0bb8f3da7834771b36aaca0583522179ad049795 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 21:38:11 +0800 Subject: [PATCH 16/65] issue #4729: Updates win32/winrt xxx_headers.props --- cocos/2d/cocos2d_headers.props | 2 +- cocos/2d/cocos2d_winrt_headers.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/cocos2d_headers.props b/cocos/2d/cocos2d_headers.props index 9e64903d6a..e605ff61a8 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\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 _VARIADIC_MAX=10;%(PreprocessorDefinitions) diff --git a/cocos/2d/cocos2d_winrt_headers.props b/cocos/2d/cocos2d_winrt_headers.props index 682d31f725..0b007eba30 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\gui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath\include;$(GeneratedFilesDir) From a240c7b240f6a380862987e779b8663699df6f98 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:29:19 +0800 Subject: [PATCH 17/65] issue #4729: Moved CCNotificationCenter.h/.cpp to deprecated folder. --- cocos/{2d => deprecated}/CCNotificationCenter.cpp | 2 +- cocos/{2d => deprecated}/CCNotificationCenter.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename cocos/{2d => deprecated}/CCNotificationCenter.cpp (99%) rename cocos/{2d => deprecated}/CCNotificationCenter.h (99%) 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; From 9d8d256bee2a8440597682d5fd7e7b033b9563df Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:30:49 +0800 Subject: [PATCH 18/65] issue #4729: Android build works ok. --- cocos/2d/Android.mk | 2 +- cocos/2d/CCAction.cpp | 2 +- cocos/2d/CCAnimation.h | 1 - cocos/2d/CCAnimationCache.cpp | 2 +- cocos/2d/CCConfiguration.h | 1 - cocos/2d/CCFontFNT.cpp | 2 +- cocos/2d/CCGLProgram.cpp | 2 +- cocos/2d/CCLabel.cpp | 1 + cocos/2d/CCLabelAtlas.cpp | 2 +- cocos/2d/CCLabelBMFont.cpp | 2 +- cocos/2d/CCLabelTTF.cpp | 2 +- cocos/2d/CCLayer.cpp | 2 +- cocos/2d/CCLayer.h | 7 ++++--- cocos/2d/CCMenu.cpp | 2 +- cocos/2d/CCMenuItem.cpp | 1 + cocos/2d/CCMenuItem.h | 1 - cocos/2d/CCNode.cpp | 2 +- cocos/2d/CCParticleSystem.h | 2 +- cocos/2d/CCScene.cpp | 1 + cocos/2d/CCScriptSupport.h | 1 - cocos/2d/CCSprite.cpp | 10 ++++------ cocos/2d/CCSprite.h | 1 - cocos/2d/CCSpriteBatchNode.cpp | 7 ++++--- cocos/2d/CCSpriteFrameCache.cpp | 2 +- cocos/2d/CCTMXLayer.cpp | 2 ++ cocos/2d/CCTMXTiledMap.cpp | 2 ++ cocos/2d/CCTexture2D.cpp | 1 + cocos/2d/CCTextureAtlas.cpp | 2 +- cocos/2d/CCTextureCache.cpp | 2 +- cocos/2d/CCTileMapAtlas.cpp | 2 +- cocos/2d/CMakeLists.txt | 2 +- cocos/2d/cocos2d.h | 20 ++++++++++--------- cocos/2d/platform/android/Android.mk | 1 + cocos/2d/platform/android/CCGLView.cpp | 1 - .../Java_org_cocos2dx_lib_Cocos2dxHelper.cpp | 2 +- cocos/2d/platform/android/jni/TouchesJni.cpp | 1 - cocos/2d/platform/apple/CCFileUtilsApple.mm | 2 +- cocos/2d/platform/linux/CCFileUtilsLinux.cpp | 2 +- cocos/audio/android/Android.mk | 1 + cocos/audio/android/ccdandroidUtils.cpp | 6 +++--- cocos/base/CCDataVisitor.cpp | 2 +- cocos/deprecated/CCArray.cpp | 2 +- cocos/deprecated/CCDictionary.cpp | 4 ++-- cocos/deprecated/CCDictionary.h | 2 +- cocos/deprecated/CCString.cpp | 2 +- 45 files changed, 62 insertions(+), 57 deletions(-) diff --git a/cocos/2d/Android.mk b/cocos/2d/Android.mk index d082c6cdd0..e79ad3db42 100644 --- a/cocos/2d/Android.mk +++ b/cocos/2d/Android.mk @@ -70,7 +70,6 @@ CCMenu.cpp \ CCMenuItem.cpp \ CCMotionStreak.cpp \ CCNode.cpp \ -CCNotificationCenter.cpp \ CCParallaxNode.cpp \ CCParticleBatchNode.cpp \ CCParticleExamples.cpp \ @@ -142,6 +141,7 @@ renderer/CCRenderMaterial.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 \ 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/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.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/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..a9c9808405 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 diff --git a/cocos/2d/CCLabelAtlas.cpp b/cocos/2d/CCLabelAtlas.cpp index 1917ea4537..90d8d546f4 100644 --- a/cocos/2d/CCLabelAtlas.cpp +++ b/cocos/2d/CCLabelAtlas.cpp @@ -38,7 +38,7 @@ THE SOFTWARE. #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..cf10e605fd 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 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..6a88406905 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. #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..8f2e15ca75 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 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/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/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/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index bc89ef1b69..ec1abfec0e 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include "CCSprite.h" #include "TransformUtils.h" #include "platform/CCFileUtils.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCArray.h" #include "CCDictionary.h" #include "CCDirector.h" 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/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..193b5fe5e0 100644 --- a/cocos/2d/CCTileMapAtlas.cpp +++ b/cocos/2d/CCTileMapAtlas.cpp @@ -31,7 +31,7 @@ THE SOFTWARE. #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/CMakeLists.txt b/cocos/2d/CMakeLists.txt index 48d08535d4..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 @@ -145,6 +144,7 @@ set(COCOS2D_SRC renderer/CCRenderer.cpp renderer/CCRenderMaterial.cpp ../deprecated/CCDeprecated.cpp + ../deprecated/CCNotificationCenter.cpp ../../external/edtaa3func/edtaa3func.cpp ) diff --git a/cocos/2d/cocos2d.h b/cocos/2d/cocos2d.h index 6ed03d1961..bf59256bea 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" @@ -230,7 +222,6 @@ THE SOFTWARE. // support #include "ccUTF8.h" -#include "CCNotificationCenter.h" #include "CCProfiling.h" #include "CCConsole.h" #include "CCUserDefault.h" @@ -277,8 +268,19 @@ THE SOFTWARE. #include "CCComponentContainer.h" // Deprecated include +#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 CC_DLL const char* cocos2dVersion(); 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/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/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/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/CCDataVisitor.cpp b/cocos/base/CCDataVisitor.cpp index a908ead8bd..23755cab6d 100644 --- a/cocos/base/CCDataVisitor.cpp +++ b/cocos/base/CCDataVisitor.cpp @@ -27,7 +27,7 @@ #include "CCInteger.h" #include "CCFloat.h" #include "CCDouble.h" -#include "CCString.h" +#include "deprecated/CCString.h" #include "CCArray.h" #include "CCDictionary.h" #include "CCSet.h" diff --git a/cocos/deprecated/CCArray.cpp b/cocos/deprecated/CCArray.cpp index 62af0b697e..b5f949d048 100644 --- a/cocos/deprecated/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 diff --git a/cocos/deprecated/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp index 9c4dfb791c..47b60d9b2e 100644 --- a/cocos/deprecated/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" diff --git a/cocos/deprecated/CCDictionary.h b/cocos/deprecated/CCDictionary.h index 343fd05520..e105c295ed 100644 --- a/cocos/deprecated/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/deprecated/CCString.cpp b/cocos/deprecated/CCString.cpp index 7298023df3..34194426e7 100644 --- a/cocos/deprecated/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 From 0af605799603a9a01c0daf1c0b35e38ab2623223 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:31:24 +0800 Subject: [PATCH 19/65] issue #4729: [ios/mac] Updates cocos2d_libs.xcodeproj --- build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 863965217f..0ff0627dee 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -556cab1bf9592b9d686c86e779989bbf1b0e22c3 \ No newline at end of file +b5b636c8bcca1ce239847cab19cfafedf83ca250 \ No newline at end of file From e59374de81f657cb29fe1bc87c2adf9536561b63 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:44:53 +0800 Subject: [PATCH 20/65] issue #4729: Move CC_INVALID_INDEX from ccCArray.h to ccTypes.h, probably there is a better place to define this variable, but let's just choose ccTypes.h now. --- cocos/2d/ccCArray.cpp | 2 -- cocos/2d/ccCArray.h | 2 -- cocos/2d/ccTypes.cpp | 2 ++ cocos/2d/ccTypes.h | 1 + 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos/2d/ccCArray.cpp b/cocos/2d/ccCArray.cpp index c73a0ced26..f9c4312b5f 100644 --- a/cocos/2d/ccCArray.cpp +++ b/cocos/2d/ccCArray.cpp @@ -29,8 +29,6 @@ THE SOFTWARE. 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 From 377086d67a16a74778870bab4d015c19401b8e31 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:46:41 +0800 Subject: [PATCH 21/65] issue #4729: don't use 'using namespace std;' --- .../cocosbuilder/CCBAnimationManager.cpp | 6 ++++-- cocos/editor-support/cocosbuilder/CCBReader.cpp | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) 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) From 56157176177dcb325de8b888e1a2013ea2850350 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:53:59 +0800 Subject: [PATCH 22/65] issue #4729: NULL -> nullptr in constructor or setXXX(NULL) --- cocos/2d/platform/android/CCDevice.cpp | 2 +- cocos/2d/platform/win32/CCApplication.cpp | 6 +++--- cocos/2d/platform/win32/CCDevice.cpp | 6 +++--- cocos/base/CCConsole.cpp | 4 ++-- cocos/deprecated/CCArray.cpp | 2 +- cocos/deprecated/CCDictionary.cpp | 2 +- .../cocosbuilder/CCBSequence.cpp | 4 ++-- cocos/editor-support/cocostudio/CCDatas.cpp | 2 +- .../lua-bindings/manual/CCLuaEngine.h | 2 +- .../lua-bindings/manual/CCLuaStack.h | 2 +- .../lua-bindings/manual/CCLuaValue.h | 2 +- cocos/ui/UIRichText.cpp | 4 +--- .../CCControlColourPicker.cpp | 6 +++--- .../CCControlExtension/CCControlHuePicker.cpp | 4 ++-- .../CCControlPotentiometer.cpp | 4 ++-- .../CCControlSaturationBrightnessPicker.cpp | 8 ++++---- .../CCControlExtension/CCControlSlider.cpp | 8 ++++---- .../CCControlExtension/CCControlStepper.cpp | 8 ++++---- .../CCControlExtension/CCControlSwitch.cpp | 14 ++++++------- .../GUI/CCControlExtension/CCScale9Sprite.cpp | 20 +++++++++---------- extensions/GUI/CCEditBox/CCEditBox.cpp | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImpl.h | 2 +- .../GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 6 +++--- extensions/GUI/CCEditBox/CCEditBoxImplMac.mm | 2 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 4 ++-- extensions/assets-manager/AssetsManager.cpp | 4 ++-- tests/cpp-tests/Classes/BaseTest.cpp | 2 +- .../cpp-tests/Classes/Box2DTest/Box2dTest.cpp | 4 ++-- .../CocosDenshionTest/CocosDenshionTest.cpp | 18 ++++++++--------- .../Classes/ConsoleTest/ConsoleTest.cpp | 2 +- .../EffectsAdvancedTest.cpp | 2 +- .../Classes/EffectsTest/EffectsTest.cpp | 2 +- .../CustomWidget/CustomImageView.cpp | 2 +- .../CustomWidget/CustomParticleWidget.cpp | 2 +- .../UIButtonTest/UIButtonTest_Editor.cpp | 2 +- .../UICheckBoxTest/UICheckBoxTest_Editor.cpp | 2 +- .../UIListViewTest/UIListViewTest_Editor.cpp | 4 ++-- .../UIPageViewTest/UIPageViewTest.cpp | 2 +- .../UIPageViewTest/UIPageViewTest_Editor.cpp | 2 +- .../CocoStudioGUITest/UIScene_Editor.cpp | 6 +++--- .../UISliderTest/UISliderTest_Editor.cpp | 2 +- .../UITextFieldTest/UITextFieldTest.cpp | 2 +- .../UITextFieldTest_Editor.cpp | 2 +- .../AnimationsTest/AnimationsTestLayer.cpp | 2 +- .../ButtonTest/ButtonTestLayer.cpp | 2 +- .../HelloCocosBuilderLayer.cpp | 4 ++-- .../TimelineCallbackTestLayer.cpp | 2 +- .../CCControlButtonTest.cpp | 4 ++-- .../CCControlPotentiometerTest.cpp | 2 +- .../ControlExtensionTest/CCControlScene.cpp | 2 +- .../CCControlStepperTest.cpp | 2 +- .../NetworkTest/HttpClientTest.cpp | 2 +- .../NetworkTest/SocketIOTest.cpp | 4 ++-- .../NetworkTest/WebSocketTest.cpp | 12 +++++------ .../Classes/ShaderTest/ShaderTest.cpp | 6 +++--- .../EffectsAdvancedTest.lua | 2 +- .../RenderTextureTest/RenderTextureTest.lua | 2 +- 58 files changed, 120 insertions(+), 122 deletions(-) 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/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/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 0a7dc8dabe..9f28f0a23c 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -650,7 +650,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 +678,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(); diff --git a/cocos/deprecated/CCArray.cpp b/cocos/deprecated/CCArray.cpp index b5f949d048..80118faa74 100644 --- a/cocos/deprecated/CCArray.cpp +++ b/cocos/deprecated/CCArray.cpp @@ -37,7 +37,7 @@ NS_CC_BEGIN // ---------------------------------------------------------------------------------- __Array::__Array() -: data(NULL) +: data(nullptr) { init(); } diff --git a/cocos/deprecated/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp index 47b60d9b2e..96ae7dcc7a 100644 --- a/cocos/deprecated/CCDictionary.cpp +++ b/cocos/deprecated/CCDictionary.cpp @@ -77,7 +77,7 @@ DictElement::~DictElement() // __Dictionary __Dictionary::__Dictionary() -: _elements(NULL) +: _elements(nullptr) , _dictType(kDictUnknown) { 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/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/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/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 178ca2870e..c09e10a70a 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) { } 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..f8a3505bf4 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) { } 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..5776a38a51 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) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index d2ba95be02..a67ef8052c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -273,10 +273,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(); 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..4c19e31c19 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) 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/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..c651624ca0 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(); diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index e8171ad08b..39d43de1fa 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); @@ -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(); diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index b4fcab3577..b30187e0e6 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -180,7 +180,7 @@ 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); 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..531c63e65a 100644 --- a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp +++ b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp @@ -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/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/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/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..13e8a61313 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp @@ -106,8 +106,8 @@ ControlButton *ControlButtonTest_HelloVariableSize::standardButtonWithTitle(cons } ControlButtonTest_Event::ControlButtonTest_Event() -: _displayValueLabel(NULL) -, _displayBitmaskLabel(NULL) +: _displayValueLabel(nullptr) +, _displayBitmaskLabel(nullptr) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp index 50bcd87502..34a15bcea1 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) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp index 5f42dc43d4..f31080c3cd 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) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp index 29767e7349..7fa5ad6c39 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) { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index ac5310ca12..e36bb37fa2 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -7,7 +7,7 @@ USING_NS_CC_EXT; using namespace cocos2d::network; HttpClientTest::HttpClientTest() -: _labelStatusCode(NULL) +: _labelStatusCode(nullptr) { auto winSize = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 9e32839fc6..e4bd50419f 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 diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp index bb6f88302b..ec5a725e89 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) { 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/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/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) From 5dc6dd87e94cab76da4415e07088b32cf67a22b9 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 22:54:38 +0800 Subject: [PATCH 23/65] issue #4729: include "ccTypes.h" in ccCArray.cpp for CC_INVALID_INDEX --- cocos/2d/ccCArray.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/2d/ccCArray.cpp b/cocos/2d/ccCArray.cpp index f9c4312b5f..560da53d51 100644 --- a/cocos/2d/ccCArray.cpp +++ b/cocos/2d/ccCArray.cpp @@ -26,6 +26,7 @@ THE SOFTWARE. #include "ccCArray.h" #include "CCRef.h" +#include "ccTypes.h" NS_CC_BEGIN From 7cdd041b79a9df314b0c325d56643398ced54e45 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 00:13:48 +0800 Subject: [PATCH 24/65] issue #4729: Adds missing include path in cocos2dx_physics.ini --- tools/tolua/cocos2dx_physics.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = From 364fc4722a353080683328bc1f0ef2dd13a3bec8 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 00:52:41 +0800 Subject: [PATCH 25/65] issue #4729: Updates CCInputDelegate.h --- cocos/editor-support/cocostudio/CCInputDelegate.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 { From 890dd64d38f0692c8b82334246a2dee2fb286ddc Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 23:54:40 +0800 Subject: [PATCH 26/65] issue #4729: some warning fixes and compilation error fixes on win32. --- cocos/2d/CCActionCatmullRom.cpp | 2 +- cocos/2d/CCActionManager.cpp | 1 - cocos/2d/CCConfiguration.cpp | 7 +- cocos/2d/CCDirector.cpp | 1 - cocos/2d/CCLabelAtlas.cpp | 1 - cocos/2d/CCMenu.cpp | 1 - cocos/2d/CCScheduler.cpp | 1 - cocos/2d/CCSpriteFrameCache.cpp | 2 - cocos/2d/CCTileMapAtlas.cpp | 1 - cocos/2d/cocos2d.vcxproj | 31 +++--- cocos/2d/cocos2d.vcxproj.filters | 94 ++++++++++--------- cocos/2d/platform/CCGLViewProtocol.cpp | 2 - cocos/2d/platform/desktop/CCGLView.cpp | 6 +- cocos/2d/platform/win32/CCFileUtilsWin32.h | 2 +- cocos/2d/platform/win32/CCStdC.h | 9 +- cocos/2d/renderer/CCRenderer.cpp | 6 +- cocos/base/CCConsole.cpp | 8 +- cocos/base/CCConsole.h | 10 +- cocos/base/CCDataVisitor.cpp | 14 +-- cocos/physics/CCPhysicsWorld.cpp | 1 - .../lua-bindings/manual/CCLuaEngine.cpp | 6 +- .../websockets/include/win32/libwebsockets.h | 2 - .../NotificationCenterTest.cpp | 1 - .../Classes/PhysicsTest/PhysicsTest.cpp | 2 +- 24 files changed, 101 insertions(+), 110 deletions(-) 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/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/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/CCLabelAtlas.cpp b/cocos/2d/CCLabelAtlas.cpp index 90d8d546f4..5af71f5d0b 100644 --- a/cocos/2d/CCLabelAtlas.cpp +++ b/cocos/2d/CCLabelAtlas.cpp @@ -34,7 +34,6 @@ THE SOFTWARE. #include "ccGLStateCache.h" #include "CCDirector.h" #include "TransformUtils.h" -#include "CCInteger.h" #include "platform/CCFileUtils.h" // external #include "kazmath/GL/matrix.h" diff --git a/cocos/2d/CCMenu.cpp b/cocos/2d/CCMenu.cpp index 6a88406905..8192f9a18d 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -28,7 +28,6 @@ THE SOFTWARE. #include "CCApplication.h" #include "CCTouch.h" #include "CCStdC.h" -#include "CCInteger.h" #include "CCEventListenerTouch.h" #include "deprecated/CCString.h" 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/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index ec1abfec0e..91b49259c8 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -36,8 +36,6 @@ THE SOFTWARE. #include "TransformUtils.h" #include "platform/CCFileUtils.h" #include "deprecated/CCString.h" -#include "CCArray.h" -#include "CCDictionary.h" #include "CCDirector.h" #include diff --git a/cocos/2d/CCTileMapAtlas.cpp b/cocos/2d/CCTileMapAtlas.cpp index 193b5fe5e0..c608596c71 100644 --- a/cocos/2d/CCTileMapAtlas.cpp +++ b/cocos/2d/CCTileMapAtlas.cpp @@ -29,7 +29,6 @@ THE SOFTWARE. #include "CCTextureAtlas.h" #include "TGAlib.h" #include "ccConfig.h" -#include "CCInteger.h" #include "CCDirector.h" #include "deprecated/CCString.h" #include 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/platform/CCGLViewProtocol.cpp b/cocos/2d/platform/CCGLViewProtocol.cpp index 2a2ac08506..be1a7a18b9 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 { diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 91d4b6e000..6bcaec04ee 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 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/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/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 9f28f0a23c..11ccdc0d0b 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -844,7 +844,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 +928,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 +955,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++ ) { 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 23755cab6d..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 "deprecated/CCBool.h" +#include "deprecated/CCInteger.h" +#include "deprecated/CCFloat.h" +#include "deprecated/CCDouble.h" #include "deprecated/CCString.h" -#include "CCArray.h" -#include "CCDictionary.h" -#include "CCSet.h" +#include "deprecated/CCArray.h" +#include "deprecated/CCDictionary.h" +#include "deprecated/CCSet.h" NS_CC_BEGIN 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/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/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/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp index 33b8ccbce8..88552070d6 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 diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index 9f5bcf1f8f..e7ba4cf1d5 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -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); From 390685ae931047504ffd76e7c1d7e160cd11b9b1 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 10 Apr 2014 10:23:00 +0800 Subject: [PATCH 27/65] Label:Change setter of system font name. --- cocos/2d/CCLabel.cpp | 4 ++-- cocos/2d/CCLabel.h | 8 +++++--- cocos/2d/CCLabelTTF.cpp | 8 ++++---- cocos/2d/CCMenuItem.cpp | 2 +- cocos/2d/CCTextFieldTTF.cpp | 4 ++-- cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp | 2 +- cocos/ui/UIButton.cpp | 4 ++-- cocos/ui/UIText.cpp | 2 +- cocos/ui/UITextField.cpp | 6 +++--- extensions/GUI/CCControlExtension/CCControlButton.cpp | 2 +- extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 6 +++--- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 6 +++--- extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp | 6 +++--- 14 files changed, 33 insertions(+), 31 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index c1facf2cbb..3e5ff52e29 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -61,7 +61,7 @@ Label* Label::createWithSystemFont(const std::string& text, const std::string& f if (ret) { - ret->setSystemFont(font); + ret->setSystemFontName(font); ret->setSystemFontSize(fontSize); ret->setDimensions(dimensions.width, dimensions.height); ret->setString(text); @@ -1099,7 +1099,7 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent setOrderOfArrival(0); } -void Label::setSystemFont(const std::string& systemFont) +void Label::setSystemFontName(const std::string& systemFont) { if (systemFont != _systemFont) { diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 86a4eb0f45..5c1dc6984a 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -112,7 +112,7 @@ public: /** set TTF configuration for Label */ virtual bool setTTFConfig(const TTFConfig& ttfConfig); - virtual TTFConfig& getTTFConfig() { return _fontConfig;} + 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;} @@ -121,9 +121,11 @@ public: virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); virtual bool setCharMap(const std::string& plistFile); - virtual void setSystemFont(const std::string& systemFont); - virtual const std::string& getSystemFont() const { return _systemFont;} + /* 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;} + /* Sets the system font size of label.*/ virtual void setSystemFontSize(float fontSize); virtual float getSystemFontSize() const { return _systemFontSize;} diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 1b19af4655..5b8ac89645 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -100,7 +100,7 @@ bool LabelTTF::initWithString(const std::string& string, const std::string& font _renderLabel->setSystemFontSize(fontSize); _renderLabel->setDimensions(dimensions.width,dimensions.height); _renderLabel->setAlignment(hAlignment,vAlignment); - _renderLabel->setSystemFont(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->getSystemFont().c_str(), _renderLabel->getSystemFontSize(), _renderLabel->getString().c_str()); + return StringUtils::format("", _renderLabel->getSystemFontName().c_str(), _renderLabel->getSystemFontSize(), _renderLabel->getString().c_str()); } TextHAlignment LabelTTF::getHorizontalAlignment() const @@ -177,12 +177,12 @@ void LabelTTF::setFontSize(float fontSize) const std::string& LabelTTF::getFontName() const { - return _renderLabel->getSystemFont(); + return _renderLabel->getSystemFontName(); } void LabelTTF::setFontName(const std::string& fontName) { - _renderLabel->setSystemFont(fontName); + _renderLabel->setSystemFontName(fontName); _contentDirty = true; } diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 9ed034371e..e25dbd00b8 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -462,7 +462,7 @@ int MenuItemFont::getFontSizeObj() const void MenuItemFont::setFontNameObj(const std::string& name) { _fontName = name; - dynamic_cast(_label)->setSystemFont(_fontName); + dynamic_cast(_label)->setSystemFontName(_fontName); this->setContentSize(dynamic_cast(_label)->getContentSize()); } diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index 3d81de0cba..bcf71bf3ab 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -111,7 +111,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz { _placeHolder = placeholder; setDimensions(dimensions.width,dimensions.height); - setSystemFont(fontName); + setSystemFontName(fontName); setSystemFontSize(fontSize); setAlignment(alignment,TextVAlignment::CENTER); Label::setTextColor(_colorSpaceHolder); @@ -122,7 +122,7 @@ 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); - setSystemFont(fontName); + setSystemFontName(fontName); setSystemFontSize(fontSize); Label::setTextColor(_colorSpaceHolder); Label::setString(_placeHolder); diff --git a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp index a07300dd94..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)->setSystemFont(pFontTTF); + ((Label *)pNode)->setSystemFontName(pFontTTF); } else { NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader); } diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index ea4f7189a9..cff34e84ec 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -699,12 +699,12 @@ float Button::getTitleFontSize() const void Button::setTitleFontName(const std::string& fontName) { - _titleRenderer->setSystemFont(fontName); + _titleRenderer->setSystemFontName(fontName); } const std::string& Button::getTitleFontName() const { - return _titleRenderer->getSystemFont(); + return _titleRenderer->getSystemFontName(); } std::string Button::getDescription() const diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index aabfe39b5a..d1e3d711b2 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -132,7 +132,7 @@ int Text::getFontSize() void Text::setFontName(const std::string& name) { _fontName = name; - _labelRenderer->setSystemFont(name); + _labelRenderer->setSystemFontName(name); labelScaleChangedWithSize(); } diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 7df2a3a36f..b96ef54dae 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -542,13 +542,13 @@ int TextField::getFontSize() void TextField::setFontName(const std::string& name) { - _textFieldRenderer->setSystemFont(name); + _textFieldRenderer->setSystemFontName(name); textfieldRendererScaleChangedWithSize(); } const std::string& TextField::getFontName() { - return _textFieldRenderer->getSystemFont(); + return _textFieldRenderer->getSystemFontName(); } void TextField::didNotSelectSelf() @@ -807,7 +807,7 @@ void TextField::copySpecialProperties(Widget *widget) setText(textField->_textFieldRenderer->getString()); setPlaceHolder(textField->getStringValue()); setFontSize(textField->_textFieldRenderer->getSystemFontSize()); - setFontName(textField->_textFieldRenderer->getSystemFont()); + 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 b5d6a13f48..bdd2adcbfe 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -369,7 +369,7 @@ const std::string& ControlButton::getTitleTTFForState(State state) Label* labelTTF = dynamic_cast(label); if(labelTTF != 0) { - return labelTTF->getSystemFont(); + return labelTTF->getSystemFontName(); } static std::string ret(""); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 03e5c0c59c..7d195726c4 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -92,12 +92,12 @@ bool EditBoxImplAndroid::initWithSize(const Size& size) void EditBoxImplAndroid::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setSystemFont(pFontName); + _label->setSystemFontName(pFontName); _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } } @@ -111,7 +111,7 @@ void EditBoxImplAndroid::setFontColor(const Color3B& color) void EditBoxImplAndroid::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 3b2771f034..803145f554 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -395,9 +395,9 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) [_systemControl.textField setFont:textFont]; } - _label->setSystemFont(pFontName); + _label->setSystemFontName(pFontName); _label->setSystemFontSize(fontSize); - _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index d7ceb063d1..3d5f3a79f7 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -94,12 +94,12 @@ bool EditBoxImplWin::initWithSize(const Size& size) void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { if(_label != NULL) { - _label->setSystemFont(pFontName); + _label->setSystemFontName(pFontName); _label->setSystemFontSize(fontSize); } if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } } @@ -113,7 +113,7 @@ void EditBoxImplWin::setFontColor(const Color3B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { if(_labelPlaceHolder != NULL) { - _labelPlaceHolder->setSystemFont(pFontName); + _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index 2da62c6eb1..a7725a4bfb 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -118,12 +118,12 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size ) void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize ) { if(m_pLabel != NULL) { - m_pLabel->setSystemFont(pFontName); + m_pLabel->setSystemFontName(pFontName); m_pLabel->setSystemFontSize(fontSize); } if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setSystemFont(pFontName); + m_pLabelPlaceHolder->setSystemFontName(pFontName); m_pLabelPlaceHolder->setSystemFontSize(fontSize); } } @@ -137,7 +137,7 @@ void CCEditBoxImplWp8::setFontColor( const Color3B& color ) void CCEditBoxImplWp8::setPlaceholderFont( const char* pFontName, int fontSize ) { if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setSystemFont(pFontName); + m_pLabelPlaceHolder->setSystemFontName(pFontName); m_pLabelPlaceHolder->setSystemFontSize(fontSize); } } From 782d3cd3be9563d13c37017454e125bef8216f00 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 19:51:05 -0700 Subject: [PATCH 28/65] issue #4729: Linux fixes --- cocos/2d/platform/CCGLViewProtocol.cpp | 2 +- cocos/2d/platform/linux/CCPlatformDefine.h | 6 +----- cocos/2d/platform/linux/CCStdC.h | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cocos/2d/platform/CCGLViewProtocol.cpp b/cocos/2d/platform/CCGLViewProtocol.cpp index be1a7a18b9..e7c22aa1ad 100644 --- a/cocos/2d/platform/CCGLViewProtocol.cpp +++ b/cocos/2d/platform/CCGLViewProtocol.cpp @@ -367,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/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)) From 8ab372fdd9b78131dd45f84e00ce6d2072334615 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 10 Apr 2014 10:58:49 +0800 Subject: [PATCH 29/65] Label:Add compatible API of the create functions. --- cocos/2d/CCLabel.cpp | 12 ++++++++++++ cocos/2d/CCLabel.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 3e5ff52e29..9feeccfd6a 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -55,6 +55,18 @@ Label* Label::create() return ret; } +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); diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 5c1dc6984a..2905addf52 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -240,6 +240,10 @@ public: virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; + 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); + CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition); CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; } From 117f248a3bb6694189b1ec42b3f4648913ad2e4c Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 9 Apr 2014 20:07:00 -0700 Subject: [PATCH 30/65] Fix for FileUtils::getData --- cocos/2d/platform/CCFileUtils.cpp | 8 +++++--- cocos/2d/platform/android/CCFileUtilsAndroid.cpp | 3 +++ cocos/2d/platform/win32/CCFileUtilsWin32.cpp | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) 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/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/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; } From 0c3c29b50d9578c180985f7502fba76f726575df Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 11:22:55 +0800 Subject: [PATCH 31/65] Remove unused comments in CCEditBoxImplIOS.mm --- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index ec719b63bc..2befae216a 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -67,11 +67,12 @@ static const int CC_EDIT_BOX_PADDING = 5; -(id) initWithFrame: (CGRect) frameRect editBox: (void*) editBox { self = [super init]; - if(self){ + + if (self) + { editState_ = NO; self.textField = [[[CCCustomUITextField alloc] initWithFrame: frameRect] autorelease]; - //TODO: what is the line below doing? - //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; From 782bdd90f55750c9c8e1fae23e0e9313c4690b1d Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 03:24:38 +0000 Subject: [PATCH 32/65] [AUTO]: updating luabinding automatically --- .../scripting/lua-bindings/auto/api/Label.lua | 71 ++++++++----------- .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 1 - 3 files changed, 31 insertions(+), 43 deletions(-) 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/lua_cocos2dx_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id index 1e41284f45..0f891e31b8 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 +1df4a985f1a3139b97fe8ae46ebe148974f6d0bb \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index b87c20bc2b..ed1d7969aa 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1558,7 +1558,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - #endif // __cocos2dx_h__ From c24cdc6eefdf6f45482937fc13a24cfec9c1b2b0 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 11:26:32 +0800 Subject: [PATCH 33/65] Update AUTHORS [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 7f4a8df7fe..3f28d7737a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -815,6 +815,7 @@ 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 Retired Core Developers: WenSheng Yang From 1e37906965327c89add91846a41b9bd1be61350d Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 03:30:39 +0000 Subject: [PATCH 34/65] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index a44122a495..c5a9fdb61f 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 +a635835297db3cb0a6a385ce9251049896017bd5 \ No newline at end of file From bc147060580cbd2e1a5db6d86da774688d52c301 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 12:47:04 +0800 Subject: [PATCH 35/65] Update AUTHORS [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 3f28d7737a..8895c3b07d 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 From 35b2271b0d19e22631a505cd79ea3ac78727b5ee Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 12:49:53 +0800 Subject: [PATCH 36/65] Update CHANGELOG [ci skip] --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index 32bb75daf7..ed95cfe99f 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -334022fee8065e04cd3ba41672900023d8b45e35 \ No newline at end of file +acfd50c26681fd99e396bc05f971723cefa81dac \ No newline at end of file From 7ec9d6907e11bc7543bb471096c5b4ae860f2a2a Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 14:11:40 +0800 Subject: [PATCH 37/65] Moved the constructor and init function of SpriteBatchNode to protected access. --- cocos/2d/CCSpriteBatchNode.h | 46 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) 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. From 3f1e8c83a496ae56261a2ed6e10bd8b0c0f710fe Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 06:19:59 +0000 Subject: [PATCH 38/65] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/SpriteBatchNode.lua | 122 +++++++----------- .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 3 - 3 files changed, 51 insertions(+), 76 deletions(-) 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/lua_cocos2dx_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id index 0f891e31b8..fbe555c714 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 @@ -1df4a985f1a3139b97fe8ae46ebe148974f6d0bb \ No newline at end of file +95e846c0ce4896a03b04e26de54f8ddef6254c91 \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index ed1d7969aa..027ae885f1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1553,9 +1553,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - - From 2800133c9994afd43db2b78501f2316a3dfbeb59 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 10 Apr 2014 14:54:14 +0800 Subject: [PATCH 39/65] Add deprecated support for `Label::create` and new lua binding for `Label:createWithTTF` --- .../manual/lua_cocos2dx_manual.cpp.REMOVED.git-id | 2 +- tests/lua-tests/src/LabelTestNew/LabelTestNew.lua | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) 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..7d42f06031 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 +1f3aaaa7a6278242e064b685470e05e0e3337972 \ No newline at end of file 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) From aa51e5dd22a22c90780d001f89e62f5f769e5dd8 Mon Sep 17 00:00:00 2001 From: koowolf <450928375@qq.com> Date: Thu, 10 Apr 2014 15:15:17 +0800 Subject: [PATCH 40/65] fix compiler error in wp8 --- cocos/2d/cocos2d_wp8.vcxproj | 32 +++--- cocos/2d/cocos2d_wp8.vcxproj.filters | 97 ++++++++++--------- cocos/2d/cocos2d_wp8_headers.props | 2 +- cocos/2d/platform/winrt/CCStdC.h | 9 +- extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp | 12 +-- .../websockets/include/wp8/libwebsockets.h | 7 +- 6 files changed, 85 insertions(+), 74 deletions(-) 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..6c5ad09ec1 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\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;$(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/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/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index a7725a4bfb..167967e312 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -118,13 +118,13 @@ bool CCEditBoxImplWp8::initWithSize( const Size& size ) void CCEditBoxImplWp8::setFont( const char* pFontName, int fontSize ) { if(m_pLabel != NULL) { - m_pLabel->setSystemFontName(pFontName); - m_pLabel->setSystemFontSize(fontSize); + m_pLabel->setFontName(pFontName); + m_pLabel->setFontSize(fontSize); } if(m_pLabelPlaceHolder != NULL) { - m_pLabelPlaceHolder->setSystemFontName(pFontName); - m_pLabelPlaceHolder->setSystemFontSize(fontSize); + m_pLabelPlaceHolder->setFontName(pFontName); + m_pLabelPlaceHolder->setFontSize(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->setSystemFontName(pFontName); - m_pLabelPlaceHolder->setSystemFontSize(fontSize); + m_pLabelPlaceHolder->setFontName(pFontName); + m_pLabelPlaceHolder->setFontSize(fontSize); } } 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 From a258df38a99181e89a9face9b58551c86a905a91 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 15:31:22 +0800 Subject: [PATCH 41/65] closed #4744: EventDispatcher::setDirtyForNode doesn't consider node's children --- cocos/2d/CCEventDispatcher.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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) From 8a66f43f303ef91ebe094557dad74460032a990f Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 15:31:53 +0800 Subject: [PATCH 42/65] closed #4744: Adds test for issue4744. --- .../NewEventDispatcherTest/NewEventDispatcherTest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 6a53ab245b..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); } }; From 249163c32d2811ae471e7d91ddfb75691173e443 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 10 Apr 2014 15:52:51 +0800 Subject: [PATCH 43/65] Update config files for lua bindings-generator and `lua_cocos2dx_manual.cpp` file --- .../manual/lua_cocos2dx_manual.cpp.REMOVED.git-id | 2 +- tools/tolua/cocos2dx.ini | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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 7d42f06031..09318c5cdf 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 @@ -1f3aaaa7a6278242e064b685470e05e0e3337972 \ No newline at end of file +fedefe748d5878f9715bcc54e3cec5a4ce6a4f1e \ No newline at end of file diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 8dd5dcd7da..23d7680442 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -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 From fce85e08f9e6383d49491dac06da2c9561e7851b Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 10 Apr 2014 16:13:07 +0800 Subject: [PATCH 44/65] Fixed logical error in CameraCenterTest::onExit. --- tests/cpp-tests/Classes/NodeTest/NodeTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } From 335b1ec2ceea19bee7e1bd599ed7fba137537c8b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 16:19:09 +0800 Subject: [PATCH 45/65] Update CHANGELOG [ci skip] --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index ed95cfe99f..079079fcb1 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -acfd50c26681fd99e396bc05f971723cefa81dac \ No newline at end of file +fa44e866a2e76cacc4b1805f18e76675ad13cfbb \ No newline at end of file From 431f843773986de6a1afce3e76d4bd87c77bcc81 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 08:20:27 +0000 Subject: [PATCH 46/65] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Console.lua | 26 +++++++++++++++++++ .../lua-bindings/auto/api/Scheduler.lua | 5 ---- .../auto/api/lua_cocos2dx_auto_api.lua | 5 ++++ .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 +++ 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 cocos/scripting/lua-bindings/auto/api/Console.lua 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/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/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 fbe555c714..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 @@ -95e846c0ce4896a03b04e26de54f8ddef6254c91 \ No newline at end of file +877f92ef1788ddee60729373e99035e25a6cdb5c \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 027ae885f1..b87c20bc2b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1552,6 +1552,10 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + From 530cfae129e71f501b8e530f1fc795d19a46fe50 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 08:30:19 +0000 Subject: [PATCH 47/65] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Console.lua | 26 +++++++++++++++++++ .../lua-bindings/auto/api/Scheduler.lua | 5 ---- .../auto/api/lua_cocos2dx_auto_api.lua | 5 ++++ .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 +++ 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 cocos/scripting/lua-bindings/auto/api/Console.lua 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/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/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 fbe555c714..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 @@ -95e846c0ce4896a03b04e26de54f8ddef6254c91 \ No newline at end of file +877f92ef1788ddee60729373e99035e25a6cdb5c \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 027ae885f1..b87c20bc2b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1552,6 +1552,10 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + From d27a3c96423129d7db74f7450b3b36b750c3cdda Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 10 Apr 2014 08:40:58 +0000 Subject: [PATCH 48/65] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index c5a9fdb61f..3a1d65b0f7 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -a635835297db3cb0a6a385ce9251049896017bd5 \ No newline at end of file +33a592c87db605bac0a2234df142f1dc3222e88f \ No newline at end of file From d583dcc0f0d65ab03d12919d1ff8359fcbf020d2 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 10 Apr 2014 16:48:51 +0800 Subject: [PATCH 49/65] Fixed logical error in TestChangeAnimationInternal::onExit. --- .../ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 0d37c0284d..bff720784c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -1464,6 +1464,7 @@ void TestChangeAnimationInternal::onEnter() void TestChangeAnimationInternal::onExit() { Director::getInstance()->setAnimationInterval(1/60.0f); + ArmatureTestLayer::onExit(); } std::string TestChangeAnimationInternal::title() const { From b5433f05c1b7575fd00c662ccad2610601103147 Mon Sep 17 00:00:00 2001 From: koowolf <450928375@qq.com> Date: Thu, 10 Apr 2014 16:51:25 +0800 Subject: [PATCH 50/65] replace LabelTTF with Label --- extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp | 16 ++++++++-------- extensions/GUI/CCEditBox/CCEditBoxImplWp8.h | 4 ++-- .../Classes/ExtensionsTest/ExtensionsTest.cpp | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) 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/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 From 247f877cf4eaf78d4aede35c9fe338d4765071e1 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 17:08:02 +0800 Subject: [PATCH 51/65] Update AUTHORS [ci skip] --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 8895c3b07d..c698576907 100644 --- a/AUTHORS +++ b/AUTHORS @@ -817,6 +817,9 @@ 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 Retired Core Developers: WenSheng Yang From 801fdde92b3d6fe9e9d386640e9280a5f282aa51 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 17:11:05 +0800 Subject: [PATCH 52/65] Update CHANGELOG [ci skip] --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index 079079fcb1..3607a60ba8 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -fa44e866a2e76cacc4b1805f18e76675ad13cfbb \ No newline at end of file +3dec43835640892d3595d2063489624cf216dd73 \ No newline at end of file From 39b25c93076fbdb986d6b275e37042e62a23fabd Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 17:15:59 +0800 Subject: [PATCH 53/65] Removed unused comments in GUIDefine.h --- cocos/ui/GUIDefine.h | 6 ------ 1 file changed, 6 deletions(-) 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__) */ From 8472e51b8528eddcae5eb464c36c4dca40d7b295 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 10 Apr 2014 17:31:42 +0800 Subject: [PATCH 54/65] Add CCFontFNT.h to cocos2d.h --- cocos/2d/cocos2d.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/2d/cocos2d.h b/cocos/2d/cocos2d.h index bf59256bea..fe8606c2ce 100644 --- a/cocos/2d/cocos2d.h +++ b/cocos/2d/cocos2d.h @@ -88,6 +88,7 @@ THE SOFTWARE. #include "CCLabelTTF.h" #include "CCLabelBMFont.h" #include "CCLabel.h" +#include "CCFontFNT.h" // layers_scenes_transitions_nodes #include "CCLayer.h" From c937cad4c94201deb99704f29762f3243deaf091 Mon Sep 17 00:00:00 2001 From: shujunqiao Date: Thu, 10 Apr 2014 18:20:53 +0800 Subject: [PATCH 55/65] [ci skip], fix android part in cocos-console-test.py. --- tools/jenkins-scripts/cocos-console-test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 157fce785c28d2f64314cf9c079a65d7b3fe33e4 Mon Sep 17 00:00:00 2001 From: heliclei Date: Thu, 10 Apr 2014 18:31:28 +0800 Subject: [PATCH 56/65] fix CCConsole linux crash --- cocos/base/CCConsole.cpp | 14 ++++++++++++++ .../cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp | 7 ++++--- tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h | 1 - 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 11ccdc0d0b..fc0c599990 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #endif #include "CCDirector.h" @@ -1058,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/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index b30187e0e6..70647f5dad 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -186,8 +186,9 @@ ConsoleUploadFile::ConsoleUploadFile() 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); }; From e7a4ac531a50268a807e70ca96179be9514d0a65 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 19:29:07 +0800 Subject: [PATCH 57/65] Initializes member variables for TransitionScene class --- cocos/2d/CCTransition.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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) From 1fdcaaa2c6e94883225163546a5860e1c0b59399 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 20:31:44 +0800 Subject: [PATCH 58/65] Initialzies member variables for QualCommand class. --- cocos/2d/renderer/CCQuadCommand.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cocos/2d/renderer/CCQuadCommand.cpp b/cocos/2d/renderer/CCQuadCommand.cpp index 29576bc7fb..b2bda8498e 100644 --- a/cocos/2d/renderer/CCQuadCommand.cpp +++ b/cocos/2d/renderer/CCQuadCommand.cpp @@ -36,11 +36,15 @@ static void convertIntToByteArray(int value, int* output) } QuadCommand::QuadCommand() -:_textureID(0) -,_blendType(BlendFunc::DISABLE) -,_quadsCount(0) +:_materialID(0) +,_textureID(0) +,_lastTextureID(0) ,_shader(nullptr) +,_lastShader(nullptr) +,_blendType(BlendFunc::DISABLE) +,_lastBlendType(BlendFunc::DISABLE) ,_quads(nullptr) +,_quadsCount(0) { _type = RenderCommand::Type::QUAD_COMMAND; } From 6b21e598c5fb4a047424e4f80fabfb2df1f25da0 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 10 Apr 2014 21:14:24 +0800 Subject: [PATCH 59/65] [win32] Fix typo in cocos2d_(winrt_|wp8_)headers.props, gui -> ui --- cocos/2d/cocos2d_headers.props | 2 +- cocos/2d/cocos2d_winrt_headers.props | 2 +- cocos/2d/cocos2d_wp8_headers.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/2d/cocos2d_headers.props b/cocos/2d/cocos2d_headers.props index e605ff61a8..76fa51e023 100644 --- a/cocos/2d/cocos2d_headers.props +++ b/cocos/2d/cocos2d_headers.props @@ -7,7 +7,7 @@ - $(EngineRoot)cocos;$(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 0b007eba30..a15b97b395 100644 --- a/cocos/2d/cocos2d_winrt_headers.props +++ b/cocos/2d/cocos2d_winrt_headers.props @@ -7,7 +7,7 @@ - $(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\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_headers.props b/cocos/2d/cocos2d_wp8_headers.props index 6c5ad09ec1..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;$(EngineRoot)cocos\deprecated;$(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 From 951bf1cbfa9b0c998650c66f17cf8c2b8f4d3235 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 10 Apr 2014 22:56:40 +0800 Subject: [PATCH 60/65] remove unneeded codes --- cocos/2d/renderer/CCQuadCommand.cpp | 15 ++++++--------- cocos/2d/renderer/CCQuadCommand.h | 3 --- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cocos/2d/renderer/CCQuadCommand.cpp b/cocos/2d/renderer/CCQuadCommand.cpp index 29576bc7fb..f0b753b291 100644 --- a/cocos/2d/renderer/CCQuadCommand.cpp +++ b/cocos/2d/renderer/CCQuadCommand.cpp @@ -49,21 +49,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 d8f2ded978..1963cae544 100644 --- a/cocos/2d/renderer/CCQuadCommand.h +++ b/cocos/2d/renderer/CCQuadCommand.h @@ -71,13 +71,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; From c687b97c6e3b7bf23aca4330ece410ef555aecb3 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 10 Apr 2014 23:36:25 +0800 Subject: [PATCH 61/65] fix the crash invoked by deprecated `create` function of `Label` --- .../lua_cocos2dx_manual.cpp.REMOVED.git-id | 2 +- tests/lua-tests/src/ActionsTest/ActionsTest.lua | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) 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 09318c5cdf..c0581608b3 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 @@ -fedefe748d5878f9715bcc54e3cec5a4ce6a4f1e \ No newline at end of file +9d352a710e92a7bfef96b3ce65ea163ce755eb59 \ No newline at end of file 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) From d82c4bed75ddd05dfd23b2ee81b53274031d262e Mon Sep 17 00:00:00 2001 From: Xiaosong Gao Date: Fri, 11 Apr 2014 08:07:18 +0800 Subject: [PATCH 62/65] In Mac OS X 10.9 and Xcode 5.1, it is a warning "Declaration shadows a local variable" in a new ios/mac project. --- external/chipmunk/src/cpCollision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } } From f136108037641ce8c2377d7bee3c4af5bdafa4f0 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 11 Apr 2014 09:52:09 +0800 Subject: [PATCH 63/65] fix compile error --- .../lua-bindings/manual/lua_cocos2dx_manual.cpp.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c0581608b3..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 @@ -9d352a710e92a7bfef96b3ce65ea163ce755eb59 \ No newline at end of file +468c9e8472db4be2923ca63484bc72ba2a30ae88 \ No newline at end of file From 48a5fd555bedec8299ac643149c2331a6e1378fb Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 11 Apr 2014 10:50:38 +0800 Subject: [PATCH 64/65] Compilation error fix in CCQuadCommand.cpp --- cocos/2d/renderer/CCQuadCommand.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/cocos/2d/renderer/CCQuadCommand.cpp b/cocos/2d/renderer/CCQuadCommand.cpp index 06a0e820d5..48d5bdc911 100644 --- a/cocos/2d/renderer/CCQuadCommand.cpp +++ b/cocos/2d/renderer/CCQuadCommand.cpp @@ -38,11 +38,8 @@ static void convertIntToByteArray(int value, int* output) QuadCommand::QuadCommand() :_materialID(0) ,_textureID(0) -,_lastTextureID(0) ,_shader(nullptr) -,_lastShader(nullptr) ,_blendType(BlendFunc::DISABLE) -,_lastBlendType(BlendFunc::DISABLE) ,_quads(nullptr) ,_quadsCount(0) { From 9f1c529885aa5e646edf9a81d9cca0aaca411c72 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 11 Apr 2014 10:57:42 +0800 Subject: [PATCH 65/65] Update AUTHORS [ci skip] --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index c698576907..3d3f2cf4fa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -820,6 +820,9 @@ Developers: ololomax Fixed a potential crash in SceneReader::createNodeWithSceneFile + + gaoxiaosong + Fixed a warning in cpCollision.c Retired Core Developers: WenSheng Yang