From 5b620fbfe19f0a71e382991bf05ceeec4423035c Mon Sep 17 00:00:00 2001 From: Daisuke Hashimoto Date: Thu, 14 Aug 2014 21:10:51 +0900 Subject: [PATCH 1/5] use fileName for _actionDic key --- cocos/editor-support/cocostudio/CCActionManagerEx.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp index 76a15e0bba..56a2d3860c 100644 --- a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp +++ b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp @@ -116,7 +116,11 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName) { - auto iterator = _actionDic.find(jsonName); + std::string path = jsonName; + ssize_t pos = path.find_last_of("/"); + std::string fileName = path.substr(pos+1,path.length()); + CCLOG("find filename == %s",fileName.c_str()); + auto iterator = _actionDic.find(fileName); if (iterator == _actionDic.end()) { return nullptr; From d5e29d285da674ad5d46902be28e6d2a1f3d6fd3 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Thu, 9 Oct 2014 18:34:14 +0800 Subject: [PATCH 2/5] fix gel Config error on android --- .../org/cocos2dx/lib/Cocos2dxActivity.java | 78 +++++++++++++++---- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index 909584040f..d4e5347880 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -226,7 +226,50 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe class cocos2dEGLConfigChooser implements GLSurfaceView.EGLConfigChooser { - public int[] attribs; + protected int[] configAttribs; + public cocos2dEGLConfigChooser(int redSize, int greenSize, int blueSize, int alphaSize, int depthSize, int stencilSize) + { + configAttribs = new int[] {redSize, greenSize, blueSize, alphaSize, depthSize, stencilSize}; + } + public cocos2dEGLConfigChooser(int[] attribs) + { + configAttribs = attribs; + } + + public EGLConfig selectConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs, int[] attribs) + { + for (EGLConfig config : configs) { + int d = findConfigAttrib(egl, display, config, + EGL10.EGL_DEPTH_SIZE, 0); + int s = findConfigAttrib(egl, display, config, + EGL10.EGL_STENCIL_SIZE, 0); + if ((d >= attribs[4]) && (s >= attribs[5])) { + int r = findConfigAttrib(egl, display, config, + EGL10.EGL_RED_SIZE, 0); + int g = findConfigAttrib(egl, display, config, + EGL10.EGL_GREEN_SIZE, 0); + int b = findConfigAttrib(egl, display, config, + EGL10.EGL_BLUE_SIZE, 0); + int a = findConfigAttrib(egl, display, config, + EGL10.EGL_ALPHA_SIZE, 0); + if ((r >= attribs[0]) && (g >= attribs[1]) + && (b >= attribs[2]) && (a >= attribs[3])) { + return config; + } + } + } + return null; + } + + private int findConfigAttrib(EGL10 egl, EGLDisplay display, + EGLConfig config, int attribute, int defaultValue) { + int[] value = new int[1]; + if (egl.eglGetConfigAttrib(display, config, attribute, value)) { + return value[0]; + } + return defaultValue; + } + @Override public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { @@ -235,12 +278,13 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe { EGLConfig[] configs = new EGLConfig[numConfigs[0]]; int[] EGLattribs = { - EGL10.EGL_RED_SIZE, attribs[0], - EGL10.EGL_GREEN_SIZE, attribs[1], - EGL10.EGL_BLUE_SIZE, attribs[2], - EGL10.EGL_ALPHA_SIZE, attribs[3], - EGL10.EGL_DEPTH_SIZE, attribs[4], - EGL10.EGL_STENCIL_SIZE,attribs[5], + EGL10.EGL_RED_SIZE, configAttribs[0], + EGL10.EGL_GREEN_SIZE, configAttribs[1], + EGL10.EGL_BLUE_SIZE, configAttribs[2], + EGL10.EGL_ALPHA_SIZE, configAttribs[3], + EGL10.EGL_DEPTH_SIZE, configAttribs[4], + EGL10.EGL_STENCIL_SIZE,configAttribs[5], + EGL10.EGL_RENDERABLE_TYPE, 4, //EGL_OPENGL_ES2_BIT EGL10.EGL_NONE }; int[] choosedConfigNum = new int[1]; @@ -248,7 +292,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe egl.eglChooseConfig(display, EGLattribs, configs, numConfigs[0], choosedConfigNum); if(choosedConfigNum[0]>0) { - return configs[0]; + return selectConfig(egl, display, configs, configAttribs); } else { @@ -259,6 +303,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe EGL10.EGL_ALPHA_SIZE, 0, EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_STENCIL_SIZE,0, + EGL10.EGL_RENDERABLE_TYPE, 4, //EGL_OPENGL_ES2_BIT EGL10.EGL_NONE }; int[] defaultEGLattribsAlpha = { @@ -268,17 +313,24 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe EGL10.EGL_ALPHA_SIZE, 4, EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_STENCIL_SIZE,0, + EGL10.EGL_RENDERABLE_TYPE, 4, //EGL_OPENGL_ES2_BIT EGL10.EGL_NONE }; + int[] attribs = null; //choose one can use - if(this.attribs[3] == 0) + if(this.configAttribs[3] == 0) + { egl.eglChooseConfig(display, defaultEGLattribs, configs, numConfigs[0], choosedConfigNum); + attribs = new int[]{5,6,5,0,0,0}; + } else + { egl.eglChooseConfig(display, defaultEGLattribsAlpha, configs, numConfigs[0], choosedConfigNum); + attribs = new int[]{4,4,4,4,0,0}; + } if(choosedConfigNum[0] > 0) { - Log.w(DEVICE_POLICY_SERVICE, "The EGLConfig can not be used for rendering, use a default one"); - return configs[0]; + return selectConfig(egl, display, configs, attribs); } else { @@ -290,9 +342,9 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe Log.e(DEVICE_POLICY_SERVICE, "Can not select an EGLConfig for rendering."); return null; } + } - cocos2dEGLConfigChooser chooser = new cocos2dEGLConfigChooser(); - chooser.attribs = this.glContextAttrs; + cocos2dEGLConfigChooser chooser = new cocos2dEGLConfigChooser(this.glContextAttrs); glSurfaceView.setEGLConfigChooser(chooser); return glSurfaceView; From a5a16eecbf237638ae848d8ec87c1b4f4c5057dd Mon Sep 17 00:00:00 2001 From: NeoLeeee Date: Fri, 10 Oct 2014 01:33:41 +0800 Subject: [PATCH 3/5] the android library path is wrong if you run the following command in your game forder cocos run -p android it will give you the following error since the path is wrong BUILD FAILED /Users/lifeng/dev/adt_bundle_mac/sdk/tools/ant/build.xml:459: ../../../cocos/platform/android/java resolve to a path with no project.properties file for project /Users/lifeng/study/cosco2dx/MyFirstGame/proj.android --- templates/cpp-template-default/proj.android/project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cpp-template-default/proj.android/project.properties b/templates/cpp-template-default/proj.android/project.properties index 572f7c30de..dc57659a70 100644 --- a/templates/cpp-template-default/proj.android/project.properties +++ b/templates/cpp-template-default/proj.android/project.properties @@ -10,4 +10,4 @@ # Project target. target=android-10 -android.library.reference.1=../../../cocos/platform/android/java +android.library.reference.1=../cocos2d/cocos/platform/android/java From 5027f2434823fa4c14e5788a7a283996c58bc2ba Mon Sep 17 00:00:00 2001 From: Ahlwong Date: Thu, 9 Oct 2014 12:48:09 -0700 Subject: [PATCH 4/5] Fix UIButton Scale 9 Highlight --- cocos/ui/UIButton.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index a4c6bf7b0f..8e938366c4 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -374,11 +374,19 @@ void Button::onPressStateChangedToNormal() } else { - _buttonNormalRenderer->stopAllActions(); - _buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize); - _titleRenderer->stopAllActions(); - _titleRenderer->setScaleX(_normalTextureScaleXInSize); - _titleRenderer->setScaleY(_normalTextureScaleYInSize); + if (_scale9Enabled) + { + _buttonNormalRenderer->setColor(Color3B::WHITE); + } + else + { + _buttonNormalRenderer->stopAllActions(); + _buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize); + + _titleRenderer->stopAllActions(); + _titleRenderer->setScaleX(_normalTextureScaleXInSize); + _titleRenderer->setScaleY(_normalTextureScaleYInSize); + } } } From d7d52a7cf0afefb47d5c8f1c4b0a9161463af923 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 10 Oct 2014 10:19:07 +0800 Subject: [PATCH 5/5] [ci skip] Update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 374d27fd3e..6e41066be9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -25,6 +25,7 @@ cocos2d-x-3.3-beta1 [FIX] Node: unscheduleAllSelectors() deprecated in favor of unscheudleAllCallbacks() [FIX] Node: crashed if remove/add child too quickly when using integrated physics [FIX] TextFieldTTF: will get wrong characters if using Chinese input method on WP8 + [FIX] UI: Button: button remains gray when releasing it, this issue only happened if enable scale9 and only has one texture cocos2d-x-3.3-beta0 Sep.20 2014 [NEW] 3d: added `BillBoard`