From fa45f3f4e0255b7b0a370595a3fc52833487067d Mon Sep 17 00:00:00 2001 From: zifter Date: Sat, 10 May 2014 04:02:24 +0300 Subject: [PATCH 01/90] Fixed bug with cascade opacity for control button. --- .../CCControlExtension/CCControlButton.cpp | 51 ++++++++++++------- .../GUI/CCControlExtension/CCControlButton.h | 8 +-- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index c3754aaa18..3171a42a9f 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -656,30 +656,32 @@ void ControlButton::onTouchEnded(Touch *pTouch, Event *pEvent) void ControlButton::setOpacity(GLubyte opacity) { - // XXX fixed me if not correct Control::setOpacity(opacity); -// _opacity = opacity; -// -// Ref* child; -// Array* children=getChildren(); -// CCARRAY_FOREACH(children, child) -// { -// RGBAProtocol* pNode = dynamic_cast(child); -// if (pNode) -// { -// pNode->setOpacity(opacity); -// } -// } for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter) { iter->second->setOpacity(opacity); } + + for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter) + { + iter->second->setOpacity(opacity); + } } -GLubyte ControlButton::getOpacity() const +void ControlButton::updateDisplayedOpacity(GLubyte parentOpacity) { - return _realOpacity; + Control::updateDisplayedOpacity(parentOpacity); + + for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter) + { + iter->second->updateDisplayedOpacity(parentOpacity); + } + + for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter) + { + iter->second->updateDisplayedOpacity(parentOpacity); + } } void ControlButton::setColor(const Color3B & color) @@ -690,11 +692,26 @@ void ControlButton::setColor(const Color3B & color) { iter->second->setColor(color); } + + for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter) + { + iter->second->setColor(color); + } } -const Color3B& ControlButton::getColor() const +void ControlButton::updateDisplayedColor(const Color3B& parentColor) { - return _realColor; + Control::updateDisplayedColor(parentColor); + + for (auto iter = _backgroundSpriteDispatchTable.begin(); iter != _backgroundSpriteDispatchTable.end(); ++iter) + { + iter->second->updateDisplayedColor(parentColor); + } + + for (auto iter = _titleLabelDispatchTable.begin(); iter != _titleLabelDispatchTable.end(); ++iter) + { + iter->second->updateDisplayedColor(parentColor); + } } void ControlButton::onTouchCancelled(Touch *pTouch, Event *pEvent) diff --git a/extensions/GUI/CCControlExtension/CCControlButton.h b/extensions/GUI/CCControlExtension/CCControlButton.h index 4db682ed51..e706955bfd 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.h +++ b/extensions/GUI/CCControlExtension/CCControlButton.h @@ -181,11 +181,11 @@ public: virtual void onTouchMoved(Touch *touch, Event *event) override; virtual void onTouchEnded(Touch *touch, Event *event) override; virtual void onTouchCancelled(Touch *touch, Event *event) override; - virtual GLubyte getOpacity(void) const override; - virtual void setOpacity(GLubyte var) override; - virtual const Color3B& getColor(void) const override; - virtual void setColor(const Color3B&) override; + virtual void setOpacity(GLubyte var) override; + virtual void updateDisplayedOpacity(GLubyte parentOpacity) override; + virtual void setColor(const Color3B&) override; + virtual void updateDisplayedColor(const Color3B& parentColor) override; const std::string& getCurrentTitle() const { return _currentTitle; }; std::string getCurrentTitle() { return _currentTitle; }; From a71ee9924e4e67444357d23ed00f1484173b1d2b Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Tue, 13 May 2014 12:53:43 +0800 Subject: [PATCH 02/90] closed issue:5020:The game still oriented in landscape mode when update the describes of orientation to Portrait in 'MainPage.xaml'. --- .../platform/wp8-xaml/cpp/Cocos2dRenderer.cpp | 5 ++-- .../platform/wp8-xaml/cpp/Cocos2dRenderer.h | 3 ++- .../platform/wp8-xaml/cpp/Direct3DInterop.cpp | 6 ++--- .../platform/wp8-xaml/cpp/Direct3DInterop.h | 2 +- .../platform/wp8-xaml/xaml/MainPage.xaml.cs | 26 ++++++++++++++++++- cocos/2d/platform/wp8/CCGLView.cpp | 4 +-- cocos/2d/platform/wp8/CCGLView.h | 3 ++- 7 files changed, 38 insertions(+), 11 deletions(-) diff --git a/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp b/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp index 3a048a40fc..24090e043b 100644 --- a/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp +++ b/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.cpp @@ -39,9 +39,10 @@ using namespace PhoneDirect3DXamlAppComponent; USING_NS_CC; -Cocos2dRenderer::Cocos2dRenderer(): mInitialized(false), m_loadingComplete(false), m_delegate(nullptr), m_messageBoxDelegate(nullptr) +Cocos2dRenderer::Cocos2dRenderer(Windows::Graphics::Display::DisplayOrientations orientation): mInitialized(false), m_loadingComplete(false), m_delegate(nullptr), m_messageBoxDelegate(nullptr) { mApp = new AppDelegate(); + m_orientation = orientation; } // Creates and restores Cocos2d-x after DirectX and Angle contexts are created or updated @@ -53,7 +54,7 @@ void Cocos2dRenderer::CreateGLResources() { mInitialized = true; GLView* glview = GLView::create("Test Cpp"); - glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height); + glview->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height,m_orientation); director->setOpenGLView(glview); CCApplication::getInstance()->run(); glview->SetXamlEventDelegate(m_delegate); diff --git a/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.h b/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.h index 796cc6e526..41c3ddd144 100644 --- a/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.h +++ b/cocos/2d/platform/wp8-xaml/cpp/Cocos2dRenderer.h @@ -32,7 +32,7 @@ class AppDelegate; ref class Cocos2dRenderer sealed : public DirectXBase { public: - Cocos2dRenderer(); + Cocos2dRenderer(Windows::Graphics::Display::DisplayOrientations orientation); // Direct3DBase methods. virtual void OnOrientationChanged(Windows::Graphics::Display::DisplayOrientations orientation) override; @@ -64,4 +64,5 @@ private: // The AppDelegate for the Cocos2D app AppDelegate* mApp; + Windows::Graphics::Display::DisplayOrientations m_orientation; }; diff --git a/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.cpp b/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.cpp index cddd4763f9..b2af8676b8 100644 --- a/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.cpp +++ b/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.cpp @@ -40,10 +40,10 @@ using namespace PhoneDirect3DXamlAppComponent; namespace PhoneDirect3DXamlAppComponent { -Direct3DInterop::Direct3DInterop() - : mCurrentOrientation(DisplayOrientations::Portrait), m_delegate(nullptr) +Direct3DInterop::Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation) + : mCurrentOrientation(orientation), m_delegate(nullptr) { - m_renderer = ref new Cocos2dRenderer(); + m_renderer = ref new Cocos2dRenderer(mCurrentOrientation); } IDrawingSurfaceBackgroundContentProvider^ Direct3DInterop::CreateContentProvider() diff --git a/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.h b/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.h index ca9b90f75c..8c6bbad3ba 100644 --- a/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.h +++ b/cocos/2d/platform/wp8-xaml/cpp/Direct3DInterop.h @@ -43,7 +43,7 @@ public delegate void RequestAdditionalFrameHandler(); public ref class Direct3DInterop sealed : public Windows::Phone::Input::Interop::IDrawingSurfaceManipulationHandler { public: - Direct3DInterop(); + Direct3DInterop(Windows::Graphics::Display::DisplayOrientations orientation); Windows::Phone::Graphics::Interop::IDrawingSurfaceBackgroundContentProvider^ CreateContentProvider(); diff --git a/cocos/2d/platform/wp8-xaml/xaml/MainPage.xaml.cs b/cocos/2d/platform/wp8-xaml/xaml/MainPage.xaml.cs index a4500a00d9..70d50eb5ee 100644 --- a/cocos/2d/platform/wp8-xaml/xaml/MainPage.xaml.cs +++ b/cocos/2d/platform/wp8-xaml/xaml/MainPage.xaml.cs @@ -24,6 +24,7 @@ using Microsoft.Phone.Shell; using Windows.UI.Input; using System.Windows.Threading; using Microsoft.Phone.Info; +using Windows.Graphics.Display; namespace PhoneDirect3DXamlAppInterop { @@ -53,7 +54,30 @@ namespace PhoneDirect3DXamlAppInterop { if (m_d3dInterop == null) { - m_d3dInterop = new Direct3DInterop(); + PageOrientation pageOrientation = (PageOrientation)GetValue(OrientationProperty); + DisplayOrientations displayOrientation; + + switch(pageOrientation) + { + case PageOrientation.Portrait: + case PageOrientation.PortraitUp: + displayOrientation = DisplayOrientations.Portrait; + break; + case PageOrientation.PortraitDown: + displayOrientation = DisplayOrientations.PortraitFlipped; + break; + case PageOrientation.Landscape: + case PageOrientation.LandscapeLeft: + displayOrientation = DisplayOrientations.Landscape; + break; + case PageOrientation.LandscapeRight: + displayOrientation = DisplayOrientations.LandscapeFlipped; + break; + default: + displayOrientation = DisplayOrientations.Landscape; + break; + } + m_d3dInterop = new Direct3DInterop(displayOrientation); // Set WindowBounds to size of DrawingSurface m_d3dInterop.WindowBounds = new Windows.Foundation.Size( diff --git a/cocos/2d/platform/wp8/CCGLView.cpp b/cocos/2d/platform/wp8/CCGLView.cpp index 5716466c59..da336b5061 100644 --- a/cocos/2d/platform/wp8/CCGLView.cpp +++ b/cocos/2d/platform/wp8/CCGLView.cpp @@ -89,7 +89,6 @@ GLView::GLView() { s_pEglView = this; _viewName = "cocos2dx"; - UpdateOrientationMatrix(); } GLView::~GLView() @@ -114,8 +113,9 @@ bool GLView::initWithFullScreen(const std::string& viewName) } -bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height) +bool GLView::Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height, DisplayOrientations orientation) { + m_orientation = orientation; m_eglDisplay = eglDisplay; m_eglContext = eglContext; m_eglSurface = eglSurface; diff --git a/cocos/2d/platform/wp8/CCGLView.h b/cocos/2d/platform/wp8/CCGLView.h index 187c796ad9..77bca357c5 100644 --- a/cocos/2d/platform/wp8/CCGLView.h +++ b/cocos/2d/platform/wp8/CCGLView.h @@ -71,7 +71,8 @@ public: void HideKeyboard(Windows::Foundation::Rect r); // WP8 XAML app - virtual bool Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height); + virtual bool Create(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, float width, float height + ,Windows::Graphics::Display::DisplayOrientations orientation); virtual void UpdateDevice(EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface); void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args); From 249dffa3466ad0d26bbc5d0bd203255df88ca437 Mon Sep 17 00:00:00 2001 From: zifter Date: Tue, 13 May 2014 23:28:04 +0300 Subject: [PATCH 03/90] getter always must be a const method. --- cocos/2d/CCLabelBMFont.cpp | 2 +- cocos/2d/CCLabelBMFont.h | 2 +- cocos/2d/CCNode.cpp | 2 +- cocos/2d/CCNode.h | 2 +- cocos/ui/UIListView.h | 2 +- cocos/ui/UIPageView.h | 2 +- cocos/ui/UIScrollView.cpp | 2 +- cocos/ui/UIScrollView.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cocos/2d/CCLabelBMFont.cpp b/cocos/2d/CCLabelBMFont.cpp index 283030f9f2..84322be822 100644 --- a/cocos/2d/CCLabelBMFont.cpp +++ b/cocos/2d/CCLabelBMFont.cpp @@ -181,7 +181,7 @@ const BlendFunc &LabelBMFont::getBlendFunc() const return _label->getBlendFunc(); } -Node* LabelBMFont::getChildByTag(int tag) +Node * LabelBMFont::getChildByTag(int tag) const { return _label->getLetter(tag); } diff --git a/cocos/2d/CCLabelBMFont.h b/cocos/2d/CCLabelBMFont.h index 0a9b7bdf04..6045fe521f 100644 --- a/cocos/2d/CCLabelBMFont.h +++ b/cocos/2d/CCLabelBMFont.h @@ -115,7 +115,7 @@ public: virtual const BlendFunc &getBlendFunc() const override; virtual Sprite * getLetter(int ID); - virtual Node * getChildByTag(int tag) override; + virtual Node * getChildByTag(int tag) const override; virtual void setColor(const Color3B& color) override; diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 7bfd23019b..32c473470a 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -697,7 +697,7 @@ void Node::childrenAlloc(void) _children.reserve(4); } -Node* Node::getChildByTag(int tag) +Node * Node::getChildByTag(int tag) const { CCASSERT( tag != Node::INVALID_TAG, "Invalid tag"); diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index dd8451bfa9..ef1dc3a953 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -644,7 +644,7 @@ public: * * @return a Node object whose tag equals to the input parameter */ - virtual Node * getChildByTag(int tag); + virtual Node * getChildByTag(int tag) const; /** * Returns the array of the node's children * diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 0d88a821da..66a0b7719a 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -189,7 +189,7 @@ protected: virtual Vector& getChildren() override{return ScrollView::getChildren();}; virtual const Vector& getChildren() const override{return ScrollView::getChildren();}; virtual ssize_t getChildrenCount() const override {return ScrollView::getChildrenCount();}; - virtual Node * getChildByTag(int tag) override {return ScrollView::getChildByTag(tag);}; + virtual Node * getChildByTag(int tag) const override {return ScrollView::getChildByTag(tag);}; virtual Widget* getChildByName(const char* name) override {return ScrollView::getChildByName(name);}; void updateInnerContainerSize(); void remedyLayoutParameter(Widget* item); diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index e403c40a41..524eac421c 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -176,7 +176,7 @@ protected: virtual Vector& getChildren() override{return Widget::getChildren();}; virtual const Vector& getChildren() const override{return Widget::getChildren();}; virtual ssize_t getChildrenCount() const override {return Widget::getChildrenCount();}; - virtual Node * getChildByTag(int tag) override {return Widget::getChildByTag(tag);}; + virtual Node * getChildByTag(int tag) const override {return Widget::getChildByTag(tag);}; virtual Widget* getChildByName(const char* name) override {return Widget::getChildByName(name);}; Layout* createPage(); float getPositionXByIndex(ssize_t idx); diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index cd69c209ed..e12fc4e48e 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -301,7 +301,7 @@ ssize_t ScrollView::getChildrenCount() const return _innerContainer->getChildrenCount(); } -Node* ScrollView::getChildByTag(int tag) +Node * ScrollView::getChildByTag(int tag) const { return _innerContainer->getChildByTag(tag); } diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 4e95cb3350..83d4d05aba 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -282,7 +282,7 @@ public: virtual ssize_t getChildrenCount() const override; - virtual Node * getChildByTag(int tag) override; + virtual Node * getChildByTag(int tag) const override; virtual Widget* getChildByName(const char* name) override; From 8c8f9611f7de81d61b23b295c409f87b24c1a9a9 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 14 May 2014 18:03:44 +0800 Subject: [PATCH 04/90] issue #5183, add CCLayoutExecutant file --- build/cocos2d_libs.xcodeproj/project.pbxproj | 34 +- cocos/ui/CCLayoutExecutant.cpp | 519 ++++++++++++++++++ cocos/ui/CCLayoutExecutant.h | 74 +++ cocos/ui/UILayout.cpp | 521 ------------------- 4 files changed, 620 insertions(+), 528 deletions(-) create mode 100644 cocos/ui/CCLayoutExecutant.cpp create mode 100644 cocos/ui/CCLayoutExecutant.h diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index b7b9739561..7a11d71992 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1039,6 +1039,10 @@ 2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; }; 2905FA8E18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; 2905FA8F18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; + 2928C2001923756F00E77353 /* CCLayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */; }; + 2928C2011923756F00E77353 /* CCLayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */; }; + 2928C2021923756F00E77353 /* CCLayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */; }; + 2928C2031923756F00E77353 /* CCLayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */; }; 296CAD221915EC8000C64FBF /* CCEventFocus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */; }; 296CAD231915EC8000C64FBF /* CCEventFocus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */; }; 296CAD241915EC8000C64FBF /* CCEventFocus.h in Headers */ = {isa = PBXBuildFile; fileRef = 296CAD211915EC8000C64FBF /* CCEventFocus.h */; }; @@ -2265,6 +2269,8 @@ 2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = ""; }; 2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = ""; }; 29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = ""; }; + 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayoutExecutant.cpp; sourceTree = ""; }; + 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayoutExecutant.h; sourceTree = ""; }; 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventFocus.cpp; path = ../base/CCEventFocus.cpp; sourceTree = ""; }; 296CAD211915EC8000C64FBF /* CCEventFocus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEventFocus.h; path = ../base/CCEventFocus.h; sourceTree = ""; }; 296CAD261915EC9900C64FBF /* CCEventListenerFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventListenerFocus.cpp; path = ../base/CCEventListenerFocus.cpp; sourceTree = ""; }; @@ -3960,6 +3966,7 @@ 2905F9E618CF08D000240AA3 /* ui */ = { isa = PBXGroup; children = ( + 2928C2041923757900E77353 /* Layout */, 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */, 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */, 2905F9E918CF08D000240AA3 /* CocosGUI.cpp */, @@ -3973,10 +3980,6 @@ 2905F9F518CF08D000240AA3 /* UIHelper.h */, 2905F9F618CF08D000240AA3 /* UIImageView.cpp */, 2905F9F718CF08D000240AA3 /* UIImageView.h */, - 2905F9F818CF08D000240AA3 /* UILayout.cpp */, - 2905F9F918CF08D000240AA3 /* UILayout.h */, - 2905F9FC18CF08D000240AA3 /* UILayoutParameter.cpp */, - 2905F9FD18CF08D000240AA3 /* UILayoutParameter.h */, 2905F9FE18CF08D000240AA3 /* UIListView.cpp */, 2905F9FF18CF08D000240AA3 /* UIListView.h */, 2905FA0018CF08D000240AA3 /* UILoadingBar.cpp */, @@ -4002,16 +4005,29 @@ 2905FA1418CF08D100240AA3 /* UIWidget.h */, 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */, + 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, + ); + name = ui; + path = ../cocos/ui; + sourceTree = ""; + }; + 2928C2041923757900E77353 /* Layout */ = { + isa = PBXGroup; + children = ( 50E6D32E18E174130051CA34 /* UIHBox.cpp */, 50E6D32F18E174130051CA34 /* UIHBox.h */, 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */, 50E6D33118E174130051CA34 /* UIRelativeBox.h */, 50E6D33218E174130051CA34 /* UIVBox.cpp */, 50E6D33318E174130051CA34 /* UIVBox.h */, - 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, + 2905F9F818CF08D000240AA3 /* UILayout.cpp */, + 2905F9F918CF08D000240AA3 /* UILayout.h */, + 2905F9FC18CF08D000240AA3 /* UILayoutParameter.cpp */, + 2905F9FD18CF08D000240AA3 /* UILayoutParameter.h */, + 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */, + 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */, ); - name = ui; - path = ../cocos/ui; + name = Layout; sourceTree = ""; }; 37936A361869B76800E974DD /* internal */ = { @@ -4931,6 +4947,7 @@ 2905FA6018CF08D100240AA3 /* UILayoutParameter.h in Headers */, 1ABA68B01888D700007D1BB4 /* CCFontCharMap.h in Headers */, 5034CA3F191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */, + 2928C2021923756F00E77353 /* CCLayoutExecutant.h in Headers */, 500DC8B419105D41007B91BF /* CCGroupCommand.h in Headers */, 500DC8D319105F7D007B91BF /* CCAffineTransform.h in Headers */, 46A170191807CBFC005B8026 /* CCCommon.h in Headers */, @@ -5529,6 +5546,7 @@ 1A5701FE180BCBAD0088DEC7 /* CCMenuItem.h in Headers */, 1A570205180BCBD40088DEC7 /* CCClippingNode.h in Headers */, 5034CA34191D591100CE6051 /* ccShader_PositionTexture_uColor.frag in Headers */, + 2928C2031923756F00E77353 /* CCLayoutExecutant.h in Headers */, 1A57020B180BCBDF0088DEC7 /* CCMotionStreak.h in Headers */, 1A570213180BCBF40088DEC7 /* CCProgressTimer.h in Headers */, B37510821823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.h in Headers */, @@ -6336,6 +6354,7 @@ 1AAF536A180E3374000584C8 /* HttpClient.cpp in Sources */, 1AAF5372180E3374000584C8 /* SocketIO.cpp in Sources */, 1AAF5376180E3374000584C8 /* WebSocket.cpp in Sources */, + 2928C2001923756F00E77353 /* CCLayoutExecutant.cpp in Sources */, 1A01C69818F57BE800EFE3A6 /* CCSet.cpp in Sources */, 1AAF584F180E40B9000584C8 /* LocalStorage.cpp in Sources */, 1AAF5853180E40B9000584C8 /* LocalStorageAndroid.cpp in Sources */, @@ -6538,6 +6557,7 @@ 296CAD291915EC9900C64FBF /* CCEventListenerFocus.cpp in Sources */, 1A01C69918F57BE800EFE3A6 /* CCSet.cpp in Sources */, 1A01C69D18F57BE800EFE3A6 /* CCString.cpp in Sources */, + 2928C2011923756F00E77353 /* CCLayoutExecutant.cpp in Sources */, 2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */, 2AC795E318628746005EC8E1 /* SkeletonBounds.cpp in Sources */, 2AC795E418628746005EC8E1 /* Event.cpp in Sources */, diff --git a/cocos/ui/CCLayoutExecutant.cpp b/cocos/ui/CCLayoutExecutant.cpp new file mode 100644 index 0000000000..79880c95c1 --- /dev/null +++ b/cocos/ui/CCLayoutExecutant.cpp @@ -0,0 +1,519 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "CCLayoutExecutant.h" +#include "UIWidget.h" + +NS_CC_BEGIN + +namespace ui { + +LayoutExecutant* LayoutExecutant::create() +{ + LayoutExecutant* exe = new LayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +LinearVerticalLayoutExecutant* LinearVerticalLayoutExecutant::create() +{ + LinearVerticalLayoutExecutant* exe = new LinearVerticalLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +LinearHorizontalLayoutExecutant* LinearHorizontalLayoutExecutant::create() +{ + LinearHorizontalLayoutExecutant* exe = new LinearHorizontalLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +RelativeLayoutExecutant* RelativeLayoutExecutant::create() +{ + RelativeLayoutExecutant* exe = new RelativeLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +void LinearVerticalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + float topBoundary = layoutSize.height; + + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + + if (layoutParameter) + { + LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); + Vector2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + float finalPosX = ap.x * cs.width; + float finalPosY = topBoundary - ((1.0f-ap.y) * cs.height); + switch (childGravity) + { + case LinearLayoutParameter::LinearGravity::NONE: + case LinearLayoutParameter::LinearGravity::LEFT: + break; + case LinearLayoutParameter::LinearGravity::RIGHT: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + break; + case LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL: + finalPosX = layoutSize.width / 2.0f - cs.width * (0.5f-ap.x); + break; + default: + break; + } + Margin mg = layoutParameter->getMargin(); + finalPosX += mg.left; + finalPosY -= mg.top; + child->setPosition(Vector2(finalPosX, finalPosY)); + topBoundary = child->getBottomInParent() - mg.bottom; + } + } + } +} + +void LinearHorizontalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + float leftBoundary = 0.0f; + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + if (layoutParameter) + { + LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); + Vector2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + float finalPosX = leftBoundary + (ap.x * cs.width); + float finalPosY = layoutSize.height - (1.0f - ap.y) * cs.height; + switch (childGravity) + { + case LinearLayoutParameter::LinearGravity::NONE: + case LinearLayoutParameter::LinearGravity::TOP: + break; + case LinearLayoutParameter::LinearGravity::BOTTOM: + finalPosY = ap.y * cs.height; + break; + case LinearLayoutParameter::LinearGravity::CENTER_VERTICAL: + finalPosY = layoutSize.height / 2.0f - cs.height * (0.5f - ap.y); + break; + default: + break; + } + Margin mg = layoutParameter->getMargin(); + finalPosX += mg.left; + finalPosY -= mg.top; + child->setPosition(Vector2(finalPosX, finalPosY)); + leftBoundary = child->getRightInParent() + mg.right; + } + } + } +} + +void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + ssize_t unlayoutChildCount = 0; + Vector widgetChildren; + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + layoutParameter->_put = false; + unlayoutChildCount++; + widgetChildren.pushBack(child); + } + } + while (unlayoutChildCount > 0) + { + for (auto& subWidget : widgetChildren) + { + Widget* child = static_cast(subWidget); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + + if (layoutParameter) + { + if (layoutParameter->_put) + { + continue; + } + Vector2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign(); + const std::string relativeName = layoutParameter->getRelativeToWidgetName(); + Widget* relativeWidget = nullptr; + RelativeLayoutParameter* relativeWidgetLP = nullptr; + float finalPosX = 0.0f; + float finalPosY = 0.0f; + if (!relativeName.empty()) + { + for (auto& sWidget : widgetChildren) + { + if (sWidget) + { + RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) + { + relativeWidget = sWidget; + relativeWidgetLP = rlayoutParameter; + break; + } + } + } + } + switch (align) + { + case RelativeLayoutParameter::RelativeAlign::NONE: + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: + finalPosX = ap.x * cs.width; + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: + finalPosX = ap.x * cs.width; + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: + finalPosX = ap.x * cs.width; + finalPosY = ap.y * cs.height; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = ap.y * cs.height; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = ap.y * cs.height; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getTopInParent(); + float locationLeft = relativeWidget->getLeftInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationBottom = relativeWidget->getTopInParent(); + + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getTopInParent(); + float locationRight = relativeWidget->getRightInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getTopInParent(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + + finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getBottomInParent(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getTopInParent(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosX = locationLeft + ap.x * cs.width; + + finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getBottomInParent(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getBottomInParent(); + float locationLeft = relativeWidget->getLeftInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationTop = relativeWidget->getBottomInParent(); + + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getBottomInParent(); + float locationRight = relativeWidget->getRightInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + default: + break; + } + Margin relativeWidgetMargin; + Margin mg = layoutParameter->getMargin(); + if (relativeWidgetLP) + { + relativeWidgetMargin = relativeWidgetLP->getMargin(); + } + //handle margin + switch (align) + { + case RelativeLayoutParameter::RelativeAlign::NONE: + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: + finalPosX += mg.left; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: + finalPosX -= mg.right; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: + finalPosX += mg.left; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: + finalPosX -= mg.right; + finalPosY += mg.bottom; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: + finalPosY += mg.bottom; + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: + finalPosY += mg.bottom; + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: + finalPosY += mg.bottom; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: + finalPosX -= mg.right; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: + finalPosX -= mg.right; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: + finalPosX -= mg.right; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: + finalPosX += mg.left; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: + finalPosX += mg.left; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: + finalPosX += mg.left; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: + finalPosY -= mg.top; + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: + finalPosY -= mg.top; + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: + finalPosY -= mg.top; + break; + default: + break; + } + child->setPosition(Vector2(finalPosX, finalPosY)); + layoutParameter->_put = true; + unlayoutChildCount--; + } + } + } + widgetChildren.clear(); +} + +} + +NS_CC_END \ No newline at end of file diff --git a/cocos/ui/CCLayoutExecutant.h b/cocos/ui/CCLayoutExecutant.h new file mode 100644 index 0000000000..7f7bfc550e --- /dev/null +++ b/cocos/ui/CCLayoutExecutant.h @@ -0,0 +1,74 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + 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 __cocos2d_libs__CCLayoutExecutant__ +#define __cocos2d_libs__CCLayoutExecutant__ + +#include "2d/CCNode.h" + +NS_CC_BEGIN + +namespace ui { + +class LayoutExecutant : public Ref +{ +public: + LayoutExecutant(){}; + virtual ~LayoutExecutant(){}; + static LayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container){}; +}; + +class LinearVerticalLayoutExecutant : public LayoutExecutant +{ +public: + LinearVerticalLayoutExecutant(){}; + virtual ~LinearVerticalLayoutExecutant(){}; + static LinearVerticalLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + +class LinearHorizontalLayoutExecutant : public LayoutExecutant +{ +public: + LinearHorizontalLayoutExecutant(){}; + virtual ~LinearHorizontalLayoutExecutant(){}; + static LinearHorizontalLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + +class RelativeLayoutExecutant : public LayoutExecutant +{ +public: + RelativeLayoutExecutant(){}; + virtual ~RelativeLayoutExecutant(){}; + static RelativeLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + + +} + +NS_CC_END +#endif /* defined(__cocos2d_libs__CCLayoutExecutant__) */ diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 22a7f8fed2..04cc40a082 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -37,527 +37,6 @@ NS_CC_BEGIN namespace ui { -class LayoutExecutant : public Ref -{ -public: - LayoutExecutant(){}; - virtual ~LayoutExecutant(){}; - static LayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container){}; -}; - -class LinearVerticalLayoutExecutant : public LayoutExecutant -{ -public: - LinearVerticalLayoutExecutant(){}; - virtual ~LinearVerticalLayoutExecutant(){}; - static LinearVerticalLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); -}; - -class LinearHorizontalLayoutExecutant : public LayoutExecutant -{ -public: - LinearHorizontalLayoutExecutant(){}; - virtual ~LinearHorizontalLayoutExecutant(){}; - static LinearHorizontalLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); -}; - -class RelativeLayoutExecutant : public LayoutExecutant -{ -public: - RelativeLayoutExecutant(){}; - virtual ~RelativeLayoutExecutant(){}; - static RelativeLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); -}; - -LayoutExecutant* LayoutExecutant::create() -{ - LayoutExecutant* exe = new LayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -LinearVerticalLayoutExecutant* LinearVerticalLayoutExecutant::create() -{ - LinearVerticalLayoutExecutant* exe = new LinearVerticalLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -LinearHorizontalLayoutExecutant* LinearHorizontalLayoutExecutant::create() -{ - LinearHorizontalLayoutExecutant* exe = new LinearHorizontalLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -RelativeLayoutExecutant* RelativeLayoutExecutant::create() -{ - RelativeLayoutExecutant* exe = new RelativeLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -void LinearVerticalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) -{ - float topBoundary = layoutSize.height; - - for (auto& subWidget : container) - { - Widget* child = dynamic_cast(subWidget); - if (child) - { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); - - if (layoutParameter) - { - LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); - Vector2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); - float finalPosX = ap.x * cs.width; - float finalPosY = topBoundary - ((1.0f-ap.y) * cs.height); - switch (childGravity) - { - case LinearLayoutParameter::LinearGravity::NONE: - case LinearLayoutParameter::LinearGravity::LEFT: - break; - case LinearLayoutParameter::LinearGravity::RIGHT: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - break; - case LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL: - finalPosX = layoutSize.width / 2.0f - cs.width * (0.5f-ap.x); - break; - default: - break; - } - Margin mg = layoutParameter->getMargin(); - finalPosX += mg.left; - finalPosY -= mg.top; - child->setPosition(Vector2(finalPosX, finalPosY)); - topBoundary = child->getBottomInParent() - mg.bottom; - } - } - } -} - -void LinearHorizontalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) -{ - float leftBoundary = 0.0f; - for (auto& subWidget : container) - { - Widget* child = dynamic_cast(subWidget); - if (child) - { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); - if (layoutParameter) - { - LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); - Vector2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); - float finalPosX = leftBoundary + (ap.x * cs.width); - float finalPosY = layoutSize.height - (1.0f - ap.y) * cs.height; - switch (childGravity) - { - case LinearLayoutParameter::LinearGravity::NONE: - case LinearLayoutParameter::LinearGravity::TOP: - break; - case LinearLayoutParameter::LinearGravity::BOTTOM: - finalPosY = ap.y * cs.height; - break; - case LinearLayoutParameter::LinearGravity::CENTER_VERTICAL: - finalPosY = layoutSize.height / 2.0f - cs.height * (0.5f - ap.y); - break; - default: - break; - } - Margin mg = layoutParameter->getMargin(); - finalPosX += mg.left; - finalPosY -= mg.top; - child->setPosition(Vector2(finalPosX, finalPosY)); - leftBoundary = child->getRightInParent() + mg.right; - } - } - } -} - -void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) -{ - ssize_t unlayoutChildCount = 0; - Vector widgetChildren; - for (auto& subWidget : container) - { - Widget* child = dynamic_cast(subWidget); - if (child) - { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); - layoutParameter->_put = false; - unlayoutChildCount++; - widgetChildren.pushBack(child); - } - } - while (unlayoutChildCount > 0) - { - for (auto& subWidget : widgetChildren) - { - Widget* child = static_cast(subWidget); - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); - - if (layoutParameter) - { - if (layoutParameter->_put) - { - continue; - } - Vector2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); - RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign(); - const std::string relativeName = layoutParameter->getRelativeToWidgetName(); - Widget* relativeWidget = nullptr; - RelativeLayoutParameter* relativeWidgetLP = nullptr; - float finalPosX = 0.0f; - float finalPosY = 0.0f; - if (!relativeName.empty()) - { - for (auto& sWidget : widgetChildren) - { - if (sWidget) - { - RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE)); - if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) - { - relativeWidget = sWidget; - relativeWidgetLP = rlayoutParameter; - break; - } - } - } - } - switch (align) - { - case RelativeLayoutParameter::RelativeAlign::NONE: - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: - finalPosX = ap.x * cs.width; - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: - finalPosX = ap.x * cs.width; - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: - finalPosX = ap.x * cs.width; - finalPosY = ap.y * cs.height; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = ap.y * cs.height; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = ap.y * cs.height; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getTopInParent(); - float locationLeft = relativeWidget->getLeftInParent(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationBottom = relativeWidget->getTopInParent(); - - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getTopInParent(); - float locationRight = relativeWidget->getRightInParent(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopInParent(); - float locationRight = relativeWidget->getLeftInParent(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationRight = relativeWidget->getLeftInParent(); - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - - finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomInParent(); - float locationRight = relativeWidget->getLeftInParent(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopInParent(); - float locationLeft = relativeWidget->getRightInParent(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationLeft = relativeWidget->getRightInParent(); - finalPosX = locationLeft + ap.x * cs.width; - - finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomInParent(); - float locationLeft = relativeWidget->getRightInParent(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getBottomInParent(); - float locationLeft = relativeWidget->getLeftInParent(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationTop = relativeWidget->getBottomInParent(); - - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getBottomInParent(); - float locationRight = relativeWidget->getRightInParent(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - default: - break; - } - Margin relativeWidgetMargin; - Margin mg = layoutParameter->getMargin(); - if (relativeWidgetLP) - { - relativeWidgetMargin = relativeWidgetLP->getMargin(); - } - //handle margin - switch (align) - { - case RelativeLayoutParameter::RelativeAlign::NONE: - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: - finalPosX += mg.left; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: - finalPosX -= mg.right; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: - finalPosX += mg.left; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: - finalPosX -= mg.right; - finalPosY += mg.bottom; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: - finalPosY += mg.bottom; - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: - finalPosY += mg.bottom; - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: - finalPosY += mg.bottom; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: - finalPosX -= mg.right; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: - finalPosX -= mg.right; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: - finalPosX -= mg.right; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: - finalPosX += mg.left; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: - finalPosX += mg.left; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: - finalPosX += mg.left; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: - finalPosY -= mg.top; - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: - finalPosY -= mg.top; - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: - finalPosY -= mg.top; - break; - default: - break; - } - child->setPosition(Vector2(finalPosX, finalPosY)); - layoutParameter->_put = true; - unlayoutChildCount--; - } - } - } - widgetChildren.clear(); -} - static const int BACKGROUNDIMAGE_Z = (-1); static const int BCAKGROUNDCOLORRENDERER_Z = (-2); From 967c071c68319c6e3e08b00e6d330721376a937e Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 14 May 2014 18:24:23 +0800 Subject: [PATCH 05/90] issue #5183, refator LayoutExecutant --- build/cocos2d_libs.xcodeproj/project.pbxproj | 24 +++++----- cocos/ui/UILayout.cpp | 33 +++----------- cocos/ui/UILayout.h | 5 +-- ...outExecutant.cpp => UILayoutExecutant.cpp} | 45 +++++++++++++------ ...CLayoutExecutant.h => UILayoutExecutant.h} | 18 ++++++-- 5 files changed, 67 insertions(+), 58 deletions(-) rename cocos/ui/{CCLayoutExecutant.cpp => UILayoutExecutant.cpp} (96%) rename cocos/ui/{CCLayoutExecutant.h => UILayoutExecutant.h} (87%) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 7a11d71992..19972114db 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1039,10 +1039,10 @@ 2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA1318CF08D100240AA3 /* UIWidget.cpp */; }; 2905FA8E18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; 2905FA8F18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; - 2928C2001923756F00E77353 /* CCLayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */; }; - 2928C2011923756F00E77353 /* CCLayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */; }; - 2928C2021923756F00E77353 /* CCLayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */; }; - 2928C2031923756F00E77353 /* CCLayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */; }; + 2928C2001923756F00E77353 /* UILayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* UILayoutExecutant.cpp */; }; + 2928C2011923756F00E77353 /* UILayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2928C1FE1923756F00E77353 /* UILayoutExecutant.cpp */; }; + 2928C2021923756F00E77353 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* UILayoutExecutant.h */; }; + 2928C2031923756F00E77353 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 2928C1FF1923756F00E77353 /* UILayoutExecutant.h */; }; 296CAD221915EC8000C64FBF /* CCEventFocus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */; }; 296CAD231915EC8000C64FBF /* CCEventFocus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */; }; 296CAD241915EC8000C64FBF /* CCEventFocus.h in Headers */ = {isa = PBXBuildFile; fileRef = 296CAD211915EC8000C64FBF /* CCEventFocus.h */; }; @@ -2269,8 +2269,8 @@ 2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = ""; }; 2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = ""; }; 29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = ""; }; - 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayoutExecutant.cpp; sourceTree = ""; }; - 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayoutExecutant.h; sourceTree = ""; }; + 2928C1FE1923756F00E77353 /* UILayoutExecutant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutExecutant.cpp; sourceTree = ""; }; + 2928C1FF1923756F00E77353 /* UILayoutExecutant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutExecutant.h; sourceTree = ""; }; 296CAD201915EC8000C64FBF /* CCEventFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventFocus.cpp; path = ../base/CCEventFocus.cpp; sourceTree = ""; }; 296CAD211915EC8000C64FBF /* CCEventFocus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEventFocus.h; path = ../base/CCEventFocus.h; sourceTree = ""; }; 296CAD261915EC9900C64FBF /* CCEventListenerFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventListenerFocus.cpp; path = ../base/CCEventListenerFocus.cpp; sourceTree = ""; }; @@ -4024,8 +4024,8 @@ 2905F9F918CF08D000240AA3 /* UILayout.h */, 2905F9FC18CF08D000240AA3 /* UILayoutParameter.cpp */, 2905F9FD18CF08D000240AA3 /* UILayoutParameter.h */, - 2928C1FE1923756F00E77353 /* CCLayoutExecutant.cpp */, - 2928C1FF1923756F00E77353 /* CCLayoutExecutant.h */, + 2928C1FE1923756F00E77353 /* UILayoutExecutant.cpp */, + 2928C1FF1923756F00E77353 /* UILayoutExecutant.h */, ); name = Layout; sourceTree = ""; @@ -4947,7 +4947,7 @@ 2905FA6018CF08D100240AA3 /* UILayoutParameter.h in Headers */, 1ABA68B01888D700007D1BB4 /* CCFontCharMap.h in Headers */, 5034CA3F191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */, - 2928C2021923756F00E77353 /* CCLayoutExecutant.h in Headers */, + 2928C2021923756F00E77353 /* UILayoutExecutant.h in Headers */, 500DC8B419105D41007B91BF /* CCGroupCommand.h in Headers */, 500DC8D319105F7D007B91BF /* CCAffineTransform.h in Headers */, 46A170191807CBFC005B8026 /* CCCommon.h in Headers */, @@ -5546,7 +5546,7 @@ 1A5701FE180BCBAD0088DEC7 /* CCMenuItem.h in Headers */, 1A570205180BCBD40088DEC7 /* CCClippingNode.h in Headers */, 5034CA34191D591100CE6051 /* ccShader_PositionTexture_uColor.frag in Headers */, - 2928C2031923756F00E77353 /* CCLayoutExecutant.h in Headers */, + 2928C2031923756F00E77353 /* UILayoutExecutant.h in Headers */, 1A57020B180BCBDF0088DEC7 /* CCMotionStreak.h in Headers */, 1A570213180BCBF40088DEC7 /* CCProgressTimer.h in Headers */, B37510821823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.h in Headers */, @@ -6354,7 +6354,7 @@ 1AAF536A180E3374000584C8 /* HttpClient.cpp in Sources */, 1AAF5372180E3374000584C8 /* SocketIO.cpp in Sources */, 1AAF5376180E3374000584C8 /* WebSocket.cpp in Sources */, - 2928C2001923756F00E77353 /* CCLayoutExecutant.cpp in Sources */, + 2928C2001923756F00E77353 /* UILayoutExecutant.cpp in Sources */, 1A01C69818F57BE800EFE3A6 /* CCSet.cpp in Sources */, 1AAF584F180E40B9000584C8 /* LocalStorage.cpp in Sources */, 1AAF5853180E40B9000584C8 /* LocalStorageAndroid.cpp in Sources */, @@ -6557,7 +6557,7 @@ 296CAD291915EC9900C64FBF /* CCEventListenerFocus.cpp in Sources */, 1A01C69918F57BE800EFE3A6 /* CCSet.cpp in Sources */, 1A01C69D18F57BE800EFE3A6 /* CCString.cpp in Sources */, - 2928C2011923756F00E77353 /* CCLayoutExecutant.cpp in Sources */, + 2928C2011923756F00E77353 /* UILayoutExecutant.cpp in Sources */, 2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */, 2AC795E318628746005EC8E1 /* SkeletonBounds.cpp in Sources */, 2AC795E418628746005EC8E1 /* Event.cpp in Sources */, diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 04cc40a082..ba95dc147e 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -32,6 +32,7 @@ THE SOFTWARE. #include "renderer/CCRenderer.h" #include "renderer/CCGroupCommand.h" #include "renderer/CCCustomCommand.h" +#include "ui/UILayoutExecutant.h" NS_CC_BEGIN @@ -83,7 +84,6 @@ _currentAlphaTestFunc(GL_ALWAYS), _currentAlphaTestRef(1), _backGroundImageColor(Color3B::WHITE), _backGroundImageOpacity(255), -_curLayoutExecutant(nullptr), _passFocusToChild(true), _loopFocus(false) { @@ -94,7 +94,6 @@ _loopFocus(false) Layout::~Layout() { CC_SAFE_RELEASE(_clippingStencil); - CC_SAFE_RELEASE(_curLayoutExecutant); } void Layout::onEnter() @@ -906,9 +905,7 @@ const Size& Layout::getBackGroundImageTextureSize() const void Layout::setLayoutType(Type type) { _layoutType = type; - CC_SAFE_RELEASE_NULL(_curLayoutExecutant); - _curLayoutExecutant = createCurrentLayoutExecutant(); - CC_SAFE_RETAIN(_curLayoutExecutant); + for (auto& child : _children) { Widget* widgetChild = dynamic_cast(child); @@ -920,25 +917,7 @@ void Layout::setLayoutType(Type type) _doLayoutDirty = true; } -LayoutExecutant* Layout::createCurrentLayoutExecutant() -{ - LayoutExecutant* exe = nullptr; - switch (_layoutType) - { - case Type::VERTICAL: - exe = LinearVerticalLayoutExecutant::create(); - break; - case Type::HORIZONTAL: - exe = LinearHorizontalLayoutExecutant::create(); - break; - case Type::RELATIVE: - exe = RelativeLayoutExecutant::create(); - break; - default: - break; - } - return exe; -} + Layout::Type Layout::getLayoutType() const { @@ -956,10 +935,12 @@ void Layout::doLayout() { return; } - if (_curLayoutExecutant) + LayoutExecutant* executant = LayoutExecutantFactory::getInstance()->createExecutant(_layoutType); + if (executant) { - _curLayoutExecutant->doLayout(getSize(), getChildren()); + executant->doLayout(getSize(), getChildren()); } + _doLayoutDirty = false; } diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index 2a1e63d7e0..ac4c7f9c6f 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -35,7 +35,6 @@ namespace ui { * @js NA * @lua NA */ -class LayoutExecutant; class Layout : public Widget { @@ -313,6 +312,7 @@ protected: void setStencilClippingSize(const Size& size); const Rect& getClippingRect(); + virtual void doLayout(); //clipping @@ -325,7 +325,6 @@ protected: void updateBackGroundImageColor(); void updateBackGroundImageOpacity(); void updateBackGroundImageRGBA(); - LayoutExecutant* createCurrentLayoutExecutant(); /** *get the content size of the layout, it will accumulate all its children's content size @@ -477,8 +476,6 @@ protected: Color3B _backGroundImageColor; GLubyte _backGroundImageOpacity; - LayoutExecutant* _curLayoutExecutant; - GLint _mask_layer_le; GroupCommand _groupCommand; CustomCommand _beforeVisitCmdStencil; diff --git a/cocos/ui/CCLayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp similarity index 96% rename from cocos/ui/CCLayoutExecutant.cpp rename to cocos/ui/UILayoutExecutant.cpp index 79880c95c1..26e23cf6e1 100644 --- a/cocos/ui/CCLayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -22,24 +22,12 @@ THE SOFTWARE. ****************************************************************************/ -#include "CCLayoutExecutant.h" +#include "UILayoutExecutant.h" #include "UIWidget.h" NS_CC_BEGIN namespace ui { - -LayoutExecutant* LayoutExecutant::create() -{ - LayoutExecutant* exe = new LayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} LinearVerticalLayoutExecutant* LinearVerticalLayoutExecutant::create() { @@ -514,6 +502,37 @@ void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container){}; + + virtual void doLayout(const Size& layoutSize, Vector container) = 0; }; class LinearVerticalLayoutExecutant : public LayoutExecutant @@ -67,6 +67,18 @@ public: virtual void doLayout(const Size& layoutSize, Vector container); }; + +class LayoutExecutantFactory +{ +public: + static LayoutExecutantFactory* getInstance(); + LayoutExecutant* createExecutant(Layout::Type type); +private: + LayoutExecutantFactory(){} + CC_DISALLOW_COPY_AND_ASSIGN(LayoutExecutantFactory); + + static LayoutExecutantFactory *_instance; +}; } From 6fcef92708e41a41884cd55b0d7bbb4bca575e28 Mon Sep 17 00:00:00 2001 From: zifter Date: Wed, 14 May 2014 19:13:14 +0300 Subject: [PATCH 06/90] Fix Progress Action. --- cocos/2d/CCActionProgressTimer.cpp | 7 ------- .../ActionsProgressTest.cpp | 20 +++++++++---------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/cocos/2d/CCActionProgressTimer.cpp b/cocos/2d/CCActionProgressTimer.cpp index 68b87fe6d2..0ad0558e90 100644 --- a/cocos/2d/CCActionProgressTimer.cpp +++ b/cocos/2d/CCActionProgressTimer.cpp @@ -72,13 +72,6 @@ void ProgressTo::startWithTarget(Node *target) { ActionInterval::startWithTarget(target); _from = ((kProgressTimerCast)(target))->getPercentage(); - - // XXX: Is this correct ? - // Adding it to support Repeat - if (_from == 100) - { - _from = 0; - } } void ProgressTo::update(float time) diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 750f886b38..813c11b21b 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -157,8 +157,8 @@ void SpriteProgressToRadial::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to1 = ProgressTo::create(2, 100); - auto to2 = ProgressTo::create(2, 100); + auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); + auto to2 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType( ProgressTimer::Type::RADIAL ); @@ -192,8 +192,8 @@ void SpriteProgressToHorizontal::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to1 = ProgressTo::create(2, 100); - auto to2 = ProgressTo::create(2, 100); + auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); + auto to2 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); @@ -232,8 +232,8 @@ void SpriteProgressToVertical::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to1 = ProgressTo::create(2, 100); - auto to2 = ProgressTo::create(2, 100); + auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); + auto to2 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); @@ -273,7 +273,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter() auto s = Director::getInstance()->getWinSize(); - auto action = ProgressTo::create(2, 100); + auto action = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); /** * Our image on the left should be a radial progress indicator, clockwise @@ -317,7 +317,7 @@ void SpriteProgressBarVarious::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to = ProgressTo::create(2, 100); + auto to = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); @@ -367,7 +367,7 @@ void SpriteProgressBarTintAndFade::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to = ProgressTo::create(6, 100); + auto to = Sequence::createWithTwoActions(ProgressTo::create(6, 100), ProgressTo::create(0, 0)); auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), @@ -434,7 +434,7 @@ void SpriteProgressWithSpriteFrame::onEnter() auto s = Director::getInstance()->getWinSize(); - auto to = ProgressTo::create(6, 100); + auto to = Sequence::createWithTwoActions(ProgressTo::create(6, 100), ProgressTo::create(0, 0)); SpriteFrameCache::getInstance()->addSpriteFramesWithFile("zwoptex/grossini.plist"); From 0639e49031051ab2c4bc776189fdbbd083a4d1f9 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 15 May 2014 10:07:42 +0800 Subject: [PATCH 07/90] issue #5183, add LayoutProtocol --- cocos/ui/UILayout.cpp | 15 ++++++++++-- cocos/ui/UILayout.h | 18 +++++++++++++- cocos/ui/UILayoutExecutant.cpp | 45 ++++++++-------------------------- cocos/ui/UILayoutExecutant.h | 25 ++++++------------- cocos/ui/UIScrollView.cpp | 14 +---------- cocos/ui/UIScrollView.h | 1 - cocos/ui/UIWidget.cpp | 2 +- cocos/ui/UIWidget.h | 2 +- 8 files changed, 50 insertions(+), 72 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index ba95dc147e..e7c881b2df 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -928,6 +928,16 @@ void Layout::requestDoLayout() { _doLayoutDirty = true; } + +const Size Layout::getLayoutSize() +{ + return this->getSize(); +} + +const Vector& Layout::getLayoutChildren() +{ + return this->getChildren(); +} void Layout::doLayout() { @@ -935,10 +945,11 @@ void Layout::doLayout() { return; } - LayoutExecutant* executant = LayoutExecutantFactory::getInstance()->createExecutant(_layoutType); + LayoutExecutant* executant = this->createLayoutExecutant(); + if (executant) { - executant->doLayout(getSize(), getChildren()); + executant->doLayout(this); } _doLayoutDirty = false; diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index ac4c7f9c6f..de62fcb4c3 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -30,13 +30,26 @@ THE SOFTWARE. NS_CC_BEGIN namespace ui { + +class LayoutExecutant; + +class LayoutProtocol +{ +public: + LayoutProtocol(){} + virtual ~LayoutProtocol(){} + + virtual LayoutExecutant* createLayoutExecutant() = 0; + virtual const Size getLayoutSize() = 0; + virtual const Vector& getLayoutChildren() = 0; +}; /** * @js NA * @lua NA */ -class Layout : public Widget +class Layout : public Widget, public LayoutProtocol { DECLARE_CLASS_GUI_INFO @@ -314,6 +327,9 @@ protected: const Rect& getClippingRect(); virtual void doLayout(); + virtual LayoutExecutant* createLayoutExecutant(); + virtual const Size getLayoutSize(); + virtual const Vector& getLayoutChildren() ; //clipping void onBeforeVisitStencil(); diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index 26e23cf6e1..32d70473ed 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -23,7 +23,7 @@ ****************************************************************************/ #include "UILayoutExecutant.h" -#include "UIWidget.h" +#include "UILayout.h" NS_CC_BEGIN @@ -65,8 +65,10 @@ RelativeLayoutExecutant* RelativeLayoutExecutant::create() return nullptr; } -void LinearVerticalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) { + Size layoutSize = layout->getLayoutSize(); + Vector container = layout->getLayoutChildren(); float topBoundary = layoutSize.height; for (auto& subWidget : container) @@ -107,8 +109,10 @@ void LinearVerticalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Ve } } -void LinearHorizontalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) { + Size layoutSize = layout->getLayoutSize(); + Vector container = layout->getLayoutChildren(); float leftBoundary = 0.0f; for (auto& subWidget : container) { @@ -147,8 +151,10 @@ void LinearHorizontalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, } } -void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { + Size layoutSize = layout->getLayoutSize(); + Vector container = layout->getLayoutChildren(); ssize_t unlayoutChildCount = 0; Vector widgetChildren; for (auto& subWidget : container) @@ -502,37 +508,6 @@ void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) = 0; + virtual void doLayout(LayoutProtocol *layout) = 0; }; class LinearVerticalLayoutExecutant : public LayoutExecutant @@ -46,7 +48,7 @@ public: LinearVerticalLayoutExecutant(){}; virtual ~LinearVerticalLayoutExecutant(){}; static LinearVerticalLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); + virtual void doLayout(LayoutProtocol *layout) override; }; class LinearHorizontalLayoutExecutant : public LayoutExecutant @@ -55,7 +57,7 @@ public: LinearHorizontalLayoutExecutant(){}; virtual ~LinearHorizontalLayoutExecutant(){}; static LinearHorizontalLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); + virtual void doLayout(LayoutProtocol *layout) override; }; class RelativeLayoutExecutant : public LayoutExecutant @@ -64,20 +66,7 @@ public: RelativeLayoutExecutant(){}; virtual ~RelativeLayoutExecutant(){}; static RelativeLayoutExecutant* create(); - virtual void doLayout(const Size& layoutSize, Vector container); -}; - - -class LayoutExecutantFactory -{ -public: - static LayoutExecutantFactory* getInstance(); - LayoutExecutant* createExecutant(Layout::Type type); -private: - LayoutExecutantFactory(){} - CC_DISALLOW_COPY_AND_ASSIGN(LayoutExecutantFactory); - - static LayoutExecutantFactory *_instance; + virtual void doLayout(LayoutProtocol *layout) override; }; } diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 6a54a07c45..a81ccf0279 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -49,19 +49,7 @@ ScrollInnerContainer* ScrollInnerContainer::create() 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; diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 62da6e45ee..2554bfe83f 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -38,7 +38,6 @@ public: ScrollInnerContainer(); virtual ~ScrollInnerContainer(); static ScrollInnerContainer* create(); - virtual const Size& getLayoutSize() override; }; CC_DEPRECATED_ATTRIBUTE typedef enum diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 7129ccdbf1..a58fc0cafe 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -257,7 +257,7 @@ void Widget::updateSizeAndPosition() Size pSize; if (widgetParent) { - pSize = widgetParent->getLayoutSize(); + pSize = widgetParent->getSize(); } else { diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 7dce8f4e45..fe8fbb7c07 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -440,7 +440,7 @@ public: const Size& getCustomSize() const; - virtual const Size& getLayoutSize() {return _size;}; + //virtual const Size& getLayoutSize() {return _size;}; /** * Returns size percent of widget From 5697d2417a97780e71cb6d2e3a28a94c96eb4737 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 15 May 2014 10:23:25 +0800 Subject: [PATCH 08/90] issue #5183, done --- cocos/ui/UILayout.cpp | 21 +++++++++++++++++++++ cocos/ui/UILayout.h | 9 +++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index e7c881b2df..b8054954ac 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -938,6 +938,27 @@ const Vector& Layout::getLayoutChildren() { return this->getChildren(); } + +LayoutExecutant* Layout::createLayoutExecutant() +{ + LayoutExecutant* exe = nullptr; + switch (_layoutType) + { + case Layout::Type::VERTICAL: + exe = LinearVerticalLayoutExecutant::create(); + break; + case Layout::Type::HORIZONTAL: + exe = LinearHorizontalLayoutExecutant::create(); + break; + case Layout::Type::RELATIVE: + exe = RelativeLayoutExecutant::create(); + break; + default: + break; + } + return exe; + +} void Layout::doLayout() { diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index de62fcb4c3..cb37fc7a5b 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -42,6 +42,7 @@ public: virtual LayoutExecutant* createLayoutExecutant() = 0; virtual const Size getLayoutSize() = 0; virtual const Vector& getLayoutChildren() = 0; + virtual void doLayout() = 0; }; /** @@ -326,10 +327,10 @@ protected: void setStencilClippingSize(const Size& size); const Rect& getClippingRect(); - virtual void doLayout(); - virtual LayoutExecutant* createLayoutExecutant(); - virtual const Size getLayoutSize(); - virtual const Vector& getLayoutChildren() ; + virtual void doLayout()override; + virtual LayoutExecutant* createLayoutExecutant()override; + virtual const Size getLayoutSize()override; + virtual const Vector& getLayoutChildren() override; //clipping void onBeforeVisitStencil(); From b32ca246e7e6b6ef277e67a953a210eefef07898 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 15 May 2014 10:44:19 +0800 Subject: [PATCH 09/90] issue #5183, done --- cocos/ui/UILayout.cpp | 6 +++--- cocos/ui/UILayoutExecutant.cpp | 20 ++++++++++---------- cocos/ui/UILayoutParameter.h | 9 +++++++++ cocos/ui/UIListView.cpp | 4 ++-- cocos/ui/UIWidget.cpp | 23 ++++++++++++----------- cocos/ui/UIWidget.h | 7 ++++--- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index b8054954ac..fecdb15d01 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -658,7 +658,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) case Type::HORIZONTAL: case Type::VERTICAL: { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (!layoutParameter) { child->setLayoutParameter(LinearLayoutParameter::create()); @@ -667,7 +667,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) } case Type::RELATIVE: { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (!layoutParameter) { child->setLayoutParameter(RelativeLayoutParameter::create()); @@ -1049,7 +1049,7 @@ Size Layout::getLayoutContentSize()const if (w) { widgetCount++; - Margin m = w->getLayoutParameter(LayoutParameter::Type::LINEAR)->getMargin(); + Margin m = w->getLayoutParameter()->getMargin(); layoutSize = layoutSize + w->getSize() + Size(m.right + m.left, m.top + m.bottom) * 0.5; } } diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index 32d70473ed..7ad6c12557 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -73,16 +73,16 @@ void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) for (auto& subWidget : container) { - Widget* child = dynamic_cast(subWidget); + LayoutParameterProtocol* child = dynamic_cast(subWidget); if (child) { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); - Vector2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); + Vector2 ap = subWidget->getAnchorPoint(); + Size cs = subWidget->getContentSize(); float finalPosX = ap.x * cs.width; float finalPosY = topBoundary - ((1.0f-ap.y) * cs.height); switch (childGravity) @@ -102,8 +102,8 @@ void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) Margin mg = layoutParameter->getMargin(); finalPosX += mg.left; finalPosY -= mg.top; - child->setPosition(Vector2(finalPosX, finalPosY)); - topBoundary = child->getBottomInParent() - mg.bottom; + subWidget->setPosition(Vector2(finalPosX, finalPosY)); + topBoundary = subWidget->getPosition().y - subWidget->getAnchorPoint().y * subWidget->getContentSize().height - mg.bottom; } } } @@ -119,7 +119,7 @@ void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) Widget* child = dynamic_cast(subWidget); if (child) { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); @@ -162,7 +162,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) Widget* child = dynamic_cast(subWidget); if (child) { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); layoutParameter->_put = false; unlayoutChildCount++; widgetChildren.pushBack(child); @@ -173,7 +173,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) for (auto& subWidget : widgetChildren) { Widget* child = static_cast(subWidget); - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { @@ -195,7 +195,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { if (sWidget) { - RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter()); if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) { relativeWidget = sWidget; diff --git a/cocos/ui/UILayoutParameter.h b/cocos/ui/UILayoutParameter.h index da23add993..2760e0208b 100644 --- a/cocos/ui/UILayoutParameter.h +++ b/cocos/ui/UILayoutParameter.h @@ -129,6 +129,15 @@ protected: Margin _margin; Type _layoutParameterType; }; + +class LayoutParameterProtocol +{ +public: + LayoutParameterProtocol(){} + virtual ~LayoutParameterProtocol(){} + + virtual LayoutParameter* getLayoutParameter() = 0; +}; /** diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index 18323fcbb6..62c582b8c3 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -130,7 +130,7 @@ void ListView::remedyLayoutParameter(Widget *item) switch (_direction) { case Direction::VERTICAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); @@ -185,7 +185,7 @@ void ListView::remedyLayoutParameter(Widget *item) } case Direction::HORIZONTAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index a58fc0cafe..fd7fbe7229 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -63,7 +63,8 @@ _opacity(255), _flippedX(false), _flippedY(false), _focused(false), -_focusEnabled(true) +_focusEnabled(true), +_layoutParameter(nullptr) { onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this); onNextFocusedWidget = nullptr; @@ -74,6 +75,8 @@ Widget::~Widget() { setTouchEnabled(false); + CC_SAFE_RELEASE_NULL(_layoutParameter); + //cleanup focused widget if (_focusedWidget == this) { _focusedWidget = nullptr; @@ -791,12 +794,12 @@ bool Widget::isEnabled() const float Widget::getLeftInParent() { - return getPosition().x - getAnchorPoint().x * _size.width;; + return getPosition().x - getAnchorPoint().x * _size.width; } float Widget::getBottomInParent() { - return getPosition().y - getAnchorPoint().y * _size.height;; + return getPosition().y - getAnchorPoint().y * _size.height; } float Widget::getRightInParent() @@ -841,12 +844,14 @@ void Widget::setLayoutParameter(LayoutParameter *parameter) { return; } - _layoutParameterDictionary.insert((int)parameter->getLayoutType(), parameter); + CC_SAFE_RELEASE_NULL(_layoutParameter); + _layoutParameter = parameter; + CC_SAFE_RETAIN(_layoutParameter); } -LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type) +LayoutParameter* Widget::getLayoutParameter() { - return dynamic_cast(_layoutParameterDictionary.at((int)type)); + return _layoutParameter; } std::string Widget::getDescription() const @@ -917,11 +922,7 @@ void Widget::copyProperties(Widget *widget) setColor(widget->getColor()); setOpacity(widget->getOpacity()); //FIXME:copy focus properties, also make sure all the subclass the copy behavior is correct - Map& layoutParameterDic = widget->_layoutParameterDictionary; - for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter) - { - setLayoutParameter(iter->second->clone()); - } + setLayoutParameter(_layoutParameter); onSizeChanged(); } diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index fe8fbb7c07..7f48650f41 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -28,6 +28,7 @@ THE SOFTWARE. #include "ui/CCProtectedNode.h" #include "ui/UILayoutParameter.h" #include "ui/GUIDefine.h" +#include "ui/UILayoutParameter.h" NS_CC_BEGIN @@ -57,7 +58,7 @@ CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType) #endif -class Widget : public ProtectedNode +class Widget : public ProtectedNode, public LayoutParameterProtocol { public: enum class FocusDirection @@ -483,7 +484,7 @@ public: * * @return LayoutParameter */ - LayoutParameter* getLayoutParameter(LayoutParameter::Type type); + LayoutParameter* getLayoutParameter() override; /** * Ignore the widget size @@ -680,7 +681,7 @@ protected: GLubyte _opacity; bool _flippedX; bool _flippedY; - Map _layoutParameterDictionary; + LayoutParameter* _layoutParameter; bool _focused; bool _focusEnabled; From 3f08dd2758606f1ee084a6948821bc07fc548596 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 15 May 2014 10:48:33 +0800 Subject: [PATCH 10/90] issue #5183, remove no needed type --- cocos/ui/UILayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index fecdb15d01..d50e761f6b 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -944,13 +944,13 @@ LayoutExecutant* Layout::createLayoutExecutant() LayoutExecutant* exe = nullptr; switch (_layoutType) { - case Layout::Type::VERTICAL: + case Type::VERTICAL: exe = LinearVerticalLayoutExecutant::create(); break; - case Layout::Type::HORIZONTAL: + case Type::HORIZONTAL: exe = LinearHorizontalLayoutExecutant::create(); break; - case Layout::Type::RELATIVE: + case Type::RELATIVE: exe = RelativeLayoutExecutant::create(); break; default: From b434840bc93d815c687decb880dcafadbce0e3c7 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 16 May 2014 10:33:28 +0800 Subject: [PATCH 11/90] issue #5183, add layout parameter type to widget for convenient access --- cocos/ui/UILayout.cpp | 6 +++--- cocos/ui/UILayoutExecutant.cpp | 10 +++++----- cocos/ui/UILayoutParameter.h | 2 +- cocos/ui/UIListView.cpp | 4 ++-- cocos/ui/UIWidget.cpp | 9 +++++---- cocos/ui/UIWidget.h | 6 ++++-- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index ce40429110..f7ff08967f 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -658,7 +658,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) case Type::HORIZONTAL: case Type::VERTICAL: { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (!layoutParameter) { child->setLayoutParameter(LinearLayoutParameter::create()); @@ -667,7 +667,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) } case Type::RELATIVE: { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (!layoutParameter) { child->setLayoutParameter(RelativeLayoutParameter::create()); @@ -1049,7 +1049,7 @@ Size Layout::getLayoutContentSize()const if (w) { widgetCount++; - Margin m = w->getLayoutParameter(LayoutParameter::Type::LINEAR)->getMargin(); + Margin m = w->getLayoutParameter()->getMargin(); layoutSize = layoutSize + w->getSize() + Size(m.right + m.left, m.top + m.bottom) * 0.5; } } diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index c34711d49d..c8f3a4f343 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -76,7 +76,7 @@ void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) LayoutParameterProtocol* child = dynamic_cast(subWidget); if (child) { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { @@ -119,7 +119,7 @@ void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) Widget* child = dynamic_cast(subWidget); if (child) { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); @@ -162,7 +162,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) Widget* child = dynamic_cast(subWidget); if (child) { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); layoutParameter->_put = false; unlayoutChildCount++; widgetChildren.pushBack(child); @@ -173,7 +173,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) for (auto& subWidget : widgetChildren) { Widget* child = static_cast(subWidget); - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); if (layoutParameter) { @@ -195,7 +195,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { if (sWidget) { - RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter()); if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) { relativeWidget = sWidget; diff --git a/cocos/ui/UILayoutParameter.h b/cocos/ui/UILayoutParameter.h index 6690ac66fc..2760e0208b 100644 --- a/cocos/ui/UILayoutParameter.h +++ b/cocos/ui/UILayoutParameter.h @@ -136,7 +136,7 @@ public: LayoutParameterProtocol(){} virtual ~LayoutParameterProtocol(){} - virtual LayoutParameter* getLayoutParameter(LayoutParameter::Type type) = 0; + virtual LayoutParameter* getLayoutParameter() = 0; }; diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index d61af9d837..417be2299b 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -130,7 +130,7 @@ void ListView::remedyLayoutParameter(Widget *item) switch (_direction) { case Direction::VERTICAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); @@ -185,7 +185,7 @@ void ListView::remedyLayoutParameter(Widget *item) } case Direction::HORIZONTAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index eb70e7211c..3177b493be 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -62,7 +62,8 @@ _opacity(255), _flippedX(false), _flippedY(false), _focused(false), -_focusEnabled(true) +_focusEnabled(true), +_layoutParameterType(LayoutParameter::Type::NONE) { onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this); onNextFocusedWidget = nullptr; @@ -868,12 +869,12 @@ void Widget::setLayoutParameter(LayoutParameter *parameter) return; } _layoutParameterDictionary.insert((int)parameter->getLayoutType(), parameter); - + _layoutParameterType = parameter->getLayoutType(); } -LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type) +LayoutParameter* Widget::getLayoutParameter() { - return dynamic_cast(_layoutParameterDictionary.at((int)type));; + return dynamic_cast(_layoutParameterDictionary.at((int)_layoutParameterType)); } std::string Widget::getDescription() const diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 3a37937581..70b2d1e49e 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -480,7 +480,7 @@ public: * * @return LayoutParameter */ - LayoutParameter* getLayoutParameter(LayoutParameter::Type type) override; + LayoutParameter* getLayoutParameter() override; /** * Ignore the widget size @@ -680,8 +680,10 @@ protected: GLubyte _opacity; bool _flippedX; bool _flippedY; + //use map to enble switch back and forth for user layout parameters Map _layoutParameterDictionary; - + LayoutParameter::Type _layoutParameterType; + bool _focused; bool _focusEnabled; From 6461e26c9f19e9f3c1aaf22cd018d6d3e211b341 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sun, 18 May 2014 14:49:16 -0700 Subject: [PATCH 12/90] Squashed commit of the following: commit 64722e414c6cacc108fa6015d6af84bd9a4d79ec Author: Ricardo Quesada Date: Sun May 18 14:03:53 2014 -0700 More WP8 fixes commit 7934be32741cddee6d04cd4f32c7e9718ba83b4c Merge: c2b1619 fea335f Author: Ricardo Quesada Date: Sun May 18 12:19:41 2014 -0700 Merge branch 'mesh3d' of github.com:ricardoquesada/cocos2d-x into mesh3d commit c2b1619005b5a62ef77afe727429584d6a57010e Author: Ricardo Quesada Date: Sun May 18 12:19:19 2014 -0700 Adds missing resources for Windows Phone 8 commit fea335f573f975d9d2f6eafeb3ad4d3ea8095ee5 Author: Ricardo Quesada Date: Sun May 18 11:54:15 2014 -0700 Updates CHANGELOG commit b8b93da914de97662c9df55cfc351ad8b74ea779 Author: Ricardo Quesada Date: Sun May 18 11:48:59 2014 -0700 Adds Sprite3d files and tests commit 059c842938e19068427bb2276d52f3e0ea1cc51f Author: Ricardo Quesada Date: Sun May 18 11:16:13 2014 -0700 fixes compiler warnings for windows commit d3299f4cf443c9603f9120e431dbcb6ce8b8e26f Author: Ricardo Quesada Date: Sun May 18 10:53:34 2014 -0700 fixes for Sprite3D Adds copyright header removes compilation warnings cleans code a bit commit 1377787a4bcebdf349f9de0a05c329066c6eb626 Merge: f89725f 9a3c2d0 Author: Huabing.Xu Date: Fri May 16 20:46:26 2014 -0700 Merge pull request #34 from dumganhar/pull/6731 fix compilation error of missing bind Mesh for luabindings. commit f89725f65ca604efb9abbcfe336c9d50135016b2 Author: Huabing.Xu Date: Fri May 16 20:45:12 2014 -0700 use const & and changed typo commit 9a3c2d0df9abcd76292cc1f71b6615931aa807d5 Author: James Chen Date: Sat May 17 11:43:10 2014 +0800 fix compilation error of missing bind Mesh for luabindings. commit 59524b3850b27342f3cb4c390751bdf97362a794 Merge: ee4ec94 5c5a6b9 Author: James Chen Date: Sat May 17 11:33:01 2014 +0800 Merge commit 'refs/pull/6731/head' of git://github.com/cocos2d/cocos2d-x into pull/6731 commit 5c5a6b9bde410027db948b539bc3111dc243cf0b Merge: d4285e3 5f41732 Author: Huabing.Xu Date: Fri May 16 20:23:58 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit d4285e336808699f828b82c6b90a83b1b0c0978c Author: Huabing.Xu Date: Fri May 16 20:22:49 2014 -0700 remove empty lines commit 5f4173271101e2411ffb6cbf600066e204df98d3 Merge: e272583 ac8cf25 Author: Huabing.Xu Date: Fri May 16 20:15:44 2014 -0700 Merge pull request #33 from dabingnn/mesh3d_work Mesh3d work commit ac8cf2571d92b03c9632d0415078d08526322289 Author: Huabing.Xu Date: Fri May 16 20:14:01 2014 -0700 added mesh3d file to template commit e272583cb8a7f41d8d74dbf7d7db71584187a779 Merge: 6a1b847 5d3a955 Author: Huabing.Xu Date: Fri May 16 19:10:45 2014 -0700 Merge pull request #32 from dabingnn/mesh3d_work Mesh3d work commit 5d3a95543f66f7ec90bf06e6e1761722b8a33cca Merge: 4feae11 97cae73 Author: Huabing.Xu Date: Fri May 16 18:18:13 2014 -0700 Merge branch 'v3' into mesh3d_work commit 6a1b847065a1b9d369892ab011478c47e80c9195 Merge: 4feae11 4ece4b3 Author: Trace0429 Date: Fri May 16 17:15:39 2014 -0700 Merge pull request #31 from Trace0429/mesh3d_work windows work now commit 4ece4b3255d84f2749298fdbdecc5ad0302c36a3 Author: Trace0429 Date: Sat May 17 08:12:46 2014 +0800 windows work now commit 4feae11577f64c3aff943af51adc37dcb987bdc1 Merge: 510fc0c fdf82d3 Author: Huabing.Xu Date: Fri May 16 16:32:58 2014 -0700 Merge pull request #30 from dabingnn/mesh3d_work Mesh3d work commit fdf82d36d97ab68fdb7bab54241fdd94f18a53eb Author: Huabing.Xu Date: Fri May 16 16:32:00 2014 -0700 fix compile error after merge (MAC can work) commit 4bef832c3f4d5e5f3c19ca36f13ceba9e4ff1dbe Merge: 510fc0c d19de29 Author: Huabing.Xu Date: Fri May 16 16:24:11 2014 -0700 Merge branch 'v3' into mesh3d_work Conflicts: build/cocos2d_libs.xcodeproj/project.pbxproj cocos/2d/cocos2d.vcxproj cocos/2d/cocos2d.vcxproj.filters cocos/Android.mk cocos/CMakeLists.txt cocos/renderer/CMakeLists.txt commit 510fc0cea76bdedfae858bb930d98715ce54f7e9 Merge: e098ed7 7fea347 Author: Huabing.Xu Date: Fri May 16 16:11:39 2014 -0700 Merge pull request #29 from dabingnn/mesh3d_work Mesh3d work commit 7fea34782f30ef0498a7a993016f45fcb786b771 Merge: a8a409a e098ed7 Author: Huabing.Xu Date: Fri May 16 16:08:01 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit a8a409a7d5280b1075eb6258ee556611a5cba7b3 Author: Huabing.Xu Date: Fri May 16 16:05:37 2014 -0700 bind ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER to 0 after draw commit e098ed7a5c187256be8313ec5d66294d3554c914 Author: yangxiao Date: Fri May 16 16:02:27 2014 -0700 bind buffer to 0 when finish draw commit d13f637a3777e81085e0285faf00105c58229d7c Author: yangxiao Date: Fri May 16 14:00:38 2014 -0700 fix outline width commit 8a79c98b163ad862a2e09cbcc19a939f06556358 Merge: e208712 a0cf4ef Author: yangxiao Date: Fri May 16 13:47:17 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit e20871233915f8b6010e59595c38793ec3d6956e Author: yangxiao Date: Fri May 16 13:47:12 2014 -0700 make some member protected commit a0cf4efc48af801636a55d1c330fb6841896d33b Merge: c0b8902 8b723e8 Author: Huabing.Xu Date: Fri May 16 13:06:17 2014 -0700 Merge branch 'mesh3d' of github.com:super626/cocos2d-x into mesh3d commit c0b89021cbbdb13db00b8844aac1f4ff9c90e968 Author: Huabing.Xu Date: Fri May 16 13:04:27 2014 -0700 linux work now commit 8b723e82d81cbffd78e7378cab6d11df30baa044 Author: yangxiao Date: Fri May 16 12:48:34 2014 -0700 inc drawcall commit 5d0b6304b3e5c9bcb2354c3245511706438dc23c Merge: 1e7032b e783da9 Author: yangxiao Date: Fri May 16 12:31:44 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit e783da91fe6c14c8594d3da865e965256376dd10 Merge: 5da20fd 8f7a19a Author: Huabing.Xu Date: Fri May 16 12:31:31 2014 -0700 Merge pull request #28 from dabingnn/mesh3d_work Mesh3d work commit 1e7032b448bc79d76a445258f2b0c5bd6dba5fea Author: yangxiao Date: Fri May 16 12:30:01 2014 -0700 optimize code commit 8f7a19a7b643ac63cbcd776095d6e8a2adb7ca64 Author: Huabing.Xu Date: Fri May 16 12:29:37 2014 -0700 adjust code style commit 5da20fd2e75001451ec790f775fc4fe9cb87aa1b Merge: 659fbd6 553acfb Author: Huabing.Xu Date: Fri May 16 12:06:53 2014 -0700 Merge pull request #27 from dabingnn/mesh3d_work Mesh3d work commit 553acfb3ee685f5461a6d2a68779200abcca8670 Author: Huabing.Xu Date: Fri May 16 12:06:02 2014 -0700 fix visual error for outline commit 659fbd652aa7f4c2d3629fe446051c3dd0377510 Merge: 056c3e1 c617bb7 Author: yangxiao Date: Fri May 16 11:54:54 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit 056c3e1394b9c1588395ac8a7f70db1e63c88c31 Author: yangxiao Date: Fri May 16 11:54:47 2014 -0700 fix shader, add multiple sprite to Sprite3DEffectTest commit c617bb74b6bc1e691ee488fd9ca43fa618710bfa Merge: 94d7896 7b19c56 Author: Huabing.Xu Date: Fri May 16 11:33:31 2014 -0700 Merge pull request #26 from dabingnn/mesh3d_work Mesh3d work commit 7b19c564e4053ad883617873b11043df1fb98a45 Author: Huabing.Xu Date: Fri May 16 11:30:34 2014 -0700 share the same glprogram in effect3DOutline commit 377d3bccd85dc566554c4fe7b529a9d0e82199e7 Author: Huabing.Xu Date: Fri May 16 11:19:56 2014 -0700 add class static variable for EffectOutline commit d4913bf735dbc74a21bd8327af0b74325bbf9d1d Merge: 213bbb0 6837cea Author: Huabing.Xu Date: Fri May 16 11:07:04 2014 -0700 Merge branch 'v3' into mesh3d_work commit 213bbb0c289e579895e92620153b95a8cf374521 Author: Huabing.Xu Date: Fri May 16 10:55:28 2014 -0700 add mesh.h in cocos2d.h commit 94d789610c9d4426b14e655a73197c652afc74f6 Merge: fa69e09 9af9da5 Author: yangxiao Date: Fri May 16 10:41:24 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit fa69e09ce0265b1fe3f4e76fa4dbc952abf17812 Author: yangxiao Date: Fri May 16 10:41:05 2014 -0700 remove namespace commit 9af9da50a91804d11537cffe0750e486cf95c8a5 Merge: ff15926 8a38a38 Author: Huabing.Xu Date: Fri May 16 10:30:23 2014 -0700 Merge pull request #25 from dabingnn/mesh3d_work Mesh3d work commit 8a38a384742ba130946de8ad1759b61ed2f70495 Author: Huabing.Xu Date: Fri May 16 10:27:28 2014 -0700 remove redundant uniform CC_Texture0 commit db80bf7c7597fd20a1ca5e4ca89ad067b527f034 Merge: ff15926 511295e Author: Huabing.Xu Date: Fri May 16 10:20:01 2014 -0700 Merge branch 'v3' into mesh3d_work commit ff15926f47edfbb1250440b060c1d887cfecd033 Author: yangxiao Date: Fri May 16 09:11:36 2014 -0700 warning more than one texture commit 5debbf8d6de4563361974b67aa52e572f7df9dd6 Author: yangxiao Date: Fri May 16 08:45:03 2014 -0700 remove redundant line commit ed357e7484a63bc3eb208d589943f802b7832e4d Merge: a1e2306 25dd07e Author: Huabing.Xu Date: Thu May 15 22:53:10 2014 -0700 Merge pull request #24 from dabingnn/mesh3d_work Mesh3d work commit 25dd07edb7005f593003e90120d6e6439686e5f6 Author: Huabing.Xu Date: Thu May 15 22:52:33 2014 -0700 fix memory leak commit 945ae3444fc2d5eb7c6293960e9c11dfbc5b7cb3 Author: Huabing.Xu Date: Thu May 15 22:49:04 2014 -0700 remove unused member variable commit a1e23064140328f4c9bbe434383ca6f25fcb7548 Merge: bac54fc 712e816 Author: Huabing.Xu Date: Thu May 15 22:37:16 2014 -0700 Merge pull request #23 from dabingnn/mesh3d_work Mesh3d work commit 712e81606f2782ac41276c1e8a87d32217ac9d28 Author: Huabing.Xu Date: Thu May 15 22:35:48 2014 -0700 fix memory leak commit bac54fce097edd4040b0a7cd522d15644e6b482a Merge: 8ed28c4 54538e8 Author: Huabing.Xu Date: Thu May 15 20:01:49 2014 -0700 Merge pull request #22 from dabingnn/mesh3d_work Mesh3d work commit 54538e89a2bf33ad6936130d1cbb3ef153db01a5 Author: Huabing.Xu Date: Thu May 15 20:01:29 2014 -0700 android work now commit a6cc0f77875e045d169758adf0cde87360f41475 Author: Huabing.Xu Date: Thu May 15 19:53:39 2014 -0700 remove sprite3dEffect include commit d8482fda09d414de76d1dc1a28c0d0b8bcc5aa32 Author: Huabing.Xu Date: Thu May 15 19:50:17 2014 -0700 remove unused Sprite3dEffect commit c5e2d5579daca64b0e9394a2b07613352847eca8 Author: Huabing.Xu Date: Thu May 15 19:48:12 2014 -0700 remove unused outline shader files commit 09a100cf388d80aa1389d96994ae189cbb0652b2 Author: Huabing.Xu Date: Thu May 15 19:43:17 2014 -0700 fix error on IOS commit 8ed28c4854d0b51ed0251f09c27a5ce328599ad5 Merge: d23ffe3 c0e8ea2 Author: Huabing.Xu Date: Thu May 15 18:47:37 2014 -0700 Merge pull request #21 from dabingnn/mesh3d_work Mesh3d work commit c0e8ea26ff29fc6a3cd04e7f9e122d4ea0a67e2c Author: Huabing.Xu Date: Thu May 15 18:46:54 2014 -0700 adjust indent, and line to the end of the file commit 661ceb72831d6eccfa522a09cedf994541af6f88 Merge: 8e764e7 d23ffe3 Author: Huabing.Xu Date: Thu May 15 18:35:18 2014 -0700 Merge branch 'mesh3d' into mesh3d_work Conflicts: cocos/3d/CCSprite3D.cpp cocos/3d/CCSprite3D.h tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp commit 8e764e74dd019852a0ef35b257895a7e79cd9a14 Author: Huabing.Xu Date: Thu May 15 18:31:06 2014 -0700 add testCase for outline commit c2ced288851892299fd7258e51f32303959b374d Author: Huabing.Xu Date: Thu May 15 18:03:34 2014 -0700 extract base class Effect3D commit d23ffe3167476d10740df321e579bf647a3698d0 Author: yangxiao Date: Thu May 15 18:02:45 2014 -0700 RendeMeshData member rename commit fb8f25553cd317a277c1b924da2c11b9f3188666 Merge: 73cb4b4 819db70 Author: yangxiao Date: Thu May 15 17:57:29 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit 819db702d5ffa9461fc9d1d232cea7d373536664 Merge: 2676911 b408f43 Author: Trace0429 Date: Thu May 15 17:54:24 2014 -0700 Merge pull request #20 from Trace0429/mesh3d_work Mesh3d work commit 73cb4b444b222d34e135b0d09b426b9c73c1b790 Author: yangxiao Date: Thu May 15 17:54:03 2014 -0700 android meshcommand commit b408f4343e47766416b19a583bc6bb5167439693 Author: Trace0429 Date: Fri May 16 08:50:38 2014 +0800 windows work now commit afbde9c25cfcdc4a6600a9e7607bc9489ea6b6f9 Author: Huabing.Xu Date: Thu May 15 17:38:41 2014 -0700 raw EffectSprite commit 2676911bb71ef92b3d9cf198021169d9e4466525 Author: yangxiao Date: Thu May 15 16:37:20 2014 -0700 remove SpriteEffect from Sprite3D commit 83dc4cfc3609d14024c3966e49ee34bf36bbd77f Author: Huabing.Xu Date: Thu May 15 16:34:36 2014 -0700 raw effectSpriteTest commit 39e372ef2037090317c9c4a2287b06cadf83c9c5 Merge: 734633e 6d27912 Author: yangxiao Date: Thu May 15 16:14:57 2014 -0700 use meshcommand commit 734633ec1ffc66e590b2ad2da94f6477d78146f2 Author: yangxiao Date: Thu May 15 15:38:30 2014 -0700 use meshcommand commit 4ec56afaa9a660e8eaad6afe18ffded8ca858eb1 Author: Huabing.Xu Date: Thu May 15 15:31:43 2014 -0700 comment out effect framework commit 6d27912f148e03acc07da3e3b4d0c565af8afefa Merge: d6f6f63 61a9011 Author: Huabing.Xu Date: Thu May 15 15:11:25 2014 -0700 Merge pull request #19 from dabingnn/mesh3d_work Mesh3d work commit 61a9011d6c78ea6918664bb608dc51344e0236e5 Author: Huabing.Xu Date: Thu May 15 14:55:06 2014 -0700 fix compile error in testcases commit 5f2f585bb8584590ecd3ebcefbb49de45b8f4bed Author: Huabing.Xu Date: Thu May 15 14:52:43 2014 -0700 fix compile error after merge with v3 commit 1a0de47740be51e586cc5615bc28e44ec8a1fc47 Merge: d6f6f63 760ee57 Author: Huabing.Xu Date: Thu May 15 14:48:19 2014 -0700 Merge branch 'v3' into mesh3d_work commit d6f6f633927eb00df984ec4239555f9ce2c7e44d Merge: c6fbd6e 76d2523 Author: Huabing.Xu Date: Thu May 15 14:26:40 2014 -0700 Merge pull request #18 from dabingnn/mesh3d_work Mesh3d work commit 76d2523ae735384533a1e37f06e370cb3481b0f2 Author: Huabing.Xu Date: Thu May 15 14:25:40 2014 -0700 move 3d shaders to shader cache commit 9b68032c809dc6667ffd5c1af37b7ad4d84fe2de Merge: 2c9a573 c6fbd6e Author: yangxiao Date: Thu May 15 13:56:00 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit 2c9a5738c2d24c33d4994e8e44e32fcc8d9ceece Author: yangxiao Date: Thu May 15 13:55:49 2014 -0700 meshcommand commit 0631a51c5d9c0aae55447105b962a888e1158cd3 Author: Huabing.Xu Date: Thu May 15 13:21:36 2014 -0700 add mesh rebuild when come to foreground in android commit 8695016869ab56f3a046f488485f9fdfb6532417 Author: Huabing.Xu Date: Thu May 15 13:13:59 2014 -0700 android work now commit c6fbd6e67d29b2fdfeed74f96de0ff5a6cdae1f5 Merge: cd7b235 0466a38 Author: Huabing.Xu Date: Thu May 15 12:21:40 2014 -0700 Merge pull request #17 from dabingnn/mesh3d_work Mesh3d work commit 0466a38e77ca1bc6be09bf18b42a6290db8dace8 Merge: e349e4e cd7b235 Author: Huabing.Xu Date: Thu May 15 12:19:24 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit e349e4e0a7047ed49c2bfa9b2e3e5cae5cbc8f67 Author: Huabing.Xu Date: Thu May 15 12:18:49 2014 -0700 commit the changed IOS/MAC project file commit a7c9a65d5603622b1d40cc009dfceee60c376f50 Author: Huabing.Xu Date: Thu May 15 12:17:57 2014 -0700 remove MeshPart commit cd7b235b5ec5b3ce21bc856888d383e6224fd047 Merge: e666045 3b7b406 Author: Huabing.Xu Date: Thu May 15 11:03:54 2014 -0700 Merge pull request #16 from dabingnn/mesh3d_work Mesh3d work commit 3b7b406caff0b6f79fe044612a32e909f778d1e3 Author: Huabing.Xu Date: Thu May 15 10:59:10 2014 -0700 raw version of single Mesh commit e666045aa4768199c530f494f0a1fb402f2ce922 Author: yangxiao Date: Thu May 15 10:44:04 2014 -0700 fix outline commit 5d4f304c5f9e5b35dbb1d1176232ab5189c98c0e Author: yangxiao Date: Thu May 15 10:09:45 2014 -0700 without normal no outline effect commit 3f6bd0ffbca804dd9ca6776c8cc2b37643911d63 Author: yangxiao Date: Wed May 14 22:39:03 2014 -0700 android listenBackToForeground commit 6bec670319ea154474c32c941c250bc3909a7e2e Author: yangxiao Date: Wed May 14 21:58:09 2014 -0700 add boss1 with normal commit 35c1b8d5fcec188cbef92457e24721ae53820328 Author: yangxiao Date: Wed May 14 21:54:20 2014 -0700 change cache commit 076166fba142d5432bbadaf3e75d6c35bcb6905a Author: yangxiao Date: Wed May 14 21:35:59 2014 -0700 depress no .mtl crash commit 498c9693a7e7009615382c5769b7493c3ff6be68 Merge: 8a63b49 d4fd946 Author: yangxiao Date: Wed May 14 15:58:50 2014 -0700 Merge branch 'mesh3d' of https://github.com/super626/cocos2d-x into mesh3d commit 8a63b4959cbb5e2b749d7f63f5b4ebe2bc5a6970 Merge: b4a8fee f395cc5 Author: yangxiao Date: Wed May 14 15:58:36 2014 -0700 merge dabingnn commit d4fd946fc8afdc95741f6a170e489d3dca9e2519 Merge: f395cc5 a17f074 Author: Huabing.Xu Date: Wed May 14 15:53:58 2014 -0700 Merge pull request #15 from dabingnn/mesh3d_work Mesh3d work commit a17f074302d10ff03881cba7e634e094d31feb0a Author: Huabing.Xu Date: Wed May 14 15:52:58 2014 -0700 android can work now commit b4a8fee4b9735e16331a5656055572db9e551367 Author: yangxiao Date: Wed May 14 15:33:07 2014 -0700 refactoring render code commit f395cc50cdd8f2f15204ad9a126338d5c2fa72d2 Merge: f129e02 a2c12df Author: Huabing.Xu Date: Wed May 14 15:27:21 2014 -0700 Merge pull request #14 from dabingnn/mesh3d_work Mesh3d work commit a2c12df8d8908abe4dcb1a0c91711a28d9f05cac Merge: 1932e22 f129e02 Author: Huabing.Xu Date: Wed May 14 15:26:19 2014 -0700 Merge branch 'mesh3d' of github.com:super626/cocos2d-x into mesh3d_work commit 1932e22962a79530adf583f24070efcee32251d3 Author: Huabing.Xu Date: Wed May 14 15:25:55 2014 -0700 android can compile now(can not work) commit f129e02ef21a0d44b8517c53d8c6bed0aaf85def Merge: ae2aa0d c0d9097 Author: Huabing.Xu Date: Wed May 14 14:21:09 2014 -0700 Merge pull request #13 from dabingnn/mesh3d_work Mesh3d work commit c0d90973c2b87582e99966256c74dcdf23712d6a Author: Huabing.Xu Date: Wed May 14 14:15:16 2014 -0700 include Sprite3DEffect in the cocos2d header commit ae2aa0dd705bf1a961164f9059eec4e5c2281bb5 Author: yangxiao Date: Wed May 14 12:51:09 2014 -0700 outline sprite commit e7a542d9c95c145241314fc63fbe12ba0b80ec6a Merge: 1c76d4c 48e9f39 Author: yangxiao Date: Wed May 14 10:48:55 2014 -0700 meshvertexattrib work commit 1c76d4ca319c15dadd7243ce4230fa35dfb7a1bb Author: yangxiao Date: Wed May 14 10:40:55 2014 -0700 use meshvertexattribute commit 48e9f3991dd7aafc90e99e1721d04f28d01f94e6 Merge: b70bf52 e0d87a9 Author: Huabing.Xu Date: Wed May 14 09:41:57 2014 -0700 Merge pull request #12 from dabingnn/mesh3d_work Mesh3d work commit e0d87a99f42f808429917c8b586509ca75e8a5e2 Author: Huabing.Xu Date: Wed May 14 09:40:14 2014 -0700 remove compile error commit c445e07c895fc2352f1220459d91f41f77690cd8 Merge: b70bf52 86fb75a Author: Huabing.Xu Date: Wed May 14 09:31:14 2014 -0700 Merge branch 'v3' into mesh3d_work commit b70bf522ef139da670cf41791a3d0ddad3dfa1cc Merge: da24c48 5a2127d Author: yangxiao Date: Wed May 14 00:25:47 2014 -0700 vertex attrib commit da24c48c981029493900bcd2143495e546faa75e Author: yangxiao Date: Tue May 13 23:49:09 2014 -0700 mesh vertex attribute commit 5a2127d718e6a9cb9f2ca3e1ac353ce1e5c0ebfd Merge: d98adb7 5148f76 Author: Huabing.Xu Date: Tue May 13 19:06:38 2014 -0700 Merge pull request #11 from dabingnn/mesh3d_work Mesh3d work commit 5148f76c43bf1e3dc5a49ad6bf112d166d6b1c93 Merge: 02deb39 d98adb7 Author: Huabing.Xu Date: Tue May 13 19:05:40 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit 02deb399314f01ec1222d78f2383a65614e33a34 Author: Huabing.Xu Date: Tue May 13 19:04:15 2014 -0700 fix texcoord y flipped commit d98adb7d9d906f8376e45a2ba57bffc4e17e1775 Merge: 300eb4e 946283b Author: Huabing.Xu Date: Tue May 13 18:35:08 2014 -0700 Merge pull request #10 from dabingnn/mesh3d_work Mesh3d work commit 946283b83218de893c727dc9780291fe1683a4f9 Author: Huabing.Xu Date: Tue May 13 18:22:16 2014 -0700 added blendFunc commit 300eb4e31783452cf16b77f85c3ef6f9dba19fc6 Merge: da7d6a0 ccc0baf Author: Huabing.Xu Date: Tue May 13 16:03:01 2014 -0700 Merge pull request #9 from dabingnn/mesh3d_work Mesh3d work commit ccc0bafd32b3375c2fe2163e0eb32714d06f8525 Author: Huabing.Xu Date: Tue May 13 16:01:59 2014 -0700 fix compile error after merge commit 5bfc30b2b930131d23058d99a6862061c2217f38 Merge: da7d6a0 0171e27 Author: Huabing.Xu Date: Tue May 13 15:56:46 2014 -0700 Merge branch 'v3' into mesh3d_work commit da7d6a087f22f4a11827ff3410fbcd2561f155fc Merge: 0caad32 f413b4e Author: Huabing.Xu Date: Tue May 13 14:19:24 2014 -0700 Merge pull request #8 from dabingnn/mesh3d_work Mesh3d work commit f413b4e55764d27863ae6978f1dbb2a0a3ca35e0 Merge: f47cfc6 0caad32 Author: Huabing.Xu Date: Tue May 13 14:17:01 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit f47cfc67041ed4655a916623a6731876758a5182 Author: Huabing.Xu Date: Tue May 13 14:15:06 2014 -0700 add new interface for createSprite3D commit 0caad32f2aa40c45e42d5d61c83419ee06e65a97 Author: yangxiao Date: Tue May 13 13:58:35 2014 -0700 default GLProgram to object commit 901ccef93593e2c39cca190784b4fc9684dfa9d0 Author: Huabing.Xu Date: Tue May 13 13:13:24 2014 -0700 remove compile warning commit a6f9cdfcdd001d4486eb8206c3bd9d85e9fc9bc8 Merge: 68bdd0b 3eef54c Author: Huabing.Xu Date: Tue May 13 13:01:20 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit 68bdd0be68e3a11bb7bc5312e61ba5fb628c439b Author: Huabing.Xu Date: Tue May 13 12:59:59 2014 -0700 rename init->initWithFile in Sprite3D commit 3eef54ca06c83f72e248ce91fe639a8446ef1be5 Merge: f719f45 1c8773c Author: Huabing.Xu Date: Tue May 13 12:58:23 2014 -0700 Merge pull request #7 from super626/mesh3d_tmp Mesh3d commit 1c8773c53ff0bb87cb249d6392a900cd572dac1e Merge: 23e8786 f719f45 Author: yangxiao Date: Tue May 13 12:56:06 2014 -0700 Merge branch 'mesh3d_tmp' into mesh3d commit f719f45aba37791ffdfe107569350a1af94cbeb0 Merge: 6bd3f28 1b76467 Author: Huabing.Xu Date: Tue May 13 11:59:46 2014 -0700 Merge pull request #6 from dabingnn/mesh3d_work Mesh3d work commit 1b7646759d9efcdf0942a42c0c22964a99309853 Merge: 6bd3f28 87adf9d Author: Huabing.Xu Date: Tue May 13 11:53:17 2014 -0700 Merge branch 'mesh3d' into mesh3d_work commit 87adf9df61e76f765f78a2bae4ec980ffb73ce57 Author: Huabing.Xu Date: Tue May 13 11:52:41 2014 -0700 adjust line indent and header file define commit 23e8786892b89e25d1add091a7c3bc618990e579 Author: yangxiao Date: Tue May 13 11:44:22 2014 -0700 using vbo commit 6bd3f28440eca3530379b4610d6f87cc88eb54c5 Merge: 56fc0f4 a239a7e Author: Huabing.Xu Date: Tue May 13 11:42:10 2014 -0700 Merge pull request #5 from dabingnn/mesh3d_work Mesh3d work commit a239a7e35a82f497c337d96a025125b92c8daefd Author: Huabing.Xu Date: Tue May 13 11:39:06 2014 -0700 add CCSprite3d include into cocos2d.h commit 8d580c28a084c1dab2a5ce925871f3361e6b970a Author: Huabing.Xu Date: Tue May 13 11:33:18 2014 -0700 remove cocos2d.h include in Sprite3DTest.h commit 56fc0f4cbccb07cda972efda302ff6689b958ab2 Merge: ab16a26 8bb75e3 Author: Huabing.Xu Date: Tue May 13 11:28:47 2014 -0700 Merge pull request #4 from dabingnn/mesh3d Mesh3d commit 8bb75e3dd96131da1c2dd9bc622d7bdbb2ad0514 Author: Huabing.Xu Date: Tue May 13 11:26:40 2014 -0700 fix compile error after rename commit 230a73132c09c66b449efbacbc417974616694c6 Author: Huabing.Xu Date: Tue May 13 11:07:30 2014 -0700 rename FileXXX to CCFileXXX commit ab16a26376f7deddf1a82f3085668e3fd9f09a12 Author: yangxiao Date: Tue May 13 10:52:36 2014 -0700 rename _model to _mesh commit 92ac7f75d06ad081282bbddcad5920a1f7584264 Merge: 6b911b5 df147d1 Author: Huabing.Xu Date: Mon May 12 22:23:59 2014 -0700 Merge pull request #3 from dabingnn/mesh3d Mesh3d commit df147d14ddb8e61d907a44c6f03f404c8a68103f Author: Huabing.Xu Date: Mon May 12 22:21:22 2014 -0700 fix retain/release in sprite3D commit 0b38939fd79168699ab737a8dc8e97c9417cf4ce Author: Huabing.Xu Date: Mon May 12 20:04:16 2014 -0700 remove compile warnings commit 090f81b8198d18bc0b31bbba28c3e2e6d73e9f92 Author: yangxiao Date: Mon May 12 19:16:25 2014 -0700 using glprogramstate work ok commit 0b4f36a964c28f5f4b3224522f27402e0efbe123 Author: yangxiao Date: Mon May 12 18:38:52 2014 -0700 add obj commit e8917d7427f3ff0e7c3d874b908e0058adecf2f7 Author: yangxiao Date: Mon May 12 18:33:23 2014 -0700 use glprogramstate commit 6b911b52c86cd79e1fd3efc0536a5ca7ab04ab7a Author: yangxiao Date: Mon May 12 13:01:56 2014 -0700 sprite3d commit 2a490c344f2db27d467506cf28c910410bb892e6 Merge: 23a5232 01b015d Author: Huabing.Xu Date: Mon May 12 10:52:17 2014 -0700 Merge pull request #1 from dabingnn/newcode Newcode commit 01b015d1238c89b6837ea276a95ce359cf0da5a7 Merge: 23a5232 5d24b3d Author: Huabing.Xu Date: Mon May 12 10:50:14 2014 -0700 Merge branch 'v3' into newcode commit 23a5232fe5bb4c0b0bc821d1945426486dafe253 Author: yangxiao Date: Mon May 12 09:44:41 2014 -0700 3d mesh initial code --- CHANGELOG | 4 +- build/cocos2d_libs.xcodeproj/project.pbxproj | 83 +- build/cocos2d_tests.xcodeproj/project.pbxproj | 28 + cocos/2d/cocos2d.vcxproj | 10 + cocos/2d/cocos2d.vcxproj.filters | 33 + cocos/2d/cocos2d_wp8.vcxproj | 10 + cocos/2d/cocos2d_wp8.vcxproj.filters | 30 + cocos/3d/CCMesh.cpp | 214 +++ cocos/3d/CCMesh.h | 133 ++ cocos/3d/CCObjLoader.cpp | 714 ++++++++ cocos/3d/CCObjLoader.h | 87 + cocos/3d/CCSprite3D.cpp | 271 +++ cocos/3d/CCSprite3D.h | 85 + cocos/3d/CCSprite3DDataCache.cpp | 145 ++ cocos/3d/CCSprite3DDataCache.h | 83 + cocos/3d/CMakeLists.txt | 7 + cocos/Android.mk | 5 + cocos/CMakeLists.txt | 2 + cocos/cocos2d.h | 4 + cocos/platform/wp8/DirectXBase.cpp | 10 +- cocos/platform/wp8/DirectXBase.h | 10 +- cocos/renderer/CCGLProgram.cpp | 3 + cocos/renderer/CCGLProgram.h | 3 + cocos/renderer/CCGLProgramCache.cpp | 26 + cocos/renderer/CCMeshCommand.cpp | 164 ++ cocos/renderer/CCMeshCommand.h | 91 + cocos/renderer/CCRenderCommand.h | 1 + cocos/renderer/CCRenderer.cpp | 7 + cocos/renderer/CMakeLists.txt | 1 + cocos/renderer/ccShader_3D_Color.frag | 15 + cocos/renderer/ccShader_3D_ColorTex.frag | 15 + cocos/renderer/ccShader_3D_PositionTex.vert | 15 + cocos/renderer/ccShaders.cpp | 5 + cocos/renderer/ccShaders.h | 3 + templates/cocos2dx_files.json | 16 +- .../cpp-empty-test/cpp-empty-test.csproj | 21 +- tests/cpp-tests/Android.mk | 1 + tests/cpp-tests/CMakeLists.txt | 1 + .../Classes/Sprite3DTest/Sprite3DTest.cpp | 486 +++++ .../Classes/Sprite3DTest/Sprite3DTest.h | 142 ++ tests/cpp-tests/Classes/controller.cpp | 3 +- tests/cpp-tests/Classes/tests.h | 2 + .../Resources/Shaders3D/OutLine.frag | 7 + .../Resources/Shaders3D/OutLine.vert | 13 + .../cpp-tests/Resources/Sprite3DTest/boss.obj | 1575 ++++++++++++++++ .../cpp-tests/Resources/Sprite3DTest/boss.png | Bin 0 -> 28427 bytes .../Resources/Sprite3DTest/boss1.obj | 1614 +++++++++++++++++ tests/cpp-tests/proj.win32/cpp-tests.vcxproj | 2 + .../proj.win32/cpp-tests.vcxproj.filters | 9 + .../proj.wp8-xaml/cpp-tests/cpp-tests.csproj | 21 +- .../cpp-testsComponent.vcxproj | 2 + .../cpp-testsComponent.vcxproj.filters | 9 + tools/tolua/cocos2dx.ini | 3 +- 53 files changed, 6220 insertions(+), 24 deletions(-) create mode 100644 cocos/3d/CCMesh.cpp create mode 100644 cocos/3d/CCMesh.h create mode 100644 cocos/3d/CCObjLoader.cpp create mode 100644 cocos/3d/CCObjLoader.h create mode 100644 cocos/3d/CCSprite3D.cpp create mode 100644 cocos/3d/CCSprite3D.h create mode 100644 cocos/3d/CCSprite3DDataCache.cpp create mode 100644 cocos/3d/CCSprite3DDataCache.h create mode 100644 cocos/3d/CMakeLists.txt create mode 100644 cocos/renderer/CCMeshCommand.cpp create mode 100644 cocos/renderer/CCMeshCommand.h create mode 100644 cocos/renderer/ccShader_3D_Color.frag create mode 100644 cocos/renderer/ccShader_3D_ColorTex.frag create mode 100644 cocos/renderer/ccShader_3D_PositionTex.vert create mode 100644 tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp create mode 100644 tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h create mode 100644 tests/cpp-tests/Resources/Shaders3D/OutLine.frag create mode 100644 tests/cpp-tests/Resources/Shaders3D/OutLine.vert create mode 100644 tests/cpp-tests/Resources/Sprite3DTest/boss.obj create mode 100644 tests/cpp-tests/Resources/Sprite3DTest/boss.png create mode 100644 tests/cpp-tests/Resources/Sprite3DTest/boss1.obj diff --git a/CHANGELOG b/CHANGELOG index 5586115a68..520a87224a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ -cocos2d-x-3.1-rc0 May.16 2014 +cocos2d-x-3.1-rc0 May.18 2014 [NEW] Cocos2dxActivity: Adds a virtual method to load native libraries. + [NEW] Directory Structure: reorder some files within the cocos/ folder + [NEW] Sprite3D: a node that renders 3d models [NEW] EditBox: support secure input on Mac [FIX] Director: twice calling of onExit diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index cb9b553f43..ba011bdaf6 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1723,6 +1723,26 @@ 50FCEBCB18C72017004AD434 /* WidgetReaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCEB9218C72017004AD434 /* WidgetReaderProtocol.h */; }; 50FCEBCC18C72017004AD434 /* WidgetReaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCEB9218C72017004AD434 /* WidgetReaderProtocol.h */; }; A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1551A342158F2AB200E66CFE /* Foundation.framework */; }; + B29594B41926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */; }; + B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */; }; + B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594B31926D5EC003EEF37 /* CCMeshCommand.h */; }; + B29594B71926D5EC003EEF37 /* CCMeshCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594B31926D5EC003EEF37 /* CCMeshCommand.h */; }; + B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B91926D61F003EEF37 /* CCMesh.cpp */; }; + B29594C31926D61F003EEF37 /* CCMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594B91926D61F003EEF37 /* CCMesh.cpp */; }; + B29594C41926D61F003EEF37 /* CCMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BA1926D61F003EEF37 /* CCMesh.h */; }; + B29594C51926D61F003EEF37 /* CCMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BA1926D61F003EEF37 /* CCMesh.h */; }; + B29594C61926D61F003EEF37 /* CCObjLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */; }; + B29594C71926D61F003EEF37 /* CCObjLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */; }; + B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BC1926D61F003EEF37 /* CCObjLoader.h */; }; + B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BC1926D61F003EEF37 /* CCObjLoader.h */; }; + B29594CA1926D61F003EEF37 /* CCSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */; }; + B29594CB1926D61F003EEF37 /* CCSprite3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */; }; + B29594CC1926D61F003EEF37 /* CCSprite3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BE1926D61F003EEF37 /* CCSprite3D.h */; }; + B29594CD1926D61F003EEF37 /* CCSprite3D.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594BE1926D61F003EEF37 /* CCSprite3D.h */; }; + B29594CE1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */; }; + B29594CF1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */; }; + B29594D01926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */; }; + B29594D11926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */; }; B37510711823AC9F00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37510451823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp */; }; B37510721823AC9F00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h in Headers */ = {isa = PBXBuildFile; fileRef = B37510461823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h */; }; B37510731823AC9F00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37510471823AC7B00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp */; }; @@ -2772,6 +2792,19 @@ A07A4F3B178387670073F6A7 /* libchipmunk iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libchipmunk iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A07A4F9E1783876B0073F6A7 /* libbox2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libbox2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A07A4FB4178387730073F6A7 /* libCocosDenshion iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCocosDenshion iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B29594AF1926D5D9003EEF37 /* ccShader_3D_Color.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Color.frag; sourceTree = ""; }; + B29594B01926D5D9003EEF37 /* ccShader_3D_ColorTex.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_ColorTex.frag; sourceTree = ""; }; + B29594B11926D5D9003EEF37 /* ccShader_3D_PositionTex.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_PositionTex.vert; sourceTree = ""; }; + B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMeshCommand.cpp; sourceTree = ""; }; + B29594B31926D5EC003EEF37 /* CCMeshCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMeshCommand.h; sourceTree = ""; }; + B29594B91926D61F003EEF37 /* CCMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMesh.cpp; sourceTree = ""; }; + B29594BA1926D61F003EEF37 /* CCMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMesh.h; sourceTree = ""; }; + B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCObjLoader.cpp; sourceTree = ""; }; + B29594BC1926D61F003EEF37 /* CCObjLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCObjLoader.h; sourceTree = ""; }; + B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSprite3D.cpp; sourceTree = ""; }; + B29594BE1926D61F003EEF37 /* CCSprite3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSprite3D.h; sourceTree = ""; }; + B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSprite3DDataCache.cpp; sourceTree = ""; }; + B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSprite3DDataCache.h; sourceTree = ""; }; B37510451823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsBodyInfo_chipmunk.cpp; sourceTree = ""; }; B37510461823AC7B00B3BA6A /* CCPhysicsBodyInfo_chipmunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsBodyInfo_chipmunk.h; sourceTree = ""; }; B37510471823AC7B00B3BA6A /* CCPhysicsContactInfo_chipmunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsContactInfo_chipmunk.cpp; sourceTree = ""; }; @@ -2886,10 +2919,12 @@ children = ( 46A15FCC1807A544005B8026 /* AUTHORS */, 1A57FFF7180BC5160088DEC7 /* CHANGELOG */, + 50272539190BF1B900AAF4ED /* cocos2d.cpp */, + 50272538190BF1B900AAF4ED /* cocos2d.h */, 46A15FCE1807A544005B8026 /* README.md */, 50DC5180187B817900A9C23F /* RELEASE_NOTES.md */, 46A169A11807B037005B8026 /* 2d */, - 50ABBEDB1926664700A911A9 /* platform */, + B29594B81926D61F003EEF37 /* 3d */, 46A15FD01807A56F005B8026 /* audio */, 1A5700A2180BC5E60088DEC7 /* base */, 1A01C67518F57BE800EFE3A6 /* deprecated */, @@ -2900,12 +2935,11 @@ 46A170851807CE87005B8026 /* math */, 1AAF5360180E3374000584C8 /* network */, 46A170611807CE7A005B8026 /* physics */, + 50ABBEDB1926664700A911A9 /* platform */, 1551A340158F2AB200E66CFE /* Products */, 500DC89819105D41007B91BF /* renderer */, 1AAF5849180E40B8000584C8 /* storage */, 2905F9E618CF08D000240AA3 /* ui */, - 50272538190BF1B900AAF4ED /* cocos2d.h */, - 50272539190BF1B900AAF4ED /* cocos2d.cpp */, ); sourceTree = ""; }; @@ -4464,7 +4498,6 @@ 500DC89819105D41007B91BF /* renderer */ = { isa = PBXGroup; children = ( - 5034CA5D191D591900CE6051 /* shaders */, 50ABBD641925AB4100A911A9 /* CCBatchCommand.cpp */, 50ABBD651925AB4100A911A9 /* CCBatchCommand.h */, 50ABBD661925AB4100A911A9 /* CCCustomCommand.cpp */, @@ -4481,6 +4514,8 @@ 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */, 50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */, 50ABBD731925AB4100A911A9 /* CCGroupCommand.h */, + B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */, + B29594B31926D5EC003EEF37 /* CCMeshCommand.h */, 50ABBD741925AB4100A911A9 /* CCQuadCommand.cpp */, 50ABBD751925AB4100A911A9 /* CCQuadCommand.h */, 50ABBD761925AB4100A911A9 /* CCRenderCommand.cpp */, @@ -4496,6 +4531,7 @@ 50ABBD801925AB4100A911A9 /* CCTextureAtlas.h */, 50ABBD811925AB4100A911A9 /* CCTextureCache.cpp */, 50ABBD821925AB4100A911A9 /* CCTextureCache.h */, + 5034CA5D191D591900CE6051 /* shaders */, ); name = renderer; path = ../cocos/renderer; @@ -4504,6 +4540,9 @@ 5034CA5D191D591900CE6051 /* shaders */ = { isa = PBXGroup; children = ( + B29594AF1926D5D9003EEF37 /* ccShader_3D_Color.frag */, + B29594B01926D5D9003EEF37 /* ccShader_3D_ColorTex.frag */, + B29594B11926D5D9003EEF37 /* ccShader_3D_PositionTex.vert */, 5034CA60191D91CF00CE6051 /* ccShader_PositionTextureColor.vert */, 5034CA61191D91CF00CE6051 /* ccShader_PositionTextureColor.frag */, 5034CA62191D91CF00CE6051 /* ccShader_PositionTextureColor_noMVP.vert */, @@ -4755,6 +4794,22 @@ path = TextReader; sourceTree = ""; }; + B29594B81926D61F003EEF37 /* 3d */ = { + isa = PBXGroup; + children = ( + B29594B91926D61F003EEF37 /* CCMesh.cpp */, + B29594BA1926D61F003EEF37 /* CCMesh.h */, + B29594BB1926D61F003EEF37 /* CCObjLoader.cpp */, + B29594BC1926D61F003EEF37 /* CCObjLoader.h */, + B29594BD1926D61F003EEF37 /* CCSprite3D.cpp */, + B29594BE1926D61F003EEF37 /* CCSprite3D.h */, + B29594BF1926D61F003EEF37 /* CCSprite3DDataCache.cpp */, + B29594C01926D61F003EEF37 /* CCSprite3DDataCache.h */, + ); + name = 3d; + path = ../cocos/3d; + sourceTree = ""; + }; B3D8D4471799219B0039C204 /* mac */ = { isa = PBXGroup; children = ( @@ -4803,6 +4858,7 @@ 06CAAAC9186AD7EE0012A414 /* TriggerMng.h in Headers */, 2905FA6018CF08D100240AA3 /* UILayoutParameter.h in Headers */, 50ABBEA51925AB6F00A911A9 /* CCScriptSupport.h in Headers */, + B29594D01926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */, 1ABA68B01888D700007D1BB4 /* CCFontCharMap.h in Headers */, 5034CA3F191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */, 50ABBD461925AB0000A911A9 /* CCVertex.h in Headers */, @@ -4929,6 +4985,7 @@ 50ABBD421925AB0000A911A9 /* CCMathBase.h in Headers */, 1A570298180BCCAB0088DEC7 /* CCAnimationCache.h in Headers */, 50FCEB9D18C72017004AD434 /* ImageViewReader.h in Headers */, + B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */, 50ABBE911925AB6F00A911A9 /* CCPlatformMacros.h in Headers */, 50ABC05D1926664800A911A9 /* CCApplication.h in Headers */, 50ABC0071926664800A911A9 /* CCApplicationProtocol.h in Headers */, @@ -4963,6 +5020,7 @@ 2905FA5818CF08D100240AA3 /* UILayout.h in Headers */, 1A57034D180BD09B0088DEC7 /* tinyxml2.h in Headers */, 1A570356180BD0B00088DEC7 /* ioapi.h in Headers */, + B29594C41926D61F003EEF37 /* CCMesh.h in Headers */, 50ABBE331925AB6F00A911A9 /* CCConfiguration.h in Headers */, 50ABC01F1926664800A911A9 /* CCThread.h in Headers */, 1A57035A180BD0B00088DEC7 /* unzip.h in Headers */, @@ -5017,6 +5075,7 @@ 1A01C69218F57BE800EFE3A6 /* CCDouble.h in Headers */, 50ABBE251925AB6F00A911A9 /* base64.h in Headers */, 50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */, + B29594CC1926D61F003EEF37 /* CCSprite3D.h in Headers */, 1AD71E9F180E26E600808F54 /* AnimationStateData.h in Headers */, 1AD71EA3180E26E600808F54 /* Atlas.h in Headers */, 1AD71EA7180E26E600808F54 /* AtlasAttachmentLoader.h in Headers */, @@ -5081,6 +5140,7 @@ 50ABBE211925AB6F00A911A9 /* atitc.h in Headers */, 1A8C5999180E930E00EF57C3 /* CCActionNode.h in Headers */, 1A8C599D180E930E00EF57C3 /* CCActionObject.h in Headers */, + B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */, 50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */, 1A8C59A1180E930E00EF57C3 /* CCArmature.h in Headers */, 1A8C59A5180E930E00EF57C3 /* CCArmatureAnimation.h in Headers */, @@ -5287,9 +5347,11 @@ 50ABBD3B1925AB0000A911A9 /* CCAffineTransform.h in Headers */, 5034CA38191D591100CE6051 /* ccShader_PositionColorLengthTexture.vert in Headers */, 50ABBE7C1925AB6F00A911A9 /* CCEventMouse.h in Headers */, + B29594D11926D61F003EEF37 /* CCSprite3DDataCache.h in Headers */, 46A171011807CECB005B8026 /* CCPhysicsJoint.h in Headers */, 46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */, 2905FA6118CF08D100240AA3 /* UILayoutParameter.h in Headers */, + B29594C51926D61F003EEF37 /* CCMesh.h in Headers */, 50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */, 50ABBD961925AB4100A911A9 /* CCGLProgramState.h in Headers */, 46A171061807CECB005B8026 /* CCPhysicsWorld.h in Headers */, @@ -5493,11 +5555,13 @@ 1AD71DEE180E26E600808F54 /* CCMenuLoader.h in Headers */, 1AD71DF2180E26E600808F54 /* CCNode+CCBRelativePositioning.h in Headers */, 50ABBDB01925AB4100A911A9 /* CCRenderer.h in Headers */, + B29594B71926D5EC003EEF37 /* CCMeshCommand.h in Headers */, 1AD71DF6180E26E600808F54 /* CCNodeLoader.h in Headers */, 50ABBD861925AB4100A911A9 /* CCBatchCommand.h in Headers */, 1AD71DFA180E26E600808F54 /* CCNodeLoaderLibrary.h in Headers */, 50ABBE481925AB6F00A911A9 /* CCEvent.h in Headers */, 5027253B190BF1B900AAF4ED /* cocos2d.h in Headers */, + B29594CD1926D61F003EEF37 /* CCSprite3D.h in Headers */, 1AD71DFC180E26E600808F54 /* CCNodeLoaderListener.h in Headers */, 3EA0FB6B191C841D00B170C8 /* UIVideoPlayer.h in Headers */, 50ABBE641925AB6F00A911A9 /* CCEventListenerAcceleration.h in Headers */, @@ -5507,6 +5571,7 @@ 1AD71E0C180E26E600808F54 /* CCSpriteLoader.h in Headers */, 50ABBD921925AB4100A911A9 /* CCGLProgramCache.h in Headers */, 1AD71E0E180E26E600808F54 /* CocosBuilder.h in Headers */, + B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */, 1AD71E98180E26E600808F54 /* Animation.h in Headers */, 1AD71E9C180E26E600808F54 /* AnimationState.h in Headers */, 50ABBE961925AB6F00A911A9 /* CCProfiling.h in Headers */, @@ -6098,6 +6163,7 @@ 50FCEBBF18C72017004AD434 /* TextFieldReader.cpp in Sources */, 50FCEBAF18C72017004AD434 /* ScrollViewReader.cpp in Sources */, 50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */, + B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */, 50ABBE3D1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */, 1A5702C8180BCE370088DEC7 /* CCTextFieldTTF.cpp in Sources */, 50ABBE7D1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */, @@ -6147,6 +6213,7 @@ 1AD71DE9180E26E600808F54 /* CCMenuItemLoader.cpp in Sources */, 50ABBDA31925AB4100A911A9 /* CCQuadCommand.cpp in Sources */, 2905FA6A18CF08D100240AA3 /* UIPageView.cpp in Sources */, + B29594C61926D61F003EEF37 /* CCObjLoader.cpp in Sources */, 06CAAAC7186AD7E90012A414 /* TriggerObj.cpp in Sources */, 1AD71DEF180E26E600808F54 /* CCNode+CCBRelativePositioning.cpp in Sources */, 50ABC01D1926664800A911A9 /* CCThread.cpp in Sources */, @@ -6185,6 +6252,7 @@ 1AD71ECD180E26E600808F54 /* Skeleton.cpp in Sources */, 1AD71ED1180E26E600808F54 /* SkeletonData.cpp in Sources */, 1AD71ED5180E26E600808F54 /* SkeletonJson.cpp in Sources */, + B29594CA1926D61F003EEF37 /* CCSprite3D.cpp in Sources */, 1AD71ED9180E26E600808F54 /* Skin.cpp in Sources */, 1AD71EDD180E26E600808F54 /* Slot.cpp in Sources */, 1AD71EE1180E26E600808F54 /* SlotData.cpp in Sources */, @@ -6229,6 +6297,7 @@ 1A8C59C3180E930E00EF57C3 /* CCComController.cpp in Sources */, 2905FA5218CF08D100240AA3 /* UIImageView.cpp in Sources */, 50ABBDBD1925AB4100A911A9 /* CCTextureCache.cpp in Sources */, + B29594CE1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */, 2905FA7C18CF08D100240AA3 /* UIText.cpp in Sources */, 50FCEB9F18C72017004AD434 /* LayoutReader.cpp in Sources */, 50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */, @@ -6255,6 +6324,7 @@ 1A8C59EF180E930E00EF57C3 /* CCSpriteFrameCacheHelper.cpp in Sources */, 1A8C59F3180E930E00EF57C3 /* CCSSceneReader.cpp in Sources */, 2905FA6E18CF08D100240AA3 /* UIRichText.cpp in Sources */, + B29594B41926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */, 1A01C68E18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */, 1A8C59F7180E930E00EF57C3 /* CCTransformHelp.cpp in Sources */, 50ABBD381925AB0000A911A9 /* CCAffineTransform.cpp in Sources */, @@ -6442,6 +6512,7 @@ 50ABBE621925AB6F00A911A9 /* CCEventListenerAcceleration.cpp in Sources */, B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */, 2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */, + B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */, 50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */, 50FCEB9818C72017004AD434 /* CheckBoxReader.cpp in Sources */, 50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */, @@ -6461,6 +6532,7 @@ 1A570082180BC5A10088DEC7 /* CCActionManager.cpp in Sources */, 1A570086180BC5A10088DEC7 /* CCActionPageTurn3D.cpp in Sources */, 1A57008A180BC5A10088DEC7 /* CCActionProgressTimer.cpp in Sources */, + B29594CB1926D61F003EEF37 /* CCSprite3D.cpp in Sources */, 2905FA6F18CF08D100240AA3 /* UIRichText.cpp in Sources */, 50ABBED81925AB6F00A911A9 /* ZipUtils.cpp in Sources */, 1A57008E180BC5A10088DEC7 /* CCActionTiledGrid.cpp in Sources */, @@ -6470,6 +6542,7 @@ 50ABBE3E1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */, 1A57009F180BC5D20088DEC7 /* CCNode.cpp in Sources */, B37510831823ACA100B3BA6A /* CCPhysicsShapeInfo_chipmunk.cpp in Sources */, + B29594CF1926D61F003EEF37 /* CCSprite3DDataCache.cpp in Sources */, 1A57010F180BC8EE0088DEC7 /* CCDrawingPrimitives.cpp in Sources */, 1A570113180BC8EE0088DEC7 /* CCDrawNode.cpp in Sources */, 1A57011C180BC90D0088DEC7 /* CCGrabber.cpp in Sources */, @@ -6572,6 +6645,7 @@ 1AD71DDA180E26E600808F54 /* CCLayerColorLoader.cpp in Sources */, 50FCEBC018C72017004AD434 /* TextFieldReader.cpp in Sources */, 1AD71DDE180E26E600808F54 /* CCLayerGradientLoader.cpp in Sources */, + B29594C31926D61F003EEF37 /* CCMesh.cpp in Sources */, 1AD71DE2180E26E600808F54 /* CCLayerLoader.cpp in Sources */, 1AD71DE6180E26E600808F54 /* CCMenuItemImageLoader.cpp in Sources */, 50ABBEA81925AB6F00A911A9 /* CCTouch.cpp in Sources */, @@ -6600,6 +6674,7 @@ 1AD71EB2180E26E600808F54 /* Bone.cpp in Sources */, 50ABBD451925AB0000A911A9 /* CCVertex.cpp in Sources */, 2905FA8118CF08D100240AA3 /* UITextAtlas.cpp in Sources */, + B29594C71926D61F003EEF37 /* CCObjLoader.cpp in Sources */, 50ABBEB01925AB6F00A911A9 /* CCUserDefault.cpp in Sources */, 50FCEBB818C72017004AD434 /* TextAtlasReader.cpp in Sources */, 1AD71EB6180E26E600808F54 /* BoneData.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 11c134ac8a..4ed7d5dbc9 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -812,6 +812,10 @@ 29080DE4191B595E0066F8DF /* UIWidgetAddNodeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D89191B595E0066F8DF /* UIWidgetAddNodeTest.cpp */; }; 29080DE5191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; }; 29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; }; + 3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; }; + 3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; }; + 3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; + 3E92EA861921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; 3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; 3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */; }; @@ -827,6 +831,8 @@ A07A52BF1783AF210073F6A7 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B91783AE900073F6A7 /* OpenGLES.framework */; }; A07A52C01783AF250073F6A7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52B71783AE6D0073F6A7 /* UIKit.framework */; }; A07A52C31783B02C0073F6A7 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07A52C11783B01F0073F6A7 /* AVFoundation.framework */; }; + B2507B6B192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; }; + B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; }; C08689C118D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; }; C08689C218D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; }; C08689C318D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; }; @@ -1849,6 +1855,9 @@ 29080D8A191B595E0066F8DF /* UIWidgetAddNodeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest.h; sourceTree = ""; }; 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidgetAddNodeTest_Editor.cpp; sourceTree = ""; }; 29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = ""; }; + 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite3DTest.cpp; path = Sprite3DTest/Sprite3DTest.cpp; sourceTree = ""; }; + 3E92EA811921A1400094CD21 /* Sprite3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite3DTest.h; path = Sprite3DTest/Sprite3DTest.h; sourceTree = ""; }; + 3E92EA841921A7720094CD21 /* Sprite3DTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Sprite3DTest; path = "../tests/cpp-tests/Resources/Sprite3DTest"; sourceTree = ""; }; 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = cocosvideo.mp4; path = "../tests/cpp-tests/Resources/cocosvideo.mp4"; sourceTree = ""; }; 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; }; 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVideoPlayerTest.cpp; sourceTree = ""; }; @@ -1864,6 +1873,7 @@ A07A52B91783AE900073F6A7 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; A07A52BB1783AEB80073F6A7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; A07A52C11783B01F0073F6A7 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; + B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = ""; }; C08689C018D370C90093E810 /* background.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = background.caf; path = "../tests/cpp-tests/Resources/background.caf"; sourceTree = ""; }; D60AE43317F7FFE100757E4B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; }; EDCC747E17C455FD007B692C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; @@ -2258,6 +2268,7 @@ 1AC35AE918CECF0C00F37B72 /* SchedulerTest */, 1AC35AEC18CECF0C00F37B72 /* ShaderTest */, 1AC35AF118CECF0C00F37B72 /* SpineTest */, + 3E92EA7D1921A0C60094CD21 /* Sprite3DTest */, 1AC35AF418CECF0C00F37B72 /* SpriteTest */, 1AC35AF718CECF0C00F37B72 /* testBasic.cpp */, 1AC35AF818CECF0C00F37B72 /* testBasic.h */, @@ -3274,6 +3285,8 @@ 1AC35CA818CED83500F37B72 /* Resources */ = { isa = PBXGroup; children = ( + B2507B6A192589AF00FA4972 /* Shaders3D */, + 3E92EA841921A7720094CD21 /* Sprite3DTest */, 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */, 1AC35CA918CED84500F37B72 /* animations */, 1AC35CAE18CED84500F37B72 /* ccb */, @@ -3790,6 +3803,15 @@ name = Frameworks; sourceTree = ""; }; + 3E92EA7D1921A0C60094CD21 /* Sprite3DTest */ = { + isa = PBXGroup; + children = ( + 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */, + 3E92EA811921A1400094CD21 /* Sprite3DTest.h */, + ); + name = Sprite3DTest; + sourceTree = ""; + }; 3EA0FB6F191C844400B170C8 /* UIVideoPlayerTest */ = { isa = PBXGroup; children = ( @@ -4415,6 +4437,7 @@ 1AC35D0418CED84500F37B72 /* Shaders in Resources */, 1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */, 1AC35CDC18CED84500F37B72 /* commonly_used_words.txt in Resources */, + B2507B6B192589AF00FA4972 /* Shaders3D in Resources */, 1AC35D0618CED84500F37B72 /* spine in Resources */, 1AC35CE818CED84500F37B72 /* extensions in Resources */, 1AC35CDE18CED84500F37B72 /* components in Resources */, @@ -4433,6 +4456,7 @@ 1AC35D0018CED84500F37B72 /* pew-pew-lei.wav in Resources */, 1AC35CD018CED84500F37B72 /* background.mp3 in Resources */, 1AC35CD618CED84500F37B72 /* CocosBuilderExample.ccbproj in Resources */, + 3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */, 1AC35CA318CECF1E00F37B72 /* InfoPlist.strings in Resources */, 1AC35CA418CECF1E00F37B72 /* MainMenu.xib in Resources */, 1AC35CD418CED84500F37B72 /* ccb in Resources */, @@ -4471,6 +4495,7 @@ 1AC35CD318CED84500F37B72 /* background.ogg in Resources */, 1AC35CCB18CED84500F37B72 /* animations in Resources */, 3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */, + 3E92EA861921A7720094CD21 /* Sprite3DTest in Resources */, 1AC35C8C18CECF1400F37B72 /* Icon-114.png in Resources */, 1AC35CF118CED84500F37B72 /* hd in Resources */, 1AC35C9318CECF1400F37B72 /* Icon-57.png in Resources */, @@ -4486,6 +4511,7 @@ 1AC35C9418CECF1400F37B72 /* Icon-58.png in Resources */, 1AC35CD118CED84500F37B72 /* background.mp3 in Resources */, 1AC35CD918CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */, + B2507B6C192589AF00FA4972 /* Shaders3D in Resources */, 1AC35CED18CED84500F37B72 /* fonts in Resources */, 1AC35CD718CED84500F37B72 /* CocosBuilderExample.ccbproj in Resources */, 1AC35CDD18CED84500F37B72 /* commonly_used_words.txt in Resources */, @@ -4574,6 +4600,7 @@ 1AC35BE118CECF0C00F37B72 /* CCControlButtonTest.cpp in Sources */, 1AC35BEB18CECF0C00F37B72 /* CCControlSliderTest.cpp in Sources */, 1AC35C4D18CECF0C00F37B72 /* SpineTest.cpp in Sources */, + 3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */, 1AC35C1D18CECF0C00F37B72 /* NewRendererTest.cpp in Sources */, 1AC35B6718CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */, 29080DB7191B595E0066F8DF /* UIListViewTest_Editor.cpp in Sources */, @@ -4906,6 +4933,7 @@ 1AC35B5418CECF0C00F37B72 /* CocosDenshionTest.cpp in Sources */, 1AC35B8018CECF0C00F37B72 /* ProjectileController.cpp in Sources */, 1AC35C2618CECF0C00F37B72 /* PerformanceAllocTest.cpp in Sources */, + 3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */, 1AC35B5A18CECF0C00F37B72 /* controller.cpp in Sources */, 1AC35C2A18CECF0C00F37B72 /* PerformanceEventDispatcherTest.cpp in Sources */, 1AC35BEA18CECF0C00F37B72 /* CCControlSceneManager.cpp in Sources */, diff --git a/cocos/2d/cocos2d.vcxproj b/cocos/2d/cocos2d.vcxproj index d7f58d5390..08ffc2fc9e 100644 --- a/cocos/2d/cocos2d.vcxproj +++ b/cocos/2d/cocos2d.vcxproj @@ -175,6 +175,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + + + + @@ -263,6 +267,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + @@ -341,6 +346,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + + + + @@ -452,6 +461,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + diff --git a/cocos/2d/cocos2d.vcxproj.filters b/cocos/2d/cocos2d.vcxproj.filters index 5c2b8adc1e..8b792ef611 100644 --- a/cocos/2d/cocos2d.vcxproj.filters +++ b/cocos/2d/cocos2d.vcxproj.filters @@ -52,6 +52,9 @@ {b4e2b1e5-2d79-44a3-af45-728d47b7bdb2} + + {a20c4bdc-bd4c-40c1-a78a-fe31cd3ec76a} + @@ -547,6 +550,21 @@ base + + renderer + + + 3d + + + 3d + + + 3d + + + 3d + @@ -1111,6 +1129,21 @@ base + + renderer + + + 3d + + + 3d + + + 3d + + + 3d + diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index 8b74b9ac1c..91de9b40b0 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -222,6 +222,10 @@ NotUsing NotUsing + + + + @@ -331,6 +335,7 @@ + @@ -409,6 +414,10 @@ + + + + @@ -531,6 +540,7 @@ + diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index a7a56641cf..ee4a610d9f 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -580,6 +580,21 @@ base + + 3d + + + 3d + + + 3d + + + 3d + + + renderer + @@ -1179,6 +1194,21 @@ base + + 3d + + + 3d + + + 3d + + + 3d + + + renderer + diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp new file mode 100644 index 0000000000..d7b61e22d1 --- /dev/null +++ b/cocos/3d/CCMesh.cpp @@ -0,0 +1,214 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "CCMesh.h" + +#include +#include +#include +#include + +#include "base/ccMacros.h" +#include "renderer/ccGLStateCache.h" +#include "CCObjLoader.h" +#include "CCSprite3DDataCache.h" + +using namespace std; + +NS_CC_BEGIN + +bool RenderMeshData::hasVertexAttrib(int attrib) +{ + for (auto itr = _vertexAttribs.begin(); itr != _vertexAttribs.end(); itr++) + { + if ((*itr).vertexAttrib == attrib) + return true; //already has + } + return false; +} + +bool RenderMeshData::initFrom(const std::vector& positions, + const std::vector& normals, + const std::vector& texs, + const std::vector& indices) +{ + CC_ASSERT(positions.size()<65536 * 3 && "index may out of bound"); + + _vertexAttribs.clear(); + _vertexsizeBytes = 0; + + _vertexNum = positions.size() / 3; //number of vertex + if (_vertexNum == 0) + return false; + + if ((normals.size() != 0 && _vertexNum * 3 != normals.size()) || (texs.size() != 0 && _vertexNum * 2 != texs.size())) + return false; + + _vertexsizeBytes += 3; + MeshVertexAttrib meshvertexattrib; + meshvertexattrib.size = 3; + meshvertexattrib.type = GL_FLOAT; + meshvertexattrib.attribSizeBytes = meshvertexattrib.size * sizeof(float); + meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_POSITION; + _vertexAttribs.push_back(meshvertexattrib); + + //normal + if (normals.size()) + { + //add normal flag + _vertexsizeBytes += 3; + meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_NORMAL; + _vertexAttribs.push_back(meshvertexattrib); + } + // + if (texs.size()) + { + _vertexsizeBytes += 2; + meshvertexattrib.size = 2; + meshvertexattrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_TEX_COORD; + meshvertexattrib.attribSizeBytes = meshvertexattrib.size * sizeof(float); + _vertexAttribs.push_back(meshvertexattrib); + } + + _vertexs.clear(); + _vertexs.reserve(_vertexNum * _vertexsizeBytes); + _vertexsizeBytes *= sizeof(float); + + bool hasNormal = hasVertexAttrib(GLProgram::VERTEX_ATTRIB_NORMAL); + bool hasTexCoord = hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD); + //position, normal, texCoordinate into _vertexs + for(int i = 0; i < _vertexNum; i++) + { + _vertexs.push_back(positions[i * 3]); + _vertexs.push_back(positions[i * 3 + 1]); + _vertexs.push_back(positions[i * 3 + 2]); + + if (hasNormal) + { + _vertexs.push_back(normals[i * 3]); + _vertexs.push_back(normals[i * 3 + 1]); + _vertexs.push_back(normals[i * 3 + 2]); + } + + if (hasTexCoord) + { + _vertexs.push_back(texs[i * 2]); + _vertexs.push_back(texs[i * 2 + 1]); + } + } + _indices = indices; + + return true; +} + +Mesh::Mesh() +:_vertexBuffer(0) +, _indexBuffer(0) +, _primitiveType(PrimitiveType::TRIANGLES) +, _indexFormat(IndexFormat::INDEX16) +, _indexCount(0) +{ +} + +Mesh::~Mesh() +{ + cleanAndFreeBuffers(); +} + +Mesh* Mesh::create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices) +{ + auto mesh = new Mesh(); + if(mesh && mesh->init(positions, normals, texs, indices)) + { + mesh->autorelease(); + return mesh; + } + CC_SAFE_DELETE(mesh); + return nullptr; +} + +bool Mesh::init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices) +{ + bool bRet = _renderdata.initFrom(positions, normals, texs, indices); + if (!bRet) + return false; + + restore(); + return true; +} + +void Mesh::cleanAndFreeBuffers() +{ + if(glIsBuffer(_vertexBuffer)) + { + glDeleteBuffers(1, &_vertexBuffer); + _vertexBuffer = 0; + } + + if(glIsBuffer(_indexBuffer)) + { + glDeleteBuffers(1, &_indexBuffer); + _indexBuffer = 0; + } + _primitiveType = PrimitiveType::TRIANGLES; + _indexFormat = IndexFormat::INDEX16; + _indexCount = 0; +} + +void Mesh::buildBuffer() +{ + cleanAndFreeBuffers(); + + glGenBuffers(1, &_vertexBuffer); + glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); + + glBufferData(GL_ARRAY_BUFFER, + _renderdata._vertexs.size() * sizeof(_renderdata._vertexs[0]), + &_renderdata._vertexs[0], + GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); + + glGenBuffers(1, &_indexBuffer); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); + + unsigned int indexSize = 2; + IndexFormat indexformat = IndexFormat::INDEX16; + + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + _primitiveType = PrimitiveType::TRIANGLES; + _indexFormat = indexformat; + _indexCount = _renderdata._indices.size(); +} + +void Mesh::restore() +{ + cleanAndFreeBuffers(); + buildBuffer(); +} + +NS_CC_END diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h new file mode 100644 index 0000000000..1d0db67785 --- /dev/null +++ b/cocos/3d/CCMesh.h @@ -0,0 +1,133 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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 __CCMESH_H__ +#define __CCMESH_H__ + +#include +#include + +#include "base/CCRef.h" +#include "base/ccTypes.h" +#include "math/CCMath.h" +#include "renderer/CCGLProgram.h" + +NS_CC_BEGIN + +//mesh vertex attribute +struct MeshVertexAttrib +{ + //attribute size + GLint size; + //GL_FLOAT + GLenum type; + //VERTEX_ATTRIB_POSITION,VERTEX_ATTRIB_COLOR,VERTEX_ATTRIB_TEX_COORD,VERTEX_ATTRIB_NORMAL, GLProgram for detail + int vertexAttrib; + //size in bytes + int attribSizeBytes; +}; + +class RenderMeshData +{ + friend class Mesh; +public: + RenderMeshData(): _vertexsizeBytes(0) + { + } + bool hasVertexAttrib(int attrib); + bool initFrom(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); + +protected: + int _vertexsizeBytes; + ssize_t _vertexNum; + std::vector _vertexs; + std::vector _indices; + std::vector _vertexAttribs; +}; + +/** Mesh: TODO, add description of Mesh */ +class Mesh : public Ref +{ +public: + /** Defines supported index formats. */ + enum class IndexFormat + { + INDEX8 = GL_UNSIGNED_BYTE, + INDEX16 = GL_UNSIGNED_SHORT, + }; + + /** Defines supported primitive types. */ + enum class PrimitiveType + { + TRIANGLES = GL_TRIANGLES, + TRIANGLE_STRIP = GL_TRIANGLE_STRIP, + LINES = GL_LINES, + LINE_STRIP = GL_LINE_STRIP, + POINTS = GL_POINTS + }; + + //create + static Mesh* create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); + + //get vertex buffer + inline GLuint getVertexBuffer() const { return _vertexBuffer; } + + //get mesh vertex attribute count + ssize_t getMeshVertexAttribCount() const { return _renderdata._vertexAttribs.size(); } + //get MeshVertexAttribute by index + const MeshVertexAttrib& getMeshVertexAttribute(int idx) const { return _renderdata._vertexAttribs[idx]; } + //has vertex attribute? + bool hasVertexAttrib(int attrib) { return _renderdata.hasVertexAttrib(attrib); } + //get per vertex size in bytes + int getVertexSizeInBytes() const { return _renderdata._vertexsizeBytes; } + + PrimitiveType getPrimitiveType() const { return _primitiveType; } + ssize_t getIndexCount() const { return _indexCount; } + IndexFormat getIndexFormat() const { return _indexFormat; } + GLuint getIndexBuffer() const {return _indexBuffer; } + + //build vertex buffer from renderdata + void restore(); + +protected: + Mesh(); + virtual ~Mesh(); + bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); + + //build buffer + void buildBuffer(); + void cleanAndFreeBuffers(); + + PrimitiveType _primitiveType; + IndexFormat _indexFormat; + GLuint _vertexBuffer; + GLuint _indexBuffer; + ssize_t _indexCount; + + RenderMeshData _renderdata; +}; + +NS_CC_END + +#endif // __CCMESH_H_ diff --git a/cocos/3d/CCObjLoader.cpp b/cocos/3d/CCObjLoader.cpp new file mode 100644 index 0000000000..939de77984 --- /dev/null +++ b/cocos/3d/CCObjLoader.cpp @@ -0,0 +1,714 @@ +// +// Copyright 2012-2013, Syoyo Fujita. +// +// Licensed under 2-clause BSD liecense. +// + +// +// version 0.9.6: Support Ni(index of refraction) mtl parameter. +// Parse transmittance material parameter correctly. +// version 0.9.5: Parse multiple group name. +// Add support of specifying the base path to load material file. +// version 0.9.4: Initial suupport of group tag(g) +// version 0.9.3: Fix parsing triple 'x/y/z' +// version 0.9.2: Add more .mtl load support +// version 0.9.1: Add initial .mtl load support +// version 0.9.0: Initial +// + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "CCObjLoader.h" +#include "platform/CCFileUtils.h" + +NS_CC_BEGIN + +struct vertex_index +{ + int v_idx, vt_idx, vn_idx; + vertex_index() {}; + vertex_index(int idx) : v_idx(idx), vt_idx(idx), vn_idx(idx) {}; + vertex_index(int vidx, int vtidx, int vnidx) : v_idx(vidx), vt_idx(vtidx), vn_idx(vnidx) {}; + +}; +// for std::map +static inline bool operator<(const vertex_index& a, const vertex_index& b) +{ + if (a.v_idx != b.v_idx) return (a.v_idx < b.v_idx); + if (a.vn_idx != b.vn_idx) return (a.vn_idx < b.vn_idx); + if (a.vt_idx != b.vt_idx) return (a.vt_idx < b.vt_idx); + return false; +} + +struct obj_shape +{ + std::vector v; + std::vector vn; + std::vector vt; +}; + +static inline bool isSpace(const char c) +{ + return (c == ' ') || (c == '\t'); +} + +static inline bool isNewLine(const char c) +{ + return (c == '\r') || (c == '\n') || (c == '\0'); +} + +// Make index zero-base, and also support relative index. +static inline int fixIndex(int idx, int n) +{ + int i; + + if (idx > 0) { + i = idx - 1; + } else if (idx == 0) { + i = 0; + } else { // negative value = relative + i = n + idx; + } + return i; +} + +static inline std::string parseString(const char*& token) +{ + std::string s; + auto b = strspn(token, " \t"); + auto e = strcspn(token, " \t\r"); + s = std::string(&token[b], &token[e]); + + token += (e - b); + return s; +} + +static inline int parseInt(const char*& token) +{ + token += strspn(token, " \t"); + int i = atoi(token); + token += strcspn(token, " \t\r"); + return i; +} + +static inline float parseFloat(const char*& token) +{ + token += strspn(token, " \t"); + float f = (float)atof(token); + token += strcspn(token, " \t\r"); + return f; +} + +static inline void parseFloat2(float& x, float& y, const char*& token) +{ + x = parseFloat(token); + y = parseFloat(token); +} + +static inline void parseFloat3(float& x, float& y, float& z, const char*& token) +{ + x = parseFloat(token); + y = parseFloat(token); + z = parseFloat(token); +} + +// Parse triples: i, i/j/k, i//k, i/j +static vertex_index parseTriple(const char* &token, int vsize, int vnsize, int vtsize) +{ + vertex_index vi(-1); + + vi.v_idx = fixIndex(atoi(token), vsize); + token += strcspn(token, "/ \t\r"); + if (token[0] != '/') { + return vi; + } + token++; + + // i//k + if (token[0] == '/') { + token++; + vi.vn_idx = fixIndex(atoi(token), vnsize); + token += strcspn(token, "/ \t\r"); + return vi; + } + + // i/j/k or i/j + vi.vt_idx = fixIndex(atoi(token), vtsize); + token += strcspn(token, "/ \t\r"); + if (token[0] != '/') { + return vi; + } + + // i/j/k + token++; // skip '/' + vi.vn_idx = fixIndex(atoi(token), vnsize); + token += strcspn(token, "/ \t\r"); + return vi; +} + +static ssize_t updateVertex( std::map& vertexCache, std::vector& positions, std::vector& normals, + std::vector& texcoords, const std::vector& in_positions, const std::vector& in_normals, const std::vector& in_texcoords, + const vertex_index& i) +{ + const auto it = vertexCache.find(i); + + if (it != vertexCache.end()) + { + // found cache + return it->second; + } + + assert(in_positions.size() > (3*i.v_idx+2)); + + positions.push_back(in_positions[3*i.v_idx+0]); + positions.push_back(in_positions[3*i.v_idx+1]); + positions.push_back(in_positions[3*i.v_idx+2]); + + if (i.vn_idx >= 0) + { + normals.push_back(in_normals[3*i.vn_idx+0]); + normals.push_back(in_normals[3*i.vn_idx+1]); + normals.push_back(in_normals[3*i.vn_idx+2]); + } + + if (i.vt_idx >= 0) + { + texcoords.push_back(in_texcoords[2*i.vt_idx+0]); + texcoords.push_back(in_texcoords[2*i.vt_idx+1]); + } + + auto idx = positions.size() / 3 - 1; + vertexCache[i] = idx; + + return idx; +} + +static bool exportFaceGroupToShape( std::map& vertexCache, ObjLoader::shapes_t& shapes, const std::vector &in_positions, + const std::vector &in_normals, const std::vector &in_texcoords, const std::vector >& faceGroup, + const ObjLoader::material_t &material, const std::string &name) +{ + if (faceGroup.empty()) + { + return false; + } + + // Flattened version of vertex data + std::vector& positions = shapes.positions; + std::vector& normals = shapes.normals; + std::vector& texcoords = shapes.texcoords; + std::vector indices; + + // Flatten vertices and indices + for (size_t i = 0; i < faceGroup.size(); i++) + { + const std::vector& face = faceGroup[i]; + + vertex_index i0 = face[0]; + vertex_index i1(-1); + vertex_index i2 = face[1]; + + size_t npolys = face.size(); + + // Polygon -> triangle fan conversion + for (size_t k = 2; k < npolys; k++) + { + i1 = i2; + i2 = face[k]; + + unsigned short v0 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i0); + unsigned short v1 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i1); + unsigned short v2 = updateVertex(vertexCache, positions, normals, texcoords, in_positions, in_normals, in_texcoords, i2); + + indices.push_back(v0); + indices.push_back(v1); + indices.push_back(v2); + } + } + + ObjLoader::shape_t shape; + shape.name = name; + shape.material = material; + shape.mesh.indices.swap(indices); + + shapes.shapes.push_back(shape); + return true; + +} + +std::string trim(const std::string& str) +{ + if (str.empty()) + return str; + auto len = str.length(); + char c = str[len - 1]; + while (c == '\r' || c == '\n') + { + len--; + c = str[len - 1]; + } + return str.substr(0, len); +} + +void InitMaterial(ObjLoader::material_t& material) +{ + material.name = ""; + material.ambient_texname = ""; + material.diffuse_texname = ""; + material.specular_texname = ""; + material.normal_texname = ""; + for (int i = 0; i < 3; i ++) + { + material.ambient[i] = 0.f; + material.diffuse[i] = 0.f; + material.specular[i] = 0.f; + material.transmittance[i] = 0.f; + material.emission[i] = 0.f; + } + material.illum = 0; + material.dissolve = 1.f; + material.shininess = 1.f; + material.unknown_parameter.clear(); +} + +std::string LoadMtl ( std::map& material_map, const char* filename, const char* mtl_basepath) +{ + material_map.clear(); + std::stringstream err; + + std::string filepath; + + if (mtl_basepath) + { + filepath = std::string(mtl_basepath) + std::string(filename); + } + else + { + filepath = std::string(filename); + } + + std::ifstream ifs(filepath.c_str()); + if (!ifs) + { + err << "Cannot open file [" << filepath << "]" << std::endl; + return err.str(); + } + + ObjLoader::material_t material; + + int maxchars = 8192; // Alloc enough size. + std::vector buf(maxchars); // Alloc enough size. + while (ifs.peek() != -1) + { + ifs.getline(&buf[0], maxchars); + + std::string linebuf(&buf[0]); + + // Trim newline '\r\n' or '\r' + if (linebuf.size() > 0) + { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + if (linebuf.size() > 0) + { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + + // Skip if empty line. + if (linebuf.empty()) + { + continue; + } + + // Skip leading space. + const char* token = linebuf.c_str(); + token += strspn(token, " \t"); + + assert(token); + if (token[0] == '\0') continue; // empty line + + if (token[0] == '#') continue; // comment line + + // new mtl + if ((0 == strncmp(token, "newmtl", 6)) && isSpace((token[6]))) + { + // flush previous material. + material_map.insert(std::pair(material.name, material)); + + // initial temporary material + InitMaterial(material); + + // set new mtl name + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + material.name = namebuf; + continue; + } + + // ambient + if (token[0] == 'K' && token[1] == 'a' && isSpace((token[2]))) + { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.ambient[0] = r; + material.ambient[1] = g; + material.ambient[2] = b; + continue; + } + + // diffuse + if (token[0] == 'K' && token[1] == 'd' && isSpace((token[2]))) + { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.diffuse[0] = r; + material.diffuse[1] = g; + material.diffuse[2] = b; + continue; + } + + // specular + if (token[0] == 'K' && token[1] == 's' && isSpace((token[2]))) + { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.specular[0] = r; + material.specular[1] = g; + material.specular[2] = b; + continue; + } + + // transmittance + if (token[0] == 'K' && token[1] == 't' && isSpace((token[2]))) + { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.transmittance[0] = r; + material.transmittance[1] = g; + material.transmittance[2] = b; + continue; + } + + // ior(index of refraction) + if (token[0] == 'N' && token[1] == 'i' && isSpace((token[2]))) + { + token += 2; + material.ior = parseFloat(token); + continue; + } + + // emission + if(token[0] == 'K' && token[1] == 'e' && isSpace(token[2])) + { + token += 2; + float r, g, b; + parseFloat3(r, g, b, token); + material.emission[0] = r; + material.emission[1] = g; + material.emission[2] = b; + continue; + } + + // shininess + if(token[0] == 'N' && token[1] == 's' && isSpace(token[2])) + { + token += 2; + material.shininess = parseFloat(token); + continue; + } + + // illum model + if (0 == strncmp(token, "illum", 5) && isSpace(token[5])) + { + token += 6; + material.illum = parseInt(token); + continue; + } + + // dissolve + if ((token[0] == 'd' && isSpace(token[1]))) + { + token += 1; + material.dissolve = parseFloat(token); + continue; + } + if (token[0] == 'T' && token[1] == 'r' && isSpace(token[2])) + { + token += 2; + material.dissolve = parseFloat(token); + continue; + } + + // ambient texture + if ((0 == strncmp(token, "map_Ka", 6)) && isSpace(token[6])) + { + token += 7; + material.ambient_texname = trim(token); + continue; + } + + // diffuse texture + if ((0 == strncmp(token, "map_Kd", 6)) && isSpace(token[6])) + { + token += 7; + material.diffuse_texname = trim(token); + continue; + } + + // specular texture + if ((0 == strncmp(token, "map_Ks", 6)) && isSpace(token[6])) + { + token += 7; + material.specular_texname = trim(token); + continue; + } + + // normal texture + if ((0 == strncmp(token, "map_Ns", 6)) && isSpace(token[6])) + { + token += 7; + material.normal_texname = trim(token); + continue; + } + + // unknown parameter + const char* _space = strchr(token, ' '); + if(!_space) + { + _space = strchr(token, '\t'); + } + if(_space) + { + auto len = _space - token; + std::string key(token, len); + std::string value = _space + 1; + material.unknown_parameter.insert(std::pair(key, value)); + } + } + // flush last material. + material_map.insert(std::pair(material.name, material)); + return err.str(); +} + +std::string ObjLoader::LoadObj(shapes_t& shapes, const char* filename, const char* mtl_basepath) +{ + shapes.reset(); + + std::stringstream err; + std::istringstream ifs(FileUtils::getInstance()->getStringFromFile(filename)); + std::map vertexCache; + //std::ifstream ifs(filename); + + if (!ifs) + { + err << "Cannot open file [" << filename << "]" << std::endl; + return err.str(); + } + + std::vector v; + std::vector vn; + std::vector vt; + std::vector > faceGroup; + std::string name; + + // material + std::map material_map; + material_t material; + + int maxchars = 8192; // Alloc enough size. + std::vector buf(maxchars); // Alloc enough size. + while (ifs.peek() != -1) + { + ifs.getline(&buf[0], maxchars); + + std::string linebuf(&buf[0]); + + // Trim newline '\r\n' or '\r' + if (linebuf.size() > 0) + { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + if (linebuf.size() > 0) + { + if (linebuf[linebuf.size()-1] == '\n') linebuf.erase(linebuf.size()-1); + } + + // Skip if empty line. + if (linebuf.empty()) + { + continue; + } + + // Skip leading space. + const char* token = linebuf.c_str(); + token += strspn(token, " \t"); + + assert(token); + if (token[0] == '\0') continue; // empty line + + if (token[0] == '#') continue; // comment line + + // vertex + if (token[0] == 'v' && isSpace((token[1]))) + { + token += 2; + float x, y, z; + parseFloat3(x, y, z, token); + v.push_back(x); + v.push_back(y); + v.push_back(z); + continue; + } + + // normal + if (token[0] == 'v' && token[1] == 'n' && isSpace((token[2]))) + { + token += 3; + float x, y, z; + parseFloat3(x, y, z, token); + vn.push_back(x); + vn.push_back(y); + vn.push_back(z); + continue; + } + + // texcoord + if (token[0] == 'v' && token[1] == 't' && isSpace((token[2]))) + { + token += 3; + float x, y; + parseFloat2(x, y, token); + vt.push_back(x); + vt.push_back(y); + continue; + } + + // face + if (token[0] == 'f' && isSpace((token[1]))) + { + token += 2; + token += strspn(token, " \t"); + + std::vector face; + while (!isNewLine(token[0])) { + vertex_index vi = parseTriple(token, v.size() / 3, vn.size() / 3, vt.size() / 2); + face.push_back(vi); + auto n = strspn(token, " \t\r"); + token += n; + } + + faceGroup.push_back(face); + + continue; + } + + // use mtl + if ((0 == strncmp(token, "usemtl", 6)) && isSpace((token[6]))) + { + + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + + if (material_map.find(namebuf) != material_map.end()) + { + material = material_map[namebuf]; + } + else + { + // { error!! material not found } + InitMaterial(material); + } + continue; + + } + + // load mtl + if ((0 == strncmp(token, "mtllib", 6)) && isSpace((token[6]))) + { + char namebuf[4096]; + token += 7; + sscanf(token, "%s", namebuf); + + std::string err_mtl = LoadMtl(material_map, namebuf, mtl_basepath); + if (!err_mtl.empty()) + { + faceGroup.clear(); // for safety + //return err_mtl; + } + continue; + } + + // group name + if (token[0] == 'g' && isSpace((token[1]))) + { + // flush previous face group. + shape_t shape; + exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name); + + faceGroup.clear(); + + std::vector names; + while (!isNewLine(token[0])) + { + std::string str = parseString(token); + names.push_back(str); + token += strspn(token, " \t\r"); // skip tag + } + + assert(names.size() > 0); + + // names[0] must be 'g', so skipt 0th element. + if (names.size() > 1) + { + name = names[1]; + } + else + { + name = ""; + } + + continue; + } + + // object name + if (token[0] == 'o' && isSpace((token[1]))) + { + // flush previous face group. + shape_t shape; + exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name); + + faceGroup.clear(); + + // @todo { multiple object name? } + char namebuf[4096]; + token += 2; + sscanf(token, "%s", namebuf); + name = std::string(namebuf); + + continue; + } + + // Ignore unknown command. + } + + shape_t shape; + exportFaceGroupToShape(vertexCache, shapes, v, vn, vt, faceGroup, material, name); + faceGroup.clear(); // for safety + + return err.str(); +} + +NS_CC_END diff --git a/cocos/3d/CCObjLoader.h b/cocos/3d/CCObjLoader.h new file mode 100644 index 0000000000..a0ef97cb4d --- /dev/null +++ b/cocos/3d/CCObjLoader.h @@ -0,0 +1,87 @@ +// +// Copyright 2012-2013, Syoyo Fujita. +// +// Licensed under 2-clause BSD liecense. +// +// copied from Syoyo Fujita +// https://github.com/syoyo/tinyobjloader + +#ifndef __CCOBJLOADER_H__ +#define __CCOBJLOADER_H__ + +#include +#include +#include +#include "base/ccTypes.h" + +NS_CC_BEGIN + +class ObjLoader +{ +public: + typedef struct + { + std::string name; + + float ambient[3]; + float diffuse[3]; + float specular[3]; + float transmittance[3]; + float emission[3]; + float shininess; + float ior; // index of refraction + float dissolve; // 1 == opaque; 0 == fully transparent + // illumination model (see http://www.fileformat.info/format/material/) + int illum; + + std::string ambient_texname; + std::string diffuse_texname; + std::string specular_texname; + std::string normal_texname; + std::map unknown_parameter; + } material_t; + + typedef struct + { + std::vector indices; + } mesh_t; + + typedef struct + { + std::string name; + material_t material; + mesh_t mesh; + } shape_t; + + typedef struct + { + std::vector positions; + std::vector normals; + std::vector texcoords; + + std::vector shapes; + + void reset() + { + positions.clear(); + normals.clear(); + texcoords.clear(); + shapes.clear(); + } + }shapes_t; + + /// Loads .obj from a file. + /// 'shapes' will be filled with parsed shape data + /// The function returns error string. + /// Returns empty string when loading .obj success. + /// 'mtl_basepath' is optional, and used for base path for .mtl file. + static std::string LoadObj( + shapes_t& shapes, // [output] + const char* filename, + const char* mtl_basepath = NULL); + +}; + +NS_CC_END + +#endif // _TINY_OBJ_LOADER_H diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp new file mode 100644 index 0000000000..06d9b1be7e --- /dev/null +++ b/cocos/3d/CCSprite3D.cpp @@ -0,0 +1,271 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "3d/CCSprite3D.h" +#include "3d/CCSprite3DDataCache.h" +#include "3d/CCMesh.h" +#include "3d/CCObjLoader.h" + +#include "base/CCDirector.h" +#include "base/CCPlatformMacros.h" +#include "base/ccMacros.h" +#include "platform/CCFileUtils.h" +#include "renderer/CCTextureCache.h" +#include "renderer/CCRenderer.h" +#include "renderer/CCGLProgramState.h" +#include "renderer/CCGLProgramCache.h" + +#include "deprecated/CCString.h" // For StringUtils::format + +NS_CC_BEGIN + +std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_NORMAL}; + +Sprite3D* Sprite3D::create(const std::string &modelPath) +{ + if (modelPath.length() < 4) + CCASSERT(false, "improper name specified when creating Sprite3D"); + + auto sprite = new Sprite3D(); + if (sprite && sprite->initWithFile(modelPath)) + { + sprite->autorelease(); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + +Sprite3D* Sprite3D::create(const std::string &modelPath, const std::string &texturePath) +{ + auto sprite = create(modelPath); + if (sprite) + { + sprite->setTexture(texturePath); + } + + return sprite; +} + +// Sprite3D* Sprite3D::create(Mesh* mesh, const std::string& texturePath) +// { +// CCASSERT(nullptr != mesh, "Could not create a Sprite3D from a null Mesh"); +// auto sprite = new Sprite3D(); +// if(sprite) +// { +// sprite->_mesh = mesh; +// sprite->_mesh->retain(); +// sprite->setTexture(texturePath); +// sprite->autorelease(); +// return sprite; +// } +// CC_SAFE_DELETE(sprite); +// return nullptr; +// } + +//.mtl file should at the same directory with the same name if exist +bool Sprite3D::loadFromObj(const std::string& path) +{ + std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path); + + //.mtl file directory + std::string dir = ""; + auto last = fullPath.rfind("/"); + if (last != -1) + dir = fullPath.substr(0, last + 1); + + ObjLoader::shapes_t shapes; + std::string errstr = ObjLoader::LoadObj(shapes, fullPath.c_str(), dir.c_str()); + if (!errstr.empty()) + return false; + + //convert to mesh and material + std::vector indices; + std::vector matnames; + std::string texname; + for (auto it = shapes.shapes.begin(); it != shapes.shapes.end(); it++) + { + indices.insert(indices.end(), (*it).mesh.indices.begin(),(*it).mesh.indices.end()); + //indices.push_back((*it).mesh.indices); + if (texname.empty()) + texname = (*it).material.diffuse_texname; + else if (texname != (*it).material.diffuse_texname) + { + CCLOGWARN("cocos2d:WARNING: more than one texture in %s", path.c_str()); + } + + matnames.push_back(dir + (*it).material.diffuse_texname); + } + _mesh = Mesh::create(shapes.positions, shapes.normals, shapes.texcoords, indices); + + _mesh->retain(); + if (_mesh == nullptr) + return false; + + if (matnames.size()) + { + setTexture(matnames[0]); + } + genGLProgramState(); + + //add to cache + Sprite3DDataCache::getInstance()->addSprite3D(fullPath, _mesh, matnames.size() > 0 ? matnames[0] : ""); + + return true; +} + +Sprite3D::Sprite3D() +: _mesh(nullptr) +, _texture(nullptr) +, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED) +{ +} + +Sprite3D::~Sprite3D() +{ + CC_SAFE_RELEASE_NULL(_texture); + CC_SAFE_RELEASE_NULL(_mesh); +} + +bool Sprite3D::initWithFile(const std::string &path) +{ + CC_SAFE_RELEASE_NULL(_mesh); + + CC_SAFE_RELEASE_NULL(_texture); + + //find from the cache + Mesh* mesh = Sprite3DDataCache::getInstance()->getSprite3DMesh(path); + if (mesh) + { + _mesh = mesh; + _mesh->retain(); + + auto tex = Sprite3DDataCache::getInstance()->getSprite3DTexture(path); + setTexture(tex); + + genGLProgramState(); + + return true; + } + else + { + //load from file + std::string ext = path.substr(path.length() - 4, 4); + if (ext != ".obj" || !loadFromObj(path)) + { + return false; + } + return true; + } +} + +void Sprite3D::genGLProgramState() +{ + auto programstate = GLProgramState::getOrCreateWithGLProgram(getDefaultGLProgram(_mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD))); + long offset = 0; + auto attributeCount = _mesh->getMeshVertexAttribCount(); + for (auto k = 0; k < attributeCount; k++) { + auto meshattribute = _mesh->getMeshVertexAttribute(k); + programstate->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib], + meshattribute.size, + meshattribute.type, + GL_FALSE, + _mesh->getVertexSizeInBytes(), + (GLvoid*)offset); + offset += meshattribute.attribSizeBytes; + } + + setGLProgramState(programstate); +} + +GLProgram* Sprite3D::getDefaultGLProgram(bool textured) +{ + if(textured) + { + return GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE); + } + else + { + return GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION); + } +} + +void Sprite3D::setTexture(const std::string& texFile) +{ + auto tex = Director::getInstance()->getTextureCache()->addImage(texFile); + if( tex && _texture != tex ) { + CC_SAFE_RETAIN(tex); + CC_SAFE_RELEASE_NULL(_texture); + _texture = tex; + } +} + +void Sprite3D::setTexture(Texture2D* texture) +{ + if(_texture != texture) { + CC_SAFE_RETAIN(texture); + CC_SAFE_RELEASE_NULL(_texture); + _texture = texture; + } +} + +void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, bool transformUpdated) +{ + GLProgramState* programstate = getGLProgramState(); + Color4F color(getDisplayedColor()); + color.a = getDisplayedOpacity() / 255.0f; + + GLuint textureID = _texture ? _texture->getName() : 0; + _meshCommand.init(_globalZOrder, + textureID, + programstate, + _blend, + _mesh->getVertexBuffer(), + _mesh->getIndexBuffer(), + (GLenum)_mesh->getPrimitiveType(), + (GLenum)_mesh->getIndexFormat(), + _mesh->getIndexCount(), + transform); + + _meshCommand.setCullFaceEnabled(true); + _meshCommand.setDepthTestEnabled(true); + //support tint and fade + _meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a)); + Director::getInstance()->getRenderer()->addCommand(&_meshCommand); +} + +void Sprite3D::setBlendFunc(const BlendFunc &blendFunc) +{ + if(_blend.src != blendFunc.src || _blend.dst != blendFunc.dst) + { + _blend = blendFunc; + } +} + +const BlendFunc& Sprite3D::getBlendFunc() const +{ + return _blend; +} + +NS_CC_END diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h new file mode 100644 index 0000000000..3d6559f662 --- /dev/null +++ b/cocos/3d/CCSprite3D.h @@ -0,0 +1,85 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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 __CCSPRITE3D_H__ +#define __CCSPRITE3D_H__ + +#include + +#include "base/CCVector.h" +#include "base/ccTypes.h" +#include "base/CCProtocols.h" +#include "2d/CCNode.h" +#include "renderer/CCMeshCommand.h" + +NS_CC_BEGIN + +class GLProgramState; +class Mesh; +class Texture2D; + +/** Sprite3D: TODO add description */ +class Sprite3D : public Node, public BlendProtocol +{ +public: + /// creates a Sprite3D + static Sprite3D* create(const std::string &modelPath); + + // creates a Sprite3D. It only supports one texture, and overrides the internal texture with 'texturePath' + static Sprite3D* create(const std::string &modelPath, const std::string &texturePath); + + //set texture + void setTexture(const std::string& texFile); + void setTexture(Texture2D* texture); + + Mesh* getMesh() const { return _mesh; } + + // overrides + virtual void setBlendFunc(const BlendFunc &blendFunc) override; + virtual const BlendFunc &getBlendFunc() const override; + +protected: + Sprite3D(); + virtual ~Sprite3D(); + bool initWithFile(const std::string &path); + + //.mtl file should at the same directory with the same name if exist + bool loadFromObj(const std::string& path); + + virtual void draw(Renderer *renderer, const Mat4 &transform, bool transformUpdated) override; + + virtual GLProgram* getDefaultGLProgram(bool textured = true); + + void genGLProgramState(); + + Mesh *_mesh; + MeshCommand _meshCommand; + Texture2D* _texture; + BlendFunc _blend; +}; + +extern std::string s_attributeNames[]; + +NS_CC_END +#endif // __SPRITE3D_H_ diff --git a/cocos/3d/CCSprite3DDataCache.cpp b/cocos/3d/CCSprite3DDataCache.cpp new file mode 100644 index 0000000000..3b5748b49f --- /dev/null +++ b/cocos/3d/CCSprite3DDataCache.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "3d/CCSprite3DDataCache.h" + +#include "3d/CCMesh.h" +#include "platform/CCFileUtils.h" +#include "renderer/CCTextureCache.h" +#include "base/CCEventCustom.h" +#include "base/CCEventListenerCustom.h" +#include "base/CCEventDispatcher.h" +#include "base/CCEventType.h" +#include "base/CCDirector.h" + +NS_CC_BEGIN + +Sprite3DDataCache* Sprite3DDataCache::_cacheInstance = nullptr; + +Sprite3DDataCache::Sprite3DDataCache() +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + // listen the event when app go to foreground + _backToForegroundlistener = EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, CC_CALLBACK_1(Sprite3DDataCache::listenBackToForeground, this)); + Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundlistener, -1); + #endif +} + +Sprite3DDataCache::~Sprite3DDataCache() +{ + removeAllSprite3DData(); + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundlistener); + #endif +} + +Sprite3DDataCache* Sprite3DDataCache::getInstance() +{ + if (! _cacheInstance) + { + _cacheInstance = new Sprite3DDataCache(); + } + + return _cacheInstance; +} + +void Sprite3DDataCache::purgeMeshCache() +{ + if (_cacheInstance) + { + CC_SAFE_DELETE(_cacheInstance); + } +} + +bool Sprite3DDataCache::addSprite3D(const std::string& fileName, Mesh* mesh, const std::string& texture) +{ + const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); + auto itr = _sprite3DDatas.find(fullPath); + if (itr == _sprite3DDatas.end()) + { + Sprite3DData data; + data.mesh = mesh; + CC_SAFE_RETAIN(mesh); + data.texture = texture; + _sprite3DDatas[fullPath] = data; + return true; + } + return false; +} + +Mesh* Sprite3DDataCache::getSprite3DMesh(const std::string& fileName) +{ + const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); + auto itr = _sprite3DDatas.find(fullPath); + if (itr != _sprite3DDatas.end()) + return itr->second.mesh; + return nullptr; +} + +Texture2D* Sprite3DDataCache::getSprite3DTexture(const std::string& fileName) +{ + const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); + auto itr = _sprite3DDatas.find(fullPath); + if (itr != _sprite3DDatas.end()) + { + auto cache = Director::getInstance()->getTextureCache(); + return cache->addImage(itr->second.texture); + } + return nullptr; +} + +void Sprite3DDataCache::removeAllSprite3DData() +{ + for (auto itr = _sprite3DDatas.begin(); itr != _sprite3DDatas.end(); itr++) { + CC_SAFE_RELEASE_NULL(itr->second.mesh); + } + _sprite3DDatas.clear(); +} +void Sprite3DDataCache::removeUnusedSprite3DData() +{ + for( auto it=_sprite3DDatas.cbegin(); it!=_sprite3DDatas.cend(); /* nothing */) { + auto value = it->second; + if( value.mesh->getReferenceCount() == 1 ) { + CCLOG("cocos2d: GLProgramStateCache: removing unused GLProgramState"); + + value.mesh->release(); + _sprite3DDatas.erase(it++); + } else { + ++it; + } + } +} + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +void Sprite3DDataCache::listenBackToForeground(EventCustom* event) +{ + for (auto iter = _sprite3DDatas.begin(); iter != _sprite3DDatas.end(); ++iter) + { + auto mesh = iter->second.mesh; + mesh->restore(); + } +} +#endif + +NS_CC_END diff --git a/cocos/3d/CCSprite3DDataCache.h b/cocos/3d/CCSprite3DDataCache.h new file mode 100644 index 0000000000..f6e80fb489 --- /dev/null +++ b/cocos/3d/CCSprite3DDataCache.h @@ -0,0 +1,83 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + 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 __CCSPRIT3DDATA_CACHE_H__ +#define __CCSPRIT3DDATA_CACHE_H__ + +#include +#include +#include "base/ccTypes.h" +#include "base/CCMap.h" + +NS_CC_BEGIN + +class Sprite3D; +class Mesh; +class EventListenerCustom; +class EventCustom; +class Texture2D; + +class Sprite3DDataCache +{ +public: + struct Sprite3DData + { + Mesh* mesh; + std::string texture; + }; + + static Sprite3DDataCache* getInstance(); + static void purgeMeshCache(); + + bool addSprite3D(const std::string& fileName, Mesh* mesh, const std::string& texture); + + Mesh* getSprite3DMesh(const std::string& fileName); + + Texture2D* getSprite3DTexture(const std::string& fileName); + + void removeAllSprite3DData(); + void removeUnusedSprite3DData(); + + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + void listenBackToForeground(EventCustom* event); + #endif + +protected: + Sprite3DDataCache(); + + ~Sprite3DDataCache(); + + static Sprite3DDataCache* _cacheInstance; + + std::unordered_map _sprite3DDatas; //sprites + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + EventListenerCustom* _backToForegroundlistener; + #endif +}; + +NS_CC_END + +#endif // __CCSPRIT3DDATA_CACHE_H__ diff --git a/cocos/3d/CMakeLists.txt b/cocos/3d/CMakeLists.txt new file mode 100644 index 0000000000..cb7d6a9de3 --- /dev/null +++ b/cocos/3d/CMakeLists.txt @@ -0,0 +1,7 @@ +set(COCOS_3D_SRC + 3d/CCMesh.cpp + 3d/CCObjLoader.cpp + 3d/CCSprite3D.cpp + 3d/CCSprite3DDataCache.cpp +) + diff --git a/cocos/Android.mk b/cocos/Android.mk index 22112f4be5..70603cfd6a 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -71,6 +71,10 @@ cocos2d.cpp \ 2d/CCTransitionPageTurn.cpp \ 2d/CCTransitionProgress.cpp \ 2d/CCTweenFunction.cpp \ +3d/CCMesh.cpp \ +3d/CCSprite3DDataCache.cpp \ +3d/CCObjLoader.cpp \ +3d/CCSprite3D.cpp \ platform/CCGLViewProtocol.cpp \ platform/CCFileUtils.cpp \ platform/CCSAXParser.cpp \ @@ -136,6 +140,7 @@ renderer/CCGLProgramState.cpp \ renderer/CCGLProgramStateCache.cpp \ renderer/CCGroupCommand.cpp \ renderer/CCQuadCommand.cpp \ +renderer/CCMeshCommand.cpp \ renderer/CCRenderCommand.cpp \ renderer/CCRenderer.cpp \ renderer/CCTexture2D.cpp \ diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index 7541b3c039..1479931bc8 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -8,6 +8,7 @@ set(COCOS_SRC ) include(2d/CMakeLists.txt) +include(3d/CMakeLists.txt) include(platform/CMakeLists.txt) include(physics/CMakeLists.txt) include(math/CMakeLists.txt) @@ -21,6 +22,7 @@ include(storage/CMakeLists.txt) add_library(cocos2d STATIC ${COCOS_SRC} ${COCOS_2D_SRC} + ${COCOS_3D_SRC} ${COCOS_PLATFORM_SRC} ${COCOS_BASE_SRC} ${COCOS_RENDERER_SRC} diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index b26c4026e1..41b3a0a89f 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -257,6 +257,10 @@ THE SOFTWARE. #include "2d/CCComponent.h" #include "2d/CCComponentContainer.h" +//3d +#include "3d/CCSprite3D.h" +#include "3d/CCMesh.h" + // Audio #include "audio/include/SimpleAudioEngine.h" diff --git a/cocos/platform/wp8/DirectXBase.cpp b/cocos/platform/wp8/DirectXBase.cpp index 0682646062..416106ce8b 100644 --- a/cocos/platform/wp8/DirectXBase.cpp +++ b/cocos/platform/wp8/DirectXBase.cpp @@ -1,4 +1,8 @@ -#include +// XXX: For some reason, this file must not be compiled +// XXX: Ask MS why +#if 0 + +#include #include #include "DirectXBase.h" @@ -275,4 +279,6 @@ void DirectXBase::SetDpi(float dpi) // will not change, and the window resize code will only be executed once. UpdateForWindowSizeChange(); } -} \ No newline at end of file +} + +#endif //0 diff --git a/cocos/platform/wp8/DirectXBase.h b/cocos/platform/wp8/DirectXBase.h index 0749973da6..72187253a5 100644 --- a/cocos/platform/wp8/DirectXBase.h +++ b/cocos/platform/wp8/DirectXBase.h @@ -1,4 +1,8 @@ -#pragma once +// XXX: For some reason, this file must not be compiled +// XXX: Ask MS why +#if 0 + +#pragma once #include "DirectXHelper.h" #include @@ -37,4 +41,6 @@ protected private: Platform::Agile m_window; float m_dpi; -}; \ No newline at end of file +}; + +#endif // 0 \ No newline at end of file diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index 9806874f03..421eec76da 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -71,6 +71,9 @@ const char* GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW = "ShaderLabelDFGlow const char* GLProgram::SHADER_NAME_LABEL_NORMAL = "ShaderLabelNormal"; const char* GLProgram::SHADER_NAME_LABEL_OUTLINE = "ShaderLabelOutline"; +const char* GLProgram::SHADER_3D_POSITION = "Shader3DPosition"; +const char* GLProgram::SHADER_3D_POSITION_TEXTURE = "Shader3DPositionTexture"; + // uniform names const char* GLProgram::UNIFORM_NAME_P_MATRIX = "CC_PMatrix"; diff --git a/cocos/renderer/CCGLProgram.h b/cocos/renderer/CCGLProgram.h index 0958ed8ebb..eb20990219 100644 --- a/cocos/renderer/CCGLProgram.h +++ b/cocos/renderer/CCGLProgram.h @@ -127,6 +127,9 @@ public: static const char* SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL; static const char* SHADER_NAME_LABEL_DISTANCEFIELD_GLOW; + //3D + static const char* SHADER_3D_POSITION; + static const char* SHADER_3D_POSITION_TEXTURE; // uniform names static const char* UNIFORM_NAME_P_MATRIX; diff --git a/cocos/renderer/CCGLProgramCache.cpp b/cocos/renderer/CCGLProgramCache.cpp index c2ce9c9dbf..a47e3a5842 100644 --- a/cocos/renderer/CCGLProgramCache.cpp +++ b/cocos/renderer/CCGLProgramCache.cpp @@ -49,6 +49,8 @@ enum { kShaderType_LabelDistanceFieldGlow, kShaderType_LabelNormal, kShaderType_LabelOutline, + kShaderType_3DPosition, + kShaderType_3DPositionTex, kShaderType_MAX, }; @@ -189,6 +191,15 @@ void GLProgramCache::loadDefaultGLPrograms() p = new GLProgram(); loadDefaultGLProgram(p, kShaderType_LabelOutline); _programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_OUTLINE, p) ); + + p = new GLProgram(); + loadDefaultGLProgram(p, kShaderType_3DPosition); + _programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION, p) ); + + p = new GLProgram(); + loadDefaultGLProgram(p, kShaderType_3DPositionTex); + _programs.insert( std::make_pair(GLProgram::SHADER_3D_POSITION_TEXTURE, p) ); + } void GLProgramCache::reloadDefaultGLPrograms() @@ -277,6 +288,15 @@ void GLProgramCache::reloadDefaultGLPrograms() p = getGLProgram(GLProgram::SHADER_NAME_LABEL_OUTLINE); p->reset(); loadDefaultGLProgram(p, kShaderType_LabelOutline); + + p = getGLProgram(GLProgram::SHADER_3D_POSITION); + p->reset(); + loadDefaultGLProgram(p, kShaderType_3DPosition); + + p = getGLProgram(GLProgram::SHADER_3D_POSITION_TEXTURE); + p->reset(); + loadDefaultGLProgram(p, kShaderType_3DPositionTex); + } void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type) @@ -330,6 +350,12 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type) case kShaderType_LabelOutline: p->initWithByteArrays(ccLabel_vert, ccLabelOutline_frag); break; + case kShaderType_3DPosition: + p->initWithByteArrays(cc3D_PositionTex_vert, cc3D_Color_frag); + break; + case kShaderType_3DPositionTex: + p->initWithByteArrays(cc3D_PositionTex_vert, cc3D_ColorTex_frag); + break; default: CCLOG("cocos2d: %s:%d, error shader type", __FUNCTION__, __LINE__); return; diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp new file mode 100644 index 0000000000..974fecfcc0 --- /dev/null +++ b/cocos/renderer/CCMeshCommand.cpp @@ -0,0 +1,164 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "base/ccMacros.h" +#include "base/CCDirector.h" +#include "renderer/CCMeshCommand.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCGLProgramState.h" +#include "renderer/CCRenderer.h" +#include "renderer/CCTextureAtlas.h" +#include "renderer/CCTexture2D.h" + +NS_CC_BEGIN + +MeshCommand::MeshCommand() +: _textureID(0) +, _blendType(BlendFunc::DISABLE) +, _glProgramState(nullptr) +, _cullFaceEnabled(false) +, _cullFace(GL_BACK) +, _depthTestEnabled(false) +, _depthWriteEnabled(false) +, _displayColor(1.0f, 1.0f, 1.0f, 1.0f) +{ + _type = RenderCommand::Type::MESH_COMMAND; +} + +void MeshCommand::init(float globalOrder, + GLuint textureID, + GLProgramState* glProgramState, + BlendFunc blendType, + GLuint vertexBuffer, + GLuint indexBuffer, + GLenum primitive, + GLenum indexFormat, + ssize_t indexCount, + const Mat4 &mv) +{ + CCASSERT(glProgramState, "GLProgramState cannot be nill"); + + _globalOrder = globalOrder; + _textureID = textureID; + _blendType = blendType; + _glProgramState = glProgramState; + + _vertexBuffer = vertexBuffer; + _indexBuffer = indexBuffer; + _primitive = primitive; + _indexFormat = indexFormat; + _indexCount = indexCount; + _mv = mv; +} + +void MeshCommand::setCullFaceEnabled(bool enable) +{ + _cullFaceEnabled = enable; +} + +void MeshCommand::setCullFace(GLenum cullFace) +{ + _cullFace = cullFace; +} + +void MeshCommand::setDepthTestEnabled(bool enable) +{ + _depthTestEnabled = enable; +} + +void MeshCommand::setDepthWriteEnabled(bool enable) +{ + _depthWriteEnabled = enable; +} + +void MeshCommand::setDisplayColor(const Vec4& color) +{ + _displayColor = color; +} + +MeshCommand::~MeshCommand() +{ +} + +void MeshCommand::applyRenderState() +{ + if (_cullFaceEnabled) + { + glEnable(GL_CULL_FACE); + glCullFace(_cullFace); + } + if (_depthTestEnabled) + { + glEnable(GL_DEPTH_TEST); + } + if (_depthWriteEnabled) + { + glDepthMask(GL_TRUE); + } +} + +void MeshCommand::restoreRenderState() +{ + if (_cullFaceEnabled) + { + glDisable(GL_CULL_FACE); + } + if (_depthTestEnabled) + { + glDisable(GL_DEPTH_TEST); + } + if (_depthWriteEnabled) + { + glDepthMask(GL_FALSE); + } +} + +void MeshCommand::execute() +{ + // set render state + applyRenderState(); + + // Set material + GL::bindTexture2D(_textureID); + GL::blendFunc(_blendType.src, _blendType.dst); + + glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); + _glProgramState->setUniformVec4("u_color", _displayColor); + _glProgramState->apply(_mv); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); + + // Draw + glDrawElements(_primitive, (GLsizei)_indexCount, _indexFormat, 0); + + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _indexCount); + + //restore render state + restoreRenderState(); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); +} + +NS_CC_END \ No newline at end of file diff --git a/cocos/renderer/CCMeshCommand.h b/cocos/renderer/CCMeshCommand.h new file mode 100644 index 0000000000..b99793f40c --- /dev/null +++ b/cocos/renderer/CCMeshCommand.h @@ -0,0 +1,91 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + 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 _CC_MESHCOMMAND_H_ +#define _CC_MESHCOMMAND_H_ + +#include "CCRenderCommand.h" +#include "renderer/CCGLProgram.h" +#include "math/CCMath.h" +#include "CCRenderCommandPool.h" + +NS_CC_BEGIN + +class GLProgramState; + +//it is a common mesh +class MeshCommand : public RenderCommand +{ +public: + + MeshCommand(); + ~MeshCommand(); + + void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, GLuint vertexBuffer, GLuint indexBuffer, GLenum primitive, GLenum indexType, ssize_t indexCount, const Mat4 &mv); + + void setCullFaceEnabled(bool enable); + + void setCullFace(GLenum cullFace); + + void setDepthTestEnabled(bool enable); + + void setDepthWriteEnabled(bool enable); + + void setDisplayColor(const Vec4& color); + + void execute(); + +protected: + // apply renderstate + void applyRenderState(); + + //restore to all false + void restoreRenderState(); + + GLuint _textureID; + GLProgramState* _glProgramState; + BlendFunc _blendType; + + GLuint _textrueID; + + Vec4 _displayColor; // in order to support tint and fade in fade out + + GLuint _vertexBuffer; + GLuint _indexBuffer; + GLenum _primitive; + GLenum _indexFormat; + ssize_t _indexCount; + + // States, default value all false + bool _cullFaceEnabled; + GLenum _cullFace; + bool _depthTestEnabled; + bool _depthWriteEnabled; + + // ModelView transform + Mat4 _mv; +}; +NS_CC_END + +#endif //_CC_MESHCOMMAND_H_ diff --git a/cocos/renderer/CCRenderCommand.h b/cocos/renderer/CCRenderCommand.h index 2caf58e2a0..01611aea7b 100644 --- a/cocos/renderer/CCRenderCommand.h +++ b/cocos/renderer/CCRenderCommand.h @@ -48,6 +48,7 @@ public: CUSTOM_COMMAND, BATCH_COMMAND, GROUP_COMMAND, + MESH_COMMAND, }; /** Get Render Command Id */ diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index f090b2e941..222118da6f 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -32,6 +32,7 @@ #include "renderer/CCGroupCommand.h" #include "renderer/CCGLProgramCache.h" #include "renderer/ccGLStateCache.h" +#include "renderer/CCMeshCommand.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" #include "base/CCEventDispatcher.h" @@ -318,6 +319,12 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) auto cmd = static_cast(command); cmd->execute(); } + else if (RenderCommand::Type::MESH_COMMAND == commandType) + { + flush(); + auto cmd = static_cast(command); + cmd->execute(); + } else { CCLOGERROR("Unknown commands in renderQueue"); diff --git a/cocos/renderer/CMakeLists.txt b/cocos/renderer/CMakeLists.txt index 42a78f3c23..b86e1aed6c 100644 --- a/cocos/renderer/CMakeLists.txt +++ b/cocos/renderer/CMakeLists.txt @@ -1,6 +1,7 @@ set(COCOS_RENDERER_SRC renderer/CCBatchCommand.cpp renderer/CCCustomCommand.cpp + renderer/CCMeshCommand.cpp renderer/CCGLProgramCache.cpp renderer/CCGLProgram.cpp renderer/CCGLProgramStateCache.cpp diff --git a/cocos/renderer/ccShader_3D_Color.frag b/cocos/renderer/ccShader_3D_Color.frag new file mode 100644 index 0000000000..d5f5913f97 --- /dev/null +++ b/cocos/renderer/ccShader_3D_Color.frag @@ -0,0 +1,15 @@ + +const char* cc3D_Color_frag = STRINGIFY( + +\n#ifdef GL_ES\n +varying lowp vec4 DestinationColor; +\n#else\n +varying vec4 DestinationColor; +\n#endif\n +uniform vec4 u_color; + +void main(void) +{ + gl_FragColor = u_color; +} +); diff --git a/cocos/renderer/ccShader_3D_ColorTex.frag b/cocos/renderer/ccShader_3D_ColorTex.frag new file mode 100644 index 0000000000..d7465c9013 --- /dev/null +++ b/cocos/renderer/ccShader_3D_ColorTex.frag @@ -0,0 +1,15 @@ + +const char* cc3D_ColorTex_frag = STRINGIFY( + +\n#ifdef GL_ES\n +varying mediump vec2 TextureCoordOut; +\n#else\n +varying vec2 TextureCoordOut; +\n#endif\n +uniform vec4 u_color; + +void main(void) +{ + gl_FragColor = texture2D(CC_Texture0, TextureCoordOut) * u_color; +} +); diff --git a/cocos/renderer/ccShader_3D_PositionTex.vert b/cocos/renderer/ccShader_3D_PositionTex.vert new file mode 100644 index 0000000000..0cc61a9643 --- /dev/null +++ b/cocos/renderer/ccShader_3D_PositionTex.vert @@ -0,0 +1,15 @@ + +const char* cc3D_PositionTex_vert = STRINGIFY( + +attribute vec4 a_position; +attribute vec2 a_texCoord; + +varying vec2 TextureCoordOut; + +void main(void) +{ + gl_Position = CC_MVPMatrix * a_position; + TextureCoordOut = a_texCoord; + TextureCoordOut.y = 1.0 - TextureCoordOut.y; +} +); diff --git a/cocos/renderer/ccShaders.cpp b/cocos/renderer/ccShaders.cpp index 4f825e9c75..8da8ba88c6 100644 --- a/cocos/renderer/ccShaders.cpp +++ b/cocos/renderer/ccShaders.cpp @@ -70,4 +70,9 @@ NS_CC_BEGIN #include "ccShader_Label_normal.frag" #include "ccShader_Label_outline.frag" +// +#include "ccShader_3D_PositionTex.vert" +#include "ccShader_3D_Color.frag" +#include "ccShader_3D_ColorTex.frag" + NS_CC_END diff --git a/cocos/renderer/ccShaders.h b/cocos/renderer/ccShaders.h index 77784deba4..4c9c832b9d 100644 --- a/cocos/renderer/ccShaders.h +++ b/cocos/renderer/ccShaders.h @@ -69,6 +69,9 @@ extern CC_DLL const GLchar * ccLabelOutline_frag; extern CC_DLL const GLchar * ccLabel_vert; +extern CC_DLL const GLchar * cc3D_PositionTex_vert; +extern CC_DLL const GLchar * cc3D_ColorTex_frag; +extern CC_DLL const GLchar * cc3D_Color_frag; // end of shaders group /// @} diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index ae8ac00a5f..002ca9504d 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -184,7 +184,16 @@ "cocos/2d/cocos2d_wp8.vcxproj", "cocos/2d/cocos2d_wp8.vcxproj.filters", "cocos/2d/cocos2d_wp8_headers.props", - "cocos/2d/cocos2dx.props", + "cocos/2d/cocos2dx.props", + "cocos/3d/CMakeLists.txt", + "cocos/3d/CCSprite3DDataCache.h", + "cocos/3d/CCSprite3DDataCache.cpp", + "cocos/3d/CCSprite3D.h", + "cocos/3d/CCSprite3D.cpp", + "cocos/3d/CCObjLoader.h", + "cocos/3d/CCObjLoader.cpp", + "cocos/3d/CCMesh.h", + "cocos/3d/CCMesh.cpp", "cocos/Android.mk", "cocos/CMakeLists.txt", "cocos/audio/CMakeLists.txt", @@ -842,6 +851,8 @@ "cocos/platform/wp8/shaders/precompiledshaders.h", "cocos/renderer/CCBatchCommand.cpp", "cocos/renderer/CCBatchCommand.h", + "cocos/renderer/CCMeshCommand.h", + "cocos/renderer/CCMeshCommand.cpp", "cocos/renderer/CCCustomCommand.cpp", "cocos/renderer/CCCustomCommand.h", "cocos/renderer/CCGLProgram.cpp", @@ -870,6 +881,9 @@ "cocos/renderer/CMakeLists.txt", "cocos/renderer/ccGLStateCache.cpp", "cocos/renderer/ccGLStateCache.h", + "cocos/renderer/ccShader_3D_Color.frag", + "cocos/renderer/ccShader_3D_ColorTex.frag", + "cocos/renderer/ccShader_3D_PositionTex.vert", "cocos/renderer/ccShader_Label.vert", "cocos/renderer/ccShader_Label_df.frag", "cocos/renderer/ccShader_Label_df_glow.frag", diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj index 386162ebb1..f744a086b5 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-test/cpp-empty-test.csproj @@ -90,10 +90,16 @@ 4 - - + + App.xaml.cs + + + EditBox.xaml.cs + + + MainPage.xaml.cs + - True @@ -148,15 +154,18 @@ - + + App.xaml MSBuild:Compile Designer - + + EditBox.xaml MSBuild:Compile Designer - + + MainPage.xaml MSBuild:Compile Designer diff --git a/tests/cpp-tests/Android.mk b/tests/cpp-tests/Android.mk index 572a970cbd..f678d83b32 100644 --- a/tests/cpp-tests/Android.mk +++ b/tests/cpp-tests/Android.mk @@ -166,6 +166,7 @@ Classes/ShaderTest/ShaderTest.cpp \ Classes/ShaderTest/ShaderTest2.cpp \ Classes/SpineTest/SpineTest.cpp \ Classes/SpriteTest/SpriteTest.cpp \ +Classes/Sprite3DTest/Sprite3DTest.cpp \ Classes/TextInputTest/TextInputTest.cpp \ Classes/Texture2dTest/Texture2dTest.cpp \ Classes/TextureCacheTest/TextureCacheTest.cpp \ diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index eeec422504..f0e70599e7 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -159,6 +159,7 @@ set(SAMPLE_SRC Classes/ShaderTest/ShaderTest.cpp Classes/ShaderTest/ShaderTest2.cpp Classes/SpriteTest/SpriteTest.cpp + Classes/Sprite3DTest/Sprite3DTest.cpp Classes/TextInputTest/TextInputTest.cpp Classes/Texture2dTest/Texture2dTest.cpp Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp new file mode 100644 index 0000000000..1554538efb --- /dev/null +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -0,0 +1,486 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + 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. + ****************************************************************************/ + +#include "Sprite3DTest.h" + +#include +#include "../testResource.h" + +enum +{ + IDC_NEXT = 100, + IDC_BACK, + IDC_RESTART +}; + +static int sceneIdx = -1; + + +static std::function createFunctions[] = +{ + CL(Sprite3DBasicTest), + CL(Sprite3DEffectTest) +}; + +#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) + +static Layer* nextSpriteTestAction() +{ + sceneIdx++; + sceneIdx = sceneIdx % MAX_LAYER; + + auto layer = (createFunctions[sceneIdx])(); + return layer; +} + +static Layer* backSpriteTestAction() +{ + sceneIdx--; + int total = MAX_LAYER; + if( sceneIdx < 0 ) + sceneIdx += total; + + auto layer = (createFunctions[sceneIdx])(); + return layer; +} + +static Layer* restartSpriteTestAction() +{ + auto layer = (createFunctions[sceneIdx])(); + return layer; +} + +//------------------------------------------------------------------ +// +// SpriteTestDemo +// +//------------------------------------------------------------------ + +Sprite3DTestDemo::Sprite3DTestDemo(void) +: BaseTest() +{ +} + +Sprite3DTestDemo::~Sprite3DTestDemo(void) +{ +} + +std::string Sprite3DTestDemo::title() const +{ + return "No title"; +} + +std::string Sprite3DTestDemo::subtitle() const +{ + return ""; +} + +void Sprite3DTestDemo::onEnter() +{ + BaseTest::onEnter(); +} + +void Sprite3DTestDemo::restartCallback(Ref* sender) +{ + auto s = new Sprite3DTestScene(); + s->addChild(restartSpriteTestAction()); + + Director::getInstance()->replaceScene(s); + s->release(); +} + +void Sprite3DTestDemo::nextCallback(Ref* sender) +{ + auto s = new Sprite3DTestScene(); + s->addChild( nextSpriteTestAction() ); + Director::getInstance()->replaceScene(s); + s->release(); +} + +void Sprite3DTestDemo::backCallback(Ref* sender) +{ + auto s = new Sprite3DTestScene(); + s->addChild( backSpriteTestAction() ); + Director::getInstance()->replaceScene(s); + s->release(); +} + + +//------------------------------------------------------------------ +// +// Sprite3DBasicTest +// +//------------------------------------------------------------------ + +Sprite3DBasicTest::Sprite3DBasicTest() +{ + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesEnded = CC_CALLBACK_2(Sprite3DBasicTest::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + + auto s = Director::getInstance()->getWinSize(); + addNewSpriteWithCoords( Vec2(s.width/2, s.height/2) ); +} + +void Sprite3DBasicTest::addNewSpriteWithCoords(Vec2 p) +{ + //int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f); + //int x = (idx%5) * 85; + //int y = (idx/5) * 121; + +// //option 1: load a obj that contain the texture in it +// auto sprite = Sprite3D::create("sprite3dTest/scene01.obj"); + + //option 2: load obj and assign the texture + auto sprite = Sprite3D::create("Sprite3DTest/boss1.obj"); + sprite->setScale(3.f); + sprite->setTexture("Sprite3DTest/boss.png"); + + // + //sprite->setEffect(cocos2d::EFFECT_OUTLINE); + + //add to scene + addChild( sprite ); + + sprite->setPosition( Vec2( p.x, p.y) ); + + ActionInterval* action; + float random = CCRANDOM_0_1(); + + if( random < 0.20 ) + action = ScaleBy::create(3, 2); + else if(random < 0.40) + action = RotateBy::create(3, 360); + else if( random < 0.60) + action = Blink::create(1, 3); + else if( random < 0.8 ) + action = TintBy::create(2, 0, -255, -255); + else + action = FadeOut::create(2); + auto action_back = action->reverse(); + auto seq = Sequence::create( action, action_back, NULL ); + + sprite->runAction( RepeatForever::create(seq) ); +} + +void Sprite3DBasicTest::onTouchesEnded(const std::vector& touches, Event* event) +{ + for (auto touch: touches) + { + auto location = touch->getLocation(); + + addNewSpriteWithCoords( location ); + } +} + +std::string Sprite3DBasicTest::title() const +{ + return "Testing Sprite3D"; +} + +std::string Sprite3DBasicTest::subtitle() const +{ + return "Tap screen to add more sprites"; +} + +void Sprite3DTestScene::runThisTest() +{ + auto layer = nextSpriteTestAction(); + addChild(layer); + + Director::getInstance()->replaceScene(this); +} + +static int tuple_sort( const std::tuple &tuple1, const std::tuple &tuple2 ) +{ + return std::get<0>(tuple1) < std::get<0>(tuple2); +} + +EffectSprite3D* EffectSprite3D::createFromObjFileAndTexture(const std::string &objFilePath, const std::string &textureFilePath) +{ + auto sprite = new EffectSprite3D(); + if (sprite && sprite->initWithFile(objFilePath)) + { + sprite->autorelease(); + sprite->setTexture(textureFilePath); + return sprite; + } + CC_SAFE_DELETE(sprite); + return nullptr; +} + +EffectSprite3D::EffectSprite3D() +: _defaultEffect(nullptr) +{ + +} + +EffectSprite3D::~EffectSprite3D() +{ + for(auto effect : _effects) + { + CC_SAFE_RELEASE_NULL(std::get<1>(effect)); + } + CC_SAFE_RELEASE(_defaultEffect); +} + +void EffectSprite3D::setEffect3D(Effect3D *effect) +{ + if(_defaultEffect == effect) return; + CC_SAFE_RETAIN(effect); + CC_SAFE_RELEASE(_defaultEffect); + _defaultEffect = effect; +} + +void EffectSprite3D::addEffect(Effect3DOutline* effect, ssize_t order) +{ + if(nullptr == effect) return; + effect->retain(); + + _effects.push_back(std::make_tuple(order,effect,CustomCommand())); + + std::sort(std::begin(_effects), std::end(_effects), tuple_sort); +} + +const std::string Effect3DOutline::_vertShaderFile = "Shaders3D/OutLine.vert"; +const std::string Effect3DOutline::_fragShaderFile = "Shaders3D/OutLine.frag"; +const std::string Effect3DOutline::_keyInGLProgramCache = "Effect3DLibrary_Outline"; +GLProgram* Effect3DOutline::getOrCreateProgram() +{ + auto program = GLProgramCache::getInstance()->getGLProgram(_keyInGLProgramCache); + if(program == nullptr) + { + program = GLProgram::createWithFilenames(_vertShaderFile, _fragShaderFile); + GLProgramCache::getInstance()->addGLProgram(program, _keyInGLProgramCache); + } + return program; +} + +Effect3DOutline* Effect3DOutline::create() +{ + Effect3DOutline* effect = new Effect3DOutline(); + if(effect && effect->init()) + { + effect->autorelease(); + return effect; + } + else + { + CC_SAFE_DELETE(effect); + return nullptr; + } +} + +bool Effect3DOutline::init() +{ + + GLProgram* glprogram = Effect3DOutline::getOrCreateProgram(); + if(nullptr == glprogram) + { + CC_SAFE_DELETE(glprogram); + return false; + } + _glProgramState = GLProgramState::create(glprogram); + if(nullptr == _glProgramState) + { + return false; + } + _glProgramState->retain(); + _glProgramState->setUniformVec3("OutLineColor", _outlineColor); + _glProgramState->setUniformFloat("OutlineWidth", _outlineWidth); + + return true; +} + +Effect3DOutline::Effect3DOutline() +: _outlineWidth(1.0f) +, _outlineColor(1, 1, 1) +{ + +} + +Effect3DOutline::~Effect3DOutline() +{ +} + +void Effect3DOutline::setOutlineColor(const Vec3& color) +{ + if(_outlineColor != color) + { + _outlineColor = color; + _glProgramState->setUniformVec3("OutLineColor", _outlineColor); + } +} + +void Effect3DOutline::setOutlineWidth(float width) +{ + if(_outlineWidth != width) + { + _outlineWidth = width; + _glProgramState->setUniformFloat("OutlineWidth", _outlineWidth); + } +} + +void Effect3DOutline::drawWithSprite(EffectSprite3D* sprite, const Mat4 &transform) +{ + auto mesh = sprite->getMesh(); + long offset = 0; + for (auto i = 0; i < mesh->getMeshVertexAttribCount(); i++) + { + auto meshvertexattrib = mesh->getMeshVertexAttribute(i); + + _glProgramState->setVertexAttribPointer(s_attributeNames[meshvertexattrib.vertexAttrib], + meshvertexattrib.size, + meshvertexattrib.type, + GL_FALSE, + mesh->getVertexSizeInBytes(), + (void*)offset); + offset += meshvertexattrib.attribSizeBytes; + } + //draw + { + glEnable(GL_CULL_FACE); + glCullFace(GL_FRONT); + glEnable(GL_DEPTH_TEST); + Color4F color(sprite->getDisplayedColor()); + color.a = sprite->getDisplayedOpacity() / 255.0f; + + _glProgramState->setUniformVec4("u_color", Vec4(color.r, color.g, color.b, color.a)); + + auto mesh = sprite->getMesh(); + glBindBuffer(GL_ARRAY_BUFFER, mesh->getVertexBuffer()); + _glProgramState->apply(transform); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->getIndexBuffer()); + glDrawElements((GLenum)mesh->getPrimitiveType(), mesh->getIndexCount(), (GLenum)mesh->getIndexFormat(), 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glDisable(GL_DEPTH_TEST); + glCullFace(GL_BACK); + glDisable(GL_CULL_FACE); + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, mesh->getIndexCount()); + } +} + +void EffectSprite3D::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, bool transformUpdated) +{ + for(auto &effect : _effects) + { + if(std::get<0>(effect) >=0) + break; + CustomCommand &cc = std::get<2>(effect); + cc.func = CC_CALLBACK_0(Effect3D::drawWithSprite,std::get<1>(effect),this,transform); + renderer->addCommand(&cc); + + } + + if(!_defaultEffect) + { + Sprite3D::draw(renderer, transform, transformUpdated); + } + else + { + _command.init(_globalZOrder); + _command.func = CC_CALLBACK_0(Effect3D::drawWithSprite, _defaultEffect, this, transform); + renderer->addCommand(&_command); + } + + for(auto &effect : _effects) + { + if(std::get<0>(effect) <=0) + continue; + CustomCommand &cc = std::get<2>(effect); + cc.func = CC_CALLBACK_0(Effect3D::drawWithSprite,std::get<1>(effect),this,transform); + renderer->addCommand(&cc); + + } +} + +Sprite3DEffectTest::Sprite3DEffectTest() +{ + auto s = Director::getInstance()->getWinSize(); + addNewSpriteWithCoords( Vec2(s.width/2, s.height/2) ); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesEnded = CC_CALLBACK_2(Sprite3DEffectTest::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); +} + +std::string Sprite3DEffectTest::title() const +{ + return "Testing Sprite3D"; +} +std::string Sprite3DEffectTest::subtitle() const +{ + return "Sprite3d with effects"; +} + +void Sprite3DEffectTest::addNewSpriteWithCoords(Vec2 p) +{ + //option 2: load obj and assign the texture + auto sprite = EffectSprite3D::createFromObjFileAndTexture("Sprite3DTest/boss1.obj", "Sprite3DTest/boss.png"); + Effect3DOutline* effect = Effect3DOutline::create(); + effect->setOutlineColor(Vec3(1,0,0)); + effect->setOutlineWidth(0.01f); + sprite->addEffect(effect, -1); + Effect3DOutline* effect2 = Effect3DOutline::create(); + effect2->setOutlineWidth(0.02f); + effect2->setOutlineColor(Vec3(1,1,0)); + sprite->addEffect(effect2, -2); + //sprite->setEffect3D(effect); + sprite->setScale(6.f); + + //add to scene + addChild( sprite ); + + sprite->setPosition( Vec2( p.x, p.y) ); + + ActionInterval* action; + float random = CCRANDOM_0_1(); + + if( random < 0.20 ) + action = ScaleBy::create(3, 2); + else if(random < 0.40) + action = RotateBy::create(3, 360); + else if( random < 0.60) + action = Blink::create(1, 3); + else if( random < 0.8 ) + action = TintBy::create(2, 0, -255, -255); + else + action = FadeOut::create(2); + auto action_back = action->reverse(); + auto seq = Sequence::create( action, action_back, NULL ); + + sprite->runAction( RepeatForever::create(seq) ); +} + +void Sprite3DEffectTest::onTouchesEnded(const std::vector& touches, Event* event) +{ + for (auto touch: touches) + { + auto location = touch->getLocation(); + + addNewSpriteWithCoords( location ); + } +} diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h new file mode 100644 index 0000000000..20a67bfd9e --- /dev/null +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h @@ -0,0 +1,142 @@ +/**************************************************************************** + Copyright (c) 2013 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 _SPRITE3D_TEST_H_ +#define _SPRITE3D_TEST_H_ + +#include "../testBasic.h" +#include "../BaseTest.h" +#include + +class Sprite3DTestDemo : public BaseTest +{ +public: + Sprite3DTestDemo(void); + virtual ~Sprite3DTestDemo(void); + + void restartCallback(Ref* sender); + void nextCallback(Ref* sender); + void backCallback(Ref* sender); + + // overrides + virtual std::string title() const override; + virtual std::string subtitle() const override; + virtual void onEnter() override; + +protected: + std::string _title; +}; + +class Sprite3DBasicTest : public Sprite3DTestDemo +{ +public: + CREATE_FUNC(Sprite3DBasicTest); + Sprite3DBasicTest(); + virtual std::string title() const override; + virtual std::string subtitle() const override; + + void addNewSpriteWithCoords(Vec2 p); + void onTouchesEnded(const std::vector& touches, Event* event); +}; + +class EffectSprite3D; + +class Effect3D : public Ref +{ +public: + virtual void drawWithSprite(EffectSprite3D* sprite, const Mat4 &transform) = 0; +protected: + Effect3D() : _glProgramState(nullptr) {} + virtual ~Effect3D() + { + CC_SAFE_RELEASE(_glProgramState); + } +protected: + GLProgramState* _glProgramState; +}; + +class Effect3DOutline: public Effect3D +{ +public: + static Effect3DOutline* create(); + + void setOutlineColor(const Vec3& color); + + void setOutlineWidth(float width); + + void drawWithSprite(EffectSprite3D* sprite, const Mat4 &transform); + +protected: + + Effect3DOutline(); + virtual ~Effect3DOutline(); + + bool init(); + + Vec3 _outlineColor; + float _outlineWidth; + +protected: + static const std::string _vertShaderFile; + static const std::string _fragShaderFile; + static const std::string _keyInGLProgramCache; + static GLProgram* getOrCreateProgram(); +}; + +class EffectSprite3D : public Sprite3D +{ +public: + static EffectSprite3D* createFromObjFileAndTexture(const std::string& objFilePath, const std::string& textureFilePath); + void setEffect3D(Effect3D* effect); + void addEffect(Effect3DOutline* effect, ssize_t order); + virtual void draw(Renderer *renderer, const Mat4 &transform, bool transformUpdated) override; +protected: + EffectSprite3D(); + virtual ~EffectSprite3D(); + + std::vector> _effects; + Effect3D* _defaultEffect; + CustomCommand _command; +}; + +class Sprite3DEffectTest : public Sprite3DTestDemo +{ +public: + CREATE_FUNC(Sprite3DEffectTest); + Sprite3DEffectTest(); + virtual std::string title() const override; + virtual std::string subtitle() const override; + + void addNewSpriteWithCoords(Vec2 p); + + void onTouchesEnded(const std::vector& touches, Event* event); +}; + +class Sprite3DTestScene : public TestScene +{ +public: + virtual void runThisTest(); +}; + +#endif diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 2eb8c52ce7..5946fff6ee 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -34,7 +34,6 @@ Controller g_aTestNames[] = { // TESTS MUST BE ORDERED ALPHABETICALLY // violators will be prosecuted // - { "A new UI", [](){ return new UITestScene(); }}, { "Accelerometer", []() { return new AccelerometerTestScene(); } }, { "ActionManager", [](){return new ActionManagerTestScene(); } }, { "Actions - Basic", [](){ return new ActionsTestScene(); } }, @@ -87,8 +86,10 @@ Controller g_aTestNames[] = { { "Node: Scene", [](){return new SceneTestScene();} }, { "Node: Spine", []() { return new SpineTestScene(); } }, { "Node: Sprite", [](){return new SpriteTestScene(); } }, + { "Node: Sprite3D", [](){ return new Sprite3DTestScene(); }}, { "Node: TileMap", [](){return new TileMapTestScene(); } }, { "Node: Text Input", [](){return new TextInputTestScene(); } }, + { "Node: UI", [](){ return new UITestScene(); }}, { "Mouse", []() { return new MouseTestScene(); } }, { "MutiTouch", []() { return new MutiTouchTestScene(); } }, { "Performance tests", []() { return new PerformanceTestScene(); } }, diff --git a/tests/cpp-tests/Classes/tests.h b/tests/cpp-tests/Classes/tests.h index 9e20f96590..06ec824dc7 100644 --- a/tests/cpp-tests/Classes/tests.h +++ b/tests/cpp-tests/Classes/tests.h @@ -70,4 +70,6 @@ #include "PhysicsTest/PhysicsTest.h" #include "ReleasePoolTest/ReleasePoolTest.h" +#include "Sprite3DTest/Sprite3DTest.h" + #endif diff --git a/tests/cpp-tests/Resources/Shaders3D/OutLine.frag b/tests/cpp-tests/Resources/Shaders3D/OutLine.frag new file mode 100644 index 0000000000..dd6e60a6a7 --- /dev/null +++ b/tests/cpp-tests/Resources/Shaders3D/OutLine.frag @@ -0,0 +1,7 @@ +uniform vec3 OutLineColor; +uniform vec4 u_color; + +void main(void) +{ + gl_FragColor = vec4(OutLineColor,1.0) * u_color; +} diff --git a/tests/cpp-tests/Resources/Shaders3D/OutLine.vert b/tests/cpp-tests/Resources/Shaders3D/OutLine.vert new file mode 100644 index 0000000000..f4cd386b34 --- /dev/null +++ b/tests/cpp-tests/Resources/Shaders3D/OutLine.vert @@ -0,0 +1,13 @@ +attribute vec4 a_position; +attribute vec3 a_normal; +uniform float OutlineWidth; + +void main(void) +{ + vec4 pos = CC_MVPMatrix * a_position; + vec4 normalproj = CC_MVPMatrix * vec4(a_normal, 0); + normalproj = normalize(normalproj); + pos.xy += normalproj.xy * (OutlineWidth * (pos.z * 0.5 + 0.5)); + + gl_Position = pos; +} diff --git a/tests/cpp-tests/Resources/Sprite3DTest/boss.obj b/tests/cpp-tests/Resources/Sprite3DTest/boss.obj new file mode 100644 index 0000000000..97154a2568 --- /dev/null +++ b/tests/cpp-tests/Resources/Sprite3DTest/boss.obj @@ -0,0 +1,1575 @@ +# WaveFront *.obj file (generated by CINEMA 4D) + +g Object +v 2.152745 1.129535 -2.654346 +v 2.018903 1.184975 -2.654349 +v 2.018903 1.184975 -0.076443 +v 2.152745 1.129537 -0.076443 +v 1.885062 1.129535 -2.654346 +v 1.885062 1.129537 -0.076443 +v 1.829623 0.995695 -2.654346 +v 1.829623 0.995695 -0.076443 +v 1.885062 0.861856 -2.654346 +v 1.885062 0.861855 -0.076443 +v 2.018903 0.806415 -2.654346 +v 2.018903 0.806415 -0.076443 +v 2.152745 0.861856 -2.654346 +v 2.152745 0.861855 -0.076443 +v 2.208183 0.995695 -2.654346 +v 2.208183 0.995695 -0.076443 +v 2.018903 0.995695 0.076003 +v 2.018903 0.995931 -2.778477 +v -2.152745 1.129535 -2.654346 +v -2.018903 1.184975 -2.654349 +v -2.018903 1.184975 -0.076443 +v -2.152745 1.129537 -0.076443 +v -1.885062 1.129535 -2.654346 +v -1.885062 1.129537 -0.076443 +v -1.829623 0.995695 -2.654346 +v -1.829623 0.995695 -0.076443 +v -1.885062 0.861856 -2.654346 +v -1.885062 0.861855 -0.076443 +v -2.018903 0.806415 -2.654346 +v -2.018903 0.806415 -0.076443 +v -2.152745 0.861856 -2.654346 +v -2.152745 0.861855 -0.076443 +v -2.208183 0.995695 -2.654346 +v -2.208183 0.995695 -0.076443 +v -2.018903 0.995695 0.076003 +v -2.018903 0.995931 -2.778477 +v -0.549117 -0.880255 7.049499 +v -0.549117 -0.366897 7.049499 +v -0.549117 -0.231349 7.400979 +v -0.549117 -0.590024 7.42836 +v -2.221097 -0.740847 -0.204388 +v -4.208594 -0.740847 -0.896515 +v -2.221097 0.158004 -0.204388 +v -4.208594 0.158004 -0.896515 +v -2.221097 0.158004 -3.981237 +v -4.208594 0.158004 -3.516596 +v -2.221097 -0.740847 -3.981237 +v -4.208594 -0.740847 -3.516596 +v -2.032921 0.247995 3.029242 +v -1.460364 0.247995 2.792081 +v -0.887809 0.247995 3.029242 +v -0.650649 0.247995 3.601797 +v -0.887809 0.247995 4.174353 +v -1.460364 0.247995 4.411513 +v -2.032921 0.247995 4.174353 +v -2.270081 0.247995 3.601797 +v -2.538304 0.759102 -6.135367 +v -1.965749 0.759102 -6.372528 +v -1.393193 0.759102 -6.135367 +v -1.156033 0.759102 -5.562812 +v -1.393193 0.759102 -4.990256 +v -1.965749 0.759102 -4.753095 +v -2.538304 0.759102 -4.990255 +v -2.775465 0.759102 -5.562812 +v -2.538304 1.408424 -6.135367 +v -1.965749 1.408424 -6.372528 +v -1.393193 1.408424 -6.135367 +v -1.156033 1.408424 -5.562812 +v -1.393193 1.408424 -4.990256 +v -1.965749 1.408424 -4.753095 +v -2.538304 1.408424 -4.990255 +v -2.775465 1.408424 -5.562812 +v -1.965749 1.408424 -5.562812 +v -1.666678 1.334443 -5.145707 +v -2.299088 1.334443 -5.145707 +v -1.666678 1.966853 -5.145707 +v -2.299088 1.966853 -5.145707 +v -1.666678 1.966853 -5.778117 +v -2.299088 1.966853 -5.778117 +v -1.666678 1.334443 -5.778117 +v -2.299088 1.334443 -5.778117 +v -2.036188 1.638001 -5.21675 +v -1.963871 1.667955 -5.216752 +v -1.891555 1.638001 -5.21675 +v 1.735587 0.649931 2.372068 +v 2.276793 0.598225 2.359797 +v 0 -0.880255 7.049499 +v 1.813632 0.760322 -4.076154 +v 0 -0.865952 7.228139 +v 0.525472 0.759814 -4.076156 +v 0.52502 0.704589 1.837225 +v 1.043754 0.65004 2.37211 +v 1.735587 0.771575 2.372068 +v 1.813248 0.882105 0.751968 +v 2.276793 0.719869 2.359797 +v 3.007264 0.675615 0.751926 +v 1.813632 0.881966 -4.076154 +v 3.008201 0.675603 -4.076154 +v 0.525481 0.882195 0.75201 +v 0.525481 0.882292 -4.076154 +v 0.525481 0.826994 1.840059 +v 1.043754 0.771684 2.37211 +v 0.525011 0.758956 0.749175 +v 3.007732 0.553965 -0.738622 +v 3.007732 0.675609 -0.738622 +v 1.81344 0.882035 -0.738601 +v 0.525481 0.882244 -0.73858 +v 0.525241 0.759385 -0.739998 +v -0.549117 -0.399614 7.049499 +v 0.620102 1.844369 -3.601022 +v 0.846037 1.755779 -3.71401 +v 1.310041 0.672056 -4.076154 +v 1.16988 2.894725 -3.501955 +v 1.269897 2.855507 -3.551973 +v 1.132038 2.932909 -3.607564 +v 1.036546 0.428545 5.751309 +v 1.315024 0.760461 0.751968 +v 1.836507 0.376839 5.864282 +v 3.007264 0.553971 0.751926 +v 1.315409 0.760322 -4.076154 +v 3.008201 0.553959 -4.076154 +v 1.232055 2.893691 -3.657582 +v 0 0.760648 -4.076154 +v 0 0.428762 5.751394 +v 0.981744 -0.879086 7.062063 +v 0.981744 0.008673 7.062063 +v 0.534619 1.930626 -3.839588 +v 1.310041 -1.310041 -4.076154 +v 2.997463 -0.990787 -4.076154 +v 2.997463 0.46602 -4.076154 +v 2.997463 0.46602 0.749076 +v 1.310041 -1.310041 0.749076 +v 2.997463 -0.990787 0.749076 +v 1.827392 -0.716184 6.50097 +v 1.25879 -0.770909 7.062063 +v 1.827643 0.288876 5.858582 +v 1.254241 -0.019801 7.062063 +v 0.981744 -0.879086 -8.433464 +v 0.981744 0.879086 -8.433464 +v 1.310041 1.310041 -4.605186 +v 1.310041 -1.310041 -4.605186 +v 2.997463 -0.990787 -4.605186 +v 2.132894 -0.664855 -8.433464 +v 2.997463 0.990787 -4.605186 +v 2.132894 0.664855 -8.433464 +v 2.997463 0.990787 -6.807402 +v 1.310041 1.310041 -6.807402 +v 1.310041 -1.310041 -6.807402 +v 2.997463 -0.990787 -6.807402 +v 3.090473 -0.421017 -4.647384 +v 3.935092 -0.421017 -4.647384 +v 3.090473 0.421017 -4.647384 +v 3.935092 0.421017 -4.647384 +v 3.090473 0.421017 -7.4454 +v 3.935092 0.421017 -7.4454 +v 3.090473 -0.421017 -7.4454 +v 3.935092 -0.421017 -7.4454 +v 3.090473 0.421017 -8.572815 +v 3.620514 0.421017 -8.572815 +v 3.620514 -0.421017 -8.572815 +v 3.090473 -0.421017 -8.572815 +v 1.310041 0.670313 -2.111028 +v 0.655086 0.670313 -0.750658 +v 1.310041 1.517316 -2.111028 +v 0.655086 1.106749 -0.750658 +v 0.655086 1.517316 -4.069324 +v 1.310041 1.517316 -3.4212 +v 1.310041 0.670313 -3.4212 +v 0.655086 0.670313 -4.069324 +v -1.861601 1.565685 -5.216749 +v -1.891555 1.493369 -5.21675 +v -1.963871 1.463414 -5.21675 +v -2.036188 1.493369 -5.21675 +v -2.066142 1.565685 -5.216749 +v -2.036188 1.638001 -4.177855 +v -1.963871 1.667955 -4.177855 +v -1.891555 1.638001 -4.177855 +v -1.861601 1.565685 -4.177855 +v -1.891555 1.493369 -4.177855 +v -1.963871 1.463414 -4.177855 +v -2.036188 1.493369 -4.177855 +v -2.066142 1.565685 -4.177855 +v -1.963871 1.565685 -4.177855 +v -2.036188 1.877795 -5.21675 +v -1.963871 1.907749 -5.216752 +v -1.891555 1.877795 -5.21675 +v -1.861601 1.805479 -5.216749 +v -1.891555 1.733163 -5.21675 +v -1.963871 1.703208 -5.21675 +v -2.036188 1.733163 -5.21675 +v -2.066142 1.805479 -5.216749 +v -2.036188 1.877795 -4.177855 +v -1.963871 1.907749 -4.177855 +v -1.891555 1.877795 -4.177855 +v -1.861601 1.805479 -4.177855 +v -1.891555 1.733163 -4.177855 +v -1.963871 1.703208 -4.177855 +v -2.036188 1.733163 -4.177855 +v -2.066142 1.805479 -4.177855 +v -1.963871 1.805479 -4.177855 +v 0 -1.459791 -3.956097 +v -7.609053 -1.069013 0.551177 +v 1.209824 2.146268 -4.643119 +v 0.549117 -0.865952 7.228139 +v 0.549117 0.004196 7.228139 +v 0.549117 -0.017407 7.0495 +v 0.549117 -0.880255 7.049499 +v 0.549117 -0.366897 7.049499 +v 0.549117 -0.231349 7.400979 +v 0.549117 -0.590024 7.42836 +v 2.221097 -0.740847 -0.204388 +v 4.208594 -0.740847 -0.896515 +v 2.221097 0.158004 -0.204388 +v 4.208594 0.158004 -0.896515 +v 2.221097 0.158004 -3.981237 +v 4.208594 0.158004 -3.516596 +v 2.221097 -0.740847 -3.981237 +v 4.208594 -0.740847 -3.516596 +v 2.032921 0.247995 3.029242 +v 1.460364 0.247995 2.792081 +v 0.887809 0.247995 3.029242 +v 0.650649 0.247995 3.601797 +v 0.887809 0.247995 4.174353 +v 1.460364 0.247995 4.411513 +v 2.032921 0.247995 4.174353 +v 2.270081 0.247995 3.601797 +v -7.609053 -0.765268 0.551177 +v 0.522715 2.473121 -4.605861 +v -7.609053 -0.765268 -0.649518 +v 0.021794 2.612102 -4.048994 +v -7.609053 -1.069013 -0.649518 +v 0 -1.459791 6.071965 +v -5.143484 -1.069013 0.812165 +v 0 -0.765268 6.071965 +v -5.143484 -0.765268 0.812165 +v 2.538304 0.759102 -6.135367 +v 1.965749 0.759102 -6.372528 +v 1.393193 0.759102 -6.135367 +v 1.156033 0.759102 -5.562812 +v 1.393193 0.759102 -4.990256 +v 1.965749 0.759102 -4.753095 +v 2.538304 0.759102 -4.990255 +v 2.775465 0.759102 -5.562812 +v 2.538304 1.408424 -6.135367 +v 1.965749 1.408424 -6.372528 +v 1.393193 1.408424 -6.135367 +v 1.156033 1.408424 -5.562812 +v 1.393193 1.408424 -4.990256 +v 1.965749 1.408424 -4.753095 +v 2.538304 1.408424 -4.990255 +v 2.775465 1.408424 -5.562812 +v 1.965749 1.408424 -5.562812 +v 1.666678 1.334443 -5.145707 +v 2.299088 1.334443 -5.145707 +v 1.666678 1.966853 -5.145707 +v 2.299088 1.966853 -5.145707 +v 1.666678 1.966853 -5.778117 +v 2.299088 1.966853 -5.778117 +v 1.666678 1.334443 -5.778117 +v 2.299088 1.334443 -5.778117 +v 2.036188 1.638001 -5.21675 +v 1.963871 1.667955 -5.216752 +v 1.891555 1.638001 -5.21675 +v 1.861601 1.565685 -5.216749 +v 1.891555 1.493369 -5.21675 +v 1.963871 1.463414 -5.21675 +v 2.036188 1.493369 -5.21675 +v 2.066142 1.565685 -5.216749 +v 2.036188 1.638001 -4.177855 +v 1.963871 1.667955 -4.177855 +v 1.891555 1.638001 -4.177855 +v 1.861601 1.565685 -4.177855 +v 1.891555 1.493369 -4.177855 +v 1.963871 1.463414 -4.177855 +v 2.036188 1.493369 -4.177855 +v 2.066142 1.565685 -4.177855 +v 1.963871 1.565685 -4.177855 +v 2.036188 1.877795 -5.21675 +v 1.963871 1.907749 -5.216752 +v 1.891555 1.877795 -5.21675 +v 1.861601 1.805479 -5.216749 +v 1.891555 1.733163 -5.21675 +v 1.963871 1.703208 -5.21675 +v 2.036188 1.733163 -5.21675 +v 2.066142 1.805479 -5.216749 +v 2.036188 1.877795 -4.177855 +v 1.963871 1.907749 -4.177855 +v 1.891555 1.877795 -4.177855 +v 1.861601 1.805479 -4.177855 +v 1.891555 1.733163 -4.177855 +v 1.963871 1.703208 -4.177855 +v 2.036188 1.733163 -4.177855 +v 2.066142 1.805479 -4.177855 +v 1.963871 1.805479 -4.177855 +v 0.760554 1.842035 -3.952577 +v 7.609053 -1.069013 0.551177 +v 0 -0.765268 -3.956097 +v 7.609053 -0.765268 0.551177 +v 0 -0.765268 -7.732946 +v 7.609053 -0.765268 -0.649518 +v 0 -1.459791 -7.732946 +v 7.609053 -1.069013 -0.649518 +v 1.214601 2.038227 -4.805394 +v 5.143484 -1.069013 0.812165 +v 0.421783 2.415365 -4.762404 +v 5.143484 -0.765268 0.812165 +v 0 -0.765268 0.439388 +v 5.143484 -0.765268 -0.38853 +v -0.156203 2.575728 -4.119865 +v 5.143484 -1.069013 -0.38853 +v 1.032114 0.340364 5.745526 +v 0.964145 -1.094563 6.551094 +v 0 0.340364 5.745526 +v 0 0.008673 7.062063 +v -0.180782 2.425379 -3.254169 +v 0.362446 2.052389 -2.672427 +v 1.155263 1.675251 -2.715417 +v 0 -1.310041 -4.076154 +v 0 0.672056 -4.076154 +v 0 0.670313 -0.750658 +v 0 1.106749 -0.750658 +v 0 1.517316 -2.111028 +v 0 1.517316 -3.4212 +v 0 1.517316 -4.069324 +v 1.733249 1.514889 -3.357956 +v 1.757828 1.665238 -4.223653 +v 1.266634 2.145324 -4.785317 +v 0.473817 2.522462 -4.742327 +v -0.10417 2.682825 -4.099788 +v 0 -1.310041 -6.807402 +v 0 -1.310041 -4.605186 +v 1.543045 -1.342558 4.494025 +v 1.543045 -0.765268 4.494025 +v 1.543045 -0.765268 0.191013 +v 1.543045 -1.342558 0.191013 +v -0.128748 2.532475 -3.234091 +v 0.414479 2.159486 -2.652349 +v 0 -0.017407 7.0495 +v 0 0.004196 7.228139 +v 1.207297 1.782348 -2.69534 +v 1.785283 1.621985 -3.337879 +v 0.549117 -0.399614 7.049499 +v -1.735587 0.649931 2.372068 +v -2.276793 0.598225 2.359797 +v 1.809861 1.772335 -4.203576 +v -1.813632 0.760322 -4.076154 +v 0.937994 1.747884 -4.5237 +v -0.525472 0.759814 -4.076156 +v -0.52502 0.704589 1.837225 +v -1.043754 0.65004 2.37211 +v -1.735587 0.771575 2.372068 +v -1.813248 0.882105 0.751968 +v -2.276793 0.719869 2.359797 +v -3.007264 0.675615 0.751926 +v -1.813632 0.881966 -4.076154 +v -3.008201 0.675603 -4.076154 +v -0.525481 0.882195 0.75201 +v -0.525481 0.882292 -4.076154 +v -0.525481 0.826994 1.840059 +v -1.043754 0.771684 2.37211 +v -0.525011 0.758956 0.749175 +v -3.007732 0.553965 -0.738622 +v -3.007732 0.675609 -0.738622 +v -1.81344 0.882035 -0.738601 +v -0.525481 0.882244 -0.73858 +v -0.525241 0.759385 -0.739998 +v -1.032114 0.340364 5.745526 +v 0.583818 1.623981 -3.817896 +v 0.395361 2.00601 -4.494276 +v -1.310041 0.672056 -4.076154 +v -2.997463 0.46602 -4.076154 +v -0.000234 2.115768 -4.054499 +v -0.017056 2.012864 -3.461985 +v -1.036546 0.428545 5.751309 +v -1.315024 0.760461 0.751968 +v -1.836507 0.376839 5.864282 +v -3.007264 0.553971 0.751926 +v -1.315409 0.760322 -4.076154 +v -3.008201 0.553959 -4.076154 +v 0 0.760551 0.75201 +v 0.354749 1.757576 -3.06382 +v 0.897382 1.49945 -3.093244 +v -0.981744 -0.879086 7.062063 +v -0.981744 0.008673 7.062063 +v 1.292976 1.389691 -3.533021 +v -1.310041 -1.310041 -4.076154 +v -2.997463 -0.990787 -4.076154 +v 1.309798 1.492596 -4.125535 +v -2.997463 0.46602 0.749076 +v -1.310041 -1.310041 0.749076 +v -2.997463 -0.990787 0.749076 +v -1.827392 -0.716184 6.50097 +v -1.25879 -0.770909 7.062063 +v -1.827643 0.288876 5.858582 +v -1.254241 -0.019801 7.062063 +v -0.981744 -0.879086 -8.433464 +v -0.981744 0.879086 -8.433464 +v -1.310041 1.310041 -4.605186 +v -1.310041 -1.310041 -4.605186 +v -2.997463 -0.990787 -4.605186 +v -2.132894 -0.664855 -8.433464 +v -2.997463 0.990787 -4.605186 +v -2.132894 0.664855 -8.433464 +v -2.997463 0.990787 -6.807402 +v -1.310041 1.310041 -6.807402 +v -1.310041 -1.310041 -6.807402 +v -2.997463 -0.990787 -6.807402 +v -3.090473 -0.421017 -4.647384 +v -3.935092 -0.421017 -4.647384 +v -3.090473 0.421017 -4.647384 +v -3.935092 0.421017 -4.647384 +v -3.090473 0.421017 -7.4454 +v -3.935092 0.421017 -7.4454 +v -3.090473 -0.421017 -7.4454 +v -3.935092 -0.421017 -7.4454 +v -3.090473 0.421017 -8.572815 +v -3.620514 0.421017 -8.572815 +v -3.620514 -0.421017 -8.572815 +v -3.090473 -0.421017 -8.572815 +v -1.310041 0.670313 -2.111028 +v -0.655086 0.670313 -0.750658 +v -1.310041 1.517316 -2.111028 +v -0.655086 1.106749 -0.750658 +v -0.655086 1.517316 -4.069324 +v -1.310041 1.517316 -3.4212 +v -1.310041 0.670313 -3.4212 +v -0.655086 0.670313 -4.069324 +v 0.000493 2.481799 -3.298723 +v -5.143484 -0.765268 -0.38853 +v 0 -1.459791 0.439388 +v -5.143484 -1.069013 -0.38853 +v 0.47129 2.158541 -2.794548 +v -0.964145 -1.094563 6.551094 +v 1.158398 1.831689 -2.831806 +v 1.65932 1.692708 -3.388673 +v 0 -0.879086 7.062063 +v 0 -1.094563 6.551094 +v 0 -1.310041 0.749076 +v 1.680621 1.823011 -4.138944 +v 0.980091 1.966239 -4.324068 +v 0.702984 1.869251 -3.771916 +v 0.555579 2.168176 -4.301049 +v 0.246098 2.254042 -3.957004 +v 0.232938 2.173538 -3.493469 +v -0.549117 -0.865952 7.228139 +v 0.523807 1.973822 -3.181978 +v 0.948319 1.771885 -3.204996 +v 0 1.310041 -4.605186 +v 0 1.310041 -6.807402 +v 0 0.879086 -8.433464 +v -0.549117 0.004196 7.228139 +v -0.549117 -0.017407 7.0495 +v 0 -0.879086 -8.433464 +v 1.257799 1.686019 -3.549042 +v 1.27096 1.766523 -4.012577 +v -1.543045 -1.342558 4.494025 +v -1.543045 -0.765268 4.494025 +v -1.543045 -0.765268 0.191013 +v -1.543045 -1.342558 0.191013 +v 0 -0.590024 7.42836 +v 0 -0.231349 7.400979 + +vt 0.401122 0.24589 0 +vt 0.422237 0.155289 0 +vt 0.408574 0.264883 0 +vt 0.426978 0.155184 0 +vt 0.427029 0.272985 0 +vt 0.428212 0.21811 0 +vt 0.445931 0.265758 0 +vt 0.42348 0.218206 0 +vt 0.4272 0.27239 0 +vt 0.431721 0.155075 0 +vt 0.408554 0.26473 0 +vt 0.432943 0.218016 0 +vt 0.445663 0.265617 0 +vt 0.436468 0.154961 0 +vt 0.401327 0.245829 0 +vt 0.437675 0.217926 0 +vt 0.453094 0.247489 0 +vt 0.441219 0.154844 0 +vt 0.409582 0.227353 0 +vt 0.442407 0.217839 0 +vt 0.446378 0.229457 0 +vt 0.40802 0.155591 0 +vt 0.445975 0.154726 0 +vt 0.428835 0.22083 0 +vt 0.409279 0.218484 0 +vt 0.447548 0.217839 0 +vt 0.42874 0.221085 0 +vt 0.412758 0.155492 0 +vt 0.446431 0.229436 0 +vt 0.414015 0.218391 0 +vt 0.409701 0.227457 0 +vt 0.417497 0.155392 0 +vt 0.453306 0.247283 0 +vt 0.418748 0.218299 0 +vt 0.428284 0.246556 0 +vt 0.428479 0.246771 0 +vt 0.401122 0.24589 0 +vt 0.422237 0.155289 0 +vt 0.408574 0.264883 0 +vt 0.426978 0.155184 0 +vt 0.427029 0.272985 0 +vt 0.428212 0.21811 0 +vt 0.445931 0.265758 0 +vt 0.42348 0.218206 0 +vt 0.4272 0.27239 0 +vt 0.431721 0.155075 0 +vt 0.408554 0.26473 0 +vt 0.432943 0.218016 0 +vt 0.445663 0.265617 0 +vt 0.436468 0.154961 0 +vt 0.401327 0.245829 0 +vt 0.437675 0.217926 0 +vt 0.453094 0.247489 0 +vt 0.441219 0.154844 0 +vt 0.409582 0.227353 0 +vt 0.442407 0.217839 0 +vt 0.446378 0.229457 0 +vt 0.40802 0.155591 0 +vt 0.445975 0.154726 0 +vt 0.428835 0.22083 0 +vt 0.409279 0.218484 0 +vt 0.447548 0.217839 0 +vt 0.42874 0.221085 0 +vt 0.412758 0.155492 0 +vt 0.446431 0.229436 0 +vt 0.414015 0.218391 0 +vt 0.409701 0.227457 0 +vt 0.417497 0.155392 0 +vt 0.453306 0.247283 0 +vt 0.418748 0.218299 0 +vt 0.428284 0.246556 0 +vt 0.428479 0.246771 0 +vt 0.406674 0.167689 0 +vt 0.34778 0.206333 0 +vt 0.400506 0.092061 0 +vt 0.34714 0.076348 0 +vt 0.347422 0.129521 0 +vt 0.25309 0.155811 0 +vt 0.986632 0.334252 0 +vt 0.900869 0.480587 0 +vt 0.178263 0.12975 0 +vt 0.948411 0.446335 0 +vt 0.938762 0.317929 0 +vt 0.90054 0.43001 0 +vt 0.726249 0.319303 0 +vt 0.753116 0.430966 0 +vt 0.253094 0.013616 0 +vt 0.677076 0.331135 0 +vt 0.753444 0.48154 0 +vt 0.178266 0.031107 0 +vt 0.703943 0.442796 0 +vt 0.946295 0.240423 0 +vt 0.661994 0.243219 0 +vt 0.991137 0.240398 0 +vt 0.701254 0.243258 0 +vt 0.739885 0.243356 0 +vt 0.778704 0.243132 0 +vt 0.818178 0.242671 0 +vt 0.858856 0.241693 0 +vt 0.90173 0.240871 0 +vt 0.973266 0.207191 0 +vt 0.94624 0.287074 0 +vt 0.911901 0.23261 0 +vt 0.662047 0.284293 0 +vt 0.991082 0.287208 0 +vt 0.850535 0.207191 0 +vt 0.701289 0.284167 0 +vt 0.825117 0.145826 0 +vt 0.739912 0.284018 0 +vt 0.850535 0.084461 0 +vt 0.778729 0.284198 0 +vt 0.911901 0.059042 0 +vt 0.818183 0.284624 0 +vt 0.973266 0.084461 0 +vt 0.858836 0.28562 0 +vt 0.998684 0.145826 0 +vt 0.901683 0.286519 0 +vt 0.911901 0.142355 0 +vt 0.565962 0.396112 0 +vt 0.520712 0.441362 0 +vt 0.611211 0.396112 0 +vt 0.656461 0.441362 0 +vt 0.565962 0.441362 0 +vt 0.611211 0.441362 0 +vt 0.565962 0.486611 0 +vt 0.611211 0.486611 0 +vt 0.565962 0.531861 0 +vt 0.520712 0.486611 0 +vt 0.611211 0.531861 0 +vt 0.656461 0.486611 0 +vt 0.352159 0.224968 0 +vt 0.355175 0.224967 0 +vt 0.35819 0.224967 0 +vt 0.901262 0.530297 0 +vt 0.945558 0.536298 0 +vt 0.938872 0.531149 0 +vt 0.266663 0.206735 0 +vt 0.902345 0.986421 0 +vt 0.266539 0.18027 0 +vt 0.813927 0.986075 0 +vt 0.809312 0.573689 0 +vt 0.812099 0.56775 0 +vt 0.853688 0.529528 0 +vt 0.848087 0.53162 0 +vt 0.900755 0.538571 0 +vt 0.904638 0.649276 0 +vt 0.937884 0.539507 0 +vt 0.987257 0.649743 0 +vt 0.90173 0.978186 0 +vt 0.984307 0.979178 0 +vt 0.816956 0.648322 0 +vt 0.813964 0.977666 0 +vt 0.81769 0.573982 0 +vt 0.853542 0.537896 0 +vt 0.808549 0.64825 0 +vt 0.994729 0.751596 0 +vt 0.986429 0.751521 0 +vt 0.903756 0.750787 0 +vt 0.815903 0.749985 0 +vt 0.807509 0.749992 0 +vt 0.400909 0.096914 0 +vt 0.453481 0.393554 0 +vt 0.481795 0.340046 0 +vt 0.538348 0.389938 0 +vt 0.493884 0.33955 0 +vt 0.062187 0.98965 0 +vt 0.69945 0.98606 0 +vt 0.48742 0.393554 0 +vt 0.49267 0.393289 0 +vt 0.487583 0.397153 0 +vt 0.687993 0.503583 0 +vt 0.69842 0.750594 0 +vt 0.727594 0.498641 0 +vt 0.780939 0.750999 0 +vt 0.995564 0.649813 0 +vt 0.994931 0.646535 0 +vt 0.699276 0.981779 0 +vt 0.779679 0.980604 0 +vt 0.992605 0.979257 0 +vt 0.985632 0.987425 0 +vt 0.492708 0.397856 0 +vt 0.636086 0.982285 0 +vt 0.636859 0.503126 0 +vt 0.047272 0.488901 0 +vt 0.05879 0.007778 0 +vt 0.058235 0.053941 0 +vt 0.453908 0.401172 0 +vt 0.477006 0.449213 0 +vt 0.057779 0.913566 0 +vt 0.407615 0.505451 0 +vt 0.123087 0.916212 0 +vt 0.346673 0.542322 0 +vt 0.128965 0.974582 0 +vt 0.782818 0.981712 0 +vt 0.224808 0.340362 0 +vt 0.785169 0.750557 0 +vt 0.058749 0.73063 0 +vt 0.124342 0.730754 0 +vt 0.28587 0.303495 0 +vt 0.0814 0.510898 0 +vt 0.125459 0.063828 0 +vt 0.102683 0.029981 0 +vt 0.073324 0.01374 0 +vt 0.05933 0.488428 0 +vt 0.099108 0.116354 0 +vt 0.731869 0.49777 0 +vt 0.726871 0.494355 0 +vt 0.072323 0.053475 0 +vt 0.424823 0.351441 0 +vt 0.193953 0.981583 0 +vt 0.188639 0.887683 0 +vt 0.199784 0.698522 0 +vt 0.20532 0.571215 0 +vt 0.438044 0.211097 0 +vt 0.384199 0.711565 0 +vt 0.500316 0.212631 0 +vt 0.290876 0.593575 0 +vt 0.258604 0.963636 0 +vt 0.467461 0.353125 0 +vt 0.318819 0.910112 0 +vt 0.283877 0.695369 0 +vt 0.252001 0.887726 0 +vt 0.275255 0.80017 0 +vt 0.19945 0.803168 0 +vt 0.436354 0.290608 0 +vt 0.3662 0.823057 0 +vt 0.498348 0.292484 0 +vt 0.495948 0.957021 0 +vt 0.10292 0.392065 0 +vt 0.45675 0.997198 0 +vt 0.375916 0.956447 0 +vt 0.075154 0.42042 0 +vt 0.416227 0.997221 0 +vt 0.456712 0.956816 0 +vt 0.416225 0.956806 0 +vt 0.456172 0.82355 0 +vt 0.416731 0.824647 0 +vt 0.496678 0.822937 0 +vt 0.196696 0.483704 0 +vt 0.169196 0.512305 0 +vt 0.377041 0.822595 0 +vt 0.452832 0.768161 0 +vt 0.425823 0.769999 0 +vt 0.218443 0.537816 0 +vt 0.384197 0.764756 0 +vt 0.422662 0.726694 0 +vt 0.49481 0.766707 0 +vt 0.23535 0.519557 0 +vt 0.449921 0.724799 0 +vt 0.095834 0.208772 0 +vt 0.039343 0.137854 0 +vt 0.057027 0.147654 0 +vt 0.062632 0.222927 0 +vt 0.039308 0.158849 0 +vt 0.04078 0.315102 0 +vt 0.070835 0.280228 0 +vt 0.102932 0.307938 0 +vt 0.110762 0.270579 0 +vt 0.041282 0.358462 0 +vt 0.072792 0.342824 0 +vt 0.361206 0.224968 0 +vt 0.364222 0.224968 0 +vt 0.343112 0.224967 0 +vt 0.367238 0.224968 0 +vt 0.346128 0.224967 0 +vt 0.349143 0.224968 0 +vt 0.328345 0.296397 0 +vt 0.352159 0.264994 0 +vt 0.316111 0.301074 0 +vt 0.355175 0.264994 0 +vt 0.304153 0.295731 0 +vt 0.35819 0.264994 0 +vt 0.299475 0.283498 0 +vt 0.361206 0.264994 0 +vt 0.304818 0.271539 0 +vt 0.364222 0.264994 0 +vt 0.317052 0.266862 0 +vt 0.343112 0.264994 0 +vt 0.367238 0.264994 0 +vt 0.32901 0.272205 0 +vt 0.346128 0.264994 0 +vt 0.333688 0.284439 0 +vt 0.349143 0.264994 0 +vt 0.316582 0.283968 0 +vt 0.312838 0.224509 0 +vt 0.315906 0.22444 0 +vt 0.318977 0.22437 0 +vt 0.322049 0.224296 0 +vt 0.325124 0.22422 0 +vt 0.303636 0.224704 0 +vt 0.328202 0.224144 0 +vt 0.306703 0.22464 0 +vt 0.30977 0.224575 0 +vt 0.368307 0.296009 0 +vt 0.313643 0.265231 0 +vt 0.356074 0.300686 0 +vt 0.316705 0.265169 0 +vt 0.344115 0.295343 0 +vt 0.319768 0.265108 0 +vt 0.339438 0.28311 0 +vt 0.32283 0.26505 0 +vt 0.344781 0.271151 0 +vt 0.325893 0.264994 0 +vt 0.357015 0.266474 0 +vt 0.304451 0.265411 0 +vt 0.32922 0.264994 0 +vt 0.368973 0.271817 0 +vt 0.307516 0.265351 0 +vt 0.37365 0.284051 0 +vt 0.31058 0.265291 0 +vt 0.356544 0.28358 0 +vt 0.11116 0.337 0 +vt 0.614968 0.723363 0 +vt 0.608538 0.990523 0 +vt 0.29194 0.529223 0 +vt 0.62133 0.98202 0 +vt 0.369034 0.609455 0 +vt 0.380177 0.167709 0 +vt 0.347655 0.179822 0 +vt 0.369767 0.039595 0 +vt 0.346915 0.033192 0 +vt 0.396334 0.040637 0 +vt 0.346793 0.00661 0 +vt 0.406674 0.167689 0 +vt 0.34778 0.206333 0 +vt 0.400506 0.092061 0 +vt 0.34714 0.076348 0 +vt 0.347422 0.129521 0 +vt 0.25309 0.155811 0 +vt 0.986632 0.334252 0 +vt 0.900869 0.480587 0 +vt 0.178263 0.12975 0 +vt 0.948411 0.446335 0 +vt 0.938762 0.317929 0 +vt 0.90054 0.43001 0 +vt 0.726249 0.319303 0 +vt 0.753116 0.430966 0 +vt 0.253094 0.013616 0 +vt 0.677076 0.331135 0 +vt 0.753444 0.48154 0 +vt 0.178266 0.031107 0 +vt 0.703943 0.442796 0 +vt 0.612474 0.98263 0 +vt 0.34598 0.618839 0 +vt 0.581161 0.967031 0 +vt 0.323125 0.60923 0 +vt 0.577236 0.974932 0 +vt 0.301895 0.494844 0 +vt 0.57263 0.969518 0 +vt 0.510333 0.226098 0 +vt 0.382299 0.360197 0 +vt 0.667065 0.356807 0 +vt 0.610495 0.598294 0 +vt 0.614647 0.607502 0 +vt 0.360782 0.383711 0 +vt 0.601286 0.608074 0 +vt 0.946295 0.240423 0 +vt 0.661994 0.243219 0 +vt 0.991137 0.240398 0 +vt 0.701254 0.243258 0 +vt 0.739885 0.243356 0 +vt 0.778704 0.243132 0 +vt 0.818178 0.242671 0 +vt 0.858856 0.241693 0 +vt 0.90173 0.240871 0 +vt 0.973266 0.207191 0 +vt 0.94624 0.287074 0 +vt 0.911901 0.23261 0 +vt 0.662047 0.284293 0 +vt 0.991082 0.287208 0 +vt 0.850535 0.207191 0 +vt 0.701289 0.284167 0 +vt 0.825117 0.145826 0 +vt 0.739912 0.284018 0 +vt 0.850535 0.084461 0 +vt 0.778729 0.284198 0 +vt 0.911901 0.059042 0 +vt 0.818183 0.284624 0 +vt 0.973266 0.084461 0 +vt 0.858836 0.28562 0 +vt 0.998684 0.145826 0 +vt 0.901683 0.286519 0 +vt 0.911901 0.142355 0 +vt 0.520712 0.441362 0 +vt 0.565962 0.396112 0 +vt 0.656461 0.441362 0 +vt 0.611211 0.396112 0 +vt 0.565962 0.441362 0 +vt 0.611211 0.441362 0 +vt 0.565962 0.486611 0 +vt 0.611211 0.486611 0 +vt 0.520712 0.486611 0 +vt 0.565962 0.531861 0 +vt 0.656461 0.486611 0 +vt 0.611211 0.531861 0 +vt 0.352159 0.224968 0 +vt 0.355175 0.224967 0 +vt 0.35819 0.224967 0 +vt 0.361206 0.224968 0 +vt 0.364222 0.224968 0 +vt 0.343112 0.224967 0 +vt 0.367238 0.224968 0 +vt 0.346128 0.224967 0 +vt 0.349143 0.224968 0 +vt 0.328345 0.296397 0 +vt 0.352159 0.264994 0 +vt 0.316111 0.301074 0 +vt 0.355175 0.264994 0 +vt 0.304153 0.295731 0 +vt 0.35819 0.264994 0 +vt 0.299475 0.283498 0 +vt 0.361206 0.264994 0 +vt 0.304818 0.271539 0 +vt 0.364222 0.264994 0 +vt 0.317052 0.266862 0 +vt 0.343112 0.264994 0 +vt 0.367238 0.264994 0 +vt 0.32901 0.272205 0 +vt 0.346128 0.264994 0 +vt 0.333688 0.284439 0 +vt 0.349143 0.264994 0 +vt 0.316582 0.283968 0 +vt 0.312838 0.224509 0 +vt 0.315906 0.22444 0 +vt 0.318977 0.22437 0 +vt 0.322049 0.224296 0 +vt 0.325124 0.22422 0 +vt 0.303636 0.224704 0 +vt 0.328202 0.224144 0 +vt 0.306703 0.22464 0 +vt 0.30977 0.224575 0 +vt 0.368307 0.296009 0 +vt 0.313643 0.265231 0 +vt 0.356074 0.300686 0 +vt 0.316705 0.265169 0 +vt 0.344115 0.295343 0 +vt 0.319768 0.265108 0 +vt 0.339438 0.28311 0 +vt 0.32283 0.26505 0 +vt 0.344781 0.271151 0 +vt 0.325893 0.264994 0 +vt 0.357015 0.266474 0 +vt 0.304451 0.265411 0 +vt 0.32922 0.264994 0 +vt 0.368973 0.271817 0 +vt 0.307516 0.265351 0 +vt 0.37365 0.284051 0 +vt 0.31058 0.265291 0 +vt 0.356544 0.28358 0 +vt 0.538458 0.400243 0 +vt 0.488848 0.450839 0 +vt 0.608538 0.990523 0 +vt 0.29194 0.529223 0 +vt 0.62133 0.98202 0 +vt 0.594713 0.724759 0 +vt 0.612474 0.98263 0 +vt 0.49603 0.675106 0 +vt 0.581161 0.967031 0 +vt 0.142475 0.228861 0 +vt 0.476527 0.680791 0 +vt 0.577236 0.974932 0 +vt 0.301895 0.494844 0 +vt 0.57263 0.969518 0 +vt 0.367986 0.565002 0 +vt 0.425478 0.616457 0 +vt 0.425848 0.486287 0 +vt 0.667065 0.356807 0 +vt 0.610495 0.598294 0 +vt 0.614647 0.607502 0 +vt 0.345685 0.555992 0 +vt 0.425794 0.505287 0 +vt 0.601286 0.608074 0 +vt 0.374237 0.635974 0 +vt 0.603553 0.660983 0 +vt 0.324555 0.565556 0 +vt 0.425737 0.525603 0 +vt 0.670709 0.390276 0 +vt 0.602008 0.674295 0 +vt 0.616898 0.660405 0 +vt 0.059939 0.122085 0 +vt 0.687668 0.499238 0 +vt 0.045477 0.509967 0 +vt 0.008219 0.122247 0 +vt 0.636899 0.498768 0 +vt 0.008104 0.053923 0 +vt 0.316467 0.586764 0 +vt 0.425678 0.546256 0 +vt 0.325297 0.607393 0 +vt 0.425622 0.565813 0 +vt 0.345968 0.616042 0 +vt 0.425573 0.583176 0 +vt 0.008828 0.913903 0 +vt 0.008828 0.991382 0 +vt 0.636121 0.986565 0 +vt 0.007736 0.358786 0 +vt 0.007736 0.137802 0 +vt 0.007736 0.157777 0 +vt 0.007736 0.222377 0 +vt 0.007736 0.284298 0 +vt 0.007736 0.316526 0 +vt 0.366961 0.607857 0 +vt 0.425532 0.597655 0 +vt 0.376419 0.586974 0 +vt 0.4255 0.608967 0 +vt 0.372567 0.613026 0 +vt 0.418233 0.616858 0 +vt 0.418604 0.486279 0 +vt 0.345949 0.623829 0 +vt 0.41855 0.505269 0 +vt 0.319594 0.612732 0 +vt 0.418492 0.525551 0 +vt 0.389044 0.29016 0 +vt 0.137994 0.570166 0 +vt 0.390497 0.210232 0 +vt 0.557298 0.26537 0 +vt 0.453183 0.43316 0 +vt 0.435459 0.452036 0 +vt 0.443424 0.642622 0 +vt 0.569111 0.384092 0 +vt 0.44067 0.668067 0 +vt 0.308742 0.586347 0 +vt 0.418434 0.546192 0 +vt 0.319631 0.559984 0 +vt 0.418378 0.565797 0 +vt 0.26567 0.007003 0 +vt 0.265811 0.033587 0 +vt 0.345967 0.548943 0 +vt 0.418328 0.583226 0 +vt 0.372506 0.559731 0 +vt 0.418287 0.597784 0 +vt 0.400909 0.096914 0 +vt 0.901262 0.530297 0 +vt 0.945558 0.536298 0 +vt 0.938872 0.531149 0 +vt 0.383698 0.586308 0 +vt 0.418254 0.609248 0 +vt 0.902345 0.986421 0 +vt 0.359357 0.573792 0 +vt 0.813927 0.986075 0 +vt 0.809312 0.573689 0 +vt 0.812099 0.56775 0 +vt 0.853688 0.529528 0 +vt 0.848087 0.53162 0 +vt 0.900755 0.538571 0 +vt 0.904638 0.649276 0 +vt 0.937884 0.539507 0 +vt 0.987257 0.649743 0 +vt 0.90173 0.978186 0 +vt 0.984307 0.979178 0 +vt 0.816956 0.648322 0 +vt 0.813964 0.977666 0 +vt 0.81769 0.573982 0 +vt 0.853542 0.537896 0 +vt 0.808549 0.64825 0 +vt 0.994729 0.751596 0 +vt 0.986429 0.751521 0 +vt 0.903756 0.750787 0 +vt 0.815903 0.749985 0 +vt 0.807509 0.749992 0 +vt 0.059939 0.122085 0 +vt 0.687668 0.499238 0 +vt 0.346162 0.586441 0 +vt 0.345869 0.568161 0 +vt 0.062187 0.98965 0 +vt 0.69945 0.98606 0 +vt 0.346673 0.542322 0 +vt 0.128965 0.974582 0 +vt 0.782818 0.981712 0 +vt 0.333221 0.573771 0 +vt 0.328226 0.586552 0 +vt 0.687993 0.503583 0 +vt 0.69842 0.750594 0 +vt 0.727594 0.498641 0 +vt 0.780939 0.750999 0 +vt 0.995564 0.649813 0 +vt 0.994931 0.646535 0 +vt 0.699276 0.981779 0 +vt 0.779679 0.980604 0 +vt 0.992605 0.979257 0 +vt 0.985632 0.987425 0 +vt 0.634522 0.750265 0 +vt 0.333547 0.599086 0 +vt 0.346093 0.604325 0 +vt 0.05879 0.007778 0 +vt 0.047272 0.488901 0 +vt 0.058235 0.053941 0 +vt 0.358792 0.599285 0 +vt 0.057779 0.913566 0 +vt 0.407615 0.505451 0 +vt 0.123087 0.916212 0 +vt 0.364368 0.586675 0 +vt 0.224808 0.340362 0 +vt 0.785169 0.750557 0 +vt 0.058749 0.73063 0 +vt 0.28587 0.303495 0 +vt 0.124342 0.730754 0 +vt 0.125459 0.063828 0 +vt 0.0814 0.510898 0 +vt 0.102683 0.029981 0 +vt 0.073324 0.01374 0 +vt 0.05933 0.488428 0 +vt 0.099108 0.116354 0 +vt 0.731869 0.49777 0 +vt 0.726871 0.494355 0 +vt 0.072323 0.053475 0 +vt 0.193953 0.981583 0 +vt 0.424823 0.351441 0 +vt 0.188639 0.887683 0 +vt 0.199784 0.698522 0 +vt 0.438044 0.211097 0 +vt 0.20532 0.571215 0 +vt 0.384199 0.711565 0 +vt 0.500316 0.212631 0 +vt 0.290876 0.593575 0 +vt 0.258604 0.963636 0 +vt 0.467461 0.353125 0 +vt 0.318819 0.910112 0 +vt 0.283877 0.695369 0 +vt 0.252001 0.887726 0 +vt 0.275255 0.80017 0 +vt 0.19945 0.803168 0 +vt 0.436354 0.290608 0 +vt 0.3662 0.823057 0 +vt 0.498348 0.292484 0 +vt 0.495948 0.957021 0 +vt 0.10292 0.392065 0 +vt 0.45675 0.997198 0 +vt 0.375916 0.956447 0 +vt 0.075154 0.42042 0 +vt 0.416227 0.997221 0 +vt 0.456712 0.956816 0 +vt 0.416225 0.956806 0 +vt 0.456172 0.82355 0 +vt 0.416731 0.824647 0 +vt 0.496678 0.822937 0 +vt 0.196696 0.483704 0 +vt 0.169196 0.512305 0 +vt 0.377041 0.822595 0 +vt 0.452832 0.768161 0 +vt 0.425823 0.769999 0 +vt 0.218443 0.537816 0 +vt 0.384197 0.764756 0 +vt 0.422662 0.726694 0 +vt 0.49481 0.766707 0 +vt 0.23535 0.519557 0 +vt 0.449921 0.724799 0 +vt 0.095834 0.208772 0 +vt 0.057027 0.147654 0 +vt 0.039343 0.137854 0 +vt 0.062632 0.222927 0 +vt 0.039308 0.158849 0 +vt 0.04078 0.315102 0 +vt 0.070835 0.280228 0 +vt 0.102932 0.307938 0 +vt 0.110762 0.270579 0 +vt 0.072792 0.342824 0 +vt 0.041282 0.358462 0 +vt 0.313711 0.586352 0 +vt 0.603553 0.660983 0 +vt 0.525739 0.381449 0 +vt 0.371282 0.666665 0 +vt 0.670709 0.390276 0 +vt 0.602008 0.674295 0 +vt 0.616898 0.660405 0 +vt 0.323155 0.563492 0 +vt 0.045477 0.509967 0 +vt 0.345996 0.553927 0 +vt 0.368994 0.563294 0 +vt 0.007243 0.008448 0 +vt 0.008828 0.488425 0 +vt 0.008828 0.509895 0 +vt 0.008828 0.730482 0 +vt 0.378658 0.586315 0 +vt 0.359372 0.599752 0 +vt 0.346081 0.586365 0 +vt 0.346045 0.605197 0 +vt 0.332779 0.599642 0 +vt 0.327306 0.586362 0 +vt 0.380177 0.167709 0 +vt 0.347655 0.179822 0 +vt 0.332793 0.573092 0 +vt 0.346054 0.567553 0 +vt 0.137994 0.695528 0 +vt 0.137994 0.804199 0 +vt 0.137994 0.891424 0 +vt 0.369767 0.039595 0 +vt 0.346915 0.033192 0 +vt 0.396334 0.040637 0 +vt 0.346793 0.00661 0 +vt 0.389055 0.351447 0 +vt 0.137994 0.982716 0 +vt 0.359376 0.573 0 +vt 0.36494 0.586271 0 +vt 0.557298 0.26537 0 +vt 0.453183 0.43316 0 +vt 0.435459 0.452036 0 +vt 0.443424 0.642622 0 +vt 0.569111 0.384092 0 +vt 0.44067 0.668067 0 +vt 0.266302 0.129883 0 +vt 0.266035 0.076773 0 + +f 209/327 342/531 208/326 206/322 205/320 +f 452/688 38/75 109/161 39/76 451/686 +f 1/2 2/4 3/6 4/8 +f 2/4 5/10 6/12 3/6 +f 5/10 7/14 8/16 6/12 +f 7/14 9/18 10/20 8/16 +f 9/18 11/23 12/26 10/20 +f 11/22 13/28 14/30 12/25 +f 13/28 15/32 16/34 14/30 +f 15/32 1/2 4/8 16/34 +f 4/7 3/5 17/35 +f 3/5 6/11 17/35 +f 6/11 8/15 17/35 +f 8/15 10/19 17/35 +f 10/19 12/24 17/35 +f 12/24 14/29 17/35 +f 14/29 16/33 17/35 +f 16/33 4/7 17/35 +f 5/9 2/3 18/36 +f 18/36 2/3 1/1 +f 11/21 18/36 13/27 +f 9/17 18/36 11/21 +f 5/9 18/36 7/13 +f 7/13 18/36 9/17 +f 13/27 18/36 15/31 +f 15/31 18/36 1/1 +f 19/38 22/44 21/42 20/40 +f 20/40 21/42 24/48 23/46 +f 23/46 24/48 26/52 25/50 +f 25/50 26/52 28/56 27/54 +f 27/54 28/56 30/62 29/59 +f 29/58 30/61 32/66 31/64 +f 31/64 32/66 34/70 33/68 +f 33/68 34/70 22/44 19/38 +f 22/43 35/71 21/41 +f 21/41 35/71 24/47 +f 24/47 35/71 26/51 +f 26/51 35/71 28/55 +f 28/55 35/71 30/60 +f 30/60 35/71 32/65 +f 32/65 35/71 34/69 +f 34/69 35/71 22/43 +f 23/45 36/72 20/39 +f 36/72 19/37 20/39 +f 29/57 31/63 36/72 +f 27/53 29/57 36/72 +f 23/45 25/49 36/72 +f 25/49 27/53 36/72 +f 31/63 33/67 36/72 +f 33/67 19/37 36/72 +f 452/689 451/687 339/526 338/525 +f 451/687 39/76 461/701 339/526 +f 445/680 37/74 87/137 89/139 +f 40/77 445/680 89/139 460/700 +f 39/76 109/161 40/77 +f 40/77 109/161 37/73 445/679 +f 110/163 111/165 114/169 113/168 +f 113/168 114/169 122/181 115/170 +f 115/170 122/181 295/451 127/188 +f 111/164 295/450 122/181 114/169 +f 127/187 110/162 113/168 115/170 +f 327/507 303/466 305/471 328/509 +f 328/509 305/471 309/476 329/511 +f 75/122 77/124 79/126 81/130 +f 80/128 78/125 76/123 74/120 +f 82/131 175/268 176/270 83/132 +f 83/132 176/270 177/272 84/133 +f 84/133 177/272 178/274 170/261 +f 170/261 178/274 179/276 171/262 +f 171/262 179/276 180/279 172/264 +f 172/263 180/278 181/281 173/265 +f 173/265 181/281 182/283 174/266 +f 174/266 182/283 175/268 82/131 +f 175/267 183/284 176/269 +f 176/269 183/284 177/271 +f 177/271 183/284 178/273 +f 178/273 183/284 179/275 +f 179/275 183/284 180/277 +f 180/277 183/284 181/280 +f 94/146 93/145 95/147 96/148 +f 106/158 94/146 96/148 105/157 +f 99/151 94/146 106/158 107/159 +f 99/151 101/153 94/146 +f 85/134 86/136 95/147 93/145 +f 86/135 119/176 96/148 95/147 +f 119/175 104/156 105/157 96/148 +f 121/180 88/138 97/149 98/150 +f 88/138 90/140 100/152 97/149 +f 91/142 92/144 102/154 101/153 +f 92/143 85/134 93/145 102/154 +f 99/151 107/159 108/160 103/155 +f 101/153 99/151 103/155 91/141 +f 104/156 121/179 98/150 105/157 +f 97/149 106/158 105/157 98/150 +f 107/159 106/158 97/149 100/152 +f 117/172 116/171 118/173 119/174 +f 120/177 117/172 119/174 121/178 +f 380/581 117/172 120/177 123/182 +f 380/581 124/183 116/171 117/172 +f 311/481 136/207 118/173 116/171 +f 136/206 131/196 119/174 118/173 +f 131/196 130/194 121/178 119/174 +f 130/194 112/167 120/177 121/178 +f 112/167 319/494 123/182 120/177 +f 313/484 311/481 116/171 124/183 +f 436/669 125/185 126/186 314/485 +f 314/485 126/186 311/480 313/483 +f 319/493 112/166 128/189 318/492 +f 438/672 132/197 312/482 437/671 +f 136/205 134/201 133/199 131/195 +f 125/184 312/482 134/200 135/204 +f 128/189 112/166 130/193 129/191 +f 126/186 125/185 135/203 137/208 +f 318/492 128/189 132/197 438/672 +f 133/198 132/197 128/189 129/191 +f 131/195 133/199 129/190 130/192 +f 135/202 134/201 136/205 137/208 +f 143/220 145/222 146/223 149/226 +f 138/209 143/219 149/227 148/225 +f 141/213 142/217 144/221 140/212 +f 147/224 146/223 145/222 139/211 +f 139/211 145/222 143/218 138/210 +f 140/212 144/221 146/223 147/224 +f 149/227 142/216 141/214 148/225 +f 146/223 144/221 142/215 149/226 +f 150/230 151/233 153/235 152/234 +f 152/234 153/235 155/237 154/236 +f 158/242 159/243 160/246 161/249 +f 156/239 157/240 151/232 150/229 +f 151/231 157/241 155/237 153/235 +f 156/238 150/228 152/234 154/236 +f 154/236 155/237 159/243 158/242 +f 155/237 157/241 160/245 159/243 +f 157/240 156/239 161/248 160/244 +f 156/238 154/236 158/242 161/247 +f 164/253 162/250 168/258 167/256 +f 163/252 162/250 164/253 165/254 +f 166/255 167/256 168/257 169/260 +f 181/280 183/284 182/282 +f 182/282 183/284 175/267 +f 184/285 192/295 193/297 185/286 +f 185/286 193/297 194/299 186/287 +f 186/287 194/299 195/301 187/288 +f 187/288 195/301 196/303 188/289 +f 188/289 196/303 197/306 189/291 +f 189/290 197/305 198/308 190/292 +f 190/292 198/308 199/310 191/293 +f 191/293 199/310 192/295 184/285 +f 192/294 200/311 193/296 +f 193/296 200/311 194/298 +f 194/298 200/311 195/300 +f 195/300 200/311 196/302 +f 196/302 200/311 197/304 +f 197/304 200/311 198/307 +f 198/307 200/311 199/309 +f 199/309 200/311 192/294 +f 76/123 78/125 79/126 77/124 +f 227/343 202/316 201/313 297/455 +f 299/457 229/345 227/343 297/455 +f 301/460 231/349 229/345 299/457 +f 201/312 202/315 231/348 301/459 +f 202/314 227/343 229/345 231/347 +f 232/351 234/355 457/696 456/695 +f 307/473 430/661 459/699 458/697 +f 430/660 232/350 456/694 459/698 +f 233/354 235/356 429/659 431/664 +f 394/602 395/605 384/586 367/560 +f 437/671 436/670 383/585 433/666 +f 392/598 391/596 390/594 433/666 +f 321/497 423/651 421/649 320/496 +f 211/330 212/333 214/335 213/334 +f 213/334 214/335 216/337 215/336 +f 215/336 216/337 218/342 217/339 +f 217/338 218/341 212/332 211/329 +f 212/331 218/340 216/337 214/335 +f 322/498 422/650 423/651 321/497 +f 323/499 425/653 422/650 322/498 +f 324/500 424/652 425/653 323/499 +f 319/495 427/657 424/652 324/500 +f 449/684 405/621 398/609 448/683 +f 450/685 397/608 405/621 449/684 +f 453/691 396/606 397/608 450/685 +f 330/512 406/622 396/607 453/690 +f 331/514 399/610 406/622 330/512 +f 448/683 398/609 399/611 331/513 +f 456/695 457/696 235/356 233/353 +f 458/697 429/659 235/356 457/696 +f 459/699 431/663 429/659 458/697 +f 78/125 80/127 81/129 79/126 +f 456/694 233/352 431/662 459/698 +f 39/76 40/77 460/700 461/701 +f 236/357 237/359 245/370 244/367 +f 237/358 238/360 246/372 245/369 +f 238/360 239/361 247/374 246/372 +f 239/361 240/362 248/376 247/374 +f 240/362 241/363 249/378 248/376 +f 241/363 242/364 250/380 249/378 +f 242/364 243/365 251/382 250/380 +f 243/365 236/357 244/367 251/382 +f 244/366 245/368 252/383 +f 245/368 246/371 252/383 +f 246/371 247/373 252/383 +f 247/373 248/375 252/383 +f 248/375 249/377 252/383 +f 249/377 250/379 252/383 +f 250/379 251/381 252/383 +f 251/381 244/366 252/383 +f 253/385 254/387 256/389 255/388 +f 255/388 256/389 258/391 257/390 +f 257/390 258/391 260/395 259/393 +f 254/386 260/394 258/391 256/389 +f 259/392 253/384 255/388 257/390 +f 261/396 262/397 270/408 269/406 +f 262/397 263/398 271/410 270/408 +f 263/398 264/399 272/412 271/410 +f 264/399 265/400 273/414 272/412 +f 265/400 266/402 274/417 273/414 +f 266/401 267/403 275/419 274/416 +f 267/403 268/404 276/421 275/419 +f 268/404 261/396 269/406 276/421 +f 269/405 270/407 277/422 +f 270/407 271/409 277/422 +f 271/409 272/411 277/422 +f 272/411 273/413 277/422 +f 273/413 274/415 277/422 +f 274/415 275/418 277/422 +f 275/418 276/420 277/422 +f 276/420 269/405 277/422 +f 278/423 279/424 287/435 286/433 +f 279/424 280/425 288/437 287/435 +f 280/425 281/426 289/439 288/437 +f 281/426 282/427 290/441 289/439 +f 282/427 283/429 291/444 290/441 +f 283/428 284/430 292/446 291/443 +f 284/430 285/431 293/448 292/446 +f 285/431 278/423 286/433 293/448 +f 286/432 287/434 294/449 +f 287/434 288/436 294/449 +f 288/436 289/438 294/449 +f 289/438 290/440 294/449 +f 290/440 291/442 294/449 +f 291/442 292/445 294/449 +f 292/445 293/447 294/449 +f 293/447 286/432 294/449 +f 298/456 297/455 201/313 296/454 +f 299/457 297/455 298/456 300/458 +f 301/460 299/457 300/458 302/463 +f 201/312 301/459 302/462 296/453 +f 296/452 302/461 300/458 298/456 +f 232/351 332/516 333/517 234/355 +f 307/473 334/518 335/520 430/661 +f 430/660 335/519 332/515 232/350 +f 304/469 310/479 308/474 306/472 +f 136/205 311/480 126/186 137/208 +f 437/671 312/482 125/184 436/670 +f 134/200 312/482 132/197 133/198 +f 321/497 320/496 163/251 165/254 +f 322/498 321/497 165/254 164/253 +f 323/499 322/498 164/253 167/256 +f 324/500 323/499 167/256 166/255 +f 319/495 324/500 166/255 169/259 +f 449/684 448/683 140/212 147/224 +f 450/685 449/684 147/224 139/211 +f 453/691 450/685 139/211 138/210 +f 330/512 453/690 138/209 148/225 +f 331/514 330/512 148/225 141/214 +f 448/683 331/513 141/213 140/212 +f 332/516 304/468 306/472 333/517 +f 334/518 333/517 306/472 308/474 +f 335/520 334/518 308/474 310/478 +f 332/515 335/519 310/477 304/467 +f 209/327 461/701 460/700 210/328 +f 206/323 338/525 339/526 205/321 +f 205/321 339/526 461/701 209/327 +f 204/319 89/139 87/137 207/325 +f 210/328 460/700 89/139 204/319 +f 209/327 210/328 342/531 +f 210/328 204/318 207/324 342/531 +f 352/545 354/547 353/546 351/544 +f 364/557 363/556 354/547 352/545 +f 357/550 365/558 364/557 352/545 +f 359/552 352/545 351/544 360/553 +f 343/532 351/544 353/546 344/534 +f 344/533 353/546 354/547 377/576 +f 377/575 354/547 363/556 362/555 +f 379/580 356/549 355/548 346/537 +f 346/537 355/548 358/551 348/539 +f 349/541 359/552 360/553 350/543 +f 350/542 360/553 351/544 343/532 +f 357/550 361/554 366/559 365/558 +f 359/552 349/540 361/554 357/550 +f 362/555 363/556 356/549 379/579 +f 355/548 356/549 363/556 364/557 +f 365/558 358/551 355/548 364/557 +f 375/572 377/574 376/573 374/571 +f 378/577 379/578 377/574 375/572 +f 380/581 123/182 378/577 375/572 +f 380/581 375/572 374/571 124/183 +f 367/561 374/571 376/573 394/604 +f 394/603 376/573 377/574 389/593 +f 389/593 377/574 379/578 371/568 +f 371/568 379/578 378/577 370/565 +f 370/565 378/577 123/182 319/494 +f 313/484 124/183 374/571 367/561 +f 436/669 314/485 384/586 383/584 +f 314/485 313/483 367/560 384/586 +f 319/493 318/492 386/588 370/564 +f 438/672 437/671 433/666 390/594 +f 394/602 389/592 391/595 392/597 +f 383/585 393/601 392/598 433/666 +f 386/588 387/590 371/567 370/564 +f 384/586 395/605 393/600 383/584 +f 318/492 438/672 390/594 386/588 +f 391/596 387/590 386/588 390/594 +f 389/592 371/566 387/589 391/595 +f 393/599 395/605 394/602 392/597 +f 401/617 407/623 404/620 403/619 +f 396/607 406/622 407/624 401/616 +f 399/611 398/609 402/618 400/614 +f 405/621 397/608 403/619 404/620 +f 397/608 396/606 401/615 403/619 +f 398/609 405/621 404/620 402/618 +f 407/624 406/622 399/610 400/613 +f 404/620 407/623 400/612 402/618 +f 408/627 410/631 411/632 409/630 +f 410/631 412/633 413/634 411/632 +f 416/639 419/646 418/643 417/640 +f 414/636 408/626 409/629 415/637 +f 409/628 411/632 413/634 415/638 +f 414/635 412/633 410/631 408/625 +f 412/633 416/639 417/640 413/634 +f 413/634 417/640 418/642 415/638 +f 415/637 418/641 419/645 414/636 +f 414/635 419/644 416/639 412/633 +f 422/650 425/653 426/655 420/647 +f 421/648 423/651 422/650 420/647 +f 424/652 427/656 426/654 425/653 +f 329/511 309/476 315/487 336/522 +f 336/522 315/487 316/489 337/524 +f 337/524 316/489 317/491 340/528 +f 340/528 317/491 325/502 341/530 +f 341/530 325/502 326/504 345/536 +f 345/536 326/504 303/465 327/506 +f 347/538 368/562 369/563 +f 369/563 368/562 372/569 +f 372/569 368/562 373/570 +f 373/570 368/562 381/582 +f 381/582 368/562 382/583 +f 382/583 368/562 385/587 +f 385/587 368/562 388/591 +f 347/538 388/591 368/562 +f 441/675 440/674 442/676 +f 441/675 442/676 443/677 +f 441/675 443/677 444/678 +f 441/675 444/678 446/681 +f 441/675 446/681 447/682 +f 441/675 447/682 454/692 +f 441/675 454/692 455/693 +f 441/675 455/693 440/674 +f 347/538 303/464 326/503 388/591 +f 347/538 369/563 305/470 303/464 +f 369/563 372/569 309/475 305/470 +f 372/569 373/570 315/486 309/475 +f 373/570 381/582 316/488 315/486 +f 381/582 382/583 317/490 316/488 +f 382/583 385/587 325/501 317/490 +f 385/587 388/591 326/503 325/501 +f 203/317 327/505 328/508 228/344 +f 228/344 328/508 329/510 230/346 +f 41/79 43/83 44/84 42/82 +f 43/83 45/85 46/86 44/84 +f 45/85 47/88 48/91 46/86 +f 47/87 41/78 42/81 48/90 +f 42/80 44/84 46/86 48/89 +f 230/346 329/510 336/521 428/658 +f 428/658 336/521 337/523 432/665 +f 432/665 337/523 340/527 434/667 +f 434/667 340/527 341/529 435/668 +f 435/668 341/529 345/535 439/673 +f 439/673 345/535 327/505 203/317 +f 440/674 203/317 228/344 442/676 +f 442/676 228/344 230/346 443/677 +f 443/677 230/346 428/658 444/678 +f 444/678 428/658 432/665 446/681 +f 446/681 432/665 434/667 447/682 +f 447/682 434/667 435/668 454/692 +f 454/692 435/668 439/673 455/693 +f 440/674 455/693 439/673 203/317 +f 94/146 101/153 102/154 93/145 +f 357/550 352/545 359/552 +f 57/92 65/102 66/105 58/94 +f 58/93 66/104 67/107 59/95 +f 59/95 67/107 68/109 60/96 +f 60/96 68/109 69/111 61/97 +f 61/97 69/111 70/113 62/98 +f 62/98 70/113 71/115 63/99 +f 63/99 71/115 72/117 64/100 +f 64/100 72/117 65/102 57/92 +f 65/101 73/118 66/103 +f 66/103 73/118 67/106 +f 67/106 73/118 68/108 +f 68/108 73/118 69/110 +f 69/110 73/118 70/112 +f 70/112 73/118 71/114 +f 71/114 73/118 72/116 +f 72/116 73/118 65/101 +f 74/119 76/123 77/124 75/121 + diff --git a/tests/cpp-tests/Resources/Sprite3DTest/boss.png b/tests/cpp-tests/Resources/Sprite3DTest/boss.png new file mode 100644 index 0000000000000000000000000000000000000000..7073a9678cf91e7f6734c17159ea26f9cea682d6 GIT binary patch literal 28427 zcmaI7cUaTG(=WOyga83T2Wg>57eX(h1S!(HG!;TsI#Q&F5IWL3hzJpo4kAUQ2LwS8 zlqv!uqJXG$>Fx4+&w0Mh4fZDKAh00I0RK)J*_@ zoHro=2|ItdRa=^!KiK>5hx%72fr>E?$g_;}u>DS$(X& zx0=&k7p-6)C(~d9GlyU|2SrC-m8%%#K&5j59!`FCm_QGAPhX|LE4=?DSLwX{pKb|W z%zu&ixn1G?UrJf(8)4MEe4H?{;?kEKu#%D(IXQ7j8Cf|wNimERR#Hj=d;XQXBq^gL zE2ktSkNMvp-t*CX9G#U+)HVP2Sm$q7c<=i8c`Hds1Ox<#2S|&1`P`9^R8&;_j|?fP zOXn1qe1kmw>;f-&`ttp^1a&802Ok%2KNl}g%zq@>*?al>UEw{~^nXpk!~6e;_4NJU z%XGeA5`lK!5|ZNB|4iw>3H9~=|4BVO{tvaUpNZ4|)%X8Xu&-H=x08g4ldqS*kHh)K zIrIHzC~qY-A16CMFCQ~6FZcgmMWef3eqO$Jy}U7Mrg9h|eLDvi&;N7?{}+e8zLK`5 zub-W#gOj%U72b0h;w~|B+YXTp5Y~Z0-MRtN**}+YiGG<@B&VF+TTTM$=J2# z4hxmcwcB?r?s_=|N-A4Ovoi!`Pb63Vsnxw$lPqGdYb?l!iZA|hwg+weaBSuAMBgsn zO;zfKOP0C+>(9>Qj2AAl^I-3Z(hIZDovw)a#m-T&#dB#>|PI3y@HLmDX*R~$!VazQ9MrtI6 zJVcW0EbU~3(rSKrFhlI5_#KtSN8e{Cz4kt2`rBwziC8RL3n3MI|qFE|RbJ4U>U6;}-0hf}C>3GDC+{|#AM0IOA zY7JfEiVONoRX^hT-U-#bx}9a4IYQTOOPAYBM)j-x6RPdD#XYn9`>VCm?qMpsANMaW z&k4TU=64DDVyAL;)cB0?(5G|nfz4XWa)GGSNlH>}t2L`flZVG`im@}Vm|tOQ*Ryml zG1r*iva-4{7e;Y*<^Fo~8dbs6*}402vBC-<951IPjvhTVc*@%MqVh$T0w_2UJ+0d) zRZLJmgMmQhk)LXF$^})C*IG>5X(^0a*6cyAa>9~WzKs9qu?hxIj9)m^Jp1+g_l1>T zD%o26KA|2v!xt7IYw=tQ*^`4b06a z0`!!R&cziT)_6Un0)Y51orl_@crsJEw_%21 zkmjPKC{xmki9DtAi@)4fizGbE9&j5oh@?-{`*((5KC!2dQwbQ|y2u?}^!O}~BslVI zL~>LX>NS7}To+*}gWO$;q2*S}`*nR*Fzf2YgX-?3chopaC|*YNF~cUN?Q$?R=RG6z0bh^60n!p&lAd9ds+PQva!}tP~5qUN!jK z{K$XNBZr*S3A;4*O3(DhBf(zr)|JwBzQLS!%h{5<%pf&eMO9^(n()q%93Jye4GAH~ zy_E1ok&JrgE$JvNGD*#4!22p5k4b>vZ+mzDY-sP_^gpkT?cEu#_LJ<()(`BzPLECy z!qqs<9#LHuX9GFIqwlfF8CeSyU8M*64!Sn(7DDR!eb)eh@<2nt;eMDK4E_(1EsLQ; z!9nI#qTX-y*Ssi>c@TH6-WQ8h#HZxV!SlK2>T=Rm)sgS+F+Y2}?&8xm=q zvU1`^4vOH*-3!4sGCl5>XaH8T6D-jI9v-#dh{`pILzxv_Z^s!rV^2iu}Oy- z)%e_p!ibGnK`Q7NyZrD|nU&HfTLSt|b%?Kpy$*Vws00gce46g4p~?C7tRrszXHImp zNX{7BBTEBovDRAkxA3i)o4jdp>ew?TN)3`i>N7~`rWsD~_%Q)gEt?T`Ai(*R)nl&C zx9BQ&dMN_A>idWEpx`yF*p~jFV7OBr6;kXYpTqYd`7V!r++ROM0cV1#=fyXFICpxu zQ4F`*?gu})J+2EytB?ap<9jd5p}%bT;254vl?>Hu>?Ese*%wh*024up33k#>aElSq zgr6Dqs_#+3dWOedP?8y#pKdXQfF3e_wYh6IpT99y-~qpnfB$|up&(>z`s*pOi9t;QoZURTP5M@EC1|T8j z*sQqQqceHpA}&}tkU=nOOCYXK$|ZGyL|C!-+}-{yvAr;1OX8!N_$)bIZ)ou5%a7ml z6j+UD?|@GiJd{qsIC#E8@4}!P!_($x1HE!YLPnQ{nhXw!V}{M9+XKK; z4x~xsgk`wimt?FUD80+U>OIFnBMLy>5kCqJv$T_wd(M`+(u73i)2Q32o=$EZd96)^ z`Hkrh+KIK_vE$OL%%}WU>#uMm0mbRc23g+^4u^cuVEv?*k12!dUqk54ll4PL@B-{} zD9D<4s4NrT0Ya3D)~ZwmuaWPpFv z1~WsAoP=5dBSdZzKftjA6c!3wSku*hbmiW+hr}&;UZlbbky8Fr*I6m|9NcKO*g~6-$b`vg8~_9qmy0D-626au{cj3uZQ0u=^5N9E zvI%HjuV<=E?E@yHmdeFjx>q~bOF(AK6Y5L|rxj}61*iW=i%z~SWK;SE;RVd&VG9Jy zn)jp|$^03OFmuF`Qte|GstssqUl{`wFX&*uC6M_@&9h&?c?!i5A5 zZ?b(#2{)nv<+K<+83B3luOq4jAS_Em6s6gddPH4zISDhI{GVre(&9 zE3=+KK}K!ct~CxsM5v&eC}G_W(R8JkSOA)G8*CV{e;ScYANUS)b@l9M>bPgbFU9(g z;YIYQ?bqy^WbSnsb%c;B)P3MiOaO0J3biqaqnvUtprEV!di?h0Ve=eB!h5XeVB4#e z4F)lSqTp=eP^#gl7H7gu$&8}C3d zI7|ZUM-^^fS(gn|0crK_pO?ma9SB3j09x;@Ws`_k9Y?)8i(PzQEcb4DJ^r?K8-gcU zZr*RiG9kG{$E{>9J1Mvx*sh-GhlWCw56C7ew9xLrI9w0$`XVLSuTHIh3-l2{6ktS| zm%==r$ekZ@o6gx%;InESsuCGp&RoJul!uOv^uA{N<&$PMe>?0TO{U&ZxdT!dvocmD zUtRTrrR|t=c6Lyvex%6w%dc|HzB5;sgcx?I7`t)T*!Xf1PW*gB$}8xaBo5ZnFBV<6 z3LbITku;L3%}0gkD3qLLllB`wm)~;mSY-^mc6*X`imWZ4D}RD|vEqa-ycD zb`m3?^;|s|?e+YY4SzF&Q~X6tmva1FkXYbA(Rzo9?8eacMXupNhYj6 zU%1%%%xv|~knbR7qBK+Qz~8=vcqT?GB7|CmQfatg?!mB98p{ANd1!z3aKQ;>;+?|V zx2J#WPJ_)PIO_SJaCHMj?-zwfFhm;Ud*=QCaCoOm2?h`IAkgCQB!Rc@ zOqjV(|Lbvcv@w^XjPmDlUO8}G)=L%%`?*dJ z{Um0rr7m>FYBK+7W;*)(EU#DVZlu&BfdxcXCWK7{2f(Q)9aL?Wxc4&xgZl6@rpWRc zhFgoPQan;pL^LD(Si|P+qKUM5=BGdYNeBjIc_Bcs6FSFHW~Y8B349=9`aCYibR$u= zN#*_wXYDC7~d#Hwui!zcpnt)eU036OuHB0BYiV&W22L-y<_5|Wm`S;S#}8vQr_Wx2X&Q(>*al8qnAYi zGmQln!3I~{uwipYE#0Nfcl5%Rg0auZJjmZd2x2jLsSqeN4l&N52dS%SZ4F**xboh{ zwt*`GYVP&pa@11hlrlmu>@`uZfEHxFYZn*wjgLQ@F|ARReWP$|%MnliommY{Y06~z zl`;88sG0}oRTr=T2tw@#>{njwDbF~3nh__pT~(U1#%K^q=r~d!bqE2}#!J7YjIA7@ zF&oU!nI_ZXFIF|G7wR;#ug%ky;{;&*)J|kh#S`=2sVckAZVHo~PFDIT0C3}z>mt*t`IE_tW$zl9`f6TjQBk9DZ^450_*>;@q zXSFaio8m2zibA{gTa_QS?pl4Rj2$$m&RJ9|N9oiR3v<-LfS^`|TIDAa4UPFoyWbZ% zBh>(v?BA^Jp6pPZPt*CG6j5SE6dg?yR-SBm{p3e=_beRsI)^63N?i=c@C{*xfjO4R zmf`;@@BB2eeZj`_X-2_K$Pu)vy_@nA#o{8(>xf`!vJV?}c`;Mz>2Tb|1=`AqdDgo) z_k%k8;!o2I!$n#PwRX4;05aFV?%uu4V;)=r;?xp(Tw}7Rs7QkIIfh06tEwxKYyZ+6 zjA{}u!3gk!R#s+Rp^x&i!s%f4!8)FTj7SHtJ|drxsHr~jr#^SLD%3#Fvp)|2^oh;K z$503?ZvXn@nyNS}QP{S*fJ3!`=BmlTQ@R>+!5xQ-kE}iXeZU7#7Gd?(&pAz`2m+Q^ z@nto6+W5G~tU|jQAwv|VDdN@#-+rUCuvraPIedsk?`oM-kLV8$KR-vn_ua zY#;AaC9oT7UrHN*BpBRzr1dfmksnSKCO!Cs9!e^xxg=HZtOGUrY&G@eaiydrBTRo` zS6wV^c8?=&2159C(`(lEty458!aC~MFUl;chvI0!LS+A_s zcD7+X_n=stdG5UXm*UCFCd!)!GVH;vOFKsLi~^kqWcTzc)AI`}xRbb|sA z(Qd=P6#>00WtzR-db06hh6zvP*VR{DJHzYiU1v`MLbp%3=eFP8H14GT^xSxw%5P&y z<#*_hr%$}jW7%k`v$~T>dOShvy8|r^%_NFTjAxq`$P}@B5=@$}Fg1O}efqb-?W!88 zAQ&VnjT(M%~-lHgnvx^1$2V`&N5%ZCDY%tvu;$RRlg^^$c=TLn+Qs_()tr~tu zfEH`Cxw`hq%~0I5d-yQuArm>yjEA17e@758>dGmr{#9;jl{)KKaap9L&y(Mxq6V? z!kirWv%HU2k9OKrG(aN1#MejL)A;X?3OO##*=+@gYVVfwPQR}VPOUN#^*;=UyIRC* z@7aBs{9f~BUSeBTE4=7-Q65*vY1COw!qtKRc3nVKUKD4w(|yygc3pqKy&2)j>R@i143 z0)wLzTLj)$T3wmcrJW8QZ!IrBc=reE+;&SmO#S8!Tbns68=DDo9tf|ITjgOL-mM$k z&ccWRQuI_e7Rn<6Xb9z6X2o$ZiK63tMu0y$;nV_f{E1;fpeQ*^fmJDA+f536aqDcp z(0Rz37PKF3Qu%svGBOFWed>Koh~z1t27rbKY;P}(D&-y&b{vfr8rTHC#XB%q2t^dd4HP@D+d_}{NhV@>+Xb?@&PhYZ-?=4>oB8;hr{L3e3Vr>`4 zvsu#BAkjO_a8jSyV^^y8F;qy3m?}le#LB*2%ZOtoN*segkHHk_H`VXPRk0yvG_^!X;7av7ud>Y0;bl%P$o40U6p0lJ3GjlS)=>3BpYCne+I8TN&TU<}~<_nxJO>&NhkauQqgJ z9guR)US|Bg*X&KEGFzA4waC(a?Xw{uA~W|OK*W-5_et(IMl}2t4T}+QtS4TC@)Qr- zzto}t-%Crq88l@GyoYHzgVu6vT=;_IqE^#{oX_z&ek8cUnsRsfX~!$Bf_wo@vC$eG+aO zXE=a>OAr#1yL81>v3XW(_4iH#YSEYhh^4${+;)6&`0+ile=N>LdR#X@INaL$YGM0u zC(WX(?TSdMii6?+1bt-_E<$ShOb@g;HY9tmt*-X#en`>}5e-B`;{If~K`NnW#89CM zckdaBwQhNg%NJ7vwY8SLR1qvOT#)kK@q>^mfNU@TA(&DVoh$se_mvM2qZnJHZ6$@y zQxg|;5i;9H;8%a%*CEf0ey*fsM<{yC>uilLWp;OfFJ&*7{*wtMNY`+YkU+OB%oRtZc25{bxbIUVFgu(9z$9$G+zIlH?1TTrdTopn(XWQ5z0a z#S9rxlVMD3wb(uhC!;CL|45>7OeCW?kz~E%`#x%mNSGxeoTipnxC8T@UsX ztz2X-{BQxMYLN@;{97ptG_lr0STyu~ymv|*j2I6i)}@1aiv<0r+&-G(MM+Goe*+0E2|>gOFM{5IA!gZc|tb4VY^y?0673OesyZ;E-h!0rid)kUjGetv>CG zZnE#19{HVBe96cZh*VIHGn+@Sr(P3cl$@Z+q0TTi%6`EETyuY(7Qyzicl2kuyzTif zFy&{c0sDdi!NQRBjz5N)4RSG3YyeIa->@Eri--7s?+2vo%{}&wQRi@VAs|%{3|n-4 ze`ng03Bd8~RH8kK+)s_|ea111x{fY>zWx+BGqYk74XlIW2y89rC0Le3ryz|Pdu;FAQUom#s zog9XjVYg%-gaKC4yN`F>QXZFI$ZLInLcpaZ-os<~^`Rj2)3p;E3j$h~zCRSp9co$n zOp|ekTn6bUG-Vebv$Jv`K)Ioxmh8L4Q?d(|dYvuL2l;2&7|gZ(%Ky*{LvIDFCbF4+ z=C(=}pO5ahIWC8r5fQ8yK#b}K=}b1Qzlxa%qwm9z zI-Jj0)_m)8v*zD0k0>qnL7J#v_Cl7i%zzp4IqjfO)_=6emZRX{2MgDOzkLnmPzUFW zJ`bF2SH`twsWYW*T^84~G7`*mD6{2t}g?B&mKx0?eVk6w4K z{~XEL-2?H4s9;n#64`w3=qve*aWBno^`!St&v?}UAU^wmC-{5BNyMd)R44&u)eHSK?nP-hnxqLE0*`tie(lV4A4^a`hhpxL+JB-#xPeLIW}Ij7 z^=w(JxR}yWE~Hpx#JFxKppm2u6cBJEpbqSzbo|Wl-D9m$)j%4YsF=FYL-8WCQkGn4 zZ~_LH8^wwRY>K!r_*2rma4o{{3EOXMdB}u-KlP12NSIVRkwksJ8gYJqTBcpHU&D(F zkP`9yA62U))G%Z~C1wfRNkaDh@l0t4*TLvZ4o zid`S@FY9v}UuTp5j`cN2SBBuX_0#onw$DTFXZm08CsGX(1}bVY+4%uueBTZ3pY}M{ z7jaXBYe$z=)WMR;L5@Ve?_jC^jBQ976o`Er~P!XO`3p;SFe)Rd&0!e;lUXxife!iT~^7_M2#6@~!NlGLz+t&|+X@sq39fa@@` zD1VZ390H-iJEH1Y!ivT58m(3P4J)-QQvlmJTz^Wk(+O`WvK%-^@j5DM`JJE5zX??t zR^@`W;CRAeN0M zuc54HC_rTCWL|I}(YwMwQK1pNzgE!oM+$V{%;0T~{J8Teb14ln2Fur56I(%7K1xsd zI?$8o8Z=jJ^=G}gWDi^9zWaSMJd;Tax^cWsBFLRimSZpFYMEJA+3z;5wVW9!PpU13 zxsMg;A6Z~P6eRNf+elgR0~omLoH4QBcX>3k!35h4AtkY&Dw;CsN2|VNS4VuBKu?4R zUwTGRx!sXj-c$WxPXFWcZJWcpyD4ghtUqAhxMl?FC+GKa(0BDM)=Z|X=hs)7Ny!Wc zPHu^yzc2NV3IhH$e2Iv>X)2`a1vNXDjQcqN#HEo`aHBODelsLzwaPv=r4d83 z6Z*cC3DckOaWc4oFEecOXBVO%m6yJtw1&gNI^I-X^ti)3bU;>3U^(5d=(lnATA%9* zJ7WVx%P38w5_cI9a*0O}D~38k#|47NfGh03b2kTefNaC)w6BK0vHBgor-30dh ztn(VJMB8!mMI&i|lR^uXtfmWr9R@DZq_+|kC&S^({$D`J;=0hDv>xXg<+rx5u@p%7 z#hDq^&^|Ii8gL*z?v7lF@1_8xAM}qblZ*M-!13iDTamRX=#|S&bWF??gDx0MlNr;f zro_|5tm*fMJrr#H%1e(P8K=3c1(S>tz9?5L_^?}{kcNP-F-K)RI85LSVDYKw> zz61pNSB^#icMFM2G&AoL?;%Kdc`F#r47ySEFll&NxR#|-2^=q7#n?Ei}bncH3BS77mO+$&oyYonJquS~mLoa3j zc}ZLm551 zk^7!J7f$&};6B!d-W`zbzL=r`vr2LHwgj^Cyd8ZV1c@8M7b|LqcW<($dXSy|Y5BK5 zk|IVOOX`oWP==+kKa{gUiK&pIY*`RfchZ~__I{HG=- z;EfW)Tiouo+d&*<(82#?F#3YPwT{mX$d4GIkSK@@4b;N>K2{#~i5l7Z?jE;5XtMw{ z$rlL{Wfx>0x}^h48UW|Zp(1ov9Ha;LOP{K!g(2IsgcBR$8@{1lTONl+LW znM*-LA@v6cKd%=ss70$O)LqHq@-21Vg09Ex|C4=KxA7SQZOR!WK$MrN4?F;U~IpZlx!gd4>Uz)62_ryM2p=ciTpNB0@`n9|0 zN)vPpJ8&=6>3(Z`St*8F5I|HStj8!<3gd8vct`NUpI%GW@(JtT;^8~*#4oOB-q;m- zwb$^S#O3|-j{lDWlv`Y>JAurdB=h%8$^AI(aE~kIeDN=(*cT-zxd!35A}uaY93piB zV+Y7dL@RBuL8h$8hWQs6T(6OS#d7Ott+u+7chR5)5;xtF9K*k?)yh^>y!>27DYreSifBCI_k)vga-}t?+ z=dL8*Q|PNFB%-`mtJ7Eq2W(QYEGeDOq7jpZ$`REv=P6!cur7rIV1t93=>9FBGG>1n zaTgW{QdxW{ASCHz>iH_1$(rZQ;F7Crr^L>74y0AZD#!H(iOK`do9VP1jbaSQ_(;ACoZPd%nQ+^B136a0`VB;dq7A5n9#n48imK}+7q52 z6L}r@3c*jZ&klA*3FF83!XKWomyMYSy|f9 z+@Ft!fG4qEC0@>uzv^4jj*O^5=sUp>}ey`kzH>*8hI zWq8U+s1zj!0$uF4xw8sk#HE+*E#D3&pUzXcoga(rrQr}{t66KX_#EpBV=)7e7-$F| z0J*D_$}zXy1p!e)UBYO#TuhRt;K~fr0X>J{VWm9S2i|hn>@0?Bs&;QxeJ*#-yUB+p z+SIV8oQ{Xz5q}|JcuNu%GqpyA7(Ea_Pq-L~q(N5U;5}iPgp4?CRvK&@Wjj`XN|tqw z8~=b|&GJ29NZ18--OMEC=k+f~?s}r^g7I}<6jGs>Y+l?eN^g6?iNe!p95}lM`PJ?N z<^$d?mECg>ih|FB@*wxC(0R$eqAYIIgjX)YIJN72FK5QHFH=fgu$#<@8(ojX$#J6y znIdWo4`B~NbNw4G4GMobb_Oa`6oGaeK@B*KeTO$A`X^h~dD47>vb`*-)!w*Fc@ zZ=v(YxvbUT3USu2lB=LDs3PI+Rc$^ke_-2c=v`AgIC%6T6SB#p#*wo3a!3mRQm!*j z%n8PtW15eK;(wbdvUXDINfXw|7_UCEFD~D6FWtyoxlmpmv(IROpl&M zSKLxAgK^U3Setsa#!(x|=)|WaBr+vEqugfmmDr`bj1(}^&SOrfZ^yebaV(OF%pRLQ zR^%kcoRf{>AxTp9V#i zG^_vWlfs;43f(F(w^WEKHXO=?v8<}LfqeX@7XQ;;s1JOge|mO9fY_ zo0MXyiAuyfVy!rDjAmK+BX`FU3DcjMjPbx|6{gK?FN zE)sQxSe%q)#1V8U@~x(KWF5K`9ygZX9w&e1!Uwj>Ztj=-Ts8P}wKLVIt}TgKz0rT9 z)QDoa9-~PAJW1hZfTcy}t9oC1Kwkn2l)oXN33nC#dObRq$JQKh$Taiq4U+$X6T#!Uc`3#9@JPyY~=SSXzygsnO&4br< zamRg2baF=$$`kfHdw1gup`gq{{HB1u9+D92iX&B%3*y@GL%CLFe6Cy3nKHuWZrx9x zU2+X85p{xRXc9%rD~22iQNEGJo{D0MfvH%0-3aP_9hAb`8{12F?kOffeaP3m8mk#J zIN@o7CQvPSy3!B441K1Y_WAy!rofDN%QEYse4Cbo-LWPHC|>X?p;5)N=z@`{1Mc7< z)78U{88Jr(^;MtyTM#0-GusR7>1cy6JD&6t>iky6RR~5pW_yse6v>a23e@|8BHGON zJZ@7t`n$#?{O+%ryTMN?V;|Z{xL zfdDy*4+@M5HW0aEsFaw&#mti8>Y7tCp3X47la)PrUf$#7X|>56@cH{Nn&IE&KYHy7Kv()!9;(0Sa{~VW(5T#F;ekWu@c{vQygxA4(s&6Z zYI-Q)c>6Q=8nt2&AqRz2~C>n1ySU)2O$E?6NnF)UcC2Ca>af$A)dvZ*= z)0W>Y35mz_mX50``q;c-svg!-Ux@`Eo#AKwf}aZ@vXW;t#>UY_5dDgKPzco2Q0(%H zLfJn9vdy=Q@hbH}Y*RRy2tmH#+j&k3zXhSBr{e_d%)jYDiLU!6%d$n@10PBk$(ic# z;c#v8@qp+0xG+1oIn?7Z%1A3-RD?fXhMb>=r0z2*^t&&3#gm?_%xA3!C&cXAaA)qR zird?2?QOZ+Uq;`CwOLn13eA^{347fBQt$r7t-j|xooax^fnP!A6}n{}N9~9Mub->z z0hUNuJ8J38VLIf_^=FogJ_9w6+!3V1X6^J@wjL2HEEST#MnUYw3=mTm@j%&g(tBym z;`2xA!adKuEQrz0w6pF{stSf%q~yu@3a7z2M@<2MC#A|j?C$>^dQr+*sd}Ksblek8 z2PZ|d@ieJ1(FNEqzC&^inJJF<>^?0wF&;h8v*Oi;8r}M<1};#5qrI_FOq;MEjF9s8 z@te;dRMO?WhMDGG$<`kXO-h(mPEOt~eqynPm+N|^ci9-js6U5bqD2s`@;_u@?#Zz;h8zNP6re zNlNZ0{ouQH`Zq72P|DUNLO0|{xS~=Pxg~M))xkgKIeQEX$fr=C9mJ@O@nAvchlA?~ z00QjHS%ryJ>tg-9B{~W3yDh64YMbk5S16!KcTADwQVC&>@fy<_K z6~yk4T|!wgtJ)K#89~yt9+M zcRF3%XuB!yW$~xp=~5X6ZoNC5eQ7YT=CdzA7YocE7f~hTp}xPQx1~9N5SIP^tS#&! zZjb7u+9rDFaJW__zH4b8SK(Lv!7U=d8KVCBk`XEa=*8uUB1GX&bu_e_=`ZF;J3Kr&{a8x-5&J(=5r(!v;O>iki`&yCBDOI_H@NpZ`mb7q}CeR%3)j zN4z530N|pZt~)vc1L;$LSMQP86>#Yd2BPy2F&5^<-|9Lel@Q|th-I$*_0F)}WB9=r zj^ssBc&C4W{u?naxxP+JQtNMj?FxJF*>PO{2@f3=pGOY6I4Ui4=LDB=& z)6wUyJ2ubf{(a*tsHT7I4($Kgv;&3imjV}WrkRE!qY4_TA2?IF;2fN8F)PPCYfy+Z zf1!8PW;)9oGXXK@{W4WB%M^(bN+Sbl-#)c}ZjBV)*(rbA(ZN!M*E73sBlcxzTA2k# zQj;YGT%9%hPW5C+zvZVqXM@(!q~fc)TC}`wMwJa(&*=mwHC@JktiQhSZ~3Ku(9qNr ztK2VSZ_>R$X@tAn_YZNSTRGQCURu1{{W~>Noc}sP(s*aI^7kW&+lK@yYkXKR4m(9#kOvh`L-|!I##0 z%aP8q=UT7P+Z!%wgCVnW%@6S*z<$;wH={7PAb03#r~*Q{tSZ=Lm}4ug~5t zxSu0m6(?R#M1t=t;B8v#wK}WFf70@S@0%X@I~%u7GaA+GJ9Eyq$urxL0y+bld#0uy zs`X$4l_o@dGzaOwEh>jLOmaSSOba#|pPM)K91)4nWW4P2>x1AfZ^XdgUU<~X zF?l+>l*_@BSOtW_(S?G?=3jf<_dh<}*beBV;OcIBW}UGvb@C7x#Vi)r@AXteEEW(> zQx<76h{=}9Dkmx4u4^)F8pC`z)XzO(Qw>>5a}CeGNz!u|kxy>oz2ir3@tvgSq5mx@4yX!DQH_O#aZ8q=Ts`b*7iI_B`NuJba zk3HD^`z)&abb8&i;;3eXvMfby%)ut8@_wqGgjLP_4kkY^15^?GnGW&GM zf=+*91oa#(N}7nk3D4W#_q`>|rl5##~S(}ydm;b8u9N;ia@B)O839A9{_YODM1 z>5Yl5lht9bur{Tze%of(>C;d!5S$tFag#DR{lQh+p4eDyCL1a5bN-ho z6i|k6w;+|oK6IdDY&i&B%OoQOB_m7L=U3p$KL%8s-v1RgEtqYhlAt+Tfi>AAE$#1=OS1v$4FMi7(Zv!_~LfswhZ(@wxWY8D5ut zeh!Q^Kp>XbKr+bd%ZyTTgkuqN?aBJb%&D{lTO%I&=v>p49|prg=`RhpgS3N%-g-;Q zPx^H}=2SW8c{;v0r=;0Bz)o{qUNywUx$=v(#RuR{)eM*QtyNYA#$L2gYhj^>=ntU$k z&*8S}OnaGpiw7v2nL4YS{Nu|&hZ`2&zLcsGFInv)9}Egw6#QpcBdk zgRZop&TE0AAV0((P}T(gVF`$fk_u-hFEO~W^0r@4zhir|%Z3MLFQgK8HV;cthH@xK zwaMs)ZrC4oJXh1XXr(d*mz;-h&0xu^8aI8^lo97RnM~5{e27hZH#NJA5`>I~d`&B9 zTjF{8%v$@slOOAnCl=6ixcKB#8ehg1*Vzgmt@8Qq6&MEJoZO z68&u|rh^jpO1;vFUJ5UyOQyi?9eNEhuyXOf_+OKE{=YNR2d{1z_5CL2Dh&QHE(*sm zA2qMUI&;6f*%dnagO)V)I#4V1pK-)^@Q0<})I6?`ogX)Gs+vjp)D%E(eQt0z zw0vSeVSnF-=*^fi;*Cya-@y5Vn1y!zshvzp`KI_|SQJM1aQ63$A-9!^+euo#{Mx}k z)0wVKz=|Xtzd4MRjbPh|c4z1#ux+)yL=55+lC&B7=mX**!XOIuI*z)Wy)RNGuqzz4 ze$8()mXG!LU)x}gMA-b5r70&E*y4V;mGyAz%5~Y7J$&j}!QVlOZuY!zdd8*l$O@UhQgb%ZIu?M7myI|H{cLv|>T?OflNG z#Q$RfTp=6XW#LBwAFRXr%iIi+$rI2&N!TMD_PM*YsC&#tVH7vxjoW(%i1N`XET5yE zFmAddN;E}ikmm*Uk281zg3@p19}DZ^Rx#}ljaxtWkQ0kTex`#By+R+y(Gu-uRm{uf z0nP;9cieL9md}m7{@s%#o|=eZzM@9@^xT$kx{ z-7}+NleTiYfktRe$vuxxY-v)et+kU76B^ABVet3C*4UTAg;knA+}|1kH%H`DlQ{`<`@u6p|QL$}2UWAiy;bCfmnGycnm(Zw#pgKE`1s=Ou=c=1mRtwQtO( zigw!+<}!?gI8o0RAQcng%^8<*!R^O=g|CHxSZOi~paB&N3{jt_#CwiW*`-I%E))mu{pPBqWvY?(WVZLGmwk2B;`fcH_-@1?iS|fNV z9G?i%n~Wg1cRBFnopN6AR?A=rh8ew~F_R2>4RSDWSR+@`cH>1+f-4t{O*jzQzt?D1!%_H_>a6&-{L^8@*lLa6TdBjqqwzQ1MXxNiQu@Bq zG1vVwR5MfwAf`b)QhWmjPY(sU80T|Ec0qxjBi_9a3<~H4?i{AS#Xuz#xa_@;QjlxS z)ft_jC6^EH?+*G%DFTXf{O<+enFF4SJVk5m)k&ASl^X~8Y-T;l>gi?WXz`)*x*ka7 zmAH)#$X_@bD~@bavArF-i}neT-iT-oyysd=zt3Q9i~A?;Gx|;tjxtBJjDWi;UdT?7 z=nVJLKa#hpFQJ5MKMh+wRTw=Gm*gJV!pf;?ejK-MvTXN#e6L3MyL;_DztDXzllO@9tqal9W=&_~#>gN-{?y}4gdmI!|nyW(|CQn|BH3xf3PqNpJcCo)1m%mRT) zOuLu0 zG|xAP&2o7r7*Q^f*bX_bp%5O?r>Sn2+>z>A03vKmDJOqrax4oo>%Zr1rfc zV6+vl7PIz&$Uf(&kAK8sJY|$YQk7cdpBR)Dw;~IdrRGXweAEtZeR2r^Ocy^Il|A*$ znwCX}P_IsDp63JpKlJs#y3vA(n>N7GyF{Ns)8JqvreENtitC=k8532=mUnAbvW z%gvd@WOQ0abMQ?nap5+u6;O29knq^6Zy3DYn$GE~bg@vot5`NbQbxiqfboa6n z3ud0s)JWECO&O2hKUpG?tgP$_jSpztBY**t975Ujq4VZP2F!xnV~aNkfF9%AP;&s6 zpDISHOuzm>b1!5pJO_y&w7)hlsJI11h;!+kpmaIeb4idMTFu_cDu4O_*EU zt?X-KNLJC~6!2iL49N`Hv!qXtsDsifDXv>7j~f#iT0++8lxNDo^JEj+TFKG+`kH#* z6gINuf>3DH1_Qm6=pQ;)EbRfOXFJt1?>ELkauu|Dt1S&w_bA~N7D2qW^v4&Rj`D3= zu1%NRpd<avN1)l+D|`;41*vSaUl$(ijcc8xEgF#k4wQw^g2z8|T8M~& z09jG*N8>cxj!!9D;zyXQyy3-+xodsSW2|Xwt1dAm-0g=R5nmROe@}N_O=m4sP&Fvl)pOH*L$6V^CaAY9b}Ik!Vu6;P(Jxd8@?agUNNu z;r16Go{`Kcpf90tAUh>+<-_lfuQb_`a**5q0KKf4?S2<5yxW)A1P;m3zz*9&j)pHYN z@mN36yh-YXcCMz^+2Sp38%6t{9R6+&vin$B&!!932B=2XRyCh1>_X&z)2zSP9TfPx zG+8nYeuT!G0F%JurO~m9;*J`*Hh-cFJ80p208NDi- zOQmRW$J`#lp(YcPuT|*dbGT|hB>H-5Q|kKgqOHfO6dzt>OZE|w@%+ytVHRf*0|H?} z_DX7uv+|sH_Ag=55dO!FgEkg{5e$3~q^C3Ixepgjpn}uCPXe_ssrU^)JOJrCn!eVn zKU~+}^@4=BZ|wyx5CGEWdk#6m5lMnvBLp49vOyefoejmZ_$ndRakT zfE)S{9>SL^kHx}w_vTOvnccq4ZO9Mw^^T|R{lk3_sR6=-Tl(WLe@Th-Cf!OruUxPR z*xklv5%IlixaEb-8+q{3;`ZLoj&7qy@7yyC`Z*yQFNUKBFB*;&IlkH&^>%pPte^x7 zB}8{7^coe9hwwU3%TJYk*eE3D@+|`G&e?o zj1dT*Imi3#oI7j9^`Cn63z~<1ie(@}ORonRsE8?-g$9V@Cgow%Ycl`-G5iiotAVn= z{S(6wxN^T0q7&n8@*;}pr@z~-?Wc{#{I9Ki9I}jUe$G8B#FKmYpq7#-|yu$4M zBLFl(#%TU`0ovtq_@JWhh<{viJFZ{jQ=k>*B8H!Tw20&1N|O0uWT*xhs3Bm00Ncjd z_DNe{Gl7yn#)gkNMo>qJl93i=VrxF}9r6CDSK}mx+MmV?^Wsfchr+XhMb%r=gNLb7 z24YoDSmj@JCR`N{RntPm^Y28JC=ukzR(|;;%`0Pv2%-6y^I;5``6$~I#;0yV8q!ry ze1J>?BA?=befZv#$B%sa55DW{fSfE~W{k8Vo|N#Y88F5}v$#p!z}bvVpV*h(>pFON5)3~_Dbjqvqa zJDn_vOB*j6#xX%(X;*NMYht5ONRAhiW{?b)EbfZ-qYCm|)nka2F=f!fU$#Zu2Rhi| z$I98Po*8Iy%}CusVP>>Fj1Y>6Vp9gIPzyW}e9VF9bQ3A9T>}BEZ}Qcgc?=x^7FC;( zkfBEY84&JDk@B=8f2Bp=Pn-63>QX~#?e-a4l!T!I$H?O+(Bsd~KQoI6eWvK9I*{*b zQdGxglS9tf%vAWDIa&JM(vNwE!J^X2gaO0KOyhnF85uWw`UXK@HeMQOil0iLfgRBI z4!~s;BjrNNH-EvgL+5|&aekq!Lim>q^H9B%m_lf-0gcGRbqel5%Bnz-LRM1v~qy% zVkIwUpsW8?HF*fB;P8PyvM=<}@(j+x6E9$#lcG2*iSa zrMAcn1--Xm2sAWeY?1~)1B||ShX_~xeD@0QiNHT27;v9d%GZiS;g=fIg0@w^&VD6F z5Cux%KmGNUja}&DZmcUcS4Hr+(imc4eb%FYAT^JM)|M$tPWmhy{4M0nbKz3dA10k9 zmA?(8PRiR>awe61@UF_IAi#nQas3yMlej;053E(79wx`_sV+fYUM#|3MGc7_?EHml z%FJVNltZCqc&(Sj+&2f{$iM9W+6Ph}6QXtS)frvQ?NkAV2u^trHBRUwOdg^L%kMrO zc~vrD^gRJ#| z*ta7)=yp$EW0z-#I+H^!TaU&cgOhWKjqgVelar~Y)5i$>%O^etd%!+dqtj6 z-gb9Zet$|~A0*ARk^P=4A_j|xKYGvsHuV=jK2vnTO4J3tpb;&^^%6~4DM4M+L7xLp z7rx3xW1bITtw31iR6;+|p=Y8V*KL3$D?+8L*xLG|?nnUid9i5V6LmJFb6e`WQ+xEv zn|qFuT2d-QLeLdIK@8l{A-i7EVk&a-1~_| z6Yfg+7zS5Boe=|seFUQ*?Q~qX3XtMpuT$^IhkT6AwBc-LC&FxFi12YCQ}oTHk|7PJ z2q^)7rJ#^JTo85cuDNa{WCl9>M(J|D$V-%-J6cB+c9!j1-?Ti=ZM|vA2e!Cd)t~I* z`VbCh43#87QwC7-9Ld;w28<__mk7ddJ~twP)#nEVu_N-I<0zkyWoQ$PV1Povv$X zHEEv{c)`}?*LbO4T9t|qQr#LlVojX#O=i&B3+tV#jZU|_2YDO|EBek6 zSK7COBZ}H%A6)H8H68e&Qw}+oV}(z9O1mfRHqBST{v=fo3-leUBbhn1eSf}Rnd)%Ws>Vpwad=r#1;|L!EMatiC0yh_l zLLC3ZFJScqi*MTqUcEhyPQ0N+Y~lL5TE)ub4dpt{Ul<1mf<))D0&mY=R#LK*aIk9h92RZO@JGdu)-Qba1Uh(K8uHw ztDt7fw(d?O?$%xnuRa^SKg->k61_K`$n2amIW)$;Y$HN6-|dH9JX)Wje2}YoP;nx; z3d_)jw$4e75KuxWfZYAj*SchzLXXlC_isiu16iPF*iJm|nACF7NM#gJY9T=4+2i6-|!p*ud>m%$PFQLE}nMuXQ^y z3;+d?Dr`x?x1Rh}1VZOqTVydL19137h0UZNdfKAV^a;OYZ zMD!?xtfOI$Iqu3cj7aXmbx;?{y#rR@x^Q zuIg=M<)r6^CjTQpT4<FaiOt9)2Av=i)^GkXc(E zWglj6A#4gfRHngD;Dz=m0`s!3=jx?)#hI$kg|`{7(}bYzV<=|}LH*DFo7_juR<<{LU zTbeB=??&(oEYfJ{sIl*pTNYD1WFQopqj&H*ehz4}h7;E7h`t)wRk15MHi(V#8Tk__ zK!Cx7!scs3$d$TGwr8!|#xa`seiZ=%eMU})@qP1;zrY1YP{>`zy3_+Y`0P9kpsu_!k$0{?Q8Z;*lOTJ;XJ&o>7^4X4j8u91RVb z75#p1ncRRv9p{mxH$!{9N49-||$&@$XYJsdW>S z)Ey_MHq8L93@Fe#RoBJXlJj)62q){O-)0T^7$QY(VOnt zBj>+)N0Ie0uBBBqD;p`=8x-hu_QKc7;+}TyL9-nlB}PFLdJ=aR#qP0(ov*{!RWxe` zmQ#Do(9&Qhl^^!@ii+?mg|lDoIbhvE1+hLfj|m6+&ntu)rK@hBx49?5eAdQ?T*egV z?<8Y(@vX?VmDNi1d4b;tLI+X5#b}5egX(iuRJpK(%5M*f@a&2$dlNlyLS#E|?pSr< zkr={5pZX1h_U-MqyM63s|8rkktrU(HA}uE|PF?yZXN#%WPdNl+r^H!lwMU>OcXjlk zQ(GxXnR7Y|OJypw-C19bLoB@DsN>asSh7Qh^@*0fN?ts;aMD?|e1tIX+#+>a24u zx%i&7K3VbZzqyvm15~R@ITmU9ez(cg^;x z?{bR_8Y1Ae48CmtP-S(?maqX%PikGNk%=K0PnDIj zI&nr^2U^AKDgnaN{7A?y-gM0uV!i73hZzeGH%az%HJ>Ga(@}Qb2C<}$I)jzjKPml~ zn@kp`<@yzVgnxZ$X(>RdB7m*IDwe!t0IXx|{mXEVF(X*C@x&)|Cjz$$f0=;za`fs%M ziZe9=o=DhoV2W^|8gL9<(IZ=|Y9tuuHkjS!y%rP9GORHYf-a}RIX<&92hf1|XIoI% zgUe&XJOD=aqRV38yu4in>s?VUw6Bd$N6#7R?^ng}daw0O&-q2XK4@))twLx&4_bCu zrWeZ183)(zcT~IECK4Yoom$tQgY#$@9@s$@01%Y4+FPRHwX$Fayu{R5I;Os6E&Y{) z87~C60$#N-9q31IHw+EyEZ#@CXTlUos1kdH2uN4Xyn4YE0s7wDlRbfEpuS@73@m7n zkiKfO?_RY>InR#>VF}KLQVM<65huLUVl!|^SMN6zyqE;7a&UVehnZgCxt-#lhcoPVDov$(jJ4(;Ps zt1ZqcmHGPlwr;iZhOSZ*wxg<5>-K8)xC3rgHyrd&O1W=G$CCMyYR>#!M!8qKy&f@` z3nF7!Ee<3}v9tE4*iYPhta;83rs>i@^l8d3zAO!G)_(FOPcrA6bsC#@lbI$Gs zo&6;1N*ByOHBH+QuyC9GMic#>e#? z$39L&Fgq=GWhA$qw$R)&G*v7CPcF`TzMERwbJf?rm?p!STE+qWhrS>Z8GokM1K@|_ zy(eZn`q`WLC_hwINd9Pv{#me5PBsjxl?N1MU@?qX{5t8?@3&~u!rfY)Tl~I^FKhaD z|Mv%d?Icwqt^UO9_Ws7+5Y;h_&Tk6B9iyts*20W=J|DjsiP>veK4~&~tb{t+EvIN} znWENk-X_?x5l-txn?8ofX3VTgYxBO?P0oFyFJX%I|Oi77YHFW$Ek0b&1@v;*ve3xSw;4Zk`_@ z)DnX@qecydkMCv|9AJ^K3JYsn;_>;gG7o3xva<11e9G6n$kkJ`a!&1A)MX>qPqe3| zMPHLx@3%u_V=#Pb8g06L>@q<)!pQNiUF;JCR7*I_kwx%0o0tXFemu0eI1caoe8V#m zB1I&@!eozfCf>T6E3{8@$sV85V({>7QJG!XU=Qr<0WV>N^qI_=Ap3dfF z`v*|`5#M%5lg7}W9sB7rLvN3xQ_t}WjtwBv4JYGESF9e^gPn*m9TM^3#^ab7Z_UYZ z*yzIt@cRB(KAhCA?fYI2I%WTHna!;qD*5QT$vIQ}(aQ3tU49Vud+cU6WqQEnce=;T z^7hf4cJhOuVpZe4GhO08-5Opvk+RtwXc>T|;rC-Y)0l;Q`TD*{WPYZ4h&7fb=53{k zDZbVDCj4DI%xR_pHzuaDDD zGoJ&=ep<0=1O`6p_zFY$S>N$5M}efv$J zD%1r3*+8|tRHfp-L87d{^AFb9*XP+}JQ`}em3&a{k)K=M;%%jAw$x}*qa`KK^CY}( zXZ*hbPu+>EP?3<;lKN1_+iDiS5M$2Koja_Px6W-k`H7go6Q|=4dtnXK1&1s#iW4>h z$Ll#SAdsw+RXm`t#vU#OP+^mwBBA>XpJ73-h@OE~NGTP6q*#|#bRW`Iy-D88hY=cc zRecBZoXTMMI@iX&PjG4FFbt2~UiFP8aS|n-nE%)87PBDC>r$;}*x+*Sc(a;AiWLIJ zB1X$lVG;<60Xp}kbuC3;lk6r78Tx=2=B+1u?OU<-Fb_(UzVlo0Wmv>x*ThkD-9iuPuhP z^pxbSMpz`Btl-)b_BXdPHy;;ufdBVFl5ek1b zjfH5tF>b6d6-p(ru@o5I8Vd9|Mx)E=Q;!7iQ0W_Wz+&YnA0Kj_K;}b2K^#KT0mnct%3UV=SGNOQ zyHpt-15>^^C}I|jE{psa(Ja%1JJ6U-)Za?yRX1X z!#qi&pQp&~yFV*j)}?L;Wk4_`Gp}DB1OT~@N*23LWU8}lE@fBsik%NKjfIwc%PGA~ z*gj?Mru*S@zu9vGV()uo3MkY<76yOFxDr2cwyJ}n@gn2Jq?V#yY)`hTD_k1h2DQy( z!Qm}R-D>#_ABe5nBsN7)rs3;()q{%gQ629bU>E!o2id@mPUI4D!b4FSjel4iAb8vZ zwk4x%4v@4UqcuOT%`Nx$N=VB3Nxet{WWv5uyY|OKfQw9{=_J1I2N%Jcvdt0AZR@4V zOe{hh_jqVo`ozN(wlD+F|X{(oIhzQKKL~` zdTRd4={S))4Bwr>u0Q~BsPwKQ&oEPn8Zk_$D4s)36ZwmfAgUkoZD-CyflOIQeSGaJ zXe9AKoPSm)neEU3v^3SQeWuUk+!DOk-cMvy&>e=|=665k%|*KY(K3BAVRyf6XjhZE zhWW3hdEiew%qPmOo%-ZS;&JQa=yuVBkduqW0gk@;LmXT?h^+ZX#xsVf>SXEXKcB6+ znt_VH>X!lCxNU!b%~T8Cv`cZ{pT2*~B$cIJ69JO*MUh;jTt$hfqrt$x4*_>?jNdI^ z-7aU(+@Igp1>N<(v`95lN~-qdmoQ~-G;Lv_Z-f)xSVDL2TO0a;ZBvw;XI?C4Veq2CAB6_o zZB;E7I!TIHfvt|DBdpjfgB}1EjBhnwp{YIX!%aBn%aXJD1}-jyVtP* z8993sd<|yBZCxA!>H2TE#o~HpgjOf(| zoT8U>g~NasrIlgz`hsBdP*^-Dz|qn1V9uHT$Zg?ZZ*M7S@;l8O2UVCxxVXeRI~rhp zYJywKlL;Xy)iKg7K$A94j|Wy8{#9~ZSlcge=(=^p8gYRc1Y*0Qp*dn?Ie1(V8Z>$u zXw5PJ54B8)F+4q|9tt}-YW&n8-l$F}Sa7&`E7XCSgP~Wjnj*`=`yFWfH&uJ0&!3&KB_}G7ywYl&%+ai zKY8#=tJ@@x=i*feDvW>2x}zE^@;O%NbC+rJ8`|(T@;sQodoo1`Te0Q7+JiOY%xvf<;gbiRx(UWYg~6(pf%Dr$RKcEXD7CZdsfE_V&s6&Ias_A z{N90k(bME1k5`ewacTI@oVU8VC3u0qu#VHmj(hs~Ahv!)ZXSA;i*=~;paF3wTf+j1 zOj~RI3XYK!0vb>714DM{BYt=Yq$}@vGB)Vw$zVz0t3iHCqNXsdO4$ zY8n{7F6oqTZl()IFj~wE8whB~S%-XFv4+{+_~M&KO>WqEQfZ%4bx^wpx$1P_9i+m3>HrYu7s<-jh*jPEu z&wEN=b-u@0aOu|cJ|=f*j{y7F)1a%WtX~Yc0f!rAPk*+f1r3`2+g$YAV@t%b`t!@I zbDhy$^tJob1?G`Tx#zJ4wi2G@B*e%XaJT~g&dydrifYORKTG)se5Mh z9OoV<(b>e@JpH}_h`5qPiI+$H9XOd0iir?c09B^~AcQ19%oCD8O+VI_H}q~&ws9nJ zm&s&t;}0}*&qg^9d2*>k1o;*Zj%k1TUBf4lUBq7SAE9A1eets-tAd^(^h&oV!1yJJ<5J3QX(8^!E z-ebsbP(h4x=kK_ln_Zdth=c@uL*>5qr!?Hz-xmO26Xb0=?*&B^YIn{%NcxJk!y#gj z$8UNycU{W`FD~tW1mz>--lH`8|6|1ruKs?C=y8A{*|1S$Tn@ItLk4suEhan#8zlNu zRf7e&g}Vo(x({!ZM}bW;AHtCdkiuYqGZixxzz!U?G;U2M^d|IvA+AL3zEM8%mt?-% zgQ{dK;-i}e(xkq)y!!MUXC;-N8bH9jja3zaC*r>$)g8%2sof0;U>jAS2KZ`T+41P% zb7Y(?7~S-p0Jain$H@uCQ>)c&Z5uW^_UY89812FKfS?&nk?%_@B z4g>&x-J=j}CA7AN3#b6)0%S4(Ol}H+7Dziz!vP4{8*l-3-H+U}D>(Q19Q~xnp7A=O zxc-q~Fae;&X)F0ED3$G?4*XyEt3ii}vYL@HrB~e-behy{;E=Cc%}QRimtU$#>!N6( z4Ca6SlMWvnH>?xWX8LQ#2kP>ec2iVS!p)Fh+nu{JGrvk_uW+13;xB zff!Rfpd|+kw49gL*S1#56HdtIly!G;(C9VoOO-6UJ&?UCrAwpGe%V3O^t43a^8|p( zudDd&i~S7d^X!dL0w5=jL<)oCL0UY#e572e#7)QV@s6Fo0)au-Gv#kV;BCR$2XeLK zmqk3$4;Fz@=*o~g4km-LMy69%O&Y|PlE93DsBof99?GPRv=FHWX( z12v}Ro<*e;?aXF6z`^QK(s&62xR!0kQ}e{`)3Sg@F6S#FePAEW5qm@2>Aoa zViKxiEBjKCA7Ys;&n#E#~sU%Jx6du!UP^%4G5zFlV*iUx%0`g4s!<2hy4flZO?x!dV? zNSyommo|U-rkVVek^B+i0^mzJ!r50^{_ + @@ -367,6 +368,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index e14b692c16..b3b2ea21a9 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -331,6 +331,9 @@ {5bde63be-bdba-4155-a3a9-72f06c169768} + + {45e9becf-58e5-424e-903d-9bc7f9999d5b} + @@ -852,6 +855,9 @@ Classes\BugsTest + + Classes\Sprite3DTest + @@ -1571,5 +1577,8 @@ Classes\BugsTest + + Classes\Sprite3DTest + \ No newline at end of file diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj index cf217ba41c..203e3e5187 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-tests/cpp-tests.csproj @@ -90,10 +90,16 @@ 4 - - + + App.xaml.cs + + + EditBox.xaml.cs + + + MainPage.xaml.cs + - True @@ -147,15 +153,18 @@ - + + App.xaml MSBuild:Compile Designer - + + EditBox.xaml MSBuild:Compile Designer - + + MainPage.xaml MSBuild:Compile Designer diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj index fede0815b3..0108b08538 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj @@ -228,6 +228,7 @@ + @@ -426,6 +427,7 @@ + diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters index f05f94d939..556e8a3efc 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters @@ -328,6 +328,9 @@ {085acc82-08d1-46c1-affe-74af030ce284} + + {8c7572e8-5643-4301-b902-ff71f0cfca2d} + @@ -852,6 +855,9 @@ Classes\BugsTest + + Classes\Sprite3DTest + @@ -1575,6 +1581,9 @@ Classes\BugsTest + + Classes\Sprite3DTest + diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index f787d63eb3..26acb84b6f 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -119,7 +119,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS Component::[serialize], Console::[addCommand], ParallaxNode::[getParallaxArray], - TileMapAtlas::[getTGAInfo] + TileMapAtlas::[getTGAInfo], + Sprite3D::[getMesh] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], ProgressTimer::[setReverseProgress=setReverseDirection], From cb67b0533ce137d19b7e03903db87874e39732ff Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Sun, 18 May 2014 21:51:37 +0000 Subject: [PATCH 13/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 002ca9504d..cedeff2182 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -184,16 +184,16 @@ "cocos/2d/cocos2d_wp8.vcxproj", "cocos/2d/cocos2d_wp8.vcxproj.filters", "cocos/2d/cocos2d_wp8_headers.props", - "cocos/2d/cocos2dx.props", - "cocos/3d/CMakeLists.txt", - "cocos/3d/CCSprite3DDataCache.h", - "cocos/3d/CCSprite3DDataCache.cpp", - "cocos/3d/CCSprite3D.h", - "cocos/3d/CCSprite3D.cpp", + "cocos/2d/cocos2dx.props", + "cocos/3d/CCMesh.cpp", + "cocos/3d/CCMesh.h", + "cocos/3d/CCObjLoader.cpp", "cocos/3d/CCObjLoader.h", - "cocos/3d/CCObjLoader.cpp", - "cocos/3d/CCMesh.h", - "cocos/3d/CCMesh.cpp", + "cocos/3d/CCSprite3D.cpp", + "cocos/3d/CCSprite3D.h", + "cocos/3d/CCSprite3DDataCache.cpp", + "cocos/3d/CCSprite3DDataCache.h", + "cocos/3d/CMakeLists.txt", "cocos/Android.mk", "cocos/CMakeLists.txt", "cocos/audio/CMakeLists.txt", @@ -851,8 +851,6 @@ "cocos/platform/wp8/shaders/precompiledshaders.h", "cocos/renderer/CCBatchCommand.cpp", "cocos/renderer/CCBatchCommand.h", - "cocos/renderer/CCMeshCommand.h", - "cocos/renderer/CCMeshCommand.cpp", "cocos/renderer/CCCustomCommand.cpp", "cocos/renderer/CCCustomCommand.h", "cocos/renderer/CCGLProgram.cpp", @@ -865,6 +863,8 @@ "cocos/renderer/CCGLProgramStateCache.h", "cocos/renderer/CCGroupCommand.cpp", "cocos/renderer/CCGroupCommand.h", + "cocos/renderer/CCMeshCommand.cpp", + "cocos/renderer/CCMeshCommand.h", "cocos/renderer/CCQuadCommand.cpp", "cocos/renderer/CCQuadCommand.h", "cocos/renderer/CCRenderCommand.cpp", From 2ab70ca39b38dedfa1ea131d7299f18aa7c96038 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Sun, 18 May 2014 15:12:48 -0700 Subject: [PATCH 14/90] Point is no longer deprecated As discussed on the forums: - Point must not be deprecated (not it must not be used internally) - Point2, Point3, must not be used. Use Vec2, Vec3 instead --- cocos/deprecated/CCDeprecated.h | 1 - cocos/math/Vec2.h | 2 +- cocos/math/Vec3.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cocos/deprecated/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h index e8b154e6b5..685a47fc4b 100644 --- a/cocos/deprecated/CCDeprecated.h +++ b/cocos/deprecated/CCDeprecated.h @@ -771,7 +771,6 @@ CC_DEPRECATED_ATTRIBUTE typedef GLView CCEGLView; CC_DEPRECATED_ATTRIBUTE typedef Component CCComponent; CC_DEPRECATED_ATTRIBUTE typedef AffineTransform CCAffineTransform; CC_DEPRECATED_ATTRIBUTE typedef Vec2 CCPoint; -CC_DEPRECATED_ATTRIBUTE typedef Vec2 Point; CC_DEPRECATED_ATTRIBUTE typedef Size CCSize; CC_DEPRECATED_ATTRIBUTE typedef Rect CCRect; CC_DEPRECATED_ATTRIBUTE typedef Color3B ccColor3B; diff --git a/cocos/math/Vec2.h b/cocos/math/Vec2.h index 059d646c88..85a93e5815 100644 --- a/cocos/math/Vec2.h +++ b/cocos/math/Vec2.h @@ -743,7 +743,7 @@ public: */ inline const Vec2 operator*(float x, const Vec2& v); -typedef Vec2 Point2; +typedef Vec2 Point; NS_CC_MATH_END diff --git a/cocos/math/Vec3.h b/cocos/math/Vec3.h index 5521ab1505..165af010f3 100644 --- a/cocos/math/Vec3.h +++ b/cocos/math/Vec3.h @@ -467,7 +467,7 @@ public: */ inline const Vec3 operator*(float x, const Vec3& v); -typedef Vec3 Point3; +//typedef Vec3 Point3; NS_CC_MATH_END From a7485bb4e9186058099cc3a4ff105e225bb2e50f Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Sun, 18 May 2014 22:18:07 +0000 Subject: [PATCH 15/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Sprite3D.lua | 36 +++ .../auto/api/lua_cocos2dx_auto_api.lua | 5 + .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 218 ++++++++++++++++++ .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 5 + 4 files changed, 264 insertions(+) create mode 100644 cocos/scripting/lua-bindings/auto/api/Sprite3D.lua diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua new file mode 100644 index 0000000000..264531e866 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua @@ -0,0 +1,36 @@ + +-------------------------------- +-- @module Sprite3D +-- @extend Node,BlendProtocol + +-------------------------------- +-- overload function: setTexture(cc.Texture2D) +-- +-- overload function: setTexture(string) +-- +-- @function [parent=#Sprite3D] setTexture +-- @param self +-- @param #string str + +-------------------------------- +-- @function [parent=#Sprite3D] getBlendFunc +-- @param self +-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc) + +-------------------------------- +-- @function [parent=#Sprite3D] setBlendFunc +-- @param self +-- @param #cc.BlendFunc blendfunc + +-------------------------------- +-- overload function: create(string, string) +-- +-- overload function: create(string) +-- +-- @function [parent=#Sprite3D] create +-- @param self +-- @param #string str +-- @param #string str +-- @return Sprite3D#Sprite3D ret (retunr value: cc.Sprite3D) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 19f899b61e..4a2120d628 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -1201,6 +1201,11 @@ -- @field [parent=#cc] Component#Component Component preloaded module +-------------------------------------------------------- +-- the cc Sprite3D +-- @field [parent=#cc] Sprite3D#Sprite3D Sprite3D preloaded module + + -------------------------------------------------------- -- the cc SimpleAudioEngine -- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index c3ea830b28..e1486c569e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -63487,6 +63487,223 @@ int lua_register_cocos2dx_Component(lua_State* tolua_S) return 1; } +int lua_cocos2dx_Sprite3D_setTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite3D* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite3D_setTexture'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 1) { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0); + + if (!ok) { break; } + cobj->setTexture(arg0); + return 0; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cobj->setTexture(arg0); + return 0; + } + }while(0); + ok = true; + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setTexture",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite3D_setTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite3D_getBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite3D* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite3D_getBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBlendFunc",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite3D_getBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite3D_setBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite3D* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite3D_setBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::BlendFunc arg0; + + #pragma warning NO CONVERSION TO NATIVE FOR BlendFunc; + if(!ok) + return 0; + cobj->setBlendFunc(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setBlendFunc",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite3D_setBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Sprite3D_create(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.Sprite3D",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); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1); + if (!ok) { break; } + cocos2d::Sprite3D* ret = cocos2d::Sprite3D::create(arg0, arg1); + object_to_luaval(tolua_S, "cc.Sprite3D",(cocos2d::Sprite3D*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 1) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + cocos2d::Sprite3D* ret = cocos2d::Sprite3D::create(arg0); + object_to_luaval(tolua_S, "cc.Sprite3D",(cocos2d::Sprite3D*)ret); + return 1; + } + } while (0); + ok = true; + CCLOG("%s has wrong number of arguments: %d, was expecting %d", "create",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite3D_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_Sprite3D_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Sprite3D)"); + return 0; +} + +int lua_register_cocos2dx_Sprite3D(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Sprite3D"); + tolua_cclass(tolua_S,"Sprite3D","cc.Sprite3D","cc.Node",nullptr); + + tolua_beginmodule(tolua_S,"Sprite3D"); + tolua_function(tolua_S,"setTexture",lua_cocos2dx_Sprite3D_setTexture); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Sprite3D_getBlendFunc); + tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Sprite3D_setBlendFunc); + tolua_function(tolua_S,"create", lua_cocos2dx_Sprite3D_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::Sprite3D).name(); + g_luaType[typeName] = "cc.Sprite3D"; + g_typeCast["Sprite3D"] = "cc.Sprite3D"; + return 1; +} + int lua_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S) { int argc = 0; @@ -65291,6 +65508,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_NodeGrid(tolua_S); lua_register_cocos2dx_TMXLayerInfo(tolua_S); lua_register_cocos2dx_EaseSineIn(tolua_S); + lua_register_cocos2dx_Sprite3D(tolua_S); lua_register_cocos2dx_EventListenerMouse(tolua_S); lua_register_cocos2dx_TiledGrid3D(tolua_S); lua_register_cocos2dx_ParticleGalaxy(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 682e55e5be..62a4c37607 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1558,6 +1558,11 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + + From 794ba8349533a8b9eec655c55201688866182770 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Sun, 18 May 2014 22:25:49 +0000 Subject: [PATCH 16/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index cedeff2182..da6b76ab1c 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3762,6 +3762,7 @@ "cocos/scripting/lua-bindings/auto/api/SplitCols.lua", "cocos/scripting/lua-bindings/auto/api/SplitRows.lua", "cocos/scripting/lua-bindings/auto/api/Sprite.lua", + "cocos/scripting/lua-bindings/auto/api/Sprite3D.lua", "cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua", "cocos/scripting/lua-bindings/auto/api/SpriteDisplayData.lua", "cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua", From 94228df977bead60b1e398fee8b854bce56aa226 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Sun, 18 May 2014 18:04:12 -0700 Subject: [PATCH 17/90] fix cpp_template --- templates/cpp-template-default/proj.android/build_native.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cpp-template-default/proj.android/build_native.py b/templates/cpp-template-default/proj.android/build_native.py index d8d303498e..15fc6912c3 100755 --- a/templates/cpp-template-default/proj.android/build_native.py +++ b/templates/cpp-template-default/proj.android/build_native.py @@ -89,7 +89,7 @@ def do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,and raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") elif android_platform is not None: sdk_tool_path = os.path.join(sdk_root, "tools/android") - cocoslib_path = os.path.join(cocos_root, "cocos/2d/platform/android/java") + cocoslib_path = os.path.join(cocos_root, "cocos/platform/android/java") command = '%s update lib-project -t %s -p %s' % (sdk_tool_path,android_platform,cocoslib_path) if os.system(command) != 0: raise Exception("update cocos lib-project [ " + cocoslib_path + " ] fails!") From b69efe00a7c3315e7849d55537ea600bfa01d772 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Sun, 18 May 2014 18:34:53 -0700 Subject: [PATCH 18/90] fix cpp template linux --- templates/cpp-template-default/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt index 9246c8519e..5a4dae3841 100644 --- a/templates/cpp-template-default/CMakeLists.txt +++ b/templates/cpp-template-default/CMakeLists.txt @@ -52,9 +52,9 @@ include_directories( ${COCOS2D_ROOT} ${COCOS2D_ROOT}/cocos ${COCOS2D_ROOT}/cocos/audio/include - ${COCOS2D_ROOT}/cocos/2d/platform - ${COCOS2D_ROOT}/cocos/2d/platform/desktop - ${COCOS2D_ROOT}/cocos/2d/platform/linux + ${COCOS2D_ROOT}/cocos/platform + ${COCOS2D_ROOT}/cocos/platform/desktop + ${COCOS2D_ROOT}/cocos/platform/linux ${COCOS2D_ROOT}/cocos/editor-support ${COCOS2D_ROOT}/extensions ${COCOS2D_ROOT}/external From 6dc7f5a2b5480b2c83eff767cbdc3b482da34891 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 19 May 2014 10:38:59 +0800 Subject: [PATCH 19/90] fix compile error for lua template --- templates/lua-template-default/frameworks/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/lua-template-default/frameworks/CMakeLists.txt b/templates/lua-template-default/frameworks/CMakeLists.txt index 1fa676bb57..cb1df16d4c 100644 --- a/templates/lua-template-default/frameworks/CMakeLists.txt +++ b/templates/lua-template-default/frameworks/CMakeLists.txt @@ -58,9 +58,9 @@ include_directories( ${COCOS2D_ROOT} ${COCOS2D_ROOT}/cocos ${COCOS2D_ROOT}/cocos/audio/include - ${COCOS2D_ROOT}/cocos/2d/platform - ${COCOS2D_ROOT}/cocos/2d/platform/desktop - ${COCOS2D_ROOT}/cocos/2d/platform/linux + ${COCOS2D_ROOT}/cocos/platform + ${COCOS2D_ROOT}/cocos/platform/desktop + ${COCOS2D_ROOT}/cocos/platform/linux ${COCOS2D_ROOT}/cocos/editor-support ${COCOS2D_ROOT}/extensions ${COCOS2D_ROOT}/external From a58ec22b7551ae9d5303efae2c59894ed40a1503 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 19 May 2014 11:15:29 +0800 Subject: [PATCH 20/90] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 7036ad40b0..b477f8913e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -843,6 +843,7 @@ Developers: zifter Fixed a bug that the effect of particle loaded from CocosBuilder is incorrectly Fix twice calling onExit + Fixed bug with cascade opacity and color for control button twhittock Fixed a bug that Application::run returns wrong value on Mac platform From 9f9b0bc4268329979cfa90f5360b97bd74ba7137 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Mon, 19 May 2014 03:16:40 +0000 Subject: [PATCH 21/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/ControlButton.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlButton.lua b/cocos/scripting/lua-bindings/auto/api/ControlButton.lua index a8ac2f0373..df6d07b9ee 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlButton.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlButton.lua @@ -250,11 +250,6 @@ -- @param self -- @param #color3b_table color3b --------------------------------- --- @function [parent=#ControlButton] getColor --- @param self --- @return color3b_table#color3b_table ret (return value: color3b_table) - -------------------------------- -- @function [parent=#ControlButton] onTouchCancelled -- @param self @@ -267,9 +262,14 @@ -- @param #unsigned char char -------------------------------- --- @function [parent=#ControlButton] getOpacity +-- @function [parent=#ControlButton] updateDisplayedOpacity -- @param self --- @return unsigned char#unsigned char ret (return value: unsigned char) +-- @param #unsigned char char + +-------------------------------- +-- @function [parent=#ControlButton] updateDisplayedColor +-- @param self +-- @param #color3b_table color3b -------------------------------- -- @function [parent=#ControlButton] onTouchBegan From da30c644980bb7d304c62bda50e5666794013347 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 19 May 2014 11:18:00 +0800 Subject: [PATCH 22/90] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 520a87224a..cf794a5e85 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ cocos2d-x-3.1-rc0 May.18 2014 [NEW] Sprite3D: a node that renders 3d models [NEW] EditBox: support secure input on Mac + [FIX] ControlButton: cascade opacity and color error [FIX] Director: twice calling of onExit [FIX] Math: Vector2->Vec2, Vector3->Vec3, Vector4->Vec4, Matrix->Mat4 [FIX] GLProgram: uniform CC_Texture0 is pre-defined by cocos2d. MUST NOT be defined in shaders From 11dcf1e1dd8dc6379392b7161aad8d954f434483 Mon Sep 17 00:00:00 2001 From: hyq Date: Mon, 19 May 2014 11:38:45 +0800 Subject: [PATCH 23/90] fix UIText's fontSize if set fontsize before setting font family, fontsize was wrong --- cocos/ui/UIText.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 1103b6ab6b..88b0aafa36 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -147,6 +147,7 @@ void Text::setFontName(const std::string& name) { TTFConfig config = _labelRenderer->getTTFConfig(); config.fontFilePath = name; + config.fontSize = _fontSize; _labelRenderer->setTTFConfig(config); _type = Type::TTF; } From 99f17ec88d306f7e9e94640bdcd6318b46468f0a Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 11:46:32 +0800 Subject: [PATCH 24/90] commnet out the Renderer test in PerformanceTest --- tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp index 914bd46a87..745be44c23 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp @@ -31,7 +31,7 @@ struct { { "Texture Perf Test",[](Ref*sender){runTextureTest();} }, { "Touches Perf Test",[](Ref*sender){runTouchesTest();} }, { "Label Perf Test",[](Ref*sender){runLabelTest();} }, - { "Renderer Perf Test",[](Ref*sender){runRendererTest();} }, + //{ "Renderer Perf Test",[](Ref*sender){runRendererTest();} }, { "Container Perf Test", [](Ref* sender ) { runContainerPerformanceTest(); } }, { "EventDispatcher Perf Test", [](Ref* sender ) { runEventDispatcherPerformanceTest(); } }, { "Scenario Perf Test", [](Ref* sender ) { runScenarioTest(); } }, From b89a073b90af09d0183e000b26bd53012373e5ce Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 12:09:55 +0800 Subject: [PATCH 25/90] replace texture resources --- .../Classes/Texture2dTest/Texture2dTest.cpp | 18 +++++++++--------- .../Resources/Images/test_image_a8.pvr | Bin 16436 -> 45 bytes 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index d7a0e0eef4..a3c4c749b9 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -1951,34 +1951,34 @@ void TextureMemoryAlloc::updateImage(cocos2d::Ref *sender) switch (tag) { case 0: - file = "Images/test_1021x1024.png"; + file = "Images/background.png"; break; #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) // android can not pack .gz file into apk file case 1: - file = "Images/test_1021x1024_rgba8888.pvr"; + file = "Images/fire_rgba8888.pvr"; break; case 2: - file = "Images/test_1021x1024_rgb888.pvr"; + file = "Images/grossini_prv_rgba8888.pvr"; break; case 3: - file = "Images/test_1021x1024_rgba4444.pvr"; + file = "Images/grossini_prv_rgba4444.pvr"; break; case 4: - file = "Images/test_1021x1024_a8.pvr"; + file = "Images/test_image_a8.pvr"; break; #else case 1: - file = "Images/test_1021x1024_rgba8888.pvr.gz"; + file = "Images/test_image_rgba4444.pvr.gz"; break; case 2: - file = "Images/test_1021x1024_rgb888.pvr.gz"; + file = "Images/test_image_rgba4444.pvr.gz"; break; case 3: - file = "Images/test_1021x1024_rgba4444.pvr.gz"; + file = "Images/test_image_rgba4444.pvr.gz"; break; case 4: - file = "Images/test_1021x1024_a8.pvr.gz"; + file = "Images/test_image_rgba4444.pvr.gz"; break; #endif } diff --git a/tests/cpp-tests/Resources/Images/test_image_a8.pvr b/tests/cpp-tests/Resources/Images/test_image_a8.pvr index c22a440b142bb89a1acfdecf303c2ed6b14b977d..bcd6f26855c535cf7f843d100b05774b6af62127 100755 GIT binary patch literal 45 vcmb2|=3roMtPEygetVFSmw|!d(1P#&xqRjefJ_KzFlU~1Pgb2lgMk462TBTB literal 16436 zcmeI(X;9N=0>^Rp-Oj$-neL0WyKS9a*G}8rmbI1B#?v<1hl($W?$^v|IG7l`OjpYd0u>9B*KiFb5x{^*MqpP9OSZFCZGc|al zyrkLbH96B8d}`Jy8imkFAeh!iW+IznnF=BDy1^ESSZpmBcFoRvBjH5K>s96yKWef0 ztlo_^IyLhcnTSVV$+iurKd{Lb=wSRY57@%*b~tSd-i0N%P%6{QHKeRZ1yA)xiFqSV zq<(dzyQ`&%M0Y&1I-G0tUTzK3JqotquoyI~Cb^#UHI!AC(I|~?-7c(EvdN;=XdmIm z=M-}D9gfJJwArT8Ls~sd8lD4NczomIZeHS9B5l%+N)1}_Uvmqd4#@^o$uyQ&nCBX% z-)9P}YonuqE!&{(DQkQJY%$^)8?_I_Q|p^%#gNcwAiQ?t=Y~OrP`;W%B6BXA%%nUn zcQ|EoPCc`#3}txF2-w2uou2WC!|9D}x87mYnP_jHy;;no_7TQ61$}v^nF3fQm8MOZ zeRG?Bw+By_>%bOU+uPfl^V6Z_7s-`G=-Kuf_sE{TC*FSL)lA#UimUJ;5_XzRC8#x) zVXwy%2oBSkV2fX#Z*8xqQt9=rNHD})*i65$X!Y~h+xRLnOGwumRzQt|b< zm1HtF85T{2RyRgTLV{FpCiSXhGj7&^yg{jy)iiuBw!0Tsi^ezX7D!ytz(Opt6pnx`+-|deVOhrJ=%^gxr$ct{x~Btn zzLX-fSU6NJ6W5QfBvaw9FzCap^T9|s9GC@LXpI_ma9O}%38<9r146YuHQv>Bwuq(i zIC&fv71M((A@mjhfxy&-CnlzS<31nQf|1}q607BsJH}{Re~Q7p?gfWgp5qQ-M~{Dcvz}q>~ReYR^0;2 zXl3&YkldkZaX%Am@k7qtpDM6jSec}UM(Lxdtx0Y>{KDO4GzNq09-M1!Lcs2nRP4T4 zRdeo2ag!8PPzAQw_kPCS-``SBF9j$n1;QVQ#76u2Z&i~eohUj*?c&Sb-bV#RCyr)c z%E;Jv;D;X%p8{LJo7)=>e8;gn=leyhe2d*5^>IX{tqe7Nz&teR9YgOPR+Aeoy!g)^I>^we=AlbG_csRQFl8Ine_zGcD1q{ z!Ns+;gDvh|zgxclU`a>6o*)oh#F7~E0t~ID;8FRtJ5L(hey(j5DGEwz&Z2tpHw((E zSi@Qe*y8%76X)N5H|xxW>kV{K^~uY5;ua)LMnIsmKmJ?BKlWzbZxkH)aQ~MQvqM!} zU039fEP^eH3vcEhyVOslz_BdV6h*}MkkNfSHff02a{gxC;rwP=f`++$5RPY<+j~0C z60Byh#pBZ3_dd%a^!L@^$aFWA$x#zKT8Ol65u2BL_vXR8dYrSi{=vQ~L=V5Qv;8zi zV+LCg$w<`gV`cT#_mFJ})__>0?1k0+SW!!2&@;16?*1aXkX(>|{oO~EFhU=Na;2Ha z2V0BMeuI58d7$G$rI&7HUR{P`Uu29KPMMCB8! zYha5`EQ@U#t0^x%L!*g4ZBW?PwM-TR)kQEe;aGAT8r#jkcKL%nFhpMt*JNo|1s1>- z%}xDu(iLV!G~%sSU)%HE{^Ok(9I-CH`4N6@VaXJUuDBKxTe`8eG}uCjBVuk; z&MdEnY{A$sk=1A0hA)o(<>ZYA8JX41UFarw=6*Pq+tN!FVHKk@0(CG1w&0QJ#P4oT zzWfbfT?lT?&n%@pxAHR1l|0El`EzMqMS1m!k1IR)9bF_LM(%JiWYYn#1rv>HId;hv zjz))U&c&IzaN3=7ZSSGNit~pa6_*qua90l3!ts6RKJsIVau`YX2f-F7I0@ zH$D?uiKaK6n-3lQ;~V?;zqjvNei=8mHiWY2Y<`<_icKa;8oT9cumzpW#C~&iWX3=0 z@dpaZ^nH%WH{)}= zr)Ot^;VtL+)32ZVKKG4p@3nrJtv6S_qgIZ1rBY|is?l{Z?LM#tPdLz@bIWA&j5^E? zhr>Jd%#Ucxd)nA`CO5C~OeSAax|=I-c?UQ{0Vz)gqnM0f3zy4jCgxQ&G&JBTECxd& z@dc*>3(?r}#K$`K>v)H_$*^!ZnxJ741b_#T0i;Z-AIiTq1M&&cqS}|LOzwo3H zX)~K#vA9V8N<(sq zK+if#X15nUh4aRIlS^9`iHasN+rSnhvmUE^j54U}9JJc)Vwd1xK_y%xlV~=AL`LTE zejeiG_vd^4Q;{v3K#XP@bYKgxngLx*z-k6`F#)R?(8UC-W8to&Cqo{$pqVv9tf!*?;WpKX&#XJNu8F{m0J! PV`u-dv;X-2*nj*7zA~aq From 9bf7ec3c20e1614c40a4269c3c886d69dea16549 Mon Sep 17 00:00:00 2001 From: Mazyad Alabduljaleel Date: Mon, 19 May 2014 09:05:50 +0400 Subject: [PATCH 26/90] Cleanup project file. [REM]: old library references. New libraries are under prebuilt. --- build/cocos2d_libs.xcodeproj/project.pbxproj | 52 ++------------------ 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index ba011bdaf6..2da14e8baf 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -2493,20 +2493,6 @@ 46A169981807AFD6005B8026 /* cpSweep1D.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpSweep1D.c; sourceTree = ""; }; 46A169991807AFD6005B8026 /* cpVect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cpVect.c; sourceTree = ""; }; 46A1699A1807AFD6005B8026 /* prime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prime.h; sourceTree = ""; }; - 46A16E1B1807C948005B8026 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = ../cocos/2d/platform/third_party/ios/libraries/libcurl.a; sourceTree = ""; }; - 46A16E1C1807C948005B8026 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../cocos/2d/platform/third_party/ios/libraries/libfreetype.a; sourceTree = ""; }; - 46A16E1D1807C948005B8026 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../cocos/2d/platform/third_party/ios/libraries/libjpeg.a; sourceTree = ""; }; - 46A16E1E1807C948005B8026 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../cocos/2d/platform/third_party/ios/libraries/libpng.a; sourceTree = ""; }; - 46A16E1F1807C948005B8026 /* libtiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtiff.a; path = ../cocos/2d/platform/third_party/ios/libraries/libtiff.a; sourceTree = ""; }; - 46A16E201807C948005B8026 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../cocos/2d/platform/third_party/ios/libraries/libwebp.a; sourceTree = ""; }; - 46A16E211807C95C005B8026 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../cocos/2d/platform/third_party/mac/libraries/libfreetype.a; sourceTree = ""; }; - 46A16E221807C95C005B8026 /* libglfw3.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libglfw3.a; path = ../cocos/2d/platform/third_party/mac/libraries/libglfw3.a; sourceTree = ""; }; - 46A16E231807C95C005B8026 /* libjpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjpeg.a; path = ../cocos/2d/platform/third_party/mac/libraries/libjpeg.a; sourceTree = ""; }; - 46A16E241807C95C005B8026 /* libpng.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpng.a; path = ../cocos/2d/platform/third_party/mac/libraries/libpng.a; sourceTree = ""; }; - 46A16E251807C95C005B8026 /* libtiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtiff.a; path = ../cocos/2d/platform/third_party/mac/libraries/libtiff.a; sourceTree = ""; }; - 46A16E261807C95C005B8026 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../cocos/2d/platform/third_party/mac/libraries/libwebp.a; sourceTree = ""; }; - 46A16E271807C992005B8026 /* libwebsockets.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebsockets.a; path = ../external/libwebsockets/ios/lib/libwebsockets.a; sourceTree = ""; }; - 46A16E281807C99F005B8026 /* libwebsockets.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebsockets.a; path = ../external/libwebsockets/mac/lib/libwebsockets.a; sourceTree = ""; }; 46A1706E1807CE7A005B8026 /* CCPhysicsBody.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsBody.cpp; sourceTree = ""; }; 46A1706F1807CE7A005B8026 /* CCPhysicsBody.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCPhysicsBody.h; sourceTree = ""; }; 46A170701807CE7A005B8026 /* CCPhysicsContact.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsContact.cpp; sourceTree = ""; }; @@ -2963,8 +2949,6 @@ 1551A341158F2AB200E66CFE /* Frameworks */ = { isa = PBXGroup; children = ( - B3D8D44B179921D50039C204 /* ios */, - B3D8D4471799219B0039C204 /* mac */, 1551A342158F2AB200E66CFE /* Foundation.framework */, ); name = Frameworks; @@ -4810,34 +4794,6 @@ path = ../cocos/3d; sourceTree = ""; }; - B3D8D4471799219B0039C204 /* mac */ = { - isa = PBXGroup; - children = ( - 46A16E281807C99F005B8026 /* libwebsockets.a */, - 46A16E211807C95C005B8026 /* libfreetype.a */, - 46A16E221807C95C005B8026 /* libglfw3.a */, - 46A16E231807C95C005B8026 /* libjpeg.a */, - 46A16E241807C95C005B8026 /* libpng.a */, - 46A16E251807C95C005B8026 /* libtiff.a */, - 46A16E261807C95C005B8026 /* libwebp.a */, - ); - name = mac; - sourceTree = ""; - }; - B3D8D44B179921D50039C204 /* ios */ = { - isa = PBXGroup; - children = ( - 46A16E271807C992005B8026 /* libwebsockets.a */, - 46A16E1B1807C948005B8026 /* libcurl.a */, - 46A16E1C1807C948005B8026 /* libfreetype.a */, - 46A16E1D1807C948005B8026 /* libjpeg.a */, - 46A16E1E1807C948005B8026 /* libpng.a */, - 46A16E1F1807C948005B8026 /* libtiff.a */, - 46A16E201807C948005B8026 /* libwebp.a */, - ); - name = ios; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -7072,7 +7028,7 @@ "\"$(SRCROOT)/../external/freetype2/prebuilt/mac\"", "\"$(SRCROOT)/../external/websockets/prebuilt/mac\"", ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac"; }; name = Debug; }; @@ -7098,7 +7054,7 @@ "\"$(SRCROOT)/../external/freetype2/prebuilt/mac\"", "\"$(SRCROOT)/../external/websockets/prebuilt/mac\"", ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../cocos/platform/desktop"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/png/include/mac $(SRCROOT)/../external/tiff/include/mac $(SRCROOT)/../external/webp/include/mac $(SRCROOT)/../external/jpeg/include/mac $(SRCROOT)/../external/freetype2/include/mac $(SRCROOT)/../external/websockets/include/mac $(SRCROOT)/../external/glfw3/include/mac"; }; name = Release; }; @@ -7258,7 +7214,7 @@ ); SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios"; }; name = Debug; }; @@ -7296,7 +7252,7 @@ ); SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/websockets/include/ios $(SRCROOT)/../external/freetype2/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../external/webp/include/ios $(SRCROOT)/../external/tiff/include/ios $(SRCROOT)/../external/jpeg/include/ios $(SRCROOT)/../external/png/include/ios"; }; name = Release; }; From d9e226f8868ecf776caa83bc7804a68807d2c819 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Mon, 19 May 2014 13:48:50 +0800 Subject: [PATCH 27/90] Package the binary files of cocos2d-console in git-achive-all. --- tools/make-package/config.json | 5 +++++ tools/make-package/git-archive-all | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/make-package/config.json b/tools/make-package/config.json index 6c8874deb8..08e78eed34 100644 --- a/tools/make-package/config.json +++ b/tools/make-package/config.json @@ -10,6 +10,11 @@ "zip_config_path": "../../templates/lua-template-runtime/runtime/config.json", "zip_file_path": "../../", "extract_to_zip_path": "templates/lua-template-runtime/runtime" + }, + { + "zip_config_path": "../cocos2d-console/config.json", + "zip_file_path": "../cocos2d-console", + "extract_to_zip_path": "tools/cocos2d-console" } ] } diff --git a/tools/make-package/git-archive-all b/tools/make-package/git-archive-all index 648e77b186..9af9b8622e 100755 --- a/tools/make-package/git-archive-all +++ b/tools/make-package/git-archive-all @@ -14,6 +14,11 @@ import traceback from os import path, extsep from subprocess import Popen, PIPE, CalledProcessError +class UnrecognizedFormat: + def __init__(self, prompt): + self._prompt = prompt + def __str__(self): + return self._prompt class GitArchiver(object): """ @@ -97,7 +102,7 @@ class GitArchiver(object): import zipfile if not zipfile.is_zipfile(zip_file_path): - raise UnrecognizedFormat("%s is not a zip file" % (self._filename)) + raise UnrecognizedFormat("%s is not a zip file" % zip_file_path) file_paths = [] print("==> Extracting files, please wait ...") @@ -204,6 +209,10 @@ class GitArchiver(object): import subprocess subprocess.call("python %s -d -f" % (path.join(self.main_repo_abspath, "download-deps.py")), shell=True, cwd=self.main_repo_abspath) + # Execute download-bin.py in cocos2d-console folder + console_path = path.join(self.main_repo_abspath, "tools", "cocos2d-console") + subprocess.call("python %s -d -f" % (path.join(console_path, "download-bin.py")), shell=True, cwd=console_path) + # Check config.json to insert a zip file content to the final generated zip file extra_folders = [] config_data = self.load_json_file("config.json") @@ -212,7 +221,7 @@ class GitArchiver(object): zip_config = self.load_json_file(zip_file["zip_config_path"]) zip_file_name = zip_config["version"] + '.zip' extra_to_zip_file = zip_file["extract_to_zip_path"] - zip_file_path = os.path.join(zip_file["zip_file_path"] + zip_file_name) + zip_file_path = os.path.join(zip_file["zip_file_path"], zip_file_name) # 'v' letter was swallowed by github, so we need to substring it from the 2nd letter extra_folder_name = zip_config["repo_name"] + '-' + zip_config["version"][1:] extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name) From a03a5658637d809ae5f09b97b49646dbe9f17d26 Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 14:11:39 +0800 Subject: [PATCH 28/90] issue #5138, add Groups in Xcode --- build/cocos2d_libs.xcodeproj/project.pbxproj | 96 +++++++++++++------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index d6dd743934..a6460dce5c 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -944,8 +944,6 @@ 2905FA6F18CF08D100240AA3 /* UIRichText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0418CF08D000240AA3 /* UIRichText.cpp */; }; 2905FA7018CF08D100240AA3 /* UIRichText.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0518CF08D000240AA3 /* UIRichText.h */; }; 2905FA7118CF08D100240AA3 /* UIRichText.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0518CF08D000240AA3 /* UIRichText.h */; }; - 2905FA7218CF08D100240AA3 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */; }; - 2905FA7318CF08D100240AA3 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */; }; 2905FA7418CF08D100240AA3 /* UIScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */; }; 2905FA7518CF08D100240AA3 /* UIScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */; }; 2905FA7618CF08D100240AA3 /* UIScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0818CF08D000240AA3 /* UIScrollView.h */; }; @@ -979,6 +977,8 @@ 29CB8F4D1929D1BB00C841D6 /* UILayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */; }; 29CB8F4E1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */; }; 29CB8F4F1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */; }; + 29CB8F551929D7A900C841D6 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */; }; + 29CB8F561929D7A900C841D6 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */; }; 2AC795DB1862870F005EC8E1 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D918628689005EC8E1 /* SkeletonBounds.cpp */; }; 2AC795DC1862870F005EC8E1 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D51862867D005EC8E1 /* Event.cpp */; }; 2AC795DD1862870F005EC8E1 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D71862867D005EC8E1 /* EventData.cpp */; }; @@ -2239,7 +2239,6 @@ 2905FA0318CF08D000240AA3 /* UIPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPageView.h; sourceTree = ""; }; 2905FA0418CF08D000240AA3 /* UIRichText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRichText.cpp; sourceTree = ""; }; 2905FA0518CF08D000240AA3 /* UIRichText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRichText.h; sourceTree = ""; }; - 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollInterface.h; sourceTree = ""; }; 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScrollView.cpp; sourceTree = ""; }; 2905FA0818CF08D000240AA3 /* UIScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollView.h; sourceTree = ""; }; 2905FA0918CF08D000240AA3 /* UISlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UISlider.cpp; sourceTree = ""; }; @@ -2259,6 +2258,7 @@ 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = ""; }; 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutExecutant.cpp; sourceTree = ""; }; 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutExecutant.h; sourceTree = ""; }; + 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollInterface.h; sourceTree = ""; }; 2AC795D318628672005EC8E1 /* BoundingBoxAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BoundingBoxAttachment.cpp; sourceTree = ""; }; 2AC795D418628672005EC8E1 /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundingBoxAttachment.h; sourceTree = ""; }; 2AC795D51862867D005EC8E1 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = ""; }; @@ -3924,25 +3924,63 @@ 2905F9E618CF08D000240AA3 /* ui */ = { isa = PBXGroup; children = ( - 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */, - 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */, - 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */, - 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */, + 29CB8F531929D67D00C841D6 /* widgets */, + 29CB8F521929D65500C841D6 /* experimental */, + 29CB8F511929D64500C841D6 /* base */, + 29CB8F501929D63600C841D6 /* layout */, 2905F9E918CF08D000240AA3 /* CocosGUI.cpp */, 2905F9EA18CF08D000240AA3 /* CocosGUI.h */, - 2905F9EB18CF08D000240AA3 /* GUIDefine.h */, - 2905F9F018CF08D000240AA3 /* UIButton.cpp */, - 2905F9F118CF08D000240AA3 /* UIButton.h */, - 2905F9F218CF08D000240AA3 /* UICheckBox.cpp */, - 2905F9F318CF08D000240AA3 /* UICheckBox.h */, - 2905F9F418CF08D000240AA3 /* UIHelper.cpp */, - 2905F9F518CF08D000240AA3 /* UIHelper.h */, - 2905F9F618CF08D000240AA3 /* UIImageView.cpp */, - 2905F9F718CF08D000240AA3 /* UIImageView.h */, + ); + name = ui; + path = ../cocos/ui; + sourceTree = ""; + }; + 29CB8F501929D63600C841D6 /* layout */ = { + isa = PBXGroup; + children = ( + 50E6D32E18E174130051CA34 /* UIHBox.cpp */, + 50E6D32F18E174130051CA34 /* UIHBox.h */, + 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */, + 50E6D33118E174130051CA34 /* UIRelativeBox.h */, + 50E6D33218E174130051CA34 /* UIVBox.cpp */, + 50E6D33318E174130051CA34 /* UIVBox.h */, 2905F9F818CF08D000240AA3 /* UILayout.cpp */, 2905F9F918CF08D000240AA3 /* UILayout.h */, 2905F9FC18CF08D000240AA3 /* UILayoutParameter.cpp */, 2905F9FD18CF08D000240AA3 /* UILayoutParameter.h */, + 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */, + 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */, + ); + name = layout; + sourceTree = ""; + }; + 29CB8F511929D64500C841D6 /* base */ = { + isa = PBXGroup; + children = ( + 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, + 2905FA1318CF08D100240AA3 /* UIWidget.cpp */, + 2905FA1418CF08D100240AA3 /* UIWidget.h */, + 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, + 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */, + 2905F9F418CF08D000240AA3 /* UIHelper.cpp */, + 2905F9F518CF08D000240AA3 /* UIHelper.h */, + 2905F9EB18CF08D000240AA3 /* GUIDefine.h */, + ); + name = base; + sourceTree = ""; + }; + 29CB8F521929D65500C841D6 /* experimental */ = { + isa = PBXGroup; + children = ( + 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */, + 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */, + ); + name = experimental; + sourceTree = ""; + }; + 29CB8F531929D67D00C841D6 /* widgets */ = { + isa = PBXGroup; + children = ( 2905F9FE18CF08D000240AA3 /* UIListView.cpp */, 2905F9FF18CF08D000240AA3 /* UIListView.h */, 2905FA0018CF08D000240AA3 /* UILoadingBar.cpp */, @@ -3951,9 +3989,9 @@ 2905FA0318CF08D000240AA3 /* UIPageView.h */, 2905FA0418CF08D000240AA3 /* UIRichText.cpp */, 2905FA0518CF08D000240AA3 /* UIRichText.h */, - 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */, 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */, 2905FA0818CF08D000240AA3 /* UIScrollView.h */, + 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */, 2905FA0918CF08D000240AA3 /* UISlider.cpp */, 2905FA0A18CF08D100240AA3 /* UISlider.h */, 2905FA0B18CF08D100240AA3 /* UIText.cpp */, @@ -3964,20 +4002,14 @@ 2905FA1018CF08D100240AA3 /* UITextBMFont.h */, 2905FA1118CF08D100240AA3 /* UITextField.cpp */, 2905FA1218CF08D100240AA3 /* UITextField.h */, - 2905FA1318CF08D100240AA3 /* UIWidget.cpp */, - 2905FA1418CF08D100240AA3 /* UIWidget.h */, - 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, - 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */, - 50E6D32E18E174130051CA34 /* UIHBox.cpp */, - 50E6D32F18E174130051CA34 /* UIHBox.h */, - 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */, - 50E6D33118E174130051CA34 /* UIRelativeBox.h */, - 50E6D33218E174130051CA34 /* UIVBox.cpp */, - 50E6D33318E174130051CA34 /* UIVBox.h */, - 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, + 2905F9F018CF08D000240AA3 /* UIButton.cpp */, + 2905F9F118CF08D000240AA3 /* UIButton.h */, + 2905F9F218CF08D000240AA3 /* UICheckBox.cpp */, + 2905F9F318CF08D000240AA3 /* UICheckBox.h */, + 2905F9F618CF08D000240AA3 /* UIImageView.cpp */, + 2905F9F718CF08D000240AA3 /* UIImageView.h */, ); - name = ui; - path = ../cocos/ui; + name = widgets; sourceTree = ""; }; 37936A361869B76800E974DD /* internal */ = { @@ -5063,7 +5095,6 @@ 1AD71DED180E26E600808F54 /* CCMenuLoader.h in Headers */, 50ABBE8F1925AB6F00A911A9 /* CCPlatformConfig.h in Headers */, 1AD71DF1180E26E600808F54 /* CCNode+CCBRelativePositioning.h in Headers */, - 2905FA7218CF08D100240AA3 /* UIScrollInterface.h in Headers */, 1AD71DF5180E26E600808F54 /* CCNodeLoader.h in Headers */, 1AD71DF9180E26E600808F54 /* CCNodeLoaderLibrary.h in Headers */, 50ABBE291925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */, @@ -5128,6 +5159,7 @@ 50ABBD9D1925AB4100A911A9 /* ccGLStateCache.h in Headers */, 50ABBEB91925AB6F00A911A9 /* ccUTF8.h in Headers */, 1AAF536E180E3374000584C8 /* HttpRequest.h in Headers */, + 29CB8F551929D7A900C841D6 /* UIScrollInterface.h in Headers */, 1AAF5370180E3374000584C8 /* HttpResponse.h in Headers */, 50ABBE671925AB6F00A911A9 /* CCEventListenerCustom.h in Headers */, 1AAF5374180E3374000584C8 /* SocketIO.h in Headers */, @@ -5410,7 +5442,6 @@ 503DD8E41926736A00CD74DD /* CCDirectorCaller.h in Headers */, 50ABBD8A1925AB4100A911A9 /* CCCustomCommand.h in Headers */, 2905FA6D18CF08D100240AA3 /* UIPageView.h in Headers */, - 2905FA7318CF08D100240AA3 /* UIScrollInterface.h in Headers */, 50ABBE881925AB6F00A911A9 /* ccMacros.h in Headers */, 50ABC0101926664800A911A9 /* CCFileUtils.h in Headers */, 2905FA4318CF08D100240AA3 /* CocosGUI.h in Headers */, @@ -5581,6 +5612,7 @@ 50ABBD921925AB4100A911A9 /* CCGLProgramCache.h in Headers */, 1AD71E0E180E26E600808F54 /* CocosBuilder.h in Headers */, B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */, + 29CB8F561929D7A900C841D6 /* UIScrollInterface.h in Headers */, 1AD71E98180E26E600808F54 /* Animation.h in Headers */, 1AD71E9C180E26E600808F54 /* AnimationState.h in Headers */, 50ABBE961925AB6F00A911A9 /* CCProfiling.h in Headers */, From 72b4b9ef154fe70d0328c88ad5414d0fa86b3ac3 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 19 May 2014 16:33:27 +0800 Subject: [PATCH 29/90] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index b477f8913e..ed65d6a58d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,7 @@ Core Developers: Huabing Xu (dabingnn) Bo Yu (boyu0) Wenhai Lin(Dhilan007) + Guanghui Qu(andyque) Developers: From 121d6d3109e6ada97aa43e724ed8f32b66f12d45 Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 16:51:25 +0800 Subject: [PATCH 30/90] issue #5183, refactor --- cocos/ui/UILayoutExecutant.cpp | 24 +++++++++---------- cocos/ui/UIPageView.cpp | 8 +++---- cocos/ui/UIWidget.cpp | 12 +++++----- cocos/ui/UIWidget.h | 12 ++++++---- .../UIScrollViewTest/UIScrollViewTest.cpp | 2 +- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index c8f3a4f343..3a5a8585e8 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -145,7 +145,7 @@ void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) finalPosX += mg.left; finalPosY -= mg.top; child->setPosition(Vec2(finalPosX, finalPosY)); - leftBoundary = child->getRightInParent() + mg.right; + leftBoundary = child->getRightBoundary() + mg.right; } } } @@ -253,7 +253,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationBottom = relativeWidget->getTopInParent(); - float locationLeft = relativeWidget->getLeftInParent(); + float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationLeft + ap.x * cs.width; } @@ -269,7 +269,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) float locationBottom = relativeWidget->getTopInParent(); finalPosY = locationBottom + ap.y * cs.height; - finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: @@ -280,7 +280,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationBottom = relativeWidget->getTopInParent(); - float locationRight = relativeWidget->getRightInParent(); + float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } @@ -292,8 +292,8 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getTopInParent(); - float locationRight = relativeWidget->getLeftInParent(); + float locationTop = relativeWidget->getTopBoundary(); + float locationRight = relativeWidget->getLeftBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } @@ -319,7 +319,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getBottomInParent(); + float locationBottom = relativeWidget->getBottomBoundary(); float locationRight = relativeWidget->getLeftInParent(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; @@ -332,7 +332,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getTopInParent(); + float locationTop = relativeWidget->getTopBoundary(); float locationLeft = relativeWidget->getRightInParent(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationLeft + ap.x * cs.width; @@ -349,7 +349,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) float locationLeft = relativeWidget->getRightInParent(); finalPosX = locationLeft + ap.x * cs.width; - finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: @@ -373,7 +373,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationTop = relativeWidget->getBottomInParent(); - float locationLeft = relativeWidget->getLeftInParent(); + float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationLeft + ap.x * cs.width; } @@ -389,7 +389,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) float locationTop = relativeWidget->getBottomInParent(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: @@ -400,7 +400,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationTop = relativeWidget->getBottomInParent(); - float locationRight = relativeWidget->getRightInParent(); + float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 4a69fa7aba..24527ec15b 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -435,18 +435,18 @@ bool PageView::scrollPages(float touchOffset) switch (_touchMoveDir) { case TouchDirection::LEFT: // left - if (_rightChild->getRightInParent() + touchOffset <= _rightBoundary) + if (_rightChild->getRightBoundary() + touchOffset <= _rightBoundary) { - realOffset = _rightBoundary - _rightChild->getRightInParent(); + realOffset = _rightBoundary - _rightChild->getRightBoundary(); movePages(realOffset); return false; } break; case TouchDirection::RIGHT: // right - if (_leftChild->getLeftInParent() + touchOffset >= _leftBoundary) + if (_leftChild->getLeftBoundary() + touchOffset >= _leftBoundary) { - realOffset = _leftBoundary - _leftChild->getLeftInParent(); + realOffset = _leftBoundary - _leftChild->getLeftBoundary(); movePages(realOffset); return false; } diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 3177b493be..a74c8d24b8 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -816,24 +816,24 @@ bool Widget::isEnabled() const return _enabled; } -float Widget::getLeftInParent() +float Widget::getLeftBoundary() const { return getPosition().x - getAnchorPoint().x * _size.width; } -float Widget::getBottomInParent() +float Widget::getBottomBoundary() const { return getPosition().y - getAnchorPoint().y * _size.height; } -float Widget::getRightInParent() +float Widget::getRightBoundary() const { - return getLeftInParent() + _size.width; + return getLeftBoundary() + _size.width; } -float Widget::getTopInParent() +float Widget::getTopBoundary() const { - return getBottomInParent() + _size.height; + return getBottomBoundary() + _size.height; } const Vec2& Widget::getTouchStartPos() diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 70b2d1e49e..044ce5833c 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -201,28 +201,32 @@ public: * * @return The left boundary position of this widget. */ - float getLeftInParent(); + CC_DEPRECATED_ATTRIBUTE float getLeftInParent(){return this->getLeftBoundary();} + float getLeftBoundary() const; /** * Gets the bottom boundary position of this widget. * * @return The bottom boundary position of this widget. */ - float getBottomInParent(); + CC_DEPRECATED_ATTRIBUTE float getBottomInParent(){return this->getBottomBoundary();} + float getBottomBoundary() const; /** * Gets the right boundary position of this widget. * * @return The right boundary position of this widget. */ - float getRightInParent(); + CC_DEPRECATED_ATTRIBUTE float getRightInParent(){return this->getRightBoundary();} + float getRightBoundary() const; /** * Gets the top boundary position of this widget. * * @return The top boundary position of this widget. */ - float getTopInParent(); + CC_DEPRECATED_ATTRIBUTE float getTopInParent(){return this->getTopBoundary();} + float getTopBoundary() const; /** * Gets a child from the container with its name diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index cec7e6ca6f..a1613ce301 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -66,7 +66,7 @@ bool UIScrollViewTest_Vertical::init() Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); button_scale9->setScale9Enabled(true); button_scale9->setSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); - button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomInParent() - titleButton->getSize().height)); + button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomBoundary() - titleButton->getSize().height)); scrollView->addChild(button_scale9); imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getSize().height / 2.0f)); From ee24e137f77ddec52593c56fac3133b8b1084bfb Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 17:18:04 +0800 Subject: [PATCH 31/90] issue #5183, refactor obscure functions --- cocos/ui/UILayoutExecutant.cpp | 26 +-- cocos/ui/UIScrollView.cpp | 154 +++++++++--------- .../UIScrollViewTest/UIScrollViewTest.cpp | 12 +- 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index 3a5a8585e8..91cc3e2def 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -252,7 +252,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getTopInParent(); + float locationBottom = relativeWidget->getTopBoundary(); float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationLeft + ap.x * cs.width; @@ -266,7 +266,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationBottom = relativeWidget->getTopInParent(); + float locationBottom = relativeWidget->getTopBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; @@ -279,7 +279,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getTopInParent(); + float locationBottom = relativeWidget->getTopBoundary(); float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; @@ -306,10 +306,10 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationRight = relativeWidget->getLeftInParent(); + float locationRight = relativeWidget->getLeftBoundary(); finalPosX = locationRight - (1.0f - ap.x) * cs.width; - finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: @@ -320,7 +320,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationBottom = relativeWidget->getBottomBoundary(); - float locationRight = relativeWidget->getLeftInParent(); + float locationRight = relativeWidget->getLeftBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } @@ -333,7 +333,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationTop = relativeWidget->getTopBoundary(); - float locationLeft = relativeWidget->getRightInParent(); + float locationLeft = relativeWidget->getRightBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationLeft + ap.x * cs.width; } @@ -346,7 +346,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationLeft = relativeWidget->getRightInParent(); + float locationLeft = relativeWidget->getRightBoundary(); finalPosX = locationLeft + ap.x * cs.width; finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; @@ -359,8 +359,8 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getBottomInParent(); - float locationLeft = relativeWidget->getRightInParent(); + float locationBottom = relativeWidget->getBottomBoundary(); + float locationLeft = relativeWidget->getRightBoundary(); finalPosY = locationBottom + ap.y * cs.height; finalPosX = locationLeft + ap.x * cs.width; } @@ -372,7 +372,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getBottomInParent(); + float locationTop = relativeWidget->getBottomBoundary(); float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationLeft + ap.x * cs.width; @@ -386,7 +386,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationTop = relativeWidget->getBottomInParent(); + float locationTop = relativeWidget->getBottomBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; @@ -399,7 +399,7 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getBottomInParent(); + float locationTop = relativeWidget->getBottomBoundary(); float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 72a96b1fa7..cbff4223b2 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -198,7 +198,7 @@ void ScrollView::setInnerContainerSize(const Size &size) } case Direction::HORIZONTAL: { - if (_innerContainer->getRightInParent() <= _size.width) + if (_innerContainer->getRightBoundary() <= _size.width) { Size newInnerSize = _innerContainer->getSize(); float offset = originalInnerSize.width - newInnerSize.width; @@ -211,7 +211,7 @@ void ScrollView::setInnerContainerSize(const Size &size) Size newInnerSize = _innerContainer->getSize(); float offsetY = originalInnerSize.height - newInnerSize.height; float offsetX = 0.0f; - if (_innerContainer->getRightInParent() <= _size.width) + if (_innerContainer->getRightBoundary() <= _size.width) { offsetX = originalInnerSize.width - newInnerSize.width; } @@ -221,11 +221,11 @@ void ScrollView::setInnerContainerSize(const Size &size) default: break; } - if (_innerContainer->getLeftInParent() > 0.0f) + if (_innerContainer->getLeftBoundary() > 0.0f) { _innerContainer->setPosition(Vec2(_innerContainer->getAnchorPoint().x * _innerContainer->getSize().width, _innerContainer->getPosition().y)); } - if (_innerContainer->getRightInParent() < _size.width) + if (_innerContainer->getRightBoundary() < _size.width) { _innerContainer->setPosition(Vec2(_size.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getSize().width), _innerContainer->getPosition().y)); } @@ -233,7 +233,7 @@ void ScrollView::setInnerContainerSize(const Size &size) { _innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _innerContainer->getAnchorPoint().y * _innerContainer->getSize().height)); } - if (_innerContainer->getTopInParent() < _size.height) + if (_innerContainer->getTopBoundary() < _size.height) { _innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _size.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getSize().height)); } @@ -378,56 +378,56 @@ bool ScrollView::checkNeedBounce() { if (_topBounceNeeded && _leftBounceNeeded) { - Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(_innerContainer->getLeftInParent(), _innerContainer->getTopInParent()); + Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getTopBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_topBounceNeeded && _rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, _size.height) - Vec2(_innerContainer->getRightInParent(), _innerContainer->getTopInParent()); + Vec2 scrollVector = Vec2(_size.width, _size.height) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getTopBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded && _leftBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftInParent(), _innerContainer->getBottomInParent()); + Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getBottomBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded && _rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightInParent(), _innerContainer->getBottomInParent()); + Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getBottomBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_topBounceNeeded) { - Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(0.0f, _innerContainer->getTopInParent()); + Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(0.0f, _innerContainer->getTopBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(0.0f, _innerContainer->getBottomInParent()); + Vec2 scrollVector = Vec2::ZERO - Vec2(0.0f, _innerContainer->getBottomBoundary()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_leftBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftInParent(), 0.0f); + Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftBoundary(), 0.0f); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightInParent(), 0.0f); + Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), 0.0f); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); @@ -439,7 +439,7 @@ bool ScrollView::checkNeedBounce() void ScrollView::checkBounceBoundary() { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos > _bottomBoundary) { scrollToBottomEvent(); @@ -449,7 +449,7 @@ void ScrollView::checkBounceBoundary() { _bottomBounceNeeded = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos < _topBoundary) { scrollToTopEvent(); @@ -459,7 +459,7 @@ void ScrollView::checkBounceBoundary() { _topBounceNeeded = false; } - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos < _rightBoundary) { scrollToRightEvent(); @@ -469,7 +469,7 @@ void ScrollView::checkBounceBoundary() { _rightBounceNeeded = false; } - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos > _leftBoundary) { scrollToLeftEvent(); @@ -576,14 +576,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; bounceRightEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -596,14 +596,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icLefrPos = _innerContainer->getLeftInParent(); + float icLefrPos = _innerContainer->getLeftBoundary(); if (icLefrPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLefrPos; bounceLeftEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -616,14 +616,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icLefrPos = _innerContainer->getLeftInParent(); + float icLefrPos = _innerContainer->getLeftBoundary(); if (icLefrPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLefrPos; bounceLeftEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -636,14 +636,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; bounceRightEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -655,7 +655,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // bounce to top { float realOffsetY = touchOffsetY; - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -667,7 +667,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) //bounce to bottom { float realOffsetY = touchOffsetY; - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -679,7 +679,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) //bounce to right { float realOffsetX = touchOffsetX; - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; @@ -691,7 +691,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) //bounce to left { float realOffsetX = touchOffsetX; - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLeftPos; @@ -712,7 +712,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (_autoScrollDir.y > 0) { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -721,7 +721,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -734,7 +734,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (_autoScrollDir.x > 0) { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -743,7 +743,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -756,13 +756,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (*touchOffsetX > 0.0f && *touchOffsetY > 0.0f) // up right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -771,13 +771,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY > 0.0f) // up left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -786,13 +786,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY < 0.0f) // down left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -801,13 +801,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX > 0.0f && *touchOffsetY < 0.0f) // down right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -816,7 +816,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX == 0.0f && *touchOffsetY > 0.0f) // up { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -825,7 +825,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY == 0.0f) // left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; @@ -834,7 +834,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX == 0.0f && *touchOffsetY < 0.0f) // down { - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -843,7 +843,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX > 0.0f && *touchOffsetY == 0.0f) // right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -869,14 +869,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) float realOffset = touchOffsetY; if (_bounceEnabled) { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) { realOffset = _bounceBottomBoundary - icBottomPos; scrollToBottomEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _bounceTopBoundary) { realOffset = _bounceTopBoundary - icTopPos; @@ -886,14 +886,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bottomBoundary) { realOffset = _bottomBoundary - icBottomPos; scrollToBottomEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _topBoundary) { realOffset = _topBoundary - icTopPos; @@ -909,14 +909,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) float realOffset = touchOffsetX; if (_bounceEnabled) { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _bounceRightBoundary) { realOffset = _bounceRightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) { realOffset = _bounceLeftBoundary - icLeftPos; @@ -926,14 +926,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _rightBoundary) { realOffset = _rightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _leftBoundary) { realOffset = _leftBoundary - icLeftPos; @@ -952,14 +952,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) { realOffsetX = _bounceLeftBoundary - icLeftPos; scrollToLeftEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) { realOffsetY = _bounceBottomBoundary - icBottomPos; @@ -969,14 +969,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _bounceRightBoundary) { realOffsetX = _bounceRightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) { realOffsetY = _bounceBottomBoundary - icBottomPos; @@ -986,14 +986,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _bounceRightBoundary) { realOffsetX = _bounceRightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _bounceTopBoundary) { realOffsetY = _bounceTopBoundary - icTopPos; @@ -1003,14 +1003,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) { realOffsetX = _bounceLeftBoundary - icLeftPos; scrollToLeftEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _bounceTopBoundary) { realOffsetY = _bounceTopBoundary - icTopPos; @@ -1020,7 +1020,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) { realOffsetY = _bounceBottomBoundary - icBottomPos; @@ -1030,7 +1030,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _bounceRightBoundary) { realOffsetX = _bounceRightBoundary - icRightPos; @@ -1040,7 +1040,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down { - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _bounceTopBoundary) { realOffsetY = _bounceTopBoundary - icTopPos; @@ -1050,7 +1050,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) { realOffsetX = _bounceLeftBoundary - icLeftPos; @@ -1063,14 +1063,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _leftBoundary) { realOffsetX = _leftBoundary - icLeftPos; scrollToLeftEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -1080,14 +1080,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -1097,14 +1097,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; scrollToRightEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -1114,14 +1114,14 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _leftBoundary) { realOffsetX = _leftBoundary - icLeftPos; scrollToLeftEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -1131,7 +1131,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up { - float icBottomPos = _innerContainer->getBottomInParent(); + float icBottomPos = _innerContainer->getBottomBoundary(); if (icBottomPos + touchOffsetY >= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -1141,7 +1141,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left { - float icRightPos = _innerContainer->getRightInParent(); + float icRightPos = _innerContainer->getRightBoundary(); if (icRightPos + touchOffsetX <= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; @@ -1151,7 +1151,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down { - float icTopPos = _innerContainer->getTopInParent(); + float icTopPos = _innerContainer->getTopBoundary(); if (icTopPos + touchOffsetY <= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -1161,7 +1161,7 @@ bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) } else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right { - float icLeftPos = _innerContainer->getLeftInParent(); + float icLeftPos = _innerContainer->getLeftBoundary(); if (icLeftPos + touchOffsetX >= _leftBoundary) { realOffsetX = _leftBoundary - icLeftPos; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index a1613ce301..d2119e1f43 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -60,7 +60,7 @@ bool UIScrollViewTest_Vertical::init() Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png"); titleButton->setTitleText("Title Button"); - titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomInParent() - button->getSize().height)); + titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomBoundary() - button->getSize().height)); scrollView->addChild(titleButton); Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); @@ -137,19 +137,19 @@ bool UIScrollViewTest_Horizontal::init() Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png"); titleButton->setTitleText("Title Button"); - titleButton->setPosition(Vec2(button->getRightInParent() + button->getSize().width / 2.0f, - button->getBottomInParent() - button->getSize().height / 2.0f)); + titleButton->setPosition(Vec2(button->getRightBoundary() + button->getSize().width / 2.0f, + button->getBottomBoundary() - button->getSize().height / 2.0f)); scrollView->addChild(titleButton); Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); button_scale9->setScale9Enabled(true); button_scale9->setSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); - button_scale9->setPosition(Vec2(titleButton->getRightInParent() + titleButton->getSize().width / 2.0f, - titleButton->getBottomInParent() - titleButton->getSize().height / 2.0f)); + button_scale9->setPosition(Vec2(titleButton->getRightBoundary() + titleButton->getSize().width / 2.0f, + titleButton->getBottomBoundary() - titleButton->getSize().height / 2.0f)); scrollView->addChild(button_scale9); imageView->setPosition(Vec2(innerWidth - imageView->getSize().width / 2.0f, - button_scale9->getBottomInParent() - button_scale9->getSize().height / 2.0f)); + button_scale9->getBottomBoundary() - button_scale9->getSize().height / 2.0f)); scrollView->addChild(imageView); return true; From a9e1c508970521194cd1c39d7f207cda0149c617 Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 17:34:48 +0800 Subject: [PATCH 32/90] issue #5183, refactor UIScrollView --- cocos/ui/UIScrollView.cpp | 620 ++++++++++++++++++++------------------ cocos/ui/UIScrollView.h | 6 + 2 files changed, 329 insertions(+), 297 deletions(-) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index cbff4223b2..07d1c976b1 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -857,320 +857,346 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } return scrollenabled; } + +bool ScrollView::scrollChilderVertical(float touchOffsetX, float touchOffsetY) +{ + bool scrollenabled = true; + + float realOffset = touchOffsetY; + if (_bounceEnabled) + { + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffset = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffset = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else + { + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffset = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffset = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + moveChildren(0.0f, realOffset); + + return scrollenabled; +} + +bool ScrollView::scrollChilderHorizontal(float touchOffsetX, float touchOffsetY) +{ + bool scrollenabled = true; + + float realOffset = touchOffsetX; + if (_bounceEnabled) + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffset = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffset = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + else + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffset = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffset = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + moveChildren(realOffset, 0.0f); + + return scrollenabled; +} + +bool ScrollView::scrollChilderBoth(float touchOffsetX, float touchOffsetY) +{ + bool scrollenabled = true; + float realOffsetX = touchOffsetX; + float realOffsetY = touchOffsetY; + if (_bounceEnabled) + { + if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up + { + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down + { + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + } + else + { + if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up + { + float icBottomPos = _innerContainer->getBottomBoundary(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left + { + float icRightPos = _innerContainer->getRightBoundary(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down + { + float icTopPos = _innerContainer->getTopBoundary(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right + { + float icLeftPos = _innerContainer->getLeftBoundary(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + } + moveChildren(realOffsetX, realOffsetY); + return scrollenabled; +} bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { bool scrollenabled = true; scrollingEvent(); + switch (_direction) { case Direction::VERTICAL: // vertical { - float realOffset = touchOffsetY; - if (_bounceEnabled) - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffset = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffset = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffset = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffset = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - moveChildren(0.0f, realOffset); + scrollenabled = this->scrollChilderVertical(touchOffsetX, touchOffsetY); break; } case Direction::HORIZONTAL: // horizontal { - float realOffset = touchOffsetX; - if (_bounceEnabled) - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffset = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffset = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - else - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffset = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffset = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - moveChildren(realOffset, 0.0f); + scrollenabled = this->scrollChilderHorizontal(touchOffsetX, touchOffsetY); break; } case Direction::BOTH: { - float realOffsetX = touchOffsetX; - float realOffsetY = touchOffsetY; - if (_bounceEnabled) - { - if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down - { - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - } - else - { - if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down - { - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - } - moveChildren(realOffsetX, realOffsetY); + scrollenabled = this->scrollChilderBoth(touchOffsetX, touchOffsetY); break; } default: diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index ae201e16a5..8009c6d071 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -356,7 +356,13 @@ protected: void startBounceChildren(float v); void stopBounceChildren(); bool checkCustomScrollDestination(float* touchOffsetX, float* touchOffsetY); + virtual bool scrollChildren(float touchOffsetX, float touchOffsetY); + virtual bool scrollChilderHorizontal(float touchOffsetX, float touchOffsetY); + virtual bool scrollChilderVertical(float touchOffsetX, float touchOffsetY); + virtual bool scrollChilderBoth(float touchOffsetX, float touchOffsetY); + + bool bounceScrollChildren(float touchOffsetX, float touchOffsetY); void startRecordSlidAction(); virtual void endRecordSlidAction(); From 9c5f7f0ce3459ae54e5fdb7b4217f82551059d4f Mon Sep 17 00:00:00 2001 From: GameEgg Date: Mon, 19 May 2014 18:42:11 +0900 Subject: [PATCH 33/90] bug fix FontFNT.cpp --- cocos/2d/CCFontFNT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCFontFNT.cpp b/cocos/2d/CCFontFNT.cpp index adae2b9ac3..8c5cb16389 100644 --- a/cocos/2d/CCFontFNT.cpp +++ b/cocos/2d/CCFontFNT.cpp @@ -695,12 +695,12 @@ FontFNT::FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset /* = V :_configuration(theContfig) ,_imageOffset(CC_POINT_PIXELS_TO_POINTS(imageOffset)) { - + _configuration->retain(); } FontFNT::~FontFNT() { - + _configuration->release(); } void FontFNT::purgeCachedData() From 834a72315a5c111a219bf3a651fd83206e3c8688 Mon Sep 17 00:00:00 2001 From: andyque Date: Mon, 19 May 2014 17:43:27 +0800 Subject: [PATCH 34/90] issue #5183, add deprecated function for Widget --- cocos/ui/UIWidget.cpp | 5 +++++ cocos/ui/UIWidget.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index a74c8d24b8..71de114da7 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -876,6 +876,11 @@ LayoutParameter* Widget::getLayoutParameter() { return dynamic_cast(_layoutParameterDictionary.at((int)_layoutParameterType)); } + +LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type) +{ + return dynamic_cast(_layoutParameterDictionary.at((int)type)); +} std::string Widget::getDescription() const { diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 044ce5833c..718336168f 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -485,6 +485,8 @@ public: * @return LayoutParameter */ LayoutParameter* getLayoutParameter() override; + CC_DEPRECATED_ATTRIBUTE LayoutParameter* getLayoutParameter(LayoutParameter::Type type); + /** * Ignore the widget size @@ -672,9 +674,12 @@ protected: Size _size; Size _customSize; bool _ignoreSize; - bool _affectByClipping; + SizeType _sizeType; Vec2 _sizePercent; + + bool _affectByClipping; + PositionType _positionType; Vec2 _positionPercent; bool _reorderWidgetChildDirty; From cffd53ea94bb9d9e1ce81ac7463918f1060348ef Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 19 May 2014 17:44:28 +0800 Subject: [PATCH 35/90] accelerometer fix --- .../AccelerometerTest/AccelerometerTest.cpp | 32 ++++++------------- .../AccelerometerTest/AccelerometerTest.h | 5 ++- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp index b352c5df50..2ec0db333b 100644 --- a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp +++ b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.cpp @@ -13,12 +13,11 @@ else if (_pos > _max) \ // AccelerometerTest // //------------------------------------------------------------------ -AccelerometerTest::AccelerometerTest(void) -: _lastTime(0.0) +AccelerometerTest::AccelerometerTest() { } -AccelerometerTest::~AccelerometerTest(void) +AccelerometerTest::~AccelerometerTest() { _ball->release(); Device::setAccelerometerEnabled(false); @@ -50,34 +49,21 @@ void AccelerometerTest::onEnter() void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event) { -// double fNow = pAccelerationValue->timestamp; -// -// if (_lastTime > 0.0) -// { -// auto ptNow = convertToUI -// } -// -// _lastTime = fNow; - - auto pDir = Director::getInstance(); - /*FIXME: Testing on the Nexus S sometimes _ball is NULL */ - if ( _ball == NULL ) { + if ( _ball == nullptr ) { return; } auto ballSize = _ball->getContentSize(); - auto ptNow = _ball->getPosition(); - auto ptTemp = pDir->convertToUI(ptNow); + auto pos = _ball->getPosition(); - ptTemp.x += acc->x * 9.81f; - ptTemp.y -= acc->y * 9.81f; + pos.x += acc->x * 9.81f; + pos.y += acc->y * 9.81f; - auto ptNext = pDir->convertToGL(ptTemp); - FIX_POS(ptNext.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0)); - FIX_POS(ptNext.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0)); - _ball->setPosition(ptNext); + FIX_POS(pos.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0)); + FIX_POS(pos.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0)); + _ball->setPosition(pos); } //------------------------------------------------------------------ diff --git a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h index 72f5b0132c..28669d6a1a 100644 --- a/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h +++ b/tests/cpp-tests/Classes/AccelerometerTest/AccelerometerTest.h @@ -9,11 +9,10 @@ class AccelerometerTest: public Layer { protected: Sprite* _ball; - double _lastTime; public: - AccelerometerTest(void); - ~AccelerometerTest(void); + AccelerometerTest(); + ~AccelerometerTest(); void onAcceleration(Acceleration* acc, Event* event); From 1d5748c505c0da062b0985d02649b06b3d1b858e Mon Sep 17 00:00:00 2001 From: lm Date: Mon, 19 May 2014 18:03:21 +0800 Subject: [PATCH 36/90] [Jenkins][ci skip] Add check slave online status to watchdog --- tools/jenkins-scripts/watchdog.py | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py index 99c2e7447f..61d5588fb0 100644 --- a/tools/jenkins-scripts/watchdog.py +++ b/tools/jenkins-scripts/watchdog.py @@ -1,8 +1,39 @@ import jenkinsapi from jenkinsapi.jenkins import Jenkins +from jenkinsapi.node import Node import sys import time import os +from email.mime.text import MIMEText +import smtplib + +def send_mail(sub,title,content): + to_list = os.environ['EMAIL_LIST'].split(' ') + mail_user = os.environ['EMAIL_USER'] + mail_pass = os.environ['EMAIL_PWD'] + mail_postfix = 'gmail.com' + me = mail_user + "<" + mail_user + "@" + mail_postfix + ">" + msg = MIMEText(content, _subtype='plain', _charset='gb2312') + msg['Subject'] = sub + msg['From'] = me + msg['To'] = " ".join(to_list) + print 'to users:', msg['To'] + msg['Content'] = 'test' + try: + s = smtplib.SMTP('smtp.gmail.com', 587) + s.ehlo() + s.starttls() + s.login(mail_user,mail_pass) + s.sendmail(me, to_list, str(msg)) + print 'info:', me, to_list, str(msg) + s.close() + return True + except Exception, e: + print str(e) + return False + +def sendEmail(msg): + send_mail("Jenkins node " + msg + " is offline", 'for offline.', msg + ' is offline') #check & kill dead buid def build_time(_job,_threshold): @@ -43,6 +74,16 @@ def main(): else: threshold = int(os.environ['jenkins-job-watchdog-threshold']) build_time(job,threshold) + + #check node status + node_names = os.environ['NODE_LIST'].split(' ') + for node_name in node_names: + node = J.get_node(node_name) + if node.is_online(): + print node_name, ' : is online' + else: + sendEmail(node_name) + print node_name, ' : is offline' return(0) From 908d329ae34c099d86dd4ecef612333d4c57388f Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 16:56:33 -0700 Subject: [PATCH 37/90] Release Notes for v3.1 --- docs/RELEASE_NOTES.md | 768 ++++++++---------------------------------- 1 file changed, 141 insertions(+), 627 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 10e66b06e9..8b27827e08 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -1,61 +1,13 @@ -# cocos2d-x v3.0 Release Notes # +# cocos2d-x v3.1 Release Notes # **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* -- [cocos2d-x v3.0 Release Notes](#user-content-cocos2d-x-v30-release-notes) -- [Misc Information](#user-content-misc-information) -- [Requirements](#user-content-requirements) - - [Runtime Requirements](#user-content-runtime-requirements) - - [Compiler Requirements](#user-content-compiler-requirements) - - [How to run tests](#user-content-how-to-run-tests) - - [Mac OSX & iOS](#user-content-mac-osx--ios) - - [Android](#user-content-android) - - [Windows](#user-content-windows) - - [Linux](#user-content-linux) - - [How to start a new game](#user-content-how-to-start-a-new-game) -- [Highlights of v3.0](#user-content-highlights-of-v30) -- [Features in detail](#user-content-features-in-detail) - - [C++11 features](#user-content-c11-features) - - [std::function](#user-content-stdfunction) - - [Strongly typed enums](#user-content-strongly-typed-enums) - - [override](#user-content-override) - - [Removed Objective-C patterns](#user-content-removed-objective-c-patterns) - - [No more 'CC' prefix for C++ classes and free functions](#user-content-no-more-cc-prefix-for-c-classes-and-free-functions) - - [clone() instead of copy()](#user-content-clone-instead-of-copy) - - [Singletons use getInstance() and destroyInstance()](#user-content-singletons-use-getinstance-and-destroyinstance) - - [Object is replaced with Ref](#user-content-object-is-replaced-with-ref) - - [getters](#user-content-getters) - - [POD types](#user-content-pod-types) - - [New Renderer](#user-content-new-renderer) - - [Renderer features](#user-content-renderer-features) - - [Auto-batching](#user-content-auto-batching) - - [Auto-culling](#user-content-auto-culling) - - [Global Z order](#user-content-global-z-order) - - [Sprite vs. SpriteBatchNode](#user-content-sprite-vs-spritebatchnode) - - [Improved LabelTTF / LabelBMFont / LabelAtlas](#user-content-improved-labelttf--labelbmfont--labelatlas) - - [New EventDispatcher](#user-content-new-eventdispatcher) - - [Physics Integration](#user-content-physics-integration) -- [Misc API Changes](#user-content-misc-api-changes) - - [ccTypes.h](#user-content-cctypesh) - - [deprecated functions and global variables](#user-content-deprecated-functions-and--global-variables) -- [Changes in the Lua bindings](#user-content-changes-in-the-lua-bindings) - - [Use bindings-generator tool for lua binding](#user-content-use-bindings-generator-tool-for-lua-binding) - - [Bind the classes with namespace to lua](#user-content-bind-the-classes-with-namespace-to-lua) - - [Use ScriptHandlerMgr to manage the register and unregister of Lua function](#user-content-use-scripthandlermgr-to-manage-the-register-and-unregister-of-lua-function) - - [Misc API changes](#user-content-misc-api-changes-1) - - [Use cc、ccs、ccui gl and sp as module name](#user-content-use-ccccsccui-gl-and-sp-as-module-name) - - [Modified functions](#user-content-modified-functions) - - [Add some modules](#user-content-add-some-modules) - - [Add more lua bindings](#user-content-add-more-lua-bindings) - - [Replace some lua-bindings of Class or Struct with lua table](#user-content-replace-some-lua-bindings-of-class-or-struct-with-lua-table) - - [Support lua script codes call Object-C codes and Java codes](#user-content-support-lua-script-codes-call-object-c-codes-and-java-codes) - - [Add some lua files to store the constants of different modules](#user-content-add-some-lua-files-to-store-the-constants-of-different-modules) - # Misc Information -* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.0beta.zip -* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0beta/CHANGELOG -* API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.0beta/index.html +* Download: http://cdn.cocos2d-x.org/cocos2d-x-3.1rc0.zip +* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/CHANGELOG +* ~~API Reference: http://www.cocos2d-x.org/reference/native-cpp/V3.0/index.html~~ +* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md) # Requirements @@ -65,15 +17,17 @@ * iOS 5.0 or newer * OS X 10.7 or newer * Windows 7 or newer -* Windows Phone 8 or newer (initail version) +* Windows Phone 8 or newer * Linux Ubuntu 12.04 (or newer) * ~~Browsers via Emscripten~~ N/A for the moment ## Compiler Requirements -* Xcode 4.6 (for iOS or Mac) -* gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required. -* Visual Studio 2012 (for Windows) +* Xcode 4.6 or newer for iOS or Mac +* gcc 4.7 or newer for Linux +* gcc 4.7 and ndk-r9 or newer for Android +* Visual Studio 2012 or newer for Windows (win32) +* Visual Studio 2012 or newer for Windows Phone 8 ## How to run tests @@ -140,627 +94,187 @@ Run Please refer to [ReadMe](../README.md). And there is a [document](https://github.com/chukong/cocos-docs/blob/master/manual/framework/native/getting-started/v3.0/how-to-start-a-new-game/en.md) for it. -# Highlights of v3.0 +# Highlights of v3.1 + +* `Sprite3D`, a new node to render 3D models +* Improved Shader subsystem +* New, unified, math library +* `ui::VideoPlayer`, a new node to play videos -* Replaced Objective-C patterns with C++ (C++11) patterns and best practices -* Improved Labels -* Improved renderer (much faster than in v2.2!!) -* New Event Dispatcher -* Physics integration -* New UI objects -* [JavaScript remote debugger](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/scripting/javascript/js-remote-debugger/en.md) -* Remote Console support -* Use [cocos console](https://github.com/cocos2d/cocos2d-console) to create and run project -* Refactor Image - release memory in time and uniform the api of supported file format -* Automatically generated Lua bindings, add LuaJavaBridge and LuaObjcBridge -* Templated containers - * `CCDictionary` is replaced by `cocos2d::Map<>`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/map/en.md) - * `CCArray` is replaced by `cocos2d::Vector<>`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/vector/en.md) - * `CCBool`, `CCFLoat`, `CCDouble` are replaced with `cocos2d::Value`, [usage](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/data-structure/v3/value/en.md) # Features in detail -## C++11 features +## Sprite3D -_Feature added in v3.0-pre-alpha0_ +cocos2d-x v3.0 replaced `Node`'s 2x3 transform matrix with a 4x4 one. This feature allows you to transform any node in a 3d space. -A subset of C++11 features are being used in cocos2d-x: +`Sprite3D` allows users to render a 3d model inside cocos2d. And since cocos2d-x already has 4x4 transform matrix, it is possible to move scale and rotate the `Sprite3D` in the x, y, and z axis. -* `std::function`, including lambda objects for callbacks -* strongly typed enums, for most of the cocos2d-x enums and constants -* `std::thread` for threading -* `override` and `final` context keywords, for overriden and final methods +The API is like `Sprite`: +```c++ +// v3.1 only supports the Wavefront file format +auto sprite3d = Sprite3D::create("mymodel.obj"); -### std::function +// if the material is not specified in .obj, you can override it with: +auto sprite3d = Sprite3D::create("mymodel.obj", "texture.png"); -* `CallFunc` can be created with an `std::function` -* `CallFuncN` can be created with an `std::function` -* `CallFuncND` and `CallFuncO` were removed since it can be created with simulated with `CallFuncN` and `CallFunc`. See ActionsTest.cpp for more examples -* `MenuItem` supports `std::function` as callbacks - -`CallFunc` example: - -```cpp -// in v2.1 -CCCallFunc *action1 = CCCallFunc::create( this, callfunc_selector( MyClass::callback_0 ) ); - -// in v3.0 (short version) -auto action1 = CallFunc::create( CC_CALLBACK_0(MyClass::callback_0,this)); -auto action2 = CallFunc::create( CC_CALLBACK_0(MyClass::callback_1,this, additional_parameters)); - -// in v3.0 (long version) -auto action1 = CallFunc::create( std::bind( &MyClass::callback_0, this)); -auto action2 = CallFunc::create( std::bind( &MyClass::callback_1, this, additional_parameters)); - -// in v3.0 you can also use lambdas or any other "Function" object -auto action1 = CallFunc::create( - [&](){ - auto s = Director::sharedDirector()->getWinSize(); - auto label = LabelTTF::create("called:lambda callback", "Marker Felt", 16); - label->setPosition(ccp( s.width/4*1,s.height/2-40)); - this->addChild(label); - } ); +// Since Sprite3D is a regular node, you can add it into the scene like any other node +scene->addChild(sprite3d); +sprite3d->setRotation3D(Vec3(x,y,z)); ``` -`MenuItem` example: +## Improved Shader Subsystem -```cpp -// in v2.1 -CCMenuItemLabel *item = CCMenuItemLabel::create(label, this, menu_selector(MyClass::callback)); +In order to support `Sprite3D`, we refactored our shader subsystem. The result is that we have an easier to use, yet more powerful shader system that can be used both for 2D and 3D. -// in v3.0 (short version) -auto item = MenuItemLabel::create(label, CC_CALLBACK_1(MyClass::callback, this)); -// in v3.0 (long version) -auto item = MenuItemLabel::create(label, std::bind(&MyClass::callback, this, std::placeholders::_1)); +In v3.0, the class `GLProgram` was used both for holdin the _OpenGL program_ (shader), and also the shader state (uniforms and attributes). -// in v3.0 you can use lambdas or any other "Function" object -auto item = MenuItemLabel::create(label, - [&](Object *sender) { - // do something. Item "sender" clicked - }); +That design had one big constraint: In order to add or remove an attribute or uniform, you had to subclass `GLProgram`. + +In v3.1, we decoupled the shader state from the shader. We added the `GLProgramState` class which holds the attributes and uniforms. + +The API is the following: + +``` +auto glprogram = GLProgram::create(...); + +// it will automatically parse all the attributes and uniforms +// used by glprogram, and it will populate the glprogramstate dictionary +// with them +auto glprogramstate = GLProgramState::create( glprogram ); + +// How to set a uniform for Vec2 (Int, Texture, Vec3, Vec4, Mat4, are all supported) +glprogramstate->setUniformVec2("u_my_uniform", Vec2(x,y)); +// or how to set it using a callback +glprogramstate->setUniformCallback("u_my_uniform", [](Uniform*uniform){ + // do something +}); + +// How to set an attribute +glprogramstate->setVertexAttribPointer("a_my_attrib", 4, GL_FLOAT, GL_FALSE, 0, vertex); +// or how to set it using a callback +glprogramstate->setVertexAttribCallback("a_my_attrib", [](VertexAttrib*attrib){ + // do something + }); ``` -### Strongly typed enums +By using this API it is possible to change the effect on a `Sprite3D` (or even an `Sprite`) without subclassing any cocos2d class! -_Feature added in v3.0-pre-alpha0_ +Possible examples: -Constants and enums that started with `k`, and that usually were defined as `int` or as simple `enum` where replaced with strongly typed enums ( `enum class` ) to prevent collisions and type errors. -The new format is: + - Outline / Shadow / Glow effects + - Multi-texturing effects + - Sepia, Grey or other color effects + - and more + +For a complete example, please see the [Shader - Sprite](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp) and [Shader - Basic](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.1rc0/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp) examples. - | v2.1 | v3.0 | - | kTypeValue | Type::VALUE | -Examples: - | v2.1 | v3.0 | - | kCCTexture2DPixelFormat_RGBA8888 | Texture2D::PixelFormat::RGBA8888 | - | kCCDirectorProjectionCustom | Director::Projection::CUSTOM | - | ccGREEN | Color3B::GREEN | - | CCPointZero | Point::ZERO | - | CCSizeZero | Size::ZERO | +## New math library -The old values can still be used, but are deprecated. +cocos2d-x v1.0 only supported 2D features. So it made sense to use a 2x3 Transform matrix for the operations. -### override +In cocos2d-x v2.0 we added OpenGL ES 2.0 support (no more built-in OpenGL matrix operations) so it made sense to use [Kazmath](https://github.com/Kazade/kazmath), a math library that replaced the OpenGL ES 1.0 functionality. Kazmath was used internally, and most of the users never used the Kazmath API at all. -To catch possible errors while overriding methods, subclasses with override methods have the `override` context keyword. -Example: -```cpp -class Sprite : public Node { - bool isFlipY(void) const; - void setFlipY(bool bFlipY); +In cocos2d-x v3.0 we refactored the renderer and we exposed a bit more the Kazmath API to the users. - // Overrides - virtual void setTexture(Texture2D *texture) override; - virtual Texture2D* getTexture() const override; - inline void setBlendFunc(const BlendFunc &blendFunc) override; - inline const BlendFunc& getBlendFunc() const override; -} +And in v3.1, with `Sprite3D` we needed to expose even more the the Kazmath API. And it no longer made sense to have multiple math libraries inside cocos2d-x. + +The problems were: + + * Part of the code was using the old 2D math library + * Part of the code was using Kazmath + * Part of the code was using ad-hoc math code + +The goal was to use only one math library for cocos2d-x, with the following requirements: + * Easy to use, easy to mantain + * Proven + * In C++ if possible + +So we took the [GamePlay3D](http://gameplay3d.org/) math library, we did some minor changes, and the cocos2d-x math code with it. + +How to use it: + +```c++ +// vector2 +Vec2 vec2(10,20); +Vec2 other2(30,40); +auto ret = vec2.cross(other2); +auto ret2 = vec2 + other2; +auto ret3 = vec3 * scalar; + +node->setPosition(vec2); + +// vector3 +Vec3 vec3(30,40,50); +node->setPosition3D(vec3); + +// vector4 +Vec4 vec4 = Vec4::ZERO; + +// Matrix 4x4 +auto identity = Mat4::IDENTITY; +node->setNodeToParentTransform(identity); ``` -## Removed Objective-C patterns - -_Feature added in v3.0-pre-alpha0_ - -### No more 'CC' prefix for C++ classes and free functions - -*Changes in classes* - -Since cocos2d-x already uses the `cocos2d` namespace, there is not need to add the prefix `CC` to all its classes. - -Examples: - - | v2.1 | v3.0 | - | CCSprite | Sprite | - | CCNode | Node | - | CCDirector | Director | - | etc... | - -v2.1 class names are still available, but they were tagged as deprecated. - -*Changes in free functions* - -For the *drawing primitives*: -* They were added in the `DrawPrimitives` namespace -* The `cc` prefix was removed - -For the *gl proxy functions*: -* They were added in the `GL` namespace -* The `ccGL` prefix was removed - -Examples: - - | v2.1 | v3.0 | - | ccDrawPoint() | DrawPrimitives::drawPoint() | - | ccDrawCircle() | DrawPrimitives::drawCircle() | - | ccGLBlendFunc() | GL::blendFunc() | - | ccGLBindTexture2D() | GL::bindTexture2D() | - | etc... | - -v2.1 free functions are still available, but they were tagged as deprecated. +The good news is that the old API still works since we `typedef` the old classes and structs to the new math classes. -### clone() instead of copy() +## New UIVideoPlayer -`clone()` returns an autoreleased version of the copy. - -`copy()` is no longer supported. If you use it, it will compile, but the code will crash. - -Example: -```cpp -// v2.1 -CCMoveBy *action = (CCMoveBy*) move->copy(); -action->autorelease(); - -// v3.0 -// No need to do autorelease, no need to do casting. -auto action = move->clone(); -``` - -### Singletons use getInstance() and destroyInstance() - -All singletons use `getInstance()` and `destroyInstance()` (if applicable) to get and destroy the instance. - -Examples: - - | v2.1 | v3.0 | - | CCDirector->sharedDirector() | Director->getInstance() | - | CCDirector->endDirector() | Director->destroyInstance() | - | etc... | +v3.1 has a new `Node` to play videos. The API is: -v2.1 methods are still available, but they were tagged as deprecated. - -### Object is replaced with Ref - -Because the name `Object` is confused, so rename it to `Ref`, and remove functions that are not related with reference count. All classes that inherit from `Object` now inherit from `Ref`. - -### getters - -Getters now use the `get` prefix. - -Examples: - - | v2.1 | v3.0* | - | node->boundingBox() | node->getBoundingBox() | - | sprite->nodeToParentTransform() | sprite->getNodeToParentTransform() | - | etc... | - -And getters were also tagged as `const` in their declaration. Example: - -```cpp -// v2.1 -virtual float getScale(); - -// v3.0 -virtual float getScale() const; -``` - -v2.1 methods are still available, but they were tagged as deprecated. - -### POD types - -Methods that were receiving POD types as arguments (eg: `TexParams`, `Point`, `Size`, etc.) are being passed as `const` reference. - -Example: -```cpp -// v2.1 -void setTexParameters(ccTexParams* texParams); - -// v3.0 -void setTexParameters(const ccTexParams& texParams); +```c++ +// VideoPlayer is under the "experimental" namespace since +// it only works for iOS and Android, and we might change its +// API in the future +auto videoPlayer = cocos2d::experimental::ui::VideoPlayer::create(); +videoPlayer->setContentSize(Size(x,y)); +videoPlayer->setURL("http://example.com/video.mp4"); +videoPlayer->play(); ``` -## New Renderer - -_Feature added in v3.0-beta and improved in v3.0-beta2_ - -The way currently cocos2d-x v2.2 does rendering is OK but it is difficult to optimize, difficult to add new functionality and difficult to port to new platforms. -So cocos2d-x v3.0 has a new renderer that is more performing, elegant, scalable, flexible but still simple to use and to understand. Also existing cocos2d-x users will find the new API familiar and they will feel immediately comfortable with, without having to bother about what’s changed or what's new under the hood. - -Features of the new renderer: - -- It has been decoupled from the Scene Graph. The `draw()` method, instead of "drawing" it sends a `RenderCommand` to the `Renderer`, and `Renderer` is responsible for drawing the queued `RenderCommand` commands. -- `QuadCommands` (used by `Sprite` and `ParticleSystem` objects) will be automatically batched. -- `CustomCommand` objects allow the user to use custom OpenGL code, using a API similar to v2.2 -- `GroupCommand` objects allow to have "stacks" in the Renderer with different OpenGL values. -- Auto-culling for `Sprite` objects (although, technically, Auto-culling is not performed in `Renderer` code, but in the `Sprite` code) -- Global Z ordering (local Z ordering is still supported) - -For detailed information, please read the following doc: [Renderer Specification document](https://docs.google.com/document/d/17zjC55vbP_PYTftTZEuvqXuMb9PbYNxRFu0EGTULPK8/edit) - -### Renderer features - -#### Auto-batching - -Auto-batching means that the `Renderer` will package "multiple draw calls" in just one "big draw call" (AKA batch). In order to group "draw calls" certain conditions are needed: - -- It only works with `QuadCommand` commands (used by Sprite and ParticleSystem objects) -- The `QuadCommands` must share the same Material ID: same Texture ID, same GLProgram and same blending function -- The `QuadCommands` must consecutive - -If those conditions are met, the `Renderer` will create create a batch (one draw call) with all those `QuadCommand` objects. - -In case you are unfamiliar with the OpenGL best practices, batching is very important to have decent speed in your games. The less batches (draw calls) the more performance your game is going to be. - -#### Auto-culling - -For the moment auto-culling is only implemented on `Sprite` objects. - -When the method `Sprite::draw()` is called, it will check if the `Sprite` is outside the screen. If so, it won't send the `QuadCommand` command to the `Renderer`, and thus, it will gain some performance. - - -#### Global Z order - -A new method called `setGlobalZOrder()` / `getGlobalZOrder()` was added to `Node`, and the old methods `setZOrder()` / `getZOrder()` were renamed to `setLocalZOrder()` / `getLocalZOrder()`. - -`globalZOrder` receives a `float` (and not an `int`) as argument. And this value is used to sort the `RenderCommand` objects in the `Renderer`. Lower values have higher priority over higher values. That means that a Node with a `globalZOrder` of `-10` is going to be drawn BEFORE a Node with `globalZOrder` of `10`. - -Nodes that have a `globalZOrder` of `0` (default value) will be drawn according to the Scene Graph order. - -If the `globalZOrder` is not changed, cocos2d-x v3.0 will behave exactly as cocos2d-x v2.2. - -__`globalZOrder()` vs. `localZOrder()`__: - -* `globalZOrder` is used to sort the "draw commands" in the `Renderer` -* `localZOrder` is used to sort the `Node` objects in its parent's children Array - -__Exceptions__: +## UI navigation TODO -### Sprite vs. SpriteBatchNode +## Improved folder structure -In v2.2 the recommended way to have good performance was to parent `Sprite` objects to a `SpriteBatchNode` object. -Although the performance was (is still) very good by using `SpriteBatchNode` objects, they had (still have) some limitations like: +In v3.0 we started a folder re-organization for cocos2d-x. Unfortunately we didn't have the time to finish it on time. -- `Sprite` objects can only have `Sprite` objects as children (if not, cocos2d-x will raise an Assert) - - You cannot add a `ParticleSystem` as a child of `Sprite`, when the `Sprite` is parented to a `SpriteBatchNode` - - As a consequence of that, you cannot use `ParallaxNode` with `Sprites` parented to `SpriteBatchNode` -- All `Sprite` objects must share the same TextureId (if not, cocos2d-x will raise an Assert) -- `Sprite` objects use the `SpriteBatchNode`'s blending function and shader. +In v3.1 we finished the folder re-organization, and it looks like this: + cocos/: includes cocos2d.cpp and other build files + cocos/2d/: includes base nodes, 2d nodes and related objects like Node, Scene, Sprite, etc. + cocos/3d/: includes 3d nodes and related objects like Sprite3D + cocos/audio/: sound and music related objects + cocos/math/: math related objects + cocos/platform/: platform specific objects + cocos/renderer/: GPU related objects like Renderer, Texture2D, Render Commands, etc. + cocos/physcis/: physics related objects + cocos/network/: network retlated objects + cocos/editor-support/: 3rd party editors file format -And although v3.0 still supports `SpriteBatchNode` (with the same features and limitations), we no longer encourage its usage. Instead, we recommend to use `Sprite` objects without parenting them to a `SpriteBatchNode`. +## Particle System fixes -But in order to have a very good performance in v3.0, you have to make sure that your `Sprite` objects: +cocos2d-x v3.0 and earlier versions had a bug in `ParticleSystem` where the the Y-flipped parameter was not calculated correctly. -- Share the same TextureId (place them in a spritesheet, like if you were using a `SpriteBatchNode`) -- Make sure all of them use the same shader and blending function (like if you were using a `SpriteBatchNode`) +We fixed that bug in v3.1. The problem is that fixing this bug breaks backward compatiblility in particles that were relying on the broken behavior. -If you do so, the `Sprites` will perform almost as fast as to using `SpriteBatchNode`... (about 10% slower on old devices. On newer devices the difference is almost imperceptible) +In order to try to make the transition easier to v3.1, we created a tool that fixes the broken particle system files. How to use it: -The big differences between v2.2 and v3.0 are: - -- `Sprite` objects can have different Texture IDs. -- `Sprite` objects can have any kind of `Node` as children, including `ParticleSystem`. -- `Sprite` objects can have different blending functions and use different shaders. - -But if you do that, the `Renderer` might not be able to batch all its children (less performant). But the game will keep running, without raising any Assert. - -__To summarize__: - -- Keep putting all your sprites in a big spritesheet -- Use the same Blending Function (just use the default one) -- Use the same Shader (just use the default one) -- And don't parent your sprites to a `SpriteBatchNode` - -Only use `SpriteBatchNode` as the last resort, when you really need an extra (although minor) boost in performance (and you are OK with its limitations). - - -## Improved LabelTTF / LabelBMFont / LabelAtlas - -_Feature added in v3.0-alpha0_ - -`LabelTTF`, `LabelBMFont` and `LabelAtlas` will be replaced by new `Label`. The benefits of new `Label` are: - -* uniform api to create `LabelTTF`, `LabelBMFont` and `LabelAtlas` -* use `freetype` to generate texture for labels, which make sure that labels have the same effect on different platforms -* will cache textures to improve performance - -## New EventDispatcher - -_Feature added in v3.0-alpha0_ - -All events such as touch event, keyboard event, acceleration event and custom event are dispatched by `EventDispatcher`. -`TouchDispatcher`, `KeypadDispatcher`, `KeyboardDispatcher`, `AccelerometerDispatcher` were removed. - -Features of `EventDispatcher` are: - -* dispatch events based on rendering sequence -* all events are dispatched by `EventDispatcher` -* can use `EventDispatcher` to dispatch custom events -* can register a lambda as call back function - -Detail information of `EventDispatcher` can refer to [this document](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/input/event-dispatcher/en.md). - -## Physics Integration - -_Feature added in v3.0-pre-alpha0_ - -In v3.0, we integrate physics engine into cocos2d-x based on [Chipmunk2D](https://chipmunk-physics.net/). By using this feature, you can create physics based games without understanding physics engine. - -More detail information of this feature, please refer to [this document](https://github.com/cocos2d/cocos-docs/blob/master/manual/framework/native/physics/physics-integration/en.md) + # Will convert broken .plist files into fixed ones. + # Will generate a backup file of the converted files + $ cocos/tools/particle/convert_YCoordFlipped.py *.plist # Misc API Changes -## `ccTypes.h` - -Remove *cc* prefix for structure names in ccTypes.h, move global functions into static member functions, and move global constants into const static member variables. - - | v2.1 struct names | v3.0 struct names | - | ccColor3B | Color3B | - | ccColor4B | Color4B | - | ccColor4F | Color4F | - | ccVertex2F | Vertex2F | - | ccVertex3F | Vertex3F | - | ccTex2F | Tex2F | - | ccPointSprite | PointSprite | - | ccQuad2 | Quad2 | - | ccQuad3 | Quad3 | - | ccV2F_C4B_T2F | V2F_C4B_T2F | - | ccV2F_C4F_T2F | V2F_C4F_T2F | - | ccV3F_C4B_T2F | V3F_C4B_T2F | - | ccV2F_C4B_T2F_Triangle | V2F_C4B_T2F_Triangle | - | ccV2F_C4B_T2F_Quad | V2F_C4B_T2F_Quad | - | ccV3F_C4B_T2F_Quad | V3F_C4B_T2F_Quad | - | ccV2F_C4F_T2F_Quad | V2F_C4F_T2F_Quad | - | ccBlendFunc | BlendFunc | - | ccT2F_Quad | T2F_Quad | - | ccAnimationFrameData | AnimationFrameData | - -Global functions changed example -```c++ -// in v2.1 -ccColor3B color3B = ccc3(0, 0, 0); -ccc3BEqual(color3B, ccc3(1, 1, 1)); -ccColor4B color4B = ccc4(0, 0, 0, 0); -ccColor4F color4F = ccc4f(0, 0, 0, 0); -color4F = ccc4FFromccc3B(color3B); -color4F = ccc4FFromccc4B(color4B); -ccc4FEqual(color4F, ccc4F(1, 1, 1, 1)); -color4B = ccc4BFromccc4F(color4F); - -color3B = ccWHITE; - -// in v3.0 -Color3B color3B = Color3B(0, 0, 0); -color3B.equals(Color3B(1, 1, 1)); -Color4B color4B = Color4B(0, 0, 0, 0); -Color4F color4F = Color4F(0, 0, 0, 0); -color4F = Color4F(color3B); -color4F = Color4F(color4B); -color4F.equals(Color4F(1, 1, 1, 1)); -color4B = Color4B(color4F); - -color3B = Color3B::WHITE; -``` - ## deprecated functions and global variables - | v2.1 names | v3.0 names | - | ccp | Point | - | ccpNeg | Point::- | - | ccpAdd | Point::+ | - | ccpSub | Point::- | - | ccpMult | Point::* | - | ccpMidpoint | Point::getMidpoint | - | ccpDot | Point::dot | - | ccpCrosss | Point::cross | - | ccpPerp | Point::getPerp | - | ccpRPerp | Point::getRPerp | - | ccpProject | Point::project | - | ccpRotate | Point::rotate | - | ccpUnrotate | Point::unrotate | - | ccpLengthSQ | Point::getLengthSq() | - | ccpDistanceSQ | Point::getDistanceSq | - | ccpLength | Point::getLength | - | ccpDistance | Point::getDistance | - | ccpNormalize | Point::normalize | - | ccpForAngle | Point::forAngle | - | ccpToAngle | Point::getAngle | - | ccpClamp | Point::getClampPoint | - | ccpFromSize | Point::Point | - | ccpCompOp | Point::compOp | - | ccpLerp | Point::lerp | - | ccpFuzzyEqual | Point::fuzzyEqual | - | ccpCompMult | Point::Point | - | ccpAngleSigned | Point::getAngle | - | ccpAngle | Point::getAngle | - | ccpRotateByAngle | Point::rotateByAngle | - | ccpLineInersect | Point::isLineIntersect | - | ccpSegmentIntersect | Point::isSegmentIntersect | - | ccpIntersectPoint | Point::getIntersectPoint | - | CCPointMake | Point::Point | - | CCSizeMake | Size::Size | - | CCRectMake | Rect::Rect | - | PointZero | Point::ZERO | - | SizeZero | Size::ZERO | - | RectZero | Rect::ZERO | - | TiledGrid3DAction::tile | TiledGrid3DAction::getTile | - | TiledGrid3DAction::originalTile | TiledGrid3DAction::getOriginalTile | - | TiledGrid3D::tile | TiledGrid3D::getTile | - | TiledGrid3D::originalTile | TiledGrid3D::getOriginalTile | - | Grid3DAction::vertex | Grid3DAction::getVertex | - | Grid3DAction::originalVertex | Grid3DAction::getOriginalVertex | - | Grid3D::vertex | Grid3D::getVertex | - | Grid3D::originalVertex | Grid3D::getOriginalVertex | - | Configuration::sharedConfiguration | Configuration::getInstance | - | Configuration::purgeConfiguration | Configuration::destroyInstance() | - | Director::sharedDirector() | Director::getInstance() | - | FileUtils::sharedFileUtils | FileUtils::getInstance | - | FileUtils::purgeFileUtils | FileUtils::destroyInstance | - | GLView::sharedOpenGLView | GLView::getInstance | - | ShaderCache::sharedShaderCache | GLProgramCache::getInstance | - | ShaderCache::purgeSharedShaderCache | ShaderCache::destroyInstance | - | AnimationCache::sharedAnimationCache | AnimationCache::getInstance | - | AnimationCache::purgeSharedAnimationCache | AnimationCache::destroyInstance | - | SpriteFrameCache::sharedSpriteFrameCache | SpriteFrameCache::getInstance | - | SpriteFrameCache:: purgeSharedSpriteFrameCache | SpriteFrameCache::destroyInstance | - | NotificationCenter::sharedNotificationCenter | NotificationCenter::getInstance | - | NotificationCenter:: purgeNotificationCenter | NotificationCenter::destroyInstance | - | Profiler::sharedProfiler | Profiler::getInstance | - | UserDefault::sharedUserDefault | UserDefault::getInstance | - | UserDefault::purgeSharedUserDefault | UserDefault::destroyInstance | - | Application::sharedApplication | Application::getInstance | - | ccc3() | Color3B() | - | ccc3BEqual() | Color3B::equals() | - | ccc4() | Color4B() | - | ccc4FFromccc3B() | Color4F() | - | ccc4f() | Color4F() | - | ccc4FFromccc4B() | Color4F() | - | ccc4BFromccc4F() | Color4B() | - | ccc4FEqual() | Color4F::equals() | - | ccWHITE | Color3B::WHITE | - | ccYELLOW | Color3B::YELLOW | - | ccBLUE | Color3B::BLUE | - | ccGREEN | Color3B::GREEN | - | ccRED | Color3B::RED | - | ccMAGENTA | Color3B::MAGENTA | - | ccBLACK | Color3B::BLACK | - | ccORANGE | Color3B::ORANGE | - | ccGRAY | Color3B::GRAY | - | kBlendFuncDisable | BlendFunc::BLEND_FUNC_DISABLE | - -# Changes in the Lua bindings - -## Use bindings-generator tool for lua binding - -Only have to write an ini file for a module, don't have to write a lot of .pkg files - -### Bind the classes with namespace to lua - -In previous, the lua binding can not bind classes that have the same class name but different namespaces. In order to resolve this issue, now the metatable name of a class is changed. For example, `CCNode` will be changed to `cc.Node`. This modification will affect some APIs as follows: - - | v2.x | v3.0 | - | tolua_usertype(tolua_S,"CCNode") | tolua_usertype(tolua_S,"cc.Node") | - | tolua_isusertable(tolua_S,1,"CCNode",0,&tolua_err | tolua_isusertable(tolua_S,1,"cc.Node",0,&tolua_err | - | tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) | tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err) | - | toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CCNode") | toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Node") | - | tolua_pushusertype(tolua_S,(void*)tolua_ret,"CCFileUtils") | tolua_pushusertype(tolua_S,(void*)tolua_ret,"cc.FileUtils") | - | tolua.cast(pChildren[i + 1], "CCNode") | tolua.cast(pChildren[i + 1], "cc.Node") | - -### Use ScriptHandlerMgr to manage the register and unregister of Lua function - -When we want to add register and unregister functions of Lua function for class, we need to change the declarative and defined files and then bind to Lua. -In v3.0, we use the `ScriptHandlerMgr`. As an example, lets see the `MenuItem` class: -In the 2.x version, we needed to add a declaration in the MenuItem header file: -```c++ - virtual void registerScriptTapHandler(int nHandler); - virtual void unregisterScriptTapHandler(void); -``` -then implement them in the .cpp file. In the Lua script ,we use it as follow: -```lua -menuItem:registerScriptTapHandler(luafunction) -``` - -In v3.0 version, we only need to add the `HandlerType` enum in the `ScriptHandlerMgr`, and the implementation in luascript as follow: -```lua -ScriptHandlerMgr:getInstance():registerScriptHandler(menuItem, luafunction,cc.HANDLERTYPE_MENU_CLICKED) -``` - -## Misc API changes - -### Use `cc`、`ccs`、`ccui` `gl` and `sp` as module name - -Now classes are bound into different modules instead of using global module. This will avoid conflicts with other codes. - -* classes in `cocos2d`、`cocos2d::extension`、`CocosDenshion` and `cocosbuilder` were bound to `cc` module -* classes in `cocos2d::ui` were bound to `ccui` module -* classes in `spine` were bound to `sp` module -* classes in `cocostudio` were bound to `ccs` module -* global variables are bound to corresponding modules -* all funcionts and constants about `openGl` were bound to `gl` module - -Examples: - - | v2.1 | v3.0 | - | CCDirector | cc.Director | - | CCArmature | ccs.Armature | - | kCCTextAlignmentLeft | cc.kCCTextAlignmentLeft | - -### Modified functions - -Some global function names are renamed: - -Examples: - - | v2.1 | v3.0 | - | CCPoint/ccp | cc.p | - | CCRect | cc.rect | - | CCColor3B | cc.c3b | - | CCColor4B | cc.c4b | - | CCColor4F | cc.c4f | - -### Add some modules - -In the version 3.0, more modules were bound to lua, specific as follows: - -* physics -* spine -* XMLHttpRequest -* OpenGL - -The `XMLHttpRequest` and `physics` are in the `cc` module, the `spine` is in the `sp` module, and the `OpenGL` is in the `gl` module. Related test cases located in: - -* physics ---> TestLua/PhysicsTest -* spine ---> TestLua/SpineTest -* XMLHttpRequest ---> TestLua/XMLHttpRequestTest -* openGL ---> TestLua/OpenGLTest - -### Add more lua bindings -Such as: New Label、New EventDispatcher and AssetsManager,etc.Related test cases located in: - -* New Label ---> TestLua/LabelTestNew -* New EventDispatcher --->TestLua/NewEventDispatcherTest -* AssetsManager ---> TestLua/AssetsManagerTest - -### Replace some lua-bindings of Class or Struct with lua table -In the version 3.0, all the lua-binding of Struct type were replaced with the lua table - -Examples: - - | v2.1 | v3.0 | - | CCPoint | lua table | - | CCRect | lua table | - | CCColor3B | lua table | - | CCColor4B | lua table | - | CCColor4F | lua table | - | CCAffineTransform | lua table | - | CCArray | lua table | - | CCDictionary | lua table | - | CCPointArray | lua table | - -### Support lua script codes call Object-C codes and Java codes -`LuaObjcBridge` and `LuaJavaBridge` bound to lua supported lua script codes calls Object-C codes and java codes. - -### Add some lua files to store the constants of different modules - -* Cocos2DConstants.lua store the constants of `cc` module -* StudioConstants.lua store the constants of `ccs` module -* GuiConstants.lua store the constants of `ccui` module -* OpenglConstants.lua store the constants of `gl` module +TODO: The old Math API \ No newline at end of file From 845d45882971b2f1f4fb9d2a438a0c1d6b2ad6df Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 17:02:30 -0700 Subject: [PATCH 38/90] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 8b27827e08..4b7404b5de 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -2,6 +2,28 @@ **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* +- [Misc Information](#user-content-misc-information) +- [Requirements](#user-content-requirements) + - [Runtime Requirements](#user-content-runtime-requirements) + - [Compiler Requirements](#user-content-compiler-requirements) + - [How to run tests](#user-content-how-to-run-tests) + - [Mac OSX & iOS](#user-content-mac-osx--ios) + - [Android](#user-content-android) + - [Windows](#user-content-windows) + - [Linux](#user-content-linux) + - [How to start a new game](#user-content-how-to-start-a-new-game) +- [Highlights of v3.1](#user-content-highlights-of-v31) +- [Features in detail](#user-content-features-in-detail) + - [Sprite3D](#user-content-sprite3d) + - [Improved Shader Subsystem](#user-content-improved-shader-subsystem) + - [New math library](#user-content-new-math-library) + - [New UIVideoPlayer](#user-content-new-uivideoplayer) + - [UI navigation](#user-content-ui-navigation) + - [Improved folder structure](#user-content-improved-folder-structure) + - [Particle System fixes](#user-content-particle-system-fixes) +- [Misc API Changes](#user-content-misc-api-changes) + - [deprecated functions and global variables](#user-content-deprecated-functions-and--global-variables) + # Misc Information * Download: http://cdn.cocos2d-x.org/cocos2d-x-3.1rc0.zip @@ -277,4 +299,4 @@ In order to try to make the transition easier to v3.1, we created a tool that fi ## deprecated functions and global variables -TODO: The old Math API \ No newline at end of file +TODO: The old Math API From a77086a41aba696b3f059b5a7741fcfd5763b17b Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 17:03:53 -0700 Subject: [PATCH 39/90] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 4b7404b5de..5c4dd29f12 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -40,7 +40,7 @@ * OS X 10.7 or newer * Windows 7 or newer * Windows Phone 8 or newer -* Linux Ubuntu 12.04 (or newer) +* Linux Ubuntu 12.04 or newer * ~~Browsers via Emscripten~~ N/A for the moment ## Compiler Requirements From cc73c59a9fcb5eed078beedcece2d23c72ada8e8 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 17:05:05 -0700 Subject: [PATCH 40/90] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 5c4dd29f12..e04fadf0de 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -113,8 +113,7 @@ Run ## How to start a new game -Please refer to [ReadMe](../README.md). And there is a [document](https://github.com/chukong/cocos-docs/blob/master/manual/framework/native/getting-started/v3.0/how-to-start-a-new-game/en.md) for it. - +Please refer to this document: [ReadMe](../README.md) # Highlights of v3.1 From d12fdc057b677a5acc8ac5cfd4971e5508ecfce7 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 17:06:30 -0700 Subject: [PATCH 41/90] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index e04fadf0de..b0dd872d0a 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -158,7 +158,7 @@ In v3.1, we decoupled the shader state from the shader. We added the `GLProgramS The API is the following: -``` +```c++ auto glprogram = GLProgram::create(...); // it will automatically parse all the attributes and uniforms From 65e25898e403d6b9f9f6fe9c86ceb0c5935c6864 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Mon, 19 May 2014 17:12:18 -0700 Subject: [PATCH 42/90] Update RELEASE_NOTES.md --- docs/RELEASE_NOTES.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index b0dd872d0a..96c1beaa46 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -7,10 +7,6 @@ - [Runtime Requirements](#user-content-runtime-requirements) - [Compiler Requirements](#user-content-compiler-requirements) - [How to run tests](#user-content-how-to-run-tests) - - [Mac OSX & iOS](#user-content-mac-osx--ios) - - [Android](#user-content-android) - - [Windows](#user-content-windows) - - [Linux](#user-content-linux) - [How to start a new game](#user-content-how-to-start-a-new-game) - [Highlights of v3.1](#user-content-highlights-of-v31) - [Features in detail](#user-content-features-in-detail) From 28c3752641fa8f04f01ec63fb0fc2828cd779f2f Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 09:36:17 +0800 Subject: [PATCH 43/90] issue #5183, refacotr some variable names --- cocos/ui/UILayoutExecutant.cpp | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index 91cc3e2def..5bd30dc4b6 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -252,9 +252,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getTopBoundary(); + float locationTop = relativeWidget->getTopBoundary(); float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationBottom + ap.y * cs.height; + finalPosY = locationTop + ap.y * cs.height; finalPosX = locationLeft + ap.x * cs.width; } break; @@ -266,9 +266,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationBottom = relativeWidget->getTopBoundary(); + float locationTop = relativeWidget->getTopBoundary(); - finalPosY = locationBottom + ap.y * cs.height; + finalPosY = locationTop + ap.y * cs.height; finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; } break; @@ -279,9 +279,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationBottom = relativeWidget->getTopBoundary(); + float locationTop = relativeWidget->getTopBoundary(); float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationBottom + ap.y * cs.height; + finalPosY = locationTop + ap.y * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } break; @@ -293,9 +293,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationTop = relativeWidget->getTopBoundary(); - float locationRight = relativeWidget->getLeftBoundary(); + float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; + finalPosX = locationLeft - (1.0f - ap.x) * cs.width; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: @@ -306,8 +306,8 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationRight = relativeWidget->getLeftBoundary(); - finalPosX = locationRight - (1.0f - ap.x) * cs.width; + float locationLeft = relativeWidget->getLeftBoundary(); + finalPosX = locationLeft - (1.0f - ap.x) * cs.width; finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; } @@ -320,9 +320,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationBottom = relativeWidget->getBottomBoundary(); - float locationRight = relativeWidget->getLeftBoundary(); + float locationLeft = relativeWidget->getLeftBoundary(); finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; + finalPosX = locationLeft - (1.0f - ap.x) * cs.width; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: @@ -333,9 +333,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationTop = relativeWidget->getTopBoundary(); - float locationLeft = relativeWidget->getRightBoundary(); + float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationLeft + ap.x * cs.width; + finalPosX = locationRight + ap.x * cs.width; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: @@ -346,8 +346,8 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationLeft = relativeWidget->getRightBoundary(); - finalPosX = locationLeft + ap.x * cs.width; + float locationRight = relativeWidget->getRightBoundary(); + finalPosX = locationRight + ap.x * cs.width; finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; } @@ -360,9 +360,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } float locationBottom = relativeWidget->getBottomBoundary(); - float locationLeft = relativeWidget->getRightBoundary(); + float locationRight = relativeWidget->getRightBoundary(); finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationLeft + ap.x * cs.width; + finalPosX = locationRight + ap.x * cs.width; } break; case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: @@ -372,9 +372,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getBottomBoundary(); + float locationBottom = relativeWidget->getBottomBoundary(); float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosY = locationBottom - (1.0f - ap.y) * cs.height; finalPosX = locationLeft + ap.x * cs.width; } break; @@ -386,9 +386,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) continue; } Size rbs = relativeWidget->getSize(); - float locationTop = relativeWidget->getBottomBoundary(); + float locationBottom = relativeWidget->getBottomBoundary(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosY = locationBottom - (1.0f - ap.y) * cs.height; finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; } break; @@ -399,9 +399,9 @@ void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { continue; } - float locationTop = relativeWidget->getBottomBoundary(); + float locationBottom = relativeWidget->getBottomBoundary(); float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosY = locationBottom - (1.0f - ap.y) * cs.height; finalPosX = locationRight - (1.0f - ap.x) * cs.width; } break; From fe01d12a210520f108599dbcd4cd5ec62c4001fe Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 09:39:05 +0800 Subject: [PATCH 44/90] issue #5183, fix android compile error --- cocos/ui/Android.mk | 1 + cocos/ui/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 73d31dff76..868b2a9dd1 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -9,6 +9,7 @@ LOCAL_SRC_FILES := \ UIWidget.cpp \ UILayout.cpp \ UILayoutParameter.cpp \ +UILayoutExecutant.cpp \ CocosGUI.cpp \ UIHelper.cpp \ UIListView.cpp \ diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index 50f088b80a..fd92084a94 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -8,6 +8,7 @@ set(COCOS_UI_SRC ui/UIImageView.cpp ui/UILayout.cpp ui/UILayoutParameter.cpp + ui/UILayoutExecutant.cpp ui/UIListView.cpp ui/UILoadingBar.cpp ui/UIPageView.cpp From e0192e2a1bc7192ad41b01286de269d96e037e53 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 09:59:12 +0800 Subject: [PATCH 45/90] issue #5183, fix win32 compile error --- cocos/ui/proj.win32/libGUI.vcxproj | 2 ++ cocos/ui/proj.win32/libGUI.vcxproj.filters | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/cocos/ui/proj.win32/libGUI.vcxproj b/cocos/ui/proj.win32/libGUI.vcxproj index dab438d560..ee4ba81fb8 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj +++ b/cocos/ui/proj.win32/libGUI.vcxproj @@ -19,6 +19,7 @@ + @@ -44,6 +45,7 @@ + diff --git a/cocos/ui/proj.win32/libGUI.vcxproj.filters b/cocos/ui/proj.win32/libGUI.vcxproj.filters index 65f4a3a52c..28a105b739 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj.filters +++ b/cocos/ui/proj.win32/libGUI.vcxproj.filters @@ -87,6 +87,9 @@ Layouts + + Layouts + @@ -155,5 +158,8 @@ Layouts + + Layouts + \ No newline at end of file From aab2bf5371ccc055b1188536e4f97a268c3009bb Mon Sep 17 00:00:00 2001 From: lm Date: Tue, 20 May 2014 10:03:09 +0800 Subject: [PATCH 46/90] [Jenkins][ci skip] A missing import to ci-release-test.py --- tools/jenkins-scripts/ci-release-test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/jenkins-scripts/ci-release-test.py b/tools/jenkins-scripts/ci-release-test.py index e1c190f5a2..bb8aad08a1 100644 --- a/tools/jenkins-scripts/ci-release-test.py +++ b/tools/jenkins-scripts/ci-release-test.py @@ -12,6 +12,7 @@ import traceback import platform import subprocess import codecs +from shutil import copy #set Jenkins build description using submitDescription to mock browser behavior #TODO: need to set parent build description From 432f688a677ce763983e821638297c0629058038 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 10:16:19 +0800 Subject: [PATCH 47/90] issue #5183, refactor --- cocos/ui/UILayout.cpp | 10 +++++----- cocos/ui/UILayout.h | 10 +++++----- cocos/ui/UILayoutExecutant.cpp | 12 ++++++------ cocos/ui/UIScrollView.cpp | 12 ++++++++++++ cocos/ui/UIScrollView.h | 1 + cocos/ui/UIWidget.h | 2 +- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index f7ff08967f..751ec40741 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -929,12 +929,12 @@ void Layout::requestDoLayout() _doLayoutDirty = true; } -const Size Layout::getLayoutSize() +const Size Layout::getLayoutContentSize() { return this->getSize(); } -const Vector& Layout::getLayoutChildren() +const Vector& Layout::getLayoutElements() { return this->getChildren(); } @@ -1031,7 +1031,7 @@ bool Layout::isPassFocusToChild() return _passFocusToChild; } -Size Layout::getLayoutContentSize()const +Size Layout::getLayoutAccumulatedSize()const { const auto& children = this->getChildren(); Size layoutSize = Size::ZERO; @@ -1041,7 +1041,7 @@ Size Layout::getLayoutContentSize()const Layout *layout = dynamic_cast(widget); if (nullptr != layout) { - layoutSize = layoutSize + layout->getLayoutContentSize(); + layoutSize = layoutSize + layout->getLayoutAccumulatedSize(); } else { @@ -1072,7 +1072,7 @@ Vec2 Layout::getWorldCenterPoint(Widget* widget) { Layout *layout = dynamic_cast(widget); //FIXEDME: we don't need to calculate the content size of layout anymore - Size widgetSize = layout ? layout->getLayoutContentSize() : widget->getSize(); + Size widgetSize = layout ? layout->getLayoutAccumulatedSize() : widget->getSize(); // CCLOG("contnet size : width = %f, height = %f", widgetSize.width, widgetSize.height); return widget->convertToWorldSpace(Vec2(widgetSize.width/2, widgetSize.height/2)); } diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index 497a33b229..cb4c0f37e3 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -40,8 +40,8 @@ public: virtual ~LayoutProtocol(){} virtual LayoutExecutant* createLayoutExecutant() = 0; - virtual const Size getLayoutSize() = 0; - virtual const Vector& getLayoutChildren() = 0; + virtual const Size getLayoutContentSize() = 0; + virtual const Vector& getLayoutElements() = 0; virtual void doLayout() = 0; }; @@ -329,8 +329,8 @@ protected: virtual void doLayout()override; virtual LayoutExecutant* createLayoutExecutant()override; - virtual const Size getLayoutSize()override; - virtual const Vector& getLayoutChildren() override; + virtual const Size getLayoutContentSize()override; + virtual const Vector& getLayoutElements() override; //clipping void onBeforeVisitStencil(); @@ -346,7 +346,7 @@ protected: /** *get the content size of the layout, it will accumulate all its children's content size */ - Size getLayoutContentSize() const; + Size getLayoutAccumulatedSize() const; /** * When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp index 5bd30dc4b6..30ac2f2e0b 100644 --- a/cocos/ui/UILayoutExecutant.cpp +++ b/cocos/ui/UILayoutExecutant.cpp @@ -67,8 +67,8 @@ RelativeLayoutExecutant* RelativeLayoutExecutant::create() void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) { - Size layoutSize = layout->getLayoutSize(); - Vector container = layout->getLayoutChildren(); + Size layoutSize = layout->getLayoutContentSize(); + Vector container = layout->getLayoutElements(); float topBoundary = layoutSize.height; for (auto& subWidget : container) @@ -111,8 +111,8 @@ void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) { - Size layoutSize = layout->getLayoutSize(); - Vector container = layout->getLayoutChildren(); + Size layoutSize = layout->getLayoutContentSize(); + Vector container = layout->getLayoutElements(); float leftBoundary = 0.0f; for (auto& subWidget : container) { @@ -153,8 +153,8 @@ void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) { - Size layoutSize = layout->getLayoutSize(); - Vector container = layout->getLayoutChildren(); + Size layoutSize = layout->getLayoutContentSize(); + Vector container = layout->getLayoutElements(); ssize_t unlayoutChildCount = 0; Vector widgetChildren; for (auto& subWidget : container) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 07d1c976b1..601dca158f 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -50,6 +50,18 @@ ScrollInnerContainer* ScrollInnerContainer::create() return nullptr; } +const Size& ScrollInnerContainer::getLayoutSize() +{ + Widget* parent = getWidgetParent(); + if (parent) + { + return parent->getSize(); + } + else + { + return _size; + } +} static const float AUTOSCROLLMAXSPEED = 1000.0f; diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 8009c6d071..57c94326f9 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -38,6 +38,7 @@ public: ScrollInnerContainer(); virtual ~ScrollInnerContainer(); static ScrollInnerContainer* create(); + virtual const Size& getLayoutSize() override; }; CC_DEPRECATED_ATTRIBUTE typedef enum diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 718336168f..e333a3da59 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -441,7 +441,7 @@ public: const Size& getCustomSize() const; - //virtual const Size& getLayoutSize() {return _size;}; + virtual const Size& getLayoutSize() {return _size;}; /** * Returns size percent of widget From 993b735392b642e1ebad101e84509ae6a3033c22 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 10:24:22 +0800 Subject: [PATCH 48/90] closed #5183, done --- cocos/ui/UIWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 71de114da7..864eac6c09 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -235,7 +235,7 @@ void Widget::updateSizeAndPosition() Size pSize; if (widgetParent) { - pSize = widgetParent->getSize(); + pSize = widgetParent->getLayoutSize(); } else { From 2b3f236792d9f8c01128343e8344c146620ec133 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 20 May 2014 10:47:27 +0800 Subject: [PATCH 49/90] Support generate release apk with prebuilt libs. --- .../cocos-project-template.json | 38 +++++++++++++++---- tools/cocos2d-console | 2 +- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/templates/lua-template-runtime/cocos-project-template.json b/templates/lua-template-runtime/cocos-project-template.json index fe0b0c07c0..a6c20e1960 100644 --- a/templates/lua-template-runtime/cocos-project-template.json +++ b/templates/lua-template-runtime/cocos-project-template.json @@ -5,13 +5,41 @@ "runtime/config.json", "runtime/version.json" ], + "append_from_template": { + "from": "frameworks/runtime-src/proj.android", + "to": "frameworks/runtime-src/proj.android", + "exclude": [ + "bin", + "assets" + ] + }, "project_replace_project_name": { "src_project_name": "HelloLua", "files": [ "config.json", - ".project"] + ".project", + "frameworks/runtime-src/proj.android/.project", + "frameworks/runtime-src/proj.android/AndroidManifest.xml", + "frameworks/runtime-src/proj.android/build.xml", + "frameworks/runtime-src/proj.android/res/values/strings.xml" + ] }, "append_dir": [ + { + "from": "cocos/platform/android/java", + "to": "frameworks/cocos2d-x/cocos/platform/android/java" + }, + { + "from": "cocos/scripting/lua-bindings/script", + "to": "frameworks/cocos2d-x/cocos/scripting/lua-bindings/script" + }, + { + "from": "external/lua/luasocket", + "to": "frameworks/cocos2d-x/external/lua/luasocket", + "include": [ + "*.lua" + ] + }, { "from": "cocos/scripting/lua-bindings/script", "to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources", @@ -104,9 +132,7 @@ "from": "frameworks/runtime-src", "to": "frameworks/runtime-src", "exclude": [ - "proj.android/bin", - "proj.android/assets", - "proj.android/libs", + "proj.android", "proj.ios_mac/HelloLua.xcodeproj/project.xcworkspace", "proj.ios_mac/HelloLua.xcodeproj/xcuserdata", "proj.win32/Debug.win32", @@ -139,10 +165,6 @@ "frameworks/runtime-src/proj.win32/PROJECT_NAME.sln", "frameworks/runtime-src/proj.win32/main.cpp", "frameworks/runtime-src/proj.win32/Runtime_win32.cpp", - "frameworks/runtime-src/proj.android/.project", - "frameworks/runtime-src/proj.android/AndroidManifest.xml", - "frameworks/runtime-src/proj.android/build.xml", - "frameworks/runtime-src/proj.android/res/values/strings.xml", "frameworks/runtime-src/proj.ios_mac/ios/main.m", "frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch", "frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm", diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 9f8d41077f..d66f714b4e 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 9f8d41077f67a81928acaa9bca4fea1c705b9104 +Subproject commit d66f714b4e88199641ea768e107855012652db17 From 41bc599b123b34866974f728c8447c92fb41f198 Mon Sep 17 00:00:00 2001 From: lm Date: Tue, 20 May 2014 10:58:59 +0800 Subject: [PATCH 50/90] [Jenkins][ci skip] Fix external lib to support ci release --- tools/jenkins-scripts/ci-release-test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/jenkins-scripts/ci-release-test.py b/tools/jenkins-scripts/ci-release-test.py index bb8aad08a1..29fed30ee5 100644 --- a/tools/jenkins-scripts/ci-release-test.py +++ b/tools/jenkins-scripts/ci-release-test.py @@ -122,9 +122,6 @@ def main(): if(ret != 0): return(2) - #copy check_current_3rd_libs - check_current_3rd_libs(branch) - #build #TODO: add android-linux build #TODO: add mac build @@ -140,6 +137,8 @@ def main(): os.system('git reset --hard') os.system("git clean -xdf -f") make_temp_dir() + #copy check_current_3rd_libs + check_current_3rd_libs(branch) if(branch == 'v3'): # Generate binding glue codes ret = os.system("python tools/jenkins-scripts/gen_jsb.py") From cbda99653d2229b78fa59bc9d41ace3608617de0 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 04:08:17 +0000 Subject: [PATCH 51/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index da6b76ab1c..6a04f638f6 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -938,6 +938,8 @@ "cocos/ui/UIImageView.h", "cocos/ui/UILayout.cpp", "cocos/ui/UILayout.h", + "cocos/ui/UILayoutExecutant.cpp", + "cocos/ui/UILayoutExecutant.h", "cocos/ui/UILayoutParameter.cpp", "cocos/ui/UILayoutParameter.h", "cocos/ui/UIListView.cpp", From 2c47eae1a06a9161541fe88d9060872a14e83460 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 04:10:28 +0000 Subject: [PATCH 52/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Layout.lua | 2 +- .../lua-bindings/auto/api/Widget.lua | 57 ++- .../auto/lua_cocos2dx_ui_auto.cpp | 383 +++++++++--------- 3 files changed, 219 insertions(+), 223 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Layout.lua b/cocos/scripting/lua-bindings/auto/api/Layout.lua index 025ed662ee..e104964c8d 100644 --- a/cocos/scripting/lua-bindings/auto/api/Layout.lua +++ b/cocos/scripting/lua-bindings/auto/api/Layout.lua @@ -1,7 +1,7 @@ -------------------------------- -- @module Layout --- @extend Widget +-- @extend Widget,LayoutProtocol -------------------------------- -- @function [parent=#Layout] setBackGroundColorVector diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index aba6a759a2..25732c5521 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -1,8 +1,13 @@ -------------------------------- -- @module Widget --- @extend ProtectedNode +-- @extend ProtectedNode,LayoutParameterProtocol +-------------------------------- +-- @function [parent=#Widget] clone +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + -------------------------------- -- @function [parent=#Widget] setSizePercent -- @param self @@ -14,9 +19,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- @function [parent=#Widget] setFlippedY +-- @function [parent=#Widget] getLeftBoundary -- @param self --- @param #bool bool +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] setFlippedX @@ -24,9 +29,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getLeftInParent +-- @function [parent=#Widget] getVirtualRenderer -- @param self --- @return float#float ret (return value: float) +-- @return Node#Node ret (return value: cc.Node) -------------------------------- -- @function [parent=#Widget] getTouchEndPos @@ -64,9 +69,9 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Widget] getBottomInParent +-- @function [parent=#Widget] getVirtualRendererSize -- @param self --- @return float#float ret (return value: float) +-- @return size_table#size_table ret (return value: size_table) -------------------------------- -- @function [parent=#Widget] isHighlighted @@ -76,7 +81,6 @@ -------------------------------- -- @function [parent=#Widget] getLayoutParameter -- @param self --- @param #ccui.LayoutParameter::Type type -- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter) -------------------------------- @@ -84,6 +88,11 @@ -- @param self -- @return Widget::PositionType#Widget::PositionType ret (return value: ccui.Widget::PositionType) +-------------------------------- +-- @function [parent=#Widget] getTopBoundary +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Widget] getChildByName -- @param self @@ -100,11 +109,6 @@ -- @param self -- @return bool#bool ret (return value: bool) --------------------------------- --- @function [parent=#Widget] getVirtualRendererSize --- @param self --- @return size_table#size_table ret (return value: size_table) - -------------------------------- -- @function [parent=#Widget] findNextFocusedWidget -- @param self @@ -132,15 +136,20 @@ -- @param self -- @param #bool bool +-------------------------------- +-- @function [parent=#Widget] setActionTag +-- @param self +-- @param #int int + -------------------------------- -- @function [parent=#Widget] setTouchEnabled -- @param self -- @param #bool bool -------------------------------- --- @function [parent=#Widget] clone +-- @function [parent=#Widget] setFlippedY -- @param self --- @return Widget#Widget ret (return value: ccui.Widget) +-- @param #bool bool -------------------------------- -- @function [parent=#Widget] getTouchMovePos @@ -153,9 +162,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getVirtualRenderer +-- @function [parent=#Widget] getRightBoundary -- @param self --- @return Node#Node ret (return value: cc.Node) +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] setBrightStyle @@ -188,9 +197,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] setActionTag +-- @function [parent=#Widget] getBottomBoundary -- @param self --- @param #int int +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] isBright @@ -209,11 +218,6 @@ -- @param #bool bool -- @return Widget#Widget ret (return value: ccui.Widget) --------------------------------- --- @function [parent=#Widget] getTopInParent --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Widget] requestFocus -- @param self @@ -232,11 +236,6 @@ -- @param self -- @return size_table#size_table ret (return value: size_table) --------------------------------- --- @function [parent=#Widget] getRightInParent --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Widget] getSizeType -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index f9773df6f5..87e10fb497 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -813,6 +813,50 @@ int lua_register_cocos2dx_ui_RelativeLayoutParameter(lua_State* tolua_S) return 1; } +int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::ui::Widget* ret = cobj->clone(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_setSizePercent(lua_State* tolua_S) { int argc = 0; @@ -903,7 +947,7 @@ int lua_cocos2dx_ui_Widget_getCustomSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getLeftBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -923,28 +967,26 @@ int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - cobj->setFlippedY(arg0); - return 0; + double ret = cobj->getLeftBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'.",&tolua_err); #endif return 0; @@ -995,7 +1037,7 @@ int lua_cocos2dx_ui_Widget_setFlippedX(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1015,7 +1057,7 @@ int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftInParent'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); return 0; } #endif @@ -1025,16 +1067,16 @@ int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) { if(!ok) return 0; - double ret = cobj->getLeftInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + cocos2d::Node* ret = cobj->getVirtualRenderer(); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftInParent",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftInParent'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); #endif return 0; @@ -1353,7 +1395,7 @@ int lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1373,7 +1415,7 @@ int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomInParent'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); return 0; } #endif @@ -1383,16 +1425,16 @@ int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) { if(!ok) return 0; - double ret = cobj->getBottomInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + const cocos2d::Size& ret = cobj->getVirtualRendererSize(); + size_to_luaval(tolua_S, ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomInParent",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomInParent'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); #endif return 0; @@ -1467,18 +1509,15 @@ int lua_cocos2dx_ui_Widget_getLayoutParameter(lua_State* tolua_S) #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - cocos2d::ui::LayoutParameter::Type arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(arg0); + cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(); object_to_luaval(tolua_S, "ccui.LayoutParameter",(cocos2d::ui::LayoutParameter*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 @@ -1532,6 +1571,50 @@ int lua_cocos2dx_ui_Widget_getPositionType(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_getTopBoundary(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopBoundary'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getTopBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopBoundary",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopBoundary'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_getChildByName(lua_State* tolua_S) { int argc = 0; @@ -1667,50 +1750,6 @@ int lua_cocos2dx_ui_Widget_isFocused(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - const cocos2d::Size& ret = cobj->getVirtualRendererSize(); - size_to_luaval(tolua_S, ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_findNextFocusedWidget(lua_State* tolua_S) { int argc = 0; @@ -1939,6 +1978,52 @@ int lua_cocos2dx_ui_Widget_setFocused(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + cobj->setActionTag(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) { int argc = 0; @@ -1985,7 +2070,7 @@ int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2005,26 +2090,28 @@ int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - cocos2d::ui::Widget* ret = cobj->clone(); - object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); - return 1; + cobj->setFlippedY(arg0); + return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); #endif return 0; @@ -2119,7 +2206,7 @@ int lua_cocos2dx_ui_Widget_setEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getRightBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2139,7 +2226,7 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightBoundary'", nullptr); return 0; } #endif @@ -2149,16 +2236,16 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { if(!ok) return 0; - cocos2d::Node* ret = cobj->getVirtualRenderer(); - object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + double ret = cobj->getRightBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightBoundary'.",&tolua_err); #endif return 0; @@ -2435,7 +2522,7 @@ int lua_cocos2dx_ui_Widget_setFocusEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getBottomBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2455,28 +2542,26 @@ int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - int arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - cobj->setActionTag(arg0); - return 0; + double ret = cobj->getBottomBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'.",&tolua_err); #endif return 0; @@ -2619,50 +2704,6 @@ int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getTopInParent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopInParent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - double ret = cobj->getTopInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopInParent",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopInParent'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_requestFocus(lua_State* tolua_S) { int argc = 0; @@ -2799,50 +2840,6 @@ int lua_cocos2dx_ui_Widget_getSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getRightInParent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightInParent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - double ret = cobj->getRightInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightInParent",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightInParent'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_getSizeType(lua_State* tolua_S) { int argc = 0; @@ -3473,11 +3470,12 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_cclass(tolua_S,"Widget","ccui.Widget","cc.ProtectedNode",nullptr); tolua_beginmodule(tolua_S,"Widget"); + tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); tolua_function(tolua_S,"setSizePercent",lua_cocos2dx_ui_Widget_setSizePercent); tolua_function(tolua_S,"getCustomSize",lua_cocos2dx_ui_Widget_getCustomSize); - tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); + tolua_function(tolua_S,"getLeftBoundary",lua_cocos2dx_ui_Widget_getLeftBoundary); tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Widget_setFlippedX); - tolua_function(tolua_S,"getLeftInParent",lua_cocos2dx_ui_Widget_getLeftInParent); + tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); tolua_function(tolua_S,"getTouchEndPos",lua_cocos2dx_ui_Widget_getTouchEndPos); tolua_function(tolua_S,"setPositionPercent",lua_cocos2dx_ui_Widget_setPositionPercent); tolua_function(tolua_S,"getLayoutSize",lua_cocos2dx_ui_Widget_getLayoutSize); @@ -3485,39 +3483,38 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_function(tolua_S,"setPositionType",lua_cocos2dx_ui_Widget_setPositionType); tolua_function(tolua_S,"getName",lua_cocos2dx_ui_Widget_getName); tolua_function(tolua_S,"isIgnoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize); - tolua_function(tolua_S,"getBottomInParent",lua_cocos2dx_ui_Widget_getBottomInParent); + tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); tolua_function(tolua_S,"isHighlighted",lua_cocos2dx_ui_Widget_isHighlighted); tolua_function(tolua_S,"getLayoutParameter",lua_cocos2dx_ui_Widget_getLayoutParameter); tolua_function(tolua_S,"getPositionType",lua_cocos2dx_ui_Widget_getPositionType); + tolua_function(tolua_S,"getTopBoundary",lua_cocos2dx_ui_Widget_getTopBoundary); tolua_function(tolua_S,"getChildByName",lua_cocos2dx_ui_Widget_getChildByName); tolua_function(tolua_S,"isEnabled",lua_cocos2dx_ui_Widget_isEnabled); tolua_function(tolua_S,"isFocused",lua_cocos2dx_ui_Widget_isFocused); - tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); tolua_function(tolua_S,"findNextFocusedWidget",lua_cocos2dx_ui_Widget_findNextFocusedWidget); tolua_function(tolua_S,"isTouchEnabled",lua_cocos2dx_ui_Widget_isTouchEnabled); tolua_function(tolua_S,"getActionTag",lua_cocos2dx_ui_Widget_getActionTag); tolua_function(tolua_S,"getWorldPosition",lua_cocos2dx_ui_Widget_getWorldPosition); tolua_function(tolua_S,"setFocused",lua_cocos2dx_ui_Widget_setFocused); + tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); tolua_function(tolua_S,"setTouchEnabled",lua_cocos2dx_ui_Widget_setTouchEnabled); - tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); + tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); tolua_function(tolua_S,"getTouchMovePos",lua_cocos2dx_ui_Widget_getTouchMovePos); tolua_function(tolua_S,"setEnabled",lua_cocos2dx_ui_Widget_setEnabled); - tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); + tolua_function(tolua_S,"getRightBoundary",lua_cocos2dx_ui_Widget_getRightBoundary); tolua_function(tolua_S,"setBrightStyle",lua_cocos2dx_ui_Widget_setBrightStyle); tolua_function(tolua_S,"setName",lua_cocos2dx_ui_Widget_setName); tolua_function(tolua_S,"setLayoutParameter",lua_cocos2dx_ui_Widget_setLayoutParameter); tolua_function(tolua_S,"getSizePercent",lua_cocos2dx_ui_Widget_getSizePercent); tolua_function(tolua_S,"getTouchStartPos",lua_cocos2dx_ui_Widget_getTouchStartPos); tolua_function(tolua_S,"setFocusEnabled",lua_cocos2dx_ui_Widget_setFocusEnabled); - tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); + tolua_function(tolua_S,"getBottomBoundary",lua_cocos2dx_ui_Widget_getBottomBoundary); tolua_function(tolua_S,"isBright",lua_cocos2dx_ui_Widget_isBright); tolua_function(tolua_S,"clippingParentAreaContainPoint",lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint); tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget); - tolua_function(tolua_S,"getTopInParent",lua_cocos2dx_ui_Widget_getTopInParent); tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus); tolua_function(tolua_S,"updateSizeAndPosition",lua_cocos2dx_ui_Widget_updateSizeAndPosition); tolua_function(tolua_S,"getSize",lua_cocos2dx_ui_Widget_getSize); - tolua_function(tolua_S,"getRightInParent",lua_cocos2dx_ui_Widget_getRightInParent); tolua_function(tolua_S,"getSizeType",lua_cocos2dx_ui_Widget_getSizeType); tolua_function(tolua_S,"ignoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize); tolua_function(tolua_S,"addTouchEventListener",lua_cocos2dx_ui_Widget_addTouchEventListener); From 5ed9e781e4c1768896dbd83684ebdf4d106b10a2 Mon Sep 17 00:00:00 2001 From: favorcode Date: Tue, 20 May 2014 13:05:20 +0800 Subject: [PATCH 53/90] Update UIText.h Update the doxygen comment --- cocos/ui/UIText.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos/ui/UIText.h b/cocos/ui/UIText.h index 93a8f89167..d0bc342a08 100644 --- a/cocos/ui/UIText.h +++ b/cocos/ui/UIText.h @@ -83,7 +83,7 @@ public: /** * Gets the string value of label. * - * @return text string value. + * @return string value. */ CC_DEPRECATED_ATTRIBUTE const std::string& getStringValue(){ return this->getString();} const std::string& getString()const; @@ -100,7 +100,7 @@ public: /** * Sets the font size of label. * - * @param font size. + * @param size font size. */ void setFontSize(int size); @@ -113,7 +113,7 @@ public: * Usage: Text *text = Text::create("Hello", "Arial", 20); //create a system font UIText * text->setFontName("Marfelt"); // it will change the font to system font no matter the previous font type is TTF or system font * text->setFontName("xxxx/xxx.ttf"); //it will change the font to TTF font no matter the previous font type is TTF or system font - * @param font name. + * @param name font name. */ void setFontName(const std::string& name); @@ -124,7 +124,7 @@ public: /** * Sets the touch scale enabled of label. * - * @param touch scale enabled of label. + * @param enabled touch scale enabled of label. */ void setTouchScaleChangeEnabled(bool enabled); From d8f56523925973966e16c572d58504de748d74f6 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 12:07:43 +0800 Subject: [PATCH 54/90] add release note --- docs/RELEASE_NOTES.md | 75 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 96c1beaa46..c2848a6b84 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -251,15 +251,86 @@ v3.1 has a new `Node` to play videos. The API is: // API in the future auto videoPlayer = cocos2d::experimental::ui::VideoPlayer::create(); videoPlayer->setContentSize(Size(x,y)); -videoPlayer->setURL("http://example.com/video.mp4"); +videoPlayer->setURL("http://example.com/video.mp4"); +//you could also play a local video file as follows: +//videoPlayer->setFileName("filepath/video.mp4"); videoPlayer->play(); ``` ## UI navigation -TODO +3.1 supports focus navigation of UI widget which is very useful for OTT manufacturer. +###Usage +Suppose that your screen has 3 widgets layout horizontally. We could define it like this: + +```c++ +HBox(widget1, widget2, widget3) +``` + +If you want the `widget1` to get focused, you could call + +```c++ +widget1->setfocused(true) +``` + +If you want to move the focus to the next widget, you could just call + +```c++ +widget1->findNextFocusedWidget(Widget::FocusDirection::RIGHT, _firstFocusedWidget); +``` + +When the focus goes to `widget3`, if you call + +```c++ +widget3->findNextFocusedWidget(Widget::FocusDirection::RIGHT, _firstFocusedWidget); +``` +, the focus will stay there only when you call `HBox->setLoopFocus()` then the focus will move to `widget1` again. + +**Note:** + +The HBox and VBox could be nested in any ways and all the widgets should be added into the HBox/VBox if you want them to be focused later. + +When a focus moves from one widget to another, it will trigger a *focus event*. You could add the following code to handle these event: + +```c++ +auto eventListener = EventListenerFocus::create(); +eventListener->onFocusChanged = CC_CALLBACK_2(UIFocusTestBase::onFocusChanged, this); +eventDispatcher->addEventListenerWithFixedPriority(_eventListener, 1); +``` + +The onFocusChanged callback, when the widget lose focus, we change its color to white, when the widget get focus, we change its color to red. You could add more complex animations to them when focus change happens. + +```c++ +void UIFocusTestBase::onFocusChanged(cocos2d::ui::Widget *widgetLostFocus, cocos2d::ui::Widget *widgetGetFocus) +{ + Layout *getLayout = dynamic_cast(widgetGetFocus); + if (!getLayout && widgetGetFocus && widgetGetFocus->isFocusEnabled()) { + widgetGetFocus->setColor(Color3B::RED); + } + Layout *loseLayout = dynamic_cast(widgetLostFocus); + if (!loseLayout && widgetLostFocus && widgetLostFocus->isFocusEnabled()) { + widgetLostFocus->setColor(Color3B::WHITE); + } +} +``` +For more usage information, please refer to [this file](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp) for more information. + + +###Limitations +Only Layout type `HORIZONTAL` and `VERTICAL` is supported which means we could not treat Scrollview and PageView as a base layout. + +The following layouts: + +```c++ +HBox(VBox, ScrollView(HBox(VBox, VBox, VBox))) +VBox(HBox, PageView(VBox(HBox,HBox)))) +``` + are not supported yet, we will implement it in cocos2d-x v3.2. + + If you want to achieve the focus movement in scrollview, you could manually call `setFocusEnabled(true/false)` when the widget in the scrollview moves out of the scrollview's boundary. + ## Improved folder structure In v3.0 we started a folder re-organization for cocos2d-x. Unfortunately we didn't have the time to finish it on time. From b637f06ce6d064e5c15fcc6b8eb5d4d7f7e9ccb7 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 05:48:12 +0000 Subject: [PATCH 55/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index da6b76ab1c..6a04f638f6 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -938,6 +938,8 @@ "cocos/ui/UIImageView.h", "cocos/ui/UILayout.cpp", "cocos/ui/UILayout.h", + "cocos/ui/UILayoutExecutant.cpp", + "cocos/ui/UILayoutExecutant.h", "cocos/ui/UILayoutParameter.cpp", "cocos/ui/UILayoutParameter.h", "cocos/ui/UIListView.cpp", From ee7c75361289dbd4eb5bdbb3bbf5f716ea62c135 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 05:50:48 +0000 Subject: [PATCH 56/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Layout.lua | 2 +- .../lua-bindings/auto/api/Widget.lua | 57 ++- .../auto/lua_cocos2dx_ui_auto.cpp | 383 +++++++++--------- 3 files changed, 219 insertions(+), 223 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Layout.lua b/cocos/scripting/lua-bindings/auto/api/Layout.lua index 025ed662ee..e104964c8d 100644 --- a/cocos/scripting/lua-bindings/auto/api/Layout.lua +++ b/cocos/scripting/lua-bindings/auto/api/Layout.lua @@ -1,7 +1,7 @@ -------------------------------- -- @module Layout --- @extend Widget +-- @extend Widget,LayoutProtocol -------------------------------- -- @function [parent=#Layout] setBackGroundColorVector diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index aba6a759a2..25732c5521 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -1,8 +1,13 @@ -------------------------------- -- @module Widget --- @extend ProtectedNode +-- @extend ProtectedNode,LayoutParameterProtocol +-------------------------------- +-- @function [parent=#Widget] clone +-- @param self +-- @return Widget#Widget ret (return value: ccui.Widget) + -------------------------------- -- @function [parent=#Widget] setSizePercent -- @param self @@ -14,9 +19,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- @function [parent=#Widget] setFlippedY +-- @function [parent=#Widget] getLeftBoundary -- @param self --- @param #bool bool +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] setFlippedX @@ -24,9 +29,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getLeftInParent +-- @function [parent=#Widget] getVirtualRenderer -- @param self --- @return float#float ret (return value: float) +-- @return Node#Node ret (return value: cc.Node) -------------------------------- -- @function [parent=#Widget] getTouchEndPos @@ -64,9 +69,9 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Widget] getBottomInParent +-- @function [parent=#Widget] getVirtualRendererSize -- @param self --- @return float#float ret (return value: float) +-- @return size_table#size_table ret (return value: size_table) -------------------------------- -- @function [parent=#Widget] isHighlighted @@ -76,7 +81,6 @@ -------------------------------- -- @function [parent=#Widget] getLayoutParameter -- @param self --- @param #ccui.LayoutParameter::Type type -- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter) -------------------------------- @@ -84,6 +88,11 @@ -- @param self -- @return Widget::PositionType#Widget::PositionType ret (return value: ccui.Widget::PositionType) +-------------------------------- +-- @function [parent=#Widget] getTopBoundary +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Widget] getChildByName -- @param self @@ -100,11 +109,6 @@ -- @param self -- @return bool#bool ret (return value: bool) --------------------------------- --- @function [parent=#Widget] getVirtualRendererSize --- @param self --- @return size_table#size_table ret (return value: size_table) - -------------------------------- -- @function [parent=#Widget] findNextFocusedWidget -- @param self @@ -132,15 +136,20 @@ -- @param self -- @param #bool bool +-------------------------------- +-- @function [parent=#Widget] setActionTag +-- @param self +-- @param #int int + -------------------------------- -- @function [parent=#Widget] setTouchEnabled -- @param self -- @param #bool bool -------------------------------- --- @function [parent=#Widget] clone +-- @function [parent=#Widget] setFlippedY -- @param self --- @return Widget#Widget ret (return value: ccui.Widget) +-- @param #bool bool -------------------------------- -- @function [parent=#Widget] getTouchMovePos @@ -153,9 +162,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getVirtualRenderer +-- @function [parent=#Widget] getRightBoundary -- @param self --- @return Node#Node ret (return value: cc.Node) +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] setBrightStyle @@ -188,9 +197,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] setActionTag +-- @function [parent=#Widget] getBottomBoundary -- @param self --- @param #int int +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] isBright @@ -209,11 +218,6 @@ -- @param #bool bool -- @return Widget#Widget ret (return value: ccui.Widget) --------------------------------- --- @function [parent=#Widget] getTopInParent --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Widget] requestFocus -- @param self @@ -232,11 +236,6 @@ -- @param self -- @return size_table#size_table ret (return value: size_table) --------------------------------- --- @function [parent=#Widget] getRightInParent --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Widget] getSizeType -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index f9773df6f5..87e10fb497 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -813,6 +813,50 @@ int lua_register_cocos2dx_ui_RelativeLayoutParameter(lua_State* tolua_S) return 1; } +int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::ui::Widget* ret = cobj->clone(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_setSizePercent(lua_State* tolua_S) { int argc = 0; @@ -903,7 +947,7 @@ int lua_cocos2dx_ui_Widget_getCustomSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getLeftBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -923,28 +967,26 @@ int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - cobj->setFlippedY(arg0); - return 0; + double ret = cobj->getLeftBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'.",&tolua_err); #endif return 0; @@ -995,7 +1037,7 @@ int lua_cocos2dx_ui_Widget_setFlippedX(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1015,7 +1057,7 @@ int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftInParent'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); return 0; } #endif @@ -1025,16 +1067,16 @@ int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) { if(!ok) return 0; - double ret = cobj->getLeftInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + cocos2d::Node* ret = cobj->getVirtualRenderer(); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftInParent",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftInParent'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); #endif return 0; @@ -1353,7 +1395,7 @@ int lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1373,7 +1415,7 @@ int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomInParent'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); return 0; } #endif @@ -1383,16 +1425,16 @@ int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) { if(!ok) return 0; - double ret = cobj->getBottomInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + const cocos2d::Size& ret = cobj->getVirtualRendererSize(); + size_to_luaval(tolua_S, ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomInParent",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomInParent'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); #endif return 0; @@ -1467,18 +1509,15 @@ int lua_cocos2dx_ui_Widget_getLayoutParameter(lua_State* tolua_S) #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - cocos2d::ui::LayoutParameter::Type arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(arg0); + cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(); object_to_luaval(tolua_S, "ccui.LayoutParameter",(cocos2d::ui::LayoutParameter*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 @@ -1532,6 +1571,50 @@ int lua_cocos2dx_ui_Widget_getPositionType(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_getTopBoundary(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopBoundary'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getTopBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopBoundary",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopBoundary'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_getChildByName(lua_State* tolua_S) { int argc = 0; @@ -1667,50 +1750,6 @@ int lua_cocos2dx_ui_Widget_isFocused(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - const cocos2d::Size& ret = cobj->getVirtualRendererSize(); - size_to_luaval(tolua_S, ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_findNextFocusedWidget(lua_State* tolua_S) { int argc = 0; @@ -1939,6 +1978,52 @@ int lua_cocos2dx_ui_Widget_setFocused(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + cobj->setActionTag(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) { int argc = 0; @@ -1985,7 +2070,7 @@ int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2005,26 +2090,28 @@ int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - cocos2d::ui::Widget* ret = cobj->clone(); - object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); - return 1; + cobj->setFlippedY(arg0); + return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); #endif return 0; @@ -2119,7 +2206,7 @@ int lua_cocos2dx_ui_Widget_setEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getRightBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2139,7 +2226,7 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightBoundary'", nullptr); return 0; } #endif @@ -2149,16 +2236,16 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { if(!ok) return 0; - cocos2d::Node* ret = cobj->getVirtualRenderer(); - object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + double ret = cobj->getRightBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightBoundary'.",&tolua_err); #endif return 0; @@ -2435,7 +2522,7 @@ int lua_cocos2dx_ui_Widget_setFocusEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getBottomBoundary(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2455,28 +2542,26 @@ int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - int arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - cobj->setActionTag(arg0); - return 0; + double ret = cobj->getBottomBoundary(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomBoundary",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'.",&tolua_err); #endif return 0; @@ -2619,50 +2704,6 @@ int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getTopInParent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopInParent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - double ret = cobj->getTopInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopInParent",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopInParent'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_requestFocus(lua_State* tolua_S) { int argc = 0; @@ -2799,50 +2840,6 @@ int lua_cocos2dx_ui_Widget_getSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getRightInParent(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightInParent'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - double ret = cobj->getRightInParent(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightInParent",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightInParent'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_getSizeType(lua_State* tolua_S) { int argc = 0; @@ -3473,11 +3470,12 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_cclass(tolua_S,"Widget","ccui.Widget","cc.ProtectedNode",nullptr); tolua_beginmodule(tolua_S,"Widget"); + tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); tolua_function(tolua_S,"setSizePercent",lua_cocos2dx_ui_Widget_setSizePercent); tolua_function(tolua_S,"getCustomSize",lua_cocos2dx_ui_Widget_getCustomSize); - tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); + tolua_function(tolua_S,"getLeftBoundary",lua_cocos2dx_ui_Widget_getLeftBoundary); tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Widget_setFlippedX); - tolua_function(tolua_S,"getLeftInParent",lua_cocos2dx_ui_Widget_getLeftInParent); + tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); tolua_function(tolua_S,"getTouchEndPos",lua_cocos2dx_ui_Widget_getTouchEndPos); tolua_function(tolua_S,"setPositionPercent",lua_cocos2dx_ui_Widget_setPositionPercent); tolua_function(tolua_S,"getLayoutSize",lua_cocos2dx_ui_Widget_getLayoutSize); @@ -3485,39 +3483,38 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_function(tolua_S,"setPositionType",lua_cocos2dx_ui_Widget_setPositionType); tolua_function(tolua_S,"getName",lua_cocos2dx_ui_Widget_getName); tolua_function(tolua_S,"isIgnoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize); - tolua_function(tolua_S,"getBottomInParent",lua_cocos2dx_ui_Widget_getBottomInParent); + tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); tolua_function(tolua_S,"isHighlighted",lua_cocos2dx_ui_Widget_isHighlighted); tolua_function(tolua_S,"getLayoutParameter",lua_cocos2dx_ui_Widget_getLayoutParameter); tolua_function(tolua_S,"getPositionType",lua_cocos2dx_ui_Widget_getPositionType); + tolua_function(tolua_S,"getTopBoundary",lua_cocos2dx_ui_Widget_getTopBoundary); tolua_function(tolua_S,"getChildByName",lua_cocos2dx_ui_Widget_getChildByName); tolua_function(tolua_S,"isEnabled",lua_cocos2dx_ui_Widget_isEnabled); tolua_function(tolua_S,"isFocused",lua_cocos2dx_ui_Widget_isFocused); - tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); tolua_function(tolua_S,"findNextFocusedWidget",lua_cocos2dx_ui_Widget_findNextFocusedWidget); tolua_function(tolua_S,"isTouchEnabled",lua_cocos2dx_ui_Widget_isTouchEnabled); tolua_function(tolua_S,"getActionTag",lua_cocos2dx_ui_Widget_getActionTag); tolua_function(tolua_S,"getWorldPosition",lua_cocos2dx_ui_Widget_getWorldPosition); tolua_function(tolua_S,"setFocused",lua_cocos2dx_ui_Widget_setFocused); + tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); tolua_function(tolua_S,"setTouchEnabled",lua_cocos2dx_ui_Widget_setTouchEnabled); - tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); + tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); tolua_function(tolua_S,"getTouchMovePos",lua_cocos2dx_ui_Widget_getTouchMovePos); tolua_function(tolua_S,"setEnabled",lua_cocos2dx_ui_Widget_setEnabled); - tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); + tolua_function(tolua_S,"getRightBoundary",lua_cocos2dx_ui_Widget_getRightBoundary); tolua_function(tolua_S,"setBrightStyle",lua_cocos2dx_ui_Widget_setBrightStyle); tolua_function(tolua_S,"setName",lua_cocos2dx_ui_Widget_setName); tolua_function(tolua_S,"setLayoutParameter",lua_cocos2dx_ui_Widget_setLayoutParameter); tolua_function(tolua_S,"getSizePercent",lua_cocos2dx_ui_Widget_getSizePercent); tolua_function(tolua_S,"getTouchStartPos",lua_cocos2dx_ui_Widget_getTouchStartPos); tolua_function(tolua_S,"setFocusEnabled",lua_cocos2dx_ui_Widget_setFocusEnabled); - tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); + tolua_function(tolua_S,"getBottomBoundary",lua_cocos2dx_ui_Widget_getBottomBoundary); tolua_function(tolua_S,"isBright",lua_cocos2dx_ui_Widget_isBright); tolua_function(tolua_S,"clippingParentAreaContainPoint",lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint); tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget); - tolua_function(tolua_S,"getTopInParent",lua_cocos2dx_ui_Widget_getTopInParent); tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus); tolua_function(tolua_S,"updateSizeAndPosition",lua_cocos2dx_ui_Widget_updateSizeAndPosition); tolua_function(tolua_S,"getSize",lua_cocos2dx_ui_Widget_getSize); - tolua_function(tolua_S,"getRightInParent",lua_cocos2dx_ui_Widget_getRightInParent); tolua_function(tolua_S,"getSizeType",lua_cocos2dx_ui_Widget_getSizeType); tolua_function(tolua_S,"ignoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize); tolua_function(tolua_S,"addTouchEventListener",lua_cocos2dx_ui_Widget_addTouchEventListener); From 4109b5b208b0405f30fb7d8fc079a1f8985a9204 Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 14:12:09 +0800 Subject: [PATCH 57/90] modify some texts on RELEASE_NOTES --- docs/RELEASE_NOTES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index c2848a6b84..ed234dd044 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -329,8 +329,8 @@ VBox(HBox, PageView(VBox(HBox,HBox)))) ``` are not supported yet, we will implement it in cocos2d-x v3.2. - If you want to achieve the focus movement in scrollview, you could manually call `setFocusEnabled(true/false)` when the widget in the scrollview moves out of the scrollview's boundary. - + If you want to achieve the focus movement in scrollview, you could use a normal VBox or HBox to layout elements and call `setFocusEnabled(true/false)` manually to skip the unwanted widgets. + ## Improved folder structure In v3.0 we started a folder re-organization for cocos2d-x. Unfortunately we didn't have the time to finish it on time. From 70d1daf8f42fd27f4f70d47530d64445842de3c6 Mon Sep 17 00:00:00 2001 From: lm Date: Tue, 20 May 2014 14:31:42 +0800 Subject: [PATCH 58/90] [Jenkins][ci skip] Fix the path of android public project --- tools/jenkins-scripts/autotest.py | 2 +- tools/jenkins-scripts/ci-release-test.py | 2 +- tools/jenkins-scripts/pull-request-builder.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/jenkins-scripts/autotest.py b/tools/jenkins-scripts/autotest.py index b585cef14e..74857a17cf 100755 --- a/tools/jenkins-scripts/autotest.py +++ b/tools/jenkins-scripts/autotest.py @@ -118,7 +118,7 @@ def ANDROID_BUILD(): print 'clean **CLEAN FAILED**' time.sleep(sleep_time) def updateProperty(): - infoUpdate = os.system('android update project -p ./cocos/2d/platform/android/java/ -t 12') + infoUpdate = os.system('android update project -p ./cocos/platform/android/java/ -t 12') print 'cocos update:', infoUpdate infoUpdate = os.system('android update project -p '+PATH_ANDROID_SRC+' -t 12') print 'test update:', infoUpdate diff --git a/tools/jenkins-scripts/ci-release-test.py b/tools/jenkins-scripts/ci-release-test.py index 29fed30ee5..065fccf131 100644 --- a/tools/jenkins-scripts/ci-release-test.py +++ b/tools/jenkins-scripts/ci-release-test.py @@ -149,7 +149,7 @@ def main(): ret = os.system("python build/android-build.py -b " + mode + " -n -j10 all") # create and save apk if(ret == 0): - os.system('android update project -p cocos/2d/platform/android/java/ -t android-13') + os.system('android update project -p cocos/platform/android/java/ -t android-13') for i, test in enumerate(tests_dirs): os.system('android update project -p ' + test + ' -t android-13') local_apk = test + '/' + tests_names[i] + '.apk' diff --git a/tools/jenkins-scripts/pull-request-builder.py b/tools/jenkins-scripts/pull-request-builder.py index ff238ce440..785679c7c7 100755 --- a/tools/jenkins-scripts/pull-request-builder.py +++ b/tools/jenkins-scripts/pull-request-builder.py @@ -194,7 +194,7 @@ def main(): # create and save apk if(ret == 0): sample_dir = 'tests/cpp-empty-test/proj.android/' - os.system('android update project -p cocos/2d/platform/android/java/ -t android-13') + os.system('android update project -p cocos/platform/android/java/ -t android-13') os.system('android update project -p ' + sample_dir + ' -t android-13') os.system('ant debug -f ' + sample_dir + 'build.xml') local_apk = sample_dir + 'bin/CppEmptyTest-debug.apk' From 1ed9b9749ea80ca56d13538613673144b09a8c2f Mon Sep 17 00:00:00 2001 From: andyque Date: Tue, 20 May 2014 14:36:29 +0800 Subject: [PATCH 59/90] Revert "Merge pull request #6752 from andyque/refactorLayout" This reverts commit ae118a9d22cd7ec0e2656ef605361467fe0f64cf, reversing changes made to 6f2f2046c7729b48d69a3c2f54c94fefc4145c8a. --- build/cocos2d_libs.xcodeproj/project.pbxproj | 104 +-- cocos/ui/Android.mk | 1 - cocos/ui/CMakeLists.txt | 1 - cocos/ui/UILayout.cpp | 580 +++++++++++++- cocos/ui/UILayout.h | 28 +- cocos/ui/UILayoutExecutant.cpp | 513 ------------- cocos/ui/UILayoutExecutant.h | 75 -- cocos/ui/UILayoutParameter.h | 9 - cocos/ui/UIListView.cpp | 4 +- cocos/ui/UIPageView.cpp | 8 +- cocos/ui/UIScrollView.cpp | 712 +++++++++--------- cocos/ui/UIScrollView.h | 6 - cocos/ui/UIWidget.cpp | 25 +- cocos/ui/UIWidget.h | 30 +- cocos/ui/proj.win32/libGUI.vcxproj | 2 - cocos/ui/proj.win32/libGUI.vcxproj.filters | 6 - .../UIScrollViewTest/UIScrollViewTest.cpp | 14 +- 17 files changed, 955 insertions(+), 1163 deletions(-) delete mode 100644 cocos/ui/UILayoutExecutant.cpp delete mode 100644 cocos/ui/UILayoutExecutant.h diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index f82f777edf..2da14e8baf 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -944,6 +944,8 @@ 2905FA6F18CF08D100240AA3 /* UIRichText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0418CF08D000240AA3 /* UIRichText.cpp */; }; 2905FA7018CF08D100240AA3 /* UIRichText.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0518CF08D000240AA3 /* UIRichText.h */; }; 2905FA7118CF08D100240AA3 /* UIRichText.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0518CF08D000240AA3 /* UIRichText.h */; }; + 2905FA7218CF08D100240AA3 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */; }; + 2905FA7318CF08D100240AA3 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */; }; 2905FA7418CF08D100240AA3 /* UIScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */; }; 2905FA7518CF08D100240AA3 /* UIScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */; }; 2905FA7618CF08D100240AA3 /* UIScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA0818CF08D000240AA3 /* UIScrollView.h */; }; @@ -973,12 +975,6 @@ 2905FA8E18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; 2905FA8F18CF08D100240AA3 /* UIWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905FA1418CF08D100240AA3 /* UIWidget.h */; }; 2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; }; - 29CB8F4C1929D1BB00C841D6 /* UILayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */; }; - 29CB8F4D1929D1BB00C841D6 /* UILayoutExecutant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */; }; - 29CB8F4E1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */; }; - 29CB8F4F1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */; }; - 29CB8F551929D7A900C841D6 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */; }; - 29CB8F561929D7A900C841D6 /* UIScrollInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */; }; 2AC795DB1862870F005EC8E1 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D918628689005EC8E1 /* SkeletonBounds.cpp */; }; 2AC795DC1862870F005EC8E1 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D51862867D005EC8E1 /* Event.cpp */; }; 2AC795DD1862870F005EC8E1 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D71862867D005EC8E1 /* EventData.cpp */; }; @@ -2239,6 +2235,7 @@ 2905FA0318CF08D000240AA3 /* UIPageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPageView.h; sourceTree = ""; }; 2905FA0418CF08D000240AA3 /* UIRichText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRichText.cpp; sourceTree = ""; }; 2905FA0518CF08D000240AA3 /* UIRichText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRichText.h; sourceTree = ""; }; + 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollInterface.h; sourceTree = ""; }; 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScrollView.cpp; sourceTree = ""; }; 2905FA0818CF08D000240AA3 /* UIScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollView.h; sourceTree = ""; }; 2905FA0918CF08D000240AA3 /* UISlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UISlider.cpp; sourceTree = ""; }; @@ -2256,9 +2253,6 @@ 29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = ""; }; 2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = ""; }; 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = ""; }; - 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutExecutant.cpp; sourceTree = ""; }; - 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutExecutant.h; sourceTree = ""; }; - 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollInterface.h; sourceTree = ""; }; 2AC795D318628672005EC8E1 /* BoundingBoxAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BoundingBoxAttachment.cpp; sourceTree = ""; }; 2AC795D418628672005EC8E1 /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundingBoxAttachment.h; sourceTree = ""; }; 2AC795D51862867D005EC8E1 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = ""; }; @@ -3908,63 +3902,23 @@ 2905F9E618CF08D000240AA3 /* ui */ = { isa = PBXGroup; children = ( - 29CB8F531929D67D00C841D6 /* widgets */, - 29CB8F521929D65500C841D6 /* experimental */, - 29CB8F511929D64500C841D6 /* base */, - 29CB8F501929D63600C841D6 /* layout */, + 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */, + 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */, 2905F9E918CF08D000240AA3 /* CocosGUI.cpp */, 2905F9EA18CF08D000240AA3 /* CocosGUI.h */, - ); - name = ui; - path = ../cocos/ui; - sourceTree = ""; - }; - 29CB8F501929D63600C841D6 /* layout */ = { - isa = PBXGroup; - children = ( - 50E6D32E18E174130051CA34 /* UIHBox.cpp */, - 50E6D32F18E174130051CA34 /* UIHBox.h */, - 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */, - 50E6D33118E174130051CA34 /* UIRelativeBox.h */, - 50E6D33218E174130051CA34 /* UIVBox.cpp */, - 50E6D33318E174130051CA34 /* UIVBox.h */, + 2905F9EB18CF08D000240AA3 /* GUIDefine.h */, + 2905F9F018CF08D000240AA3 /* UIButton.cpp */, + 2905F9F118CF08D000240AA3 /* UIButton.h */, + 2905F9F218CF08D000240AA3 /* UICheckBox.cpp */, + 2905F9F318CF08D000240AA3 /* UICheckBox.h */, + 2905F9F418CF08D000240AA3 /* UIHelper.cpp */, + 2905F9F518CF08D000240AA3 /* UIHelper.h */, + 2905F9F618CF08D000240AA3 /* UIImageView.cpp */, + 2905F9F718CF08D000240AA3 /* UIImageView.h */, 2905F9F818CF08D000240AA3 /* UILayout.cpp */, 2905F9F918CF08D000240AA3 /* UILayout.h */, 2905F9FC18CF08D000240AA3 /* UILayoutParameter.cpp */, 2905F9FD18CF08D000240AA3 /* UILayoutParameter.h */, - 29CB8F4A1929D1BB00C841D6 /* UILayoutExecutant.cpp */, - 29CB8F4B1929D1BB00C841D6 /* UILayoutExecutant.h */, - ); - name = layout; - sourceTree = ""; - }; - 29CB8F511929D64500C841D6 /* base */ = { - isa = PBXGroup; - children = ( - 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, - 2905FA1318CF08D100240AA3 /* UIWidget.cpp */, - 2905FA1418CF08D100240AA3 /* UIWidget.h */, - 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, - 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */, - 2905F9F418CF08D000240AA3 /* UIHelper.cpp */, - 2905F9F518CF08D000240AA3 /* UIHelper.h */, - 2905F9EB18CF08D000240AA3 /* GUIDefine.h */, - ); - name = base; - sourceTree = ""; - }; - 29CB8F521929D65500C841D6 /* experimental */ = { - isa = PBXGroup; - children = ( - 3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */, - 3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */, - ); - name = experimental; - sourceTree = ""; - }; - 29CB8F531929D67D00C841D6 /* widgets */ = { - isa = PBXGroup; - children = ( 2905F9FE18CF08D000240AA3 /* UIListView.cpp */, 2905F9FF18CF08D000240AA3 /* UIListView.h */, 2905FA0018CF08D000240AA3 /* UILoadingBar.cpp */, @@ -3973,9 +3927,9 @@ 2905FA0318CF08D000240AA3 /* UIPageView.h */, 2905FA0418CF08D000240AA3 /* UIRichText.cpp */, 2905FA0518CF08D000240AA3 /* UIRichText.h */, + 2905FA0618CF08D000240AA3 /* UIScrollInterface.h */, 2905FA0718CF08D000240AA3 /* UIScrollView.cpp */, 2905FA0818CF08D000240AA3 /* UIScrollView.h */, - 29CB8F541929D7A900C841D6 /* UIScrollInterface.h */, 2905FA0918CF08D000240AA3 /* UISlider.cpp */, 2905FA0A18CF08D100240AA3 /* UISlider.h */, 2905FA0B18CF08D100240AA3 /* UIText.cpp */, @@ -3986,14 +3940,20 @@ 2905FA1018CF08D100240AA3 /* UITextBMFont.h */, 2905FA1118CF08D100240AA3 /* UITextField.cpp */, 2905FA1218CF08D100240AA3 /* UITextField.h */, - 2905F9F018CF08D000240AA3 /* UIButton.cpp */, - 2905F9F118CF08D000240AA3 /* UIButton.h */, - 2905F9F218CF08D000240AA3 /* UICheckBox.cpp */, - 2905F9F318CF08D000240AA3 /* UICheckBox.h */, - 2905F9F618CF08D000240AA3 /* UIImageView.cpp */, - 2905F9F718CF08D000240AA3 /* UIImageView.h */, + 2905FA1318CF08D100240AA3 /* UIWidget.cpp */, + 2905FA1418CF08D100240AA3 /* UIWidget.h */, + 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, + 50E6D30D18DADB5D0051CA34 /* CCProtectedNode.h */, + 50E6D32E18E174130051CA34 /* UIHBox.cpp */, + 50E6D32F18E174130051CA34 /* UIHBox.h */, + 50E6D33018E174130051CA34 /* UIRelativeBox.cpp */, + 50E6D33118E174130051CA34 /* UIRelativeBox.h */, + 50E6D33218E174130051CA34 /* UIVBox.cpp */, + 50E6D33318E174130051CA34 /* UIVBox.h */, + 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, ); - name = widgets; + name = ui; + path = ../cocos/ui; sourceTree = ""; }; 37936A361869B76800E974DD /* internal */ = { @@ -4846,7 +4806,6 @@ 5034CA39191D591100CE6051 /* ccShader_PositionColorLengthTexture.frag in Headers */, 2AC795DF18628723005EC8E1 /* SkeletonBounds.h in Headers */, 50ABBE891925AB6F00A911A9 /* CCMap.h in Headers */, - 29CB8F4E1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */, 2AC795E018628723005EC8E1 /* Event.h in Headers */, 2AC795E118628723005EC8E1 /* EventData.h in Headers */, 50E6D33618E174130051CA34 /* UIHBox.h in Headers */, @@ -5051,6 +5010,7 @@ 1AD71DED180E26E600808F54 /* CCMenuLoader.h in Headers */, 50ABBE8F1925AB6F00A911A9 /* CCPlatformConfig.h in Headers */, 1AD71DF1180E26E600808F54 /* CCNode+CCBRelativePositioning.h in Headers */, + 2905FA7218CF08D100240AA3 /* UIScrollInterface.h in Headers */, 1AD71DF5180E26E600808F54 /* CCNodeLoader.h in Headers */, 1AD71DF9180E26E600808F54 /* CCNodeLoaderLibrary.h in Headers */, 50ABBE291925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */, @@ -5115,7 +5075,6 @@ 50ABBD9D1925AB4100A911A9 /* ccGLStateCache.h in Headers */, 50ABBEB91925AB6F00A911A9 /* ccUTF8.h in Headers */, 1AAF536E180E3374000584C8 /* HttpRequest.h in Headers */, - 29CB8F551929D7A900C841D6 /* UIScrollInterface.h in Headers */, 1AAF5370180E3374000584C8 /* HttpResponse.h in Headers */, 50ABBE671925AB6F00A911A9 /* CCEventListenerCustom.h in Headers */, 1AAF5374180E3374000584C8 /* SocketIO.h in Headers */, @@ -5398,6 +5357,7 @@ 503DD8E41926736A00CD74DD /* CCDirectorCaller.h in Headers */, 50ABBD8A1925AB4100A911A9 /* CCCustomCommand.h in Headers */, 2905FA6D18CF08D100240AA3 /* UIPageView.h in Headers */, + 2905FA7318CF08D100240AA3 /* UIScrollInterface.h in Headers */, 50ABBE881925AB6F00A911A9 /* ccMacros.h in Headers */, 50ABC0101926664800A911A9 /* CCFileUtils.h in Headers */, 2905FA4318CF08D100240AA3 /* CocosGUI.h in Headers */, @@ -5568,7 +5528,6 @@ 50ABBD921925AB4100A911A9 /* CCGLProgramCache.h in Headers */, 1AD71E0E180E26E600808F54 /* CocosBuilder.h in Headers */, B29594C91926D61F003EEF37 /* CCObjLoader.h in Headers */, - 29CB8F561929D7A900C841D6 /* UIScrollInterface.h in Headers */, 1AD71E98180E26E600808F54 /* Animation.h in Headers */, 1AD71E9C180E26E600808F54 /* AnimationState.h in Headers */, 50ABBE961925AB6F00A911A9 /* CCProfiling.h in Headers */, @@ -5661,7 +5620,6 @@ 1A8C59E2180E930E00EF57C3 /* CCInputDelegate.h in Headers */, 503DD8EA1926736A00CD74DD /* CCESRenderer.h in Headers */, 1A8C59E6180E930E00EF57C3 /* CCProcessBase.h in Headers */, - 29CB8F4F1929D1BB00C841D6 /* UILayoutExecutant.h in Headers */, 50ABBE581925AB6F00A911A9 /* CCEventFocus.h in Headers */, 50ABC00A1926664800A911A9 /* CCCommon.h in Headers */, 2905FA5918CF08D100240AA3 /* UILayout.h in Headers */, @@ -6242,7 +6200,6 @@ 2905FA4018CF08D100240AA3 /* CocosGUI.cpp in Sources */, 1AD71EC1180E26E600808F54 /* extension.cpp in Sources */, 50ABBE511925AB6F00A911A9 /* CCEventDispatcher.cpp in Sources */, - 29CB8F4C1929D1BB00C841D6 /* UILayoutExecutant.cpp in Sources */, 50ABC0051926664800A911A9 /* CCThread.mm in Sources */, 1AD71EC5180E26E600808F54 /* Json.cpp in Sources */, 50E6D33C18E174130051CA34 /* UIVBox.cpp in Sources */, @@ -6721,7 +6678,6 @@ 50FCEBAC18C72017004AD434 /* PageViewReader.cpp in Sources */, 1A8C598C180E930E00EF57C3 /* CCActionFrame.cpp in Sources */, 1A8C5990180E930E00EF57C3 /* CCActionFrameEasing.cpp in Sources */, - 29CB8F4D1929D1BB00C841D6 /* UILayoutExecutant.cpp in Sources */, 50FCEBA418C72017004AD434 /* ListViewReader.cpp in Sources */, 1A8C5994180E930E00EF57C3 /* CCActionManagerEx.cpp in Sources */, 50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */, diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 868b2a9dd1..73d31dff76 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -9,7 +9,6 @@ LOCAL_SRC_FILES := \ UIWidget.cpp \ UILayout.cpp \ UILayoutParameter.cpp \ -UILayoutExecutant.cpp \ CocosGUI.cpp \ UIHelper.cpp \ UIListView.cpp \ diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index fd92084a94..50f088b80a 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -8,7 +8,6 @@ set(COCOS_UI_SRC ui/UIImageView.cpp ui/UILayout.cpp ui/UILayoutParameter.cpp - ui/UILayoutExecutant.cpp ui/UIListView.cpp ui/UILoadingBar.cpp ui/UIPageView.cpp diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 751ec40741..be628e30f9 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -32,12 +32,532 @@ THE SOFTWARE. #include "renderer/CCRenderer.h" #include "renderer/CCGroupCommand.h" #include "renderer/CCCustomCommand.h" -#include "ui/UILayoutExecutant.h" NS_CC_BEGIN namespace ui { +class LayoutExecutant : public Ref +{ +public: + LayoutExecutant(){}; + virtual ~LayoutExecutant(){}; + static LayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container){}; +}; + +class LinearVerticalLayoutExecutant : public LayoutExecutant +{ +public: + LinearVerticalLayoutExecutant(){}; + virtual ~LinearVerticalLayoutExecutant(){}; + static LinearVerticalLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + +class LinearHorizontalLayoutExecutant : public LayoutExecutant +{ +public: + LinearHorizontalLayoutExecutant(){}; + virtual ~LinearHorizontalLayoutExecutant(){}; + static LinearHorizontalLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + +class RelativeLayoutExecutant : public LayoutExecutant +{ +public: + RelativeLayoutExecutant(){}; + virtual ~RelativeLayoutExecutant(){}; + static RelativeLayoutExecutant* create(); + virtual void doLayout(const Size& layoutSize, Vector container); +}; + +LayoutExecutant* LayoutExecutant::create() +{ + LayoutExecutant* exe = new LayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +LinearVerticalLayoutExecutant* LinearVerticalLayoutExecutant::create() +{ + LinearVerticalLayoutExecutant* exe = new LinearVerticalLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +LinearHorizontalLayoutExecutant* LinearHorizontalLayoutExecutant::create() +{ + LinearHorizontalLayoutExecutant* exe = new LinearHorizontalLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +RelativeLayoutExecutant* RelativeLayoutExecutant::create() +{ + RelativeLayoutExecutant* exe = new RelativeLayoutExecutant(); + if (exe) + { + exe->autorelease(); + return exe; + } + CC_SAFE_DELETE(exe); + return nullptr; +} + +void LinearVerticalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + float topBoundary = layoutSize.height; + + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + + if (layoutParameter) + { + LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); + Vec2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + float finalPosX = ap.x * cs.width; + float finalPosY = topBoundary - ((1.0f-ap.y) * cs.height); + switch (childGravity) + { + case LinearLayoutParameter::LinearGravity::NONE: + case LinearLayoutParameter::LinearGravity::LEFT: + break; + case LinearLayoutParameter::LinearGravity::RIGHT: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + break; + case LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL: + finalPosX = layoutSize.width / 2.0f - cs.width * (0.5f-ap.x); + break; + default: + break; + } + Margin mg = layoutParameter->getMargin(); + finalPosX += mg.left; + finalPosY -= mg.top; + child->setPosition(Vec2(finalPosX, finalPosY)); + topBoundary = child->getBottomInParent() - mg.bottom; + } + } + } +} + +void LinearHorizontalLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + float leftBoundary = 0.0f; + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); + if (layoutParameter) + { + LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); + Vec2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + float finalPosX = leftBoundary + (ap.x * cs.width); + float finalPosY = layoutSize.height - (1.0f - ap.y) * cs.height; + switch (childGravity) + { + case LinearLayoutParameter::LinearGravity::NONE: + case LinearLayoutParameter::LinearGravity::TOP: + break; + case LinearLayoutParameter::LinearGravity::BOTTOM: + finalPosY = ap.y * cs.height; + break; + case LinearLayoutParameter::LinearGravity::CENTER_VERTICAL: + finalPosY = layoutSize.height / 2.0f - cs.height * (0.5f - ap.y); + break; + default: + break; + } + Margin mg = layoutParameter->getMargin(); + finalPosX += mg.left; + finalPosY -= mg.top; + child->setPosition(Vec2(finalPosX, finalPosY)); + leftBoundary = child->getRightInParent() + mg.right; + } + } + } +} + +void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector container) +{ + ssize_t unlayoutChildCount = 0; + Vector widgetChildren; + for (auto& subWidget : container) + { + Widget* child = dynamic_cast(subWidget); + if (child) + { + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + layoutParameter->_put = false; + unlayoutChildCount++; + widgetChildren.pushBack(child); + } + } + while (unlayoutChildCount > 0) + { + for (auto& subWidget : widgetChildren) + { + Widget* child = static_cast(subWidget); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + + if (layoutParameter) + { + if (layoutParameter->_put) + { + continue; + } + Vec2 ap = child->getAnchorPoint(); + Size cs = child->getSize(); + RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign(); + const std::string relativeName = layoutParameter->getRelativeToWidgetName(); + Widget* relativeWidget = nullptr; + RelativeLayoutParameter* relativeWidgetLP = nullptr; + float finalPosX = 0.0f; + float finalPosY = 0.0f; + if (!relativeName.empty()) + { + for (auto& sWidget : widgetChildren) + { + if (sWidget) + { + RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE)); + if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) + { + relativeWidget = sWidget; + relativeWidgetLP = rlayoutParameter; + break; + } + } + } + } + switch (align) + { + case RelativeLayoutParameter::RelativeAlign::NONE: + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: + finalPosX = ap.x * cs.width; + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: + finalPosX = ap.x * cs.width; + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: + finalPosX = ap.x * cs.width; + finalPosY = ap.y * cs.height; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: + finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); + finalPosY = ap.y * cs.height; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: + finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); + finalPosY = ap.y * cs.height; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getTopInParent(); + float locationLeft = relativeWidget->getLeftInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationBottom = relativeWidget->getTopInParent(); + + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getTopInParent(); + float locationRight = relativeWidget->getRightInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getTopInParent(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + + finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getBottomInParent(); + float locationRight = relativeWidget->getLeftInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getTopInParent(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosX = locationLeft + ap.x * cs.width; + + finalPosY = relativeWidget->getBottomInParent() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationBottom = relativeWidget->getBottomInParent(); + float locationLeft = relativeWidget->getRightInParent(); + finalPosY = locationBottom + ap.y * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getBottomInParent(); + float locationLeft = relativeWidget->getLeftInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationLeft + ap.x * cs.width; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + Size rbs = relativeWidget->getSize(); + float locationTop = relativeWidget->getBottomInParent(); + + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = relativeWidget->getLeftInParent() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; + } + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: + if (relativeWidget) + { + if (relativeWidgetLP && !relativeWidgetLP->_put) + { + continue; + } + float locationTop = relativeWidget->getBottomInParent(); + float locationRight = relativeWidget->getRightInParent(); + finalPosY = locationTop - (1.0f - ap.y) * cs.height; + finalPosX = locationRight - (1.0f - ap.x) * cs.width; + } + break; + default: + break; + } + Margin relativeWidgetMargin; + Margin mg = layoutParameter->getMargin(); + if (relativeWidgetLP) + { + relativeWidgetMargin = relativeWidgetLP->getMargin(); + } + //handle margin + switch (align) + { + case RelativeLayoutParameter::RelativeAlign::NONE: + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: + finalPosX += mg.left; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: + finalPosX -= mg.right; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: + finalPosX += mg.left; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: + finalPosX -= mg.right; + finalPosY += mg.bottom; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: + finalPosY += mg.bottom; + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: + finalPosY += mg.bottom; + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: + finalPosY += mg.bottom; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: + finalPosX -= mg.right; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: + finalPosX -= mg.right; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: + finalPosX -= mg.right; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: + finalPosX += mg.left; + finalPosY -= mg.top; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: + finalPosX += mg.left; + finalPosY += mg.bottom; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: + finalPosX += mg.left; + break; + + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: + finalPosY -= mg.top; + finalPosX += mg.left; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: + finalPosY -= mg.top; + finalPosX -= mg.right; + break; + case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: + finalPosY -= mg.top; + break; + default: + break; + } + child->setPosition(Vec2(finalPosX, finalPosY)); + layoutParameter->_put = true; + unlayoutChildCount--; + } + } + } + widgetChildren.clear(); +} + static const int BACKGROUNDIMAGE_Z = (-1); static const int BCAKGROUNDCOLORRENDERER_Z = (-2); @@ -84,6 +604,7 @@ _currentAlphaTestFunc(GL_ALWAYS), _currentAlphaTestRef(1), _backGroundImageColor(Color3B::WHITE), _backGroundImageOpacity(255), +_curLayoutExecutant(nullptr), _passFocusToChild(true), _loopFocus(false) { @@ -94,6 +615,7 @@ _loopFocus(false) Layout::~Layout() { CC_SAFE_RELEASE(_clippingStencil); + CC_SAFE_RELEASE(_curLayoutExecutant); } void Layout::onEnter() @@ -658,7 +1180,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) case Type::HORIZONTAL: case Type::VERTICAL: { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); + LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::LINEAR)); if (!layoutParameter) { child->setLayoutParameter(LinearLayoutParameter::create()); @@ -667,7 +1189,7 @@ void Layout::supplyTheLayoutParameterLackToChild(Widget *child) } case Type::RELATIVE: { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); + RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter(LayoutParameter::Type::RELATIVE)); if (!layoutParameter) { child->setLayoutParameter(RelativeLayoutParameter::create()); @@ -905,7 +1427,9 @@ const Size& Layout::getBackGroundImageTextureSize() const void Layout::setLayoutType(Type type) { _layoutType = type; - + CC_SAFE_RELEASE_NULL(_curLayoutExecutant); + _curLayoutExecutant = createCurrentLayoutExecutant(); + CC_SAFE_RETAIN(_curLayoutExecutant); for (auto& child : _children) { Widget* widgetChild = dynamic_cast(child); @@ -917,29 +1441,7 @@ void Layout::setLayoutType(Type type) _doLayoutDirty = true; } - - -Layout::Type Layout::getLayoutType() const -{ - return _layoutType; -} - -void Layout::requestDoLayout() -{ - _doLayoutDirty = true; -} - -const Size Layout::getLayoutContentSize() -{ - return this->getSize(); -} - -const Vector& Layout::getLayoutElements() -{ - return this->getChildren(); -} - -LayoutExecutant* Layout::createLayoutExecutant() +LayoutExecutant* Layout::createCurrentLayoutExecutant() { LayoutExecutant* exe = nullptr; switch (_layoutType) @@ -957,7 +1459,16 @@ LayoutExecutant* Layout::createLayoutExecutant() break; } return exe; +} +Layout::Type Layout::getLayoutType() const +{ + return _layoutType; +} + +void Layout::requestDoLayout() +{ + _doLayoutDirty = true; } void Layout::doLayout() @@ -966,13 +1477,10 @@ void Layout::doLayout() { return; } - LayoutExecutant* executant = this->createLayoutExecutant(); - - if (executant) + if (_curLayoutExecutant) { - executant->doLayout(this); + _curLayoutExecutant->doLayout(getSize(), getChildren()); } - _doLayoutDirty = false; } @@ -1031,7 +1539,7 @@ bool Layout::isPassFocusToChild() return _passFocusToChild; } -Size Layout::getLayoutAccumulatedSize()const +Size Layout::getLayoutContentSize()const { const auto& children = this->getChildren(); Size layoutSize = Size::ZERO; @@ -1041,7 +1549,7 @@ Size Layout::getLayoutAccumulatedSize()const Layout *layout = dynamic_cast(widget); if (nullptr != layout) { - layoutSize = layoutSize + layout->getLayoutAccumulatedSize(); + layoutSize = layoutSize + layout->getLayoutContentSize(); } else { @@ -1049,7 +1557,7 @@ Size Layout::getLayoutAccumulatedSize()const if (w) { widgetCount++; - Margin m = w->getLayoutParameter()->getMargin(); + Margin m = w->getLayoutParameter(LayoutParameter::Type::LINEAR)->getMargin(); layoutSize = layoutSize + w->getSize() + Size(m.right + m.left, m.top + m.bottom) * 0.5; } } @@ -1072,7 +1580,7 @@ Vec2 Layout::getWorldCenterPoint(Widget* widget) { Layout *layout = dynamic_cast(widget); //FIXEDME: we don't need to calculate the content size of layout anymore - Size widgetSize = layout ? layout->getLayoutAccumulatedSize() : widget->getSize(); + Size widgetSize = layout ? layout->getLayoutContentSize() : widget->getSize(); // CCLOG("contnet size : width = %f, height = %f", widgetSize.width, widgetSize.height); return widget->convertToWorldSpace(Vec2(widgetSize.width/2, widgetSize.height/2)); } diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index cb4c0f37e3..f9f5eab81d 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -30,27 +30,14 @@ THE SOFTWARE. NS_CC_BEGIN namespace ui { - -class LayoutExecutant; - -class LayoutProtocol -{ -public: - LayoutProtocol(){} - virtual ~LayoutProtocol(){} - - virtual LayoutExecutant* createLayoutExecutant() = 0; - virtual const Size getLayoutContentSize() = 0; - virtual const Vector& getLayoutElements() = 0; - virtual void doLayout() = 0; -}; /** * @js NA * @lua NA */ +class LayoutExecutant; -class Layout : public Widget, public LayoutProtocol +class Layout : public Widget { DECLARE_CLASS_GUI_INFO @@ -326,11 +313,7 @@ protected: void setStencilClippingSize(const Size& size); const Rect& getClippingRect(); - - virtual void doLayout()override; - virtual LayoutExecutant* createLayoutExecutant()override; - virtual const Size getLayoutContentSize()override; - virtual const Vector& getLayoutElements() override; + virtual void doLayout(); //clipping void onBeforeVisitStencil(); @@ -342,11 +325,12 @@ protected: void updateBackGroundImageColor(); void updateBackGroundImageOpacity(); void updateBackGroundImageRGBA(); + LayoutExecutant* createCurrentLayoutExecutant(); /** *get the content size of the layout, it will accumulate all its children's content size */ - Size getLayoutAccumulatedSize() const; + Size getLayoutContentSize() const; /** * When the layout get focused, it the layout pass the focus to its child, it will use this method to determine which child @@ -493,6 +477,8 @@ protected: Color3B _backGroundImageColor; GLubyte _backGroundImageOpacity; + LayoutExecutant* _curLayoutExecutant; + GLint _mask_layer_le; GroupCommand _groupCommand; CustomCommand _beforeVisitCmdStencil; diff --git a/cocos/ui/UILayoutExecutant.cpp b/cocos/ui/UILayoutExecutant.cpp deleted file mode 100644 index 30ac2f2e0b..0000000000 --- a/cocos/ui/UILayoutExecutant.cpp +++ /dev/null @@ -1,513 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013-2014 Chukong Technologies Inc. - - 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. - ****************************************************************************/ - -#include "UILayoutExecutant.h" -#include "UILayout.h" - -NS_CC_BEGIN - -namespace ui { - -LinearVerticalLayoutExecutant* LinearVerticalLayoutExecutant::create() -{ - LinearVerticalLayoutExecutant* exe = new LinearVerticalLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -LinearHorizontalLayoutExecutant* LinearHorizontalLayoutExecutant::create() -{ - LinearHorizontalLayoutExecutant* exe = new LinearHorizontalLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -RelativeLayoutExecutant* RelativeLayoutExecutant::create() -{ - RelativeLayoutExecutant* exe = new RelativeLayoutExecutant(); - if (exe) - { - exe->autorelease(); - return exe; - } - CC_SAFE_DELETE(exe); - return nullptr; -} - -void LinearVerticalLayoutExecutant::doLayout(LayoutProtocol* layout) -{ - Size layoutSize = layout->getLayoutContentSize(); - Vector container = layout->getLayoutElements(); - float topBoundary = layoutSize.height; - - for (auto& subWidget : container) - { - LayoutParameterProtocol* child = dynamic_cast(subWidget); - if (child) - { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); - - if (layoutParameter) - { - LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); - Vec2 ap = subWidget->getAnchorPoint(); - Size cs = subWidget->getContentSize(); - float finalPosX = ap.x * cs.width; - float finalPosY = topBoundary - ((1.0f-ap.y) * cs.height); - switch (childGravity) - { - case LinearLayoutParameter::LinearGravity::NONE: - case LinearLayoutParameter::LinearGravity::LEFT: - break; - case LinearLayoutParameter::LinearGravity::RIGHT: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - break; - case LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL: - finalPosX = layoutSize.width / 2.0f - cs.width * (0.5f-ap.x); - break; - default: - break; - } - Margin mg = layoutParameter->getMargin(); - finalPosX += mg.left; - finalPosY -= mg.top; - subWidget->setPosition(Vec2(finalPosX, finalPosY)); - topBoundary = subWidget->getPosition().y - subWidget->getAnchorPoint().y * subWidget->getContentSize().height - mg.bottom; - } - } - } -} - -void LinearHorizontalLayoutExecutant::doLayout(LayoutProtocol* layout) -{ - Size layoutSize = layout->getLayoutContentSize(); - Vector container = layout->getLayoutElements(); - float leftBoundary = 0.0f; - for (auto& subWidget : container) - { - Widget* child = dynamic_cast(subWidget); - if (child) - { - LinearLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); - if (layoutParameter) - { - LinearLayoutParameter::LinearGravity childGravity = layoutParameter->getGravity(); - Vec2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); - float finalPosX = leftBoundary + (ap.x * cs.width); - float finalPosY = layoutSize.height - (1.0f - ap.y) * cs.height; - switch (childGravity) - { - case LinearLayoutParameter::LinearGravity::NONE: - case LinearLayoutParameter::LinearGravity::TOP: - break; - case LinearLayoutParameter::LinearGravity::BOTTOM: - finalPosY = ap.y * cs.height; - break; - case LinearLayoutParameter::LinearGravity::CENTER_VERTICAL: - finalPosY = layoutSize.height / 2.0f - cs.height * (0.5f - ap.y); - break; - default: - break; - } - Margin mg = layoutParameter->getMargin(); - finalPosX += mg.left; - finalPosY -= mg.top; - child->setPosition(Vec2(finalPosX, finalPosY)); - leftBoundary = child->getRightBoundary() + mg.right; - } - } - } -} - -void RelativeLayoutExecutant::doLayout(LayoutProtocol *layout) -{ - Size layoutSize = layout->getLayoutContentSize(); - Vector container = layout->getLayoutElements(); - ssize_t unlayoutChildCount = 0; - Vector widgetChildren; - for (auto& subWidget : container) - { - Widget* child = dynamic_cast(subWidget); - if (child) - { - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); - layoutParameter->_put = false; - unlayoutChildCount++; - widgetChildren.pushBack(child); - } - } - while (unlayoutChildCount > 0) - { - for (auto& subWidget : widgetChildren) - { - Widget* child = static_cast(subWidget); - RelativeLayoutParameter* layoutParameter = dynamic_cast(child->getLayoutParameter()); - - if (layoutParameter) - { - if (layoutParameter->_put) - { - continue; - } - Vec2 ap = child->getAnchorPoint(); - Size cs = child->getSize(); - RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign(); - const std::string relativeName = layoutParameter->getRelativeToWidgetName(); - Widget* relativeWidget = nullptr; - RelativeLayoutParameter* relativeWidgetLP = nullptr; - float finalPosX = 0.0f; - float finalPosY = 0.0f; - if (!relativeName.empty()) - { - for (auto& sWidget : widgetChildren) - { - if (sWidget) - { - RelativeLayoutParameter* rlayoutParameter = dynamic_cast(sWidget->getLayoutParameter()); - if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName) - { - relativeWidget = sWidget; - relativeWidgetLP = rlayoutParameter; - break; - } - } - } - } - switch (align) - { - case RelativeLayoutParameter::RelativeAlign::NONE: - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: - finalPosX = ap.x * cs.width; - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = layoutSize.height - ((1.0f - ap.y) * cs.height); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: - finalPosX = ap.x * cs.width; - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = layoutSize.height * 0.5f - cs.height * (0.5f - ap.y); - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: - finalPosX = ap.x * cs.width; - finalPosY = ap.y * cs.height; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: - finalPosX = layoutSize.width * 0.5f - cs.width * (0.5f - ap.x); - finalPosY = ap.y * cs.height; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: - finalPosX = layoutSize.width - ((1.0f - ap.x) * cs.width); - finalPosY = ap.y * cs.height; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopBoundary(); - float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationTop + ap.y * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationTop = relativeWidget->getTopBoundary(); - - finalPosY = locationTop + ap.y * cs.height; - finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopBoundary(); - float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationTop + ap.y * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopBoundary(); - float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationLeft - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationLeft = relativeWidget->getLeftBoundary(); - finalPosX = locationLeft - (1.0f - ap.x) * cs.width; - - finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomBoundary(); - float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationLeft - (1.0f - ap.x) * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationTop = relativeWidget->getTopBoundary(); - float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationTop - (1.0f - ap.y) * cs.height; - finalPosX = locationRight + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationRight = relativeWidget->getRightBoundary(); - finalPosX = locationRight + ap.x * cs.width; - - finalPosY = relativeWidget->getBottomBoundary() + rbs.height * 0.5f + ap.y * cs.height - cs.height * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomBoundary(); - float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationBottom + ap.y * cs.height; - finalPosX = locationRight + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomBoundary(); - float locationLeft = relativeWidget->getLeftBoundary(); - finalPosY = locationBottom - (1.0f - ap.y) * cs.height; - finalPosX = locationLeft + ap.x * cs.width; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - Size rbs = relativeWidget->getSize(); - float locationBottom = relativeWidget->getBottomBoundary(); - - finalPosY = locationBottom - (1.0f - ap.y) * cs.height; - finalPosX = relativeWidget->getLeftBoundary() + rbs.width * 0.5f + ap.x * cs.width - cs.width * 0.5f; - } - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: - if (relativeWidget) - { - if (relativeWidgetLP && !relativeWidgetLP->_put) - { - continue; - } - float locationBottom = relativeWidget->getBottomBoundary(); - float locationRight = relativeWidget->getRightBoundary(); - finalPosY = locationBottom - (1.0f - ap.y) * cs.height; - finalPosX = locationRight - (1.0f - ap.x) * cs.width; - } - break; - default: - break; - } - Margin relativeWidgetMargin; - Margin mg = layoutParameter->getMargin(); - if (relativeWidgetLP) - { - relativeWidgetMargin = relativeWidgetLP->getMargin(); - } - //handle margin - switch (align) - { - case RelativeLayoutParameter::RelativeAlign::NONE: - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT: - finalPosX += mg.left; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL: - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT: - finalPosX -= mg.right; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL: - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT: - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL: - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM: - finalPosX += mg.left; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL: - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM: - finalPosX -= mg.right; - finalPosY += mg.bottom; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN: - finalPosY += mg.bottom; - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN: - finalPosY += mg.bottom; - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER: - finalPosY += mg.bottom; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN: - finalPosX -= mg.right; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN: - finalPosX -= mg.right; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER: - finalPosX -= mg.right; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN: - finalPosX += mg.left; - finalPosY -= mg.top; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN: - finalPosX += mg.left; - finalPosY += mg.bottom; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER: - finalPosX += mg.left; - break; - - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN: - finalPosY -= mg.top; - finalPosX += mg.left; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN: - finalPosY -= mg.top; - finalPosX -= mg.right; - break; - case RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER: - finalPosY -= mg.top; - break; - default: - break; - } - child->setPosition(Vec2(finalPosX, finalPosY)); - layoutParameter->_put = true; - unlayoutChildCount--; - } - } - } - widgetChildren.clear(); -} - -} - -NS_CC_END \ No newline at end of file diff --git a/cocos/ui/UILayoutExecutant.h b/cocos/ui/UILayoutExecutant.h deleted file mode 100644 index a8deffd2f0..0000000000 --- a/cocos/ui/UILayoutExecutant.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013-2014 Chukong Technologies Inc. - - 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 __cocos2d_libs__CCLayoutExecutant__ -#define __cocos2d_libs__CCLayoutExecutant__ - -#include "base/CCRef.h" - -NS_CC_BEGIN - -namespace ui { - -class LayoutProtocol; - -class LayoutExecutant : public Ref -{ -public: - LayoutExecutant(){}; - virtual ~LayoutExecutant(){}; - - virtual void doLayout(LayoutProtocol *layout) = 0; -}; - -class LinearVerticalLayoutExecutant : public LayoutExecutant -{ -public: - LinearVerticalLayoutExecutant(){}; - virtual ~LinearVerticalLayoutExecutant(){}; - static LinearVerticalLayoutExecutant* create(); - virtual void doLayout(LayoutProtocol *layout) override; -}; - -class LinearHorizontalLayoutExecutant : public LayoutExecutant -{ -public: - LinearHorizontalLayoutExecutant(){}; - virtual ~LinearHorizontalLayoutExecutant(){}; - static LinearHorizontalLayoutExecutant* create(); - virtual void doLayout(LayoutProtocol *layout) override; -}; - -class RelativeLayoutExecutant : public LayoutExecutant -{ -public: - RelativeLayoutExecutant(){}; - virtual ~RelativeLayoutExecutant(){}; - static RelativeLayoutExecutant* create(); - virtual void doLayout(LayoutProtocol *layout) override; -}; - -} - -NS_CC_END -#endif /* defined(__cocos2d_libs__CCLayoutExecutant__) */ diff --git a/cocos/ui/UILayoutParameter.h b/cocos/ui/UILayoutParameter.h index 2760e0208b..da23add993 100644 --- a/cocos/ui/UILayoutParameter.h +++ b/cocos/ui/UILayoutParameter.h @@ -129,15 +129,6 @@ protected: Margin _margin; Type _layoutParameterType; }; - -class LayoutParameterProtocol -{ -public: - LayoutParameterProtocol(){} - virtual ~LayoutParameterProtocol(){} - - virtual LayoutParameter* getLayoutParameter() = 0; -}; /** diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index 417be2299b..d61af9d837 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -130,7 +130,7 @@ void ListView::remedyLayoutParameter(Widget *item) switch (_direction) { case Direction::VERTICAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); @@ -185,7 +185,7 @@ void ListView::remedyLayoutParameter(Widget *item) } case Direction::HORIZONTAL: { - LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter()); + LinearLayoutParameter* llp = (LinearLayoutParameter*)(item->getLayoutParameter(LayoutParameter::Type::LINEAR)); if (!llp) { LinearLayoutParameter* defaultLp = LinearLayoutParameter::create(); diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 24527ec15b..4a69fa7aba 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -435,18 +435,18 @@ bool PageView::scrollPages(float touchOffset) switch (_touchMoveDir) { case TouchDirection::LEFT: // left - if (_rightChild->getRightBoundary() + touchOffset <= _rightBoundary) + if (_rightChild->getRightInParent() + touchOffset <= _rightBoundary) { - realOffset = _rightBoundary - _rightChild->getRightBoundary(); + realOffset = _rightBoundary - _rightChild->getRightInParent(); movePages(realOffset); return false; } break; case TouchDirection::RIGHT: // right - if (_leftChild->getLeftBoundary() + touchOffset >= _leftBoundary) + if (_leftChild->getLeftInParent() + touchOffset >= _leftBoundary) { - realOffset = _leftBoundary - _leftChild->getLeftBoundary(); + realOffset = _leftBoundary - _leftChild->getLeftInParent(); movePages(realOffset); return false; } diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 601dca158f..646f743bee 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -49,7 +49,7 @@ ScrollInnerContainer* ScrollInnerContainer::create() CC_SAFE_DELETE(widget); return nullptr; } - + const Size& ScrollInnerContainer::getLayoutSize() { Widget* parent = getWidgetParent(); @@ -210,7 +210,7 @@ void ScrollView::setInnerContainerSize(const Size &size) } case Direction::HORIZONTAL: { - if (_innerContainer->getRightBoundary() <= _size.width) + if (_innerContainer->getRightInParent() <= _size.width) { Size newInnerSize = _innerContainer->getSize(); float offset = originalInnerSize.width - newInnerSize.width; @@ -223,7 +223,7 @@ void ScrollView::setInnerContainerSize(const Size &size) Size newInnerSize = _innerContainer->getSize(); float offsetY = originalInnerSize.height - newInnerSize.height; float offsetX = 0.0f; - if (_innerContainer->getRightBoundary() <= _size.width) + if (_innerContainer->getRightInParent() <= _size.width) { offsetX = originalInnerSize.width - newInnerSize.width; } @@ -233,11 +233,11 @@ void ScrollView::setInnerContainerSize(const Size &size) default: break; } - if (_innerContainer->getLeftBoundary() > 0.0f) + if (_innerContainer->getLeftInParent() > 0.0f) { _innerContainer->setPosition(Vec2(_innerContainer->getAnchorPoint().x * _innerContainer->getSize().width, _innerContainer->getPosition().y)); } - if (_innerContainer->getRightBoundary() < _size.width) + if (_innerContainer->getRightInParent() < _size.width) { _innerContainer->setPosition(Vec2(_size.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getSize().width), _innerContainer->getPosition().y)); } @@ -245,7 +245,7 @@ void ScrollView::setInnerContainerSize(const Size &size) { _innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _innerContainer->getAnchorPoint().y * _innerContainer->getSize().height)); } - if (_innerContainer->getTopBoundary() < _size.height) + if (_innerContainer->getTopInParent() < _size.height) { _innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _size.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getSize().height)); } @@ -390,56 +390,56 @@ bool ScrollView::checkNeedBounce() { if (_topBounceNeeded && _leftBounceNeeded) { - Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getTopBoundary()); + Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(_innerContainer->getLeftInParent(), _innerContainer->getTopInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_topBounceNeeded && _rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, _size.height) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getTopBoundary()); + Vec2 scrollVector = Vec2(_size.width, _size.height) - Vec2(_innerContainer->getRightInParent(), _innerContainer->getTopInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded && _leftBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getBottomBoundary()); + Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftInParent(), _innerContainer->getBottomInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded && _rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getBottomBoundary()); + Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightInParent(), _innerContainer->getBottomInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_topBounceNeeded) { - Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(0.0f, _innerContainer->getTopBoundary()); + Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(0.0f, _innerContainer->getTopInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_bottomBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(0.0f, _innerContainer->getBottomBoundary()); + Vec2 scrollVector = Vec2::ZERO - Vec2(0.0f, _innerContainer->getBottomInParent()); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_leftBounceNeeded) { - Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftBoundary(), 0.0f); + Vec2 scrollVector = Vec2::ZERO - Vec2(_innerContainer->getLeftInParent(), 0.0f); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); } else if (_rightBounceNeeded) { - Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), 0.0f); + Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightInParent(), 0.0f); float orSpeed = scrollVector.getLength()/(0.2f); _bounceDir = scrollVector.getNormalized(); startBounceChildren(orSpeed); @@ -451,7 +451,7 @@ bool ScrollView::checkNeedBounce() void ScrollView::checkBounceBoundary() { - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos > _bottomBoundary) { scrollToBottomEvent(); @@ -461,7 +461,7 @@ void ScrollView::checkBounceBoundary() { _bottomBounceNeeded = false; } - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos < _topBoundary) { scrollToTopEvent(); @@ -471,7 +471,7 @@ void ScrollView::checkBounceBoundary() { _topBounceNeeded = false; } - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos < _rightBoundary) { scrollToRightEvent(); @@ -481,7 +481,7 @@ void ScrollView::checkBounceBoundary() { _rightBounceNeeded = false; } - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos > _leftBoundary) { scrollToLeftEvent(); @@ -588,14 +588,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; bounceRightEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -608,14 +608,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icLefrPos = _innerContainer->getLeftBoundary(); + float icLefrPos = _innerContainer->getLeftInParent(); if (icLefrPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLefrPos; bounceLeftEvent(); scrollenabled = false; } - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -628,14 +628,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icLefrPos = _innerContainer->getLeftBoundary(); + float icLefrPos = _innerContainer->getLeftInParent(); if (icLefrPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLefrPos; bounceLeftEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -648,14 +648,14 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) { float realOffsetX = touchOffsetX; float realOffsetY = touchOffsetY; - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; bounceRightEvent(); scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -667,7 +667,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // bounce to top { float realOffsetY = touchOffsetY; - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + touchOffsetY >= _topBoundary) { realOffsetY = _topBoundary - icTopPos; @@ -679,7 +679,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) //bounce to bottom { float realOffsetY = touchOffsetY; - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + touchOffsetY <= _bottomBoundary) { realOffsetY = _bottomBoundary - icBottomPos; @@ -691,7 +691,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) //bounce to right { float realOffsetX = touchOffsetX; - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + realOffsetX >= _rightBoundary) { realOffsetX = _rightBoundary - icRightPos; @@ -703,7 +703,7 @@ bool ScrollView::bounceScrollChildren(float touchOffsetX, float touchOffsetY) else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) //bounce to left { float realOffsetX = touchOffsetX; - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + realOffsetX <= _leftBoundary) { realOffsetX = _leftBoundary - icLeftPos; @@ -724,7 +724,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (_autoScrollDir.y > 0) { - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -733,7 +733,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else { - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -746,7 +746,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (_autoScrollDir.x > 0) { - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -755,7 +755,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else { - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -768,13 +768,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO { if (*touchOffsetX > 0.0f && *touchOffsetY > 0.0f) // up right { - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -783,13 +783,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY > 0.0f) // up left { - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; scrollenabled = false; } - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -798,13 +798,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY < 0.0f) // down left { - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; scrollenabled = false; } - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -813,13 +813,13 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX > 0.0f && *touchOffsetY < 0.0f) // down right { - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; scrollenabled = false; } - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -828,7 +828,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX == 0.0f && *touchOffsetY > 0.0f) // up { - float icBottomPos = _innerContainer->getBottomBoundary(); + float icBottomPos = _innerContainer->getBottomInParent(); if (icBottomPos + *touchOffsetY >= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icBottomPos; @@ -837,7 +837,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX < 0.0f && *touchOffsetY == 0.0f) // left { - float icRightPos = _innerContainer->getRightBoundary(); + float icRightPos = _innerContainer->getRightInParent(); if (icRightPos + *touchOffsetX <= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icRightPos; @@ -846,7 +846,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX == 0.0f && *touchOffsetY < 0.0f) // down { - float icTopPos = _innerContainer->getTopBoundary(); + float icTopPos = _innerContainer->getTopInParent(); if (icTopPos + *touchOffsetY <= _autoScrollDestination.y) { *touchOffsetY = _autoScrollDestination.y - icTopPos; @@ -855,7 +855,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } else if (*touchOffsetX > 0.0f && *touchOffsetY == 0.0f) // right { - float icLeftPos = _innerContainer->getLeftBoundary(); + float icLeftPos = _innerContainer->getLeftInParent(); if (icLeftPos + *touchOffsetX >= _autoScrollDestination.x) { *touchOffsetX = _autoScrollDestination.x - icLeftPos; @@ -869,346 +869,320 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO } return scrollenabled; } - -bool ScrollView::scrollChilderVertical(float touchOffsetX, float touchOffsetY) -{ - bool scrollenabled = true; - - float realOffset = touchOffsetY; - if (_bounceEnabled) - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffset = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffset = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffset = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffset = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - moveChildren(0.0f, realOffset); - - return scrollenabled; -} - -bool ScrollView::scrollChilderHorizontal(float touchOffsetX, float touchOffsetY) -{ - bool scrollenabled = true; - - float realOffset = touchOffsetX; - if (_bounceEnabled) - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffset = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffset = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - else - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffset = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffset = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - moveChildren(realOffset, 0.0f); - - return scrollenabled; -} - -bool ScrollView::scrollChilderBoth(float touchOffsetX, float touchOffsetY) -{ - bool scrollenabled = true; - float realOffsetX = touchOffsetX; - float realOffsetY = touchOffsetY; - if (_bounceEnabled) - { - if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) - { - realOffsetY = _bounceBottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _bounceRightBoundary) - { - realOffsetX = _bounceRightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down - { - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _bounceTopBoundary) - { - realOffsetY = _bounceTopBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) - { - realOffsetX = _bounceLeftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - } - else - { - if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up - { - float icBottomPos = _innerContainer->getBottomBoundary(); - if (icBottomPos + touchOffsetY >= _bottomBoundary) - { - realOffsetY = _bottomBoundary - icBottomPos; - scrollToBottomEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left - { - float icRightPos = _innerContainer->getRightBoundary(); - if (icRightPos + touchOffsetX <= _rightBoundary) - { - realOffsetX = _rightBoundary - icRightPos; - scrollToRightEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down - { - float icTopPos = _innerContainer->getTopBoundary(); - if (icTopPos + touchOffsetY <= _topBoundary) - { - realOffsetY = _topBoundary - icTopPos; - scrollToTopEvent(); - scrollenabled = false; - } - } - else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right - { - float icLeftPos = _innerContainer->getLeftBoundary(); - if (icLeftPos + touchOffsetX >= _leftBoundary) - { - realOffsetX = _leftBoundary - icLeftPos; - scrollToLeftEvent(); - scrollenabled = false; - } - } - } - moveChildren(realOffsetX, realOffsetY); - return scrollenabled; -} bool ScrollView::scrollChildren(float touchOffsetX, float touchOffsetY) { bool scrollenabled = true; scrollingEvent(); - switch (_direction) { case Direction::VERTICAL: // vertical { - scrollenabled = this->scrollChilderVertical(touchOffsetX, touchOffsetY); + float realOffset = touchOffsetY; + if (_bounceEnabled) + { + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffset = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffset = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else + { + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffset = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffset = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + moveChildren(0.0f, realOffset); break; } case Direction::HORIZONTAL: // horizontal { - scrollenabled = this->scrollChilderHorizontal(touchOffsetX, touchOffsetY); + float realOffset = touchOffsetX; + if (_bounceEnabled) + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffset = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffset = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + else + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffset = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffset = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + moveChildren(realOffset, 0.0f); break; } case Direction::BOTH: { - scrollenabled = this->scrollChilderBoth(touchOffsetX, touchOffsetY); + float realOffsetX = touchOffsetX; + float realOffsetY = touchOffsetY; + if (_bounceEnabled) + { + if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up + { + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bounceBottomBoundary) + { + realOffsetY = _bounceBottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _bounceRightBoundary) + { + realOffsetX = _bounceRightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down + { + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _bounceTopBoundary) + { + realOffsetY = _bounceTopBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _bounceLeftBoundary) + { + realOffsetX = _bounceLeftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + } + else + { + if (touchOffsetX > 0.0f && touchOffsetY > 0.0f) // up right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY > 0.0f) // up left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY < 0.0f) // down left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY < 0.0f) // down right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY > 0.0f) // up + { + float icBottomPos = _innerContainer->getBottomInParent(); + if (icBottomPos + touchOffsetY >= _bottomBoundary) + { + realOffsetY = _bottomBoundary - icBottomPos; + scrollToBottomEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX < 0.0f && touchOffsetY == 0.0f) // left + { + float icRightPos = _innerContainer->getRightInParent(); + if (icRightPos + touchOffsetX <= _rightBoundary) + { + realOffsetX = _rightBoundary - icRightPos; + scrollToRightEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX == 0.0f && touchOffsetY < 0.0f) // down + { + float icTopPos = _innerContainer->getTopInParent(); + if (icTopPos + touchOffsetY <= _topBoundary) + { + realOffsetY = _topBoundary - icTopPos; + scrollToTopEvent(); + scrollenabled = false; + } + } + else if (touchOffsetX > 0.0f && touchOffsetY == 0.0f) // right + { + float icLeftPos = _innerContainer->getLeftInParent(); + if (icLeftPos + touchOffsetX >= _leftBoundary) + { + realOffsetX = _leftBoundary - icLeftPos; + scrollToLeftEvent(); + scrollenabled = false; + } + } + } + moveChildren(realOffsetX, realOffsetY); break; } default: diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 57c94326f9..2f986dfdeb 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -357,13 +357,7 @@ protected: void startBounceChildren(float v); void stopBounceChildren(); bool checkCustomScrollDestination(float* touchOffsetX, float* touchOffsetY); - virtual bool scrollChildren(float touchOffsetX, float touchOffsetY); - virtual bool scrollChilderHorizontal(float touchOffsetX, float touchOffsetY); - virtual bool scrollChilderVertical(float touchOffsetX, float touchOffsetY); - virtual bool scrollChilderBoth(float touchOffsetX, float touchOffsetY); - - bool bounceScrollChildren(float touchOffsetX, float touchOffsetY); void startRecordSlidAction(); virtual void endRecordSlidAction(); diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 864eac6c09..2af4888fde 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -62,8 +62,7 @@ _opacity(255), _flippedX(false), _flippedY(false), _focused(false), -_focusEnabled(true), -_layoutParameterType(LayoutParameter::Type::NONE) +_focusEnabled(true) { onFocusChanged = CC_CALLBACK_2(Widget::onFocusChange,this); onNextFocusedWidget = nullptr; @@ -816,24 +815,24 @@ bool Widget::isEnabled() const return _enabled; } -float Widget::getLeftBoundary() const +float Widget::getLeftInParent() { - return getPosition().x - getAnchorPoint().x * _size.width; + return getPosition().x - getAnchorPoint().x * _size.width;; } -float Widget::getBottomBoundary() const +float Widget::getBottomInParent() { - return getPosition().y - getAnchorPoint().y * _size.height; + return getPosition().y - getAnchorPoint().y * _size.height;; } -float Widget::getRightBoundary() const +float Widget::getRightInParent() { - return getLeftBoundary() + _size.width; + return getLeftInParent() + _size.width; } -float Widget::getTopBoundary() const +float Widget::getTopInParent() { - return getBottomBoundary() + _size.height; + return getBottomInParent() + _size.height; } const Vec2& Widget::getTouchStartPos() @@ -869,14 +868,8 @@ void Widget::setLayoutParameter(LayoutParameter *parameter) return; } _layoutParameterDictionary.insert((int)parameter->getLayoutType(), parameter); - _layoutParameterType = parameter->getLayoutType(); } -LayoutParameter* Widget::getLayoutParameter() -{ - return dynamic_cast(_layoutParameterDictionary.at((int)_layoutParameterType)); -} - LayoutParameter* Widget::getLayoutParameter(LayoutParameter::Type type) { return dynamic_cast(_layoutParameterDictionary.at((int)type)); diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index e333a3da59..7eee62b2ab 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -28,7 +28,6 @@ THE SOFTWARE. #include "ui/CCProtectedNode.h" #include "ui/UILayoutParameter.h" #include "ui/GUIDefine.h" -#include "ui/UILayoutParameter.h" NS_CC_BEGIN @@ -58,7 +57,7 @@ CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType) #endif -class Widget : public ProtectedNode, public LayoutParameterProtocol +class Widget : public ProtectedNode { public: enum class FocusDirection @@ -201,32 +200,28 @@ public: * * @return The left boundary position of this widget. */ - CC_DEPRECATED_ATTRIBUTE float getLeftInParent(){return this->getLeftBoundary();} - float getLeftBoundary() const; + float getLeftInParent(); /** * Gets the bottom boundary position of this widget. * * @return The bottom boundary position of this widget. */ - CC_DEPRECATED_ATTRIBUTE float getBottomInParent(){return this->getBottomBoundary();} - float getBottomBoundary() const; + float getBottomInParent(); /** * Gets the right boundary position of this widget. * * @return The right boundary position of this widget. */ - CC_DEPRECATED_ATTRIBUTE float getRightInParent(){return this->getRightBoundary();} - float getRightBoundary() const; + float getRightInParent(); /** * Gets the top boundary position of this widget. * * @return The top boundary position of this widget. */ - CC_DEPRECATED_ATTRIBUTE float getTopInParent(){return this->getTopBoundary();} - float getTopBoundary() const; + float getTopInParent(); /** * Gets a child from the container with its name @@ -484,9 +479,7 @@ public: * * @return LayoutParameter */ - LayoutParameter* getLayoutParameter() override; - CC_DEPRECATED_ATTRIBUTE LayoutParameter* getLayoutParameter(LayoutParameter::Type type); - + LayoutParameter* getLayoutParameter(LayoutParameter::Type type); /** * Ignore the widget size @@ -674,12 +667,9 @@ protected: Size _size; Size _customSize; bool _ignoreSize; - + bool _affectByClipping; SizeType _sizeType; Vec2 _sizePercent; - - bool _affectByClipping; - PositionType _positionType; Vec2 _positionPercent; bool _reorderWidgetChildDirty; @@ -689,10 +679,8 @@ protected: GLubyte _opacity; bool _flippedX; bool _flippedY; - //use map to enble switch back and forth for user layout parameters - Map _layoutParameterDictionary; - LayoutParameter::Type _layoutParameterType; - + Map _layoutParameterDictionary; + bool _focused; bool _focusEnabled; diff --git a/cocos/ui/proj.win32/libGUI.vcxproj b/cocos/ui/proj.win32/libGUI.vcxproj index ee4ba81fb8..dab438d560 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj +++ b/cocos/ui/proj.win32/libGUI.vcxproj @@ -19,7 +19,6 @@ - @@ -45,7 +44,6 @@ - diff --git a/cocos/ui/proj.win32/libGUI.vcxproj.filters b/cocos/ui/proj.win32/libGUI.vcxproj.filters index 28a105b739..65f4a3a52c 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj.filters +++ b/cocos/ui/proj.win32/libGUI.vcxproj.filters @@ -87,9 +87,6 @@ Layouts - - Layouts - @@ -158,8 +155,5 @@ Layouts - - Layouts - \ No newline at end of file diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index d2119e1f43..cec7e6ca6f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -60,13 +60,13 @@ bool UIScrollViewTest_Vertical::init() Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png"); titleButton->setTitleText("Title Button"); - titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomBoundary() - button->getSize().height)); + titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomInParent() - button->getSize().height)); scrollView->addChild(titleButton); Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); button_scale9->setScale9Enabled(true); button_scale9->setSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); - button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomBoundary() - titleButton->getSize().height)); + button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomInParent() - titleButton->getSize().height)); scrollView->addChild(button_scale9); imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getSize().height / 2.0f)); @@ -137,19 +137,19 @@ bool UIScrollViewTest_Horizontal::init() Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png"); titleButton->setTitleText("Title Button"); - titleButton->setPosition(Vec2(button->getRightBoundary() + button->getSize().width / 2.0f, - button->getBottomBoundary() - button->getSize().height / 2.0f)); + titleButton->setPosition(Vec2(button->getRightInParent() + button->getSize().width / 2.0f, + button->getBottomInParent() - button->getSize().height / 2.0f)); scrollView->addChild(titleButton); Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); button_scale9->setScale9Enabled(true); button_scale9->setSize(Size(100.0f, button_scale9->getVirtualRendererSize().height)); - button_scale9->setPosition(Vec2(titleButton->getRightBoundary() + titleButton->getSize().width / 2.0f, - titleButton->getBottomBoundary() - titleButton->getSize().height / 2.0f)); + button_scale9->setPosition(Vec2(titleButton->getRightInParent() + titleButton->getSize().width / 2.0f, + titleButton->getBottomInParent() - titleButton->getSize().height / 2.0f)); scrollView->addChild(button_scale9); imageView->setPosition(Vec2(innerWidth - imageView->getSize().width / 2.0f, - button_scale9->getBottomBoundary() - button_scale9->getSize().height / 2.0f)); + button_scale9->getBottomInParent() - button_scale9->getSize().height / 2.0f)); scrollView->addChild(imageView); return true; From 06febdf2b9bd40a27e449633b9420919ffaa7ccb Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 06:40:22 +0000 Subject: [PATCH 60/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 6a04f638f6..da6b76ab1c 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -938,8 +938,6 @@ "cocos/ui/UIImageView.h", "cocos/ui/UILayout.cpp", "cocos/ui/UILayout.h", - "cocos/ui/UILayoutExecutant.cpp", - "cocos/ui/UILayoutExecutant.h", "cocos/ui/UILayoutParameter.cpp", "cocos/ui/UILayoutParameter.h", "cocos/ui/UIListView.cpp", From 33d897327700a259b293a00bf806fdf8080ccb99 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 06:44:06 +0000 Subject: [PATCH 61/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/Layout.lua | 2 +- .../lua-bindings/auto/api/Widget.lua | 57 +-- .../auto/lua_cocos2dx_ui_auto.cpp | 383 +++++++++--------- 3 files changed, 223 insertions(+), 219 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Layout.lua b/cocos/scripting/lua-bindings/auto/api/Layout.lua index e104964c8d..025ed662ee 100644 --- a/cocos/scripting/lua-bindings/auto/api/Layout.lua +++ b/cocos/scripting/lua-bindings/auto/api/Layout.lua @@ -1,7 +1,7 @@ -------------------------------- -- @module Layout --- @extend Widget,LayoutProtocol +-- @extend Widget -------------------------------- -- @function [parent=#Layout] setBackGroundColorVector diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index 25732c5521..aba6a759a2 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -1,13 +1,8 @@ -------------------------------- -- @module Widget --- @extend ProtectedNode,LayoutParameterProtocol +-- @extend ProtectedNode --------------------------------- --- @function [parent=#Widget] clone --- @param self --- @return Widget#Widget ret (return value: ccui.Widget) - -------------------------------- -- @function [parent=#Widget] setSizePercent -- @param self @@ -19,9 +14,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- @function [parent=#Widget] getLeftBoundary +-- @function [parent=#Widget] setFlippedY -- @param self --- @return float#float ret (return value: float) +-- @param #bool bool -------------------------------- -- @function [parent=#Widget] setFlippedX @@ -29,9 +24,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getVirtualRenderer +-- @function [parent=#Widget] getLeftInParent -- @param self --- @return Node#Node ret (return value: cc.Node) +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] getTouchEndPos @@ -69,9 +64,9 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- @function [parent=#Widget] getVirtualRendererSize +-- @function [parent=#Widget] getBottomInParent -- @param self --- @return size_table#size_table ret (return value: size_table) +-- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#Widget] isHighlighted @@ -81,6 +76,7 @@ -------------------------------- -- @function [parent=#Widget] getLayoutParameter -- @param self +-- @param #ccui.LayoutParameter::Type type -- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter) -------------------------------- @@ -88,11 +84,6 @@ -- @param self -- @return Widget::PositionType#Widget::PositionType ret (return value: ccui.Widget::PositionType) --------------------------------- --- @function [parent=#Widget] getTopBoundary --- @param self --- @return float#float ret (return value: float) - -------------------------------- -- @function [parent=#Widget] getChildByName -- @param self @@ -109,6 +100,11 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- @function [parent=#Widget] getVirtualRendererSize +-- @param self +-- @return size_table#size_table ret (return value: size_table) + -------------------------------- -- @function [parent=#Widget] findNextFocusedWidget -- @param self @@ -136,20 +132,15 @@ -- @param self -- @param #bool bool --------------------------------- --- @function [parent=#Widget] setActionTag --- @param self --- @param #int int - -------------------------------- -- @function [parent=#Widget] setTouchEnabled -- @param self -- @param #bool bool -------------------------------- --- @function [parent=#Widget] setFlippedY +-- @function [parent=#Widget] clone -- @param self --- @param #bool bool +-- @return Widget#Widget ret (return value: ccui.Widget) -------------------------------- -- @function [parent=#Widget] getTouchMovePos @@ -162,9 +153,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getRightBoundary +-- @function [parent=#Widget] getVirtualRenderer -- @param self --- @return float#float ret (return value: float) +-- @return Node#Node ret (return value: cc.Node) -------------------------------- -- @function [parent=#Widget] setBrightStyle @@ -197,9 +188,9 @@ -- @param #bool bool -------------------------------- --- @function [parent=#Widget] getBottomBoundary +-- @function [parent=#Widget] setActionTag -- @param self --- @return float#float ret (return value: float) +-- @param #int int -------------------------------- -- @function [parent=#Widget] isBright @@ -218,6 +209,11 @@ -- @param #bool bool -- @return Widget#Widget ret (return value: ccui.Widget) +-------------------------------- +-- @function [parent=#Widget] getTopInParent +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Widget] requestFocus -- @param self @@ -236,6 +232,11 @@ -- @param self -- @return size_table#size_table ret (return value: size_table) +-------------------------------- +-- @function [parent=#Widget] getRightInParent +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Widget] getSizeType -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index 87e10fb497..f9773df6f5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -813,50 +813,6 @@ int lua_register_cocos2dx_ui_RelativeLayoutParameter(lua_State* tolua_S) return 1; } -int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - cocos2d::ui::Widget* ret = cobj->clone(); - object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_setSizePercent(lua_State* tolua_S) { int argc = 0; @@ -947,7 +903,7 @@ int lua_cocos2dx_ui_Widget_getCustomSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getLeftBoundary(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -967,26 +923,28 @@ int lua_cocos2dx_ui_Widget_getLeftBoundary(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - double ret = cobj->getLeftBoundary(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + cobj->setFlippedY(arg0); + return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftBoundary",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftBoundary'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); #endif return 0; @@ -1037,7 +995,7 @@ int lua_cocos2dx_ui_Widget_setFlippedX(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getLeftInParent(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1057,7 +1015,7 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getLeftInParent'", nullptr); return 0; } #endif @@ -1067,16 +1025,16 @@ int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { if(!ok) return 0; - cocos2d::Node* ret = cobj->getVirtualRenderer(); - object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + double ret = cobj->getLeftInParent(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLeftInParent",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getLeftInParent'.",&tolua_err); #endif return 0; @@ -1395,7 +1353,7 @@ int lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getBottomInParent(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -1415,7 +1373,7 @@ int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomInParent'", nullptr); return 0; } #endif @@ -1425,16 +1383,16 @@ int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) { if(!ok) return 0; - const cocos2d::Size& ret = cobj->getVirtualRendererSize(); - size_to_luaval(tolua_S, ret); + double ret = cobj->getBottomInParent(); + tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomInParent",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomInParent'.",&tolua_err); #endif return 0; @@ -1509,15 +1467,18 @@ int lua_cocos2dx_ui_Widget_getLayoutParameter(lua_State* tolua_S) #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + cocos2d::ui::LayoutParameter::Type arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(); + cocos2d::ui::LayoutParameter* ret = cobj->getLayoutParameter(arg0); object_to_luaval(tolua_S, "ccui.LayoutParameter",(cocos2d::ui::LayoutParameter*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLayoutParameter",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 @@ -1571,50 +1532,6 @@ int lua_cocos2dx_ui_Widget_getPositionType(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getTopBoundary(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopBoundary'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - double ret = cobj->getTopBoundary(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopBoundary",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopBoundary'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_getChildByName(lua_State* tolua_S) { int argc = 0; @@ -1750,6 +1667,50 @@ int lua_cocos2dx_ui_Widget_isFocused(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const cocos2d::Size& ret = cobj->getVirtualRendererSize(); + size_to_luaval(tolua_S, ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRendererSize",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRendererSize'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_findNextFocusedWidget(lua_State* tolua_S) { int argc = 0; @@ -1978,52 +1939,6 @@ int lua_cocos2dx_ui_Widget_setFocused(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Widget* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - int arg0; - - ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - if(!ok) - return 0; - cobj->setActionTag(arg0); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) { int argc = 0; @@ -2070,7 +1985,7 @@ int lua_cocos2dx_ui_Widget_setTouchEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_clone(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2090,28 +2005,26 @@ int lua_cocos2dx_ui_Widget_setFlippedY(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setFlippedY'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_clone'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0); if(!ok) return 0; - cobj->setFlippedY(arg0); - return 0; + cocos2d::ui::Widget* ret = cobj->clone(); + object_to_luaval(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret); + return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFlippedY",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "clone",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setFlippedY'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_clone'.",&tolua_err); #endif return 0; @@ -2206,7 +2119,7 @@ int lua_cocos2dx_ui_Widget_setEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getRightBoundary(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_getVirtualRenderer(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2226,7 +2139,7 @@ int lua_cocos2dx_ui_Widget_getRightBoundary(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightBoundary'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'", nullptr); return 0; } #endif @@ -2236,16 +2149,16 @@ int lua_cocos2dx_ui_Widget_getRightBoundary(lua_State* tolua_S) { if(!ok) return 0; - double ret = cobj->getRightBoundary(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + cocos2d::Node* ret = cobj->getVirtualRenderer(); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightBoundary",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVirtualRenderer",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightBoundary'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getVirtualRenderer'.",&tolua_err); #endif return 0; @@ -2522,7 +2435,7 @@ int lua_cocos2dx_ui_Widget_setFocusEnabled(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Widget_getBottomBoundary(lua_State* tolua_S) +int lua_cocos2dx_ui_Widget_setActionTag(lua_State* tolua_S) { int argc = 0; cocos2d::ui::Widget* cobj = nullptr; @@ -2542,26 +2455,28 @@ int lua_cocos2dx_ui_Widget_getBottomBoundary(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setActionTag'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); if(!ok) return 0; - double ret = cobj->getBottomBoundary(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; + cobj->setActionTag(arg0); + return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getBottomBoundary",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getBottomBoundary'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setActionTag'.",&tolua_err); #endif return 0; @@ -2704,6 +2619,50 @@ int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_getTopInParent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getTopInParent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getTopInParent(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getTopInParent",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getTopInParent'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_requestFocus(lua_State* tolua_S) { int argc = 0; @@ -2840,6 +2799,50 @@ int lua_cocos2dx_ui_Widget_getSize(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Widget_getRightInParent(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Widget* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_getRightInParent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getRightInParent(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getRightInParent",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_getRightInParent'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Widget_getSizeType(lua_State* tolua_S) { int argc = 0; @@ -3470,12 +3473,11 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_cclass(tolua_S,"Widget","ccui.Widget","cc.ProtectedNode",nullptr); tolua_beginmodule(tolua_S,"Widget"); - tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); tolua_function(tolua_S,"setSizePercent",lua_cocos2dx_ui_Widget_setSizePercent); tolua_function(tolua_S,"getCustomSize",lua_cocos2dx_ui_Widget_getCustomSize); - tolua_function(tolua_S,"getLeftBoundary",lua_cocos2dx_ui_Widget_getLeftBoundary); + tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Widget_setFlippedX); - tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); + tolua_function(tolua_S,"getLeftInParent",lua_cocos2dx_ui_Widget_getLeftInParent); tolua_function(tolua_S,"getTouchEndPos",lua_cocos2dx_ui_Widget_getTouchEndPos); tolua_function(tolua_S,"setPositionPercent",lua_cocos2dx_ui_Widget_setPositionPercent); tolua_function(tolua_S,"getLayoutSize",lua_cocos2dx_ui_Widget_getLayoutSize); @@ -3483,38 +3485,39 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S) tolua_function(tolua_S,"setPositionType",lua_cocos2dx_ui_Widget_setPositionType); tolua_function(tolua_S,"getName",lua_cocos2dx_ui_Widget_getName); tolua_function(tolua_S,"isIgnoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_isIgnoreContentAdaptWithSize); - tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); + tolua_function(tolua_S,"getBottomInParent",lua_cocos2dx_ui_Widget_getBottomInParent); tolua_function(tolua_S,"isHighlighted",lua_cocos2dx_ui_Widget_isHighlighted); tolua_function(tolua_S,"getLayoutParameter",lua_cocos2dx_ui_Widget_getLayoutParameter); tolua_function(tolua_S,"getPositionType",lua_cocos2dx_ui_Widget_getPositionType); - tolua_function(tolua_S,"getTopBoundary",lua_cocos2dx_ui_Widget_getTopBoundary); tolua_function(tolua_S,"getChildByName",lua_cocos2dx_ui_Widget_getChildByName); tolua_function(tolua_S,"isEnabled",lua_cocos2dx_ui_Widget_isEnabled); tolua_function(tolua_S,"isFocused",lua_cocos2dx_ui_Widget_isFocused); + tolua_function(tolua_S,"getVirtualRendererSize",lua_cocos2dx_ui_Widget_getVirtualRendererSize); tolua_function(tolua_S,"findNextFocusedWidget",lua_cocos2dx_ui_Widget_findNextFocusedWidget); tolua_function(tolua_S,"isTouchEnabled",lua_cocos2dx_ui_Widget_isTouchEnabled); tolua_function(tolua_S,"getActionTag",lua_cocos2dx_ui_Widget_getActionTag); tolua_function(tolua_S,"getWorldPosition",lua_cocos2dx_ui_Widget_getWorldPosition); tolua_function(tolua_S,"setFocused",lua_cocos2dx_ui_Widget_setFocused); - tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); tolua_function(tolua_S,"setTouchEnabled",lua_cocos2dx_ui_Widget_setTouchEnabled); - tolua_function(tolua_S,"setFlippedY",lua_cocos2dx_ui_Widget_setFlippedY); + tolua_function(tolua_S,"clone",lua_cocos2dx_ui_Widget_clone); tolua_function(tolua_S,"getTouchMovePos",lua_cocos2dx_ui_Widget_getTouchMovePos); tolua_function(tolua_S,"setEnabled",lua_cocos2dx_ui_Widget_setEnabled); - tolua_function(tolua_S,"getRightBoundary",lua_cocos2dx_ui_Widget_getRightBoundary); + tolua_function(tolua_S,"getVirtualRenderer",lua_cocos2dx_ui_Widget_getVirtualRenderer); tolua_function(tolua_S,"setBrightStyle",lua_cocos2dx_ui_Widget_setBrightStyle); tolua_function(tolua_S,"setName",lua_cocos2dx_ui_Widget_setName); tolua_function(tolua_S,"setLayoutParameter",lua_cocos2dx_ui_Widget_setLayoutParameter); tolua_function(tolua_S,"getSizePercent",lua_cocos2dx_ui_Widget_getSizePercent); tolua_function(tolua_S,"getTouchStartPos",lua_cocos2dx_ui_Widget_getTouchStartPos); tolua_function(tolua_S,"setFocusEnabled",lua_cocos2dx_ui_Widget_setFocusEnabled); - tolua_function(tolua_S,"getBottomBoundary",lua_cocos2dx_ui_Widget_getBottomBoundary); + tolua_function(tolua_S,"setActionTag",lua_cocos2dx_ui_Widget_setActionTag); tolua_function(tolua_S,"isBright",lua_cocos2dx_ui_Widget_isBright); tolua_function(tolua_S,"clippingParentAreaContainPoint",lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint); tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget); + tolua_function(tolua_S,"getTopInParent",lua_cocos2dx_ui_Widget_getTopInParent); tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus); tolua_function(tolua_S,"updateSizeAndPosition",lua_cocos2dx_ui_Widget_updateSizeAndPosition); tolua_function(tolua_S,"getSize",lua_cocos2dx_ui_Widget_getSize); + tolua_function(tolua_S,"getRightInParent",lua_cocos2dx_ui_Widget_getRightInParent); tolua_function(tolua_S,"getSizeType",lua_cocos2dx_ui_Widget_getSizeType); tolua_function(tolua_S,"ignoreContentAdaptWithSize",lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize); tolua_function(tolua_S,"addTouchEventListener",lua_cocos2dx_ui_Widget_addTouchEventListener); From ccc85ab210081427fcf2633c7695e67cd5c3bf8b Mon Sep 17 00:00:00 2001 From: zhangbin Date: Tue, 20 May 2014 15:03:43 +0800 Subject: [PATCH 62/90] Update the reference of submodule cocos2d-console. --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index d66f714b4e..edd24a1dcc 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit d66f714b4e88199641ea768e107855012652db17 +Subproject commit edd24a1dcc0d8344038e4d46367c603b2a846ab5 From e5a27ad605a2e5ddf096063a407a3f7ed611a416 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 20 May 2014 15:41:19 +0800 Subject: [PATCH 63/90] [ci skip] --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index cf794a5e85..d77819773a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +cocos2d-x-3.1 ??? + [FIX] ProgressTo: will start from 0 when it reaches 100 + cocos2d-x-3.1-rc0 May.18 2014 [NEW] Cocos2dxActivity: Adds a virtual method to load native libraries. [NEW] Directory Structure: reorder some files within the cocos/ folder From f092f26ca56c3b06587ab9a3d2c4c00f4e2abd8c Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 20 May 2014 15:44:12 +0800 Subject: [PATCH 64/90] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index ed65d6a58d..ec5d323bb1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -845,6 +845,7 @@ Developers: Fixed a bug that the effect of particle loaded from CocosBuilder is incorrectly Fix twice calling onExit Fixed bug with cascade opacity and color for control button + Fix Progress Action. Not working with charging from 100 to 0. twhittock Fixed a bug that Application::run returns wrong value on Mac platform From 855b8a27844ac1a8459bab4337fdf9885bb700a8 Mon Sep 17 00:00:00 2001 From: hanbihui Date: Tue, 20 May 2014 16:45:09 +0800 Subject: [PATCH 65/90] Update UIImageView.h Update param name --- cocos/ui/UIImageView.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/ui/UIImageView.h b/cocos/ui/UIImageView.h index 2bf9bd43b3..26ce344704 100644 --- a/cocos/ui/UIImageView.h +++ b/cocos/ui/UIImageView.h @@ -59,7 +59,7 @@ public: /** * create a imageview * - * @param fileName file name of texture. + * @param imageFileName file name of texture. * * @param texType @see UI_TEX_TYPE_LOCAL */ @@ -84,7 +84,7 @@ public: /** * Sets if imageview is using scale9 renderer. * - * @param true that using scale9 renderer, false otherwise. + * @param able true that using scale9 renderer, false otherwise. */ void setScale9Enabled(bool able); From 55c1319426b0092a9d986c13713f76caec5cf938 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Tue, 20 May 2014 16:54:51 +0800 Subject: [PATCH 66/90] closed issue#5252:Label:It could be possible that for using outline cause crash. --- cocos/2d/CCFontFreeType.cpp | 53 ++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index c99269bcdd..2f93ac75f0 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -286,8 +286,6 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid auto copyBitmap = new unsigned char[outWidth * outHeight]; memcpy(copyBitmap,ret,outWidth * outHeight * sizeof(unsigned char)); - long bitmapWidth; - long bitmapHeight; FT_BBox bbox; auto outlineBitmap = getGlyphBitmapWithOutline(theChar,bbox); if(outlineBitmap == nullptr) @@ -297,42 +295,47 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid break; } - bitmapWidth = (bbox.xMax - bbox.xMin)>>6; - bitmapHeight = (bbox.yMax - bbox.yMin)>>6; + long outlineWidth = (bbox.xMax - bbox.xMin)>>6; + long outlineHeight = (bbox.yMax - bbox.yMin)>>6; - long index; - auto blendImage = new unsigned char[bitmapWidth * bitmapHeight * 2]; - memset(blendImage, 0, bitmapWidth * bitmapHeight * 2); - for (int x = 0; x < bitmapWidth; ++x) + long blendWidth = outlineWidth > outWidth ? outlineWidth : outWidth; + long blendHeight = outlineHeight > outHeight ? outlineHeight : outHeight; + + long index,index2; + auto blendImage = new unsigned char[blendWidth * blendHeight * 2]; + memset(blendImage, 0, blendWidth * blendHeight * 2); + + int px = blendWidth == outlineWidth ? 0 : _outlineSize; + int py = blendHeight == outlineHeight ? 0 : _outlineSize; + for (int x = 0; x < outlineWidth; ++x) { - for (int y = 0; y < bitmapHeight; ++y) + for (int y = 0; y < outlineHeight; ++y) { - index = x + ( y * bitmapWidth ); - blendImage[2 * index] = outlineBitmap[index]; + index = px + x + ( (py + y) * blendWidth ); + index2 = x + (y * outlineWidth); + blendImage[2 * index] = outlineBitmap[index2]; } } - long maxX = outWidth + _outlineSize; - long maxY = outHeight + _outlineSize; - for (int x = _outlineSize; x < maxX; ++x) + px = blendWidth == outWidth ? 0 : _outlineSize; + py = blendHeight == outHeight ? 0 : _outlineSize; + for (int x = 0; x < outWidth; ++x) { - for (int y = _outlineSize; y < maxY; ++y) + for (int y = 0; y < outHeight; ++y) { - index = x + ( y * bitmapWidth ); - - blendImage[2 * index + 1] = copyBitmap[outWidth * (y - _outlineSize) + x - _outlineSize]; + index = px + x + ( (y + py) * blendWidth ); + index2 = x + (y * outWidth); + blendImage[2 * index + 1] = copyBitmap[index2]; } } outRect.origin.x = bbox.xMin >> 6; outRect.origin.y = - (bbox.yMax >> 6); - - xAdvance += bitmapWidth - outRect.size.width; - - outRect.size.width = bitmapWidth; - outRect.size.height = bitmapHeight; - outWidth = bitmapWidth; - outHeight = bitmapHeight; + xAdvance += 2 * _outlineSize; + outRect.size.width = blendWidth; + outRect.size.height = blendHeight; + outWidth = blendWidth; + outHeight = blendHeight; delete [] outlineBitmap; delete [] copyBitmap; From 92074b780e1ff1f07c1a29bc6fb3b945573bf34a Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 20 May 2014 17:49:43 +0800 Subject: [PATCH 67/90] [ci skip] --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index ec5d323bb1..ddc9082dd2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -858,6 +858,9 @@ Developers: NatWeiss Fix compilation error using arch i386 + + favorcode + Correct some doxygen comment Retired Core Developers: WenSheng Yang From 2d65f9bc6fb4dce0115d8e4b88235aa71214cb61 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Tue, 20 May 2014 18:09:04 +0800 Subject: [PATCH 68/90] issue #5255:Add Sprite3D test cases for Lua --- .../manual/LuaBasicConversions.cpp | 279 ++++++++++++++++++ .../lua-bindings/manual/LuaBasicConversions.h | 11 + .../lua-bindings/manual/LuaOpengl.cpp | 69 +++-- .../manual/lua_cocos2dx_manual.cpp | 76 +++++ .../src/Sprite3DTest/Sprite3DTest.lua | 275 +++++++++++++++++ tests/lua-tests/src/mainMenu.lua | 2 + tools/bindings-generator | 2 +- tools/tolua/cocos2dx.ini | 4 +- 8 files changed, 693 insertions(+), 25 deletions(-) create mode 100644 tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp index ba90a32049..d443d4c78f 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -340,6 +340,48 @@ bool luaval_to_vec3(lua_State* L,int lo,cocos2d::Vec3* outValue) return ok; } +bool luaval_to_vec4(lua_State* L,int lo,cocos2d::Vec4* outValue) +{ + if (nullptr == L || nullptr == outValue) + return false; + + bool ok = true; + + tolua_Error tolua_err; + if (!tolua_istable(L, lo, 0, &tolua_err) ) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err); +#endif + ok = false; + } + + + if (ok) + { + lua_pushstring(L, "x"); + lua_gettable(L, lo); + outValue->x = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "y"); + lua_gettable(L, lo); + outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "z"); + lua_gettable(L, lo); + outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "w"); + lua_gettable(L, lo); + outValue->y = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + } + return ok; +} + bool luaval_to_blendfunc(lua_State* L, int lo, cocos2d::BlendFunc* outValue) { if (nullptr == L || nullptr == outValue) @@ -1697,6 +1739,129 @@ bool luaval_to_std_vector_int(lua_State* L, int lo, std::vector* ret) return ok; } +bool luaval_to_mesh_vertex_attrib(lua_State* L, int lo, cocos2d::MeshVertexAttrib* ret) +{ + if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) + return false; + + tolua_Error tolua_err; + bool ok = true; + + if (!tolua_istable(L, lo, 0, &tolua_err)) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err); +#endif + ok = false; + } + + + if (ok) + { + lua_pushstring(L, "size"); /* L: paramStack key */ + lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */ + ret->size = (GLint)lua_tonumber(L, -1); + lua_pop(L,1); + + lua_pushstring(L, "type"); /* L: paramStack key */ + lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */ + ret->type = (GLenum)lua_tonumber(L, -1); + lua_pop(L,1); + + lua_pushstring(L, "vertexAttrib"); /* L: paramStack key */ + lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */ + ret->type = (GLenum)lua_tonumber(L, -1); + lua_pop(L,1); + + lua_pushstring(L, "vertexAttrib"); /* L: paramStack key */ + lua_gettable(L,lo); /* L: paramStack paramStack[lo][key] */ + ret->type = (GLenum)lua_tonumber(L, -1); + lua_pop(L,1); + } + + return ok; + +} + +bool luaval_to_std_vector_float(lua_State* L, int lo, std::vector* ret) +{ + if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) + return false; + + tolua_Error tolua_err; + bool ok = true; + + if (!tolua_istable(L, lo, 0, &tolua_err)) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err); +#endif + ok = false; + } + + if (ok) + { + size_t len = lua_objlen(L, lo); + for (int i = 0; i < len; i++) + { + lua_pushnumber(L, i + 1); + lua_gettable(L,lo); + if(lua_isnumber(L, -1)) + { + ret->push_back((float)tolua_tonumber(L, -1, 0)); + } + else + { + CCASSERT(false, "float type is needed"); + } + + lua_pop(L, 1); + } + } + + return ok; +} + + +bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector* ret) +{ + if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) + return false; + + tolua_Error tolua_err; + bool ok = true; + + if (!tolua_istable(L, lo, 0, &tolua_err)) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err); +#endif + ok = false; + } + + if (ok) + { + size_t len = lua_objlen(L, lo); + for (int i = 0; i < len; i++) + { + lua_pushnumber(L, i + 1); + lua_gettable(L,lo); + if(lua_isnumber(L, -1)) + { + ret->push_back((unsigned short)tolua_tonumber(L, -1, 0)); + } + else + { + CCASSERT(false, "unsigned short type is needed"); + } + + lua_pop(L, 1); + } + } + + return ok; +} + void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count) { if (NULL == L) @@ -1741,6 +1906,26 @@ void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3) lua_rawset(L, -3); } +void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3) +{ + if (NULL == L) + return; + + lua_newtable(L); /* L: table */ + lua_pushstring(L, "x"); /* L: table key */ + lua_pushnumber(L, (lua_Number) vec3.x); /* L: table key value*/ + lua_rawset(L, -3); /* table[key] = value, L: table */ + lua_pushstring(L, "y"); /* L: table key */ + lua_pushnumber(L, (lua_Number) vec3.y); /* L: table key value*/ + lua_rawset(L, -3); + lua_pushstring(L, "z"); /* L: table key */ + lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/ + lua_rawset(L, -3); + lua_pushstring(L, "w"); /* L: table key */ + lua_pushnumber(L, (lua_Number) vec3.z); /* L: table key value*/ + lua_rawset(L, -3); +} + void physics_material_to_luaval(lua_State* L,const PhysicsMaterial& pm) { if (nullptr == L) @@ -2476,3 +2661,97 @@ void ttfconfig_to_luaval(lua_State* L, const cocos2d::TTFConfig& config) lua_pushnumber(L, (lua_Number)config.outlineSize); lua_rawset(L, -3); } + +void mesh_vertex_attrib_to_luaval(lua_State* L, const cocos2d::MeshVertexAttrib& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + lua_pushstring(L, "size"); + lua_pushnumber(L, (lua_Number)inValue.size); + lua_rawset(L, -3); + + lua_pushstring(L, "type"); + lua_pushnumber(L, (lua_Number)inValue.type); + lua_rawset(L, -3); + + lua_pushstring(L, "vertexAttrib"); + lua_pushnumber(L, (lua_Number)inValue.vertexAttrib); + lua_rawset(L, -3); + + lua_pushstring(L, "attribSizeBytes"); + lua_pushnumber(L, (lua_Number)inValue.attribSizeBytes); + lua_rawset(L, -3); +} + + +void ccvector_std_string_to_luaval(lua_State* L, const std::vector& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + int index = 1; + + for (const std::string value : inValue) + { + lua_pushnumber(L, (lua_Number)index); + lua_pushstring(L, value.c_str()); + lua_rawset(L, -3); + ++index; + } +} + +void ccvector_int_to_luaval(lua_State* L, const std::vector& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + int index = 1; + for (const int value : inValue) + { + lua_pushnumber(L, (lua_Number)index); + lua_pushnumber(L, (lua_Number)value); + lua_rawset(L, -3); + ++index; + } +} + +void ccvector_float_to_luaval(lua_State* L, const std::vector& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + int index = 1; + for (const float value : inValue) + { + lua_pushnumber(L, (lua_Number)index); + lua_pushnumber(L, (lua_Number)value); + lua_rawset(L, -3); + ++index; + } +} + +void ccvector_ushort_to_luaval(lua_State* L, const std::vector& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + int index = 1; + for (const unsigned short value : inValue) + { + lua_pushnumber(L, (lua_Number)index); + lua_pushnumber(L, (lua_Number)value); + lua_rawset(L, -3); + ++index; + } +} diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h index 6394ff5a6b..10c9ec07ae 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -73,6 +73,7 @@ extern bool luavals_variadic_to_array(lua_State* L,int argc, __Array** ret); extern bool luavals_variadic_to_ccvaluevector(lua_State* L, int argc, cocos2d::ValueVector* ret); extern bool luaval_to_vec2(lua_State* L,int lo,cocos2d::Vec2* outValue); extern bool luaval_to_vec3(lua_State* L,int lo,cocos2d::Vec3* outValue); +extern bool luaval_to_vec4(lua_State* L,int lo,cocos2d::Vec4* outValue); extern bool luaval_to_blendfunc(lua_State* L, int lo, cocos2d::BlendFunc* outValue); extern bool luaval_to_ttfconfig(lua_State* L, int lo, cocos2d::TTFConfig* outValue); @@ -228,10 +229,14 @@ bool luaval_to_object(lua_State* L, int lo, const char* type, T** ret) return true; } +extern bool luaval_to_mesh_vertex_attrib(lua_State* L, int lo, cocos2d::MeshVertexAttrib* ret); +extern bool luaval_to_std_vector_float(lua_State* L, int lo, std::vector* ret); +extern bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector* ret); // from native extern void vec2_to_luaval(lua_State* L,const cocos2d::Vec2& vec2); extern void vec3_to_luaval(lua_State* L,const cocos2d::Vec3& vec3); +extern void vec4_to_luaval(lua_State* L,const cocos2d::Vec4& vec3); extern void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count); extern void size_to_luaval(lua_State* L,const Size& sz); extern void rect_to_luaval(lua_State* L,const Rect& rt); @@ -372,4 +377,10 @@ void object_to_luaval(lua_State* L,const char* type, T* ret) } } +void mesh_vertex_attrib_to_luaval(lua_State* L, const cocos2d::MeshVertexAttrib& inValue); +void ccvector_std_string_to_luaval(lua_State* L, const std::vector& inValue); +void ccvector_int_to_luaval(lua_State* L, const std::vector& inValue); +void ccvector_float_to_luaval(lua_State* L, const std::vector& inValue); +void ccvector_ushort_to_luaval(lua_State* L, const std::vector& inValue); + #endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__ diff --git a/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp b/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp index dd2ee1b0de..d07416b867 100644 --- a/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp @@ -1447,7 +1447,7 @@ static int tolua_Cocos2d_glDrawElements00(lua_State* tolua_S) !tolua_isnumber(tolua_S,2,0,&tolua_err) || !tolua_isnumber(tolua_S,3,0,&tolua_err) || !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_istable(tolua_S,5,0,&tolua_err) || + !tolua_istable(tolua_S,5,1,&tolua_err) || !tolua_isnoobj(tolua_S,6, &tolua_err) ) goto tolua_lerror; @@ -1460,45 +1460,70 @@ static int tolua_Cocos2d_glDrawElements00(lua_State* tolua_S) unsigned int arg3 = (unsigned int)tolua_tonumber(tolua_S, 4, 0); if (GL_UNSIGNED_BYTE == arg2) { - unsigned char* unit8Array = new unsigned char[arg3]; - if (NULL == unit8Array) + if (arg3 > 0) { - return 0; + unsigned char* unit8Array = new unsigned char[arg3]; + if (NULL == unit8Array) + { + return 0; + } + for (unsigned int i = 1; i <= arg3; i++) + { + unit8Array[i-1] = (unsigned char)tolua_tofieldnumber(tolua_S, 5, i, 0); + } + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)unit8Array); + CC_SAFE_DELETE_ARRAY(unit8Array); + } - for (unsigned int i = 1; i <= arg3; i++) + else { - unit8Array[i-1] = (unsigned char)tolua_tofieldnumber(tolua_S, 5, i, 0); + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr); } - glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)unit8Array); - CC_SAFE_DELETE_ARRAY(unit8Array); } else if(GL_UNSIGNED_SHORT == arg2) { - unsigned short* shortArray = new unsigned short[arg3]; - if (NULL == shortArray) + if (arg3 > 0) { - return 0; + unsigned short* shortArray = new unsigned short[arg3]; + if (NULL == shortArray) + { + return 0; + } + for (unsigned int i = 1; i <= arg3; i++) + { + shortArray[i-1] = (unsigned short)tolua_tofieldnumber(tolua_S, 5, i, 0); + } + + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)shortArray); + + CC_SAFE_DELETE_ARRAY(shortArray); } - for (unsigned int i = 1; i <= arg3; i++) + else { - shortArray[i-1] = (unsigned short)tolua_tofieldnumber(tolua_S, 5, i, 0); + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr); } - glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)shortArray); - CC_SAFE_DELETE_ARRAY(shortArray); } else if(GL_UNSIGNED_INT == arg2) { - unsigned int* intArray = new unsigned int[arg3]; - if (NULL == intArray) + if (arg3 > 0) { - return 0; + unsigned int* intArray = new unsigned int[arg3]; + if (NULL == intArray) + { + return 0; + } + for (unsigned int i = 1; i <= arg3; i++) + { + intArray[i-1] = (unsigned int)tolua_tofieldnumber(tolua_S, 5, i, 0); + } + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)intArray); + CC_SAFE_DELETE_ARRAY(intArray); } - for (unsigned int i = 1; i <= arg3; i++) + else { - intArray[i-1] = (unsigned int)tolua_tofieldnumber(tolua_S, 5, i, 0); + glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , nullptr); + } - glDrawElements((GLenum)arg0 , (GLsizei)arg1 , (GLenum)arg2 , (GLvoid*)intArray); - CC_SAFE_DELETE_ARRAY(intArray); } } return 0; diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp index 9e765728f1..0e16c074f5 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp @@ -5296,6 +5296,80 @@ static void extendConsole(lua_State* tolua_S) lua_pop(tolua_S, 1); } +static int lua_cocos2dx_GLProgramState_setVertexAttribPointer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setVertexAttribPointer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 6) + { + std::string arg0; + int arg1; + unsigned int arg2; + bool arg3; + int arg4; + int arg5; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); + + ok &= luaval_to_uint32(tolua_S, 4,&arg2); + + ok &= luaval_to_boolean(tolua_S, 5, &arg3); + + ok &= luaval_to_int32(tolua_S, 6,(int *)&arg4); + + ok &= luaval_to_int32(tolua_S, 7, (int *)&arg5); + + if(!ok) + return 0; + cobj->setVertexAttribPointer(arg0, arg1, arg2, arg3, arg4, (void*)arg5); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setVertexAttribPointer",argc, 6); + return 0; + +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setVertexAttribPointer'.",&tolua_err); +#endif + + return 0; +} + +static void extendGLProgramState(lua_State* tolua_S) +{ + lua_pushstring(tolua_S, "cc.GLProgramState"); + lua_rawget(tolua_S, LUA_REGISTRYINDEX); + if (lua_istable(tolua_S,-1)) + { + tolua_function(tolua_S,"setVertexAttribPointer", lua_cocos2dx_GLProgramState_setVertexAttribPointer); + } + lua_pop(tolua_S, 1); +} + int register_all_cocos2dx_manual(lua_State* tolua_S) { if (NULL == tolua_S) @@ -5344,5 +5418,7 @@ int register_all_cocos2dx_manual(lua_State* tolua_S) extendLabel(tolua_S); extendTMXTiledMap(tolua_S); extendConsole(tolua_S); + extendGLProgramState(tolua_S); + return 0; } diff --git a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua new file mode 100644 index 0000000000..263f56659f --- /dev/null +++ b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua @@ -0,0 +1,275 @@ +local size = cc.Director:getInstance():getWinSize() +local attributeNames = +{ + "a_position", + "a_color", + "a_texCoord", + "a_normal", +} + + +---------------------------------------- +----Sprite3DBasicTest +---------------------------------------- + +local Sprite3DBasicTest = {} +Sprite3DBasicTest.__index = Sprite3DBasicTest + +function Sprite3DBasicTest.onTouchesEnd(touches, event) + for i = 1,table.getn(touches) do + local location = touches[i]:getLocation() + Sprite3DBasicTest.addNewSpriteWithCoords(Helper.currentLayer, location.x, location.y ) + end +end + +function Sprite3DBasicTest.addNewSpriteWithCoords(parent,x,y) + local sprite = cc.Sprite3D:create("Sprite3DTest/boss1.obj") + sprite:setScale(3.0) + sprite:setTexture("Sprite3DTest/boss.png") + + parent:addChild(sprite) + sprite:setPosition(cc.p(x,y)) + + local random = math.random(0, 1) + local action = nil + if random < 0.2 then + action = cc.ScaleBy:create(3,2) + elseif random < 0.4 then + action = cc.RotateBy:create(3, 360) + elseif random < 0.6 then + action = cc.Blink:create(1, 3) + elseif random < 0.8 then + action = cc.TintBy:create(2, 0, -255, -255) + else + action = cc.FadeOut:create(2) + end + + local action_back = action:reverse() + local seq = cc.Sequence:create(action, action_back) + + sprite:runAction(cc.RepeatForever:create(seq)) +end + +function Sprite3DBasicTest.create() + local layer = cc.Layer:create() + Helper.initWithLayer(layer) + Helper.titleLabel:setString("Testing Sprite3D") + Helper.subtitleLabel:setString("Tap screen to add more sprites") + + local listener = cc.EventListenerTouchAllAtOnce:create() + listener:registerScriptHandler(Sprite3DBasicTest.onTouchesEnd,cc.Handler.EVENT_TOUCHES_ENDED ) + + local eventDispatcher = layer:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer) + + Sprite3DBasicTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2) + return layer +end + +---------------------------------------- +----Sprite3DEffectTest +---------------------------------------- + +local Effect3DOutline = class("Effect3DOutline") +Effect3DOutline.__index = Effect3DOutline + +function Effect3DOutline:ctor() + self.outlineWidth = 0.0 + self.outlineColor = { x = 1, y = 1, z = 1} + self.glProgramState = nil + self.vertShaderFile = "Shaders3D/OutLine.vert" + self.fragShaderFile = "Shaders3D/OutLine.frag" + self.keyInGLProgramCache = "Effect3DLibrary_Outline" + + if self:init() then + return self + else + return nil + end +end + +function Effect3DOutline:getOrCreateProgram() + + local program = cc.GLProgramCache:getInstance():getGLProgram(self.keyInGLProgramCache) + + if nil == program then + program = cc.GLProgram:createWithFilenames(self.vertShaderFile , self.fragShaderFile) + cc.GLProgramCache:getInstance():addGLProgram(program, self.keyInGLProgramCache) + end + print(program) + return program +end + +function Effect3DOutline:init() + local program = self:getOrCreateProgram() + if nil == program then + return false + end + + self.glProgramState = cc.GLProgramState:create(program) + if nil == self.glProgramState then + return false + end + + self.glProgramState:retain() + self.glProgramState:setUniformVec3("OutLineColor", self.outlineColor) + self.glProgramState:setUniformFloat("OutlineWidth", self.outlineWidth) + + return true +end + + +function Effect3DOutline:setOutlineColor(color) + if self.outlineColor.x ~= color.x and self.outlineColor.y ~= color.y or self.outlineColor.z ~= color.z then + self.outlineColor.x = color.x + self.outlineColor.y = color.y + self.outlineColor.z = color.z + self.glProgramState:setUniformVec3("OutLineColor", self.outlineColor) + end +end + +function Effect3DOutline:setOutlineWidth(width) + if self.outlineWidth ~= width then + self.outlineWidth = width + self.glProgramState:setUniformFloat("OutlineWidth", self.outlineWidth ) + end +end + +function Effect3DOutline:drawWithSprite(sprite, transform) + + local mesh = sprite:getMesh() + local offset = 0 + for i = 1, mesh:getMeshVertexAttribCount() do + local meshvertexattrib = mesh:getMeshVertexAttribute(i - 1) + self.glProgramState:setVertexAttribPointer(attributeNames[meshvertexattrib.vertexAttrib + 1], meshvertexattrib.size, meshvertexattrib.type, false, mesh:getVertexSizeInBytes(), offset) + offset = offset + meshvertexattrib.attribSizeBytes + end + + --draw + gl.enable(gl.CULL_FACE) + gl.cullFace(gl.FRONT) + gl.enable(gl.DEPTH_TEST) + + local color = sprite:getDisplayedColor() + color.a = sprite:getDisplayedOpacity() / 255.0 + self.glProgramState:setUniformVec4("u_color", {x = color.r / 255.0, y = color.g / 255.0, z = color.b / 255.0, w = 1.0}) + + mesh = sprite:getMesh() + gl.bindBuffer(gl.ARRAY_BUFFER, mesh:getVertexBuffer()) + self.glProgramState:apply(transform) + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh:getIndexBuffer()) + gl.drawElements(mesh:getPrimitiveType(), mesh:getIndexCount(), mesh:getIndexFormat(), 0) + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0) + gl.bindBuffer(gl.ARRAY_BUFFER, 0) + gl.disable(gl.DEPTH_TEST) + gl.cullFace(gl.BACK) + gl.disable(gl.CULL_FACE) +end + + +local EffectSprite3D = class("EffectSprite3D") +EffectSprite3D.__index = EffectSprite3D + +function EffectSprite3D.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, EffectSprite3D) + return target +end + +function EffectSprite3D:init() + self.effects = {} + self.defaultEffect = nil +end + +function EffectSprite3D.createFromObjFileAndTexture(objFilePath, textureFilePath) + local sprite = EffectSprite3D.extend(cc.Sprite3D:create(objFilePath)) + sprite:setTexture(textureFilePath) + return sprite +end + + +local Sprite3DEffectTest = {} +Sprite3DEffectTest.__index = Sprite3DEffectTest + +function Sprite3DEffectTest.onTouchesEnd(touches, event) + for i = 1,table.getn(touches) do + local location = touches[i]:getLocation() + Sprite3DEffectTest.addNewSpriteWithCoords(Helper.currentLayer, location.x, location.y ) + end +end + +function Sprite3DEffectTest.addNewSpriteWithCoords(layer, x, y) + local sprite = EffectSprite3D.createFromObjFileAndTexture("Sprite3DTest/boss1.obj", "Sprite3DTest/boss.png") + sprite:setScale(6.0) + layer:addChild(sprite) + sprite:setPosition(cc.p(x, y)) + + local effect = Effect3DOutline.new() + effect:setOutlineColor({x = 1, y = 0, z =0}) + effect:setOutlineWidth(0.1) + local effect2 = Effect3DOutline.new() + effect2:setOutlineWidth(0.02) + effect2:setOutlineColor({x = 1, y = 1, z =0}) + + + local function onDraw(transform, transformUpdated) + effect:drawWithSprite(sprite, transform) + effect2:drawWithSprite(sprite, transform) + end + + local random = math.random(0, 1) + local action = nil + if random < 0.2 then + action = cc.ScaleBy:create(3,2) + elseif random < 0.4 then + action = cc.RotateBy:create(3, 360) + elseif random < 0.6 then + action = cc.Blink:create(1, 3) + elseif random < 0.8 then + action = cc.TintBy:create(2, 0, -255, -255) + else + action = cc.FadeOut:create(2) + end + + local action_back = action:reverse() + local seq = cc.Sequence:create(action, action_back) + + sprite:runAction(cc.RepeatForever:create(seq)) + + local glNode = gl.glNodeCreate() + glNode:setContentSize(cc.size(size.width, size.height)) + glNode:setAnchorPoint(cc.p(0.5, 0.5)) + glNode:setPosition( size.width / 2, size.height / 2) + glNode:registerScriptDrawHandler(onDraw) + layer:addChild(glNode,-10) + +end + +function Sprite3DEffectTest.create() + local layer = cc.Layer:create() + Helper.initWithLayer(layer) + Helper.titleLabel:setString("Testing Sprite3D") + Helper.subtitleLabel:setString("Sprite3d with effects") + + Sprite3DEffectTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2) + return layer +end + +function Sprite3DTest() + local scene = cc.Scene:create() + + Helper.createFunctionTable = + { + Sprite3DBasicTest.create, + Sprite3DEffectTest.create, + } + + scene:addChild(Sprite3DBasicTest.create()) + scene:addChild(CreateBackMenuItem()) + + return scene +end diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 844fb7e1a5..8d2241a1f4 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -39,6 +39,7 @@ require "src/ParticleTest/ParticleTest" require "src/PerformanceTest/PerformanceTest" require "src/RenderTextureTest/RenderTextureTest" require "src/RotateWorldTest/RotateWorldTest" +require "src/Sprite3DTest/Sprite3DTest" require "src/SpriteTest/SpriteTest" require "src/SceneTest/SceneTest" require "src/SpineTest/SpineTest" @@ -102,6 +103,7 @@ local _allTests = { { isSupported = true, name = "SpineTest" , create_func = SpineTestMain }, { isSupported = false, name = "SchdulerTest" , create_func= SchdulerTestMain }, { isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain }, + { isSupported = true, name = "Sprite3DTest" , create_func = Sprite3DTest }, { isSupported = true, name = "SpriteTest" , create_func = SpriteTest }, { isSupported = false, name = "TextInputTest" , create_func= TextInputTestMain }, { isSupported = true, name = "Texture2DTest" , create_func = Texture2dTestMain }, diff --git a/tools/bindings-generator b/tools/bindings-generator index 0aba499447..e9f1775eb8 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 0aba499447134661135f55e84681540ade4f766f +Subproject commit e9f1775eb85c4ccf429556199634048df920688d diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 26acb84b6f..e35bb9d96e 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAu # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewProtocol GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console +classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewProtocol GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console Mesh GLProgramCache GLProgramState # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -120,7 +120,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS Console::[addCommand], ParallaxNode::[getParallaxArray], TileMapAtlas::[getTGAInfo], - Sprite3D::[getMesh] + GLProgramState::[setVertexAttribCallback setUniformCallback setVertexAttribPointer] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], ProgressTimer::[setReverseProgress=setReverseDirection], From f734cc3f7ba18e7e4c27a38d1e859baf28fcbc6e Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 11:46:42 +0000 Subject: [PATCH 69/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/GLProgramCache.lua | 39 + .../lua-bindings/auto/api/GLProgramState.lua | 100 + .../scripting/lua-bindings/auto/api/Mesh.lua | 66 + .../lua-bindings/auto/api/Sprite3D.lua | 5 + .../auto/api/lua_cocos2dx_auto_api.lua | 15 + .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 1626 ++++++++++++++++- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 38 + 7 files changed, 1887 insertions(+), 2 deletions(-) create mode 100644 cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/GLProgramState.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/Mesh.lua diff --git a/cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua b/cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua new file mode 100644 index 0000000000..1f6f66d157 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua @@ -0,0 +1,39 @@ + +-------------------------------- +-- @module GLProgramCache +-- @extend Ref + +-------------------------------- +-- @function [parent=#GLProgramCache] addGLProgram +-- @param self +-- @param #cc.GLProgram glprogram +-- @param #string str + +-------------------------------- +-- @function [parent=#GLProgramCache] getGLProgram +-- @param self +-- @param #string str +-- @return GLProgram#GLProgram ret (return value: cc.GLProgram) + +-------------------------------- +-- @function [parent=#GLProgramCache] reloadDefaultGLPrograms +-- @param self + +-------------------------------- +-- @function [parent=#GLProgramCache] loadDefaultGLPrograms +-- @param self + +-------------------------------- +-- @function [parent=#GLProgramCache] destroyInstance +-- @param self + +-------------------------------- +-- @function [parent=#GLProgramCache] getInstance +-- @param self +-- @return GLProgramCache#GLProgramCache ret (return value: cc.GLProgramCache) + +-------------------------------- +-- @function [parent=#GLProgramCache] GLProgramCache +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua b/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua new file mode 100644 index 0000000000..c47765057e --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua @@ -0,0 +1,100 @@ + +-------------------------------- +-- @module GLProgramState +-- @extend Ref + +-------------------------------- +-- overload function: setUniformTexture(string, unsigned int) +-- +-- overload function: setUniformTexture(string, cc.Texture2D) +-- +-- @function [parent=#GLProgramState] setUniformTexture +-- @param self +-- @param #string str +-- @param #cc.Texture2D texture2d + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformMat4 +-- @param self +-- @param #string str +-- @param #cc.Mat4 mat4 + +-------------------------------- +-- @function [parent=#GLProgramState] getUniformCount +-- @param self +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformFloat +-- @param self +-- @param #string str +-- @param #float float + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformVec3 +-- @param self +-- @param #string str +-- @param #cc.Vec3 vec3 + +-------------------------------- +-- @function [parent=#GLProgramState] setGLProgram +-- @param self +-- @param #cc.GLProgram glprogram + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformVec4 +-- @param self +-- @param #string str +-- @param #cc.Vec4 vec4 + +-------------------------------- +-- @function [parent=#GLProgramState] getVertexAttribCount +-- @param self +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformInt +-- @param self +-- @param #string str +-- @param #int int + +-------------------------------- +-- @function [parent=#GLProgramState] setUniformVec2 +-- @param self +-- @param #string str +-- @param #cc.Vec2 vec2 + +-------------------------------- +-- @function [parent=#GLProgramState] getVertexAttribsFlags +-- @param self +-- @return unsigned int#unsigned int ret (return value: unsigned int) + +-------------------------------- +-- @function [parent=#GLProgramState] apply +-- @param self +-- @param #cc.Mat4 mat4 + +-------------------------------- +-- @function [parent=#GLProgramState] getGLProgram +-- @param self +-- @return GLProgram#GLProgram ret (return value: cc.GLProgram) + +-------------------------------- +-- @function [parent=#GLProgramState] create +-- @param self +-- @param #cc.GLProgram glprogram +-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState) + +-------------------------------- +-- @function [parent=#GLProgramState] getOrCreateWithGLProgramName +-- @param self +-- @param #string str +-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState) + +-------------------------------- +-- @function [parent=#GLProgramState] getOrCreateWithGLProgram +-- @param self +-- @param #cc.GLProgram glprogram +-- @return GLProgramState#GLProgramState ret (return value: cc.GLProgramState) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Mesh.lua b/cocos/scripting/lua-bindings/auto/api/Mesh.lua new file mode 100644 index 0000000000..5d2de87cff --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/Mesh.lua @@ -0,0 +1,66 @@ + +-------------------------------- +-- @module Mesh +-- @extend Ref + +-------------------------------- +-- @function [parent=#Mesh] restore +-- @param self + +-------------------------------- +-- @function [parent=#Mesh] getMeshVertexAttribCount +-- @param self +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#Mesh] getIndexFormat +-- @param self +-- @return Mesh::IndexFormat#Mesh::IndexFormat ret (return value: cc.Mesh::IndexFormat) + +-------------------------------- +-- @function [parent=#Mesh] getVertexSizeInBytes +-- @param self +-- @return int#int ret (return value: int) + +-------------------------------- +-- @function [parent=#Mesh] getPrimitiveType +-- @param self +-- @return Mesh::PrimitiveType#Mesh::PrimitiveType ret (return value: cc.Mesh::PrimitiveType) + +-------------------------------- +-- @function [parent=#Mesh] getIndexCount +-- @param self +-- @return long#long ret (return value: long) + +-------------------------------- +-- @function [parent=#Mesh] getVertexBuffer +-- @param self +-- @return unsigned int#unsigned int ret (return value: unsigned int) + +-------------------------------- +-- @function [parent=#Mesh] getMeshVertexAttribute +-- @param self +-- @param #int int +-- @return MeshVertexAttrib#MeshVertexAttrib ret (return value: cc.MeshVertexAttrib) + +-------------------------------- +-- @function [parent=#Mesh] getIndexBuffer +-- @param self +-- @return unsigned int#unsigned int ret (return value: unsigned int) + +-------------------------------- +-- @function [parent=#Mesh] hasVertexAttrib +-- @param self +-- @param #int int +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#Mesh] create +-- @param self +-- @param #array_table array +-- @param #array_table array +-- @param #array_table array +-- @param #array_table vector > +-- @return Mesh#Mesh ret (return value: cc.Mesh) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua index 264531e866..5031415719 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite3D.lua @@ -12,6 +12,11 @@ -- @param self -- @param #string str +-------------------------------- +-- @function [parent=#Sprite3D] getMesh +-- @param self +-- @return Mesh#Mesh ret (return value: cc.Mesh) + -------------------------------- -- @function [parent=#Sprite3D] getBlendFunc -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 4a2120d628..002779db85 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -51,6 +51,11 @@ -- @field [parent=#cc] Node#Node Node preloaded module +-------------------------------------------------------- +-- the cc GLProgramState +-- @field [parent=#cc] GLProgramState#GLProgramState GLProgramState preloaded module + + -------------------------------------------------------- -- the cc AtlasNode -- @field [parent=#cc] AtlasNode#AtlasNode AtlasNode preloaded module @@ -1126,6 +1131,11 @@ -- @field [parent=#cc] TiledGrid3D#TiledGrid3D TiledGrid3D preloaded module +-------------------------------------------------------- +-- the cc GLProgramCache +-- @field [parent=#cc] GLProgramCache#GLProgramCache GLProgramCache preloaded module + + -------------------------------------------------------- -- the cc TextureCache -- @field [parent=#cc] TextureCache#TextureCache TextureCache preloaded module @@ -1206,6 +1216,11 @@ -- @field [parent=#cc] Sprite3D#Sprite3D Sprite3D preloaded module +-------------------------------------------------------- +-- the cc Mesh +-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module + + -------------------------------------------------------- -- the cc SimpleAudioEngine -- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index e1486c569e..4558f77700 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -9382,6 +9382,763 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S) return 1; } +int lua_cocos2dx_GLProgramState_setUniformTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformTexture'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + unsigned int arg1; + ok &= luaval_to_uint32(tolua_S, 3,&arg1); + + if (!ok) { break; } + cobj->setUniformTexture(arg0, arg1); + return 0; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cocos2d::Texture2D* arg1; + ok &= luaval_to_object(tolua_S, 3, "cc.Texture2D",&arg1); + + if (!ok) { break; } + cobj->setUniformTexture(arg0, arg1); + return 0; + } + }while(0); + ok = true; + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformTexture",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformMat4(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformMat4'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + cocos2d::Mat4 arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_mat4(tolua_S, 3, &arg1); + if(!ok) + return 0; + cobj->setUniformMat4(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformMat4",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformMat4'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_getUniformCount(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_getUniformCount'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + ssize_t ret = cobj->getUniformCount(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getUniformCount",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getUniformCount'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformFloat(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformFloat'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + double arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_number(tolua_S, 3,&arg1); + if(!ok) + return 0; + cobj->setUniformFloat(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformFloat",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformFloat'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformVec3(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec3'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + cocos2d::Vec3 arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_vec3(tolua_S, 3, &arg1); + if(!ok) + return 0; + cobj->setUniformVec3(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec3",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformVec3'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setGLProgram(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setGLProgram'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::GLProgram* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.GLProgram",&arg0); + if(!ok) + return 0; + cobj->setGLProgram(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setGLProgram",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setGLProgram'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformVec4(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec4'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + cocos2d::Vec4 arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_vec4(tolua_S, 3, &arg1); + if(!ok) + return 0; + cobj->setUniformVec4(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec4",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformVec4'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_getVertexAttribCount(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_getVertexAttribCount'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + ssize_t ret = cobj->getVertexAttribCount(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVertexAttribCount",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getVertexAttribCount'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformInt(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformInt'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + int arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); + if(!ok) + return 0; + cobj->setUniformInt(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformInt",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformInt'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_setUniformVec2(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec2'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + cocos2d::Vec2 arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + ok &= luaval_to_vec2(tolua_S, 3, &arg1); + if(!ok) + return 0; + cobj->setUniformVec2(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec2",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_setUniformVec2'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_getVertexAttribsFlags(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_getVertexAttribsFlags'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + unsigned int ret = cobj->getVertexAttribsFlags(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVertexAttribsFlags",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getVertexAttribsFlags'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_apply(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_apply'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Mat4 arg0; + + ok &= luaval_to_mat4(tolua_S, 2, &arg0); + if(!ok) + return 0; + cobj->apply(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "apply",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_apply'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_getGLProgram(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramState* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_getGLProgram'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::GLProgram* ret = cobj->getGLProgram(); + object_to_luaval(tolua_S, "cc.GLProgram",(cocos2d::GLProgram*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getGLProgram",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getGLProgram'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramState_create(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.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + cocos2d::GLProgram* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.GLProgram",&arg0); + if(!ok) + return 0; + cocos2d::GLProgramState* ret = cocos2d::GLProgramState::create(arg0); + object_to_luaval(tolua_S, "cc.GLProgramState",(cocos2d::GLProgramState*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_GLProgramState_getOrCreateWithGLProgramName(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.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if(!ok) + return 0; + cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithGLProgramName(arg0); + object_to_luaval(tolua_S, "cc.GLProgramState",(cocos2d::GLProgramState*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreateWithGLProgramName",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getOrCreateWithGLProgramName'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_GLProgramState_getOrCreateWithGLProgram(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.GLProgramState",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + cocos2d::GLProgram* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.GLProgram",&arg0); + if(!ok) + return 0; + cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithGLProgram(arg0); + object_to_luaval(tolua_S, "cc.GLProgramState",(cocos2d::GLProgramState*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreateWithGLProgram",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramState_getOrCreateWithGLProgram'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_GLProgramState_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (GLProgramState)"); + return 0; +} + +int lua_register_cocos2dx_GLProgramState(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.GLProgramState"); + tolua_cclass(tolua_S,"GLProgramState","cc.GLProgramState","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"GLProgramState"); + tolua_function(tolua_S,"setUniformTexture",lua_cocos2dx_GLProgramState_setUniformTexture); + tolua_function(tolua_S,"setUniformMat4",lua_cocos2dx_GLProgramState_setUniformMat4); + tolua_function(tolua_S,"getUniformCount",lua_cocos2dx_GLProgramState_getUniformCount); + tolua_function(tolua_S,"setUniformFloat",lua_cocos2dx_GLProgramState_setUniformFloat); + tolua_function(tolua_S,"setUniformVec3",lua_cocos2dx_GLProgramState_setUniformVec3); + tolua_function(tolua_S,"setGLProgram",lua_cocos2dx_GLProgramState_setGLProgram); + tolua_function(tolua_S,"setUniformVec4",lua_cocos2dx_GLProgramState_setUniformVec4); + tolua_function(tolua_S,"getVertexAttribCount",lua_cocos2dx_GLProgramState_getVertexAttribCount); + tolua_function(tolua_S,"setUniformInt",lua_cocos2dx_GLProgramState_setUniformInt); + tolua_function(tolua_S,"setUniformVec2",lua_cocos2dx_GLProgramState_setUniformVec2); + tolua_function(tolua_S,"getVertexAttribsFlags",lua_cocos2dx_GLProgramState_getVertexAttribsFlags); + tolua_function(tolua_S,"apply",lua_cocos2dx_GLProgramState_apply); + tolua_function(tolua_S,"getGLProgram",lua_cocos2dx_GLProgramState_getGLProgram); + tolua_function(tolua_S,"create", lua_cocos2dx_GLProgramState_create); + tolua_function(tolua_S,"getOrCreateWithGLProgramName", lua_cocos2dx_GLProgramState_getOrCreateWithGLProgramName); + tolua_function(tolua_S,"getOrCreateWithGLProgram", lua_cocos2dx_GLProgramState_getOrCreateWithGLProgram); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::GLProgramState).name(); + g_luaType[typeName] = "cc.GLProgramState"; + g_typeCast["GLProgramState"] = "cc.GLProgramState"; + return 1; +} + int lua_cocos2dx_AtlasNode_updateAtlasValues(lua_State* tolua_S) { int argc = 0; @@ -55413,6 +56170,309 @@ int lua_register_cocos2dx_TiledGrid3D(lua_State* tolua_S) return 1; } +int lua_cocos2dx_GLProgramCache_addGLProgram(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramCache* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramCache*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramCache_addGLProgram'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + cocos2d::GLProgram* arg0; + std::string arg1; + + ok &= luaval_to_object(tolua_S, 2, "cc.GLProgram",&arg0); + + ok &= luaval_to_std_string(tolua_S, 3,&arg1); + if(!ok) + return 0; + cobj->addGLProgram(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "addGLProgram",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_addGLProgram'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramCache_getGLProgram(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramCache* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramCache*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramCache_getGLProgram'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if(!ok) + return 0; + cocos2d::GLProgram* ret = cobj->getGLProgram(arg0); + object_to_luaval(tolua_S, "cc.GLProgram",(cocos2d::GLProgram*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getGLProgram",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_getGLProgram'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramCache_reloadDefaultGLPrograms(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramCache* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramCache*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramCache_reloadDefaultGLPrograms'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->reloadDefaultGLPrograms(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "reloadDefaultGLPrograms",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_reloadDefaultGLPrograms'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramCache_loadDefaultGLPrograms(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramCache* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLProgramCache*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramCache_loadDefaultGLPrograms'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->loadDefaultGLPrograms(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "loadDefaultGLPrograms",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_loadDefaultGLPrograms'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_GLProgramCache_destroyInstance(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.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::GLProgramCache::destroyInstance(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "destroyInstance",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_destroyInstance'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_GLProgramCache_getInstance(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.GLProgramCache",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::GLProgramCache* ret = cocos2d::GLProgramCache::getInstance(); + object_to_luaval(tolua_S, "cc.GLProgramCache",(cocos2d::GLProgramCache*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getInstance",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_getInstance'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_GLProgramCache_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLProgramCache* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj = new cocos2d::GLProgramCache(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.GLProgramCache"); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "GLProgramCache",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLProgramCache_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_GLProgramCache_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (GLProgramCache)"); + return 0; +} + +int lua_register_cocos2dx_GLProgramCache(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.GLProgramCache"); + tolua_cclass(tolua_S,"GLProgramCache","cc.GLProgramCache","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"GLProgramCache"); + tolua_function(tolua_S,"addGLProgram",lua_cocos2dx_GLProgramCache_addGLProgram); + tolua_function(tolua_S,"getGLProgram",lua_cocos2dx_GLProgramCache_getGLProgram); + tolua_function(tolua_S,"reloadDefaultGLPrograms",lua_cocos2dx_GLProgramCache_reloadDefaultGLPrograms); + tolua_function(tolua_S,"loadDefaultGLPrograms",lua_cocos2dx_GLProgramCache_loadDefaultGLPrograms); + tolua_function(tolua_S,"new",lua_cocos2dx_GLProgramCache_constructor); + tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_GLProgramCache_destroyInstance); + tolua_function(tolua_S,"getInstance", lua_cocos2dx_GLProgramCache_getInstance); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::GLProgramCache).name(); + g_luaType[typeName] = "cc.GLProgramCache"; + g_typeCast["GLProgramCache"] = "cc.GLProgramCache"; + return 1; +} + int lua_cocos2dx_TextureCache_reloadTexture(lua_State* tolua_S) { int argc = 0; @@ -63540,6 +64600,50 @@ int lua_cocos2dx_Sprite3D_setTexture(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Sprite3D_getMesh(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Sprite3D* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Sprite3D_getMesh'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cocos2d::Mesh* ret = cobj->getMesh(); + object_to_luaval(tolua_S, "cc.Mesh",(cocos2d::Mesh*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getMesh",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite3D_getMesh'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Sprite3D_getBlendFunc(lua_State* tolua_S) { int argc = 0; @@ -63694,6 +64798,7 @@ int lua_register_cocos2dx_Sprite3D(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Sprite3D"); tolua_function(tolua_S,"setTexture",lua_cocos2dx_Sprite3D_setTexture); + tolua_function(tolua_S,"getMesh",lua_cocos2dx_Sprite3D_getMesh); tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Sprite3D_getBlendFunc); tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_Sprite3D_setBlendFunc); tolua_function(tolua_S,"create", lua_cocos2dx_Sprite3D_create); @@ -63704,6 +64809,520 @@ int lua_register_cocos2dx_Sprite3D(lua_State* tolua_S) return 1; } +int lua_cocos2dx_Mesh_restore(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_restore'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->restore(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "restore",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_restore'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getMeshVertexAttribCount(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getMeshVertexAttribCount'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + ssize_t ret = cobj->getMeshVertexAttribCount(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getMeshVertexAttribCount",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getMeshVertexAttribCount'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getIndexFormat(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getIndexFormat'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + int ret = (int)cobj->getIndexFormat(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getIndexFormat",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getIndexFormat'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getVertexSizeInBytes(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getVertexSizeInBytes'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + int ret = cobj->getVertexSizeInBytes(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVertexSizeInBytes",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getVertexSizeInBytes'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getPrimitiveType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getPrimitiveType'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + int ret = (int)cobj->getPrimitiveType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPrimitiveType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getPrimitiveType'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getIndexCount(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getIndexCount'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + ssize_t ret = cobj->getIndexCount(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getIndexCount",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getIndexCount'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getVertexBuffer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getVertexBuffer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + unsigned int ret = cobj->getVertexBuffer(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getVertexBuffer",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getVertexBuffer'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getMeshVertexAttribute(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getMeshVertexAttribute'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + const cocos2d::MeshVertexAttrib& ret = cobj->getMeshVertexAttribute(arg0); + mesh_vertex_attrib_to_luaval(tolua_S, ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getMeshVertexAttribute",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getMeshVertexAttribute'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_getIndexBuffer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_getIndexBuffer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + unsigned int ret = cobj->getIndexBuffer(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getIndexBuffer",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_getIndexBuffer'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_hasVertexAttrib(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Mesh* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Mesh_hasVertexAttrib'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + bool ret = cobj->hasVertexAttrib(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "hasVertexAttrib",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_hasVertexAttrib'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Mesh_create(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.Mesh",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 4) + { + std::vector > arg0; + std::vector > arg1; + std::vector > arg2; + std::vector > arg3; + ok &= luaval_to_std_vector_float(tolua_S, 2, &arg0); + ok &= luaval_to_std_vector_float(tolua_S, 3, &arg1); + ok &= luaval_to_std_vector_float(tolua_S, 4, &arg2); + ok &= luaval_to_std_vector_ushort(tolua_S, 5, &arg3); + if(!ok) + return 0; + cocos2d::Mesh* ret = cocos2d::Mesh::create(arg0, arg1, arg2, arg3); + object_to_luaval(tolua_S, "cc.Mesh",(cocos2d::Mesh*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 4); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Mesh_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_Mesh_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Mesh)"); + return 0; +} + +int lua_register_cocos2dx_Mesh(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Mesh"); + tolua_cclass(tolua_S,"Mesh","cc.Mesh","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"Mesh"); + tolua_function(tolua_S,"restore",lua_cocos2dx_Mesh_restore); + tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_Mesh_getMeshVertexAttribCount); + tolua_function(tolua_S,"getIndexFormat",lua_cocos2dx_Mesh_getIndexFormat); + tolua_function(tolua_S,"getVertexSizeInBytes",lua_cocos2dx_Mesh_getVertexSizeInBytes); + tolua_function(tolua_S,"getPrimitiveType",lua_cocos2dx_Mesh_getPrimitiveType); + tolua_function(tolua_S,"getIndexCount",lua_cocos2dx_Mesh_getIndexCount); + tolua_function(tolua_S,"getVertexBuffer",lua_cocos2dx_Mesh_getVertexBuffer); + tolua_function(tolua_S,"getMeshVertexAttribute",lua_cocos2dx_Mesh_getMeshVertexAttribute); + tolua_function(tolua_S,"getIndexBuffer",lua_cocos2dx_Mesh_getIndexBuffer); + tolua_function(tolua_S,"hasVertexAttrib",lua_cocos2dx_Mesh_hasVertexAttrib); + tolua_function(tolua_S,"create", lua_cocos2dx_Mesh_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::Mesh).name(); + g_luaType[typeName] = "cc.Mesh"; + g_typeCast["Mesh"] = "cc.Mesh"; + return 1; +} + int lua_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S) { int argc = 0; @@ -65434,6 +67053,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_Grid3DAction(tolua_S); lua_register_cocos2dx_FadeTo(tolua_S); lua_register_cocos2dx_FadeIn(tolua_S); + lua_register_cocos2dx_ShakyTiles3D(tolua_S); lua_register_cocos2dx_EventListenerCustom(tolua_S); lua_register_cocos2dx_FlipX3D(tolua_S); lua_register_cocos2dx_FlipY3D(tolua_S); @@ -65530,6 +67150,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_TransitionFadeBL(tolua_S); lua_register_cocos2dx_TargetedAction(tolua_S); lua_register_cocos2dx_DrawNode(tolua_S); + lua_register_cocos2dx_Mesh(tolua_S); lua_register_cocos2dx_TransitionTurnOffTiles(tolua_S); lua_register_cocos2dx_RotateTo(tolua_S); lua_register_cocos2dx_TransitionSplitRows(tolua_S); @@ -65552,7 +67173,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_ScaleTo(tolua_S); lua_register_cocos2dx_Spawn(tolua_S); lua_register_cocos2dx_EaseQuarticActionInOut(tolua_S); - lua_register_cocos2dx_ShakyTiles3D(tolua_S); + lua_register_cocos2dx_GLProgramState(tolua_S); lua_register_cocos2dx_PageTurn3D(tolua_S); lua_register_cocos2dx_TransitionSlideInL(tolua_S); lua_register_cocos2dx_TransitionSlideInT(tolua_S); @@ -65582,6 +67203,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_MenuItemAtlasFont(tolua_S); lua_register_cocos2dx_Liquid(tolua_S); lua_register_cocos2dx_OrbitCamera(tolua_S); + lua_register_cocos2dx_ParallaxNode(tolua_S); lua_register_cocos2dx_EventCustom(tolua_S); lua_register_cocos2dx_ParticleBatchNode(tolua_S); lua_register_cocos2dx_Component(tolua_S); @@ -65610,7 +67232,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_TransitionProgressRadialCW(tolua_S); lua_register_cocos2dx_EaseBounceInOut(tolua_S); lua_register_cocos2dx_TransitionSlideInR(tolua_S); - lua_register_cocos2dx_ParallaxNode(tolua_S); + lua_register_cocos2dx_GLProgramCache(tolua_S); lua_register_cocos2dx_EaseQuadraticActionIn(tolua_S); lua_register_cocos2dx_WavesTiles3D(tolua_S); lua_register_cocos2dx_TransitionSlideInB(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 62a4c37607..5899bee1f4 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1548,6 +1548,44 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5fe36c55c7a7a7d103a566c1b4afd182da08a890 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 20 May 2014 11:49:30 +0000 Subject: [PATCH 70/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index da6b76ab1c..bc6acf5bcf 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3628,6 +3628,8 @@ "cocos/scripting/lua-bindings/auto/api/Follow.lua", "cocos/scripting/lua-bindings/auto/api/FrameData.lua", "cocos/scripting/lua-bindings/auto/api/GLProgram.lua", + "cocos/scripting/lua-bindings/auto/api/GLProgramCache.lua", + "cocos/scripting/lua-bindings/auto/api/GLProgramState.lua", "cocos/scripting/lua-bindings/auto/api/GLView.lua", "cocos/scripting/lua-bindings/auto/api/GLViewProtocol.lua", "cocos/scripting/lua-bindings/auto/api/GUIReader.lua", @@ -3665,6 +3667,7 @@ "cocos/scripting/lua-bindings/auto/api/MenuItemLabel.lua", "cocos/scripting/lua-bindings/auto/api/MenuItemSprite.lua", "cocos/scripting/lua-bindings/auto/api/MenuItemToggle.lua", + "cocos/scripting/lua-bindings/auto/api/Mesh.lua", "cocos/scripting/lua-bindings/auto/api/MotionStreak.lua", "cocos/scripting/lua-bindings/auto/api/MoveBy.lua", "cocos/scripting/lua-bindings/auto/api/MoveTo.lua", From 0efc0701041fdb4a6d98b1834a3e7fed93cb15c6 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 20 May 2014 07:48:12 -0700 Subject: [PATCH 71/90] fixed shader compiler after cocos refactor --- cocos/2d/cocos2d_winrt.vcxproj | 291 ++-- cocos/2d/cocos2d_winrt.vcxproj.filters | 1811 ++++++++++++------------ cocos/2d/cocos2d_wp8.vcxproj | 19 +- cocos/2d/cocos2d_wp8.vcxproj.filters | 2 + cocos/platform/winrt/CCGLView.cpp | 2 +- 5 files changed, 1063 insertions(+), 1062 deletions(-) diff --git a/cocos/2d/cocos2d_winrt.vcxproj b/cocos/2d/cocos2d_winrt.vcxproj index e65209978d..c78b1a2102 100644 --- a/cocos/2d/cocos2d_winrt.vcxproj +++ b/cocos/2d/cocos2d_winrt.vcxproj @@ -265,6 +265,18 @@ + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + true + true + true + true + true + true CompileAsCpp CompileAsCpp CompileAsCpp @@ -278,34 +290,33 @@ - false - false - false - false - false - false NotUsing NotUsing NotUsing NotUsing NotUsing NotUsing - - - - - - - - - - - - + true + true + true + true + true + true + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + @@ -326,15 +337,30 @@ + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + + + + @@ -345,13 +371,14 @@ + + - - - - + + + @@ -362,6 +389,32 @@ + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + @@ -370,10 +423,14 @@ + + + + @@ -390,7 +447,6 @@ - @@ -402,36 +458,9 @@ - - false - false - false - false - false - false - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - - - - - - - - - - - - - + - - @@ -442,6 +471,7 @@ + @@ -450,15 +480,11 @@ - - - - @@ -468,37 +494,6 @@ - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - Create - Create - - - @@ -507,9 +502,14 @@ + + + + + @@ -532,21 +532,33 @@ + + + - - + + + + + + + + + + + @@ -563,13 +575,14 @@ + + - - - - + + + @@ -581,6 +594,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -589,11 +627,15 @@ + + + + @@ -610,56 +652,44 @@ - - - - - + - - - - + - - - - - @@ -668,53 +698,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + diff --git a/cocos/2d/cocos2d_winrt.vcxproj.filters b/cocos/2d/cocos2d_winrt.vcxproj.filters index 77d7af3277..b641582cb4 100644 --- a/cocos/2d/cocos2d_winrt.vcxproj.filters +++ b/cocos/2d/cocos2d_winrt.vcxproj.filters @@ -1,536 +1,340 @@  - - {cc64f5ad-2234-494c-9c51-b7a20c8887aa} - - - {736cf4ab-e0d6-40ba-912a-b062d28d318a} - - - {1c7c61b8-3d36-4ba0-a87c-457eb4c782d0} - - - {0b3a64bd-79fa-476a-a461-6b97e5072453} - - - {e455af5e-da09-4f41-b79f-df4dd311820d} - - - {206bd96b-f80e-4722-8675-d7c6ff9b3639} - - - {075492ba-08bc-404c-92da-32029797a600} - - - {41abe422-1602-4fe0-ac1c-6b04a14c1abb} - - - {8bf0f517-2ac3-4fc3-a1ad-999d9ea103cd} - {926fc31c-8742-4984-9940-c972dd02fc8a} - - {755e5282-111e-46a5-9169-7c12b37f5ffc} - - - {d94bbf20-8de9-49a7-ae20-6a1140cf633b} - - - {4a64789e-cc8d-4f84-a869-e6dae2e0d58c} - - - {bb98a889-9a48-4e31-af2f-117f14da388a} - - - {fdea327e-b905-47db-8c33-b70d7866166b} - - - {46c8d130-b8b5-47f5-a063-ca700e1c32cc} - - - {f2671200-b2d8-4d2e-9728-06719cf6f835} - - - {535c04b0-fe2b-44c9-9a8c-9029e2b6de5c} - - - {5b082c5c-d396-43ca-b3b1-997d0f6247d0} - - - {1179d205-d065-49f0-8457-bc4c3f1d0cb3} - - - {cc25bb83-527d-4218-8d68-ebf963ce7698} - - - {caa78ce0-9b58-4314-b117-1acae278691e} - - - {47fda93e-6eb4-4abc-b5bc-725bf667a395} - - - {08593631-5bf5-46aa-9436-62595c4f7bf6} - - - {aeadfa95-9c89-4212-98ae-89ad57db596a} - - - {aec8225f-81a7-4213-b97b-7004d5535398} - - - {cba0f362-878c-438b-ad0f-43d287516357} - - - {6e394a3e-2c57-4988-bc51-bea18e491559} - - - {0f5d437f-e972-4b3c-9e01-11802af452dc} - - - {c45b97e8-fa1f-4e58-8ec5-d46371c2dd26} - - - {8357726f-36e1-4e1c-9fac-c86601307b1e} - - + {66fe0560-cca4-4b0c-a192-44aca8ad82af} - - {b14b4bf9-3bc3-499b-b7a1-5e054aaf2ab0} + + {d3c53fc9-8678-4801-9a24-a619be0e761e} + + + {929b5dfc-73f5-4094-9036-051078571248} + + + {c883205c-736d-46a1-8626-8307d7c1967b} + + + {ff74d35d-9d65-44b8-8569-36197c006c41} + + + {8e9c8baf-8264-4016-bc90-ed547dfb524d} + + + {6063a842-a931-44fe-aea7-605af02302a4} + + + {ebd488cd-3f7b-4d28-adfc-e70980a65199} + + + {b31e69bf-1430-4938-81a4-b88019ba6f70} + + + {364e5ee6-3dee-4d24-baee-a59dd3519e8b} + + + {7532fb96-9b65-44e6-a165-b78eb67e14e2} + + + {bb9fdcc1-d324-4e79-9d10-8698b0ea583d} + + + {7ca64aa2-f350-4bc9-a046-d24c4df4f0ad} + + + {261eb0ec-d921-49ec-8ccd-f528d5a91abd} + + + {bb14c2af-576d-4274-a21e-c518397fa0cf} + + + {4626742b-b8a8-4626-ac6c-17be46e1c3c1} - - physics + + + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - base_nodes + + platform\winrt - - base_nodes + + platform\winrt - - effects + + platform\winrt - - effects + + platform\winrt - - layers_scenes_transitions_nodes + + platform\winrt - - layers_scenes_transitions_nodes + + platform\winrt - - layers_scenes_transitions_nodes + + platform\winrt - - layers_scenes_transitions_nodes + + platform\winrt - - layers_scenes_transitions_nodes + + platform - - menu_nodes + + platform - - menu_nodes + + platform - - misc_nodes + + platform - - misc_nodes - - - misc_nodes - - - misc_nodes - - - particle_nodes - - - particle_nodes - - - particle_nodes - - - particle_nodes - - - script_support + + platform - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions - - - draw_nodes - - - draw_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - platform\etc - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - sprite_nodes - - - sprite_nodes - - - sprite_nodes - - - sprite_nodes + 2d - sprite_nodes + 2d - sprite_nodes + 2d - - text_input_node + + 2d - - text_input_node - - - textures - - - textures - - - textures - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - - support - - - support + + 2d - support\component + 2d - support\component + 2d - - support\data_support + + 2d - - support\image_support + + 2d - - support\tinyxml2 + + 2d - - support\tinyxml2\user_default + + 2d - - support\zip_support + + 2d - - support\zip_support + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 3d + + + 3d + + + 3d + + + 3d + + + base + + + base base + + base + + + base + + + base + base base - - base - - - base - - - support - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - base - - - misc_nodes - - - label_nodes - - - label_nodes - - - platform - - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - base - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - - base - - - base - base @@ -579,541 +383,494 @@ base + + base + + + base + + + base + base + + base + base + + base + base base + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + base + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + - ConvertUTF + external\ConvertUTF - ConvertUTF + external\ConvertUTF - - platform\etc\winrt + + external\edtaa + + + external\tinyxml2 + + + external\unzip + + + external\unzip - - xxhash + external\xxhash + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics + + + physics + + + physics + + + physics + + + physics - - physics + + + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - physics + + platform\winrt - - base_nodes + + platform\winrt - - base_nodes + + platform\winrt - - effects + + platform\winrt - - effects + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - include + + platform\winrt - - layers_scenes_transitions_nodes + + platform - - layers_scenes_transitions_nodes + + platform - - layers_scenes_transitions_nodes + + platform - - layers_scenes_transitions_nodes + + platform - - layers_scenes_transitions_nodes + + platform - - menu_nodes + + platform - - menu_nodes + + platform - - misc_nodes - - - misc_nodes - - - misc_nodes - - - misc_nodes - - - particle_nodes - - - particle_nodes - - - particle_nodes - - - particle_nodes - - - script_support + + platform - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions + 2d - actions - - - draw_nodes - - - draw_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - label_nodes - - - platform\etc - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - platform - - - sprite_nodes - - - sprite_nodes - - - sprite_nodes - - - sprite_nodes + 2d - sprite_nodes + 2d - sprite_nodes + 2d - - text_input_node + + 2d - - text_input_node - - - text_input_node - - - textures - - - textures - - - textures - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - tilemap_parallax_nodes - - - - support - - - support - - - support + + 2d - support\component + 2d - support\component + 2d - - support\data_support + + 2d - - support\data_support + + 2d - - support\data_support + + 2d - - support\image_support + + 2d - - support\tinyxml2 + + 2d - - support\tinyxml2\user_default + + 2d - - support\zip_support + + 2d - - support\zip_support + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 2d + + + 3d + + + 3d + + + 3d + + + 3d + + + base + + + base base - - base - - - base - - - base - - - base - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - physics\chipmunk - - - base - - - base - - - base - - - misc_nodes - - - label_nodes - - - label_nodes - - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - platform\etc\winrt - - - base - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - deprecated - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - renderer - - - + base @@ -1122,6 +879,15 @@ base + + base + + + base + + + base + base @@ -1173,68 +939,293 @@ base + + base + + + base + + + base + base + + base + + + base + + + base + + + base + base + + base + + + base + base base + + base + base base + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + + + base + base + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + + + deprecated + - ConvertUTF + external\ConvertUTF - - platform\etc\winrt + + external\edtaa - - platform\etc\winrt + + external\tinyxml2 + + + external\unzip + + + external\unzip - - xxhash + external\xxhash + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + renderer + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics\chipmunk + + + physics + + + physics + + + physics + + + physics + + + physics - + + base + + math - - - + math math - - math - math - + math - + math - + math + + renderer + + + renderer + + + renderer + renderer diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index 91de9b40b0..91aa5e52a8 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -75,7 +75,7 @@ %(PreprocessorDefinitions) - NotUsing + Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) $(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories) @@ -100,7 +100,7 @@ _LIB;NDEBUG;%(PreprocessorDefinitions) - NotUsing + Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) $(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories) @@ -125,7 +125,7 @@ _LIB;%(PreprocessorDefinitions) - NotUsing + Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) $(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories) @@ -151,7 +151,7 @@ _LIB;NDEBUG;%(PreprocessorDefinitions) - NotUsing + Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) $(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\wp8;$(EngineRoot)external\jpeg\include\wp8;$(EngineRoot)external\curl\include\wp8;$(EngineRoot)external\curl\include\wp8\curl;$(EngineRoot)external\tiff\include\wp8;$(EngineRoot)external\freetype2\include\wp8;$(EngineRoot)external\wp8-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;%(AdditionalIncludeDirectories) @@ -261,6 +261,10 @@ + NotUsing + NotUsing + NotUsing + NotUsing @@ -327,6 +331,12 @@ + + Create + Create + Create + Create + @@ -532,6 +542,7 @@ + diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index ee4a610d9f..33bbaae0a1 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -595,6 +595,7 @@ renderer + @@ -1209,6 +1210,7 @@ renderer + diff --git a/cocos/platform/winrt/CCGLView.cpp b/cocos/platform/winrt/CCGLView.cpp index 118449fa25..7fb7e1b9fd 100644 --- a/cocos/platform/winrt/CCGLView.cpp +++ b/cocos/platform/winrt/CCGLView.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. #include "base/ccMacros.h" #include "base/CCDirector.h" #include "base/CCTouch.h" -#include "2d/CCIMEDispatcher.h" +#include "base/CCIMEDispatcher.h" #include "CCApplication.h" #include "CCWinRTUtils.h" From 3db6856d278b5e77610352977279cc4c28d7a86c Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 20 May 2014 07:48:42 -0700 Subject: [PATCH 72/90] added missing pch files for WP8 --- cocos/platform/wp8/pch.cpp | 1 + cocos/platform/wp8/pch.h | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 cocos/platform/wp8/pch.cpp create mode 100644 cocos/platform/wp8/pch.h diff --git a/cocos/platform/wp8/pch.cpp b/cocos/platform/wp8/pch.cpp new file mode 100644 index 0000000000..bcb5590be1 --- /dev/null +++ b/cocos/platform/wp8/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/cocos/platform/wp8/pch.h b/cocos/platform/wp8/pch.h new file mode 100644 index 0000000000..842a70abec --- /dev/null +++ b/cocos/platform/wp8/pch.h @@ -0,0 +1,3 @@ +#pragma once + +#include "cocos2d.h" \ No newline at end of file From c0798a3c0a50928d939b9df480f0d33c84d7a274 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 20 May 2014 10:06:02 -0700 Subject: [PATCH 73/90] updated precompiled shaders for wp8 --- .../platform/wp8/shaders/precompiledshaders.h | 721 +++++++++++++++++- 1 file changed, 717 insertions(+), 4 deletions(-) diff --git a/cocos/platform/wp8/shaders/precompiledshaders.h b/cocos/platform/wp8/shaders/precompiledshaders.h index 389aa191f8..09de1b560f 100644 --- a/cocos/platform/wp8/shaders/precompiledshaders.h +++ b/cocos/platform/wp8/shaders/precompiledshaders.h @@ -2777,6 +2777,719 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = { 111, 110, 0, 171, 171, 171, }; +const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = { + +166, 147, 0, 0, 142, 9, 2, 1, + 0, 128, 0, 0, 82, 139, 0, 0, + 10, 0, 0, 0, 97, 95, 112, 111, +115, 105, 116, 105, 111, 110, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, 80, 139, + 0, 0, 10, 0, 0, 0, 97, 95, +116, 101, 120, 67, 111, 111, 114, 100, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 3, 0, 0, 0, 92, 139, 0, + 0, 242, 141, 0, 0, 12, 0, 0, + 0, 67, 67, 95, 77, 86, 80, 77, + 97, 116, 114, 105, 120, 0, 0, 0, + 0, 255, 255, 255, 255, 0, 0, 0, + 0, 4, 0, 0, 0, 94, 139, 0, + 0, 0, 0, 0, 0, 11, 0, 0, + 0, 67, 67, 95, 84, 101, 120, 116, +117, 114, 101, 48, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 1, 0, 0, 0, 82, 139, 0, 0, +241, 141, 0, 0, 7, 0, 0, 0, +117, 95, 99, 111, 108, 111, 114, 0, + 0, 0, 0, 0, 0, 0, 0, 255, +255, 255, 255, 1, 0, 0, 0, 3, + 0, 0, 0, 12, 0, 0, 0, 67, + 67, 95, 77, 86, 80, 77, 97, 116, +114, 105, 120, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 0, 0, 0, 67, + 67, 95, 84, 101, 120, 116, 117, 114, +101, 48, 0, 0, 0, 0, 1, 0, + 0, 0, 7, 0, 0, 0, 117, 95, + 99, 111, 108, 111, 114, 0, 0, 0, + 0, 2, 0, 0, 0, 96, 4, 0, + 0, 192, 4, 0, 0, 0, 0, 0, + 0, 20, 134, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 68, 88, 66, 67, 157, 116, 105, + 89, 118, 135, 249, 239, 42, 226, 184, + 78, 220, 105, 236, 28, 1, 0, 0, + 0, 96, 4, 0, 0, 6, 0, 0, + 0, 56, 0, 0, 0, 228, 0, 0, + 0, 252, 1, 0, 0, 120, 2, 0, + 0, 176, 3, 0, 0, 228, 3, 0, + 0, 65, 111, 110, 57, 164, 0, 0, + 0, 164, 0, 0, 0, 0, 2, 255, +255, 112, 0, 0, 0, 52, 0, 0, + 0, 1, 0, 40, 0, 0, 0, 52, + 0, 0, 0, 52, 0, 1, 0, 36, + 0, 0, 0, 52, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 255, +255, 31, 0, 0, 2, 0, 0, 0, +128, 0, 0, 3, 176, 31, 0, 0, + 2, 0, 0, 0, 144, 0, 8, 15, +160, 66, 0, 0, 3, 0, 0, 15, +128, 0, 0, 228, 176, 0, 8, 228, +160, 5, 0, 0, 3, 0, 0, 15, +128, 0, 0, 228, 128, 0, 0, 228, +160, 1, 0, 0, 2, 0, 8, 15, +128, 0, 0, 228, 128, 1, 0, 0, + 2, 1, 8, 15, 128, 0, 0, 228, +128, 1, 0, 0, 2, 2, 8, 15, +128, 0, 0, 228, 128, 1, 0, 0, + 2, 3, 8, 15, 128, 0, 0, 228, +128, 255, 255, 0, 0, 83, 72, 68, + 82, 16, 1, 0, 0, 64, 0, 0, + 0, 68, 0, 0, 0, 89, 0, 0, + 4, 70, 142, 32, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 90, 0, 0, + 3, 0, 96, 16, 0, 0, 0, 0, + 0, 88, 24, 0, 4, 0, 112, 16, + 0, 0, 0, 0, 0, 85, 85, 0, + 0, 98, 16, 0, 3, 50, 16, 16, + 0, 0, 0, 0, 0, 101, 0, 0, + 3, 242, 32, 16, 0, 0, 0, 0, + 0, 101, 0, 0, 3, 242, 32, 16, + 0, 1, 0, 0, 0, 101, 0, 0, + 3, 242, 32, 16, 0, 2, 0, 0, + 0, 101, 0, 0, 3, 242, 32, 16, + 0, 3, 0, 0, 0, 104, 0, 0, + 2, 1, 0, 0, 0, 69, 0, 0, + 9, 242, 0, 16, 0, 0, 0, 0, + 0, 70, 16, 16, 0, 0, 0, 0, + 0, 70, 126, 16, 0, 0, 0, 0, + 0, 0, 96, 16, 0, 0, 0, 0, + 0, 56, 0, 0, 8, 242, 0, 16, + 0, 0, 0, 0, 0, 70, 14, 16, + 0, 0, 0, 0, 0, 70, 142, 32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 54, 0, 0, 5, 242, 32, 16, + 0, 0, 0, 0, 0, 70, 14, 16, + 0, 0, 0, 0, 0, 54, 0, 0, + 5, 242, 32, 16, 0, 1, 0, 0, + 0, 70, 14, 16, 0, 0, 0, 0, + 0, 54, 0, 0, 5, 242, 32, 16, + 0, 2, 0, 0, 0, 70, 14, 16, + 0, 0, 0, 0, 0, 54, 0, 0, + 5, 242, 32, 16, 0, 3, 0, 0, + 0, 70, 14, 16, 0, 0, 0, 0, + 0, 62, 0, 0, 1, 83, 84, 65, + 84, 116, 0, 0, 0, 7, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 82, 68, 69, 70, 48, 1, 0, + 0, 1, 0, 0, 0, 176, 0, 0, + 0, 3, 0, 0, 0, 28, 0, 0, + 0, 0, 4, 255, 255, 0, 65, 0, + 0, 252, 0, 0, 0, 124, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, 145, 0, 0, + 0, 2, 0, 0, 0, 5, 0, 0, + 0, 4, 0, 0, 0, 255, 255, 255, +255, 0, 0, 0, 0, 1, 0, 0, + 0, 13, 0, 0, 0, 166, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 115, 97, 109, +112, 108, 101, 114, 95, 95, 67, 67, + 95, 84, 101, 120, 116, 117, 114, 101, + 48, 0, 116, 101, 120, 116, 117, 114, +101, 95, 95, 67, 67, 95, 84, 101, +120, 116, 117, 114, 101, 48, 0, 36, + 71, 108, 111, 98, 97, 108, 115, 0, +171, 166, 0, 0, 0, 1, 0, 0, + 0, 200, 0, 0, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 224, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 0, 0, 2, 0, 0, + 0, 236, 0, 0, 0, 0, 0, 0, + 0, 95, 117, 95, 99, 111, 108, 111, +114, 0, 171, 171, 171, 1, 0, 3, + 0, 1, 0, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 105, 99, +114, 111, 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, 76, 32, + 83, 104, 97, 100, 101, 114, 32, 67, +111, 109, 112, 105, 108, 101, 114, 32, + 54, 46, 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, 0, 171, +171, 73, 83, 71, 78, 44, 0, 0, + 0, 1, 0, 0, 0, 8, 0, 0, + 0, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 3, 3, 0, + 0, 84, 69, 88, 67, 79, 79, 82, + 68, 0, 171, 171, 171, 79, 83, 71, + 78, 116, 0, 0, 0, 4, 0, 0, + 0, 8, 0, 0, 0, 104, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 104, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 1, 0, 0, + 0, 15, 0, 0, 0, 104, 0, 0, + 0, 2, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 2, 0, 0, + 0, 15, 0, 0, 0, 104, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 3, 0, 0, + 0, 15, 0, 0, 0, 83, 86, 95, + 84, 97, 114, 103, 101, 116, 0, 171, +171, 68, 88, 66, 67, 183, 109, 16, +202, 49, 89, 17, 26, 134, 90, 213, +163, 143, 192, 250, 93, 1, 0, 0, + 0, 192, 4, 0, 0, 6, 0, 0, + 0, 56, 0, 0, 0, 76, 1, 0, + 0, 204, 2, 0, 0, 72, 3, 0, + 0, 28, 4, 0, 0, 104, 4, 0, + 0, 65, 111, 110, 57, 12, 1, 0, + 0, 12, 1, 0, 0, 0, 2, 254, +255, 216, 0, 0, 0, 52, 0, 0, + 0, 1, 0, 36, 0, 0, 0, 48, + 0, 0, 0, 48, 0, 0, 0, 36, + 0, 1, 0, 48, 0, 0, 0, 0, + 0, 4, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 254, +255, 81, 0, 0, 5, 5, 0, 15, +160, 0, 0, 0, 63, 0, 0, 128, + 63, 0, 0, 128, 191, 0, 0, 0, + 0, 31, 0, 0, 2, 5, 0, 0, +128, 0, 0, 15, 144, 31, 0, 0, + 2, 5, 0, 1, 128, 1, 0, 15, +144, 9, 0, 0, 3, 0, 0, 1, +128, 3, 0, 228, 160, 0, 0, 228, +144, 9, 0, 0, 3, 0, 0, 2, +128, 4, 0, 228, 160, 0, 0, 228, +144, 2, 0, 0, 3, 0, 0, 1, +128, 0, 0, 85, 128, 0, 0, 0, +128, 5, 0, 0, 3, 0, 0, 4, +192, 0, 0, 0, 128, 5, 0, 0, +160, 9, 0, 0, 3, 0, 0, 1, +128, 2, 0, 228, 160, 0, 0, 228, +144, 1, 0, 0, 2, 1, 0, 2, +128, 0, 0, 0, 129, 9, 0, 0, + 3, 1, 0, 1, 128, 1, 0, 228, +160, 0, 0, 228, 144, 4, 0, 0, + 4, 0, 0, 3, 192, 0, 0, 85, +128, 0, 0, 228, 160, 1, 0, 228, +128, 1, 0, 0, 2, 0, 0, 8, +192, 0, 0, 85, 128, 4, 0, 0, + 4, 0, 0, 3, 224, 1, 0, 228, +144, 5, 0, 233, 160, 5, 0, 231, +160, 255, 255, 0, 0, 83, 72, 68, + 82, 120, 1, 0, 0, 64, 0, 1, + 0, 94, 0, 0, 0, 89, 0, 0, + 4, 70, 142, 32, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 95, 0, 0, + 3, 242, 16, 16, 0, 0, 0, 0, + 0, 95, 0, 0, 3, 50, 16, 16, + 0, 1, 0, 0, 0, 101, 0, 0, + 3, 50, 32, 16, 0, 0, 0, 0, + 0, 103, 0, 0, 4, 242, 32, 16, + 0, 1, 0, 0, 0, 1, 0, 0, + 0, 104, 0, 0, 2, 1, 0, 0, + 0, 50, 0, 0, 15, 50, 32, 16, + 0, 0, 0, 0, 0, 70, 16, 16, + 0, 1, 0, 0, 0, 2, 64, 0, + 0, 0, 0, 128, 63, 0, 0, 128, +191, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 64, 0, 0, 0, 0, 0, + 0, 0, 0, 128, 63, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 0, + 8, 18, 0, 16, 0, 0, 0, 0, + 0, 70, 142, 32, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 70, 30, 16, + 0, 0, 0, 0, 0, 54, 0, 0, + 6, 34, 32, 16, 0, 1, 0, 0, + 0, 10, 0, 16, 128, 65, 0, 0, + 0, 0, 0, 0, 0, 17, 0, 0, + 8, 18, 0, 16, 0, 0, 0, 0, + 0, 70, 142, 32, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 70, 30, 16, + 0, 0, 0, 0, 0, 17, 0, 0, + 8, 34, 0, 16, 0, 0, 0, 0, + 0, 70, 142, 32, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 70, 30, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 7, 18, 0, 16, 0, 0, 0, 0, + 0, 26, 0, 16, 0, 0, 0, 0, + 0, 10, 0, 16, 0, 0, 0, 0, + 0, 54, 0, 0, 5, 130, 32, 16, + 0, 1, 0, 0, 0, 26, 0, 16, + 0, 0, 0, 0, 0, 56, 0, 0, + 7, 66, 32, 16, 0, 1, 0, 0, + 0, 10, 0, 16, 0, 0, 0, 0, + 0, 1, 64, 0, 0, 0, 0, 0, + 63, 17, 0, 0, 8, 18, 32, 16, + 0, 1, 0, 0, 0, 70, 142, 32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 70, 30, 16, 0, 0, 0, 0, + 0, 62, 0, 0, 1, 83, 84, 65, + 84, 116, 0, 0, 0, 10, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 82, 68, 69, 70, 204, 0, 0, + 0, 1, 0, 0, 0, 72, 0, 0, + 0, 1, 0, 0, 0, 28, 0, 0, + 0, 0, 4, 254, 255, 0, 65, 0, + 0, 152, 0, 0, 0, 60, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 36, 71, 108, +111, 98, 97, 108, 115, 0, 171, 171, +171, 60, 0, 0, 0, 1, 0, 0, + 0, 96, 0, 0, 0, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 120, 0, 0, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 2, 0, 0, + 0, 136, 0, 0, 0, 0, 0, 0, + 0, 95, 67, 67, 95, 77, 86, 80, + 77, 97, 116, 114, 105, 120, 0, 171, +171, 3, 0, 3, 0, 4, 0, 4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 105, 99, 114, 111, 115, 111, +102, 116, 32, 40, 82, 41, 32, 72, + 76, 83, 76, 32, 83, 104, 97, 100, +101, 114, 32, 67, 111, 109, 112, 105, +108, 101, 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, + 78, 68, 0, 0, 0, 2, 0, 0, + 0, 8, 0, 0, 0, 56, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 0, 0, 56, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 1, 0, 0, + 0, 3, 3, 0, 0, 84, 69, 88, + 67, 79, 79, 82, 68, 0, 171, 171, +171, 79, 83, 71, 78, 80, 0, 0, + 0, 2, 0, 0, 0, 8, 0, 0, + 0, 56, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 3, 12, 0, + 0, 65, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 3, 0, 0, + 0, 1, 0, 0, 0, 15, 0, 0, + 0, 84, 69, 88, 67, 79, 79, 82, + 68, 0, 83, 86, 95, 80, 111, 115, +105, 116, 105, 111, 110, 0, 171, 171, +171, +}; + +const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = { + +166, 147, 0, 0, 142, 9, 2, 1, + 0, 128, 0, 0, 82, 139, 0, 0, + 10, 0, 0, 0, 97, 95, 112, 111, +115, 105, 116, 105, 111, 110, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, 80, 139, + 0, 0, 10, 0, 0, 0, 97, 95, +116, 101, 120, 67, 111, 111, 114, 100, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 0, 0, 0, 92, 139, 0, + 0, 242, 141, 0, 0, 12, 0, 0, + 0, 67, 67, 95, 77, 86, 80, 77, + 97, 116, 114, 105, 120, 0, 0, 0, + 0, 255, 255, 255, 255, 0, 0, 0, + 0, 4, 0, 0, 0, 82, 139, 0, + 0, 241, 141, 0, 0, 7, 0, 0, + 0, 117, 95, 99, 111, 108, 111, 114, + 0, 0, 0, 0, 0, 0, 0, 0, +255, 255, 255, 255, 1, 0, 0, 0, + 2, 0, 0, 0, 12, 0, 0, 0, + 67, 67, 95, 77, 86, 80, 77, 97, +116, 114, 105, 120, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 0, 0, 0, +117, 95, 99, 111, 108, 111, 114, 0, + 0, 0, 0, 1, 0, 0, 0, 52, + 3, 0, 0, 40, 4, 0, 0, 0, + 0, 0, 0, 20, 134, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 68, 88, 66, 67, 153, + 8, 62, 201, 202, 170, 111, 182, 149, +120, 120, 178, 230, 43, 232, 244, 1, + 0, 0, 0, 52, 3, 0, 0, 6, + 0, 0, 0, 56, 0, 0, 0, 168, + 0, 0, 0, 92, 1, 0, 0, 216, + 1, 0, 0, 168, 2, 0, 0, 184, + 2, 0, 0, 65, 111, 110, 57, 104, + 0, 0, 0, 104, 0, 0, 0, 0, + 2, 255, 255, 56, 0, 0, 0, 48, + 0, 0, 0, 1, 0, 36, 0, 0, + 0, 48, 0, 0, 0, 48, 0, 0, + 0, 36, 0, 0, 0, 48, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 2, 255, 255, 1, + 0, 0, 2, 0, 8, 15, 128, 0, + 0, 228, 160, 1, 0, 0, 2, 1, + 8, 15, 128, 0, 0, 228, 160, 1, + 0, 0, 2, 2, 8, 15, 128, 0, + 0, 228, 160, 1, 0, 0, 2, 3, + 8, 15, 128, 0, 0, 228, 160, 255, +255, 0, 0, 83, 72, 68, 82, 172, + 0, 0, 0, 64, 0, 0, 0, 43, + 0, 0, 0, 89, 0, 0, 4, 70, +142, 32, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 101, 0, 0, 3, 242, + 32, 16, 0, 0, 0, 0, 0, 101, + 0, 0, 3, 242, 32, 16, 0, 1, + 0, 0, 0, 101, 0, 0, 3, 242, + 32, 16, 0, 2, 0, 0, 0, 101, + 0, 0, 3, 242, 32, 16, 0, 3, + 0, 0, 0, 54, 0, 0, 6, 242, + 32, 16, 0, 0, 0, 0, 0, 70, +142, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 54, 0, 0, 6, 242, + 32, 16, 0, 1, 0, 0, 0, 70, +142, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 54, 0, 0, 6, 242, + 32, 16, 0, 2, 0, 0, 0, 70, +142, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 54, 0, 0, 6, 242, + 32, 16, 0, 3, 0, 0, 0, 70, +142, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 62, 0, 0, 1, 83, + 84, 65, 84, 116, 0, 0, 0, 5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 68, 69, 70, 200, + 0, 0, 0, 1, 0, 0, 0, 72, + 0, 0, 0, 1, 0, 0, 0, 28, + 0, 0, 0, 0, 4, 255, 255, 0, + 65, 0, 0, 148, 0, 0, 0, 60, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 36, + 71, 108, 111, 98, 97, 108, 115, 0, +171, 171, 171, 60, 0, 0, 0, 1, + 0, 0, 0, 96, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 120, 0, 0, 0, 0, + 0, 0, 0, 16, 0, 0, 0, 2, + 0, 0, 0, 132, 0, 0, 0, 0, + 0, 0, 0, 95, 117, 95, 99, 111, +108, 111, 114, 0, 171, 171, 171, 1, + 0, 3, 0, 1, 0, 4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 77, +105, 99, 114, 111, 115, 111, 102, 116, + 32, 40, 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, 101, 114, + 32, 67, 111, 109, 112, 105, 108, 101, +114, 32, 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 8, + 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 0, 79, 83, 71, 78, 116, + 0, 0, 0, 4, 0, 0, 0, 8, + 0, 0, 0, 104, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 15, + 0, 0, 0, 104, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 1, 0, 0, 0, 15, + 0, 0, 0, 104, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 2, 0, 0, 0, 15, + 0, 0, 0, 104, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 3, 0, 0, 0, 15, + 0, 0, 0, 83, 86, 95, 84, 97, +114, 103, 101, 116, 0, 171, 171, 68, + 88, 66, 67, 127, 38, 114, 44, 227, +180, 68, 44, 235, 149, 12, 244, 164, +251, 61, 185, 1, 0, 0, 0, 40, + 4, 0, 0, 6, 0, 0, 0, 56, + 0, 0, 0, 44, 1, 0, 0, 88, + 2, 0, 0, 212, 2, 0, 0, 168, + 3, 0, 0, 244, 3, 0, 0, 65, +111, 110, 57, 236, 0, 0, 0, 236, + 0, 0, 0, 0, 2, 254, 255, 184, + 0, 0, 0, 52, 0, 0, 0, 1, + 0, 36, 0, 0, 0, 48, 0, 0, + 0, 48, 0, 0, 0, 36, 0, 1, + 0, 48, 0, 0, 0, 0, 0, 4, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 2, 254, 255, 81, + 0, 0, 5, 5, 0, 15, 160, 0, + 0, 0, 63, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 31, + 0, 0, 2, 5, 0, 0, 128, 0, + 0, 15, 144, 9, 0, 0, 3, 0, + 0, 1, 128, 3, 0, 228, 160, 0, + 0, 228, 144, 9, 0, 0, 3, 0, + 0, 2, 128, 4, 0, 228, 160, 0, + 0, 228, 144, 2, 0, 0, 3, 0, + 0, 1, 128, 0, 0, 85, 128, 0, + 0, 0, 128, 5, 0, 0, 3, 0, + 0, 4, 192, 0, 0, 0, 128, 5, + 0, 0, 160, 9, 0, 0, 3, 0, + 0, 1, 128, 2, 0, 228, 160, 0, + 0, 228, 144, 1, 0, 0, 2, 1, + 0, 2, 128, 0, 0, 0, 129, 9, + 0, 0, 3, 1, 0, 1, 128, 1, + 0, 228, 160, 0, 0, 228, 144, 4, + 0, 0, 4, 0, 0, 3, 192, 0, + 0, 85, 128, 0, 0, 228, 160, 1, + 0, 228, 128, 1, 0, 0, 2, 0, + 0, 8, 192, 0, 0, 85, 128, 255, +255, 0, 0, 83, 72, 68, 82, 36, + 1, 0, 0, 64, 0, 1, 0, 73, + 0, 0, 0, 89, 0, 0, 4, 70, +142, 32, 0, 0, 0, 0, 0, 4, + 0, 0, 0, 95, 0, 0, 3, 242, + 16, 16, 0, 0, 0, 0, 0, 103, + 0, 0, 4, 242, 32, 16, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 104, + 0, 0, 2, 1, 0, 0, 0, 17, + 0, 0, 8, 18, 0, 16, 0, 0, + 0, 0, 0, 70, 142, 32, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 70, + 30, 16, 0, 0, 0, 0, 0, 54, + 0, 0, 6, 34, 32, 16, 0, 0, + 0, 0, 0, 10, 0, 16, 128, 65, + 0, 0, 0, 0, 0, 0, 0, 17, + 0, 0, 8, 18, 0, 16, 0, 0, + 0, 0, 0, 70, 142, 32, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 70, + 30, 16, 0, 0, 0, 0, 0, 17, + 0, 0, 8, 34, 0, 16, 0, 0, + 0, 0, 0, 70, 142, 32, 0, 0, + 0, 0, 0, 3, 0, 0, 0, 70, + 30, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 18, 0, 16, 0, 0, + 0, 0, 0, 26, 0, 16, 0, 0, + 0, 0, 0, 10, 0, 16, 0, 0, + 0, 0, 0, 54, 0, 0, 5, 130, + 32, 16, 0, 0, 0, 0, 0, 26, + 0, 16, 0, 0, 0, 0, 0, 56, + 0, 0, 7, 66, 32, 16, 0, 0, + 0, 0, 0, 10, 0, 16, 0, 0, + 0, 0, 0, 1, 64, 0, 0, 0, + 0, 0, 63, 17, 0, 0, 8, 18, + 32, 16, 0, 0, 0, 0, 0, 70, +142, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 70, 30, 16, 0, 0, + 0, 0, 0, 62, 0, 0, 1, 83, + 84, 65, 84, 116, 0, 0, 0, 9, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 68, 69, 70, 204, + 0, 0, 0, 1, 0, 0, 0, 72, + 0, 0, 0, 1, 0, 0, 0, 28, + 0, 0, 0, 0, 4, 254, 255, 0, + 65, 0, 0, 152, 0, 0, 0, 60, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 36, + 71, 108, 111, 98, 97, 108, 115, 0, +171, 171, 171, 60, 0, 0, 0, 1, + 0, 0, 0, 96, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 120, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, 0, 2, + 0, 0, 0, 136, 0, 0, 0, 0, + 0, 0, 0, 95, 67, 67, 95, 77, + 86, 80, 77, 97, 116, 114, 105, 120, + 0, 171, 171, 3, 0, 3, 0, 4, + 0, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 77, 105, 99, 114, 111, +115, 111, 102, 116, 32, 40, 82, 41, + 32, 72, 76, 83, 76, 32, 83, 104, + 97, 100, 101, 114, 32, 67, 111, 109, +112, 105, 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 171, 73, + 83, 71, 78, 68, 0, 0, 0, 2, + 0, 0, 0, 8, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 15, 15, 0, 0, 56, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 0, 0, 1, + 0, 0, 0, 3, 0, 0, 0, 84, + 69, 88, 67, 79, 79, 82, 68, 0, +171, 171, 171, 79, 83, 71, 78, 44, + 0, 0, 0, 1, 0, 0, 0, 8, + 0, 0, 0, 32, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 15, + 0, 0, 0, 83, 86, 95, 80, 111, +115, 105, 116, 105, 111, 110, 0, +}; + const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = { 166, 147, 0, 0, 142, 9, 2, 1, @@ -5929,7 +6642,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = { 105, 111, 110, 0, 171, 171, 171, }; -const int s_numPrograms = 15; -const int s_programLengths[] = {2990,2528,4102,3022,2996,3358,2982,3300,3350,3025,3556,2502,2675,3746,2775}; -const unsigned char* s_programs[] = {s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873,s_13E33F532157A58EC77EDE3B3112560A89D272B2,s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE,s_53938AB67AD93ABA0DDB87F3C9889304284E011E,s_67837675F2BB48C0E926316F505FC1538228E0FA,s_78250E25D1929D4A842050738140787BE42541C6,s_7B67DD242152D35ACC079265FAD9D03DC98182DE,s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5,s_92BE325B516F887D2C928EDE20ADF428DB01C038,s_A2377A827972A5466DA8637681045D32DA8A817D,s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86,s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893,s_E2D56227712263272BD5218FEA117CD06180F81B,s_F46558C274182079784898CF4968CF431593D5E2,s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6}; -const char* s_programKeys[] = {"133478C5A874C1E6F59B418CE6C7C39F1AE0F873","13E33F532157A58EC77EDE3B3112560A89D272B2","1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE","53938AB67AD93ABA0DDB87F3C9889304284E011E","67837675F2BB48C0E926316F505FC1538228E0FA","78250E25D1929D4A842050738140787BE42541C6","7B67DD242152D35ACC079265FAD9D03DC98182DE","847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5","92BE325B516F887D2C928EDE20ADF428DB01C038","A2377A827972A5466DA8637681045D32DA8A817D","B5E27B4F3CF7236633255B28CBA530D6EE5CED86","E2C7CE1244DE9C76688EFA9463B2A130B6A08893","E2D56227712263272BD5218FEA117CD06180F81B","F46558C274182079784898CF4968CF431593D5E2","F6BA4519AF2653A53D57FB5D5508F0D8617105D6"}; +const int s_numPrograms = 17; +const int s_programLengths[] = {2990,2528,4102,3022,2996,3358,2982,3073,2559,3300,3350,3025,3556,2502,2675,3746,2775}; +const unsigned char* s_programs[] = {s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873,s_13E33F532157A58EC77EDE3B3112560A89D272B2,s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE,s_53938AB67AD93ABA0DDB87F3C9889304284E011E,s_67837675F2BB48C0E926316F505FC1538228E0FA,s_78250E25D1929D4A842050738140787BE42541C6,s_7B67DD242152D35ACC079265FAD9D03DC98182DE,s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D,s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C,s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5,s_92BE325B516F887D2C928EDE20ADF428DB01C038,s_A2377A827972A5466DA8637681045D32DA8A817D,s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86,s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893,s_E2D56227712263272BD5218FEA117CD06180F81B,s_F46558C274182079784898CF4968CF431593D5E2,s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6}; +const char* s_programKeys[] = {"133478C5A874C1E6F59B418CE6C7C39F1AE0F873","13E33F532157A58EC77EDE3B3112560A89D272B2","1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE","53938AB67AD93ABA0DDB87F3C9889304284E011E","67837675F2BB48C0E926316F505FC1538228E0FA","78250E25D1929D4A842050738140787BE42541C6","7B67DD242152D35ACC079265FAD9D03DC98182DE","7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D","7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C","847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5","92BE325B516F887D2C928EDE20ADF428DB01C038","A2377A827972A5466DA8637681045D32DA8A817D","B5E27B4F3CF7236633255B28CBA530D6EE5CED86","E2C7CE1244DE9C76688EFA9463B2A130B6A08893","E2D56227712263272BD5218FEA117CD06180F81B","F46558C274182079784898CF4968CF431593D5E2","F6BA4519AF2653A53D57FB5D5508F0D8617105D6"}; From 39716664267d85c993784a4f37cb6808b17be32d Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 20 May 2014 10:06:24 -0700 Subject: [PATCH 74/90] updated pch file for wp8 --- build/cocos2d-wp8.vc2012.sln | 16 +++++++--------- cocos/2d/cocos2d_wp8.vcxproj | 2 -- cocos/2d/cocos2d_wp8.vcxproj.filters | 6 ------ 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/build/cocos2d-wp8.vc2012.sln b/build/cocos2d-wp8.vc2012.sln index 1f3e8ba26c..bd66958f7e 100644 --- a/build/cocos2d-wp8.vc2012.sln +++ b/build/cocos2d-wp8.vc2012.sln @@ -1,7 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30324.0 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 2012 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d_wp8.vcxproj", "{B5AF91B3-64EA-44E1-84B0-D759E93758FB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.wp8\libSpine.vcxproj", "{7D4FC6EB-9497-4804-98F3-3EAEDC896154}" @@ -46,9 +44,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cpp-tests", "..\tests\cpp-t EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-testsComponent", "..\tests\cpp-tests\proj.wp8-xaml\cpp-testsComponent\cpp-testsComponent.vcxproj", "{86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9}" - ProjectSection(ProjectDependencies) = postProject - {271FEE84-9198-4C26-8567-4247C563B0B1} = {271FEE84-9198-4C26-8567-4247C563B0B1} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libNetwork", "..\cocos\network\proj.wp8\libNetwork.vcxproj", "{7DAA99E7-8E07-4FEF-8374-8EC04E395D2E}" ProjectSection(ProjectDependencies) = postProject @@ -63,9 +58,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cpp-empty-test", "..\tests\ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-testComponent", "..\tests\cpp-empty-test\proj-wp8-xaml\cpp-empty-testComponent\cpp-empty-testComponent.vcxproj", "{F5D665F8-AE19-4F3F-99A7-230A1E8305D2}" - ProjectSection(ProjectDependencies) = postProject - {271FEE84-9198-4C26-8567-4247C563B0B1} = {271FEE84-9198-4C26-8567-4247C563B0B1} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.wp8\libGUI.vcxproj", "{08FB23E4-1517-4EDC-B682-DA238CDAA83D}" ProjectSection(ProjectDependencies) = postProject @@ -73,6 +65,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj. EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CopyTemplateFiles", "..\cocos\platform\wp8-xaml\CopyTemplateFiles.vcxproj", "{271FEE84-9198-4C26-8567-4247C563B0B1}" + ProjectSection(ProjectDependencies) = postProject + {5921FE12-7EF3-4847-8453-42EF286DDBE7} = {5921FE12-7EF3-4847-8453-42EF286DDBE7} + {60D53713-1675-4466-81DC-D67A031C3D21} = {60D53713-1675-4466-81DC-D67A031C3D21} + {86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9} = {86B2C23C-3A6C-4C4E-AB0E-16A8CC1523E9} + {F5D665F8-AE19-4F3F-99A7-230A1E8305D2} = {F5D665F8-AE19-4F3F-99A7-230A1E8305D2} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index 91aa5e52a8..af64540683 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -326,7 +326,6 @@ - @@ -537,7 +536,6 @@ - diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index 33bbaae0a1..e7f75c3fd6 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -571,9 +571,6 @@ platform\winrt - - platform\winrt - platform\winrt @@ -1183,9 +1180,6 @@ platform\winrt - - platform\winrt - platform\winrt From 2a7b223b5be6f0c82ebcfe0bd4cde908a28c426d Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Tue, 20 May 2014 11:47:33 -0700 Subject: [PATCH 75/90] updated link() for wp8 --- cocos/renderer/CCGLProgram.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index 421eec76da..e198cfa2c4 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -504,6 +504,10 @@ bool GLProgram::link() if(!_hasShaderCompiler) { // precompiled shader program is already linked + + //bindPredefinedVertexAttribs(); + parseVertexAttribs(); + parseUniforms(); return true; } #endif From fa5d43741ce64a44d4ec734e0643723291c430a8 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 21 May 2014 10:46:26 +0800 Subject: [PATCH 76/90] fix keypad test --- tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp b/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp index 4bac8b0ba4..de8ad35a0e 100644 --- a/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp +++ b/tests/cpp-tests/Classes/KeypadTest/KeypadTest.cpp @@ -27,7 +27,7 @@ KeypadTest::~KeypadTest() void KeypadTest::onKeyReleased(EventKeyboard::KeyCode keycode, Event* event) { - if (keycode == EventKeyboard::KeyCode::KEY_BACKSPACE) + if (keycode == EventKeyboard::KeyCode::KEY_ESCAPE) { _label->setString("BACK clicked!"); } From dd21d27d59a632ef55a7a5a50cc3fc74c423722e Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 21 May 2014 11:24:23 +0800 Subject: [PATCH 77/90] [ci skip] --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d77819773a..aec2277c82 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ cocos2d-x-3.1 ??? + [FIX] Label: may crash when using outline effect [FIX] ProgressTo: will start from 0 when it reaches 100 + [FIX] WP8: orientation is not correct when it is set to portrait cocos2d-x-3.1-rc0 May.18 2014 [NEW] Cocos2dxActivity: Adds a virtual method to load native libraries. From ac258439b008e108ebd7e61df1714c8ead66e5c0 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 21 May 2014 11:38:45 +0800 Subject: [PATCH 78/90] close issue#5277:Label:It could be possible that for using outline and invoking 'Director::setContentScaleFactor' cause label show nothing. --- cocos/2d/CCFontAtlasCache.cpp | 4 ++-- cocos/2d/CCFontFreeType.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cocos/2d/CCFontAtlasCache.cpp b/cocos/2d/CCFontAtlasCache.cpp index 683f825071..bad6c9f733 100644 --- a/cocos/2d/CCFontAtlasCache.cpp +++ b/cocos/2d/CCFontAtlasCache.cpp @@ -69,8 +69,8 @@ FontAtlas * FontAtlasCache::getFontAtlasTTF(const TTFConfig & config) if ( it == _atlasMap.end() ) { - auto font = FontFreeType::create(config.fontFilePath, fontSize * contentScaleFactor, config.glyphs, - config.customGlyphs,useDistanceField,config.outlineSize * contentScaleFactor); + auto font = FontFreeType::create(config.fontFilePath, fontSize, config.glyphs, + config.customGlyphs, useDistanceField, config.outlineSize); if (font) { auto tempAtlas = font->createFontAtlas(); diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 2f93ac75f0..53607fc127 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. #include #include - +#include "base/CCDirector.h" #include "base/ccUTF8.h" #include "platform/CCFileUtils.h" #include "edtaa3func.h" @@ -104,7 +104,7 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline / { FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker); FT_Stroker_Set(_stroker, - (int)(_outlineSize * 64), + (int)(_outlineSize * 64 * CC_CONTENT_SCALE_FACTOR()), FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); @@ -142,7 +142,7 @@ bool FontFreeType::createFontObject(const std::string &fontName, int fontSize) // set the requested font size int dpi = 72; - int fontSizePoints = (int)(64.f * fontSize); + int fontSizePoints = (int)(64.f * fontSize * CC_CONTENT_SCALE_FACTOR()); if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi)) return false; From 7facea521c84d125b4e6b31a646889b9bfdc87fe Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 21 May 2014 11:44:15 +0800 Subject: [PATCH 79/90] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index aec2277c82..4a2af05844 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ cocos2d-x-3.1 ??? [FIX] Label: may crash when using outline effect + [FIX] Label: using outline and invoking 'Director::setContentScaleFactor' cause label show nothing [FIX] ProgressTo: will start from 0 when it reaches 100 [FIX] WP8: orientation is not correct when it is set to portrait From d13ed93fc1ec3e3e308d0dddae0e6c5e7a0bc590 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 21 May 2014 14:08:30 +0800 Subject: [PATCH 80/90] issue #5277:Label:It could be possible that for using outline and invoking 'Director::setContentScaleFactor' cause label show nothing. --- cocos/2d/CCFontFreeType.cpp | 11 ++++++----- cocos/2d/CCFontFreeType.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 53607fc127..48ce2d8bba 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -102,9 +102,10 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline / { if (_outlineSize > 0) { + _outlineSize *= CC_CONTENT_SCALE_FACTOR(); FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker); FT_Stroker_Set(_stroker, - (int)(_outlineSize * 64 * CC_CONTENT_SCALE_FACTOR()), + (int)(_outlineSize * 64), FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); @@ -305,8 +306,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid auto blendImage = new unsigned char[blendWidth * blendHeight * 2]; memset(blendImage, 0, blendWidth * blendHeight * 2); - int px = blendWidth == outlineWidth ? 0 : _outlineSize; - int py = blendHeight == outlineHeight ? 0 : _outlineSize; + int px = (blendWidth - outlineWidth) / 2; + int py = (blendHeight - outlineHeight) / 2; for (int x = 0; x < outlineWidth; ++x) { for (int y = 0; y < outlineHeight; ++y) @@ -317,8 +318,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid } } - px = blendWidth == outWidth ? 0 : _outlineSize; - py = blendHeight == outHeight ? 0 : _outlineSize; + px = (blendWidth - outWidth) / 2; + py = (blendHeight - outHeight) / 2; for (int x = 0; x < outWidth; ++x) { for (int y = 0; y < outHeight; ++y) diff --git a/cocos/2d/CCFontFreeType.h b/cocos/2d/CCFontFreeType.h index 9c38e979b8..681f009a3b 100644 --- a/cocos/2d/CCFontFreeType.h +++ b/cocos/2d/CCFontFreeType.h @@ -58,7 +58,7 @@ public: static void shutdownFreeType(); bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;} - int getOutlineSize() const { return _outlineSize; } + float getOutlineSize() const { return _outlineSize; } void renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,long bitmapWidth,long bitmapHeight); virtual FontAtlas * createFontAtlas() override; @@ -89,7 +89,7 @@ private: FT_Stroker _stroker; std::string _fontName; bool _distanceFieldEnabled; - int _outlineSize; + float _outlineSize; }; NS_CC_END From 64d316fa65f943a385382313dd9ae8af24dd99f9 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 21 May 2014 14:32:03 +0800 Subject: [PATCH 81/90] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 4a2af05844..f157fbd9b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ cocos2d-x-3.1 ??? [FIX] Label: using outline and invoking 'Director::setContentScaleFactor' cause label show nothing [FIX] ProgressTo: will start from 0 when it reaches 100 [FIX] WP8: orientation is not correct when it is set to portrait + [FIX] WP8: fix for precompiled shaders and precompiled headers cocos2d-x-3.1-rc0 May.18 2014 [NEW] Cocos2dxActivity: Adds a virtual method to load native libraries. From dbd2de63b24211d0763e4ec8a77f34447a29e855 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 21 May 2014 15:21:55 +0800 Subject: [PATCH 82/90] issue #5183, fix Layout visit issue --- cocos/ui/UILayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index be628e30f9..243268be3e 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -705,7 +705,7 @@ bool Layout::isClippingEnabled() void Layout::visit(Renderer *renderer, const Mat4 &parentTransform, bool parentTransformUpdated) { - if (!_enabled) + if (!_visible) { return; } From a07b2dae7540e154d1c99f1c22dbefbf3f5dea4f Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Wed, 21 May 2014 07:25:16 +0000 Subject: [PATCH 83/90] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index bc6acf5bcf..4411ec4210 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -848,6 +848,8 @@ "cocos/platform/wp8/Direct3DBase.h", "cocos/platform/wp8/DirectXBase.cpp", "cocos/platform/wp8/DirectXBase.h", + "cocos/platform/wp8/pch.cpp", + "cocos/platform/wp8/pch.h", "cocos/platform/wp8/shaders/precompiledshaders.h", "cocos/renderer/CCBatchCommand.cpp", "cocos/renderer/CCBatchCommand.h", From b6274a469d9c943b85fffa444ce8346f854064a8 Mon Sep 17 00:00:00 2001 From: boyu0 Date: Wed, 21 May 2014 16:07:49 +0800 Subject: [PATCH 84/90] closed #4944: fixed bug: physics engine crashes occasionally when remove bodies at physics contact callback. --- cocos/physics/CCPhysicsWorld.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index f62a715b63..be97f220c6 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -526,18 +526,20 @@ void PhysicsWorld::updateBodies() return; } - for (auto& body : _delayAddBodies) + // issue #4944, contact callback will be invoked when add/remove body, _delayAddBodies maybe changed, so we need make a copy. + auto addCopy = _delayAddBodies; + _delayAddBodies.clear(); + for (auto& body : addCopy) { doAddBody(body); } - for (auto& body : _delayRemoveBodies) + auto removeCopy = _delayRemoveBodies; + _delayRemoveBodies.clear(); + for (auto& body : removeCopy) { doRemoveBody(body); } - - _delayAddBodies.clear(); - _delayRemoveBodies.clear(); } void PhysicsWorld::removeBody(int tag) @@ -668,12 +670,16 @@ void PhysicsWorld::updateJoints() return; } - for (auto joint : _delayAddJoints) + auto addCopy = _delayAddJoints; + _delayAddJoints.clear(); + for (auto joint : addCopy) { doAddJoint(joint); } - for (auto joint : _delayRemoveJoints) + auto removeCopy = _delayRemoveJoints; + _delayRemoveJoints.clear(); + for (auto joint : removeCopy) { doRemoveJoint(joint); @@ -682,9 +688,6 @@ void PhysicsWorld::updateJoints() delete joint; } } - - _delayAddJoints.clear(); - _delayRemoveJoints.clear(); } void PhysicsWorld::removeShape(PhysicsShape* shape) @@ -878,7 +881,7 @@ void PhysicsWorld::setGravity(const Vect& gravity) void PhysicsWorld::update(float delta) { - if (_delayDirty) + while (_delayDirty) { // the updateJoints must run before the updateBodies. updateJoints(); From b7cd118d522070e4d7f6a8fe6c4171d309279676 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 21 May 2014 18:35:14 +0800 Subject: [PATCH 85/90] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index f157fbd9b7..31038df902 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ cocos2d-x-3.1 ??? [FIX] Label: may crash when using outline effect [FIX] Label: using outline and invoking 'Director::setContentScaleFactor' cause label show nothing [FIX] ProgressTo: will start from 0 when it reaches 100 + [FIX] Physics integration: may crashes if remove bodies at physics contact callback [FIX] WP8: orientation is not correct when it is set to portrait [FIX] WP8: fix for precompiled shaders and precompiled headers From 6c8e38871c30447bad6175bcbb5d1f3557158591 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 22 May 2014 10:22:10 +0800 Subject: [PATCH 86/90] issue #5255:Remove Sprite3D effect test --- build/cocos2d_tests.xcodeproj/project.pbxproj | 2 + .../src/Sprite3DTest/Sprite3DTest.lua | 201 ------------------ 2 files changed, 2 insertions(+), 201 deletions(-) diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 4ed7d5dbc9..a210b34307 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -85,6 +85,7 @@ 15C90B4A18E66C2B00D69802 /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; }; 15C90B4B18E66C2F00D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 15C90B4C18E66C3100D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; + 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; 1A0EE2A118CDF6DA004CD58F /* libchipmunk Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB41807A4F9005B8026 /* libchipmunk Mac.a */; }; 1A0EE2A218CDF6DA004CD58F /* libcocos2dx Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2dx Mac.a */; }; 1A0EE2A418CDF6DA004CD58F /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB81807A4F9005B8026 /* libCocosDenshion Mac.a */; }; @@ -4354,6 +4355,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */, 15C90B4418E66C1800D69802 /* mime.lua in Resources */, 15C90B4C18E66C3100D69802 /* url.lua in Resources */, 1AC35DD618CEE65200F37B72 /* Misc in Resources */, diff --git a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua index 263f56659f..78effa2d15 100644 --- a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua +++ b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua @@ -1,12 +1,4 @@ local size = cc.Director:getInstance():getWinSize() -local attributeNames = -{ - "a_position", - "a_color", - "a_texCoord", - "a_normal", -} - ---------------------------------------- ----Sprite3DBasicTest @@ -66,198 +58,6 @@ function Sprite3DBasicTest.create() return layer end ----------------------------------------- -----Sprite3DEffectTest ----------------------------------------- - -local Effect3DOutline = class("Effect3DOutline") -Effect3DOutline.__index = Effect3DOutline - -function Effect3DOutline:ctor() - self.outlineWidth = 0.0 - self.outlineColor = { x = 1, y = 1, z = 1} - self.glProgramState = nil - self.vertShaderFile = "Shaders3D/OutLine.vert" - self.fragShaderFile = "Shaders3D/OutLine.frag" - self.keyInGLProgramCache = "Effect3DLibrary_Outline" - - if self:init() then - return self - else - return nil - end -end - -function Effect3DOutline:getOrCreateProgram() - - local program = cc.GLProgramCache:getInstance():getGLProgram(self.keyInGLProgramCache) - - if nil == program then - program = cc.GLProgram:createWithFilenames(self.vertShaderFile , self.fragShaderFile) - cc.GLProgramCache:getInstance():addGLProgram(program, self.keyInGLProgramCache) - end - print(program) - return program -end - -function Effect3DOutline:init() - local program = self:getOrCreateProgram() - if nil == program then - return false - end - - self.glProgramState = cc.GLProgramState:create(program) - if nil == self.glProgramState then - return false - end - - self.glProgramState:retain() - self.glProgramState:setUniformVec3("OutLineColor", self.outlineColor) - self.glProgramState:setUniformFloat("OutlineWidth", self.outlineWidth) - - return true -end - - -function Effect3DOutline:setOutlineColor(color) - if self.outlineColor.x ~= color.x and self.outlineColor.y ~= color.y or self.outlineColor.z ~= color.z then - self.outlineColor.x = color.x - self.outlineColor.y = color.y - self.outlineColor.z = color.z - self.glProgramState:setUniformVec3("OutLineColor", self.outlineColor) - end -end - -function Effect3DOutline:setOutlineWidth(width) - if self.outlineWidth ~= width then - self.outlineWidth = width - self.glProgramState:setUniformFloat("OutlineWidth", self.outlineWidth ) - end -end - -function Effect3DOutline:drawWithSprite(sprite, transform) - - local mesh = sprite:getMesh() - local offset = 0 - for i = 1, mesh:getMeshVertexAttribCount() do - local meshvertexattrib = mesh:getMeshVertexAttribute(i - 1) - self.glProgramState:setVertexAttribPointer(attributeNames[meshvertexattrib.vertexAttrib + 1], meshvertexattrib.size, meshvertexattrib.type, false, mesh:getVertexSizeInBytes(), offset) - offset = offset + meshvertexattrib.attribSizeBytes - end - - --draw - gl.enable(gl.CULL_FACE) - gl.cullFace(gl.FRONT) - gl.enable(gl.DEPTH_TEST) - - local color = sprite:getDisplayedColor() - color.a = sprite:getDisplayedOpacity() / 255.0 - self.glProgramState:setUniformVec4("u_color", {x = color.r / 255.0, y = color.g / 255.0, z = color.b / 255.0, w = 1.0}) - - mesh = sprite:getMesh() - gl.bindBuffer(gl.ARRAY_BUFFER, mesh:getVertexBuffer()) - self.glProgramState:apply(transform) - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, mesh:getIndexBuffer()) - gl.drawElements(mesh:getPrimitiveType(), mesh:getIndexCount(), mesh:getIndexFormat(), 0) - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, 0) - gl.bindBuffer(gl.ARRAY_BUFFER, 0) - gl.disable(gl.DEPTH_TEST) - gl.cullFace(gl.BACK) - gl.disable(gl.CULL_FACE) -end - - -local EffectSprite3D = class("EffectSprite3D") -EffectSprite3D.__index = EffectSprite3D - -function EffectSprite3D.extend(target) - local t = tolua.getpeer(target) - if not t then - t = {} - tolua.setpeer(target, t) - end - setmetatable(t, EffectSprite3D) - return target -end - -function EffectSprite3D:init() - self.effects = {} - self.defaultEffect = nil -end - -function EffectSprite3D.createFromObjFileAndTexture(objFilePath, textureFilePath) - local sprite = EffectSprite3D.extend(cc.Sprite3D:create(objFilePath)) - sprite:setTexture(textureFilePath) - return sprite -end - - -local Sprite3DEffectTest = {} -Sprite3DEffectTest.__index = Sprite3DEffectTest - -function Sprite3DEffectTest.onTouchesEnd(touches, event) - for i = 1,table.getn(touches) do - local location = touches[i]:getLocation() - Sprite3DEffectTest.addNewSpriteWithCoords(Helper.currentLayer, location.x, location.y ) - end -end - -function Sprite3DEffectTest.addNewSpriteWithCoords(layer, x, y) - local sprite = EffectSprite3D.createFromObjFileAndTexture("Sprite3DTest/boss1.obj", "Sprite3DTest/boss.png") - sprite:setScale(6.0) - layer:addChild(sprite) - sprite:setPosition(cc.p(x, y)) - - local effect = Effect3DOutline.new() - effect:setOutlineColor({x = 1, y = 0, z =0}) - effect:setOutlineWidth(0.1) - local effect2 = Effect3DOutline.new() - effect2:setOutlineWidth(0.02) - effect2:setOutlineColor({x = 1, y = 1, z =0}) - - - local function onDraw(transform, transformUpdated) - effect:drawWithSprite(sprite, transform) - effect2:drawWithSprite(sprite, transform) - end - - local random = math.random(0, 1) - local action = nil - if random < 0.2 then - action = cc.ScaleBy:create(3,2) - elseif random < 0.4 then - action = cc.RotateBy:create(3, 360) - elseif random < 0.6 then - action = cc.Blink:create(1, 3) - elseif random < 0.8 then - action = cc.TintBy:create(2, 0, -255, -255) - else - action = cc.FadeOut:create(2) - end - - local action_back = action:reverse() - local seq = cc.Sequence:create(action, action_back) - - sprite:runAction(cc.RepeatForever:create(seq)) - - local glNode = gl.glNodeCreate() - glNode:setContentSize(cc.size(size.width, size.height)) - glNode:setAnchorPoint(cc.p(0.5, 0.5)) - glNode:setPosition( size.width / 2, size.height / 2) - glNode:registerScriptDrawHandler(onDraw) - layer:addChild(glNode,-10) - -end - -function Sprite3DEffectTest.create() - local layer = cc.Layer:create() - Helper.initWithLayer(layer) - Helper.titleLabel:setString("Testing Sprite3D") - Helper.subtitleLabel:setString("Sprite3d with effects") - - Sprite3DEffectTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2) - return layer -end function Sprite3DTest() local scene = cc.Scene:create() @@ -265,7 +65,6 @@ function Sprite3DTest() Helper.createFunctionTable = { Sprite3DBasicTest.create, - Sprite3DEffectTest.create, } scene:addChild(Sprite3DBasicTest.create()) From d1df19794a290e3b19235b14b72802ef949541dc Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 22 May 2014 10:49:28 +0800 Subject: [PATCH 87/90] fixed ui header file include problem --- cocos/ui/GUIDefine.h | 1 - cocos/ui/UIHelper.cpp | 3 ++- cocos/ui/UIHelper.h | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cocos/ui/GUIDefine.h b/cocos/ui/GUIDefine.h index 1df8a99884..99207e3248 100644 --- a/cocos/ui/GUIDefine.h +++ b/cocos/ui/GUIDefine.h @@ -25,7 +25,6 @@ #ifndef __TestCpp__GUIDefine__ #define __TestCpp__GUIDefine__ -#include "cocos2d.h" #include #include "cocostudio/ObjectFactory.h" diff --git a/cocos/ui/UIHelper.cpp b/cocos/ui/UIHelper.cpp index 7e0e4ca169..11b44c6b1d 100644 --- a/cocos/ui/UIHelper.cpp +++ b/cocos/ui/UIHelper.cpp @@ -22,7 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "CocosGUI.h" +#include "ui/UIHelper.h" +#include "ui/UIWidget.h" NS_CC_BEGIN diff --git a/cocos/ui/UIHelper.h b/cocos/ui/UIHelper.h index c16f90e669..68fa8dbfb9 100644 --- a/cocos/ui/UIHelper.h +++ b/cocos/ui/UIHelper.h @@ -25,9 +25,14 @@ THE SOFTWARE. #ifndef __UIHELPER_H__ #define __UIHELPER_H__ +#include +#include "base/CCPlatformMacros.h" + NS_CC_BEGIN namespace ui { + + class Widget; /** * @js NA From a68515dbff8dc2bfee03929ff9735243dcae2732 Mon Sep 17 00:00:00 2001 From: vision Date: Thu, 22 May 2014 12:42:52 +0800 Subject: [PATCH 88/90] adding guard for the callback condition --- cocos/renderer/CCTextureCache.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index 87ebe6195d..99f7dc4624 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -268,7 +268,11 @@ void TextureCache::addImageAsyncCallBack(float dt) texture = it->second; } - asyncStruct->callback(texture); + if (asyncStruct->callback) + { + asyncStruct->callback(texture); + } + if(image) { image->release(); From a6efd4f6509dec173dbb6c5f7a3837d139258169 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 22 May 2014 14:00:39 +0800 Subject: [PATCH 89/90] Move `setSearchPat` operation from cpp to script --- build/cocos2d_tests.xcodeproj/project.pbxproj | 2 + .../lua-tests/project/Classes/AppDelegate.cpp | 50 ----------------- tests/lua-tests/src/controller.lua | 55 +++++++++++++++++++ tools/tolua/cocos2dx.ini | 2 +- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index a210b34307..479ff9081c 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ 15C90B4B18E66C2F00D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 15C90B4C18E66C3100D69802 /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; + 15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; 1A0EE2A118CDF6DA004CD58F /* libchipmunk Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB41807A4F9005B8026 /* libchipmunk Mac.a */; }; 1A0EE2A218CDF6DA004CD58F /* libcocos2dx Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2dx Mac.a */; }; 1A0EE2A418CDF6DA004CD58F /* libCocosDenshion Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB81807A4F9005B8026 /* libCocosDenshion Mac.a */; }; @@ -4287,6 +4288,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15E66FD6192DC8C700C20A52 /* Sprite3DTest in Resources */, 1AC35DC318CEE65100F37B72 /* Misc in Resources */, 1AC35DC618CEE65100F37B72 /* Shaders in Resources */, 1AC35DBB18CEE65100F37B72 /* components in Resources */, diff --git a/tests/lua-tests/project/Classes/AppDelegate.cpp b/tests/lua-tests/project/Classes/AppDelegate.cpp index a49f931cfe..cbcd0f6821 100644 --- a/tests/lua-tests/project/Classes/AppDelegate.cpp +++ b/tests/lua-tests/project/Classes/AppDelegate.cpp @@ -36,14 +36,9 @@ bool AppDelegate::applicationDidFinishLaunching() auto designSize = Size(480, 320); - auto pFileUtils = FileUtils::getInstance(); - if (screenSize.height > 320) { auto resourceSize = Size(960, 640); - std::vector searchPaths; - searchPaths.push_back("hd"); - pFileUtils->setSearchPaths(searchPaths); director->setContentScaleFactor(resourceSize.height/designSize.height); } @@ -58,51 +53,6 @@ bool AppDelegate::applicationDidFinishLaunching() register_assetsmanager_test_sample(stack->getLuaState()); #endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) - std::string resPrefix(""); -#else - std::string resPrefix("res/"); -#endif - - std::vector searchPaths = pFileUtils->getSearchPaths(); - searchPaths.insert(searchPaths.begin(), resPrefix); - - searchPaths.insert(searchPaths.begin(), resPrefix + "cocosbuilderRes"); - if (screenSize.height > 320) - { - searchPaths.insert(searchPaths.begin(), resPrefix + "hd"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/Images"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/ArmatureComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/AttributeComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/BackgroundComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/EffectComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/LoadSceneEdtiorFileTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/ParticleComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/SpriteComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/TmxMapComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/UIComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/hd/scenetest/TriggerTest"); - } - else - { - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/Images"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/ArmatureComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/AttributeComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/BackgroundComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/EffectComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/LoadSceneEdtiorFileTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/ParticleComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/SpriteComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/TmxMapComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/UIComponentTest"); - searchPaths.insert(searchPaths.begin(), resPrefix + "ccs-res/scenetest/TriggerTest"); - } - - - FileUtils::getInstance()->setSearchPaths(searchPaths); - pEngine->executeScriptFile("src/controller.lua"); return true; diff --git a/tests/lua-tests/src/controller.lua b/tests/lua-tests/src/controller.lua index 2ccad7250d..9a9d863513 100644 --- a/tests/lua-tests/src/controller.lua +++ b/tests/lua-tests/src/controller.lua @@ -8,6 +8,61 @@ require "src/mainMenu" -- run + +local glView = cc.Director:getInstance():getOpenGLView() +local screenSize = glView:getFrameSize() +local designSize = {width = 480, height = 320} +local fileUtils = cc.FileUtils:getInstance() + +if screenSize.height > 320 then + local searchPaths = {} + table.insert(searchPaths, "hd") + fileUtils:setSearchPaths(searchPaths) +end + +local targetPlatform = cc.Application:getInstance():getTargetPlatform() +local resPrefix = "" +if cc.PLATFORM_OS_IPAD == targetPlatform or cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_MAC == targetPlatform then + resPrefix = "" +else + resPrefix = "res/" +end + +local searchPaths = fileUtils:getSearchPaths() +table.insert(searchPaths, 1, resPrefix) +table.insert(searchPaths, 1, "cocosbuilderRes") + +if screenSize.height > 320 then + table.insert(searchPaths, 1, resPrefix .. "hd") + table.insert(searchPaths, 1, resPrefix .. "ccs-res") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/Images") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ArmatureComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/AttributeComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/BackgroundComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/EffectComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/LoadSceneEdtiorFileTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/ParticleComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/SpriteComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TmxMapComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/UIComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TriggerTest") +else + table.insert(searchPaths, 1, resPrefix .. "ccs-res/Images") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ArmatureComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/AttributeComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/BackgroundComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/EffectComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/LoadSceneEdtiorFileTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ParticleComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/SpriteComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TmxMapComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/UIComponentTest") + table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TriggerTest") +end + +fileUtils:setSearchPaths(searchPaths) + local scene = cc.Scene:create() scene:addChild(CreateTestMenu()) cc.Director:getInstance():runWithScene(scene) diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index e35bb9d96e..0e182c71e9 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -102,7 +102,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS TextureCache::[addPVRTCImage addImageAsync], Timer::[getSelector createWithScriptHandler], *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener], - FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile getFullPathCache], + FileUtils::[getFileData getDataFromFile getFullPathCache], Application::[^application.* ^run$], Camera::[getEyeXYZ getCenterXYZ getUpXYZ], ccFontDefinition::[*], From 0ab8624d2fb4c43bec2ed05dbe9522d19180acf4 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 22 May 2014 08:08:54 +0000 Subject: [PATCH 90/90] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/FileUtils.lua | 20 ++ .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 184 ++++++++++++++++++ .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 4 + 3 files changed, 208 insertions(+) diff --git a/cocos/scripting/lua-bindings/auto/api/FileUtils.lua b/cocos/scripting/lua-bindings/auto/api/FileUtils.lua index 87586f26bf..f4af944969 100644 --- a/cocos/scripting/lua-bindings/auto/api/FileUtils.lua +++ b/cocos/scripting/lua-bindings/auto/api/FileUtils.lua @@ -41,6 +41,11 @@ -- @param #string str -- @return array_table#array_table ret (return value: array_table) +-------------------------------- +-- @function [parent=#FileUtils] getSearchPaths +-- @param self +-- @return array_table#array_table ret (return value: array_table) + -------------------------------- -- @function [parent=#FileUtils] writeToFile -- @param self @@ -54,6 +59,16 @@ -- @param #string str -- @return map_table#map_table ret (return value: map_table) +-------------------------------- +-- @function [parent=#FileUtils] setSearchPaths +-- @param self +-- @param #array_table array + +-------------------------------- +-- @function [parent=#FileUtils] setSearchResolutionsOrder +-- @param self +-- @param #array_table array + -------------------------------- -- @function [parent=#FileUtils] addSearchResolutionsOrder -- @param self @@ -86,6 +101,11 @@ -- @param self -- @param #bool bool +-------------------------------- +-- @function [parent=#FileUtils] getSearchResolutionsOrder +-- @param self +-- @return array_table#array_table ret (return value: array_table) + -------------------------------- -- @function [parent=#FileUtils] getWritablePath -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 4558f77700..5415f2504e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -14412,6 +14412,50 @@ int lua_cocos2dx_FileUtils_getValueVectorFromFile(lua_State* tolua_S) return 0; } +int lua_cocos2dx_FileUtils_getSearchPaths(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_getSearchPaths'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const std::vector& ret = cobj->getSearchPaths(); + ccvector_std_string_to_luaval(tolua_S, ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSearchPaths",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_getSearchPaths'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_FileUtils_writeToFile(lua_State* tolua_S) { int argc = 0; @@ -14509,6 +14553,98 @@ int lua_cocos2dx_FileUtils_getValueMapFromFile(lua_State* tolua_S) return 0; } +int lua_cocos2dx_FileUtils_setSearchPaths(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_setSearchPaths'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::vector arg0; + + ok &= luaval_to_std_vector_string(tolua_S, 2, &arg0); + if(!ok) + return 0; + cobj->setSearchPaths(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSearchPaths",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_setSearchPaths'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_FileUtils_setSearchResolutionsOrder(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_setSearchResolutionsOrder'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::vector arg0; + + ok &= luaval_to_std_vector_string(tolua_S, 2, &arg0); + if(!ok) + return 0; + cobj->setSearchResolutionsOrder(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSearchResolutionsOrder",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_setSearchResolutionsOrder'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_FileUtils_addSearchResolutionsOrder(lua_State* tolua_S) { int argc = 0; @@ -14787,6 +14923,50 @@ int lua_cocos2dx_FileUtils_setPopupNotify(lua_State* tolua_S) return 0; } +int lua_cocos2dx_FileUtils_getSearchResolutionsOrder(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_FileUtils_getSearchResolutionsOrder'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + const std::vector& ret = cobj->getSearchResolutionsOrder(); + ccvector_std_string_to_luaval(tolua_S, ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSearchResolutionsOrder",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_FileUtils_getSearchResolutionsOrder'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_FileUtils_getWritablePath(lua_State* tolua_S) { int argc = 0; @@ -14911,14 +15091,18 @@ int lua_register_cocos2dx_FileUtils(lua_State* tolua_S) tolua_function(tolua_S,"loadFilenameLookup",lua_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile); tolua_function(tolua_S,"isPopupNotify",lua_cocos2dx_FileUtils_isPopupNotify); tolua_function(tolua_S,"getValueVectorFromFile",lua_cocos2dx_FileUtils_getValueVectorFromFile); + tolua_function(tolua_S,"getSearchPaths",lua_cocos2dx_FileUtils_getSearchPaths); tolua_function(tolua_S,"writeToFile",lua_cocos2dx_FileUtils_writeToFile); tolua_function(tolua_S,"getValueMapFromFile",lua_cocos2dx_FileUtils_getValueMapFromFile); + tolua_function(tolua_S,"setSearchPaths",lua_cocos2dx_FileUtils_setSearchPaths); + tolua_function(tolua_S,"setSearchResolutionsOrder",lua_cocos2dx_FileUtils_setSearchResolutionsOrder); tolua_function(tolua_S,"addSearchResolutionsOrder",lua_cocos2dx_FileUtils_addSearchResolutionsOrder); tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_FileUtils_addSearchPath); tolua_function(tolua_S,"isFileExist",lua_cocos2dx_FileUtils_isFileExist); tolua_function(tolua_S,"purgeCachedEntries",lua_cocos2dx_FileUtils_purgeCachedEntries); tolua_function(tolua_S,"fullPathFromRelativeFile",lua_cocos2dx_FileUtils_fullPathFromRelativeFile); tolua_function(tolua_S,"setPopupNotify",lua_cocos2dx_FileUtils_setPopupNotify); + tolua_function(tolua_S,"getSearchResolutionsOrder",lua_cocos2dx_FileUtils_getSearchResolutionsOrder); tolua_function(tolua_S,"getWritablePath",lua_cocos2dx_FileUtils_getWritablePath); tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_FileUtils_destroyInstance); tolua_function(tolua_S,"getInstance", lua_cocos2dx_FileUtils_getInstance); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 5899bee1f4..858c8078c8 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1602,6 +1602,10 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + +