diff --git a/CHANGELOG b/CHANGELOG index 088559c3bc..994a064a8b 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] Physics integration: may crashes if remove bodies at physics contact callback + [FIX] UIWidget: copyProperties() lost copy some properties [FIX] WP8: orientation is not correct when it is set to portrait [FIX] WP8: fix for precompiled shaders and precompiled headers [FIX] WP8: template supports orientation diff --git a/cocos/cocos2d.cpp b/cocos/cocos2d.cpp index c614bba1e8..7aa6de9fe3 100644 --- a/cocos/cocos2d.cpp +++ b/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "cocos2d-x 3.1rc0"; + return "cocos2d-x 3.1"; } NS_CC_END diff --git a/cocos/ui/UICheckBox.cpp b/cocos/ui/UICheckBox.cpp index 555095cde0..8da15cf230 100644 --- a/cocos/ui/UICheckBox.cpp +++ b/cocos/ui/UICheckBox.cpp @@ -615,6 +615,9 @@ void CheckBox::copySpecialProperties(Widget *widget) loadTextureBackGroundDisabled(checkBox->_backGroundDisabledFileName, checkBox->_backGroundDisabledTexType); loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledFileName, checkBox->_frontCrossDisabledTexType); setSelectedState(checkBox->_isSelected); + _checkBoxEventListener = checkBox->_checkBoxEventListener; + _checkBoxEventSelector = checkBox->_checkBoxEventSelector; + _checkBoxEventCallback = checkBox->_checkBoxEventCallback; } } diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 243268be3e..772ede8071 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -1515,6 +1515,8 @@ void Layout::copySpecialProperties(Widget *widget) setLayoutType(layout->_layoutType); setClippingEnabled(layout->_clippingEnabled); setClippingType(layout->_clippingType); + _loopFocus = layout->_loopFocus; + _passFocusToChild = layout->_passFocusToChild; } } diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index d61af9d837..fea46d7d1b 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -502,6 +502,9 @@ void ListView::copySpecialProperties(Widget *widget) setItemModel(listViewEx->_model); setItemsMargin(listViewEx->_itemsMargin); setGravity(listViewEx->_gravity); + _listViewEventListener = listViewEx->_listViewEventListener; + _listViewEventSelector = listViewEx->_listViewEventSelector; + _eventCallback = listViewEx->_eventCallback; } } diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 4a69fa7aba..381adb828f 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -626,6 +626,9 @@ void PageView::copySpecialProperties(Widget *widget) if (pageView) { Layout::copySpecialProperties(widget); + _eventCallback = pageView->_eventCallback; + _pageViewEventListener = pageView->_pageViewEventListener; + _pageViewEventSelector = pageView->_pageViewEventSelector; } } diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 09d0275ab8..0bc505ba60 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -1738,6 +1738,9 @@ void ScrollView::copySpecialProperties(Widget *widget) setDirection(scrollView->_direction); setBounceEnabled(scrollView->_bounceEnabled); setInertiaScrollEnabled(scrollView->_inertiaScrollEnabled); + _scrollViewEventListener = scrollView->_scrollViewEventListener; + _scrollViewEventSelector = scrollView->_scrollViewEventSelector; + _eventCallback = scrollView->_eventCallback; } } diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 899be8f866..4b6e89f4e3 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -627,6 +627,9 @@ void Slider::copySpecialProperties(Widget *widget) loadSlidBallTexturePressed(slider->_slidBallPressedTextureFile, slider->_ballPTexType); loadSlidBallTextureDisabled(slider->_slidBallDisabledTextureFile, slider->_ballDTexType); setPercent(slider->getPercent()); + _sliderEventListener = slider->_sliderEventListener; + _sliderEventSelector = slider->_sliderEventSelector; + _eventCallback = slider->_eventCallback; } } diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 479e2782ee..688ab9a80f 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -842,6 +842,9 @@ void TextField::copySpecialProperties(Widget *widget) setDetachWithIME(textField->getDetachWithIME()); setInsertText(textField->getInsertText()); setDeleteBackward(textField->getDeleteBackward()); + _eventCallback = textField->_eventCallback; + _textFieldEventListener = textField->_textFieldEventListener; + _textFieldEventSelector = textField->_textFieldEventSelector; } } diff --git a/cocos/ui/UIVideoPlayer.h b/cocos/ui/UIVideoPlayer.h index 5f30281b47..c6dd4b3b79 100644 --- a/cocos/ui/UIVideoPlayer.h +++ b/cocos/ui/UIVideoPlayer.h @@ -77,6 +77,9 @@ namespace experimental{ virtual void draw(Renderer *renderer, const Mat4& transform, bool transformUpdated) override; protected: + virtual cocos2d::ui::Widget* createCloneInstance() override; + virtual void copySpecialProperties(Widget* model) override; + VideoPlayer(); virtual ~VideoPlayer(); diff --git a/cocos/ui/UIVideoPlayerAndroid.cpp b/cocos/ui/UIVideoPlayerAndroid.cpp index c91afe3bf9..ae0b7d50d7 100644 --- a/cocos/ui/UIVideoPlayerAndroid.cpp +++ b/cocos/ui/UIVideoPlayerAndroid.cpp @@ -355,6 +355,28 @@ void VideoPlayer::onPlayEvent(VideoPlayer::EventType event) } } +cocos2d::ui::Widget* VideoPlayer::createCloneInstance() +{ + return VideoPlayer::create(); +} + +void VideoPlayer::copySpecialProperties(Widget *widget) +{ + VideoPlayer* videoPlayer = dynamic_cast(widget); + if (videoPlayer) + { + _isPlaying = videoPlayer->_isPlaying; + _fullScreenEnabled = videoPlayer->_fullScreenEnabled; + _fullScreenDirty = videoPlayer->_fullScreenDirty; + _videoURL = videoPlayer->_videoURL; + _keepAspectRatioEnabled = videoPlayer->_keepAspectRatioEnabled; + _videoSource = videoPlayer->_videoSource; + _videoPlayerIndex = videoPlayer->_videoPlayerIndex; + _eventCallback = videoPlayer->_eventCallback; + _videoView = videoPlayer->_videoView; + } +} + void executeVideoCallback(int index,int event) { auto it = s_allVideoPlayers.find(index); diff --git a/cocos/ui/UIVideoPlayerIOS.mm b/cocos/ui/UIVideoPlayerIOS.mm index dfc1c3021a..52ee49cb99 100644 --- a/cocos/ui/UIVideoPlayerIOS.mm +++ b/cocos/ui/UIVideoPlayerIOS.mm @@ -461,4 +461,26 @@ void VideoPlayer::onPlayEvent(VideoPlayer::EventType event) } } +cocos2d::ui::Widget* VideoPlayer::createCloneInstance() +{ + return VideoPlayer::create(); +} + +void VideoPlayer::copySpecialProperties(Widget *widget) +{ + VideoPlayer* videoPlayer = dynamic_cast(widget); + if (videoPlayer) + { + _isPlaying = videoPlayer->_isPlaying; + _fullScreenEnabled = videoPlayer->_fullScreenEnabled; + _fullScreenDirty = videoPlayer->_fullScreenDirty; + _videoURL = videoPlayer->_videoURL; + _keepAspectRatioEnabled = videoPlayer->_keepAspectRatioEnabled; + _videoSource = videoPlayer->_videoSource; + _videoPlayerIndex = videoPlayer->_videoPlayerIndex; + _eventCallback = videoPlayer->_eventCallback; + _videoView = videoPlayer->_videoView; + } +} + #endif diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 2af4888fde..22f8bdf741 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -925,7 +925,6 @@ void Widget::copyProperties(Widget *widget) _ignoreSize = widget->_ignoreSize; _size = widget->_size; _customSize = widget->_customSize; - copySpecialProperties(widget); _sizeType = widget->getSizeType(); _sizePercent = widget->_sizePercent; _positionType = widget->_positionType; @@ -941,6 +940,14 @@ void Widget::copyProperties(Widget *widget) setFlippedY(widget->isFlippedY()); setColor(widget->getColor()); setOpacity(widget->getOpacity()); + _touchEventCallback = widget->_touchEventCallback; + _touchEventListener = widget->_touchEventListener; + _touchEventSelector = widget->_touchEventSelector; + _focused = widget->_focused; + _focusEnabled = widget->_focusEnabled; + + copySpecialProperties(widget); + //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) diff --git a/templates/lua-template-runtime/cocos-project-template.json b/templates/lua-template-runtime/cocos-project-template.json index a6c20e1960..d6fd40c68d 100644 --- a/templates/lua-template-runtime/cocos-project-template.json +++ b/templates/lua-template-runtime/cocos-project-template.json @@ -40,6 +40,21 @@ "*.lua" ] }, + { + "from": "templates/lua-template-runtime/runtime/rtres", + "to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources/rtres", + "exclude": [] + }, + { + "from": "templates/lua-template-runtime/runtime/rtres", + "to": "runtime/ios/PrebuiltRuntimeLua.app/rtres", + "exclude": [] + }, + { + "from": "templates/lua-template-runtime/runtime/rtres", + "to": "runtime/win32/rtres", + "exclude": [] + }, { "from": "cocos/scripting/lua-bindings/script", "to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources", diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp index 1c518a5e4a..c8c3500d6a 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp @@ -149,11 +149,12 @@ public: string strip = getIPAddress(); char szIPAddress[512]={0}; - sprintf(szIPAddress, "LocalIP: %s",strip.c_str()); - auto IPlabel = Label::create(szIPAddress, "Arial", 36); + sprintf(szIPAddress, "IP: %s",strip.c_str()); + auto IPlabel = Label::create(szIPAddress, "Arial", 72); IPlabel->setAnchorPoint(Vec2(0,0)); - int spaceSize = 72; - IPlabel->setPosition( Point(VisibleRect::leftTop().x+spaceSize, VisibleRect::top().y -spaceSize) ); + int spaceSizex = 72; + int spaceSizey = 200; + IPlabel->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, VisibleRect::top().y -spaceSizey) ); addChild(IPlabel, 9999); string strShowMsg = "waiting for file transfer ..."; @@ -162,9 +163,9 @@ public: strShowMsg = "waiting for debugger to connect ..."; } - _labelUploadFile = Label::create(strShowMsg.c_str(), "Arial", 24); + _labelUploadFile = Label::create(strShowMsg.c_str(), "Arial", 36); _labelUploadFile->setAnchorPoint(Vec2(0,0)); - _labelUploadFile->setPosition( Point(VisibleRect::leftTop().x+spaceSize, IPlabel->getPositionY()-spaceSize) ); + _labelUploadFile->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, IPlabel->getPositionY()-spaceSizex) ); _labelUploadFile->setAlignment(TextHAlignment::LEFT); addChild(_labelUploadFile, 10000); diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index e0734cdb29..799e0326c9 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -128,6 +128,8 @@ C09BA7E718BC929700A85A3E /* WorkSpaceDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */; }; C09BA7E818BC929700A85A3E /* WorkSpaceDialogController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */; }; C09BA7EE18BCA49600A85A3E /* NSAppSheetAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */; }; + C0F9D4BC192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; }; + C0F9D4BD192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; }; D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6B061341803AC000077942B /* CoreMotion.framework */; }; F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; }; F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; }; @@ -394,6 +396,7 @@ C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WorkSpaceDialogController.mm; sourceTree = ""; }; C09BA7EC18BCA49600A85A3E /* NSAppSheetAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppSheetAdditions.h; sourceTree = ""; }; C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAppSheetAdditions.m; sourceTree = ""; }; + C0F9D4BB192F3E6A0066134A /* rtres */ = {isa = PBXFileReference; lastKnownFileType = folder; name = rtres; path = ../../../runtime/rtres; sourceTree = ""; }; D6B061341803AC000077942B /* 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; }; F293B3C815EB7BE500256477 /* HelloLua iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloLua iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; @@ -642,6 +645,7 @@ F293BC4615EB859D00256477 /* Resources */ = { isa = PBXGroup; children = ( + C0F9D4BB192F3E6A0066134A /* rtres */, C05D1C111923449100B808A4 /* config.json */, C03781B718BF655400FE4F13 /* res */, C03781B818BF655400FE4F13 /* src */, @@ -852,6 +856,7 @@ C08D5D5D18E567C6009071A4 /* ltn12.lua in Resources */, C03781EC18BF656A00FE4F13 /* luaoc.lua in Resources */, C07828F918B4D72E00BD2287 /* MainMenu.xib in Resources */, + C0F9D4BD192F3E6A0066134A /* rtres in Resources */, 5023817617EBBE3400990C9B /* Icon.icns in Resources */, C03781D218BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */, C08D5D5F18E567C6009071A4 /* mbox.lua in Resources */, @@ -894,6 +899,7 @@ C03781F118BF656A00FE4F13 /* StudioConstants.lua in Resources */, 5023811F17EBBCAC00990C9B /* Icon-152.png in Resources */, C03781D118BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */, + C0F9D4BC192F3E6A0066134A /* rtres in Resources */, 5023812017EBBCAC00990C9B /* Icon-57.png in Resources */, C03781CF18BF656A00FE4F13 /* AudioEngine.lua in Resources */, C03781B918BF655400FE4F13 /* res in Resources */, diff --git a/templates/lua-template-runtime/runtime/config.json b/templates/lua-template-runtime/runtime/config.json index 59412228bf..e0413f8008 100644 --- a/templates/lua-template-runtime/runtime/config.json +++ b/templates/lua-template-runtime/runtime/config.json @@ -1,6 +1,6 @@ { - "version":"v3-lua-runtime-1.1.1", - "zip_file_size":"20854899", + "version":"v3-lua-runtime-1.1.2", + "zip_file_size":"21402175", "repo_name":"cocos-runtime-bin", "repo_parent":"https://github.com/chukong/" }