From d7aa1312bac632a0dc62150a4f09637b2923f72f Mon Sep 17 00:00:00 2001 From: linchaogithub Date: Wed, 12 Mar 2014 15:36:09 +0800 Subject: [PATCH 01/35] [Jenkins] watchdog --- tools/jenkins-scripts/watchdog.py | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tools/jenkins-scripts/watchdog.py diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py new file mode 100644 index 0000000000..a54b766496 --- /dev/null +++ b/tools/jenkins-scripts/watchdog.py @@ -0,0 +1,47 @@ +import jenkinsapi +from jenkinsapi.jenkins import Jenkins +import sys +import time +import os + +def main(): + + J = Jenkins('http://115.28.134.83:8000','redmine','cocos2dx2013') + job = J['cocos-2dx-pull-request-build'] + duration = os.environ['duration'] + #Get the numerical ID of the last build. + buildnu = job.get_last_buildnumber() + build = job.get_last_build() + running = build.is_running() + print 'running:',running + + if not running: + return False + print "buildnumber:#",buildnu + nowtime = time.strftime('%M',time.localtime(time.time())) + #print 'nowtime:',nowtime + timeb = build.get_timestamp() + #print 'buildtime:',str(timeb)[14:16] + buildtime = int(str(timeb)[14:16]) + subtime = 0 + if int(nowtime) >= buildtime: + subtime = int(nowtime)-buildtime + else: + subtime = 60-buildtime+int(nowtime) + if subtime > duration: + #print 'subtime',subtime + build.stop() + + return(0) + + +# -------------- main -------------- +if __name__ == '__main__': + sys_ret = 0 + try: + sys_ret = main() + except: + traceback.print_exc() + sys_ret = 1 + finally: + sys.exit(sys_ret) From db68e1feed9ae02bd4b536a04a9b11bd32ed6153 Mon Sep 17 00:00:00 2001 From: linchaogithub Date: Wed, 12 Mar 2014 16:28:23 +0800 Subject: [PATCH 02/35] [jenkins] watchdog --- tools/jenkins-scripts/watchdog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py index a54b766496..30f25ba956 100644 --- a/tools/jenkins-scripts/watchdog.py +++ b/tools/jenkins-scripts/watchdog.py @@ -6,12 +6,14 @@ import os def main(): - J = Jenkins('http://115.28.134.83:8000','redmine','cocos2dx2013') + J = Jenkins('http://115.28.134.83:8000') job = J['cocos-2dx-pull-request-build'] duration = os.environ['duration'] #Get the numerical ID of the last build. buildnu = job.get_last_buildnumber() + #Get the last build build = job.get_last_build() + #Get the build running running = build.is_running() print 'running:',running From d1a84cd7e89c4a23f7e55e99854c720c2816820c Mon Sep 17 00:00:00 2001 From: linchaogithub Date: Wed, 12 Mar 2014 17:18:16 +0800 Subject: [PATCH 03/35] [Jenkins] watchdog --- tools/jenkins-scripts/watchdog.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py index 30f25ba956..5aebb128c1 100644 --- a/tools/jenkins-scripts/watchdog.py +++ b/tools/jenkins-scripts/watchdog.py @@ -5,8 +5,9 @@ import time import os def main(): - - J = Jenkins('http://115.28.134.83:8000') + username = os.environ['username'] + password = os.environ['password'] + J = Jenkins('http://115.28.134.83:8000',username,password) job = J['cocos-2dx-pull-request-build'] duration = os.environ['duration'] #Get the numerical ID of the last build. @@ -20,6 +21,7 @@ def main(): if not running: return False print "buildnumber:#",buildnu + #get nowtime nowtime = time.strftime('%M',time.localtime(time.time())) #print 'nowtime:',nowtime timeb = build.get_timestamp() From 9c9d2c24bf719e40f2b7b3e80acffc55bc385fe0 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 12 Mar 2014 21:40:58 +0800 Subject: [PATCH 04/35] EditBox:fixes clip the text width to fit to the text box on Android and IOS. --- .../GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 19 +++++++++---------- .../GUI/CCEditBox/CCEditBoxImplAndroid.h | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImplIOS.h | 4 ++-- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 17 +++++++---------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index d3c2ac4743..88900fa8a0 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -68,14 +68,16 @@ static const int CC_EDIT_BOX_PADDING = 5; bool EditBoxImplAndroid::initWithSize(const Size& size) { int fontSize = getFontSizeAccordingHeightJni(size.height-12); - _label = LabelTTF::create("", "", size.height-12); + _label = Label::create(); + _label->setFontSize(size.height-12); // align the text vertically center _label->setAnchorPoint(Point(0, 0.5f)); _label->setPosition(Point(CC_EDIT_BOX_PADDING, size.height / 2.0f)); _label->setColor(_colText); _editBox->addChild(_label); - _labelPlaceHolder = LabelTTF::create("", "", size.height-12); + _labelPlaceHolder = Label::create(); + _labelPlaceHolder->setFontSize(size.height-12); // align the text vertically center _labelPlaceHolder->setAnchorPoint(Point(0, 0.5f)); _labelPlaceHolder->setPosition(Point(CC_EDIT_BOX_PADDING, size.height / 2.0f)); @@ -178,15 +180,12 @@ void EditBoxImplAndroid::setText(const char* pText) _label->setString(strToShow.c_str()); // Clip the text width to fit to the text box - // FIXME: After re-implement LabelTTF by Label, '(g|s)etTextureRect' will not work, it's because LabelTTF is inherited from Node rather than Sprite now. - - // float fMaxWidth = _editSize.width - CC_EDIT_BOX_PADDING * 2; - // Rect clippingRect = _label->getTextureRect(); - // if(clippingRect.size.width > fMaxWidth) { - // clippingRect.size.width = fMaxWidth; - // _label->setTextureRect(clippingRect); - // } + float fMaxWidth = _editSize.width - CC_EDIT_BOX_PADDING * 2; + auto labelSize = _label->getContentSize(); + if(labelSize.width > fMaxWidth) { + _label->setDimensions(fMaxWidth,labelSize.height); + } } else { diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h index 5e4c7ebf51..69a1f3e1a6 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h @@ -84,8 +84,8 @@ public: virtual void closeKeyboard(); private: - LabelTTF* _label; - LabelTTF* _labelPlaceHolder; + Label* _label; + Label* _labelPlaceHolder; EditBox::InputMode _editBoxInputMode; EditBox::InputFlag _editBoxInputFlag; EditBox::KeyboardReturnType _keyboardReturnType; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index b64208f4d2..329d30c55a 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -123,8 +123,8 @@ private: void adjustTextFieldPosition(); void placeInactiveLabels(); - LabelTTF* _label; - LabelTTF* _labelPlaceHolder; + Label* _label; + Label* _labelPlaceHolder; Size _contentSize; Point _position; Point _anchorPoint; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 13002597df..d2ba95be02 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -327,13 +327,13 @@ void EditBoxImplIOS::initInactiveLabels(const Size& size) { const char* pDefaultFontName = [[_systemControl.textField.font fontName] UTF8String]; - _label = LabelTTF::create("", "", 0.0f); + _label = Label::create(); _label->setAnchorPoint(Point(0, 0.5f)); _label->setColor(Color3B::WHITE); _label->setVisible(false); _editBox->addChild(_label, kLabelZOrder); - _labelPlaceHolder = LabelTTF::create("", "", 0.0f); + _labelPlaceHolder = Label::create(); // align the text vertically center _labelPlaceHolder->setAnchorPoint(Point(0, 0.5f)); _labelPlaceHolder->setColor(Color3B::GRAY); @@ -362,14 +362,11 @@ void EditBoxImplIOS::setInactiveText(const char* pText) _label->setString(getText()); // Clip the text width to fit to the text box - // FIXME: After re-implement LabelTTF by Label, '(g|s)etTextureRect' will not work, it's because LabelTTF is inherited from Node rather than Sprite now. - // float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2; - // Rect clippingRect = _label->getTextureRect(); - // if(clippingRect.size.width > fMaxWidth) - // { - // clippingRect.size.width = fMaxWidth; - // _label->setTextureRect(clippingRect); - // } + float fMaxWidth = _editBox->getContentSize().width - CC_EDIT_BOX_PADDING * 2; + Size labelSize = _label->getContentSize(); + if(labelSize.width > fMaxWidth) { + _label->setDimensions(fMaxWidth,labelSize.height); + } } void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) From 9dcca7641ce35bb098044ee3f38057ba6ed8407b Mon Sep 17 00:00:00 2001 From: linchaogithub Date: Thu, 13 Mar 2014 11:16:21 +0800 Subject: [PATCH 05/35] [Jenkins] watchdog --- tools/jenkins-scripts/watchdog.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py index 5aebb128c1..fc34237e55 100644 --- a/tools/jenkins-scripts/watchdog.py +++ b/tools/jenkins-scripts/watchdog.py @@ -4,26 +4,24 @@ import sys import time import os -def main(): - username = os.environ['username'] - password = os.environ['password'] - J = Jenkins('http://115.28.134.83:8000',username,password) - job = J['cocos-2dx-pull-request-build'] +#check & kill dead buid +def build_time(_job): + #get build duration duration = os.environ['duration'] - #Get the numerical ID of the last build. - buildnu = job.get_last_buildnumber() - #Get the last build - build = job.get_last_build() - #Get the build running + #Get last build running + build = _job.get_last_build() running = build.is_running() - print 'running:',running - + print 'build_job:',_job,'running:',running if not running: return False + + #Get numerical ID of the last build. + buildnu = _job.get_last_buildnumber() print "buildnumber:#",buildnu #get nowtime nowtime = time.strftime('%M',time.localtime(time.time())) #print 'nowtime:',nowtime + #get build start time timeb = build.get_timestamp() #print 'buildtime:',str(timeb)[14:16] buildtime = int(str(timeb)[14:16]) @@ -34,8 +32,16 @@ def main(): subtime = 60-buildtime+int(nowtime) if subtime > duration: #print 'subtime',subtime + #kill dead buid build.stop() +def main(): + username = os.environ['username'] + password = os.environ['password'] + J = Jenkins('http://115.28.134.83:8000',username,password) + #get all jenkins jobs + for key,job in J.iteritems(): + build_time(job) return(0) @@ -49,3 +55,4 @@ if __name__ == '__main__': sys_ret = 1 finally: sys.exit(sys_ret) + From 347dd55f3dd9be7c86b77f3bed88066083518a9c Mon Sep 17 00:00:00 2001 From: linchaogithub Date: Thu, 13 Mar 2014 14:12:29 +0800 Subject: [PATCH 06/35] [jenkins-job-watchdog-threshold]replace[duration] --- tools/jenkins-scripts/watchdog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/jenkins-scripts/watchdog.py b/tools/jenkins-scripts/watchdog.py index fc34237e55..feff7a3731 100644 --- a/tools/jenkins-scripts/watchdog.py +++ b/tools/jenkins-scripts/watchdog.py @@ -6,8 +6,8 @@ import os #check & kill dead buid def build_time(_job): - #get build duration - duration = os.environ['duration'] + #get jenkins-job-watchdog-threshold + threshold = os.environ['jenkins-job-watchdog-threshold'] #Get last build running build = _job.get_last_build() running = build.is_running() @@ -30,7 +30,7 @@ def build_time(_job): subtime = int(nowtime)-buildtime else: subtime = 60-buildtime+int(nowtime) - if subtime > duration: + if subtime > threshold: #print 'subtime',subtime #kill dead buid build.stop() From 108928e1a7d656cf4cd918cb0b53ac50b9a4254b Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 13 Mar 2014 14:31:07 +0800 Subject: [PATCH 07/35] Update `bindings-generator` submodule and add auto-binding for the `RichText` --- tools/bindings-generator | 2 +- tools/tolua/cocos2dx_ui.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index cd30a5b87d..25a152fbc7 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit cd30a5b87d5c9b6fdbd57cdc5a9213bcb975f65b +Subproject commit 25a152fbc798464b85359010bbc666aed5bbc918 diff --git a/tools/tolua/cocos2dx_ui.ini b/tools/tolua/cocos2dx_ui.ini index 538a46cfb0..68e1978ca5 100644 --- a/tools/tolua/cocos2dx_ui.ini +++ b/tools/tolua/cocos2dx_ui.ini @@ -30,7 +30,7 @@ headers = %(cocosdir)s/cocos/ui/CocosGUI.h # 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 = Helper Widget Layer Layout RootWidget Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider Switch TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter +classes = Helper Widget Layer Layout RootWidget Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider Switch TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter Rich.* # 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 From a30ce6cfc5681126c56b4d51bbe55856a585ec22 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 13 Mar 2014 14:47:00 +0800 Subject: [PATCH 08/35] Update `bindings-generator` submodule --- tools/bindings-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 25a152fbc7..f2e408f1ce 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 25a152fbc798464b85359010bbc666aed5bbc918 +Subproject commit f2e408f1ce29df573b0ed6bbcc83cf9fd7a795d5 From b1becd3fae1f6aabb7e83539eac6feda89823440 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 06:51:53 +0000 Subject: [PATCH 09/35] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/RichElement.lua | 16 ++++++ .../auto/api/RichElementCustomNode.lua | 26 +++++++++ .../auto/api/RichElementImage.lua | 26 +++++++++ .../lua-bindings/auto/api/RichElementText.lua | 30 ++++++++++ .../lua-bindings/auto/api/RichText.lua | 57 +++++++++++++++++++ .../auto/api/lua_cocos2dx_ui_auto_api.lua | 25 ++++++++ .../auto/lua_cocos2dx_auto.cpp.REMOVED.git-id | 2 +- ...cocos2dx_extension_auto.cpp.REMOVED.git-id | 2 +- ...a_cocos2dx_physics_auto.cpp.REMOVED.git-id | 2 +- .../auto/lua_cocos2dx_spine_auto.cpp | 32 +++++------ ...ua_cocos2dx_studio_auto.cpp.REMOVED.git-id | 2 +- .../lua_cocos2dx_ui_auto.cpp.REMOVED.git-id | 2 +- .../auto/lua_cocos2dx_ui_auto.hpp | 26 +++++++++ 13 files changed, 227 insertions(+), 21 deletions(-) create mode 100644 cocos/scripting/lua-bindings/auto/api/RichElement.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/RichElementImage.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/RichElementText.lua create mode 100644 cocos/scripting/lua-bindings/auto/api/RichText.lua diff --git a/cocos/scripting/lua-bindings/auto/api/RichElement.lua b/cocos/scripting/lua-bindings/auto/api/RichElement.lua new file mode 100644 index 0000000000..34d4aec0a9 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichElement.lua @@ -0,0 +1,16 @@ + +-------------------------------- +-- @module RichElement +-------------------------------- +-- @function [parent=#RichElement] init +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#RichElement] RichElement +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua b/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua new file mode 100644 index 0000000000..99943ed0d3 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua @@ -0,0 +1,26 @@ + +-------------------------------- +-- @module RichElementCustomNode +-------------------------------- +-- @function [parent=#RichElementCustomNode] init +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #cc.Node node +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#RichElementCustomNode] create +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #cc.Node node +-- @return RichElementCustomNode#RichElementCustomNode ret (return value: ccui.RichElementCustomNode) + +-------------------------------- +-- @function [parent=#RichElementCustomNode] RichElementCustomNode +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua b/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua new file mode 100644 index 0000000000..202e67672a --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua @@ -0,0 +1,26 @@ + +-------------------------------- +-- @module RichElementImage +-------------------------------- +-- @function [parent=#RichElementImage] init +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #char char +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#RichElementImage] create +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #char char +-- @return RichElementImage#RichElementImage ret (return value: ccui.RichElementImage) + +-------------------------------- +-- @function [parent=#RichElementImage] RichElementImage +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementText.lua b/cocos/scripting/lua-bindings/auto/api/RichElementText.lua new file mode 100644 index 0000000000..5cf922dcf0 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichElementText.lua @@ -0,0 +1,30 @@ + +-------------------------------- +-- @module RichElementText +-------------------------------- +-- @function [parent=#RichElementText] init +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #char char +-- @param #char char +-- @param #float float +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @function [parent=#RichElementText] create +-- @param self +-- @param #int int +-- @param #color3B_table color3b +-- @param #unsigned char char +-- @param #char char +-- @param #char char +-- @param #float float +-- @return RichElementText#RichElementText ret (return value: ccui.RichElementText) + +-------------------------------- +-- @function [parent=#RichElementText] RichElementText +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/RichText.lua b/cocos/scripting/lua-bindings/auto/api/RichText.lua new file mode 100644 index 0000000000..6fadaad8ff --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/RichText.lua @@ -0,0 +1,57 @@ + +-------------------------------- +-- @module RichText +-------------------------------- +-- @function [parent=#RichText] insertElement +-- @param self +-- @param #ccui.RichElement richelement +-- @param #int int + +-------------------------------- +-- @function [parent=#RichText] setAnchorPoint +-- @param self +-- @param #point_table point + +-------------------------------- +-- @function [parent=#RichText] pushBackElement +-- @param self +-- @param #ccui.RichElement richelement + +-------------------------------- +-- @function [parent=#RichText] formatText +-- @param self + +-------------------------------- +-- @function [parent=#RichText] ignoreContentAdaptWithSize +-- @param self +-- @param #bool bool + +-------------------------------- +-- @function [parent=#RichText] setVerticalSpace +-- @param self +-- @param #float float + +-------------------------------- +-- @function [parent=#RichText] getContentSize +-- @param self +-- @return size_table#size_table ret (return value: size_table) + +-------------------------------- +-- overload function: removeElement(ccui.RichElement) +-- +-- overload function: removeElement(int) +-- +-- @function [parent=#RichText] removeElement +-- @param self +-- @param #int int + +-------------------------------- +-- @function [parent=#RichText] create +-- @param self +-- @return RichText#RichText ret (return value: ccui.RichText) + +-------------------------------- +-- @function [parent=#RichText] RichText +-- @param self + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua index 918cb1f330..022d2f7187 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_ui_auto_api.lua @@ -91,4 +91,29 @@ -- @field [parent=#ccui] Helper#Helper Helper preloaded module +-------------------------------------------------------- +-- the ccui RichElement +-- @field [parent=#ccui] RichElement#RichElement RichElement preloaded module + + +-------------------------------------------------------- +-- the ccui RichElementText +-- @field [parent=#ccui] RichElementText#RichElementText RichElementText preloaded module + + +-------------------------------------------------------- +-- the ccui RichElementImage +-- @field [parent=#ccui] RichElementImage#RichElementImage RichElementImage preloaded module + + +-------------------------------------------------------- +-- the ccui RichElementCustomNode +-- @field [parent=#ccui] RichElementCustomNode#RichElementCustomNode RichElementCustomNode preloaded module + + +-------------------------------------------------------- +-- the ccui RichText +-- @field [parent=#ccui] RichText#RichText RichText preloaded module + + return nil diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id index a499b30375..033466eb38 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -b0dc5acd96b5d7e94c40c01097a6f969719a6110 \ No newline at end of file +44ccccc9572e8345c6b9903e8f10abcf0937d1cc \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp.REMOVED.git-id index 7d3b4412fd..99aa8077bc 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -337366fa551a6f02e7f44e832e351fad51895ca5 \ No newline at end of file +cb29285429f792ed191dc2135b5f80ca5e52e9d1 \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id index e59710c30d..133c03a49c 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -6deb0e9e9ec193559f4eaa0f48310265bc32a491 \ No newline at end of file +930a0d9f77202f6128d3c406b3da9e495debcccf \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp index 02abdfff42..e15f911b88 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp @@ -25,7 +25,7 @@ int lua_cocos2dx_spine_Skeleton_setToSetupPose(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setToSetupPose'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setToSetupPose'", nullptr); return 0; } #endif @@ -68,7 +68,7 @@ int lua_cocos2dx_spine_Skeleton_setBlendFunc(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBlendFunc'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBlendFunc'", nullptr); return 0; } #endif @@ -114,7 +114,7 @@ int lua_cocos2dx_spine_Skeleton_onDraw(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_onDraw'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_onDraw'", nullptr); return 0; } #endif @@ -163,7 +163,7 @@ int lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose'", nullptr); return 0; } #endif @@ -206,7 +206,7 @@ int lua_cocos2dx_spine_Skeleton_getBlendFunc(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_getBlendFunc'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_getBlendFunc'", nullptr); return 0; } #endif @@ -250,7 +250,7 @@ int lua_cocos2dx_spine_Skeleton_setSkin(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSkin'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSkin'", nullptr); return 0; } #endif @@ -297,7 +297,7 @@ int lua_cocos2dx_spine_Skeleton_setBonesToSetupPose(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBonesToSetupPose'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBonesToSetupPose'", nullptr); return 0; } #endif @@ -329,7 +329,7 @@ static int lua_cocos2dx_spine_Skeleton_finalize(lua_State* tolua_S) int lua_register_cocos2dx_spine_Skeleton(lua_State* tolua_S) { tolua_usertype(tolua_S,"sp.Skeleton"); - tolua_cclass(tolua_S,"Skeleton","sp.Skeleton","cc.Node",NULL); + tolua_cclass(tolua_S,"Skeleton","sp.Skeleton","cc.Node",nullptr); tolua_beginmodule(tolua_S,"Skeleton"); tolua_function(tolua_S,"setToSetupPose",lua_cocos2dx_spine_Skeleton_setToSetupPose); @@ -366,7 +366,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_addAnimation(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_addAnimation'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_addAnimation'", nullptr); return 0; } #endif @@ -439,7 +439,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_getCurrent(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_getCurrent'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_getCurrent'", nullptr); return 0; } #endif @@ -494,7 +494,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_setMix(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setMix'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setMix'", nullptr); return 0; } #endif @@ -546,7 +546,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_setAnimation(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setAnimation'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setAnimation'", nullptr); return 0; } #endif @@ -599,7 +599,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_clearTracks(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_clearTracks'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_clearTracks'", nullptr); return 0; } #endif @@ -642,7 +642,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_clearTrack(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_clearTrack'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_clearTrack'", nullptr); return 0; } #endif @@ -695,7 +695,7 @@ int lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(lua_State* tolua_ #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent'", NULL); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent'", nullptr); return 0; } #endif @@ -739,7 +739,7 @@ static int lua_cocos2dx_spine_SkeletonAnimation_finalize(lua_State* tolua_S) int lua_register_cocos2dx_spine_SkeletonAnimation(lua_State* tolua_S) { tolua_usertype(tolua_S,"sp.SkeletonAnimation"); - tolua_cclass(tolua_S,"SkeletonAnimation","sp.SkeletonAnimation","sp.Skeleton",NULL); + tolua_cclass(tolua_S,"SkeletonAnimation","sp.SkeletonAnimation","sp.Skeleton",nullptr); tolua_beginmodule(tolua_S,"SkeletonAnimation"); tolua_function(tolua_S,"addAnimation",lua_cocos2dx_spine_SkeletonAnimation_addAnimation); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp.REMOVED.git-id index 548c0c9831..bcd5a80a5a 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -b1abe1fd74f3d67444e32b3a3a0cad5c86b4269a \ No newline at end of file +0a46232432ba108d165f69ca9435f3ae0e911a27 \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id index 46b602ad1b..104c65729e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -d0b810bd90f5639ba15e03fc5e083b762225a16d \ No newline at end of file +11bba6be0cebc89eb4c7195a61d021e51719468f \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 220c5d3f00..1e576402ce 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -328,6 +328,32 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + + + + + + + + + From 28f7603f8197a2babfb43eafa691829f124020a9 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 07:18:02 +0000 Subject: [PATCH 10/35] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index dc63ffbac6..d92bc84e3a 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -879acef60464ae6a0af99e8e5d809245f8cdbe56 \ No newline at end of file +725d085b1800d788b0a8cf1ec615d750573dce15 \ No newline at end of file From 747ca17386f8f38131f19eb35d7d12b0cdd63a67 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 13 Mar 2014 16:01:33 +0800 Subject: [PATCH 11/35] find correct path on windows --- setup.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f3feb4b830..3d09bb2282 100755 --- a/setup.py +++ b/setup.py @@ -271,7 +271,10 @@ class SetEnvVar(object): if not android_sdk_root: return False - android_path = os.path.join(android_sdk_root, 'tools/android') + if self._isWindows(): + android_path = os.path.join(android_sdk_root, 'tools/android.bat') + else: + android_path = os.path.join(android_sdk_root, 'tools/android') if os.path.isfile(android_path): return True else: @@ -281,7 +284,7 @@ class SetEnvVar(object): ant_path = '' if self._isWindows(): - ant_path = os.path.join(ant_root, 'ant.exe') + ant_path = os.path.join(ant_root, 'ant.bat') else: ant_path = os.path.join(ant_root, 'ant') From 17ba28de2a6357b3a5ef7551ab78d853729d5811 Mon Sep 17 00:00:00 2001 From: qiaofeng00oo Date: Thu, 13 Mar 2014 16:29:47 +0800 Subject: [PATCH 12/35] add cocos-console-test.py to tools/jenkins-scripts/ --- tools/jenkins-scripts/cocos-console-test.py | 72 +++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 tools/jenkins-scripts/cocos-console-test.py diff --git a/tools/jenkins-scripts/cocos-console-test.py b/tools/jenkins-scripts/cocos-console-test.py new file mode 100755 index 0000000000..85c90f1229 --- /dev/null +++ b/tools/jenkins-scripts/cocos-console-test.py @@ -0,0 +1,72 @@ +#!/usr/bin/python +#create new project by cocos-console +#build new project and run + +import os +import sys + +project_types = ['cpp', 'lua'] +PROJ_SUFFIX = 'Proj' +phonePlats = ['mac','ios','android'] + +cocos_console_dir = 'tools/cocos2d-console/bin/' + +#now cocos2d-console suport different run on Platforms, e.g: only run android on win +runSupport = { + 'darwin' : [1, 1, 1], + 'win' : [0, 0, 1], + 'linux' : [0, 0, 1] +} + +curPlat = sys.platform +if curPlat.find('linux') >= 0: + curPlat = 'linux' +elif curPlat.find('darwin') >= 0: + curPlat = 'darwin' +else: + curPlat = 'win' +print 'current platform is:', curPlat + +def clean_project(): + for proj in project_types: + cmd = 'rm -rf '+proj+PROJ_SUFFIX + os.system(cmd) + +def create_project(): + print 'will create_project: ' + idx = 0 + for proj in project_types: + print 'proj: ', proj + cmd = './'+cocos_console_dir+'cocos new -l '+proj+' '+proj+PROJ_SUFFIX + print proj,'cmd:',cmd + idx += 1 + info_create = os.system(cmd) #call cmd on win is diff + print 'create project',proj,' is:', not info_create +def build_run(): + print 'will build and run' + for proj in project_types: + idx = 0 + for phone in phonePlats: + cmd = './'+cocos_console_dir+'cocos run -p '+phone+' -s '+proj+PROJ_SUFFIX + print proj,'cmd:',cmd + if runSupport[curPlat][idx]: + info_run = os.system(cmd) + print 'run project', proj, 'is:', not info_run + idx += 1 + +def main(): + clean_project() + create_project() + build_run() + +# -------------- main -------------- +if __name__ == '__main__': + sys_ret = 0 + try: + sys_ret = main() + except: + traceback.print_exc() + sys_ret = 1 + finally: + sys.exit(sys_ret) + From 3013bf2d6dd496d86983a3935927efa849d4ba97 Mon Sep 17 00:00:00 2001 From: qiaofeng00oo Date: Thu, 13 Mar 2014 17:05:10 +0800 Subject: [PATCH 14/35] modify cocos-console-test.py. --- tools/jenkins-scripts/cocos-console-test.py | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/jenkins-scripts/cocos-console-test.py b/tools/jenkins-scripts/cocos-console-test.py index 85c90f1229..2c67ab746d 100755 --- a/tools/jenkins-scripts/cocos-console-test.py +++ b/tools/jenkins-scripts/cocos-console-test.py @@ -18,6 +18,19 @@ runSupport = { 'linux' : [0, 0, 1] } +_argvs = sys.argv +print 'input argvs:', _argvs[1], _argvs[2] +_will_create = False +_will_run = False +if _argvs[1]=='create' || _argvs[2]=='create': + _will_create = True +if _argvs[1]=='run' || _argvs[2]=='run': + _will_create = True + _will_run = True +if _will_create == False and _will_run == False: + _will_create = True + _will_run = True + curPlat = sys.platform if curPlat.find('linux') >= 0: curPlat = 'linux' @@ -37,7 +50,7 @@ def create_project(): idx = 0 for proj in project_types: print 'proj: ', proj - cmd = './'+cocos_console_dir+'cocos new -l '+proj+' '+proj+PROJ_SUFFIX + cmd = 'cocos new -l '+proj+' '+proj+PROJ_SUFFIX print proj,'cmd:',cmd idx += 1 info_create = os.system(cmd) #call cmd on win is diff @@ -47,7 +60,7 @@ def build_run(): for proj in project_types: idx = 0 for phone in phonePlats: - cmd = './'+cocos_console_dir+'cocos run -p '+phone+' -s '+proj+PROJ_SUFFIX + cmd = 'cocos run -p '+phone+' -s '+proj+PROJ_SUFFIX print proj,'cmd:',cmd if runSupport[curPlat][idx]: info_run = os.system(cmd) @@ -55,9 +68,11 @@ def build_run(): idx += 1 def main(): - clean_project() - create_project() - build_run() + if _will_create: + clean_project() + create_project() + if _will_run: + build_run() # -------------- main -------------- if __name__ == '__main__': From ca56410427c323343f820191df01a9f2e54c45ab Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 13 Mar 2014 17:36:53 +0800 Subject: [PATCH 15/35] Rename `testlua` to `lua_tests` for luaTest android project --- .../src/org/cocos2dx/{testlua => lua_tests}/Cocos2dxActivity.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/lua-tests/project/proj.android/src/org/cocos2dx/{testlua => lua_tests}/Cocos2dxActivity.java (100%) diff --git a/tests/lua-tests/project/proj.android/src/org/cocos2dx/testlua/Cocos2dxActivity.java b/tests/lua-tests/project/proj.android/src/org/cocos2dx/lua_tests/Cocos2dxActivity.java similarity index 100% rename from tests/lua-tests/project/proj.android/src/org/cocos2dx/testlua/Cocos2dxActivity.java rename to tests/lua-tests/project/proj.android/src/org/cocos2dx/lua_tests/Cocos2dxActivity.java From bc68c6b62940672423396091b6802d2426a95983 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 13 Mar 2014 18:46:35 +0800 Subject: [PATCH 16/35] Refactor setter of label's font name and font size. --- cocos/2d/CCLabel.cpp | 258 ++++++++++++++++++++++--------------------- cocos/2d/CCLabel.h | 10 +- 2 files changed, 139 insertions(+), 129 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 574a3f33ec..1f2ced4179 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -208,15 +208,15 @@ bool Label::setCharMap(const std::string& plistFile) FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(plistFile); if (!newAtlas) - return false; - - if (initWithFontAtlas(newAtlas)) { - _currentLabelType = LabelType::CHARMAP; - return true; + reset(); + return false; } - return false; + initWithFontAtlas(newAtlas); + _currentLabelType = LabelType::CHARMAP; + + return true; } bool Label::setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap) @@ -224,15 +224,15 @@ bool Label::setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int st FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(texture,itemWidth,itemHeight,startCharMap); if (!newAtlas) - return false; - - if (initWithFontAtlas(newAtlas)) { - _currentLabelType = LabelType::CHARMAP; - return true; + reset(); + return false; } - return false; + initWithFontAtlas(newAtlas); + _currentLabelType = LabelType::CHARMAP; + + return true; } bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) @@ -240,15 +240,15 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(charMapFile,itemWidth,itemHeight,startCharMap); if (!newAtlas) - return false; - - if (initWithFontAtlas(newAtlas)) { - _currentLabelType = LabelType::CHARMAP; - return true; + reset(); + return false; } - return false; + initWithFontAtlas(newAtlas); + _currentLabelType = LabelType::CHARMAP; + + return true; } Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, @@ -274,17 +274,10 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te , _currNumLines(-1) , _textSprite(nullptr) , _contentDirty(false) -, _currentLabelType(LabelType::STRING_TEXTURE) -, _currLabelEffect(LabelEffect::NORMAL) -, _shadowBlurRadius(0) { _cascadeColorEnabled = true; - _batchNodes.push_back(this); - - _fontDefinition._fontName = "Helvetica"; - _fontDefinition._fontSize = 12; - _fontDefinition._alignment = TextHAlignment::LEFT; - _fontDefinition._vertAlignment = TextVAlignment::TOP; + + reset(); } Label::~Label() @@ -301,25 +294,37 @@ Label::~Label() CC_SAFE_RELEASE_NULL(_reusedLetter); } -bool Label::init() -{ - bool ret = true; - if(_fontAtlas) - { - ret = SpriteBatchNode::initWithTexture(_fontAtlas->getTexture(0), 30); - if (_reusedLetter == nullptr) - { - _reusedLetter = Sprite::createWithTexture(_fontAtlas->getTexture(0)); - _reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB); - _reusedLetter->retain(); - _reusedLetter->setAnchorPoint(Point::ANCHOR_TOP_LEFT); - _reusedLetter->setBatchNode(this); - } - } - _currLabelEffect = LabelEffect::NORMAL; - initProgram(); +void Label::reset() +{ + TTFConfig temp; + _fontConfig = temp; - return ret; + _fontDefinition._fontName = "Helvetica"; + _fontDefinition._fontSize = 12; + _fontDefinition._alignment = _hAlignment; + _fontDefinition._vertAlignment = _vAlignment; + + _fontDirty = false; + _fontName = "Helvetica"; + _fontSize = 12; + + _batchNodes.clear(); + _batchNodes.push_back(this); + + if (_fontAtlas) + { + FontAtlasCache::releaseFontAtlas(_fontAtlas); + _fontAtlas = nullptr; + } + + _currentLabelType = LabelType::STRING_TEXTURE; + _currLabelEffect = LabelEffect::NORMAL; + _shadowBlurRadius = 0; + + Node::removeAllChildrenWithCleanup(true); + _textSprite = nullptr; + + CC_SAFE_RELEASE_NULL(_reusedLetter); } void Label::initProgram() @@ -351,30 +356,31 @@ void Label::initProgram() bool Label::initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false */, bool useA8Shader /* = false */) { - FontAtlas *oldAtlas = _fontAtlas; - bool oldDistanceFieldEnable = _useDistanceField; - bool oldA8ShaderEnabel = _useA8Shader; + if (atlas == _fontAtlas) + { + FontAtlasCache::releaseFontAtlas(atlas); + return true; + } + + if (_fontAtlas) + { + FontAtlasCache::releaseFontAtlas(_fontAtlas); + _fontAtlas = nullptr; + } _fontAtlas = atlas; - _useDistanceField = distanceFieldEnabled; - _useA8Shader = useA8Shader; - - bool ret = Label::init(); - if (oldAtlas) + SpriteBatchNode::initWithTexture(_fontAtlas->getTexture(0), 30); + if (_reusedLetter == nullptr) { - if (ret) - { - FontAtlasCache::releaseFontAtlas(oldAtlas); - } - else - { - _fontAtlas = oldAtlas; - _useDistanceField = oldDistanceFieldEnable; - _useA8Shader = oldA8ShaderEnabel; - Label::init(); - - FontAtlasCache::releaseFontAtlas(atlas); - } + _reusedLetter = Sprite::createWithTexture(_fontAtlas->getTexture(0)); + _reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB); + _reusedLetter->retain(); + _reusedLetter->setAnchorPoint(Point::ANCHOR_TOP_LEFT); + _reusedLetter->setBatchNode(this); + } + else + { + _reusedLetter->setTexture(_fontAtlas->getTexture(0)); } if (_fontAtlas) @@ -382,8 +388,12 @@ bool Label::initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = fa _commonLineHeight = _fontAtlas->getCommonLineHeight(); _contentDirty = true; } + _useDistanceField = distanceFieldEnabled; + _useA8Shader = useA8Shader; + _currLabelEffect = LabelEffect::NORMAL; + initProgram(); - return ret; + return true; } bool Label::setTTFConfig(const TTFConfig& ttfConfig) @@ -391,30 +401,30 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) FontAtlas *newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig); if (!newAtlas) + { + reset(); return false; + } - if (initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true)) + _fontConfig = ttfConfig; + if (_fontConfig.outlineSize > 0) { - _fontConfig = ttfConfig; - if (ttfConfig.outlineSize > 0) - { - _fontConfig.distanceFieldEnabled = false; - _useDistanceField = false; - _useA8Shader = false; - _currLabelEffect = LabelEffect::OUTLINE; - initProgram(); - } - else if(ttfConfig.distanceFieldEnabled) - { - this->setFontScale(1.0f * ttfConfig.fontSize / DefultFontSize); - } - _currentLabelType = LabelType::TTF; - return true; + _fontConfig.distanceFieldEnabled = false; + _useDistanceField = false; + _useA8Shader = false; + _currLabelEffect = LabelEffect::OUTLINE; + initProgram(); } - else + else if(ttfConfig.distanceFieldEnabled) { - return false; + this->setFontScale(1.0f * ttfConfig.fontSize / DefultFontSize); } + + initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); + + _currentLabelType = LabelType::TTF; + + return true; } bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset /* = Point::ZERO */) @@ -422,21 +432,23 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& im FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset); if (!newAtlas) - return false; - - if (initWithFontAtlas(newAtlas)) { - _currentLabelType = LabelType::BMFONT; - return true; + reset(); + return false; } - return false; + initWithFontAtlas(newAtlas); + _currentLabelType = LabelType::BMFONT; + + return true; } void Label::setFontDefinition(const FontDefinition& textDefinition) { + reset(); _fontDefinition = textDefinition; - _currentLabelType = LabelType::STRING_TEXTURE; + _fontName = textDefinition._fontName; + _fontSize = textDefinition._fontSize; _contentDirty = true; } @@ -940,12 +952,30 @@ void Label::updateContent() _contentDirty = false; } +void Label::updateFont() +{ + if (_fontName.find('.') != _fontName.npos) + { + _fontConfig.fontFilePath = _fontName; + _fontConfig.fontSize = _fontSize; + setTTFConfig(_fontConfig); + } + _fontDefinition._fontName = _fontName; + _fontDefinition._fontSize = _fontSize; + _contentDirty = true; + _fontDirty = false; +} + void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) { if (! _visible || _originalUTF8String.empty()) { return; } + if (_fontDirty) + { + updateFont(); + } if (_contentDirty) { updateContent(); @@ -987,19 +1017,10 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent void Label::setFontName(const std::string& fontName) { - if (fontName.find('.') != fontName.npos) + if (fontName != _fontName) { - auto config = _fontConfig; - config.fontFilePath = fontName; - if (setTTFConfig(config)) - { - return; - } - } - if (_fontDefinition._fontName != fontName) - { - _fontDefinition._fontName = fontName; - _contentDirty = true; + _fontName = fontName; + _fontDirty = true; } } @@ -1016,29 +1037,10 @@ const std::string& Label::getFontName() const void Label::setFontSize(int fontSize) { - if (_currentLabelType == LabelType::TTF) + if (_fontSize != fontSize) { - if (_fontConfig.fontSize == fontSize) - { - return; - } - if (_fontConfig.distanceFieldEnabled) - { - _fontConfig.fontSize = fontSize; - this->setFontScale(1.0f * fontSize / DefultFontSize); - } - else - { - auto fontConfig = _fontConfig; - fontConfig.fontSize = fontSize; - setTTFConfig(fontConfig); - } - } - else if(_fontDefinition._fontSize != fontSize) - { - _fontDefinition._fontSize = fontSize; - _fontConfig.fontSize = fontSize; - _contentDirty = true; + _fontSize = fontSize; + _fontDirty = true; } } @@ -1204,6 +1206,10 @@ std::string Label::getDescription() const const Size& Label::getContentSize() const { + if (_fontDirty) + { + const_cast(this)->updateFont(); + } if (_contentDirty) { const_cast(this)->updateContent(); diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index cbfcacf985..4045438ee8 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -59,7 +59,7 @@ typedef struct _ttfConfig bool distanceFieldEnabled; int outlineSize; - _ttfConfig(const char* filePath = "",int size = 36, const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC, + _ttfConfig(const char* filePath = "",int size = 12, const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC, const char *customGlyphCollection = nullptr,bool useDistanceField = false,int outline = 0) :fontFilePath(filePath) ,fontSize(size) @@ -265,8 +265,6 @@ protected: bool recordPlaceholderInfo(int spriteIndex); void setFontScale(float fontScale); - - virtual bool init(); virtual void alignText(); @@ -285,8 +283,14 @@ protected: void createSpriteWithFontDefinition(); + void updateFont(); + void reset(); + bool _isOpacityModifyRGB; bool _contentDirty; + bool _fontDirty; + std::string _fontName; + int _fontSize; LabelType _currentLabelType; std::vector _batchNodes; From 3ce647268d77a2f546fa9cc693e2b8866a3383b0 Mon Sep 17 00:00:00 2001 From: lihex Date: Thu, 13 Mar 2014 19:35:55 +0800 Subject: [PATCH 17/35] update submodule --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index f52d834ee7..dd37c2f64d 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit f52d834ee7b4f412f7b972ef484a0e406ce6c1fd +Subproject commit dd37c2f64d6ba564feefd681d4d2a6ac0a596400 From c4e20dd63a0db5f92725b50788fdc9542b148ad9 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 13 Mar 2014 19:53:06 +0800 Subject: [PATCH 18/35] fix ease action error --- cocos/2d/CCTweenFunction.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/cocos/2d/CCTweenFunction.cpp b/cocos/2d/CCTweenFunction.cpp index 79a413dc9a..bb9bf4ccd3 100644 --- a/cocos/2d/CCTweenFunction.cpp +++ b/cocos/2d/CCTweenFunction.cpp @@ -121,13 +121,31 @@ float tweenTo(float time, TweenType type, float *easingParam) break; case Elastic_EaseIn: - delta = elasticEaseIn(time, easingParam[0]); + { + float period = 0.3f; + if (nullptr != easingParam) { + period = easingParam[0]; + } + delta = elasticEaseIn(time, period); + } break; case Elastic_EaseOut: - delta = elasticEaseOut(time, easingParam[0]); + { + float period = 0.3f; + if (nullptr != easingParam) { + period = easingParam[0]; + } + delta = elasticEaseOut(time, period); + } break; case Elastic_EaseInOut: - delta = elasticEaseInOut(time, easingParam[0]); + { + float period = 0.3f; + if (nullptr != easingParam) { + period = easingParam[0]; + } + delta = elasticEaseInOut(time, period); + } break; From 62d0fa8564f264ee6377f5fd957530eb7c76f40c Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 13 Mar 2014 20:52:33 +0800 Subject: [PATCH 22/35] label:rename some API for clearly. --- cocos/2d/CCFontAtlasCache.cpp | 2 +- cocos/2d/CCLabel.cpp | 32 +++++++++++++++----------------- cocos/2d/CCLabel.h | 6 +++--- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/cocos/2d/CCFontAtlasCache.cpp b/cocos/2d/CCFontAtlasCache.cpp index ab76eeb28a..60494a0222 100644 --- a/cocos/2d/CCFontAtlasCache.cpp +++ b/cocos/2d/CCFontAtlasCache.cpp @@ -46,7 +46,7 @@ FontAtlas * FontAtlasCache::getFontAtlasTTF(const TTFConfig & config) int fontSize = config.fontSize; if (useDistanceField) { - fontSize = Label::DefultFontSize; + fontSize = Label::DistanceFieldFontSize; } std::string atlasName = generateFontName(config.fontFilePath, fontSize, GlyphCollection::DYNAMIC, useDistanceField); diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 1f2ced4179..06b2e8f52e 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -36,7 +36,7 @@ NS_CC_BEGIN -const int Label::DefultFontSize = 50; +const int Label::DistanceFieldFontSize = 50; Label* Label::create() { @@ -213,7 +213,7 @@ bool Label::setCharMap(const std::string& plistFile) return false; } - initWithFontAtlas(newAtlas); + setFontAtlas(newAtlas); _currentLabelType = LabelType::CHARMAP; return true; @@ -229,7 +229,7 @@ bool Label::setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int st return false; } - initWithFontAtlas(newAtlas); + setFontAtlas(newAtlas); _currentLabelType = LabelType::CHARMAP; return true; @@ -245,7 +245,7 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe return false; } - initWithFontAtlas(newAtlas); + setFontAtlas(newAtlas); _currentLabelType = LabelType::CHARMAP; return true; @@ -327,7 +327,7 @@ void Label::reset() CC_SAFE_RELEASE_NULL(_reusedLetter); } -void Label::initProgram() +void Label::configureShaderProgram() { switch (_currLabelEffect) { @@ -354,12 +354,12 @@ void Label::initProgram() _uniformEffectColor = glGetUniformLocation(_shaderProgram->getProgram(), "v_effectColor"); } -bool Label::initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false */, bool useA8Shader /* = false */) +void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false */, bool useA8Shader /* = false */) { if (atlas == _fontAtlas) { FontAtlasCache::releaseFontAtlas(atlas); - return true; + return; } if (_fontAtlas) @@ -391,9 +391,7 @@ bool Label::initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = fa _useDistanceField = distanceFieldEnabled; _useA8Shader = useA8Shader; _currLabelEffect = LabelEffect::NORMAL; - initProgram(); - - return true; + configureShaderProgram(); } bool Label::setTTFConfig(const TTFConfig& ttfConfig) @@ -413,14 +411,14 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) _useDistanceField = false; _useA8Shader = false; _currLabelEffect = LabelEffect::OUTLINE; - initProgram(); + configureShaderProgram(); } else if(ttfConfig.distanceFieldEnabled) { - this->setFontScale(1.0f * ttfConfig.fontSize / DefultFontSize); + this->setFontScale(1.0f * ttfConfig.fontSize / DistanceFieldFontSize); } - initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); + setFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); _currentLabelType = LabelType::TTF; @@ -437,7 +435,7 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& im return false; } - initWithFontAtlas(newAtlas); + setFontAtlas(newAtlas); _currentLabelType = LabelType::BMFONT; return true; @@ -756,7 +754,7 @@ void Label::enableGlow(const Color3B& glowColor) return; _currLabelEffect = LabelEffect::GLOW; _effectColor = glowColor; - initProgram(); + configureShaderProgram(); } void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = 1 */) @@ -772,7 +770,7 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = 1 */) auto config = _fontConfig; config.outlineSize = outlineSize; setTTFConfig(config); - initProgram(); + configureShaderProgram(); } } _fontDefinition._stroke._strokeEnabled = true; @@ -809,7 +807,7 @@ void Label::disableEffect() setTTFConfig(_fontConfig); } _currLabelEffect = LabelEffect::NORMAL; - initProgram(); + configureShaderProgram(); _contentDirty = true; } diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 4045438ee8..d92745e366 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -78,7 +78,7 @@ typedef struct _ttfConfig class CC_DLL Label : public SpriteBatchNode, public LabelProtocol { public: - static const int DefultFontSize; + static const int DistanceFieldFontSize; static Label* create(); @@ -259,7 +259,7 @@ protected: */ virtual ~Label(); - virtual bool initWithFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false); + virtual void setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false); bool recordLetterInfo(const cocos2d::Point& point,const FontLetterDefinition& letterDef, int spriteIndex); bool recordPlaceholderInfo(int spriteIndex); @@ -277,7 +277,7 @@ protected: virtual void updateColor() override; - virtual void initProgram(); + virtual void configureShaderProgram(); void drawShadowWithoutBlur(); From b0b1645190dde5bd65bb64eb17d12009331f3002 Mon Sep 17 00:00:00 2001 From: boyu0 Date: Thu, 13 Mar 2014 20:56:51 +0800 Subject: [PATCH 23/35] fix some physics bugs. --- cocos/physics/CCPhysicsBody.h | 2 +- cocos/physics/CCPhysicsShape.cpp | 4 ++-- cocos/physics/CCPhysicsWorld.cpp | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cocos/physics/CCPhysicsBody.h b/cocos/physics/CCPhysicsBody.h index ea09a7f2f1..c8cbb1bd86 100644 --- a/cocos/physics/CCPhysicsBody.h +++ b/cocos/physics/CCPhysicsBody.h @@ -235,7 +235,7 @@ public: */ void setMoment(float moment); /** get the body moment of inertia. */ - inline float getMoment(float moment) const { return _moment; } + inline float getMoment() const { return _moment; } /** * @brief add moment of inertia to body. * if _moment(moment of the body) == PHYSICS_INFINITY, it remains. diff --git a/cocos/physics/CCPhysicsShape.cpp b/cocos/physics/CCPhysicsShape.cpp index 84098e4751..660cf1337d 100644 --- a/cocos/physics/CCPhysicsShape.cpp +++ b/cocos/physics/CCPhysicsShape.cpp @@ -504,8 +504,8 @@ void PhysicsShapeBox::getPoints(Point* points) const Size PhysicsShapeBox::getSize() const { cpShape* shape = _info->getShapes().front(); - return PhysicsHelper::cpv2size(cpv(cpvdist(cpPolyShapeGetVert(shape, 0), cpPolyShapeGetVert(shape, 1)), - cpvdist(cpPolyShapeGetVert(shape, 1), cpPolyShapeGetVert(shape, 2)))); + return PhysicsHelper::cpv2size(cpv(cpvdist(cpPolyShapeGetVert(shape, 1), cpPolyShapeGetVert(shape, 2)), + cpvdist(cpPolyShapeGetVert(shape, 0), cpPolyShapeGetVert(shape, 1)))); } // PhysicsShapePolygon diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index 50e773f525..4edf422f03 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -211,6 +211,11 @@ void PhysicsWorld::debugDraw() { PhysicsBody* body = dynamic_cast(obj); + if (!body->isEnabled()) + { + continue; + } + for (auto& shape : body->getShapes()) { _debugDraw->drawShape(*dynamic_cast(shape)); From fe6f485a6b526bbeeaade0270c8eefb4cea4392a Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 13 Mar 2014 21:00:36 +0800 Subject: [PATCH 24/35] label:rename some API for clearly. --- cocos/2d/CCLabel.cpp | 12 ++++++------ cocos/2d/CCLabel.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 06b2e8f52e..3cede4756a 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -327,7 +327,7 @@ void Label::reset() CC_SAFE_RELEASE_NULL(_reusedLetter); } -void Label::configureShaderProgram() +void Label::updateShaderProgram() { switch (_currLabelEffect) { @@ -391,7 +391,7 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false * _useDistanceField = distanceFieldEnabled; _useA8Shader = useA8Shader; _currLabelEffect = LabelEffect::NORMAL; - configureShaderProgram(); + updateShaderProgram(); } bool Label::setTTFConfig(const TTFConfig& ttfConfig) @@ -411,7 +411,7 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) _useDistanceField = false; _useA8Shader = false; _currLabelEffect = LabelEffect::OUTLINE; - configureShaderProgram(); + updateShaderProgram(); } else if(ttfConfig.distanceFieldEnabled) { @@ -754,7 +754,7 @@ void Label::enableGlow(const Color3B& glowColor) return; _currLabelEffect = LabelEffect::GLOW; _effectColor = glowColor; - configureShaderProgram(); + updateShaderProgram(); } void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = 1 */) @@ -770,7 +770,7 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = 1 */) auto config = _fontConfig; config.outlineSize = outlineSize; setTTFConfig(config); - configureShaderProgram(); + updateShaderProgram(); } } _fontDefinition._stroke._strokeEnabled = true; @@ -807,7 +807,7 @@ void Label::disableEffect() setTTFConfig(_fontConfig); } _currLabelEffect = LabelEffect::NORMAL; - configureShaderProgram(); + updateShaderProgram(); _contentDirty = true; } diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index d92745e366..89f7252d43 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -277,7 +277,7 @@ protected: virtual void updateColor() override; - virtual void configureShaderProgram(); + virtual void updateShaderProgram(); void drawShadowWithoutBlur(); From c9259bb800d6667642543bc4887e00f480a33f0b Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 13 Mar 2014 13:17:32 +0000 Subject: [PATCH 25/35] [AUTO]: updating luabinding automatically --- cocos/scripting/lua-bindings/auto/api/PhysicsBody.lua | 1 - .../auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/PhysicsBody.lua b/cocos/scripting/lua-bindings/auto/api/PhysicsBody.lua index f67992b694..a611fb7553 100644 --- a/cocos/scripting/lua-bindings/auto/api/PhysicsBody.lua +++ b/cocos/scripting/lua-bindings/auto/api/PhysicsBody.lua @@ -43,7 +43,6 @@ -------------------------------- -- @function [parent=#PhysicsBody] getMoment -- @param self --- @param #float float -- @return float#float ret (return value: float) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id index 133c03a49c..3a2dffca25 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -930a0d9f77202f6128d3c406b3da9e495debcccf \ No newline at end of file +6830e4b8f10511215bf059042bfd7eca7cc03679 \ No newline at end of file From ad514932c6058d4c29235ddb4e81c015cb25b226 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 13 Mar 2014 21:21:18 +0800 Subject: [PATCH 26/35] Update CHANGELOG [ci skip] --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index b224457f2d..519851ffa9 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -b8bc5839895bfc413816baa425d43a2b8e48205d \ No newline at end of file +0b50d2b1b4ed3b031417b663cca76662bdf97fc8 \ No newline at end of file From 28a71ff14ebb070bae249cca7044d53210274a88 Mon Sep 17 00:00:00 2001 From: lihex Date: Thu, 13 Mar 2014 22:11:38 +0800 Subject: [PATCH 28/35] update submodule --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index dd37c2f64d..223a7cd9fd 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit dd37c2f64d6ba564feefd681d4d2a6ac0a596400 +Subproject commit 223a7cd9fdf1d399ecb7b97346e2b5dea5f25331 From cea307bfb8f7b0c44594c67b76a03fd956cb013b Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 13 Mar 2014 22:16:38 +0800 Subject: [PATCH 29/35] EditBox:fixed nothing to display when input flag is PASSWORD on Android. --- extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 2 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 6 ++++-- extensions/GUI/CCEditBox/CCEditBoxImplWin.h | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 88900fa8a0..f46499e44c 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -169,7 +169,7 @@ void EditBoxImplAndroid::setText(const char* pText) long length = cc_utf8_strlen(_text.c_str(), -1); for (long i = 0; i < length; i++) { - strToShow.append("\u25CF"); + strToShow.append("*"); } } else diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index 4dcc885f49..b532285370 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -70,14 +70,16 @@ void EditBoxImplWin::doAnimationWhenKeyboardMove(float duration, float distance) bool EditBoxImplWin::initWithSize(const Size& size) { //! int fontSize = getFontSizeAccordingHeightJni(size.height-12); - _label = LabelTTF::create("", "", size.height-12); + _label = Label::create(); + _label->setFontSize(size.height-12); // align the text vertically center _label->setAnchorPoint(Point(0, 0.5f)); _label->setPosition(Point(5, size.height / 2.0f)); _label->setColor(_colText); _editBox->addChild(_label); - _labelPlaceHolder = LabelTTF::create("", "", size.height-12); + _labelPlaceHolder = Label::create(); + _labelPlaceHolder->setFontSize(size.height-12); // align the text vertically center _labelPlaceHolder->setAnchorPoint(Point(0, 0.5f)); _labelPlaceHolder->setPosition(Point(5, size.height / 2.0f)); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h index 2b379efe83..7c2a699dc8 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h @@ -84,8 +84,8 @@ public: virtual void onEnter(void); private: - LabelTTF* _label; - LabelTTF* _labelPlaceHolder; + Label* _label; + Label* _labelPlaceHolder; EditBox::InputMode _editBoxInputMode; EditBox::InputFlag _editBoxInputFlag; EditBox::KeyboardReturnType _keyboardReturnType; From bc4ceda242ba242b682ec2506313bae4e3937ea2 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 13 Mar 2014 23:12:55 +0800 Subject: [PATCH 30/35] set COCOS_CONSOLE_ROOT to path on windows --- setup.py | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 3d09bb2282..b39c0d5d88 100755 --- a/setup.py +++ b/setup.py @@ -87,19 +87,6 @@ class SetEnvVar(object): return file_to_write - def _update_system_variable(self, origin_content, target_content): - - is_updated = False - file = open(self.file_used_for_setup, 'a') - for line in fileinput.input(file_to_write, inplace=1): - if line.startswith(origin_content): - line = target_content - if_undated = True - sys.stdout.write(line) - - file.close() - return is_updated - def _find_string_in_file(self, string, file_path): with open(file_path) as f: for line in f: @@ -118,7 +105,9 @@ class SetEnvVar(object): 0, _winreg.KEY_SET_VALUE | _winreg.KEY_READ) _winreg.SetValueEx(env, key, 0, _winreg.REG_SZ, value) + _winreg.FlushKey(env) _winreg.CloseKey(env) + except Exception: if env: _winreg.CloseKey(env) @@ -293,6 +282,35 @@ class SetEnvVar(object): else: return False + def set_windows_path(self, cocos_consle_root): + import _winreg + try: + env = None + path = None + env = _winreg.OpenKeyEx(_winreg.HKEY_CURRENT_USER, + 'Environment', + 0, + _winreg.KEY_SET_VALUE | _winreg.KEY_READ) + path = _winreg.QueryValueEx(env, 'Path')[0] + path = path + ';' + cocos_consle_root + path.replace('/', '\\') + _winreg.SetValueEx(env, 'Path', 0, _winreg.REG_SZ, path) + _winreg.FlushKey(env) + _winreg.CloseKey(env) + + except Exception: + if not path: + path = cocos_consle_root.replace('/', '\\') + _winreg.SetValueEx(env, 'Path', 0, _winreg.REG_SZ, path) + _winreg.FlushKey(env) + else: + _winreg.SetValueEx(env, 'Path', 0, _winreg.REG_SZ, path) + _winreg.FlushKey(env) + if env: + _winreg.CloseKey(env) + return False + return True + def set_console_root(self): @@ -300,6 +318,8 @@ class SetEnvVar(object): print '-> Adding COCOS2D_CONSOLE_ROOT environment variable...', if not self._find_environment_variable(COCOS_CONSOLE_ROOT): cocos_consle_root = os.path.join(self.current_absolute_path, 'tools/cocos2d-console/bin') + if self._isWindows(): + self.set_windows_path(cocos_consle_root) if self._set_environment_variable(COCOS_CONSOLE_ROOT, cocos_consle_root): print 'OK' print ' -> Added: %s = %s' % (COCOS_CONSOLE_ROOT, cocos_consle_root) From 4aef65d4b71a4b8debd07d04e894f7d76282cf66 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 14 Mar 2014 09:48:48 +0800 Subject: [PATCH 31/35] =?UTF-8?q?fix=20the=20error=20that=20AssetManager?= =?UTF-8?q?=20test=20case=20can=E2=80=99t=20find=20correct=20resource=20pa?= =?UTF-8?q?th?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/lua-tests/src/AssetsManagerTest/AssetsManagerModule.lua | 2 +- tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/lua-tests/src/AssetsManagerTest/AssetsManagerModule.lua b/tests/lua-tests/src/AssetsManagerTest/AssetsManagerModule.lua index 0fbe58efca..85d57230b9 100644 --- a/tests/lua-tests/src/AssetsManagerTest/AssetsManagerModule.lua +++ b/tests/lua-tests/src/AssetsManagerTest/AssetsManagerModule.lua @@ -31,7 +31,7 @@ function AssetManagerModule.newScene(backfunc) helloLabel:setPosition(cc.p(winSize.width / 2, winSize.height - 40)) layer:addChild(helloLabel, 5) - local sprite = cc.Sprite:create("background.png") + local sprite = cc.Sprite:create("Images/background.png") sprite:setAnchorPoint(cc.p(0.5, 0.5)) sprite:setPosition(cc.p(winSize.width / 2, winSize.height / 2)) layer:addChild(sprite, 0) diff --git a/tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua b/tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua index eecbf1b83e..e0c1108ea7 100644 --- a/tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua +++ b/tests/lua-tests/src/AssetsManagerTest/AssetsManagerTest.lua @@ -100,7 +100,8 @@ local function updateLayer() local function enter(sender) if not isUpdateItemClicked then - addSearchPath(pathToSave,true) + local realPath = pathToSave .. "/package" + addSearchPath(realPath,true) end assetsManagerModule = reloadModule("src/AssetsManagerTest/AssetsManagerModule") From 36bfd6d2c2eb15902529092b58ca4fbef0e1881a Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 14 Mar 2014 09:51:39 +0800 Subject: [PATCH 32/35] label:fixed incorrect effect of outline. --- cocos/2d/CCLabel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 3cede4756a..061af3ea18 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -404,6 +404,8 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) return false; } + setFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); + _fontConfig = ttfConfig; if (_fontConfig.outlineSize > 0) { @@ -418,8 +420,6 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) this->setFontScale(1.0f * ttfConfig.fontSize / DistanceFieldFontSize); } - setFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); - _currentLabelType = LabelType::TTF; return true; From 82ddaa089bf19afdb3b582726ce64d60a306ed9f Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 14 Mar 2014 11:37:26 +0800 Subject: [PATCH 33/35] make description more readable --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b39c0d5d88..ad44542130 100755 --- a/setup.py +++ b/setup.py @@ -433,7 +433,7 @@ class SetEnvVar(object): print '\nCOCOS_CONSOLE_ROOT was already added. Edit "%s" for manual changes' % target if self._isWindows(): - print '\nPlease restart the terminal to make added system variables take effect' + print '\nPlease restart the terminal or restart computer to make added system variables take effect' else: print '\nPlease execute command: "source %s" to make added system variables take effect' % target @@ -441,7 +441,7 @@ if __name__ == '__main__': parser = OptionParser() parser.add_option('-n', '--ndkroot', dest='ndk_root', help='directory of ndk root') parser.add_option('-a', '--androidsdkroot', dest='android_sdk_root', help='directory of android sdk root') - parser.add_option('-t', '--antroot', dest='ant_root', help='directory of ant root') + parser.add_option('-t', '--antroot', dest='ant_root', help='directory that contains ant/ant.bat') opts, args = parser.parse_args() # set environment variables From 1dec4655253d0a203af23872d720f7a1480cf196 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 14 Mar 2014 11:38:23 +0800 Subject: [PATCH 34/35] update changelog --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index 519851ffa9..b1e1695c9b 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -0b50d2b1b4ed3b031417b663cca76662bdf97fc8 \ No newline at end of file +25c5be6d07f3ad8b7e96afbd2e2046d4691b9aa1 \ No newline at end of file From b893ca337858ba75be0bf818ff0d11b499850fbf Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 14 Mar 2014 12:52:24 +0800 Subject: [PATCH 35/35] Some fixes for android-build.py. --- build/android-build.py | 95 +++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/build/android-build.py b/build/android-build.py index b2fbc48a3c..1bdf09370a 100755 --- a/build/android-build.py +++ b/build/android-build.py @@ -1,6 +1,6 @@ #!/usr/bin/python # android-build.py -# Build android +# Build android import sys import os, os.path @@ -12,21 +12,21 @@ LUA_SAMPLES = ['lua-empty-test', 'lua-tests'] ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES def get_num_of_cpu(): - ''' The build process can be accelerated by running multiple concurrent job processes using the -j-option. - ''' - try: - platform = sys.platform - if platform == 'win32': - if 'NUMBER_OF_PROCESSORS' in os.environ: - return int(os.environ['NUMBER_OF_PROCESSORS']) - else: - return 1 - else: - from numpy.distutils import cpuinfo - return cpuinfo.cpu._getNCPUs() - except Exception: - print "Can't know cpuinfo, use default 1 cpu" - return 1 + ''' The build process can be accelerated by running multiple concurrent job processes using the -j-option. + ''' + try: + platform = sys.platform + if platform == 'win32': + if 'NUMBER_OF_PROCESSORS' in os.environ: + return int(os.environ['NUMBER_OF_PROCESSORS']) + else: + return 1 + else: + from numpy.distutils import cpuinfo + return cpuinfo.cpu._getNCPUs() + except Exception: + print "Can't know cpuinfo, use default 1 cpu" + return 1 def check_environment_variables(): ''' Checking the environment NDK_ROOT, which will be used for building @@ -39,7 +39,7 @@ def check_environment_variables(): sys.exit(1) return NDK_ROOT - + def check_environment_variables_sdk(): ''' Checking the environment ANDROID_SDK_ROOT, which will be used for building ''' @@ -74,7 +74,7 @@ def select_toolchain_version(): def caculate_built_samples(args): ''' Compute the sampels to be built 'cpp' for short of all cpp tests - 'lua' for short of all lua tests + 'lua' for short of all lua tests ''' if 'all' in args: @@ -115,17 +115,17 @@ def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param,sdk_root,an if os.system(command) != 0: 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") - 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!") - command = '%s update project -t %s -p %s -s' % (sdk_tool_path,android_platform,app_android_root) - if os.system(command) != 0: - raise Exception("update project [ " + app_android_root + " ] fails!") - buildfile_path = os.path.join(app_android_root, "build.xml") - command = 'ant clean %s -f %s -Dsdk.dir=%s' % (build_mode,buildfile_path,sdk_root) - os.system(command) + sdk_tool_path = os.path.join(sdk_root, "tools/android") + cocoslib_path = os.path.join(cocos_root, "cocos/2d/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!") + command = '%s update project -t %s -p %s -s' % (sdk_tool_path,android_platform,app_android_root) + if os.system(command) != 0: + raise Exception("update project [ " + app_android_root + " ] fails!") + buildfile_path = os.path.join(app_android_root, "build.xml") + command = 'ant clean %s -f %s -Dsdk.dir=%s' % (build_mode,buildfile_path,sdk_root) + os.system(command) def copy_files(src, dst): @@ -166,7 +166,7 @@ def copy_resources(target, app_android_root): assets_src_dir = os.path.join(assets_dir, "src"); os.mkdir(assets_src_dir) copy_files(resources_dir, assets_src_dir) - + resources_dir = os.path.join(app_android_root, "../../../../cocos/scripting/lua-bindings/script") copy_files(resources_dir, assets_dir) @@ -184,20 +184,20 @@ def build_samples(target,ndk_build_param,android_platform,build_mode): current_dir = os.path.dirname(os.path.realpath(__file__)) cocos_root = os.path.join(current_dir, "..") - + if android_platform is not None: - sdk_root = check_environment_variables_sdk() - if android_platform.isdigit(): - android_platform = 'android-'+android_platform - else: - print 'please use vaild android platform' - exit(1) - + sdk_root = check_environment_variables_sdk() + if android_platform.isdigit(): + android_platform = 'android-'+android_platform + else: + print 'please use vaild android platform' + exit(1) + if build_mode is None: - build_mode = 'debug' + build_mode = 'debug' elif build_mode != 'release': build_mode = 'debug' - + app_android_root = '' target_proj_path_map = { @@ -214,8 +214,8 @@ def build_samples(target,ndk_build_param,android_platform,build_mode): print 'unknown target: %s' % target continue - copy_resources(target, app_android_root) - do_build(cocos_root, ndk_root, app_android_root, ndk_build_param,sdk_root,android_platform,build_mode) + copy_resources(target, app_android_root) + do_build(cocos_root, ndk_root, app_android_root, ndk_build_param,sdk_root,android_platform,build_mode) # -------------- main -------------- if __name__ == '__main__': @@ -223,8 +223,8 @@ if __name__ == '__main__': #parse the params usage = """ This script is mainy used for building tests built-in with cocos2d-x. - - Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests] + + Usage: %prog [options] [cpp-empty-test|cpp-tests|lua-empty-test|lua-tests|cpp|lua|all] If you are new to cocos2d-x, I recommend you start with cpp-empty-test, lua-empty-test. @@ -237,16 +237,17 @@ if __name__ == '__main__': """ parser = OptionParser(usage=usage) - parser.add_option("-n", "--ndk", dest="ndk_build_param", + parser.add_option("-n", "--ndk", dest="ndk_build_param", help='Parameter for ndk-build') - parser.add_option("-p", "--platform", dest="android_platform", + parser.add_option("-p", "--platform", dest="android_platform", help='Parameter for android-update. Without the parameter,the script just build dynamic library for the projects. Valid android-platform are:[10|11|12|13|14|15|16|17|18|19]') - parser.add_option("-b", "--build", dest="build_mode", + parser.add_option("-b", "--build", dest="build_mode", help='The build mode for java project,debug[default] or release. Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html') (opts, args) = parser.parse_args() if len(args) == 0: parser.print_help() + sys.exit(1) else: try: build_samples(args, opts.ndk_build_param,opts.android_platform,opts.build_mode)