Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3luaruntime

This commit is contained in:
cw 2014-05-23 16:38:03 +08:00
commit ca68a273e3
13 changed files with 77 additions and 2 deletions

View File

@ -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

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
const char* cocos2dVersion()
{
return "cocos2d-x 3.1rc0";
return "cocos2d-x 3.1";
}
NS_CC_END

View File

@ -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;
}
}

View File

@ -1515,6 +1515,8 @@ void Layout::copySpecialProperties(Widget *widget)
setLayoutType(layout->_layoutType);
setClippingEnabled(layout->_clippingEnabled);
setClippingType(layout->_clippingType);
_loopFocus = layout->_loopFocus;
_passFocusToChild = layout->_passFocusToChild;
}
}

View File

@ -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;
}
}

View File

@ -626,6 +626,9 @@ void PageView::copySpecialProperties(Widget *widget)
if (pageView)
{
Layout::copySpecialProperties(widget);
_eventCallback = pageView->_eventCallback;
_pageViewEventListener = pageView->_pageViewEventListener;
_pageViewEventSelector = pageView->_pageViewEventSelector;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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<VideoPlayer*>(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);

View File

@ -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<VideoPlayer*>(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

View File

@ -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<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)