From 8161d2ad348041545b68483eb101aacb497b1ad9 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 17 Oct 2014 11:31:00 +0800 Subject: [PATCH 1/9] fix scrollView rotate issue --- build/cocos2d_tests.xcodeproj/project.pbxproj | 52 +++++++++++-------- cocos/ui/UIScrollView.cpp | 4 +- .../UIScrollViewTest/UIScrollViewTest.cpp | 5 +- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 1cdb82ea9f..1dc2263953 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -2621,12 +2621,12 @@ 1D6058910D05DD3D006BFB54 /* cpp-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cpp-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1F33634D18E37E840074764D /* RefPtrTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefPtrTest.cpp; sourceTree = ""; }; 1F33634E18E37E840074764D /* RefPtrTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefPtrTest.h; sourceTree = ""; }; - 29080D1A191B574B0066F8DF /* UITest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UITest.cpp; path = ../UITest.cpp; sourceTree = ""; }; - 29080D1B191B574B0066F8DF /* UITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UITest.h; path = ../UITest.h; sourceTree = ""; }; + 29080D1A191B574B0066F8DF /* UITest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UITest.cpp; path = UITest/UITest.cpp; sourceTree = ""; }; + 29080D1B191B574B0066F8DF /* UITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UITest.h; path = UITest/UITest.h; sourceTree = ""; }; 29080D1F191B595E0066F8DF /* CocosGUIScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocosGUIScene.cpp; sourceTree = ""; }; 29080D20191B595E0066F8DF /* CocosGUIScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosGUIScene.h; sourceTree = ""; }; - 29080D21191B595E0066F8DF /* CocoStudioGUITest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoStudioGUITest.cpp; sourceTree = ""; }; - 29080D22191B595E0066F8DF /* CocoStudioGUITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoStudioGUITest.h; sourceTree = ""; }; + 29080D21191B595E0066F8DF /* CocoStudioGUITest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CocoStudioGUITest.cpp; path = UITest/CocoStudioGUITest/CocoStudioGUITest.cpp; sourceTree = ""; }; + 29080D22191B595E0066F8DF /* CocoStudioGUITest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CocoStudioGUITest.h; path = UITest/CocoStudioGUITest/CocoStudioGUITest.h; sourceTree = ""; }; 29080D23191B595E0066F8DF /* CustomGUIScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CustomGUIScene.cpp; path = ../CustomGUIScene.cpp; sourceTree = ""; }; 29080D24191B595E0066F8DF /* CustomGUIScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomGUIScene.h; path = ../CustomGUIScene.h; sourceTree = ""; }; 29080D27191B595E0066F8DF /* CustomImageTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomImageTest.cpp; sourceTree = ""; }; @@ -6481,14 +6481,6 @@ sourceTree = ""; }; 29080D17191B571F0066F8DF /* UITest */ = { - isa = PBXGroup; - children = ( - 29080D1E191B595E0066F8DF /* CocoStudioGUITest */, - ); - name = UITest; - sourceTree = ""; - }; - 29080D1E191B595E0066F8DF /* CocoStudioGUITest */ = { isa = PBXGroup; children = ( 29080D1A191B574B0066F8DF /* UITest.cpp */, @@ -6499,8 +6491,7 @@ 29FBBBFB196A9ECD00E65826 /* CocostudioParserTest */, 29080D25191B595E0066F8DF /* CustomTest */, ); - name = CocoStudioGUITest; - path = UITest/CocoStudioGUITest; + name = UITest; sourceTree = ""; }; 29080D25191B595E0066F8DF /* CustomTest */ = { @@ -6512,7 +6503,8 @@ 29080D26191B595E0066F8DF /* CustomImageTest */, 29080D29191B595E0066F8DF /* CustomParticleWidgetTest */, ); - path = CustomTest; + name = CustomTest; + path = UITest/CocoStudioGUITest/CustomTest; sourceTree = ""; }; 29080D26191B595E0066F8DF /* CustomImageTest */ = { @@ -6732,6 +6724,24 @@ name = UIWebViewTest; sourceTree = ""; }; + 29AAE28519F0BD02004F5A18 /* UIScale9SpriteTest */ = { + isa = PBXGroup; + children = ( + 295824571987415900F9746D /* UIScale9SpriteTest.cpp */, + 295824581987415900F9746D /* UIScale9SpriteTest.h */, + ); + name = UIScale9SpriteTest; + sourceTree = ""; + }; + 29AAE28619F0BD12004F5A18 /* UIEditBoxTest */ = { + isa = PBXGroup; + children = ( + 292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */, + 292CF01319A1965E00E8E6A0 /* UIEditBoxTest.h */, + ); + name = UIEditBoxTest; + sourceTree = ""; + }; 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( @@ -6806,17 +6816,13 @@ 29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */, 29FBBBFD196A9ECD00E65826 /* CocostudioParserJsonTest.h */, ); - path = CocostudioParserTest; + name = CocostudioParserTest; + path = UITest/CocoStudioGUITest/CocostudioParserTest; sourceTree = ""; }; 29FBBC00196A9F0D00E65826 /* UIAndEditorTests */ = { isa = PBXGroup; children = ( - 298D7F6C19AC31C000FF096D /* UIWebViewTest */, - 295824571987415900F9746D /* UIScale9SpriteTest.cpp */, - 295824581987415900F9746D /* UIScale9SpriteTest.h */, - 292CF01219A1965E00E8E6A0 /* UIEditBoxTest.cpp */, - 292CF01319A1965E00E8E6A0 /* UIEditBoxTest.h */, 29080D1F191B595E0066F8DF /* CocosGUIScene.cpp */, 29080D20191B595E0066F8DF /* CocosGUIScene.h */, 29080D37191B595E0066F8DF /* GUIEditorTest.cpp */, @@ -6829,6 +6835,9 @@ 29080D67191B595E0066F8DF /* UISceneManager.h */, 29080D68191B595E0066F8DF /* UISceneManager_Editor.cpp */, 29080D69191B595E0066F8DF /* UISceneManager_Editor.h */, + 29AAE28619F0BD12004F5A18 /* UIEditBoxTest */, + 29AAE28519F0BD02004F5A18 /* UIScale9SpriteTest */, + 298D7F6C19AC31C000FF096D /* UIWebViewTest */, 29080D6A191B595E0066F8DF /* UIScrollViewTest */, 29080D6F191B595E0066F8DF /* UISliderTest */, 29080D74191B595E0066F8DF /* UITextAtlasTest */, @@ -6848,6 +6857,7 @@ 3EA0FB6F191C844400B170C8 /* UIVideoPlayerTest */, ); name = UIAndEditorTests; + path = UITest/CocoStudioGUITest; sourceTree = ""; }; 38FA2E70194AEBE100FF2BE4 /* CocoStudioActionTimelineTest */ = { diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index f36f76d706..1e8772b91f 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -1470,7 +1470,9 @@ void ScrollView::handlePressLogic(Touch *touch) void ScrollView::handleMoveLogic(Touch *touch) { - Vec2 delta = touch->getLocation() - touch->getPreviousLocation(); + Vec2 touchPositionInNodeSpace = this->convertToNodeSpace(touch->getLocation()); + Vec2 previousTouchPositionInNodeSpace = this->convertToNodeSpace(touch->getPreviousLocation()); + Vec2 delta = touchPositionInNodeSpace - previousTouchPositionInNodeSpace; switch (_direction) { case Direction::VERTICAL: // vertical diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index e73cb4d4e5..89461e1c21 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -39,7 +39,7 @@ bool UIScrollViewTest_Vertical::init() // Create the scrollview by vertical ui::ScrollView* scrollView = ui::ScrollView::create(); - scrollView->setContentSize(Size(280.0f, 150.0f)); + scrollView->setContentSize(Size(280.0f, 100.0f)); Size backgroundSize = background->getContentSize(); scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + (backgroundSize.width - scrollView->getContentSize().width) / 2.0f, @@ -71,7 +71,8 @@ bool UIScrollViewTest_Vertical::init() imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getContentSize().height / 2.0f)); scrollView->addChild(imageView); - + + return true; } From 952e52365bab88c4a2b0cd92b6c4bfe8d2306d59 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 17 Oct 2014 14:02:49 +0800 Subject: [PATCH 2/9] fix scrollView rotate issue --- cocos/ui/UIScrollView.cpp | 8 +- .../CocoStudioGUITest/CocosGUIScene.cpp | 2 +- .../CocoStudioGUITest/UISceneManager.cpp | 4 + .../UITest/CocoStudioGUITest/UISceneManager.h | 2 + .../UIScrollViewTest/UIScrollViewTest.cpp | 78 +++++++++++++++++++ .../UIScrollViewTest/UIScrollViewTest.h | 12 +++ 6 files changed, 102 insertions(+), 4 deletions(-) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 1e8772b91f..95bab8ed39 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -1422,10 +1422,12 @@ void ScrollView::endRecordSlidAction() } float totalDis = 0.0f; Vec2 dir; + Vec2 touchEndPositionInNodeSpace = this->convertToNodeSpace(_touchEndPosition); + Vec2 touchBeganPositionInNodeSpace = this->convertToNodeSpace(_touchBeganPosition); switch (_direction) { case Direction::VERTICAL: - totalDis = _touchEndPosition.y - _touchBeganPosition.y; + totalDis = touchEndPositionInNodeSpace.y - touchBeganPositionInNodeSpace.y; if (totalDis < 0.0f) { dir = SCROLLDIR_DOWN; @@ -1436,7 +1438,7 @@ void ScrollView::endRecordSlidAction() } break; case Direction::HORIZONTAL: - totalDis = _touchEndPosition.x - _touchBeganPosition.x; + totalDis = touchEndPositionInNodeSpace.x - touchBeganPositionInNodeSpace.x; if (totalDis < 0.0f) { dir = SCROLLDIR_LEFT; @@ -1448,7 +1450,7 @@ void ScrollView::endRecordSlidAction() break; case Direction::BOTH: { - Vec2 subVector = _touchEndPosition - _touchBeganPosition; + Vec2 subVector = touchEndPositionInNodeSpace - touchBeganPositionInNodeSpace; totalDis = subVector.getLength(); dir = subVector.getNormalized(); break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp index 6d44ef0536..c6fb2138d5 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp @@ -211,7 +211,7 @@ g_guisTests[] = UISceneManager* sceneManager = UISceneManager::sharedUISceneManager(); sceneManager->setCurrentUISceneId(kUIScrollViewTest_Vertical); sceneManager->setMinUISceneId(kUIScrollViewTest_Vertical); - sceneManager->setMaxUISceneId(kUIScrollViewNestTest); + sceneManager->setMaxUISceneId(kUIScrollViewRotated); Scene* scene = sceneManager->currentUIScene(); Director::getInstance()->replaceScene(scene); } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp index 5219f6f0e1..c00944cd14 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp @@ -91,6 +91,7 @@ static const char* s_testArray[] = "UIScrollViewTest_ScrollToPercentBothDirection", "UIScrollViewTest_ScrollToPercentBothDirection_Bounce", "UIScrollViewNestTest", + "UIScrollViewRotated", "UIPageViewTest", "UIPageViewButtonTest", @@ -323,6 +324,9 @@ Scene *UISceneManager::currentUIScene() return UIScrollViewTest_ScrollToPercentBothDirection_Bounce::sceneWithTitle(s_testArray[_currentUISceneId]); case kUIScrollViewNestTest: return UIScrollViewNestTest::sceneWithTitle(s_testArray[_currentUISceneId]); + case kUIScrollViewRotated: + return UIScrollViewRotated::sceneWithTitle(s_testArray[_currentUISceneId]); + case kUIPageViewTest: return UIPageViewTest::sceneWithTitle(s_testArray[_currentUISceneId]); case kUIPageViewButtonTest: diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h index bcaf85bf37..cc49fb4f40 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.h @@ -82,6 +82,8 @@ enum kUIScrollViewTest_ScrollToPercentBothDirection, kUIScrollViewTest_ScrollToPercentBothDirection_Bounce, kUIScrollViewNestTest, + kUIScrollViewRotated, + kUIPageViewTest, kUIPageViewButtonTest, kUIPageViewCustomScrollThreshold, diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index 89461e1c21..1c57acae30 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -426,3 +426,81 @@ bool UIScrollViewNestTest::init() return false; } +// UIScrollViewRotated + +UIScrollViewRotated::UIScrollViewRotated() +: _displayValueLabel(nullptr) +{ +} + +UIScrollViewRotated::~UIScrollViewRotated() +{ +} + +bool UIScrollViewRotated::init() +{ + if (UIScene::init()) + { + Size widgetSize = _widget->getContentSize(); + + // Add a label in which the scrollview alert will be displayed + _displayValueLabel = Text::create("Move by vertical direction", "fonts/Marker Felt.ttf", 32); + _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); + _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f)); + _uiLayer->addChild(_displayValueLabel); + + // Add the alert + Text* alert = Text::create("ScrollView vertical", "fonts/Marker Felt.ttf", 30); + alert->setColor(Color3B(159, 168, 176)); + alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f)); + _uiLayer->addChild(alert); + + Layout* root = static_cast(_uiLayer->getChildByTag(81)); + + Layout* background = dynamic_cast(root->getChildByName("background_Panel")); + + // Create the scrollview by vertical + ui::ScrollView* scrollView = ui::ScrollView::create(); + scrollView->setContentSize(Size(280.0f, 150.0f)); + scrollView->setDirection(ui::ScrollView::Direction::BOTH); + Size backgroundSize = background->getContentSize(); + scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + + (backgroundSize.width - scrollView->getContentSize().width) / 2.0f, + (widgetSize.height - backgroundSize.height) / 2.0f + + (backgroundSize.height - scrollView->getContentSize().height) / 2.0f + 100) ); + scrollView->setRotation(45); + _uiLayer->addChild(scrollView); + + ImageView* imageView = ImageView::create("cocosui/ccicon.png"); + + float innerWidth = scrollView->getContentSize().width; + float innerHeight = scrollView->getContentSize().height + imageView->getContentSize().height; + + scrollView->setInnerContainerSize(Size(innerWidth, innerHeight)); + + Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); + button->setPosition(Vec2(innerWidth / 2.0f, scrollView->getInnerContainerSize().height - button->getContentSize().height / 2.0f)); + scrollView->addChild(button); + + Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png"); + titleButton->setTitleText("Title Button"); + titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomBoundary() - button->getContentSize().height)); + scrollView->addChild(titleButton); + + Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); + button_scale9->setScale9Enabled(true); + button_scale9->setContentSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); + button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomBoundary() - titleButton->getContentSize().height)); + scrollView->addChild(button_scale9); + + imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getContentSize().height / 2.0f)); + scrollView->addChild(imageView); + + + + return true; + } + + return false; +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h index bbb78949d3..766a11002b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h @@ -99,4 +99,16 @@ protected: Text* _displayValueLabel; }; +class UIScrollViewRotated : public UIScene +{ +public: + UIScrollViewRotated(); + ~UIScrollViewRotated(); + bool init(); + +protected: + UI_SCENE_CREATE_FUNC(UIScrollViewRotated) + Text* _displayValueLabel; +}; + #endif /* defined(__TestCpp__UIScrollViewTest__) */ From 778701595ccc35cac94b9f3d1f2b69ecfe1e4cf3 Mon Sep 17 00:00:00 2001 From: pipu Date: Fri, 17 Oct 2014 14:11:15 +0800 Subject: [PATCH 3/9] Fixed #8770 --- .../ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index 22fdccf095..5d4cc3ba9a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp @@ -214,6 +214,7 @@ void SceneEditorTestLayer::changeLoadTypeCallback(cocos2d::Ref *pSender) if(_rootNode != nullptr) { + ActionManagerEx::getInstance()->releaseActions(); this->removeChild(_rootNode); _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); if (_rootNode == nullptr) From e8373e9b4173b037c9a192cdd0f22511c9c8e71d Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 17 Oct 2014 06:28:36 +0000 Subject: [PATCH 4/9] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Animate3D.lua | 15 +++ .../auto/api/SkeletonAnimation.lua | 10 -- .../auto/lua_cocos2dx_3d_auto.cpp | 54 +++++++++++ .../auto/lua_cocos2dx_3d_auto.hpp | 1 + .../auto/lua_cocos2dx_spine_auto.cpp | 95 ------------------- .../auto/lua_cocos2dx_spine_auto.hpp | 1 - 6 files changed, 70 insertions(+), 106 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua index fb9c86d96c..799140a2d5 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua @@ -44,6 +44,21 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- create Animate3D by frame section, [startFrame, endFrame)
+-- param animation used to generate animate3D
+-- param startFrame
+-- param endFrame
+-- param frameRate default is 30 per second
+-- return Animate3D created using animate +-- @function [parent=#Animate3D] createWithFrames +-- @param self +-- @param #cc.Animation3D animation +-- @param #int startFrame +-- @param #int endFrame +-- @param #float frameRate +-- @return Animate3D#Animate3D ret (return value: cc.Animate3D) + -------------------------------- -- -- @function [parent=#Animate3D] startWithTarget diff --git a/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua b/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua index aac8298278..cfaee60ac3 100644 --- a/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua +++ b/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua @@ -74,14 +74,4 @@ -- @function [parent=#SkeletonAnimation] clearTrack -- @param self --------------------------------- --- @overload self, string, string, float --- @overload self, string, spAtlas, float --- @function [parent=#SkeletonAnimation] createWithFile --- @param self --- @param #string skeletonDataFile --- @param #spAtlas atlas --- @param #float scale --- @return SkeletonAnimation#SkeletonAnimation ret (retunr value: sp.SkeletonAnimation) - return nil diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp index 43db45a304..9b06965efa 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -1754,6 +1754,59 @@ int lua_cocos2dx_3d_Animate3D_getTransitionTime(lua_State* tolua_S) #endif return 0; } +int lua_cocos2dx_3d_Animate3D_createWithFrames(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 3) + { + cocos2d::Animation3D* arg0; + int arg1; + int arg2; + ok &= luaval_to_object(tolua_S, 2, "cc.Animation3D",&arg0); + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "cc.Animate3D:createWithFrames"); + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Animate3D:createWithFrames"); + if(!ok) + return 0; + cocos2d::Animate3D* ret = cocos2d::Animate3D::createWithFrames(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret); + return 1; + } + if (argc == 4) + { + cocos2d::Animation3D* arg0; + int arg1; + int arg2; + double arg3; + ok &= luaval_to_object(tolua_S, 2, "cc.Animation3D",&arg0); + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "cc.Animate3D:createWithFrames"); + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Animate3D:createWithFrames"); + ok &= luaval_to_number(tolua_S, 5,&arg3, "cc.Animate3D:createWithFrames"); + if(!ok) + return 0; + cocos2d::Animate3D* ret = cocos2d::Animate3D::createWithFrames(arg0, arg1, arg2, arg3); + object_to_luaval(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Animate3D:createWithFrames",argc, 3); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Animate3D_createWithFrames'.",&tolua_err); +#endif + return 0; +} static int lua_cocos2dx_3d_Animate3D_finalize(lua_State* tolua_S) { printf("luabindings: finalizing LUA object (Animate3D)"); @@ -1772,6 +1825,7 @@ int lua_register_cocos2dx_3d_Animate3D(lua_State* tolua_S) tolua_function(tolua_S,"getWeight",lua_cocos2dx_3d_Animate3D_getWeight); tolua_function(tolua_S,"create", lua_cocos2dx_3d_Animate3D_create); tolua_function(tolua_S,"getTransitionTime", lua_cocos2dx_3d_Animate3D_getTransitionTime); + tolua_function(tolua_S,"createWithFrames", lua_cocos2dx_3d_Animate3D_createWithFrames); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::Animate3D).name(); g_luaType[typeName] = "cc.Animate3D"; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp index 443f02e21d..2a79697214 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp @@ -58,6 +58,7 @@ int register_all_cocos2dx_3d(lua_State* tolua_S); + #endif // __cocos2dx_3d_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp index 46b1b7dd97..59ee30b2c7 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp @@ -1276,100 +1276,6 @@ int lua_cocos2dx_spine_SkeletonAnimation_clearTrack(lua_State* tolua_S) return 0; } -int lua_cocos2dx_spine_SkeletonAnimation_createWithFile(lua_State* tolua_S) -{ - int argc = 0; - bool ok = true; -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertable(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; -#endif - - argc = lua_gettop(tolua_S)-1; - - do - { - if (argc == 2) - { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - std::string arg1; - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); - object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 3) - { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - std::string arg1; - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - double arg2; - ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); - object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 2) - { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - spAtlas* arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { break; } - spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); - object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 3) - { - std::string arg0; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - spAtlas* arg1; - #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* - ok = false; - if (!ok) { break; } - double arg2; - ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonAnimation:createWithFile"); - if (!ok) { break; } - spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); - object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); - return 1; - } - } while (0); - ok = true; - CCLOG("%s has wrong number of arguments: %d, was expecting %d", "sp.SkeletonAnimation:createWithFile",argc, 2); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_createWithFile'.",&tolua_err); -#endif - return 0; -} static int lua_cocos2dx_spine_SkeletonAnimation_finalize(lua_State* tolua_S) { printf("luabindings: finalizing LUA object (SkeletonAnimation)"); @@ -1393,7 +1299,6 @@ int lua_register_cocos2dx_spine_SkeletonAnimation(lua_State* tolua_S) tolua_function(tolua_S,"setEndListener",lua_cocos2dx_spine_SkeletonAnimation_setEndListener); tolua_function(tolua_S,"clearTracks",lua_cocos2dx_spine_SkeletonAnimation_clearTracks); tolua_function(tolua_S,"clearTrack",lua_cocos2dx_spine_SkeletonAnimation_clearTrack); - tolua_function(tolua_S,"createWithFile", lua_cocos2dx_spine_SkeletonAnimation_createWithFile); tolua_endmodule(tolua_S); std::string typeName = typeid(spine::SkeletonAnimation).name(); g_luaType[typeName] = "sp.SkeletonAnimation"; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp index eacf39fb30..5a23db13eb 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp @@ -37,7 +37,6 @@ int register_all_cocos2dx_spine(lua_State* tolua_S); - #endif // __cocos2dx_spine_h__ From d997fdc7f7f536dee60b85c74bab8f953e0122ec Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 17 Oct 2014 14:51:34 +0800 Subject: [PATCH 5/9] Default build mode of samples change to release builds --- build/android-build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/android-build.py b/build/android-build.py index 3465d37d8c..15f708437e 100755 --- a/build/android-build.py +++ b/build/android-build.py @@ -204,9 +204,9 @@ def build_samples(target,ndk_build_param,android_platform,build_mode): exit(1) if build_mode is None: - build_mode = 'debug' - elif build_mode != 'release': - build_mode = 'debug' + build_mode = 'release' + elif build_mode != 'debug': + build_mode = 'release' app_android_root = '' From 8a38d192bb6611a7dc0fe91a9910650c09437720 Mon Sep 17 00:00:00 2001 From: honghui Date: Fri, 17 Oct 2014 14:51:27 +0800 Subject: [PATCH 6/9] win32 runtime need more dll files --- .../cocos-project-template.json | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/templates/lua-template-runtime/cocos-project-template.json b/templates/lua-template-runtime/cocos-project-template.json index b75ccf0fbe..be860c7814 100644 --- a/templates/lua-template-runtime/cocos-project-template.json +++ b/templates/lua-template-runtime/cocos-project-template.json @@ -26,14 +26,35 @@ ] }, { - "from": "external/win32-specific/zlib/prebuilt", + "from": "external/win32-specific/icon/prebuilt", "to": "runtime/win32", "include": [ "*.dll" ] }, { - "from": "external/win32-specific/icon/prebuilt", + "from": "external/win32-specific/MP3Decoder/prebuilt", + "to": "runtime/win32", + "include": [ + "*.dll" + ] + }, + { + "from": "external/win32-specific/OggDecoder/prebuilt", + "to": "runtime/win32", + "include": [ + "*.dll" + ] + }, + { + "from": "external/win32-specific/OpenalSoft/prebuilt", + "to": "runtime/win32", + "include": [ + "*.dll" + ] + }, + { + "from": "external/win32-specific/zlib/prebuilt", "to": "runtime/win32", "include": [ "*.dll" From 8c0af59f9ae2bfd40ab755934953f3bdb637dcee Mon Sep 17 00:00:00 2001 From: honghui Date: Fri, 17 Oct 2014 14:53:19 +0800 Subject: [PATCH 7/9] open lua debugger only when IDE connected --- .../frameworks/runtime-src/Classes/runtime/Runtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp index e6961444b9..95b8e7e994 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp @@ -93,6 +93,7 @@ void startScript(string strDebugArg) if (!strDebugArg.empty()) { // open debugger.lua module + luaopen_lua_debugger(engine->getLuaStack()->getLuaState()); engine->executeString(strDebugArg.c_str()); } cocos2d::log("debug args = %s", strDebugArg.c_str()); @@ -1220,7 +1221,6 @@ void initRuntime() auto engine = LuaEngine::getInstance(); ScriptEngineManager::getInstance()->setScriptEngine(engine); register_runtime_override_function(engine->getLuaStack()->getLuaState()); - luaopen_lua_debugger(engine->getLuaStack()->getLuaState()); static ConsoleCustomCommand *g_customCommand; g_customCommand = new ConsoleCustomCommand(); From 32c6bc05b97f30cf7a972d69f6c0bc2f0449ba7d Mon Sep 17 00:00:00 2001 From: joshuastray Date: Fri, 17 Oct 2014 16:29:37 +0800 Subject: [PATCH 8/9] fix typo of file name --- cocos/storage/local-storage/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/storage/local-storage/Android.mk b/cocos/storage/local-storage/Android.mk index 65a29778fd..38563bbe8e 100644 --- a/cocos/storage/local-storage/Android.mk +++ b/cocos/storage/local-storage/Android.mk @@ -6,7 +6,7 @@ LOCAL_MODULE := cocos_localstorage_static LOCAL_MODULE_FILENAME := liblocalstorage LOCAL_SRC_FILES := LocalStorage.cpp \ -LocalStorageAndroid.cpp +LocalStorage-android.cpp LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. From 4bede5067e05f3e22b79383cc782622310bb4158 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 17 Oct 2014 17:02:22 +0800 Subject: [PATCH 9/9] Fix CPP template project crash --- templates/cpp-template-default/Classes/HelloWorldScene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cpp-template-default/Classes/HelloWorldScene.cpp b/templates/cpp-template-default/Classes/HelloWorldScene.cpp index 8a437afe99..5c273b9b8b 100644 --- a/templates/cpp-template-default/Classes/HelloWorldScene.cpp +++ b/templates/cpp-template-default/Classes/HelloWorldScene.cpp @@ -54,7 +54,7 @@ bool HelloWorld::init() // add a label shows "Hello World" // create and initialize a label - auto label = Label::createWithTTF("Hello World", "Arial", 24); + auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24); // position the label on the center of the screen label->setPosition(Vec2(origin.x + visibleSize.width/2,