From e89a6c16512868973d22ce6f2f70e604232e1c8e Mon Sep 17 00:00:00 2001 From: anniruddh Date: Wed, 24 Jun 2015 17:50:11 -0700 Subject: [PATCH 01/32] fixed issue #160 --- cocos/audio/winrt/AudioCachePlayer.cpp | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/cocos/audio/winrt/AudioCachePlayer.cpp b/cocos/audio/winrt/AudioCachePlayer.cpp index d6dbbd3af5..9f2cdb2f5b 100644 --- a/cocos/audio/winrt/AudioCachePlayer.cpp +++ b/cocos/audio/winrt/AudioCachePlayer.cpp @@ -332,6 +332,9 @@ bool AudioPlayer::play2d(AudioCache* cache) _duration = getDuration(); ret = _play(); } + else { + error(); + } } return ret; @@ -342,6 +345,7 @@ void AudioPlayer::init() do { memset(&_xaBuffer, 0, sizeof(_xaBuffer)); if (FAILED(XAudio2Create(_xaEngine.ReleaseAndGetAddressOf()))) { + error(); break; } @@ -354,8 +358,10 @@ void AudioPlayer::init() _xaEngine->RegisterForCallbacks(this); if (FAILED(_xaEngine->CreateMasteringVoice(&_xaMasterVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, nullptr, nullptr, AudioCategory_GameMedia))) { + error(); break; } + _ready = true; _state = AudioPlayerState::READY; } while (false); @@ -363,10 +369,12 @@ void AudioPlayer::init() void AudioPlayer::free() { + _ready = false; _stop(); memset(&_xaBuffer, 0, sizeof(_xaBuffer)); if (_xaEngine) { + _xaEngine->UnregisterForCallbacks(this); _xaEngine->StopEngine(); } @@ -430,6 +438,7 @@ void AudioPlayer::error() _criticalError = true; _ready = false; _state = AudioPlayerState::ERRORED; + CCLOG("Audio system encountered error."); } void AudioPlayer::popBuffer() @@ -537,13 +546,15 @@ void AudioPlayer::OnProcessingPassEnd() void AudioPlayer::OnCriticalError(HRESULT err) { UNREFERENCED_PARAMETER(err); - error(); + if (_ready) { + error(); + } } // IXAudio2VoiceCallback void AudioPlayer::OnVoiceProcessingPassStart(UINT32 uBytesRequired) { - if (uBytesRequired && _isStreaming){ + if (_ready && uBytesRequired && _isStreaming){ submitBuffers(); } } @@ -554,7 +565,9 @@ void AudioPlayer::OnVoiceProcessingPassEnd() void AudioPlayer::OnStreamEnd() { - onBufferRunOut(); + if (_ready) { + onBufferRunOut(); + } } void AudioPlayer::OnBufferStart(void* pBufferContext) @@ -565,14 +578,16 @@ void AudioPlayer::OnBufferStart(void* pBufferContext) void AudioPlayer::OnBufferEnd(void* pBufferContext) { UNREFERENCED_PARAMETER(pBufferContext); - updateState(); + if (_ready) { + updateState(); + } } void AudioPlayer::OnLoopEnd(void* pBufferContext) { UNREFERENCED_PARAMETER(pBufferContext); - if (!_loop) { + if (_ready && !_loop) { _stop(); } } @@ -581,7 +596,9 @@ void AudioPlayer::OnVoiceError(void* pBufferContext, HRESULT err) { UNREFERENCED_PARAMETER(pBufferContext); UNREFERENCED_PARAMETER(err); - error(); + if (_ready) { + error(); + } } #endif From 2bb7b96839f4c414a43ae72b3eb1c25dc5b946f7 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 25 Jun 2015 10:17:31 +0800 Subject: [PATCH 02/32] add guard to audio engine pointer --- cocos/audio/linux/SimpleAudioEngineFMOD.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/audio/linux/SimpleAudioEngineFMOD.cpp b/cocos/audio/linux/SimpleAudioEngineFMOD.cpp index a72ad34d0e..26fd913abe 100644 --- a/cocos/audio/linux/SimpleAudioEngineFMOD.cpp +++ b/cocos/audio/linux/SimpleAudioEngineFMOD.cpp @@ -46,7 +46,10 @@ SimpleAudioEngine* SimpleAudioEngine::getInstance() { } void SimpleAudioEngine::end() { - oAudioPlayer->close(); + if(oAudioPlayer) + { + oAudioPlayer->close(); + } } ////////////////////////////////////////////////////////////////////////// From 3cb29bbc6502650f0b8bec31cbd8829c9aaeec56 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Thu, 25 Jun 2015 10:53:41 +0800 Subject: [PATCH 03/32] [ci skip]Fixed warns --- cocos/2d/CCAutoPolygon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCAutoPolygon.h b/cocos/2d/CCAutoPolygon.h index e20ac0b000..e94c92e286 100644 --- a/cocos/2d/CCAutoPolygon.h +++ b/cocos/2d/CCAutoPolygon.h @@ -41,7 +41,7 @@ NS_CC_BEGIN */ /** - * PolygonInfo is an object holding the required data to display Sprites。 + * PolygonInfo is an object holding the required data to display Sprites. * It can be a simple as a triangle, or as complex as a whole 3D mesh */ class CC_DLL PolygonInfo From 6a61f1de400b6085694009d3b78241f18de56bd2 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 25 Jun 2015 11:23:27 +0800 Subject: [PATCH 04/32] Solve the error in git-archive-all tools. --- tools/make-package/config.json | 4 ---- tools/make-package/git-archive-all | 38 ++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/tools/make-package/config.json b/tools/make-package/config.json index 61caceba9b..9d5b64509b 100644 --- a/tools/make-package/config.json +++ b/tools/make-package/config.json @@ -11,9 +11,5 @@ "zip_file_path": "../cocos2d-console", "extract_to_zip_path": "tools/cocos2d-console" } - ], - "extra_dirs": - [ - "tools/fbx-conv" ] } diff --git a/tools/make-package/git-archive-all b/tools/make-package/git-archive-all index 32b1c98260..82215a4e33 100755 --- a/tools/make-package/git-archive-all +++ b/tools/make-package/git-archive-all @@ -238,11 +238,22 @@ class GitArchiver(object): extra_folder_path = os.path.join(self.main_repo_abspath, extra_folder_name) extra_folders.append(extra_folder_path) extra_file_paths = self.unpack_zipfile(zip_file_path, self.main_repo_abspath) + + key_move_dirs = "move_dirs" for file_path in extra_file_paths: if file_path.find(extra_folder_path) == -1: raise Exception("Couldn't find extra folder path (%s) in (%s)!" % (extra_folder_path, file_path)) path_in_zip = extra_to_zip_file + file_path[(len(extra_folder_path)):] + if key_move_dirs in zip_config: + move_dirs = zip_config[key_move_dirs] + related_path = os.path.relpath(file_path, extra_folder_path) + temp_rel_path = related_path.replace('\\', '/') + for move_dir in move_dirs: + if temp_rel_path.startswith(move_dir): + move_to_dir = move_dirs[move_dir] + path_in_zip = os.path.join(move_to_dir, related_path) + break try: add(file_path, path_in_zip) @@ -250,19 +261,20 @@ class GitArchiver(object): print('add %s failed.' % file_path) pass - outfile_name, outfile_ext = path.splitext(output_path) - for extra_dir in config_data["extra_dirs"]: - dir_path = path.join(self.main_repo_abspath, extra_dir) - list_dirs = os.walk(dir_path) - for root,dirs,files in list_dirs: - for f in files: - file_path = path.join(root,f) - path_in_zip = file_path[(len(self.main_repo_abspath)+1):] - try: - add(file_path, path_in_zip) - except: - print('add %s failed.' % file_path) - pass + key_extra_dirs = "extra_dirs" + if key_extra_dirs in config_data: + for extra_dir in config_data[key_extra_dirs]: + dir_path = path.join(self.main_repo_abspath, extra_dir) + list_dirs = os.walk(dir_path) + for root,dirs,files in list_dirs: + for f in files: + file_path = path.join(root,f) + path_in_zip = file_path[(len(self.main_repo_abspath)+1):] + try: + add(file_path, path_in_zip) + except: + print('add %s failed.' % file_path) + pass if not dry_run: archive.close() From 444bddcccaf9f0629d0a7a5e3269222c1700c989 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 25 Jun 2015 13:36:42 +0800 Subject: [PATCH 05/32] Solve the error in framework-compile tools. --- tools/framework-compile/bin/utils_cocos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/framework-compile/bin/utils_cocos.py b/tools/framework-compile/bin/utils_cocos.py index c538de65d6..880b111b40 100755 --- a/tools/framework-compile/bin/utils_cocos.py +++ b/tools/framework-compile/bin/utils_cocos.py @@ -120,7 +120,7 @@ def get_vs_cmd_path(vs_version): def rmdir(folder): if os.path.exists(folder): if sys.platform == 'win32': - execute_command("rd /s/q %s" % folder) + execute_command("rd /s/q \"%s\"" % folder) else: shutil.rmtree(folder) From 63f948c822a817887e1aa923bdf45d0b83a5f225 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 25 Jun 2015 15:01:39 +0800 Subject: [PATCH 06/32] modify skybox to projection space --- cocos/3d/CCSkybox.cpp | 21 ++----------------- cocos/renderer/ccShader_3D_Skybox.vert | 6 ++++-- .../Classes/Sprite3DTest/Sprite3DTest.cpp | 2 -- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/cocos/3d/CCSkybox.cpp b/cocos/3d/CCSkybox.cpp index f40556afdb..97876b2c3e 100644 --- a/cocos/3d/CCSkybox.cpp +++ b/cocos/3d/CCSkybox.cpp @@ -176,12 +176,8 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags) Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f); state->setUniformVec4("u_color", color); - float scalf = (camera->getFarPlane() + camera->getNearPlane()) / 2; - state->setUniformFloat("u_scalef", scalf); - - GLboolean depthFlag = glIsEnabled(GL_DEPTH_TEST); - GLint depthFunc; - glGetIntegerv(GL_DEPTH_FUNC, &depthFunc); + cameraModelMat.m[12] = cameraModelMat.m[13] = cameraModelMat.m[14] = 0; + state->setUniformMat4("u_cameraRot", cameraModelMat); glEnable(GL_DEPTH_TEST); RenderState::StateBlock::_defaultState->setDepthTest(true); @@ -189,11 +185,6 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags) glDepthFunc(GL_LEQUAL); RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_LEQUAL); - - GLboolean cullFlag = glIsEnabled(GL_CULL_FACE); - GLint cullMode; - glGetIntegerv(GL_CULL_FACE_MODE, &cullMode); - glEnable(GL_CULL_FACE); RenderState::StateBlock::_defaultState->setCullFace(true); @@ -228,14 +219,6 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags) CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8); - glCullFace(cullMode); - if (!cullFlag) - glDisable(GL_CULL_FACE); - - glDepthFunc(depthFunc); - if (!depthFlag) - glDisable(GL_DEPTH_TEST); - CHECK_GL_ERROR_DEBUG(); } diff --git a/cocos/renderer/ccShader_3D_Skybox.vert b/cocos/renderer/ccShader_3D_Skybox.vert index b7b039810b..8f3caf208a 100644 --- a/cocos/renderer/ccShader_3D_Skybox.vert +++ b/cocos/renderer/ccShader_3D_Skybox.vert @@ -1,12 +1,14 @@ const char* cc3D_Skybox_vert = STRINGIFY( uniform float u_scalef; +uniform mat4 u_cameraRot; attribute vec3 a_position; varying vec3 v_reflect; void main(void) { - v_reflect = a_position; - gl_Position = CC_MVPMatrix * vec4(u_scalef * a_position, 1.0); + vec4 reflect = u_cameraRot * vec4(a_position, 1.0); + v_reflect = reflect.xyz; + gl_Position = vec4(a_position.xy, 1.0 , 1.0); } ); \ No newline at end of file diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 2289ca7234..ec1c3735aa 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -2469,8 +2469,6 @@ void Sprite3DCubeMapTest::addNewSpriteWithCoords(Vec2 p) _skyBox->setTexture(_textureCube); addChild(_skyBox); - - _skyBox->setScale(700.f); } addChild(_camera); From 13dbd44250062e5015d9860f1413cb7f69a61064 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 25 Jun 2015 15:05:21 +0800 Subject: [PATCH 07/32] remove unused variable --- cocos/renderer/ccShader_3D_Skybox.vert | 1 - 1 file changed, 1 deletion(-) diff --git a/cocos/renderer/ccShader_3D_Skybox.vert b/cocos/renderer/ccShader_3D_Skybox.vert index 8f3caf208a..a05a3c04a6 100644 --- a/cocos/renderer/ccShader_3D_Skybox.vert +++ b/cocos/renderer/ccShader_3D_Skybox.vert @@ -1,6 +1,5 @@ const char* cc3D_Skybox_vert = STRINGIFY( -uniform float u_scalef; uniform mat4 u_cameraRot; attribute vec3 a_position; varying vec3 v_reflect; From ad4f5b8ec0ac59df925fbbbf9c2890ab90a6bedd Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 25 Jun 2015 15:13:01 +0800 Subject: [PATCH 08/32] Fix the some lua tests case bug --- tests/lua-tests/src/LabelTestNew/LabelTestNew.lua | 8 +------- .../lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua | 6 +++--- tests/lua-tests/src/helper.lua | 1 + 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua b/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua index e61b88c6cd..4982f19902 100644 --- a/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua +++ b/tests/lua-tests/src/LabelTestNew/LabelTestNew.lua @@ -1242,15 +1242,9 @@ function LabelCharMapTest.create() local label2 = cc.Label:createWithCharMap("fonts/tuffy_bold_italic-charmap.plist") layer:addChild(label2, 0, kTagSprite2) label2:setAnchorPoint(cc.p(0, 0)) - label2:setPosition( cc.p(10,160) ) + label2:setPosition( cc.p(10,200) ) label2:setOpacity( 32 ) - local label3 = cc.Label:createWithCharMap("fonts/tuffy_bold_italic-charmap.plist")--32 means Space key - label3:setString("123 Test") - layer:addChild(label3, 0, kTagSprite3) - label3:setAnchorPoint(cc.p(0, 0)) - label3:setPosition(cc.p(10,220)) - local function step(dt) time = time + dt local info = string.format("%2.2f Test", time) diff --git a/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua b/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua index 3d30986394..c5d3362e17 100644 --- a/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua +++ b/tests/lua-tests/src/SpritePolygonTest/SpritePolygonTest.lua @@ -103,7 +103,7 @@ function SpritePolygonTest1:ctor() spp:setPosition(cc.p(s.width / 2 + offset.x, s.height / 2 + offset.y)) - sp = cc.Sprite:create(filename) + local sp = cc.Sprite:create(filename) self:addChild(sp) sp:setPosition(cc.p(s.width/2 - offset.x, s.height/2 - offset.y)) @@ -119,7 +119,7 @@ function SpritePolygonTest1:ctor() temp = "SpritePolygon:\nPixels drawn: " local vertCount = "\nverts:" .. info:getVertCount() - local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. info:getArea() .. vertCount) + local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. math.floor(info:getArea()) .. vertCount) spp:addChild(sppArea) sppArea:setAnchorPoint(cc.p(0, 1)) @@ -212,7 +212,7 @@ function SpritePolygonTest2:make2Sprites() temp = "SpritePolygon:\nPixels drawn: " local vertCount = "\nverts:" .. info:getVertCount() - local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. info:getArea() .. vertCount) + local sppArea = cc.Label:createWithTTF(ttfConfig, temp .. math.floor(info:getArea()) .. vertCount) self.spp:addChild(sppArea) sppArea:setAnchorPoint(cc.p(0, 1)) end diff --git a/tests/lua-tests/src/helper.lua b/tests/lua-tests/src/helper.lua index bf20656cf0..63eba2d289 100644 --- a/tests/lua-tests/src/helper.lua +++ b/tests/lua-tests/src/helper.lua @@ -113,6 +113,7 @@ local function MainMenuCallback() local scene = cc.Scene:create() scene:addChild(CreateTestMenu()) Helper.usePhysics = false + cc.Director:getInstance():setDepthTest(false) cc.Director:getInstance():replaceScene(scene) end From f4a81f0e5333bd7aecc91c18e898a06f47bbcace Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 25 Jun 2015 15:14:44 +0800 Subject: [PATCH 09/32] optimize draw --- cocos/3d/CCSkybox.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/cocos/3d/CCSkybox.cpp b/cocos/3d/CCSkybox.cpp index 97876b2c3e..e3bf4415ba 100644 --- a/cocos/3d/CCSkybox.cpp +++ b/cocos/3d/CCSkybox.cpp @@ -155,24 +155,10 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags) { auto camera = Camera::getVisitingCamera(); - /* - At beginning, we have a regular skybox at origin point. - To render the skybox, we should keep camera at the center of skybox. - So we need a translate matrix, which can transform origin point to camera pos. - Camera's node to word transform matrix don't match our requement, - because it maybe contain the scale, rotate, reflact... effects, which isn't need. - First, we transform origin point to camera position by camera's node to world matrix. - Second, we create a translate matrix with the origin point's world position. - */ - Vec3 cameraPosInNode(0, 0, 0); - Vec3 cameraPosInWorld; Mat4 cameraModelMat = camera->getNodeToWorldTransform(); - Mat4 trans = Mat4::IDENTITY; - cameraModelMat.transformPoint(cameraPosInNode, &cameraPosInWorld); - trans.translate(cameraPosInWorld); auto state = getGLProgramState(); - state->apply(trans); + state->apply(transform); Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f); state->setUniformVec4("u_color", color); From 7feaa18d82ee85e1b153cea2df85feb25b4c8b0b Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 25 Jun 2015 16:08:48 +0800 Subject: [PATCH 10/32] Fix the compile error for cpp-tests based on android studio --- tests/cpp-tests/proj.android-studio/app/jni/Android.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cpp-tests/proj.android-studio/app/jni/Android.mk b/tests/cpp-tests/proj.android-studio/app/jni/Android.mk index a0396a022c..6179bca134 100644 --- a/tests/cpp-tests/proj.android-studio/app/jni/Android.mk +++ b/tests/cpp-tests/proj.android-studio/app/jni/Android.mk @@ -202,7 +202,8 @@ LOCAL_SRC_FILES := main.cpp \ ../../../Classes/VisibleRect.cpp \ ../../../Classes/ZwoptexTest/ZwoptexTest.cpp \ ../../../Classes/controller.cpp \ -../../../Classes/testBasic.cpp +../../../Classes/testBasic.cpp \ +../../../Classes/NavMeshTest/NavMeshTest.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \ $(LOCAL_PATH)/../../../../.. From 0c1ee8b26a996f605b8f414c2c6a374cf8021909 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 25 Jun 2015 16:14:22 +0800 Subject: [PATCH 11/32] fix studio json reader percentage mode bug --- cocos/editor-support/cocostudio/CCSGUIReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index 5cda9f553d..34cc2ee17a 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -1412,7 +1412,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st } else { - if (dynamic_cast(widget)) + if (nullptr == dynamic_cast(widget)) { if (child->getPositionType() == ui::Widget::PositionType::PERCENT) { @@ -1504,7 +1504,7 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va } else { - if (dynamic_cast(widget)) + if (nullptr == dynamic_cast(widget)) { if (child->getPositionType() == ui::Widget::PositionType::PERCENT) { From d83f528327fa75f56f0e2d540e4dbd2c6e2fe1ab Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 25 Jun 2015 16:57:00 +0800 Subject: [PATCH 12/32] use inch for childFocusCancelOffset in UIScrollView --- cocos/ui/UIScrollView.cpp | 31 ++++++++++++++++++++++++++++--- cocos/ui/UIScrollView.h | 2 +- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 94668591a3..02578acda6 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -23,13 +23,23 @@ THE SOFTWARE. ****************************************************************************/ #include "ui/UIScrollView.h" +#include "platform/CCDevice.h" +#include "base/CCDirector.h" NS_CC_BEGIN namespace ui { +#define MOVE_INCH 7.0f/160.0f static const float AUTOSCROLLMAXSPEED = 1000.0f; +static float convertDistanceFromPointToInch(float pointDis) +{ + auto glview = Director::getInstance()->getOpenGLView(); + float factor = ( glview->getScaleX() + glview->getScaleY() ) / 2; + return pointDis * factor / Device::getDPI(); +} + const Vec2 SCROLLDIR_UP(0.0f, 1.0f); const Vec2 SCROLLDIR_DOWN(0.0f, -1.0f); const Vec2 SCROLLDIR_LEFT(-1.0f, 0.0f); @@ -56,7 +66,7 @@ _isAutoScrollSpeedAttenuated(false), _needCheckAutoScrollDestination(false), _bePressed(false), _slidTime(0.0f), -_childFocusCancelOffset(5.0f), +_childFocusCancelOffsetInInch(MOVE_INCH), _leftBounceNeeded(false), _topBounceNeeded(false), _rightBounceNeeded(false), @@ -1576,9 +1586,24 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende break; case TouchEventType::MOVED: { - float offset = (sender->getTouchBeganPosition() - touchPoint).getLength(); _touchMovePosition = touch->getLocation(); - if (offset > _childFocusCancelOffset) + // calculates move offset in points + float offset = 0; + switch (_direction) + { + case Direction::HORIZONTAL: + offset = fabs(sender->getTouchBeganPosition().x - touchPoint.x); + break; + case Direction::VERTICAL: + offset = fabs(sender->getTouchBeganPosition().y - touchPoint.y); + break; + case Direction::BOTH: + offset = (sender->getTouchBeganPosition() - touchPoint).getLength(); + break; + default: + break; + } + if (convertDistanceFromPointToInch(offset) > _childFocusCancelOffsetInInch) { sender->setHighlighted(false); handleMoveLogic(touch); diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 414153e25e..456e1bbcfa 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -491,7 +491,7 @@ protected: bool _bePressed; float _slidTime; Vec2 _moveChildPoint; - float _childFocusCancelOffset; + float _childFocusCancelOffsetInInch; bool _leftBounceNeeded; bool _topBounceNeeded; From b963b637019281ed302e1ffbe2d60918f63fd63f Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 25 Jun 2015 17:07:15 +0800 Subject: [PATCH 13/32] Update the branches info for the related travis scripts to v3.7 --- .travis.yml | 2 +- tools/travis-scripts/generate-bindings.sh | 2 +- tools/travis-scripts/generate-cocosfiles.sh | 2 +- tools/travis-scripts/travis_mac.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bccfbf9d6..2ab4eb079d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,4 +37,4 @@ before_install: # whitelist branches: only: - - v3 + - v3.7-release diff --git a/tools/travis-scripts/generate-bindings.sh b/tools/travis-scripts/generate-bindings.sh index 7c51476415..8e5d9a7b51 100755 --- a/tools/travis-scripts/generate-bindings.sh +++ b/tools/travis-scripts/generate-bindings.sh @@ -25,7 +25,7 @@ ELAPSEDSECS=`date +%s` COCOS_BRANCH="update_lua_bindings_$ELAPSEDSECS" COCOS_ROBOT_REMOTE="https://${GH_USER}:${GH_PASSWORD}@github.com/${GH_USER}/cocos2d-x.git" PULL_REQUEST_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls" -FETCH_REMOTE_BRANCH="v3" +FETCH_REMOTE_BRANCH="v3.7-release" LUA_COMMIT_PATH="cocos/scripting/lua-bindings/auto" JS_COMMIT_PATH="cocos/scripting/js-bindings/auto" diff --git a/tools/travis-scripts/generate-cocosfiles.sh b/tools/travis-scripts/generate-cocosfiles.sh index d946787499..1bfedb3cf0 100755 --- a/tools/travis-scripts/generate-cocosfiles.sh +++ b/tools/travis-scripts/generate-cocosfiles.sh @@ -6,7 +6,7 @@ PROJECT_ROOT="$DIR"/../.. COMMITTAG="[AUTO][ci skip]: updating cocos2dx_files.json" PUSH_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls" OUTPUT_FILE_PATH="${PROJECT_ROOT}/templates/cocos2dx_files.json" -FETCH_REMOTE_BRANCH="v3" +FETCH_REMOTE_BRANCH="v3.7-release" COMMIT_PATH="templates/cocos2dx_files.json" # Exit on error diff --git a/tools/travis-scripts/travis_mac.yml b/tools/travis-scripts/travis_mac.yml index d5ea1235f9..7c5913bb23 100644 --- a/tools/travis-scripts/travis_mac.yml +++ b/tools/travis-scripts/travis_mac.yml @@ -16,4 +16,4 @@ notifications: # whitelist branches: only: - - v3 + - v3.7-release From 3a654b4615c98f000b202579d218cbff04a980d1 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 25 Jun 2015 17:44:51 +0800 Subject: [PATCH 14/32] Fix the compile error of js-template by using android-studio compile param. --- cocos/ui/Android.mk | 4 ++++ extensions/Android.mk | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 316d8a51d1..d97fdda1b5 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -5,6 +5,10 @@ LOCAL_MODULE := cocos_ui_static LOCAL_MODULE_FILENAME := libui +ifeq ($(USE_ARM_MODE),1) +LOCAL_ARM_MODE := arm +endif + LOCAL_SRC_FILES := \ UIWidget.cpp \ UILayout.cpp \ diff --git a/extensions/Android.mk b/extensions/Android.mk index 90a1561c6f..0e5d7e2514 100644 --- a/extensions/Android.mk +++ b/extensions/Android.mk @@ -5,6 +5,10 @@ LOCAL_MODULE := cocos_extension_static LOCAL_MODULE_FILENAME := libextension +ifeq ($(USE_ARM_MODE),1) +LOCAL_ARM_MODE := arm +endif + LOCAL_SRC_FILES := \ assets-manager/AssetsManager.cpp \ assets-manager/Downloader.cpp \ From 8f7b439dfe0731bbca707a9e6a8d81c150048a5d Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 25 Jun 2015 18:06:45 +0800 Subject: [PATCH 15/32] add cocostudio 1.6 tests --- .../Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp index 631efa239a..7e62a31105 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp @@ -30,4 +30,5 @@ CocostudioParserTests::CocostudioParserTests() addTestCase("cocostudio 1.3", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.ExportJson"); }); addTestCase("cocostudio 1.4", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.ExportJson"); }); addTestCase("cocostudio 1.5", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.ExportJson"); }); + addTestCase("cocostudio 1.6", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_6/CocoStudio1.6Demo_1.ExportJson"); }); } From 7ca8542d756969a3de36327cac188c9af18dca62 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 25 Jun 2015 19:47:55 +0800 Subject: [PATCH 16/32] Optimize the implementation of auto-generating prebuilt mk files. --- .../framework-compile/bin/gen_prebuilt_mk.py | 136 +++++++++++++----- .../bin/template_binary_config.json | 4 + .../audio/android/prebuilt-mk/Android.mk | 28 ---- .../x-modified/cocos/prebuilt-mk/Android.mk | 86 ----------- .../proj.android/prebuilt-mk/Android.mk | 66 --------- .../proj.android/prebuilt-mk/Android.mk | 54 ------- 6 files changed, 107 insertions(+), 267 deletions(-) delete mode 100755 tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk delete mode 100755 tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk delete mode 100755 tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk delete mode 100755 tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk diff --git a/tools/framework-compile/bin/gen_prebuilt_mk.py b/tools/framework-compile/bin/gen_prebuilt_mk.py index cc1b7e5267..a2223c36fe 100755 --- a/tools/framework-compile/bin/gen_prebuilt_mk.py +++ b/tools/framework-compile/bin/gen_prebuilt_mk.py @@ -27,6 +27,10 @@ class MKGenerator(object): EXPORT_INCLUDE_PATTERN = r"^LOCAL_EXPORT_C_INCLUDES[ \t]+[\:\+]=[ \t]+(.+)" INCLUDE_MODULE_PATTERN = r"^\$\(call[ \t]*import-module,[ \t]*(.*)\)" + + KEY_IS_MODULE = 'is_module' + KEY_MODULE_LINES = 'lines' + def __init__(self, src_mk_path, lib_file_path, dst_mk_path=None): if os.path.isabs(src_mk_path): self.src_mk_path = src_mk_path @@ -53,11 +57,10 @@ class MKGenerator(object): from utils_cocos import win2unix win2unix(self.src_mk_path) - def get_lib_file_name(self): - src_mk_obj = open(self.src_mk_path) + def get_lib_file_name(self, lines): module_file_name = None module_name = None - for line in src_mk_obj.readlines(): + for line in lines: trim_line = line.lstrip(" ") trim_line = trim_line.rstrip(" ") match1 = re.match(MKGenerator.LIB_MODULE_FILENAME_PATTERN, trim_line) @@ -74,8 +77,6 @@ class MKGenerator(object): elif module_name is not None: ret = "lib%s.a" % module_name - src_mk_obj.close() - return ret def modidy_src_file(self, lines, new_src_file): @@ -83,9 +84,11 @@ class MKGenerator(object): src_file_begin_flag = False added = False + found_src_file_cfg = False for line in lines: trim_line = line.lstrip(" ") if re.match(MKGenerator.SRC_FILE_CFG_PATTERN, trim_line): + found_src_file_cfg = True if not added: new_lines.append("LOCAL_SRC_FILES := %s\n" % new_src_file) added = True @@ -97,7 +100,16 @@ class MKGenerator(object): else: new_lines.append(line) - return new_lines + if not found_src_file_cfg: + ret_lines = [] + for line in new_lines: + ret_lines.append(line) + if re.match(MKGenerator.LIB_MODULE_FILENAME_PATTERN, line): + ret_lines.append("LOCAL_SRC_FILES := %s\n" % new_src_file) + else: + ret_lines = new_lines + + return ret_lines def remove_config(self, lines, cfg_key): new_lines = [] @@ -160,13 +172,14 @@ class MKGenerator(object): new_path = "$(LOCAL_PATH)/%s/%s" % (rel_path, include_path) new_include_paths.append(new_path) - new_path_str = "LOCAL_EXPORT_C_INCLUDES := " - new_path_str += " \\\n".join(new_include_paths) - new_path_str += "\n" - if insert_idx >= 0: - new_lines.insert(insert_idx, new_path_str) - else: - new_lines.append(new_path_str) + if len(new_include_paths) > 0: + new_path_str = "LOCAL_EXPORT_C_INCLUDES := " + new_path_str += " \\\n".join(new_include_paths) + new_path_str += "\n" + if insert_idx >= 0: + new_lines.insert(insert_idx, new_path_str) + else: + new_lines.append(new_path_str) return new_lines @@ -217,13 +230,76 @@ class MKGenerator(object): new_line = line.replace("LOCAL_STATIC_LIBRARIES", "LOCAL_WHOLE_STATIC_LIBRARIES") new_lines.append(new_line) - return new_lines + ret_lines = [] + is_first_time = True + pattern = r'LOCAL_WHOLE_STATIC_LIBRARIES[ \t]*:=.*' + for line in new_lines: + ret_line = line + if re.match(pattern, line): + if is_first_time: + is_first_time = False + else: + ret_line = line.replace(":=", "+=") + + ret_lines.append(ret_line) + + return ret_lines + + def split_modules(self, origin_lines): + ret = [] + cur_module = {} + cur_module[MKGenerator.KEY_MODULE_LINES] = [] + cur_module[MKGenerator.KEY_IS_MODULE] = False + + pattern_begin = r'include[ \t]+\$\(CLEAR_VARS\)' + pattern_end = r'include[ \t]+\$\(BUILD_STATIC_LIBRARY\)' + for line in origin_lines: + if re.match(pattern_begin, line): + if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0: + ret.append(cur_module) + + cur_module = {} + cur_module[MKGenerator.KEY_MODULE_LINES] = [] + cur_module[MKGenerator.KEY_IS_MODULE] = True + + cur_module[MKGenerator.KEY_MODULE_LINES].append(line) + + if re.match(pattern_end, line): + if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0: + ret.append(cur_module) + cur_module = {} + cur_module[MKGenerator.KEY_MODULE_LINES] = [] + cur_module[MKGenerator.KEY_IS_MODULE] = False + + if len(cur_module[MKGenerator.KEY_MODULE_LINES]) > 0: + ret.append(cur_module) + + return ret + + def handle_module(self, module_lines, relative_path): + # modify the LOCAL_SRC_FILES + lib_file_name = self.get_lib_file_name(module_lines) + if lib_file_name is None: + raise Exception("The mk file %s not specify module name." % self.src_mk_path) + relative_path = "%s/$(TARGET_ARCH_ABI)/%s" % (relative_path, lib_file_name) + dst_lines = self.modidy_src_file(module_lines, relative_path) + + # remove the LOCAL_C_INCLUDES & LOCAL_LDLIBS + dst_lines = self.remove_config(dst_lines, "LOCAL_C_INCLUDES") + dst_lines = self.remove_config(dst_lines, "LOCAL_LDLIBS") + + # modify the LOCAL_EXPORT_C_INCLUDES + dst_lines = self.modify_export_c_include(dst_lines) + + # modify the line $(include BUILD_STATIC_LIBRARY) + dst_lines = self.modify_include_cfg(dst_lines) + + # use whole libs + dst_lines = self.use_whole_lib(dst_lines) + + return dst_lines def do_generate(self): - lib_file_name = self.get_lib_file_name() - if lib_file_name is None: - raise Exception("The mk file %s not specify module name.") - src_mk_obj = open(self.src_mk_path) # open the dst file @@ -236,30 +312,24 @@ class MKGenerator(object): dst_mk_obj = open(self.dst_mk_path, "w") relative_path = os.path.relpath(self.lib_file_path, os.path.dirname(self.dst_mk_path)) - relative_path = "%s/$(TARGET_ARCH_ABI)/%s" % (relative_path, lib_file_name) # read the src file src_lines = src_mk_obj.readlines() - # modify the LOCAL_SRC_FILES - dst_lines = self.modidy_src_file(src_lines, relative_path) + modules = self.split_modules(src_lines) + dst_lines = [] + for module in modules: + if module[MKGenerator.KEY_IS_MODULE]: + ret_lines = self.handle_module(module[MKGenerator.KEY_MODULE_LINES], relative_path) + else: + ret_lines = module[MKGenerator.KEY_MODULE_LINES] - # remove the LOCAL_C_INCLUDES & LOCAL_LDLIBS - dst_lines = self.remove_config(dst_lines, "LOCAL_C_INCLUDES") - dst_lines = self.remove_config(dst_lines, "LOCAL_LDLIBS") - - # modify the LOCAL_EXPORT_C_INCLUDES - dst_lines = self.modify_export_c_include(dst_lines) - - # modify the line $(include BUILD_STATIC_LIBRARY) - dst_lines = self.modify_include_cfg(dst_lines) + for l in ret_lines: + dst_lines.append(l) # modify the import-module dst_lines = self.modify_import_module(dst_lines) - # use whole libs - dst_lines = self.use_whole_lib(dst_lines) - dst_mk_obj.writelines(dst_lines) #close files diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index 31c7ce7ed6..98927b14d5 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -169,6 +169,10 @@ } ], "android_mks" : [ + "cocos/Android.mk", + "cocos/audio/android/Android.mk", + "cocos/scripting/js-bindings/proj.android/Android.mk", + "cocos/scripting/lua-bindings/proj.android/Android.mk", "cocos/storage/local-storage/Android.mk", "external/flatbuffers/Android.mk", "external/Box2D/Android.mk", diff --git a/tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk b/tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk deleted file mode 100755 index d1c0de6237..0000000000 --- a/tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk +++ /dev/null @@ -1,28 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := cocosdenshion_static - -LOCAL_MODULE_FILENAME := libcocosdenshion - -LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocosdenshion.a - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include - - -include $(PREBUILT_STATIC_LIBRARY) - -#new audio engine -include $(CLEAR_VARS) - -LOCAL_MODULE := audioengine_static - -LOCAL_MODULE_FILENAME := libaudioengine - -LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libaudioengine.a - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include - -LOCAL_EXPORT_LDLIBS := -lOpenSLES - -include $(PREBUILT_STATIC_LIBRARY) diff --git a/tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk b/tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk deleted file mode 100755 index 4b10f22afa..0000000000 --- a/tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk +++ /dev/null @@ -1,86 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2dx_internal_static - -LOCAL_MODULE_FILENAME := libcocos2dxinternal - -LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocos2dxinternal.a - - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \ -$(LOCAL_PATH)/../. \ -$(LOCAL_PATH)/../platform \ -$(LOCAL_PATH)/../base \ -$(LOCAL_PATH)/../../external \ -$(LOCAL_PATH)/../../external/tinyxml2 \ -$(LOCAL_PATH)/../../external/unzip \ -$(LOCAL_PATH)/../../external/chipmunk/include/chipmunk \ -$(LOCAL_PATH)/../../external/xxhash \ -$(LOCAL_PATH)/../../external/nslog - - -LOCAL_EXPORT_LDLIBS := -lGLESv2 \ - -llog \ - -landroid - -LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_png_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_tiff_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_webp_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_chipmunk_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_zlib_static - -LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static - -# define the macro to compile through support/zip_support/ioapi.c -LOCAL_CFLAGS := -DUSE_FILE32API -LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat -LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API -LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat - -include $(PREBUILT_STATIC_LIBRARY) - -#============================================================== - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2dx_static -LOCAL_MODULE_FILENAME := libcocos2d - -LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libcocos2d.a - -LOCAL_WHOLE_STATIC_LIBRARIES := cocostudio_static -LOCAL_WHOLE_STATIC_LIBRARIES += audioengine_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos3d_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static -LOCAL_WHOLE_STATIC_LIBRARIES += spine_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static - -include $(PREBUILT_STATIC_LIBRARY) - -#============================================================== -$(call import-module,freetype2/prebuilt/android) -$(call import-module, platform/android/prebuilt-mk) -$(call import-module,png/prebuilt/android) -$(call import-module,jpeg/prebuilt/android) -$(call import-module,tiff/prebuilt/android) -$(call import-module,webp/prebuilt/android) -$(call import-module,chipmunk/prebuilt/android) -$(call import-module, 3d/prebuilt-mk) -$(call import-module, audio/android/prebuilt-mk) -$(call import-module, editor-support/cocosbuilder/prebuilt-mk) -$(call import-module, editor-support/cocostudio/prebuilt-mk) -$(call import-module, editor-support/spine/prebuilt-mk) -$(call import-module, network/prebuilt-mk) -$(call import-module, ui/prebuilt-mk) -$(call import-module, extensions/prebuilt-mk) -$(call import-module, Box2D/prebuilt-mk) -$(call import-module,curl/prebuilt/android) -$(call import-module,websockets/prebuilt/android) -$(call import-module, flatbuffers/prebuilt-mk) -$(call import-module, zlib/prebuilt/android) - - diff --git a/tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk b/tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk deleted file mode 100755 index a532a9a883..0000000000 --- a/tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk +++ /dev/null @@ -1,66 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2d_js_android_static - -LOCAL_MODULE_FILENAME := libjscocos2dandroid - -LOCAL_SRC_FILES := __LIBS_DIR__/android/$(TARGET_ARCH_ABI)/libjscocos2dandroid.a - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. \ - $(LOCAL_PATH)/../manual \ - $(LOCAL_PATH)/../manual/platform/android \ - $(LOCAL_PATH)/../../../base \ - $(LOCAL_PATH)/../../../../external/chipmunk/include/chipmunk - -LOCAL_EXPORT_LDLIBS := -lGLESv2 \ - -llog \ - -landroid - -LOCAL_STATIC_LIBRARIES := spidermonkey_static - -include $(PREBUILT_STATIC_LIBRARY) - -#============================================================== - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2d_js_static - -LOCAL_MODULE_FILENAME := libjscocos2d - -LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libjscocos2d.a - - -LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT - -LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \ - $(LOCAL_PATH)/../auto \ - $(LOCAL_PATH)/../../../2d \ - $(LOCAL_PATH)/../../../base \ - $(LOCAL_PATH)/../../../ui \ - $(LOCAL_PATH)/../../../audio/include \ - $(LOCAL_PATH)/../../../storage \ - $(LOCAL_PATH)/../../../../extensions \ - $(LOCAL_PATH)/../../../editor-support/spine \ - $(LOCAL_PATH)/../../../editor-support/cocosbuilder \ - $(LOCAL_PATH)/../../../editor-support/cocostudio - - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../manual \ - $(LOCAL_PATH)/../../auto \ - $(LOCAL_PATH)/../../../../audio/include - -LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_js_android_static - -LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static -LOCAL_WHOLE_STATIC_LIBRARIES += cocos_localstorage_static - -include $(PREBUILT_STATIC_LIBRARY) - -$(call import-module,./prebuilt-mk) -$(call import-module,external/spidermonkey/prebuilt/android) -$(call import-module,storage/local-storage/prebuilt-mk) diff --git a/tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk b/tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk deleted file mode 100755 index f51b6f34a2..0000000000 --- a/tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk +++ /dev/null @@ -1,54 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2d_lua_android_static - -LOCAL_MODULE_FILENAME := libluacocos2dandroid - -LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libluacocos2dandroid.a - - -LOCAL_EXPORT_LDLIBS := -lGLESv2 \ - -llog \ - -landroid - -LOCAL_WHOLE_STATIC_LIBRARIES := luajit_static - -include $(PREBUILT_STATIC_LIBRARY) - -#============================================================== - -include $(CLEAR_VARS) - -LOCAL_MODULE := cocos2d_lua_static - -LOCAL_MODULE_FILENAME := libluacocos2d - -LOCAL_SRC_FILES := __LIBS_DIR__/prebuilt/android/$(TARGET_ARCH_ABI)/libluacocos2d.a - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../../external/lua/tolua \ -$(LOCAL_PATH)/../../../../../external/lua/luajit/include \ -$(LOCAL_PATH)/../../auto \ -$(LOCAL_PATH)/../../manual \ -$(LOCAL_PATH)/../../manual/cocos2d \ -$(LOCAL_PATH)/../../manual/3d \ -$(LOCAL_PATH)/../../manual/cocosdenshion \ -$(LOCAL_PATH)/../../manual/audioengine \ -$(LOCAL_PATH)/../../manual/network \ -$(LOCAL_PATH)/../../manual/cocosbuilder \ -$(LOCAL_PATH)/../../manual/cocostudio \ -$(LOCAL_PATH)/../../manual/spine \ -$(LOCAL_PATH)/../../manual/extension \ -$(LOCAL_PATH)/../../manual/ui \ -$(LOCAL_PATH)/../../../../../external/lua/quick \ -$(LOCAL_PATH)/../../../../.. - -LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_android_static - -LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static - -include $(PREBUILT_STATIC_LIBRARY) - -$(call import-module,lua/luajit/prebuilt/android) -$(call import-module, ./prebuilt-mk) From d508d2ecdd26c92eb94dc30dbbb10af967379793 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 25 Jun 2015 19:57:49 +0800 Subject: [PATCH 17/32] Solve the error when generating binary templates. --- .../bin/gen_cocos_binary_template.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_binary_template.py b/tools/framework-compile/bin/gen_cocos_binary_template.py index 3fcbd52b84..98b25db956 100755 --- a/tools/framework-compile/bin/gen_cocos_binary_template.py +++ b/tools/framework-compile/bin/gen_cocos_binary_template.py @@ -76,19 +76,6 @@ class CocosBinTemplateGenerator(object): tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path) tmp_obj.do_generate() - def process_file(sour, dest): - f = open(sour) - file_content = f.read() - f.close() - - file_content = file_content.replace("__LIBS_DIR__", self.lib_dir) - - f = open(os.path.join(dest, os.path.basename(sour)), "w") - f.write(file_content) - f.close() - - utils_cocos.copy_files_with_cb(os.path.join(self.cur_dir, os.path.pardir, "x-modified"), self.repo_x, process_file) - def getConfigJson(self): cfg_json_path = os.path.join(self.cur_dir, "template_binary_config.json") f = open(cfg_json_path) From 516d45db62a1f1391b4b8200130d30bae7d5a2ea Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 25 Jun 2015 20:16:43 +0800 Subject: [PATCH 18/32] update submodule --- .../Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp | 3 ++- tests/cpp-tests/Resources/ccs-res | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp index 7e62a31105..1fe1096a8f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp @@ -30,5 +30,6 @@ CocostudioParserTests::CocostudioParserTests() addTestCase("cocostudio 1.3", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.ExportJson"); }); addTestCase("cocostudio 1.4", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.ExportJson"); }); addTestCase("cocostudio 1.5", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.ExportJson"); }); - addTestCase("cocostudio 1.6", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_6/CocoStudio1.6Demo_1.ExportJson"); }); + addTestCase("cocostudio 1.6", [](){ return CocostudioParserJsonScene::create("cocosui/UIEditorTest/cocostudio1_6/CocoStudio1.6Demo_1.ExportJson"); }); + } diff --git a/tests/cpp-tests/Resources/ccs-res b/tests/cpp-tests/Resources/ccs-res index 65f45cef16..dc719c1676 160000 --- a/tests/cpp-tests/Resources/ccs-res +++ b/tests/cpp-tests/Resources/ccs-res @@ -1 +1 @@ -Subproject commit 65f45cef163bea7f25d20fe9ba77f6af871656c0 +Subproject commit dc719c167623d343cd5fdaaba867e9e1a26a24d3 From e29284374b2b7f020983caf7d3ba53a32a934f35 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 25 Jun 2015 20:57:23 +0800 Subject: [PATCH 19/32] Fix convertDistanceFromPointToInch logic --- cocos/ui/UIScrollView.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 02578acda6..fb790685d4 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -33,11 +33,12 @@ namespace ui { #define MOVE_INCH 7.0f/160.0f static const float AUTOSCROLLMAXSPEED = 1000.0f; -static float convertDistanceFromPointToInch(float pointDis) +static float convertDistanceFromPointToInch(Vec2 dis) { auto glview = Director::getInstance()->getOpenGLView(); - float factor = ( glview->getScaleX() + glview->getScaleY() ) / 2; - return pointDis * factor / Device::getDPI(); + int dpi = Device::getDPI(); + float distance = Vec2(dis * glview->getScaleX() / dpi, dis * glview->getScaleY() / dpi).getLength(); + return distance; } const Vec2 SCROLLDIR_UP(0.0f, 1.0f); @@ -1588,22 +1589,22 @@ void ScrollView::interceptTouchEvent(Widget::TouchEventType event, Widget *sende { _touchMovePosition = touch->getLocation(); // calculates move offset in points - float offset = 0; + float offsetInInch = 0; switch (_direction) { case Direction::HORIZONTAL: - offset = fabs(sender->getTouchBeganPosition().x - touchPoint.x); + offsetInInch = convertDistanceFromPointToInch(Vec2(fabs(sender->getTouchBeganPosition().x - touchPoint.x), 0)); break; case Direction::VERTICAL: - offset = fabs(sender->getTouchBeganPosition().y - touchPoint.y); + offsetInInch = convertDistanceFromPointToInch(Vec2(0, fabs(sender->getTouchBeganPosition().y - touchPoint.y))); break; case Direction::BOTH: - offset = (sender->getTouchBeganPosition() - touchPoint).getLength(); + offsetInInch = convertDistanceFromPointToInch(sender->getTouchBeganPosition() - touchPoint); break; default: break; } - if (convertDistanceFromPointToInch(offset) > _childFocusCancelOffsetInInch) + if (offsetInInch > _childFocusCancelOffsetInInch) { sender->setHighlighted(false); handleMoveLogic(touch); From 3136bef9e3105738329799e7ce3c9695cc40b535 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 25 Jun 2015 21:34:00 +0800 Subject: [PATCH 20/32] Fix convertDistanceFromPointToInch logic (add x, y) --- cocos/ui/UIScrollView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index fb790685d4..cd5777edc7 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -37,7 +37,7 @@ static float convertDistanceFromPointToInch(Vec2 dis) { auto glview = Director::getInstance()->getOpenGLView(); int dpi = Device::getDPI(); - float distance = Vec2(dis * glview->getScaleX() / dpi, dis * glview->getScaleY() / dpi).getLength(); + float distance = Vec2(dis.x * glview->getScaleX() / dpi, dis.y * glview->getScaleY() / dpi).getLength(); return distance; } From 1494f09f0631baf86372cf31ac9ddf2e0e0b3f10 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Thu, 25 Jun 2015 23:15:39 +0800 Subject: [PATCH 21/32] Remove unneeded include files and fixed warns. --- .../ActionManagerTest/ActionManagerTest.h | 1 - .../Classes/ActionsEaseTest/ActionsEaseTest.h | 2 -- .../ActionsProgressTest/ActionsProgressTest.h | 1 - .../cpp-tests/Classes/ActionsTest/ActionsTest.h | 1 - .../Classes/AllocatorTest/AllocatorTest.h | 1 - .../Classes/BillBoardTest/BillBoardTest.cpp | 2 +- .../Classes/BillBoardTest/BillBoardTest.h | 1 - .../CocosStudio3DTest/CocosStudio3DTest.h | 1 - .../ConfigurationTest/ConfigurationTest.h | 1 - .../MaterialSystemTest/MaterialSystemTest.cpp | 16 ++++++++-------- .../MaterialSystemTest/MaterialSystemTest.h | 1 - .../cpp-tests/Classes/NavMeshTest/NavMeshTest.h | 1 - .../Classes/Physics3DTest/Physics3DTest.h | 1 - .../RenderTextureTest/RenderTextureTest.cpp | 1 - tests/cpp-tests/Classes/ShaderTest/ShaderTest.h | 1 - tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h | 2 +- .../SpritePolygonTest/SpritePolygonTest.h | 1 - .../cpp-tests/Classes/TerrainTest/TerrainTest.h | 2 +- .../Classes/TextInputTest/TextInputTest.h | 1 - 19 files changed, 11 insertions(+), 27 deletions(-) diff --git a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.h b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.h index 574af60526..0c1183bf32 100644 --- a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.h +++ b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.h @@ -1,7 +1,6 @@ #ifndef _ACTION_MANAGER_TEST_H_ #define _ACTION_MANAGER_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(ActionManagerTests); diff --git a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.h b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.h index 7123948e84..43010127a1 100644 --- a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.h +++ b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.h @@ -26,8 +26,6 @@ #ifndef _ACTIONS__EASE_TEST_H_ #define _ACTIONS__EASE_TEST_H_ -////----#include "cocos2d.h" -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(ActionsEaseTests); diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.h b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.h index 1818b957f1..f769537dac 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.h +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.h @@ -26,7 +26,6 @@ #ifndef _ACTIONS__PROGRESS_TEST_H_ #define _ACTIONS__PROGRESS_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(ActionsProgressTests); diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h index b5acaa5d07..16c05cc432 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h @@ -26,7 +26,6 @@ #ifndef _ActionsTest_H_ #define _ActionsTest_H_ -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(ActionsTests); diff --git a/tests/cpp-tests/Classes/AllocatorTest/AllocatorTest.h b/tests/cpp-tests/Classes/AllocatorTest/AllocatorTest.h index 75c54b80ae..50dc5c7aef 100644 --- a/tests/cpp-tests/Classes/AllocatorTest/AllocatorTest.h +++ b/tests/cpp-tests/Classes/AllocatorTest/AllocatorTest.h @@ -25,7 +25,6 @@ THE SOFTWARE. ****************************************************************************/ -#include "../testBasic.h" #include "../BaseTest.h" #include "base/allocator/CCAllocatorStrategyPool.h" diff --git a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp index f2defcfe69..21ccf5f301 100644 --- a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp +++ b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp @@ -74,7 +74,7 @@ BillBoardRotationTest::BillBoardRotationTest() root->runAction(rp); auto jump = JumpBy::create(1, Vec2(0, 0), 30, 1); - auto scale = ScaleBy::create(2, 2, 2, 0.1); + auto scale = ScaleBy::create(2.f, 2.f, 2.f, 0.1f); auto seq = Sequence::create(jump,scale, NULL); auto rot = RotateBy::create(2, Vec3(-90, 0, 0)); diff --git a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.h b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.h index 4ee680a251..478f3c5bb5 100644 --- a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.h +++ b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.h @@ -25,7 +25,6 @@ #ifndef _BILLBOARD_TEST_H_ #define _BILLBOARD_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" #include diff --git a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h index 1ce606a6cc..eb246abc1e 100644 --- a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h +++ b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h @@ -25,7 +25,6 @@ #ifndef _COCOSSTUDIO3D_TEST_H_ #define _COCOSSTUDIO3D_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" #include diff --git a/tests/cpp-tests/Classes/ConfigurationTest/ConfigurationTest.h b/tests/cpp-tests/Classes/ConfigurationTest/ConfigurationTest.h index ec7f618689..7410a50645 100644 --- a/tests/cpp-tests/Classes/ConfigurationTest/ConfigurationTest.h +++ b/tests/cpp-tests/Classes/ConfigurationTest/ConfigurationTest.h @@ -1,7 +1,6 @@ #ifndef __CONFIGURATIONTEST_H__ #define __CONFIGURATIONTEST_H__ -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(ConfigurationTests); diff --git a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp index 41348974fc..87cbe8043b 100644 --- a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp +++ b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp @@ -220,22 +220,22 @@ void Material_AutoBindings::onEnter() Material *mat1 = Material::createWithProperties(properties); auto spriteBlur = Sprite::create("Images/grossini.png"); - spriteBlur->setNormalizedPosition(Vec2(0.2, 0.5)); + spriteBlur->setNormalizedPosition(Vec2(0.2f, 0.5f)); this->addChild(spriteBlur); spriteBlur->setGLProgramState(mat1->getTechniqueByName("blur")->getPassByIndex(0)->getGLProgramState()); auto spriteOutline = Sprite::create("Images/grossini.png"); - spriteOutline->setNormalizedPosition(Vec2(0.4, 0.5)); + spriteOutline->setNormalizedPosition(Vec2(0.4f, 0.5f)); this->addChild(spriteOutline); spriteOutline->setGLProgramState(mat1->getTechniqueByName("outline")->getPassByIndex(0)->getGLProgramState()); auto spriteNoise = Sprite::create("Images/grossini.png"); - spriteNoise->setNormalizedPosition(Vec2(0.6, 0.5)); + spriteNoise->setNormalizedPosition(Vec2(0.6f, 0.5f)); this->addChild(spriteNoise); spriteNoise->setGLProgramState(mat1->getTechniqueByName("noise")->getPassByIndex(0)->getGLProgramState()); auto spriteEdgeDetect = Sprite::create("Images/grossini.png"); - spriteEdgeDetect->setNormalizedPosition(Vec2(0.8, 0.5)); + spriteEdgeDetect->setNormalizedPosition(Vec2(0.8f, 0.5f)); this->addChild(spriteEdgeDetect); spriteEdgeDetect->setGLProgramState(mat1->getTechniqueByName("edge_detect")->getPassByIndex(0)->getGLProgramState()); @@ -396,7 +396,7 @@ void Material_invalidate::onEnter() sprite->setScale(5); sprite->setRotation3D(Vec3(0,180,0)); addChild(sprite); - sprite->setNormalizedPosition(Vec2(0.3,0.3)); + sprite->setNormalizedPosition(Vec2(0.3f,0.3f)); auto rotate = RotateBy::create(5, Vec3(0,360,0)); auto repeat = RepeatForever::create(rotate); @@ -408,7 +408,7 @@ void Material_invalidate::onEnter() skeletonNode->setSkin("goblin"); skeletonNode->setScale(0.25); - skeletonNode->setNormalizedPosition(Vec2(0.6,0.3)); + skeletonNode->setNormalizedPosition(Vec2(0.6f,0.3f)); this->addChild(skeletonNode); } @@ -465,7 +465,7 @@ void Material_renderState::onEnter() sprite->setScale(5); sprite->setRotation3D(Vec3(0,180,0)); addChild(sprite); - sprite->setNormalizedPosition(Vec2(0.3,0.3)); + sprite->setNormalizedPosition(Vec2(0.3f,0.3f)); auto rotate = RotateBy::create(5, Vec3(0,360,0)); auto repeat = RepeatForever::create(rotate); @@ -477,7 +477,7 @@ void Material_renderState::onEnter() skeletonNode->setSkin("goblin"); skeletonNode->setScale(0.25); - skeletonNode->setNormalizedPosition(Vec2(0.6,0.3)); + skeletonNode->setNormalizedPosition(Vec2(0.6f,0.3f)); this->addChild(skeletonNode); _stateBlock.setDepthTest(false); diff --git a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.h b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.h index 02a09afc00..4bf9403ee0 100644 --- a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.h +++ b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.h @@ -24,7 +24,6 @@ #pragma once -#include "../testBasic.h" #include "../BaseTest.h" DEFINE_TEST_SUITE(MaterialSystemTest); diff --git a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h index ceb0981aa0..146ca249ec 100644 --- a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h +++ b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h @@ -25,7 +25,6 @@ #ifndef _NAVMESH_TEST_H_ #define _NAVMESH_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" #include "navmesh/CCNavMesh.h" #include diff --git a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.h b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.h index 03c77a6ffd..10874eca49 100644 --- a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.h +++ b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.h @@ -25,7 +25,6 @@ #ifndef _PHYSICS3D_TEST_H_ #define _PHYSICS3D_TEST_H_ -#include "../testBasic.h" #include "../BaseTest.h" #include diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index 849044931f..5fd99c31e0 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -1,5 +1,4 @@ #include "RenderTextureTest.h" -#include "../testBasic.h" USING_NS_CC; using namespace cocos2d::ui; diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.h b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.h index a02451e83a..fd47bd65e0 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.h +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.h @@ -3,7 +3,6 @@ #include "ui/CocosGUI.h" -#include "../testBasic.h" #include "extensions/cocos-ext.h" #include "../BaseTest.h" diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h index 7144ba78f7..06bdb867c6 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h @@ -1,6 +1,6 @@ #ifndef _SHADER_TEST2_H_ #define _SHADER_TEST2_H_ -#include "../testBasic.h" + #include "extensions/cocos-ext.h" #include "../BaseTest.h" diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h index 5bfc7b8531..13f8a93868 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.h @@ -1,6 +1,5 @@ #ifndef __cocos2d_tests__SpritePolygonTest__ -#include "../testBasic.h" #include "../BaseTest.h" #include "ui/CocosGUI.h" diff --git a/tests/cpp-tests/Classes/TerrainTest/TerrainTest.h b/tests/cpp-tests/Classes/TerrainTest/TerrainTest.h index 49cee0307b..68bd98d139 100644 --- a/tests/cpp-tests/Classes/TerrainTest/TerrainTest.h +++ b/tests/cpp-tests/Classes/TerrainTest/TerrainTest.h @@ -1,5 +1,5 @@ #ifndef TERRAIN_TESH_H -#include "../testBasic.h" + #include "../BaseTest.h" #include "3d/CCSprite3D.h" diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h index 2eedfdf06a..5e6668ae7f 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h @@ -1,7 +1,6 @@ #ifndef __TEXT_INPUT_TEST_H__ #define __TEXT_INPUT_TEST_H__ -#include "../testBasic.h" #include "../BaseTest.h" class KeyboardNotificationLayer; From 1875829ab45ef96c58000985e1c45258af4dd400 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 26 Jun 2015 10:16:52 +0800 Subject: [PATCH 22/32] [CppTests:ExtensionsTest-->CocoStudioComponentsTest]Fixed crash on Android 5.0.x --- cocos/audio/android/AudioEngine-inl.cpp | 20 ++++++++--------- .../jni/cddandroidAndroidJavaEngine.cpp | 22 +++++++++---------- .../android/jni/cddandroidAndroidJavaEngine.h | 4 ++-- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cocos/audio/android/AudioEngine-inl.cpp b/cocos/audio/android/AudioEngine-inl.cpp index 804454bd99..cc939d140b 100644 --- a/cocos/audio/android/AudioEngine-inl.cpp +++ b/cocos/audio/android/AudioEngine-inl.cpp @@ -285,16 +285,7 @@ void AudioEngineImpl::update(float dt) for (auto iter = _audioPlayers.begin(); iter != itend; ) { player = &(iter->second); - if (player->_playOver) - { - if (player->_finishCallback) - player->_finishCallback(player->_audioID, *AudioEngine::_audioIDInfoMap[player->_audioID].filePath); - - AudioEngine::remove(player->_audioID); - iter = _audioPlayers.erase(iter); - continue; - } - else if (player->_delayTimeToRemove > 0.f) + if (player->_delayTimeToRemove > 0.f) { player->_delayTimeToRemove -= dt; if (player->_delayTimeToRemove < 0.f) @@ -303,6 +294,15 @@ void AudioEngineImpl::update(float dt) continue; } } + else if (player->_playOver) + { + if (player->_finishCallback) + player->_finishCallback(player->_audioID, *AudioEngine::_audioIDInfoMap[player->_audioID].filePath); + + AudioEngine::remove(player->_audioID); + iter = _audioPlayers.erase(iter); + continue; + } ++iter; } diff --git a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp index 074495f96f..a6521f4064 100644 --- a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp +++ b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.cpp @@ -366,9 +366,9 @@ void AndroidJavaEngine::setEffectsVolume(float volume) if (_effectVolume != volume) { _effectVolume = volume; - for (auto& it : _soundIDs) + for (auto it : _soundIDs) { - AudioEngine::setVolume(it.first, volume); + AudioEngine::setVolume(it, volume); } } } @@ -386,10 +386,10 @@ unsigned int AndroidJavaEngine::playEffect(const char* filePath, bool loop, auto soundID = AudioEngine::play2d(filePath, loop, _effectVolume); if (soundID != AudioEngine::INVALID_AUDIO_ID) { - _soundIDs[soundID] = soundID; + _soundIDs.push_back(soundID); AudioEngine::setFinishCallback(soundID, [this](int id, const std::string& filePath){ - _soundIDs.erase(id); + _soundIDs.remove(id); }); } @@ -430,7 +430,7 @@ void AndroidJavaEngine::stopEffect(unsigned int soundID) if (_implementBaseOnAudioEngine) { AudioEngine::stop(soundID); - _soundIDs.erase(soundID); + _soundIDs.remove(soundID); } else { @@ -442,9 +442,9 @@ void AndroidJavaEngine::pauseAllEffects() { if (_implementBaseOnAudioEngine) { - for (auto& it : _soundIDs) + for (auto it : _soundIDs) { - AudioEngine::pause(it.first); + AudioEngine::pause(it); } } else @@ -457,9 +457,9 @@ void AndroidJavaEngine::resumeAllEffects() { if (_implementBaseOnAudioEngine) { - for (auto& it : _soundIDs) + for (auto it : _soundIDs) { - AudioEngine::resume(it.first); + AudioEngine::resume(it); } } else @@ -472,9 +472,9 @@ void AndroidJavaEngine::stopAllEffects() { if (_implementBaseOnAudioEngine) { - for (auto& it : _soundIDs) + for (auto it : _soundIDs) { - AudioEngine::stop(it.first); + AudioEngine::stop(it); } _soundIDs.clear(); } diff --git a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h index c5d6dbcd9a..656399ea19 100644 --- a/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h +++ b/cocos/audio/android/jni/cddandroidAndroidJavaEngine.h @@ -27,7 +27,7 @@ THE SOFTWARE. #include "SimpleAudioEngine.h" #include "platform/android/jni/JniHelper.h" -#include +#include namespace CocosDenshion { namespace android { @@ -62,7 +62,7 @@ namespace CocosDenshion { private : bool _implementBaseOnAudioEngine; float _effectVolume; - std::unordered_map _soundIDs; + std::list _soundIDs; }; } } From a44eb39bb51ddd44106159bd6720b754199895ef Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 26 Jun 2015 11:27:02 +0800 Subject: [PATCH 23/32] fix tiff 32bit header file include erro --- external/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/config.json b/external/config.json index 70d9d7d9c8..b59d0e3b8f 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-66", + "version":"v3-deps-67", "zip_file_size":"131253061", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", From cc6f02584bb4065d1a2000f6008140830835772a Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Fri, 26 Jun 2015 12:01:45 +0800 Subject: [PATCH 24/32] Solve the error in framework-compile on Mac. --- .../bin/gen_cocos_binary_template.py | 28 ++++++++++++++++++- tools/framework-compile/bin/gen_cocos_libs.py | 2 +- .../bin/template_binary_config.json | 24 ++++++++-------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_binary_template.py b/tools/framework-compile/bin/gen_cocos_binary_template.py index 98b25db956..0365807619 100755 --- a/tools/framework-compile/bin/gen_cocos_binary_template.py +++ b/tools/framework-compile/bin/gen_cocos_binary_template.py @@ -117,6 +117,14 @@ class CocosBinTemplateGenerator(object): self.modify_android_build_cfg(lua_build_cfg, "lua") self.modify_android_build_cfg(js_build_cfg, "js") + # modify the project.properties for templates + cpp_prop_file = os.path.join(dst_dir, "cpp-template-binary/proj.android/project.properties") + lua_prop_file = os.path.join(dst_dir, "lua-template-binary/frameworks/runtime-src/proj.android/project.properties") + js_prop_file = os.path.join(dst_dir, "js-template-binary/frameworks/runtime-src/proj.android/project.properties") + self.modify_project_properties(cpp_prop_file) + self.modify_project_properties(lua_prop_file) + self.modify_project_properties(js_prop_file) + self.modify_version_json(os.path.join(dst_dir, "lua-template-binary/.settings/version.json")) self.modify_version_json(os.path.join(dst_dir, "js-template-binary/.settings/version.json")) @@ -177,6 +185,22 @@ class CocosBinTemplateGenerator(object): json.dump(cfg_info, f, sort_keys=True, indent=4) f.close() + def modify_project_properties(self, cfg_path): + f = open(cfg_path) + lines = f.readlines() + f.close() + + new_lines = [] + pattern = r'android\.library\.reference.*' + for line in lines: + temp_str = line.strip() + if not re.match(pattern, temp_str): + new_lines.append(line) + + f = open(cfg_path, 'w') + f.writelines(new_lines) + f.close() + def modify_android_build_cfg(self, cfg_path, language): f = open(cfg_path) content = f.read() @@ -190,7 +214,9 @@ class CocosBinTemplateGenerator(object): replace_str = "../../cocos2d-x" if replace_str is not None: - content = content.replace(replace_str, self.repo_x) + framework_version = self.version.strip() + framework_version = framework_version.replace(' ', '-') + content = content.replace(replace_str, "${COCOS_FRAMEWORKS}/%s" % framework_version) f = open(cfg_path, "w") f.write(content) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index 58727112ae..04b03a8ca0 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -87,8 +87,8 @@ class CocosLibsCompiler(object): if self.build_mac: self.compile_mac_ios() if self.build_android: - self.compile_android("lua") self.compile_android("js") + self.compile_android("lua") def build_win32_proj(self, cmd_path, sln_path, proj_name, mode): diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index 98927b14d5..2f7a2a988d 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -64,6 +64,13 @@ "RuntimeJsImpl.*" ] }, + { + "from": "tools/simulator/frameworks/runtime-src/Classes", + "to": "lua-template-binary/frameworks/runtime-src/Classes", + "include": [ + "lua_module_register.h" + ] + }, { "from": "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios", "to": "lua-template-binary/frameworks/runtime-src/proj.ios_mac/ios", @@ -136,24 +143,15 @@ }, { "from": "cocos/platform/android/java/src", - "to": "cpp-template-binary/proj.android/src", - "include": [ - "*.java" - ] + "to": "cpp-template-binary/proj.android/src" }, { "from": "cocos/platform/android/java/src", - "to": "lua-template-binary/frameworks/runtime-src/proj.android/src", - "include": [ - "*.java" - ] + "to": "lua-template-binary/frameworks/runtime-src/proj.android/src" }, { "from": "cocos/platform/android/java/src", - "to": "js-template-binary/frameworks/runtime-src/proj.android/src", - "include": [ - "*.java" - ] + "to": "js-template-binary/frameworks/runtime-src/proj.android/src" } ], "modify_config": [ @@ -174,6 +172,8 @@ "cocos/scripting/js-bindings/proj.android/Android.mk", "cocos/scripting/lua-bindings/proj.android/Android.mk", "cocos/storage/local-storage/Android.mk", + "external/bullet/Android.mk", + "external/recast/Android.mk", "external/flatbuffers/Android.mk", "external/Box2D/Android.mk", "cocos/editor-support/cocosbuilder/Android.mk", From 94c0c0c3fc7acbb4dd34bbf52b3ef3457d43eabc Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Fri, 26 Jun 2015 12:02:15 +0800 Subject: [PATCH 25/32] [Cpp-tests-->SpriteOffsetAnchorRotation]Fixed crash when enter `SpriteOffsetAnchorRotation` test case again after a auto-tested. --- tests/cpp-tests/Classes/BaseTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cpp-tests/Classes/BaseTest.cpp b/tests/cpp-tests/Classes/BaseTest.cpp index 4501cb3730..42a804dc4f 100644 --- a/tests/cpp-tests/Classes/BaseTest.cpp +++ b/tests/cpp-tests/Classes/BaseTest.cpp @@ -350,6 +350,7 @@ TestCase::TestCase() , _runTime(0.0f) { Director::getInstance()->getTextureCache()->removeUnusedTextures(); + SpriteFrameCache::getInstance()->removeUnusedSpriteFrames(); this->schedule([&](float dt){ _runTime += dt; From 47c0e45ec4640b98ac5449622b1126893114f1ec Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 26 Jun 2015 04:52:25 +0000 Subject: [PATCH 26/32] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index b7039db976..52d938de6e 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3041,6 +3041,8 @@ "external/tiff/include/android/tiffio.h", "external/tiff/include/android/tiffvers.h", "external/tiff/include/ios/tiff.h", + "external/tiff/include/ios/tiffconf-32.h", + "external/tiff/include/ios/tiffconf-64.h", "external/tiff/include/ios/tiffconf.h", "external/tiff/include/ios/tiffio.h", "external/tiff/include/ios/tiffvers.h", From 48f03adc3f5fb3f8e6b5f116200498a3f1283a47 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 26 Jun 2015 04:56:58 +0000 Subject: [PATCH 27/32] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index b7039db976..19d46c4850 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -3041,6 +3041,8 @@ "external/tiff/include/android/tiffio.h", "external/tiff/include/android/tiffvers.h", "external/tiff/include/ios/tiff.h", + "external/tiff/include/ios/tiffconf-32.h", + "external/tiff/include/ios/tiffconf-64.h", "external/tiff/include/ios/tiffconf.h", "external/tiff/include/ios/tiffio.h", "external/tiff/include/ios/tiffvers.h", @@ -5284,10 +5286,6 @@ "tools/framework-compile/bin-templates/lua-template-runtime/src/app/MyApp.lua", "tools/framework-compile/bin-templates/lua-template-runtime/src/app/views/MainScene.lua", "tools/framework-compile/bin-templates/lua-template-runtime/src/config.lua", - "tools/framework-compile/x-modified/cocos/audio/android/prebuilt-mk/Android.mk", - "tools/framework-compile/x-modified/cocos/prebuilt-mk/Android.mk", - "tools/framework-compile/x-modified/cocos/scripting/js-bindings/proj.android/prebuilt-mk/Android.mk", - "tools/framework-compile/x-modified/cocos/scripting/lua-bindings/proj.android/prebuilt-mk/Android.mk", "tools/gen-prebuilt/README.md", "tools/gen-prebuilt/build_config.json", "tools/gen-prebuilt/excopy.py", From 1fd45d6f30d0f8855eb6002d23997a245185cf97 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 26 Jun 2015 13:45:28 +0800 Subject: [PATCH 28/32] Update submodules --- tools/cocos2d-console | 2 +- web | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 79d220cb05..2ef9289c0f 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 79d220cb052372cde4868b6d0cc332a89e4fbc03 +Subproject commit 2ef9289c0f9e365d4c0aa11989508607f7dada17 diff --git a/web b/web index 7b76c2bc70..fec945a700 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 7b76c2bc701f87818c90192d8988cf4f898d3943 +Subproject commit fec945a7000ff31a7c206ca2ca7fd13707a2570a From 24eca337cae94f606a824abb797403d8395cf054 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Fri, 26 Jun 2015 17:12:39 +0800 Subject: [PATCH 29/32] [ci-skip][lua-tests/lua-empty-test]Fixed can't run successfully by console on WIN32. --- tests/lua-empty-test/project/proj.win32/build-cfg.json | 2 +- tests/lua-tests/project/proj.win32/build-cfg.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lua-empty-test/project/proj.win32/build-cfg.json b/tests/lua-empty-test/project/proj.win32/build-cfg.json index 393cc9e3ab..214d8b6ce5 100644 --- a/tests/lua-empty-test/project/proj.win32/build-cfg.json +++ b/tests/lua-empty-test/project/proj.win32/build-cfg.json @@ -10,7 +10,7 @@ }, { "from": "../../../../cocos/scripting/lua-bindings/script", - "to": "" + "to": "src/cocos" }, { "from": "../../../../external/lua/luasocket", diff --git a/tests/lua-tests/project/proj.win32/build-cfg.json b/tests/lua-tests/project/proj.win32/build-cfg.json index 76fc1bdfe3..84c2dfb509 100644 --- a/tests/lua-tests/project/proj.win32/build-cfg.json +++ b/tests/lua-tests/project/proj.win32/build-cfg.json @@ -14,7 +14,7 @@ }, { "from": "../../../../cocos/scripting/lua-bindings/script", - "to": "" + "to": "src/cocos" }, { "from": "../../../../external/lua/luasocket", From 0ac3da16363b6975d3eeca94f6c96efd200ede7e Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Fri, 26 Jun 2015 21:00:32 +0800 Subject: [PATCH 30/32] Solve the error in framework-compile tools. --- .../cpp-template-default/proj.win32/main.cpp | 16 +++++++++--- .../runtime-src/proj.win32/main.cpp | 22 ++++++++++++---- .../runtime-src/proj.win32/main.cpp | 23 ++++++++++++----- tools/framework-compile/bin/gen_cocos_libs.py | 25 +++++++++++-------- .../bin/gen_libs_config.json | 22 +++------------- .../bin/template_binary_config.json | 11 +++++--- .../runtime-src/proj.win32/simulator.sln | 6 +++++ .../runtime-src/proj.win32/simulator.vcxproj | 2 ++ 8 files changed, 81 insertions(+), 46 deletions(-) diff --git a/tools/framework-compile/bin-templates/cpp-template-default/proj.win32/main.cpp b/tools/framework-compile/bin-templates/cpp-template-default/proj.win32/main.cpp index 38ae466fb6..0269ad2eee 100755 --- a/tools/framework-compile/bin-templates/cpp-template-default/proj.win32/main.cpp +++ b/tools/framework-compile/bin-templates/cpp-template-default/proj.win32/main.cpp @@ -4,9 +4,19 @@ USING_NS_CC; -#pragma comment(lib,"libcocos2d.lib") -#pragma comment(lib,"libbox2d.lib") -#pragma comment(lib,"libSpine.lib") +#if _MSC_VER > 1800 +#pragma comment(lib,"libcocos2d_2015.lib") +#pragma comment(lib,"libbox2d_2015.lib") +#pragma comment(lib,"libSpine_2015.lib") +#pragma comment(lib,"libbullet_2015.lib") +#pragma comment(lib,"librecast_2015.lib") +#else +#pragma comment(lib,"libcocos2d_2013.lib") +#pragma comment(lib,"libbox2d_2013.lib") +#pragma comment(lib,"libSpine_2013.lib") +#pragma comment(lib,"libbullet_2013.lib") +#pragma comment(lib,"librecast_2013.lib") +#endif int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, diff --git a/tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/main.cpp b/tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/main.cpp index 9229bc26b1..2fc68f669f 100755 --- a/tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/main.cpp +++ b/tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/main.cpp @@ -2,11 +2,23 @@ #include "SimulatorWin.h" #include -#pragma comment(lib,"libcocos2d.lib") -#pragma comment(lib,"libjscocos2d.lib") -#pragma comment(lib,"libbox2d.lib") -#pragma comment(lib,"libSpine.lib") -#pragma comment(lib,"libsimulator.lib") +#if _MSC_VER > 1800 +#pragma comment(lib,"libcocos2d_2015.lib") +#pragma comment(lib,"libbox2d_2015.lib") +#pragma comment(lib,"libSpine_2015.lib") +#pragma comment(lib,"libbullet_2015.lib") +#pragma comment(lib,"librecast_2015.lib") +#pragma comment(lib,"libjscocos2d_2015.lib") +#pragma comment(lib,"libsimulator_2015.lib") +#else +#pragma comment(lib,"libcocos2d_2013.lib") +#pragma comment(lib,"libbox2d_2013.lib") +#pragma comment(lib,"libSpine_2013.lib") +#pragma comment(lib,"libbullet_2013.lib") +#pragma comment(lib,"librecast_2013.lib") +#pragma comment(lib,"libjscocos2d_2013.lib") +#pragma comment(lib,"libsimulator_2013.lib") +#endif int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, diff --git a/tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp b/tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp index ba3b237f11..cd765971c3 100755 --- a/tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp +++ b/tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp @@ -2,12 +2,23 @@ #include "SimulatorWin.h" #include -#pragma comment(lib,"libcocos2d.lib") -#pragma comment(lib,"libluacocos2d.lib") -#pragma comment(lib,"libbox2d.lib") -#pragma comment(lib,"libSpine.lib") -#pragma comment(lib,"libsimulator.lib") - +#if _MSC_VER > 1800 +#pragma comment(lib,"libcocos2d_2015.lib") +#pragma comment(lib,"libbox2d_2015.lib") +#pragma comment(lib,"libSpine_2015.lib") +#pragma comment(lib,"libbullet_2015.lib") +#pragma comment(lib,"librecast_2015.lib") +#pragma comment(lib,"libluacocos2d_2015.lib") +#pragma comment(lib,"libsimulator_2015.lib") +#else +#pragma comment(lib,"libcocos2d_2013.lib") +#pragma comment(lib,"libbox2d_2013.lib") +#pragma comment(lib,"libSpine_2013.lib") +#pragma comment(lib,"libbullet_2013.lib") +#pragma comment(lib,"librecast_2013.lib") +#pragma comment(lib,"libluacocos2d_2013.lib") +#pragma comment(lib,"libsimulator_2013.lib") +#endif int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index 04b03a8ca0..73602aa66e 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -128,8 +128,21 @@ class CocosLibsCompiler(object): # get the VS projects info win32_proj_info = self.cfg_info[CocosLibsCompiler.KEY_VS_PROJS_INFO] - for vs_version in vs_cmd_info.keys(): + for vs_version in compile_vs_versions: + if not vs_version in vs_cmd_info.keys(): + continue + vs_command = vs_cmd_info[vs_version] + for key in win32_proj_info.keys(): + # clean solutions + proj_path = os.path.join(self.repo_x, key) + clean_cmd = " ".join([ + "\"%s\"" % vs_command, + "\"%s\"" % proj_path, + "/clean \"Release|Win32\"" + ]) + utils_cocos.execute_command(clean_cmd) + for key in win32_proj_info.keys(): output_dir = os.path.join(self.lib_dir, "win32") proj_path = os.path.join(self.repo_x, key) @@ -140,14 +153,6 @@ class CocosLibsCompiler(object): if not os.path.exists(win32_output_dir): os.makedirs(win32_output_dir) - # clean solution - # clean_cmd = " ".join([ - # "\"%s\"" % vs_command, - # "\"%s\"" % proj_path, - # "/clean \"Release|Win32\"" - # ]) - # utils_cocos.execute_command(clean_cmd) - # build project if self.use_incredibuild: # use incredibuild, build whole sln @@ -354,7 +359,7 @@ if __name__ == "__main__": parser.add_argument('--mac', dest='mac', action="store_true", help='compile mac platform') parser.add_argument('--android', dest='android', action="store_true",help='complile android platform') parser.add_argument('--dis-strip', "--disable-strip", dest='disable_strip', action="store_true", help='Disable the strip of the generated libs.') - parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=2013) + parser.add_argument('--vs', dest='vs_version', type=int, help='visual studio version, such as 2013.', default=None) parser.add_argument("--app-abi", dest="app_abi", help="Set the APP_ABI of ndk-build.Can be multi value separated with ':'. Sample : --app-aib armeabi:x86:mips. Default value is 'armeabi'.") diff --git a/tools/framework-compile/bin/gen_libs_config.json b/tools/framework-compile/bin/gen_libs_config.json index f9abbca41c..48eebcc034 100755 --- a/tools/framework-compile/bin/gen_libs_config.json +++ b/tools/framework-compile/bin/gen_libs_config.json @@ -15,30 +15,16 @@ } }, "vs_projs_info" : { - "build/cocos2d-win32.sln" : { - "build_targets" : [ - "libluacocos2d" - ], - "rename_targets" : [ - "libcocos2d", "libluacocos2d", "libSpine", "libbox2d" - ] - }, - "build/cocos2d-js-win32.sln" : { - "build_targets" : [ - "libjscocos2d" - ], - "rename_targets" : [ - "libjscocos2d" - ] - }, "tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln" : { "build_targets" : [ - "libsimulator" + "simulator" ], "rename_targets" : [ + "libSpine", "libbox2d", "libbullet", "librecast", + "libcocos2d", "libluacocos2d", "libjscocos2d", "libsimulator" ] } }, - "support_vs_versions" : [ 2013, 2015 ] + "support_vs_versions" : [ 2015, 2013 ] } diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index 2f7a2a988d..dfe5b49ba2 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -4,6 +4,8 @@ "from": "templates/cpp-template-default", "to": "cpp-template-binary", "exclude": [ + "*android-studio", + "*win10", "*wp8", "*win8.1-universal", "*linux", @@ -25,6 +27,8 @@ "from": "templates/lua-template-default/frameworks", "to": "lua-template-binary/frameworks", "exclude": [ + "*android-studio", + "*win10", "*wp8", "*win8.1-universal", "*linux", @@ -42,6 +46,8 @@ "from": "templates/js-template-runtime", "to": "js-template-binary", "exclude": [ + "*android-studio", + "*win10", "*wp8", "*win8.1-universal", "*linux", @@ -52,10 +58,7 @@ }, { "from": "web", - "to": "js-template-binary/frameworks/cocos2d-html5", - "exclude": [ - ".*" - ] + "to": "js-template-binary/frameworks/cocos2d-html5" }, { "from": "tools/simulator/frameworks/runtime-src/Classes/ide-support", diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln index e81b11e41c..1e67890410 100644 --- a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln +++ b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.sln @@ -22,6 +22,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\..\..\.. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\..\..\..\..\external\bullet\proj.win32\libbullet.vcxproj", "{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\..\..\..\..\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -60,6 +62,10 @@ Global {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.Build.0 = Debug|Win32 {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.ActiveCfg = Release|Win32 {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.Build.0 = Release|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj index cb6d726a63..3123402c14 100644 --- a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj +++ b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj @@ -91,6 +91,7 @@ libcurl_imp.lib;websockets.lib;mozjs-33.lib;%(AdditionalDependencies) $(ProjectDir)../../../runtime/win32/$(TargetName).pdb $(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt) + libcmt.lib;%(IgnoreSpecificDefaultLibraries) 0x0409 @@ -156,6 +157,7 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32" libcurl_imp.lib;websockets.lib;mozjs-33.lib;%(AdditionalDependencies) false $(OutDir)$(ProjectName).exe + libcmt.lib;%(IgnoreSpecificDefaultLibraries) 0x0409 From 652aaf3bcd605b8f72d98b196c1bbd1420277f76 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Sat, 27 Jun 2015 14:44:10 +0800 Subject: [PATCH 31/32] Solve the error in framework-compile tools. --- tools/framework-compile/bin/gen_cocos_libs.py | 128 ++++++++++-------- .../framework-compile/bin/modify_template.py | 16 +-- .../bin/proj_modifier/modify_vcxproj.py | 29 ++-- 3 files changed, 103 insertions(+), 70 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index 73602aa66e..a93c365d99 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -126,74 +126,94 @@ class CocosLibsCompiler(object): if len(vs_cmd_info) == 0: raise CustomError('Not found available VS.', CustomError.ERROR_TOOLS_NOT_FOUND) + cocos2d_proj_file = os.path.join(self.repo_x, 'cocos/2d/libcocos2d.vcxproj') + # get the VS projects info win32_proj_info = self.cfg_info[CocosLibsCompiler.KEY_VS_PROJS_INFO] for vs_version in compile_vs_versions: if not vs_version in vs_cmd_info.keys(): continue - vs_command = vs_cmd_info[vs_version] - for key in win32_proj_info.keys(): - # clean solutions - proj_path = os.path.join(self.repo_x, key) - clean_cmd = " ".join([ - "\"%s\"" % vs_command, - "\"%s\"" % proj_path, - "/clean \"Release|Win32\"" - ]) - utils_cocos.execute_command(clean_cmd) + # rename the cocos2d project out dll name + f = open(cocos2d_proj_file, 'r') + old_file_content = f.read() + f.close() - for key in win32_proj_info.keys(): - output_dir = os.path.join(self.lib_dir, "win32") - proj_path = os.path.join(self.repo_x, key) + new_file_content = old_file_content.replace('$(OutDir)$(ProjectName).dll', '$(OutDir)$(ProjectName)_%d.dll' % vs_version) + f = open(cocos2d_proj_file, 'w') + f.write(new_file_content) + f.close() - # get the build folder & win32 output folder - build_folder_path = os.path.join(os.path.dirname(proj_path), "Release.win32") - win32_output_dir = os.path.join(self.repo_x, output_dir) - if not os.path.exists(win32_output_dir): - os.makedirs(win32_output_dir) - - # build project - if self.use_incredibuild: - # use incredibuild, build whole sln - build_cmd = " ".join([ - "BuildConsole", - "%s" % proj_path, - "/build", - "/cfg=\"Release|Win32\"" + try: + vs_command = vs_cmd_info[vs_version] + for key in win32_proj_info.keys(): + # clean solutions + proj_path = os.path.join(self.repo_x, key) + clean_cmd = " ".join([ + "\"%s\"" % vs_command, + "\"%s\"" % proj_path, + "/clean \"Release|Win32\"" ]) - utils_cocos.execute_command(build_cmd) - else: - for proj_name in win32_proj_info[key][CocosLibsCompiler.KEY_VS_BUILD_TARGETS]: - # build the projects - self.build_win32_proj(vs_command, proj_path, proj_name, "build") + utils_cocos.execute_command(clean_cmd) - lib_file_path = os.path.join(build_folder_path, "%s.lib" % proj_name) - if not os.path.exists(lib_file_path): - # if the lib is not generated, rebuild the project - self.build_win32_proj(vs_command, proj_path, proj_name, "rebuild") + for key in win32_proj_info.keys(): + output_dir = os.path.join(self.lib_dir, "win32") + proj_path = os.path.join(self.repo_x, key) - if not os.path.exists(lib_file_path): - raise Exception("Library %s not generated as expected!" % lib_file_path) + # get the build folder & win32 output folder + build_folder_path = os.path.join(os.path.dirname(proj_path), "Release.win32") + win32_output_dir = os.path.join(self.repo_x, output_dir) + if not os.path.exists(win32_output_dir): + os.makedirs(win32_output_dir) - # copy the libs into prebuilt dir - for file_name in os.listdir(build_folder_path): - name, ext = os.path.splitext(file_name) - if ext != ".lib" and ext != ".dll": - continue + # build project + if self.use_incredibuild: + # use incredibuild, build whole sln + build_cmd = " ".join([ + "BuildConsole", + "%s" % proj_path, + "/build", + "/cfg=\"Release|Win32\"" + ]) + utils_cocos.execute_command(build_cmd) + else: + for proj_name in win32_proj_info[key][CocosLibsCompiler.KEY_VS_BUILD_TARGETS]: + # build the projects + self.build_win32_proj(vs_command, proj_path, proj_name, "build") - file_path = os.path.join(build_folder_path, file_name) - shutil.copy(file_path, win32_output_dir) + lib_file_path = os.path.join(build_folder_path, "%s.lib" % proj_name) + if not os.path.exists(lib_file_path): + # if the lib is not generated, rebuild the project + self.build_win32_proj(vs_command, proj_path, proj_name, "rebuild") + + if not os.path.exists(lib_file_path): + raise Exception("Library %s not generated as expected!" % lib_file_path) + + # copy the libs into prebuilt dir + for file_name in os.listdir(build_folder_path): + name, ext = os.path.splitext(file_name) + if ext != ".lib" and ext != ".dll": + continue + + file_path = os.path.join(build_folder_path, file_name) + shutil.copy(file_path, win32_output_dir) + + # rename the specified libs + suffix = "_%d" % vs_version + for proj_name in win32_proj_info[key][CocosLibsCompiler.KEY_VS_RENAME_TARGETS]: + src_name = os.path.join(win32_output_dir, "%s.lib" % proj_name) + dst_name = os.path.join(win32_output_dir, "%s%s.lib" % (proj_name, suffix)) + if os.path.exists(src_name): + if os.path.exists(dst_name): + os.remove(dst_name) + os.rename(src_name, dst_name) + except Exception as e: + raise e + finally: + f = open(cocos2d_proj_file, 'w') + f.write(old_file_content) + f.close() - # rename the specified libs - suffix = "_%d" % vs_version - for proj_name in win32_proj_info[key][CocosLibsCompiler.KEY_VS_RENAME_TARGETS]: - src_name = os.path.join(win32_output_dir, "%s.lib" % proj_name) - dst_name = os.path.join(win32_output_dir, "%s%s.lib" % (proj_name, suffix)) - if os.path.exists(src_name): - if os.path.exists(dst_name): - os.remove(dst_name) - os.rename(src_name, dst_name) print("Win32 build succeeded.") diff --git a/tools/framework-compile/bin/modify_template.py b/tools/framework-compile/bin/modify_template.py index 1fb601adcb..0f02223f1e 100755 --- a/tools/framework-compile/bin/modify_template.py +++ b/tools/framework-compile/bin/modify_template.py @@ -150,19 +150,20 @@ class TemplateModifier(object): install_path = self.engine_path if self.is_for_package: - install_path = "$(COCOS_FRAMEWORKS)\\%s" % self.version + install_path = "$(COCOS_FRAMEWORKS)\\%s\\" % self.version - custom_step_event = vcx_proj.get_event_command('CustomBuildStep') copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \ "xcopy /Y /Q \"$(EngineRoot)\\prebuilt\\win32\\*.*\" \"$(OutDir)\"\n" - custom_step_event = copy_libs_cmd + custom_step_event + vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'debug') + vcx_proj.set_event_command('PreLinkEvent', copy_libs_cmd, 'release') if language == "js": - vcx_proj.set_event_command('PreLinkEvent', '', create_new=False) + custom_step_event = vcx_proj.get_event_command('CustomBuildStep') custom_step_event.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script", "$(ProjectDir)..\\..\\..\\script") + vcx_proj.set_event_command("CustomBuildStep", custom_step_event, create_new=False) - vcx_proj.set_event_command("CustomBuildStep", custom_step_event, create_new=False) + vcx_proj.remove_predefine_macro("_DEBUG", 'debug') # # copy_libs_cmd = "if not exist \"$(OutDir)\" mkdir \"$(OutDir)\"\n" \ @@ -179,9 +180,6 @@ class TemplateModifier(object): # link_cmd = "libcmt.lib;%(IgnoreSpecificDefaultLibraries)" # vcx_proj.set_item("Link", "IgnoreSpecificDefaultLibraries", link_cmd) # - # vcx_proj.remove_predefine_macro("_DEBUG") - # - # # debug_prebuild = vcx_proj.get_event_command("PreBuildEvent", "debug") # debug_prebuild = debug_prebuild.replace("$(ProjectDir)..\\..\\cocos2d-x\\cocos\\scripting\\js-bindings\\script", # "$(ProjectDir)..\\..\\..\\script") @@ -234,6 +232,8 @@ class TemplateModifier(object): file_content = file_content.replace("MultiThreadedDebugDLL", "MultiThreadedDLL") for str in replace_strs: file_content = file_content.replace(str, install_path) + file_content = file_content.replace('%s\\' % install_path, install_path) + f = open(proj_file_path, "w") f.write(file_content) f.close() diff --git a/tools/framework-compile/bin/proj_modifier/modify_vcxproj.py b/tools/framework-compile/bin/proj_modifier/modify_vcxproj.py index e3940460f4..57173848bf 100755 --- a/tools/framework-compile/bin/proj_modifier/modify_vcxproj.py +++ b/tools/framework-compile/bin/proj_modifier/modify_vcxproj.py @@ -147,6 +147,9 @@ class VCXProject(object): cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup") for cfg_node in cfg_nodes: if config is not None: + if 'Condition' not in cfg_node.attributes.keys(): + continue + cond_attr = cfg_node.attributes["Condition"].value if cond_attr.lower().find("debug") >= 0: cur_mode = "Debug" @@ -161,7 +164,13 @@ class VCXProject(object): continue cmd_node = self.get_or_create_node(event_node, "Command") - cmd_node.firstChild.nodeValue = command + if cmd_node.firstChild is None: + impl = minidom.getDOMImplementation() + dom = impl.createDocument(None, 'catalog', None) + nodeValue = dom.createTextNode(command) + cmd_node.appendChild(nodeValue) + else: + cmd_node.firstChild.nodeValue = command def get_node_if(self, parent, name): children = parent.getElementsByTagName(name) @@ -210,14 +219,18 @@ class VCXProject(object): def remove_predefine_macro(self, macro, config=None): cfg_nodes = self.root_node.getElementsByTagName("ItemDefinitionGroup") for cfg_node in cfg_nodes: - cond_attr = cfg_node.attributes["Condition"].value - if cond_attr.lower().find("debug") >= 0: - cur_mode = "Debug" - else: - cur_mode = "Release" + if config is not None: + if 'Condition' not in cfg_node.attributes.keys(): + continue - if (config is not None) and (cur_mode.lower() != config.lower()): - continue + cond_attr = cfg_node.attributes["Condition"].value + if cond_attr.lower().find("debug") >= 0: + cur_mode = "Debug" + else: + cur_mode = "Release" + + if (cur_mode.lower() != config.lower()): + continue compile_node = self.get_or_create_node(cfg_node, "ClCompile") predefine_node = self.get_or_create_node(compile_node, "PreprocessorDefinitions") From 02500976f7fc3054b214fd15b51f032f6a67def7 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Sat, 27 Jun 2015 17:42:15 +0800 Subject: [PATCH 32/32] Solve the error in framework-compile tools. --- tools/framework-compile/bin/gen_cocos_libs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index a93c365d99..6188287ed7 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -291,7 +291,7 @@ class CocosLibsCompiler(object): cmd_path = os.path.join(console_dir, "cocos") proj_name = "My%sGame" % language - proj_dir = os.path.join(self.cur_dir, "temp") + proj_dir = engine_dir proj_path = os.path.join(proj_dir, proj_name) utils_cocos.rmdir(proj_path)