From b8ce59962a39e12d2620062486c320a30c61d9ec Mon Sep 17 00:00:00 2001 From: CaiWenzhi Date: Thu, 13 Mar 2014 10:11:41 +0800 Subject: [PATCH 1/9] Fixed bug of ScrollView --- .../project.pbxproj.REMOVED.git-id | 2 +- cocos/ui/UIScrollView.cpp | 37 +++- cocos/ui/UIScrollView.h | 9 + cocos/ui/UIWidget.cpp | 113 +++-------- cocos/ui/UIWidget.h | 4 + .../ButtonReader/ButtonReader.cpp | 158 -------------- .../WidgetReader/ButtonReader/ButtonReader.h | 47 ----- .../CheckBoxReader/CheckBoxReader.cpp | 153 -------------- .../CheckBoxReader/CheckBoxReader.h | 47 ----- .../ImageViewReader/ImageViewReader.cpp | 98 --------- .../ImageViewReader/ImageViewReader.h | 47 ----- .../LayoutReader/LayoutReader.cpp | 119 ----------- .../WidgetReader/LayoutReader/LayoutReader.h | 47 ----- .../ListViewReader/ListViewReader.cpp | 48 ----- .../ListViewReader/ListViewReader.h | 47 ----- .../LoadingBarReader/LoadingBarReader.cpp | 91 --------- .../LoadingBarReader/LoadingBarReader.h | 47 ----- .../PageViewReader/PageViewReader.cpp | 35 ---- .../PageViewReader/PageViewReader.h | 47 ----- .../ScrollViewReader/ScrollViewReader.cpp | 47 ----- .../ScrollViewReader/ScrollViewReader.h | 47 ----- .../SliderReader/SliderReader.cpp | 192 ------------------ .../WidgetReader/SliderReader/SliderReader.h | 47 ----- .../TextAtlasReader/TextAtlasReader.cpp | 69 ------- .../TextAtlasReader/TextAtlasReader.h | 46 ----- .../TextBMFontReader/TextBMFontReader.cpp | 65 ------ .../TextBMFontReader/TextBMFontReader.h | 47 ----- .../TextFieldReader/TextFieldReader.cpp | 84 -------- .../TextFieldReader/TextFieldReader.h | 47 ----- .../ui/WidgetReader/TextReader/TextReader.cpp | 74 ------- cocos/ui/WidgetReader/TextReader/TextReader.h | 47 ----- cocos/ui/WidgetReader/WidgetReader.cpp | 173 ---------------- cocos/ui/WidgetReader/WidgetReader.h | 51 ----- cocos/ui/WidgetReader/WidgetReaderProtocol.h | 53 ----- .../Hello.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../GUI/missing-font.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../Hello.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../background.png.REMOVED.git-id | 0 .../UITest/background.png.REMOVED.git-id | 0 .../b11.png.REMOVED.git-id | 0 .../bitmapFontTest2.png.REMOVED.git-id | 0 .../examples/examples.json.REMOVED.git-id | 0 .../map_1/map_pve.png.REMOVED.git-id | 0 .../page_1/background.png.REMOVED.git-id | 0 68 files changed, 82 insertions(+), 2203 deletions(-) delete mode 100644 cocos/ui/WidgetReader/ButtonReader/ButtonReader.cpp delete mode 100644 cocos/ui/WidgetReader/ButtonReader/ButtonReader.h delete mode 100644 cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.cpp delete mode 100644 cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.h delete mode 100644 cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.cpp delete mode 100644 cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.h delete mode 100644 cocos/ui/WidgetReader/LayoutReader/LayoutReader.cpp delete mode 100644 cocos/ui/WidgetReader/LayoutReader/LayoutReader.h delete mode 100644 cocos/ui/WidgetReader/ListViewReader/ListViewReader.cpp delete mode 100644 cocos/ui/WidgetReader/ListViewReader/ListViewReader.h delete mode 100644 cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.cpp delete mode 100644 cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.h delete mode 100644 cocos/ui/WidgetReader/PageViewReader/PageViewReader.cpp delete mode 100644 cocos/ui/WidgetReader/PageViewReader/PageViewReader.h delete mode 100644 cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.cpp delete mode 100644 cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.h delete mode 100644 cocos/ui/WidgetReader/SliderReader/SliderReader.cpp delete mode 100644 cocos/ui/WidgetReader/SliderReader/SliderReader.h delete mode 100644 cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.cpp delete mode 100644 cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.h delete mode 100644 cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.cpp delete mode 100644 cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.h delete mode 100644 cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.cpp delete mode 100644 cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.h delete mode 100644 cocos/ui/WidgetReader/TextReader/TextReader.cpp delete mode 100644 cocos/ui/WidgetReader/TextReader/TextReader.h delete mode 100644 cocos/ui/WidgetReader/WidgetReader.cpp delete mode 100644 cocos/ui/WidgetReader/WidgetReader.h delete mode 100644 cocos/ui/WidgetReader/WidgetReaderProtocol.h rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/Hello.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIButton_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UICheckBox_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIImageView_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILabelAtlas_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILabelBMFont_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILabel_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/Hello.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UILoadingBar_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIPageView_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UISlider_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UITextField_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UIEditorTest/UIWidgetAddNode_Editor/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/UITest/background.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/b11.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/bitmapFontTest2.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/examples/examples.json.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/gui_examples/map_1/map_pve.png.REMOVED.git-id (100%) rename tests/cpp-tests/Resources/hd/{cocosgui => cocosui}/gui_examples/page_1/background.png.REMOVED.git-id (100%) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index f04874a8ec..8088b36f0b 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -71a61fb97a4db05adaabc4cc03035fe419cc35d6 \ No newline at end of file +bbf0323293cba3d7ee58ef36706831a8761692d8 \ No newline at end of file diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index f286c9ba29..3b6b4e4421 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -27,6 +27,41 @@ THE SOFTWARE. NS_CC_BEGIN namespace ui { + +ScrollInnerContainer::ScrollInnerContainer() +{ + +} + +ScrollInnerContainer::~ScrollInnerContainer() +{ + +} + +ScrollInnerContainer* ScrollInnerContainer::create() +{ + ScrollInnerContainer* widget = new ScrollInnerContainer(); + if (widget && widget->init()) + { + widget->autorelease(); + return widget; + } + CC_SAFE_DELETE(widget); + return nullptr; +} + +const Size& ScrollInnerContainer::getLayoutSize() +{ + Widget* parent = getWidgetParent(); + if (parent) + { + return parent->getSize(); + } + else + { + return _size; + } +} static const float AUTOSCROLLMAXSPEED = 1000.0f; @@ -233,7 +268,7 @@ void ScrollView::addChild(Node * child, int zOrder) void ScrollView::addChild(Node *child, int zOrder, int tag) { - return _innerContainer->addChild(child, zOrder, tag); + _innerContainer->addChild(child, zOrder, tag); } void ScrollView::removeAllChildren() diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 1f0150e2ea..ad06d519ce 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -31,6 +31,15 @@ THE SOFTWARE. NS_CC_BEGIN namespace ui { + +class ScrollInnerContainer : public Layout +{ +public: + ScrollInnerContainer(); + virtual ~ScrollInnerContainer(); + static ScrollInnerContainer* create(); + virtual const Size& getLayoutSize() override; +}; enum SCROLLVIEW_DIR { diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 9b7f613a51..3459f9e2ec 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -396,6 +396,21 @@ void Widget::setSizePercent(const Point &percent) } void Widget::updateSizeAndPosition() +{ + Widget* widgetParent = getWidgetParent(); + Size pSize; + if (widgetParent) + { + pSize = widgetParent->getLayoutSize(); + } + else + { + pSize = _parent->getContentSize(); + } + updateSizeAndPosition(pSize); +} + +void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize) { switch (_sizeType) { @@ -409,70 +424,33 @@ void Widget::updateSizeAndPosition() { _size = _customSize; } - Widget* widgetParent = getWidgetParent(); - if (widgetParent) + float spx = 0.0f; + float spy = 0.0f; + if (parentSize.width > 0.0f) { - Size pSize = widgetParent->getSize(); - float spx = 0.0f; - float spy = 0.0f; - if (pSize.width > 0.0f) - { - spx = _customSize.width / pSize.width; - } - if (pSize.height > 0.0f) - { - spy = _customSize.height / pSize.height; - } - _sizePercent = Point(spx, spy); + spx = _customSize.width / parentSize.width; } - else + if (parentSize.height > 0.0f) { - Size pSize = _parent->getContentSize(); - float spx = 0.0f; - float spy = 0.0f; - if (pSize.width > 0.0f) - { - spx = _customSize.width / pSize.width; - } - if (pSize.height > 0.0f) - { - spy = _customSize.height / pSize.height; - } - _sizePercent = Point(spx, spy); + spy = _customSize.height / parentSize.height; } + _sizePercent = Point(spx, spy); break; } case SIZE_PERCENT: { - Widget* widgetParent = getWidgetParent(); - if (widgetParent) + Size cSize = Size(parentSize.width * _sizePercent.x , parentSize.height * _sizePercent.y); + if (_ignoreSize) { - Size cSize = Size(widgetParent->getSize().width * _sizePercent.x , widgetParent->getSize().height * _sizePercent.y); - if (_ignoreSize) - { - _size = getContentSize(); - } - else - { - _size = cSize; - } - _customSize = cSize; + _size = getContentSize(); } else { - Size cSize = Size(_parent->getContentSize().width * _sizePercent.x , _parent->getContentSize().height * _sizePercent.y); - if (_ignoreSize) - { - _size = getContentSize(); - } - else - { - _size = cSize; - } - _customSize = cSize; + _size = cSize; } - } + _customSize = cSize; break; + } default: break; } @@ -482,46 +460,19 @@ void Widget::updateSizeAndPosition() { case POSITION_ABSOLUTE: { - Widget* widgetParent = getWidgetParent(); - if (widgetParent) + if (parentSize.width <= 0.0f || parentSize.height <= 0.0f) { - Size pSize = widgetParent->getSize(); - if (pSize.width <= 0.0f || pSize.height <= 0.0f) - { - _positionPercent = Point::ZERO; - } - else - { - _positionPercent = Point(absPos.x / pSize.width, absPos.y / pSize.height); - } + _positionPercent = Point::ZERO; } else { - Size pSize = _parent->getContentSize(); - if (pSize.width <= 0.0f || pSize.height <= 0.0f) - { - _positionPercent = Point::ZERO; - } - else - { - _positionPercent = Point(absPos.x / pSize.width, absPos.y / pSize.height); - } + _positionPercent = Point(absPos.x / parentSize.width, absPos.y / parentSize.height); } break; } case POSITION_PERCENT: { - Widget* widgetParent = getWidgetParent(); - if (widgetParent) - { - Size parentSize = widgetParent->getSize(); - absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y); - } - else - { - Size parentSize = _parent->getContentSize(); - absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y); - } + absPos = Point(parentSize.width * _positionPercent.x, parentSize.height * _positionPercent.y); break; } default: diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index eaa4bb692e..a91ac6102e 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -549,6 +549,8 @@ public: const Size& getSize() const; const Size& getCustomSize() const; + + virtual const Size& getLayoutSize() {return _size;}; /** * Returns size percent of widget @@ -642,6 +644,8 @@ public: void updateSizeAndPosition(); + void updateSizeAndPosition(const Size& parentSize); + /*temp action*/ void setActionTag(int tag); int getActionTag(); diff --git a/cocos/ui/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/ui/WidgetReader/ButtonReader/ButtonReader.cpp deleted file mode 100644 index 5bf321dc84..0000000000 --- a/cocos/ui/WidgetReader/ButtonReader/ButtonReader.cpp +++ /dev/null @@ -1,158 +0,0 @@ - - -#include "ButtonReader.h" -#include "ui/UIButton.h" - -namespace cocostudio -{ - static ButtonReader* instanceButtonReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader) - - ButtonReader::ButtonReader() - { - - } - - ButtonReader::~ButtonReader() - { - - } - - ButtonReader* ButtonReader::getInstance() - { - if (!instanceButtonReader) - { - instanceButtonReader = new ButtonReader(); - } - return instanceButtonReader; - } - - void ButtonReader::purge() - { - CC_SAFE_DELETE(instanceButtonReader); - } - - void ButtonReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - Button* button = static_cast(widget); - bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable"); - button->setScale9Enabled(scale9Enable); - - const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "normalData"); - int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType"); - switch (normalType) - { - case 0: - { - std::string tp_n = jsonPath; - const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path"); - const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr; - button->loadTextureNormal(normalFileName_tp); - break; - } - case 1: - { - const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path"); - button->loadTextureNormal(normalFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "pressedData"); - int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType"); - switch (pressedType) - { - case 0: - { - std::string tp_p = jsonPath; - const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path"); - const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr; - button->loadTexturePressed(pressedFileName_tp); - break; - } - case 1: - { - const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path"); - button->loadTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "disabledData"); - int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType"); - switch (disabledType) - { - case 0: - { - std::string tp_d = jsonPath; - const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path"); - const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr; - button->loadTextureDisabled(disabledFileName_tp); - break; - } - case 1: - { - const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path"); - button->loadTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - if (scale9Enable) - { - float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); - float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); - float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); - float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); - - button->setCapInsets(Rect(cx, cy, cw, ch)); - bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width"); - bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height"); - if (sw && sh) - { - float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); - float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); - button->setSize(Size(swf, shf)); - } - } - bool tt = DICTOOL->checkObjectExist_json(options, "text"); - if (tt) - { - const char* text = DICTOOL->getStringValue_json(options, "text"); - if (text) - { - button->setTitleText(text); - } - } - - bool cr = DICTOOL->checkObjectExist_json(options, "textColorR"); - bool cg = DICTOOL->checkObjectExist_json(options, "textColorG"); - bool cb = DICTOOL->checkObjectExist_json(options, "textColorB"); - int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255; - int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255; - int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255; - button->setTitleColor(Color3B(cri,cgi,cbi)); - bool fs = DICTOOL->checkObjectExist_json(options, "fontSize"); - if (fs) - { - button->setTitleFontSize(DICTOOL->getIntValue_json(options, "fontSize")); - } - bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); - if (fn) - { - button->setTitleFontName(DICTOOL->getStringValue_json(options, "fontName")); - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/ButtonReader/ButtonReader.h b/cocos/ui/WidgetReader/ButtonReader/ButtonReader.h deleted file mode 100644 index f3ec7b406a..0000000000 --- a/cocos/ui/WidgetReader/ButtonReader/ButtonReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__ButtonReader__ -#define __TestCpp__ButtonReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class ButtonReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - ButtonReader(); - virtual ~ButtonReader(); - - static ButtonReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__ButtonReader__) */ diff --git a/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.cpp b/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.cpp deleted file mode 100644 index 06ac1bc0a7..0000000000 --- a/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.cpp +++ /dev/null @@ -1,153 +0,0 @@ - - -#include "CheckBoxReader.h" -#include "ui/UICheckBox.h" - -namespace cocostudio -{ - static CheckBoxReader* instanceCheckBoxReader = NULL; - using cocos2d::ui::CheckBox; - IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader) - - CheckBoxReader::CheckBoxReader() - { - - } - - CheckBoxReader::~CheckBoxReader() - { - - } - - CheckBoxReader* CheckBoxReader::getInstance() - { - if (!instanceCheckBoxReader) - { - instanceCheckBoxReader = new CheckBoxReader(); - } - return instanceCheckBoxReader; - } - - void CheckBoxReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - CheckBox* checkBox = static_cast(widget); - - const rapidjson::Value& backGroundDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxData"); - int backGroundType = DICTOOL->getIntValue_json(backGroundDic, "resourceType"); - switch (backGroundType) - { - case 0: - { - std::string tp_b = jsonPath; - const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path"); - const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():nullptr; - checkBox->loadTextureBackGround(backGroundFileName_tp); - break; - } - case 1: - { - const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path"); - checkBox->loadTextureBackGround(backGroundFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& backGroundSelectedDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxSelectedData"); - int backGroundSelectedType = DICTOOL->getIntValue_json(backGroundSelectedDic, "resourceType"); - switch (backGroundSelectedType) - { - case 0: - { - std::string tp_bs = jsonPath; - const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path"); - const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():nullptr; - checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName_tp); - break; - } - case 1: - { - const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path"); - checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& frontCrossDic = DICTOOL->getSubDictionary_json(options, "frontCrossData"); - int frontCrossType = DICTOOL->getIntValue_json(frontCrossDic, "resourceType"); - switch (frontCrossType) - { - case 0: - { - std::string tp_c = jsonPath; - const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path"); - const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():nullptr; - checkBox->loadTextureFrontCross(frontCrossFileName_tp); - break; - } - case 1: - { - const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path"); - checkBox->loadTextureFrontCross(frontCrossFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& backGroundDisabledDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxDisabledData"); - int backGroundDisabledType = DICTOOL->getIntValue_json(backGroundDisabledDic, "resourceType"); - switch (backGroundDisabledType) - { - case 0: - { - std::string tp_bd = jsonPath; - const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path"); - const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():nullptr; - checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName_tp); - break; - } - case 1: - { - const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path"); - checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& frontCrossDisabledDic = DICTOOL->getSubDictionary_json(options, "frontCrossDisabledData"); - int frontCrossDisabledType = DICTOOL->getIntValue_json(frontCrossDisabledDic, "resourceType"); - switch (frontCrossDisabledType) - { - case 0: - { - std::string tp_cd = jsonPath; - const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path"); - const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():nullptr; - checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName_tp); - break; - } - case 1: - { - const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path"); - checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.h b/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.h deleted file mode 100644 index cbfed76584..0000000000 --- a/cocos/ui/WidgetReader/CheckBoxReader/CheckBoxReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__CheckBoxReader__ -#define __TestCpp__CheckBoxReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class CheckBoxReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - CheckBoxReader(); - virtual ~CheckBoxReader(); - - static CheckBoxReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__CheckBoxReader__) */ diff --git a/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.cpp deleted file mode 100644 index 083d81f261..0000000000 --- a/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ /dev/null @@ -1,98 +0,0 @@ - - -#include "ImageViewReader.h" -#include "ui/UIImageView.h" - -namespace cocostudio -{ - static ImageViewReader* instanceImageViewReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader) - - ImageViewReader::ImageViewReader() - { - - } - - ImageViewReader::~ImageViewReader() - { - - } - - ImageViewReader* ImageViewReader::getInstance() - { - if (!instanceImageViewReader) - { - instanceImageViewReader = new ImageViewReader(); - } - return instanceImageViewReader; - } - - void ImageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - ImageView* imageView = static_cast(widget); - - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "fileNameData"); - int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType"); - switch (imageFileNameType) - { - case 0: - { - std::string tp_i = jsonPath; - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - const char* imageFileName_tp = nullptr; - if (imageFileName && (strcmp(imageFileName, "") != 0)) - { - imageFileName_tp = tp_i.append(imageFileName).c_str(); - imageView->loadTexture(imageFileName_tp); - } - break; - } - case 1: - { - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable"); - bool scale9Enable = false; - if (scale9EnableExist) - { - scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable"); - } - imageView->setScale9Enabled(scale9Enable); - - - if (scale9Enable) - { - bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width"); - bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height"); - if (sw && sh) - { - float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); - float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); - imageView->setSize(Size(swf, shf)); - } - - float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); - float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); - float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); - float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); - - imageView->setCapInsets(Rect(cx, cy, cw, ch)); - - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.h b/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.h deleted file mode 100644 index 09d4ae2b43..0000000000 --- a/cocos/ui/WidgetReader/ImageViewReader/ImageViewReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__ImageViewReader__ -#define __TestCpp__ImageViewReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class ImageViewReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - ImageViewReader(); - virtual ~ImageViewReader(); - - static ImageViewReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__ImageViewReader__) */ diff --git a/cocos/ui/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/ui/WidgetReader/LayoutReader/LayoutReader.cpp deleted file mode 100644 index ec137e7ca4..0000000000 --- a/cocos/ui/WidgetReader/LayoutReader/LayoutReader.cpp +++ /dev/null @@ -1,119 +0,0 @@ - - -#include "LayoutReader.h" -#include "ui/UILayout.h" - -namespace cocostudio -{ - static LayoutReader* instanceLayoutReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader) - - LayoutReader::LayoutReader() - { - - } - - LayoutReader::~LayoutReader() - { - - } - - LayoutReader* LayoutReader::getInstance() - { - if (!instanceLayoutReader) - { - instanceLayoutReader = new LayoutReader(); - } - return instanceLayoutReader; - } - - void LayoutReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - Layout* panel = static_cast(widget); - - /* adapt screen gui */ - float w = 0, h = 0; - bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen"); - if (adaptScrenn) - { - Size screenSize = CCDirector::getInstance()->getWinSize(); - w = screenSize.width; - h = screenSize.height; - } - else - { - w = DICTOOL->getFloatValue_json(options, "width"); - h = DICTOOL->getFloatValue_json(options, "height"); - } - panel->setSize(Size(w, h)); - /**/ - - bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable"); - panel->setBackGroundImageScale9Enabled(backGroundScale9Enable); - int cr = DICTOOL->getIntValue_json(options, "bgColorR"); - int cg = DICTOOL->getIntValue_json(options, "bgColorG"); - int cb = DICTOOL->getIntValue_json(options, "bgColorB"); - - int scr = DICTOOL->getIntValue_json(options, "bgStartColorR"); - int scg = DICTOOL->getIntValue_json(options, "bgStartColorG"); - int scb = DICTOOL->getIntValue_json(options, "bgStartColorB"); - - int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR"); - int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG"); - int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB"); - - float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX"); - float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY"); - panel->setBackGroundColorVector(Point(bgcv1, bgcv2)); - - int co = DICTOOL->getIntValue_json(options, "bgColorOpacity"); - - int colorType = DICTOOL->getIntValue_json(options, "colorType"); - panel->setBackGroundColorType(LayoutBackGroundColorType(colorType)); - panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb)); - panel->setBackGroundColor(Color3B(cr, cg, cb)); - panel->setBackGroundColorOpacity(co); - - - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "backGroundImageData"); - int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType"); - switch (imageFileNameType) - { - case 0: - { - std::string tp_b = jsonPath; - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr; - panel->setBackGroundImage(imageFileName_tp); - break; - } - case 1: - { - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - if (backGroundScale9Enable) - { - float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); - float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); - float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); - float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); - panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch)); - } - panel->setLayoutType((LayoutType)DICTOOL->getIntValue_json(options, "layoutType")); - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/LayoutReader/LayoutReader.h b/cocos/ui/WidgetReader/LayoutReader/LayoutReader.h deleted file mode 100644 index e4d2f3b479..0000000000 --- a/cocos/ui/WidgetReader/LayoutReader/LayoutReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__LayoutReader__ -#define __TestCpp__LayoutReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class LayoutReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - LayoutReader(); - virtual ~LayoutReader(); - - static LayoutReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__LayoutReader__) */ diff --git a/cocos/ui/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/ui/WidgetReader/ListViewReader/ListViewReader.cpp deleted file mode 100644 index 44a58941b5..0000000000 --- a/cocos/ui/WidgetReader/ListViewReader/ListViewReader.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#include "ListViewReader.h" -#include "ui/UIListView.h" - -namespace cocostudio -{ - static ListViewReader* instanceListViewReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader) - - ListViewReader::ListViewReader() - { - - } - - ListViewReader::~ListViewReader() - { - - } - - ListViewReader* ListViewReader::getInstance() - { - if (!instanceListViewReader) - { - instanceListViewReader = new ListViewReader(); - } - return instanceListViewReader; - } - - void ListViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options) - { - ScrollViewReader::setPropsFromJsonDictionary(widget, options); - - - ListView* listView = static_cast(widget); - - int direction = DICTOOL->getFloatValue_json(options, "direction"); - listView->setDirection((SCROLLVIEW_DIR)direction); - - ListViewGravity gravity = (ListViewGravity)DICTOOL->getIntValue_json(options, "gravity"); - listView->setGravity(gravity); - - float itemMargin = DICTOOL->getFloatValue_json(options, "itemMargin"); - listView->setItemsMargin(itemMargin); - } -} - diff --git a/cocos/ui/WidgetReader/ListViewReader/ListViewReader.h b/cocos/ui/WidgetReader/ListViewReader/ListViewReader.h deleted file mode 100644 index 6c10b2114b..0000000000 --- a/cocos/ui/WidgetReader/ListViewReader/ListViewReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__ListViewReader__ -#define __TestCpp__ListViewReader__ - -#include "../ScrollViewReader/ScrollViewReader.h" - -namespace cocostudio -{ - class ListViewReader : public ScrollViewReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - ListViewReader(); - virtual ~ListViewReader(); - - static ListViewReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__ListViewReader__) */ diff --git a/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.cpp deleted file mode 100644 index 864e19a473..0000000000 --- a/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -#include "LoadingBarReader.h" -#include "ui/UILoadingBar.h" - -namespace cocostudio -{ - static LoadingBarReader* instanceLoadingBar = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader) - - LoadingBarReader::LoadingBarReader() - { - - } - - LoadingBarReader::~LoadingBarReader() - { - - } - - LoadingBarReader* LoadingBarReader::getInstance() - { - if (!instanceLoadingBar) - { - instanceLoadingBar = new LoadingBarReader(); - } - return instanceLoadingBar; - } - - void LoadingBarReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - LoadingBar* loadingBar = static_cast(widget); - - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "textureData"); - int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType"); - switch (imageFileNameType) - { - case 0: - { - std::string tp_i = jsonPath; - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - const char* imageFileName_tp = nullptr; - if (imageFileName && (strcmp(imageFileName, "") != 0)) - { - imageFileName_tp = tp_i.append(imageFileName).c_str(); - loadingBar->loadTexture(imageFileName_tp); - } - break; - } - case 1: - { - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - /* gui mark add load bar scale9 parse */ - bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable"); - loadingBar->setScale9Enabled(scale9Enable); - - if (scale9Enable) - { - float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); - float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); - float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); - float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); - - loadingBar->setCapInsets(Rect(cx, cy, cw, ch)); - - float width = DICTOOL->getFloatValue_json(options, "width"); - float height = DICTOOL->getFloatValue_json(options, "height"); - loadingBar->setSize(Size(width, height)); - } - /**/ - - loadingBar->setDirection(LoadingBarType(DICTOOL->getIntValue_json(options, "direction"))); - loadingBar->setPercent(DICTOOL->getIntValue_json(options, "percent")); - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.h b/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.h deleted file mode 100644 index 69d12e3f33..0000000000 --- a/cocos/ui/WidgetReader/LoadingBarReader/LoadingBarReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__LoadingBarReader__ -#define __TestCpp__LoadingBarReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class LoadingBarReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - LoadingBarReader(); - virtual ~LoadingBarReader(); - - static LoadingBarReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__LoadingBarReader__) */ diff --git a/cocos/ui/WidgetReader/PageViewReader/PageViewReader.cpp b/cocos/ui/WidgetReader/PageViewReader/PageViewReader.cpp deleted file mode 100644 index c5692277e2..0000000000 --- a/cocos/ui/WidgetReader/PageViewReader/PageViewReader.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#include "PageViewReader.h" -#include "ui/UIPageView.h" - -namespace cocostudio -{ - static PageViewReader* instancePageViewReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader) - - PageViewReader::PageViewReader() - { - - } - - PageViewReader::~PageViewReader() - { - - } - - PageViewReader* PageViewReader::getInstance() - { - if (!instancePageViewReader) - { - instancePageViewReader = new PageViewReader(); - } - return instancePageViewReader; - } - - void PageViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options) - { - LayoutReader::setPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/PageViewReader/PageViewReader.h b/cocos/ui/WidgetReader/PageViewReader/PageViewReader.h deleted file mode 100644 index 07b7719565..0000000000 --- a/cocos/ui/WidgetReader/PageViewReader/PageViewReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__PageViewReader__ -#define __TestCpp__PageViewReader__ - -#include "../LayoutReader/LayoutReader.h" - -namespace cocostudio -{ - class PageViewReader : public LayoutReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - PageViewReader(); - virtual ~PageViewReader(); - - static PageViewReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(ui::Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__PageViewReader__) */ diff --git a/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.cpp b/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.cpp deleted file mode 100644 index a09480d8e1..0000000000 --- a/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#include "ScrollViewReader.h" -#include "ui/UIScrollView.h" - -namespace cocostudio -{ - static ScrollViewReader* instanceScrollViewReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader) - - ScrollViewReader::ScrollViewReader() - { - - } - - ScrollViewReader::~ScrollViewReader() - { - - } - - ScrollViewReader* ScrollViewReader::getInstance() - { - if (!instanceScrollViewReader) - { - instanceScrollViewReader = new ScrollViewReader(); - } - return instanceScrollViewReader; - } - - void ScrollViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - LayoutReader::setPropsFromJsonDictionary(widget, options); - - - ScrollView* scrollView = static_cast(widget); - float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth"); - float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight"); - scrollView->setInnerContainerSize(Size(innerWidth, innerHeight)); - int direction = DICTOOL->getFloatValue_json(options, "direction"); - scrollView->setDirection((SCROLLVIEW_DIR)direction); - scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, "bounceEnable")); - - - LayoutReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.h b/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.h deleted file mode 100644 index 429a2ad9fe..0000000000 --- a/cocos/ui/WidgetReader/ScrollViewReader/ScrollViewReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__ScrollViewReader__ -#define __TestCpp__ScrollViewReader__ - -#include "../LayoutReader/LayoutReader.h" - -namespace cocostudio -{ - class ScrollViewReader : public LayoutReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - ScrollViewReader(); - virtual ~ScrollViewReader(); - - static ScrollViewReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__ScrollViewReader__) */ diff --git a/cocos/ui/WidgetReader/SliderReader/SliderReader.cpp b/cocos/ui/WidgetReader/SliderReader/SliderReader.cpp deleted file mode 100644 index 9e290d28e3..0000000000 --- a/cocos/ui/WidgetReader/SliderReader/SliderReader.cpp +++ /dev/null @@ -1,192 +0,0 @@ - - -#include "SliderReader.h" -#include "ui/UISlider.h" - -namespace cocostudio -{ - static SliderReader* instanceSliderReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader) - - SliderReader::SliderReader() - { - - } - - SliderReader::~SliderReader() - { - - } - - SliderReader* SliderReader::getInstance() - { - if (!instanceSliderReader) - { - instanceSliderReader = new SliderReader(); - } - return instanceSliderReader; - } - - void SliderReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - Slider* slider = static_cast(widget); - - bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "barTextureScale9Enable"); - slider->setScale9Enabled(barTextureScale9Enable); - bool bt = DICTOOL->checkObjectExist_json(options, "barFileName"); - float barLength = DICTOOL->getFloatValue_json(options, "length"); - if (bt) - { - if (barTextureScale9Enable) - { - - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData"); - int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType"); - switch (imageFileType) - { - case 0: - { - std::string tp_b = jsonPath; - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr; - slider->loadBarTexture(imageFileName_tp); - break; - } - case 1: - { - const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - slider->setSize(Size(barLength, slider->getContentSize().height)); - } - else - { - const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData"); - int imageFileType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType"); - switch (imageFileType) - { - case 0: - { - std::string tp_b = jsonPath; - const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr; - slider->loadBarTexture(imageFileName_tp); - break; - } - case 1: - { - const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path"); - slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - } - } - - const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "ballNormalData"); - int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType"); - switch (normalType) - { - case 0: - { - std::string tp_n = jsonPath; - const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path"); - const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr; - slider->loadSlidBallTextureNormal(normalFileName_tp); - break; - } - case 1: - { - const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path"); - slider->loadSlidBallTextureNormal(normalFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "ballPressedData"); - int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType"); - switch (pressedType) - { - case 0: - { - std::string tp_p = jsonPath; - const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path"); - const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr; - slider->loadSlidBallTexturePressed(pressedFileName_tp); - break; - } - case 1: - { - const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path"); - slider->loadSlidBallTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "ballDisabledData"); - int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType"); - switch (disabledType) - { - case 0: - { - std::string tp_d = jsonPath; - const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path"); - const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr; - slider->loadSlidBallTextureDisabled(disabledFileName_tp); - break; - } - case 1: - { - const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path"); - slider->loadSlidBallTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - slider->setPercent(DICTOOL->getIntValue_json(options, "percent")); - - const rapidjson::Value& progressBarDic = DICTOOL->getSubDictionary_json(options, "progressBarData"); - int progressBarType = DICTOOL->getIntValue_json(progressBarDic, "resourceType"); - switch (progressBarType) - { - case 0: - { - std::string tp_b = jsonPath; - const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path"); - const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr; - slider->loadProgressBarTexture(imageFileName_tp); - break; - } - case 1: - { - const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path"); - slider->loadProgressBarTexture(imageFileName,UI_TEX_TYPE_PLIST); - break; - } - default: - break; - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/SliderReader/SliderReader.h b/cocos/ui/WidgetReader/SliderReader/SliderReader.h deleted file mode 100644 index 1fa0390c07..0000000000 --- a/cocos/ui/WidgetReader/SliderReader/SliderReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__SliderReader__ -#define __TestCpp__SliderReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class SliderReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - SliderReader(); - virtual ~SliderReader(); - - static SliderReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__SliderReader__) */ diff --git a/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.cpp deleted file mode 100644 index 9fd20de2f2..0000000000 --- a/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -#include "TextAtlasReader.h" -#include "ui/UITextAtlas.h" - -namespace cocostudio -{ - static TextAtlasReader* instanceTextAtalsReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader) - - TextAtlasReader::TextAtlasReader() - { - - } - - TextAtlasReader::~TextAtlasReader() - { - - } - - TextAtlasReader* TextAtlasReader::getInstance() - { - if (!instanceTextAtalsReader) - { - instanceTextAtalsReader = new TextAtlasReader(); - } - return instanceTextAtalsReader; - } - - void TextAtlasReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - TextAtlas* labelAtlas = static_cast(widget); - bool sv = DICTOOL->checkObjectExist_json(options, "stringValue"); - bool cmf = DICTOOL->checkObjectExist_json(options, "charMapFile"); - bool iw = DICTOOL->checkObjectExist_json(options, "itemWidth"); - bool ih = DICTOOL->checkObjectExist_json(options, "itemHeight"); - bool scm = DICTOOL->checkObjectExist_json(options, "startCharMap"); - if (sv && cmf && iw && ih && scm) - { - const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "charMapFileData"); - int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType"); - switch (cmfType) - { - case 0: - { - std::string tp_c = jsonPath; - const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path"); - const char* cmf_tp = tp_c.append(cmfPath).c_str(); - labelAtlas->setProperty(DICTOOL->getStringValue_json(options, "stringValue"),cmf_tp,DICTOOL->getIntValue_json(options, "itemWidth"),DICTOOL->getIntValue_json(options,"itemHeight"), DICTOOL->getStringValue_json(options, "startCharMap")); - break; - } - case 1: - CCLOG("Wrong res type of LabelAtlas!"); - break; - default: - break; - } - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.h b/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.h deleted file mode 100644 index a065162769..0000000000 --- a/cocos/ui/WidgetReader/TextAtlasReader/TextAtlasReader.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__TextAtlasReader__ -#define __TestCpp__TextAtlasReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class TextAtlasReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - TextAtlasReader(); - virtual ~TextAtlasReader(); - - static TextAtlasReader* getInstance(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__TextAtlasReader__) */ diff --git a/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.cpp deleted file mode 100644 index daec7016a0..0000000000 --- a/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -#include "TextBMFontReader.h" -#include "ui/UITextBMFont.h" - -namespace cocostudio -{ - static TextBMFontReader* instanceTextBMFontReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader) - - TextBMFontReader::TextBMFontReader() - { - - } - - TextBMFontReader::~TextBMFontReader() - { - - } - - TextBMFontReader* TextBMFontReader::getInstance() - { - if (!instanceTextBMFontReader) - { - instanceTextBMFontReader = new TextBMFontReader(); - } - return instanceTextBMFontReader; - } - - void TextBMFontReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - TextBMFont* labelBMFont = static_cast(widget); - - const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "fileNameData"); - int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType"); - switch (cmfType) - { - case 0: - { - std::string tp_c = jsonPath; - const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path"); - const char* cmf_tp = tp_c.append(cmfPath).c_str(); - labelBMFont->setFntFile(cmf_tp); - break; - } - case 1: - CCLOG("Wrong res type of LabelAtlas!"); - break; - default: - break; - } - - const char* text = DICTOOL->getStringValue_json(options, "text"); - labelBMFont->setText(text); - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.h b/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.h deleted file mode 100644 index bfba2f3cfc..0000000000 --- a/cocos/ui/WidgetReader/TextBMFontReader/TextBMFontReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__TextBMFontReader__ -#define __TestCpp__TextBMFontReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class TextBMFontReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - TextBMFontReader(); - virtual ~TextBMFontReader(); - - static TextBMFontReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__TextBMFontReader__) */ diff --git a/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.cpp deleted file mode 100644 index 0066e796fc..0000000000 --- a/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ /dev/null @@ -1,84 +0,0 @@ - - -#include "TextFieldReader.h" -#include "ui/UITextField.h" - -namespace cocostudio -{ - static TextFieldReader* instanceTextFieldReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(TextFieldReader) - - TextFieldReader::TextFieldReader() - { - - } - - TextFieldReader::~TextFieldReader() - { - - } - - TextFieldReader* TextFieldReader::getInstance() - { - if (!instanceTextFieldReader) - { - instanceTextFieldReader = new TextFieldReader(); - } - return instanceTextFieldReader; - } - - void TextFieldReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - TextField* textField = static_cast(widget); - bool ph = DICTOOL->checkObjectExist_json(options, "placeHolder"); - if (ph) - { - textField->setPlaceHolder(DICTOOL->getStringValue_json(options, "placeHolder")); - } - textField->setText(DICTOOL->getStringValue_json(options, "text")); - bool fs = DICTOOL->checkObjectExist_json(options, "fontSize"); - if (fs) - { - textField->setFontSize(DICTOOL->getIntValue_json(options, "fontSize")); - } - bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); - if (fn) - { - textField->setFontName(DICTOOL->getStringValue_json(options, "fontName")); - } - bool tsw = DICTOOL->checkObjectExist_json(options, "touchSizeWidth"); - bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight"); - if (tsw && tsh) - { - textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight"))); - } - - float dw = DICTOOL->getFloatValue_json(options, "width"); - float dh = DICTOOL->getFloatValue_json(options, "height"); - if (dw > 0.0f || dh > 0.0f) - { - //textField->setSize(Size(dw, dh)); - } - bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, "maxLengthEnable"); - textField->setMaxLengthEnabled(maxLengthEnable); - - if (maxLengthEnable) - { - int maxLength = DICTOOL->getIntValue_json(options, "maxLength"); - textField->setMaxLength(maxLength); - } - bool passwordEnable = DICTOOL->getBooleanValue_json(options, "passwordEnable"); - textField->setPasswordEnabled(passwordEnable); - if (passwordEnable) - { - textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, "passwordStyleText")); - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.h b/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.h deleted file mode 100644 index 30d467787a..0000000000 --- a/cocos/ui/WidgetReader/TextFieldReader/TextFieldReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__TextFieldReader__ -#define __TestCpp__TextFieldReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class TextFieldReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - TextFieldReader(); - virtual ~TextFieldReader(); - - static TextFieldReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__TextFieldReader__) */ diff --git a/cocos/ui/WidgetReader/TextReader/TextReader.cpp b/cocos/ui/WidgetReader/TextReader/TextReader.cpp deleted file mode 100644 index 5910122767..0000000000 --- a/cocos/ui/WidgetReader/TextReader/TextReader.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -#include "TextReader.h" -#include "ui/UIText.h" - -namespace cocostudio -{ - static TextReader* instanceTextReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader) - - TextReader::TextReader() - { - - } - - TextReader::~TextReader() - { - - } - - TextReader* TextReader::getInstance() - { - if (!instanceTextReader) - { - instanceTextReader = new TextReader(); - } - return instanceTextReader; - } - - void TextReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) - { - WidgetReader::setPropsFromJsonDictionary(widget, options); - - - std::string jsonPath = GUIReader::getInstance()->getFilePath(); - - Text* label = static_cast(widget); - bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, "touchScaleEnable"); - label->setTouchScaleChangeEnabled(touchScaleChangeAble); - const char* text = DICTOOL->getStringValue_json(options, "text"); - label->setText(text); - bool fs = DICTOOL->checkObjectExist_json(options, "fontSize"); - if (fs) - { - label->setFontSize(DICTOOL->getIntValue_json(options, "fontSize")); - } - bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); - if (fn) - { - label->setFontName(DICTOOL->getStringValue_json(options, "fontName")); - } - bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth"); - bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight"); - if (aw && ah) - { - Size size = Size(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight")); - label->setTextAreaSize(size); - } - bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment"); - if (ha) - { - label->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, "hAlignment")); - } - bool va = DICTOOL->checkObjectExist_json(options, "vAlignment"); - if (va) - { - label->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, "vAlignment")); - } - - - WidgetReader::setColorPropsFromJsonDictionary(widget, options); - } -} diff --git a/cocos/ui/WidgetReader/TextReader/TextReader.h b/cocos/ui/WidgetReader/TextReader/TextReader.h deleted file mode 100644 index 18d15e6323..0000000000 --- a/cocos/ui/WidgetReader/TextReader/TextReader.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__TextReader__ -#define __TestCpp__TextReader__ - -#include "../WidgetReader.h" - -namespace cocostudio -{ - class TextReader : public WidgetReader - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - TextReader(); - virtual ~TextReader(); - - static TextReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__TextReader__) */ diff --git a/cocos/ui/WidgetReader/WidgetReader.cpp b/cocos/ui/WidgetReader/WidgetReader.cpp deleted file mode 100644 index 29570ecff3..0000000000 --- a/cocos/ui/WidgetReader/WidgetReader.cpp +++ /dev/null @@ -1,173 +0,0 @@ - - -#include "WidgetReader.h" - -namespace cocostudio -{ - using namespace cocos2d::ui; - static WidgetReader* instanceWidgetReader = NULL; - - IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader) - - WidgetReader::WidgetReader() - { - - } - - WidgetReader::~WidgetReader() - { - - } - - WidgetReader* WidgetReader::getInstance() - { - if (!instanceWidgetReader) - { - instanceWidgetReader = new WidgetReader(); - } - return instanceWidgetReader; - } - - void WidgetReader::purge() - { - CC_SAFE_DELETE(instanceWidgetReader); - } - - void WidgetReader::setPropsFromJsonDictionary(cocos2d::ui::Widget *widget, const rapidjson::Value &options) - { - bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, "ignoreSize"); - if (ignoreSizeExsit) - { - widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, "ignoreSize")); - } - - widget->setSizeType((SizeType)DICTOOL->getIntValue_json(options, "sizeType")); - widget->setPositionType((PositionType)DICTOOL->getIntValue_json(options, "positionType")); - - widget->setSizePercent(Point(DICTOOL->getFloatValue_json(options, "sizePercentX"), DICTOOL->getFloatValue_json(options, "sizePercentY"))); - widget->setPositionPercent(Point(DICTOOL->getFloatValue_json(options, "positionPercentX"), DICTOOL->getFloatValue_json(options, "positionPercentY"))); - - /* adapt screen */ - float w = 0, h = 0; - bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen"); - if (adaptScrenn) - { - Size screenSize = CCDirector::getInstance()->getWinSize(); - w = screenSize.width; - h = screenSize.height; - } - else - { - w = DICTOOL->getFloatValue_json(options, "width"); - h = DICTOOL->getFloatValue_json(options, "height"); - } - widget->setSize(Size(w, h)); - // before - /* - float w = DICTOOL->getFloatValue_json(options, "width"); - float h = DICTOOL->getFloatValue_json(options, "height"); - widget->setSize(CCSizeMake(w, h)); - */ - /**/ - - widget->setTag(DICTOOL->getIntValue_json(options, "tag")); - widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag")); - widget->setTouchEnabled(DICTOOL->getBooleanValue_json(options, "touchAble")); - const char* name = DICTOOL->getStringValue_json(options, "name"); - const char* widgetName = name?name:"default"; - widget->setName(widgetName); - float x = DICTOOL->getFloatValue_json(options, "x"); - float y = DICTOOL->getFloatValue_json(options, "y"); - widget->setPosition(Point(x,y)); - bool sx = DICTOOL->checkObjectExist_json(options, "scaleX"); - if (sx) - { - widget->setScaleX(DICTOOL->getFloatValue_json(options, "scaleX")); - } - bool sy = DICTOOL->checkObjectExist_json(options, "scaleY"); - if (sy) - { - widget->setScaleY(DICTOOL->getFloatValue_json(options, "scaleY")); - } - bool rt = DICTOOL->checkObjectExist_json(options, "rotation"); - if (rt) - { - widget->setRotation(DICTOOL->getFloatValue_json(options, "rotation")); - } - bool vb = DICTOOL->checkObjectExist_json(options, "visible"); - if (vb) - { - widget->setVisible(DICTOOL->getBooleanValue_json(options, "visible")); - } - int z = DICTOOL->getIntValue_json(options, "ZOrder"); - widget->setLocalZOrder(z); - - bool layout = DICTOOL->checkObjectExist_json(options, "layoutParameter"); - if (layout) - { - const rapidjson::Value& layoutParameterDic = DICTOOL->getSubDictionary_json(options, "layoutParameter"); - int paramType = DICTOOL->getIntValue_json(layoutParameterDic, "type"); - LayoutParameter* parameter = nullptr; - switch (paramType) - { - case 0: - break; - case 1: - { - parameter = LinearLayoutParameter::create(); - int gravity = DICTOOL->getIntValue_json(layoutParameterDic, "gravity"); - ((LinearLayoutParameter*)parameter)->setGravity((LinearGravity)gravity); - break; - } - case 2: - { - parameter = RelativeLayoutParameter::create(); - RelativeLayoutParameter* rParameter = (RelativeLayoutParameter*)parameter; - const char* relativeName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeName"); - rParameter->setRelativeName(relativeName); - const char* relativeToName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeToName"); - rParameter->setRelativeToWidgetName(relativeToName); - int align = DICTOOL->getIntValue_json(layoutParameterDic, "align"); - rParameter->setAlign((RelativeAlign)align); - break; - } - default: - break; - } - if (parameter) - { - float mgl = DICTOOL->getFloatValue_json(layoutParameterDic, "marginLeft"); - float mgt = DICTOOL->getFloatValue_json(layoutParameterDic, "marginTop"); - float mgr = DICTOOL->getFloatValue_json(layoutParameterDic, "marginRight"); - float mgb = DICTOOL->getFloatValue_json(layoutParameterDic, "marginDown"); - parameter->setMargin(Margin(mgl, mgt, mgr, mgb)); - widget->setLayoutParameter(parameter); - } - } - } - - void WidgetReader::setColorPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options) - { - bool op = DICTOOL->checkObjectExist_json(options, "opacity"); - if (op) - { - widget->setOpacity(DICTOOL->getIntValue_json(options, "opacity")); - } - bool cr = DICTOOL->checkObjectExist_json(options, "colorR"); - bool cg = DICTOOL->checkObjectExist_json(options, "colorG"); - bool cb = DICTOOL->checkObjectExist_json(options, "colorB"); - int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255; - int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255; - int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255; - widget->setColor(Color3B(colorR, colorG, colorB)); - bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX"); - float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f); - bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY"); - float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f); - widget->setAnchorPoint(Point(apxf, apyf)); - bool flipX = DICTOOL->getBooleanValue_json(options, "flipX"); - bool flipY = DICTOOL->getBooleanValue_json(options, "flipY"); - widget->setFlipX(flipX); - widget->setFlipY(flipY); - } -} diff --git a/cocos/ui/WidgetReader/WidgetReader.h b/cocos/ui/WidgetReader/WidgetReader.h deleted file mode 100644 index 7e10cfd8ef..0000000000 --- a/cocos/ui/WidgetReader/WidgetReader.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__WidgetReader__ -#define __TestCpp__WidgetReader__ - -#include "WidgetReaderProtocol.h" -#include "CCSGUIReader.h" -#include "ui/GUIDefine.h" -#include "ui/UIWidget.h" - -namespace cocostudio -{ - class WidgetReader : public Object, public WidgetReaderProtocol - { - public: - DECLARE_CLASS_WIDGET_READER_INFO - - WidgetReader(); - virtual ~WidgetReader(); - - static WidgetReader* getInstance(); - static void purge(); - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - virtual void setColorPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options); - }; -} - -#endif /* defined(__TestCpp__WidgetReader__) */ diff --git a/cocos/ui/WidgetReader/WidgetReaderProtocol.h b/cocos/ui/WidgetReader/WidgetReaderProtocol.h deleted file mode 100644 index 574262743a..0000000000 --- a/cocos/ui/WidgetReader/WidgetReaderProtocol.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ - -#ifndef __TestCpp__WidgetReaderProtocol__ -#define __TestCpp__WidgetReaderProtocol__ - -#include "cocos2d.h" -#include "cocostudio/DictionaryHelper.h" - -namespace cocos2d -{ - namespace ui - { - class Widget; - } -} - -USING_NS_CC; -using namespace cocos2d::ui; - -namespace cocostudio -{ - class WidgetReaderProtocol - { - public: - virtual ~WidgetReaderProtocol() {}; - - virtual void setPropsFromJsonDictionary(Widget* widget, const rapidjson::Value& options) = 0; - }; -} - -#endif /* defined(__TestCpp__WidgetReaderProtocol__) */ diff --git a/tests/cpp-tests/Resources/hd/cocosgui/Hello.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/Hello.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/Hello.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/Hello.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIButton_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIButton_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIButton_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIButton_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UICheckBox_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UICheckBox_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UICheckBox_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UICheckBox_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIImageView_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIImageView_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIImageView_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIImageView_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelAtlas_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelAtlas_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelAtlas_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelAtlas_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelBMFont_Editor/GUI/missing-font.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelBMFont_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelBMFont_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabelBMFont_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabelBMFont_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabel_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabel_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILabel_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILabel_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/Hello.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/Hello.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/Hello.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/Hello.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_BackgroundImage_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Color_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Gradient_Color_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Horizontal_Layout_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Linear_Vertical_Layout_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Location_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Relative_Align_Parent_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILayout_Editor/UILayout_Scale9_BackgroundImage_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIListView_Editor/UIListView_Horizontal_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIListView_Editor/UIListView_Vertical_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILoadingBar_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILoadingBar_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UILoadingBar_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UILoadingBar_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIPageView_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIPageView_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIPageView_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIPageView_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Both_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Horizontal_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIScrollView_Editor/UIScrollView_Vertical_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UISlider_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UISlider_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UISlider_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UISlider_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UITextField_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UITextField_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UITextField_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UITextField_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIWidgetAddNode_Editor/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIWidgetAddNode_Editor/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UIEditorTest/UIWidgetAddNode_Editor/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UIEditorTest/UIWidgetAddNode_Editor/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/UITest/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/UITest/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/UITest/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/UITest/background.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/b11.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/b11.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/b11.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/b11.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/bitmapFontTest2.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/bitmapFontTest2.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/bitmapFontTest2.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/bitmapFontTest2.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/examples/examples.json.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/examples/examples.json.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/examples/examples.json.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/examples/examples.json.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/gui_examples/map_1/map_pve.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/gui_examples/map_1/map_pve.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/gui_examples/map_1/map_pve.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/gui_examples/map_1/map_pve.png.REMOVED.git-id diff --git a/tests/cpp-tests/Resources/hd/cocosgui/gui_examples/page_1/background.png.REMOVED.git-id b/tests/cpp-tests/Resources/hd/cocosui/gui_examples/page_1/background.png.REMOVED.git-id similarity index 100% rename from tests/cpp-tests/Resources/hd/cocosgui/gui_examples/page_1/background.png.REMOVED.git-id rename to tests/cpp-tests/Resources/hd/cocosui/gui_examples/page_1/background.png.REMOVED.git-id From a567d467b3e89d461c3c233dd55f4c1ef5a07594 Mon Sep 17 00:00:00 2001 From: dingpinglv Date: Thu, 13 Mar 2014 10:14:24 +0800 Subject: [PATCH 2/9] Issue #4277: fixed a bug of ControlButton that it will crash when it deletes itself in its callback. --- extensions/GUI/CCControlExtension/CCControl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index 04cd0219d0..94bbec65ab 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -102,6 +102,7 @@ Control::~Control() void Control::sendActionsForControlEvents(EventType controlEvents) { + retain(); // For each control events for (int i = 0; i < kControlEventTotalNumber; i++) { @@ -126,6 +127,7 @@ void Control::sendActionsForControlEvents(EventType controlEvents) #endif } } + release(); } void Control::addTargetWithActionForControlEvents(Ref* target, Handler action, EventType controlEvents) { From c26b103b2351a0dceb2998be11d242b350ee9eb0 Mon Sep 17 00:00:00 2001 From: heliclei Date: Thu, 13 Mar 2014 10:45:02 +0800 Subject: [PATCH 3/9] remove node name related features from v3.0 --- cocos/2d/CCNode.cpp | 49 --------------- cocos/2d/CCNode.h | 51 +--------------- tests/cpp-tests/Classes/NodeTest/NodeTest.cpp | 59 ------------------- tests/cpp-tests/Classes/NodeTest/NodeTest.h | 8 --- 4 files changed, 1 insertion(+), 166 deletions(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index b2a7856289..9125d50393 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -598,17 +598,6 @@ void Node::setTag(int var) _tag = var; } -//name getter -std::string& Node::getName() -{ - return _name; -} - -//name setter -void Node::setName(const std::string& name) -{ - _name = name; -} /// userData setter void Node::setUserData(void *var) { @@ -713,44 +702,6 @@ Node* Node::getChildByTag(int tag) return nullptr; } -Node* Node::getChildByName(const std::string& name) -{ - for (auto& child : _children) - { - - if(child->_name == name) - { - return child; - } - - auto found = child->getChildByName(name); - if(found != nullptr) - { - return found; - } - } - return nullptr; -} - -void Node::enumerateChildrenByName(const std::string& name, const std::function& callback) -{ - for (auto& child : _children) - { - - if(child->_name == name) - { - bool stop = false; - callback(child, &stop); - if(stop == true) - { - return; - } - } - child->enumerateChildrenByName(name, callback); - } - return; -} - /* "add" logic MUST only be on this method * If a class want's to extend the 'addChild' behavior it only needs * to override this method diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 0ae342f34d..a6ea4ed04d 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -645,15 +645,6 @@ public: * @return a Node object whose tag equals to the input parameter */ virtual Node * getChildByTag(int tag); - - /** - * get a child node with its name, will recursively search the whole node tree - * - * @param name A string identifier to find the child node. - * - * @return the first Node object whose name equals to the input parameter - */ - virtual Node* getChildByName(const std::string& name); /** * Returns the array of the node's children * @@ -768,47 +759,7 @@ public: */ virtual void setTag(int tag); - /// @{ - /// @name name - - /** - * Returns a name that is used to identify the node easily. - * - * You can set name to node then identify them easily. - @code - - // set name - node1->setName("player"); - node2->setName("monster"); - node3->setName("boss"); - parent->addChild(node1); - parent->addChild(node2); - parent->addChild(node3); - // identify by name - Node* player = nullptr; - player = parent->getChildByName("player") - @endcode - * - * @return A string that identifies the node. - */ - virtual std::string& getName(); - /** - * Changes the name that is used to identify the node easily. - * - * Please refer to getName for the sample code. - * - * @param name A string that indentifies the node. - */ - virtual void setName(const std::string& name); - /** - * Search the children to perform processing for nodes which share a name. - * Note: this function will search the whole node tree recursively. - * @param name the name to search for - * @param callback, A callback to execute on nodes that match the name parameter. The callback takes the following arguments: - * node: A node that matches the name. - * stop: A pointer to a Boolean variable. Your callback can set this to true to terminate the enumeration. - */ - virtual void enumerateChildrenByName(const std::string& name, const std::function& callback); + /** * Returns a custom user data pointer * diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 0038b3db43..b3b58bac47 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -57,7 +57,6 @@ static std::function createFunctions[] = CL(Test4), CL(Test5), CL(Test6), - CL(NodeEnumChildByNameTest), CL(StressTest1), CL(StressTest2), CL(NodeToWorld), @@ -353,64 +352,6 @@ std::string Test6::subtitle() const return "remove/cleanup with children"; } -//------------------------------------------------------------------ -// -// NodeEnumChildByNameTest -// -//------------------------------------------------------------------ -void NodeEnumChildByNameTest::onEnter() -{ - TestCocosNodeDemo::onEnter(); - auto sp10 = Sprite::create(s_pathSister1); - auto sp11 = Sprite::create(s_pathSister1); - auto sp12 = Sprite::create(s_pathSister1); - auto sp20 = Sprite::create(s_pathSister2); - auto sp21 = Sprite::create(s_pathSister2); - auto sp22 = Sprite::create(s_pathSister2); - - sp10->setPosition(Point(100,60)); - sp11->setPosition(Point(100,160)); - sp12->setPosition(Point(100,260)); - sp20->setPosition(Point(380,60)); - sp21->setPosition(Point(380,160)); - sp22->setPosition(Point(380,260)); - - sp10->setName("sister1"); - sp11->setName("sister1"); - sp12->setName("sister1"); - sp20->setName("sister2"); - sp21->setName("sister2"); - sp22->setName("sister2"); - - addChild(sp10); - addChild(sp11); - addChild(sp12); - addChild(sp20); - addChild(sp21); - addChild(sp22); - - enumerateChildrenByName("sister1", - [](Node* node, bool* stop) - { - auto rot = RotateBy::create(2, 360); - auto rot_back = rot->reverse(); - auto forever1 = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); - node->runAction(forever1); - }); - enumerateChildrenByName("sister2", - [](Node* node, bool* stop) - { - auto actionUp = JumpBy::create(2, Point(0,0), 80, 4); - auto forever2 = RepeatForever::create(Sequence::create(actionUp, NULL)); - node->runAction(forever2); - }); -} - - -std::string NodeEnumChildByNameTest::subtitle() const -{ - return "Enum child nodes by name"; -} //------------------------------------------------------------------ // diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.h b/tests/cpp-tests/Classes/NodeTest/NodeTest.h index 9506fd6181..5938eb9a4f 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.h +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.h @@ -263,14 +263,6 @@ protected: Sprite *_sprite; }; -class NodeEnumChildByNameTest : public TestCocosNodeDemo -{ -public: - CREATE_FUNC(NodeEnumChildByNameTest); - virtual void onEnter() override; - virtual std::string subtitle() const override; -}; - class CocosNodeTestScene : public TestScene { public: From 2da4b7f37512bdc3729d5aa04d7fcf42385ea249 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 13 Mar 2014 10:52:47 +0800 Subject: [PATCH 4/9] 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 e071d04655..bc32718262 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -2ba216b4ae56fa741405d81c01614f325fc19874 \ No newline at end of file +89b662adad809bb82801b21aef538a38f04e4bd7 \ No newline at end of file From 5f376e0b5bcb8a66e20b17f41f54846dc092575c Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 13 Mar 2014 11:10:53 +0800 Subject: [PATCH 5/9] 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 bc32718262..b224457f2d 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -89b662adad809bb82801b21aef538a38f04e4bd7 \ No newline at end of file +b8bc5839895bfc413816baa425d43a2b8e48205d \ No newline at end of file From 2c59743abfa6daa87ee7d19e4b73601404dbae65 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 03:35:40 +0000 Subject: [PATCH 6/9] [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 4dbbf4bbd5..dc63ffbac6 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -9f3063090daa92453372f232d777b4b625e31f98 \ No newline at end of file +879acef60464ae6a0af99e8e5d809245f8cdbe56 \ No newline at end of file From e3c6497c2b0acad4596f8a2aa3d2ab1f106d99e3 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 03:37:37 +0000 Subject: [PATCH 7/9] [AUTO]: updating luabinding automatically --- cocos/scripting/lua-bindings/auto/api/Widget.lua | 14 ++++++++++++-- .../auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_ui_auto.hpp | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index 91edad6820..a0341bff7d 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -47,6 +47,11 @@ -- @param self -- @return array_table#array_table ret (return value: array_table) +-------------------------------- +-- @function [parent=#Widget] getLayoutSize +-- @param self +-- @return size_table#size_table ret (return value: size_table) + -------------------------------- -- @function [parent=#Widget] setPositionType -- @param self @@ -63,9 +68,14 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Widget] updateSizeAndPosition +-- overload function: updateSizeAndPosition(size_table) +-- +-- overload function: updateSizeAndPosition() +-- +-- @function [parent=#Widget] updateSizeAndPosition -- @param self - +-- @param #size_table size + -------------------------------- -- @function [parent=#Widget] getBottomInParent -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id index 8db5a53eed..46b602ad1b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -c9cf8f3050b95aec88a2452e60fe492252ad30c3 \ No newline at end of file +d0b810bd90f5639ba15e03fc5e083b762225a16d \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 472d1be093..220c5d3f00 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -346,6 +346,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + #endif // __cocos2dx_ui_h__ From 6d8bc4e61668b95b7c1c642bf31b842532ed2032 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 03:45:57 +0000 Subject: [PATCH 8/9] [AUTO]: updating luabinding automatically --- .../scripting/lua-bindings/auto/api/Node.lua | 52 ++++++------------- .../lua-bindings/auto/api/Widget.lua | 14 ++++- .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 -- .../lua_cocos2dx_ui_auto.cpp.REMOVED.git-id | 2 +- .../auto/lua_cocos2dx_ui_auto.hpp | 1 + 6 files changed, 30 insertions(+), 45 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index fab16bbe5d..d68c53dff9 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -78,12 +78,6 @@ -- @param self -- @return bool#bool ret (return value: bool) --------------------------------- --- @function [parent=#Node] getChildByName --- @param self --- @param #string str --- @return Node#Node ret (return value: cc.Node) - -------------------------------- -- @function [parent=#Node] updateDisplayedOpacity -- @param self @@ -100,10 +94,9 @@ -- @param #float float -------------------------------- --- @function [parent=#Node] enumerateChildrenByName +-- @function [parent=#Node] setScaleY -- @param self --- @param #string str --- @param #function func +-- @param #float float -------------------------------- -- @function [parent=#Node] setScaleX @@ -211,11 +204,6 @@ -- @param self -- @param #cc.Node node --------------------------------- --- @function [parent=#Node] getName --- @param self --- @return string#string ret (return value: string) - -------------------------------- -- @function [parent=#Node] getRotation3D -- @param self @@ -330,11 +318,16 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Node] runAction +-- overload function: visit() +-- +-- overload function: visit(cc.Renderer, kmMat4, bool) +-- +-- @function [parent=#Node] visit -- @param self --- @param #cc.Action action --- @return Action#Action ret (return value: cc.Action) - +-- @param #cc.Renderer renderer +-- @param #kmMat4 kmmat4 +-- @param #bool bool + -------------------------------- -- @function [parent=#Node] setShaderProgram -- @param self @@ -351,16 +344,11 @@ -- @return point_table#point_table ret (return value: point_table) -------------------------------- --- overload function: visit() --- --- overload function: visit(cc.Renderer, kmMat4, bool) --- --- @function [parent=#Node] visit +-- @function [parent=#Node] runAction -- @param self --- @param #cc.Renderer renderer --- @param #kmMat4 kmmat4 --- @param #bool bool - +-- @param #cc.Action action +-- @return Action#Action ret (return value: cc.Action) + -------------------------------- -- @function [parent=#Node] setScheduler -- @param self @@ -391,11 +379,6 @@ -- @param #int int -- @return Action#Action ret (return value: cc.Action) --------------------------------- --- @function [parent=#Node] setName --- @param self --- @param #string str - -------------------------------- -- overload function: setAdditionalTransform(cc.AffineTransform) -- @@ -504,11 +487,6 @@ -- @param self -- @param #float float --------------------------------- --- @function [parent=#Node] setScaleY --- @param self --- @param #float float - -------------------------------- -- overload function: setScale(float, float) -- diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index 91edad6820..a0341bff7d 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -47,6 +47,11 @@ -- @param self -- @return array_table#array_table ret (return value: array_table) +-------------------------------- +-- @function [parent=#Widget] getLayoutSize +-- @param self +-- @return size_table#size_table ret (return value: size_table) + -------------------------------- -- @function [parent=#Widget] setPositionType -- @param self @@ -63,9 +68,14 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Widget] updateSizeAndPosition +-- overload function: updateSizeAndPosition(size_table) +-- +-- overload function: updateSizeAndPosition() +-- +-- @function [parent=#Widget] updateSizeAndPosition -- @param self - +-- @param #size_table size + -------------------------------- -- @function [parent=#Widget] getBottomInParent -- @param self 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 709c9efccc..a499b30375 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 @@ -fa5cf8075e2b31cc61b8c17783dbdc435feae281 \ No newline at end of file +b0dc5acd96b5d7e94c40c01097a6f969719a6110 \ 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 754ee1efa1..3e656d80e9 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1541,10 +1541,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - - - diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id index 8db5a53eed..46b602ad1b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -c9cf8f3050b95aec88a2452e60fe492252ad30c3 \ No newline at end of file +d0b810bd90f5639ba15e03fc5e083b762225a16d \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 472d1be093..220c5d3f00 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -346,6 +346,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + #endif // __cocos2dx_ui_h__ From 107a8791e1b47601ebc455090b968505a3960434 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 04:02:44 +0000 Subject: [PATCH 9/9] [AUTO]: updating luabinding automatically --- .../scripting/lua-bindings/auto/api/Node.lua | 52 ++++++------------- .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 -- 3 files changed, 16 insertions(+), 42 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index fab16bbe5d..d68c53dff9 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -78,12 +78,6 @@ -- @param self -- @return bool#bool ret (return value: bool) --------------------------------- --- @function [parent=#Node] getChildByName --- @param self --- @param #string str --- @return Node#Node ret (return value: cc.Node) - -------------------------------- -- @function [parent=#Node] updateDisplayedOpacity -- @param self @@ -100,10 +94,9 @@ -- @param #float float -------------------------------- --- @function [parent=#Node] enumerateChildrenByName +-- @function [parent=#Node] setScaleY -- @param self --- @param #string str --- @param #function func +-- @param #float float -------------------------------- -- @function [parent=#Node] setScaleX @@ -211,11 +204,6 @@ -- @param self -- @param #cc.Node node --------------------------------- --- @function [parent=#Node] getName --- @param self --- @return string#string ret (return value: string) - -------------------------------- -- @function [parent=#Node] getRotation3D -- @param self @@ -330,11 +318,16 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Node] runAction +-- overload function: visit() +-- +-- overload function: visit(cc.Renderer, kmMat4, bool) +-- +-- @function [parent=#Node] visit -- @param self --- @param #cc.Action action --- @return Action#Action ret (return value: cc.Action) - +-- @param #cc.Renderer renderer +-- @param #kmMat4 kmmat4 +-- @param #bool bool + -------------------------------- -- @function [parent=#Node] setShaderProgram -- @param self @@ -351,16 +344,11 @@ -- @return point_table#point_table ret (return value: point_table) -------------------------------- --- overload function: visit() --- --- overload function: visit(cc.Renderer, kmMat4, bool) --- --- @function [parent=#Node] visit +-- @function [parent=#Node] runAction -- @param self --- @param #cc.Renderer renderer --- @param #kmMat4 kmmat4 --- @param #bool bool - +-- @param #cc.Action action +-- @return Action#Action ret (return value: cc.Action) + -------------------------------- -- @function [parent=#Node] setScheduler -- @param self @@ -391,11 +379,6 @@ -- @param #int int -- @return Action#Action ret (return value: cc.Action) --------------------------------- --- @function [parent=#Node] setName --- @param self --- @param #string str - -------------------------------- -- overload function: setAdditionalTransform(cc.AffineTransform) -- @@ -504,11 +487,6 @@ -- @param self -- @param #float float --------------------------------- --- @function [parent=#Node] setScaleY --- @param self --- @param #float float - -------------------------------- -- overload function: setScale(float, float) -- 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 709c9efccc..a499b30375 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 @@ -fa5cf8075e2b31cc61b8c17783dbdc435feae281 \ No newline at end of file +b0dc5acd96b5d7e94c40c01097a6f969719a6110 \ 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 754ee1efa1..3e656d80e9 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1541,10 +1541,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - - -