Skip to content

Commit 86a8811

Browse files
committed
Merge commit '1528ea01d2749b4ef65e97f79cffa6135fe13c4d' into scgamex-v3
submodule: cocos-console (kept at scgame_v3) * commit '1528ea01d2749b4ef65e97f79cffa6135fe13c4d': setPercent after initialization (cocos2d#19718) Update CHANGELOG [js-tests/cpp-tests] iOS: add fonts to Info.plist (cocos2d#19708) update release note and change log (cocos2d#19711) fix get environment (cocos2d#19690) rename Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.* to Cocos2dxLuaJavaBridge.* (cocos2d#19694) fix twice copy lua scripts error (cocos2d#19687) (cocos2d#19691) protect empty string (cocos2d#19680) modify engine version (cocos2d#19677) fix Sprite update_blend_func (cocos2d#19649) [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19648) add clang-tidy support (cocos2d#19643) [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19644) add optimization for OPPO. (cocos2d#19631) Optimize cases where loop variable is unecessarily copied in a range-for loop. (cocos2d#19637) # Conflicts: # cocos/physics/CCPhysicsJoint.cpp # cocos/platform/android/javaactivity-android.cpp # cocos/scripting/js-bindings/manual/js_manual_conversions.cpp # cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.cpp # cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp # cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h # cocos/scripting/lua-bindings/proj.android/Android.mk # cocos/scripting/lua-bindings/proj.android/CMakeLists.txt # extensions/Particle3D/PU/CCPURibbonTrailRender.cpp # extensions/Particle3D/PU/CCPUScriptCompiler.cpp # templates/js-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh # templates/js-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro # templates/lua-template-default/CMakeLists.txt # templates/lua-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh # templates/lua-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro # tests/js-tests/project/proj.android/app/get_environment.sh # tests/js-tests/project/proj.android/app/proguard-rules.pro # tests/js-tests/project/proj.ios/Info.plist # tests/lua-empty-test/project/proj.android/app/build.gradle # tests/lua-empty-test/project/proj.android/app/get_environment.sh # tests/lua-empty-test/project/proj.android/app/proguard-rules.pro # tests/lua-empty-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties # tests/lua-game-controller-test/project/proj.android/app/proguard-rules.pro # tests/lua-tests/project/Classes/lua_test_bindings.cpp # tests/lua-tests/project/proj.android/app/proguard-rules.pro # tests/lua-tests/project/proj.ios_mac/ios/Info.plist # tools/cocos2d-console
2 parents 4930d15 + 1528ea0 commit 86a8811

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+367
-64
lines changed

Diff for: .clang-tidy

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
Checks: >
3+
-*,
4+
performance-faster-string-find,
5+
performance-for-range-copy,
6+
7+
WarningsAsErrors: '*'
8+
HeaderFilterRegex: '/(?!external)/.*'
9+
AnalyzeTemporaryDtors: false
10+
FormatStyle: none

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,4 @@ temp/
185185

186186
# external libs zip
187187
*.zip
188+
**/simulator/

Diff for: .travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ matrix:
1111
- secure: M5lyDs0qai15mWHzJdkh0WPfVJJmVZu6SWtYULxatukGPXVwoQvmEtYAwAW+iz6aM+tXksQ/mk6nW5L8UFbHm+n6yrsa5bZU9sGXjilPE8p8bLFYDmIbPRazU+E6pBP3J2CDoAm0XnWkiYQ8feTxKTo6ysLnHAEjyaHTw0+Q1GM=
1212
sudo: required
1313
language: cpp
14+
# clang-tidy
15+
- os: linux
16+
dist: xenial
17+
env: BUILD_TARGET=linux_clang_tidy
18+
language: cpp
19+
sudo: required
1420
# mac_cmake
1521
- os: osx
1622
env: BUILD_TARGET=mac_cmake

Diff for: CHANGELOG

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
cocos2d-x-3.17.2 May.21 2019
2+
3+
[NEW] Network: added clear requests and responses method to httpclient
4+
[NEW] UI: VideoPlayer added ability to enable/disable looping, resonding user input
5+
[NEW] UI: VideoPlayer added function to set style
6+
[NEW] IMEDispacher: added a function to check if any IME dispatcher is active
7+
[NEW] Renderer: add a function to get current clearing color
8+
[NEW] Lua: added binding codes for `EventDispathcer::addCustomEventListener()`
9+
10+
[REFINE] Android: added optimization codes for OPPO devcies
11+
[REFINE] Network: improved websocket traces
12+
[REFINE] Android: supported Android P cutout area
13+
[REFINE] FontAtlas: font atlas texture initialization delayed
14+
[REFINE] LOG: CCLOG may block thread on windows
15+
16+
[FIX] FileUtils:fixed a bug that `listFiles()` can not work correctly if the file path starts with `assets/` on Android
17+
[FIX] AssetsManager: fixed a bug that `_percent` is always be 0 during the update process
18+
[FIX] Texture2D: fixed memory leak if `Texture2D::setAlphaTexture()` is invoked many times
19+
[FIX] FontAtlasCache: avoided crash if a file path is too long
20+
[FIX] Audio: fixed crash on iOS
21+
[FIX] UI: VideoPlayer could not play video in obb file on Android
22+
[FIX] SpriteFrame: fixed performance issue in parsing plist files
23+
[FIX] 3rd: unzip failed to uncompress files
24+
125
cocos2d-x-3.17.1 Nov.19 2018
226

327
[REFINE] Renderer: properly reduce clear buffer times to save energy

Diff for: cocos/2d/CCScene.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ THE SOFTWARE.
3434
#include "base/ccUTF8.h"
3535
#include "renderer/CCRenderer.h"
3636
#include "renderer/CCFrameBuffer.h"
37+
#include "platform/CCDataManager.h"
3738

3839
#if CC_USE_PHYSICS
3940
#include "physics/CCPhysicsWorld.h"
@@ -76,6 +77,19 @@ Scene::Scene()
7677
_event->retain();
7778

7879
Camera::_visitingCamera = nullptr;
80+
81+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
82+
DataManager::onSceneLoaderBegin();
83+
#endif
84+
}
85+
86+
void Scene::onEnter()
87+
{
88+
Node::onEnter();
89+
90+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
91+
DataManager::onSceneLoaderEnd();
92+
#endif
7993
}
8094

8195
Scene::~Scene()

Diff for: cocos/2d/CCScene.h

+9
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ class CC_DLL Scene : public Node
126126
/** override function */
127127
virtual void removeAllChildren() override;
128128

129+
/**
130+
* Event callback that is invoked every time when Node enters the 'stage'.
131+
* If the Node enters the 'stage' with a transition, this event is called when the transition starts.
132+
* During onEnter you can't access a "sister/brother" node.
133+
* If you override onEnter, you shall call its parent's one, e.g., Node::onEnter().
134+
* @lua NA
135+
*/
136+
virtual void onEnter() override;
137+
129138
CC_CONSTRUCTOR_ACCESS:
130139
Scene();
131140
virtual ~Scene();

Diff for: cocos/2d/CCSprite.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,14 @@ void Sprite::setTexture(Texture2D *texture)
403403
}
404404
}
405405

406-
if ((_renderMode != RenderMode::QUAD_BATCHNODE) && (_texture != texture))
406+
if (_renderMode != RenderMode::QUAD_BATCHNODE)
407407
{
408-
CC_SAFE_RETAIN(texture);
409-
CC_SAFE_RELEASE(_texture);
410-
_texture = texture;
408+
if (_texture != texture)
409+
{
410+
CC_SAFE_RETAIN(texture);
411+
CC_SAFE_RELEASE(_texture);
412+
_texture = texture;
413+
}
411414
updateBlendFunc();
412415
}
413416
}

Diff for: cocos/2d/CCSpriteFrameCache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ bool SpriteFrameCache::PlistFramesCache::erasePlistIndex(const std::string &plis
761761
if (it == _indexPlist2Frames.end()) return false;
762762

763763
auto &frames = it->second;
764-
for (auto f : frames)
764+
for (const auto& f : frames)
765765
{
766766
// !!do not!! call `_spriteFrames.erase(f);` to erase SpriteFrame
767767
// only erase index here

Diff for: cocos/2d/CCTMXXMLParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char *name)
756756
}
757757

758758
uint32_t* bufferPtr = reinterpret_cast<uint32_t*>(buffer);
759-
for(auto gidToken : gidTokens) {
759+
for(const auto& gidToken : gidTokens) {
760760
auto tileGid = (uint32_t)strtoul(gidToken.c_str(), nullptr, 10);
761761
*bufferPtr = tileGid;
762762
bufferPtr++;

Diff for: cocos/3d/CCAnimate3D.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ void Animate3D::update(float t)
392392
float prekeyTime = lastTime * getDuration() * _frameRate;
393393
float keyTime = t * getDuration() * _frameRate;
394394
std::vector<Animate3DDisplayedEventInfo*> eventInfos;
395-
for (auto keyFrame : _keyFrameUserInfos)
395+
for (const auto& keyFrame : _keyFrameUserInfos)
396396
{
397397
if ((!_playReverse && keyFrame.first >= prekeyTime && keyFrame.first < keyTime)
398398
|| (_playReverse && keyFrame.first >= keyTime && keyFrame.first < prekeyTime))

Diff for: cocos/3d/CCAnimation3D.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ Animation3D::Animation3D()
8787

8888
Animation3D::~Animation3D()
8989
{
90-
for (auto itor : _boneCurves) {
91-
CC_SAFE_DELETE(itor.second);
90+
for (const auto& itor : _boneCurves) {
91+
Curve* curve = itor.second;
92+
CC_SAFE_DELETE(curve);
9293
}
9394
}
9495

Diff for: cocos/3d/CCBundle3D.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ std::vector<Vec3> Bundle3D::getTrianglesList(const std::string& path)
22102210
Bundle3D::destroyBundle(bundle);
22112211
for (auto iter : meshs.meshDatas){
22122212
int preVertexSize = iter->getPerVertexSize() / sizeof(float);
2213-
for (auto indexArray : iter->subMeshIndices){
2213+
for (const auto& indexArray : iter->subMeshIndices){
22142214
for (auto i : indexArray){
22152215
trianglesList.push_back(Vec3(iter->vertex[i * preVertexSize], iter->vertex[i * preVertexSize + 1], iter->vertex[i * preVertexSize + 2]));
22162216
}

Diff for: cocos/3d/CCSkeleton3D.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void Bone3D::updateLocalMat()
202202
Quaternion quat(Quaternion::ZERO);
203203

204204
float total = 0.f;
205-
for (auto it: _blendStates) {
205+
for (const auto& it: _blendStates) {
206206
total += it.weight;
207207
}
208208
if (total)

Diff for: cocos/3d/CCTerrain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ bool Terrain::Chunk::getIntersectPointWithRay(const Ray& ray, Vec3& intersectPoi
13351335

13361336
float minDist = FLT_MAX;
13371337
bool isFind = false;
1338-
for (auto triangle : _trianglesList)
1338+
for (const auto& triangle : _trianglesList)
13391339
{
13401340
Vec3 p;
13411341
if (triangle.getIntersectPoint(ray, p))

Diff for: cocos/Android.mk

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ cocos2d.cpp \
8989
2d/CCAutoPolygon.cpp \
9090
3d/CCFrustum.cpp \
9191
3d/CCPlane.cpp \
92+
platform/CCDataManager.cpp \
9293
platform/CCFileUtils.cpp \
9394
platform/CCGLView.cpp \
9495
platform/CCImage.cpp \

Diff for: cocos/cocos2d.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ NS_CC_BEGIN
3232

3333
CC_DLL const char* cocos2dVersion()
3434
{
35-
return "cocos2d-x-3.17.1";
35+
return "cocos2d-x-3.17.2";
3636
}
3737

3838
NS_CC_END

Diff for: cocos/cocos2d.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ THE SOFTWARE.
3131

3232
// 0x00 HI ME LO
3333
// 00 03 08 00
34-
#define COCOS2D_VERSION 0x00031701
34+
#define COCOS2D_VERSION 0x00031702
3535

3636
//
3737
// all cocos2d include files

Diff for: cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ ActionTimeline* ActionTimeline::clone() const
176176
newAction->setDuration(_duration);
177177
newAction->setTimeSpeed(_timeSpeed);
178178

179-
for (auto timelines : _timelineMap)
179+
for (const auto& timelines : _timelineMap)
180180
{
181181
for(auto timeline : timelines.second)
182182
{
@@ -185,7 +185,7 @@ ActionTimeline* ActionTimeline::clone() const
185185
}
186186
}
187187

188-
for( auto info : _animationInfos)
188+
for(const auto& info : _animationInfos)
189189
{
190190
newAction->addAnimationInfo(info.second);
191191
}
@@ -416,7 +416,7 @@ void ActionTimeline::emitFrameEndCallFuncs(int frameIndex)
416416
if (clipEndCallsIter != _frameEndCallFuncs.end())
417417
{
418418
auto clipEndCalls = (*clipEndCallsIter).second;
419-
for (auto call : clipEndCalls)
419+
for (const auto& call : clipEndCalls)
420420
(call).second();
421421
}
422422
}

Diff for: cocos/editor-support/cocostudio/CCArmatureDataManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,22 @@ void ArmatureDataManager::removeArmatureFileInfo(const std::string& configFilePa
9595
{
9696
if (RelativeData *data = getRelativeData(configFilePath))
9797
{
98-
for (std::string str : data->armatures)
98+
for (const std::string& str : data->armatures)
9999
{
100100
removeArmatureData(str);
101101
}
102102

103-
for (std::string str : data->animations)
103+
for (const std::string& str : data->animations)
104104
{
105105
removeAnimationData(str);
106106
}
107107

108-
for (std::string str : data->textures)
108+
for (const std::string& str : data->textures)
109109
{
110110
removeTextureData(str);
111111
}
112112

113-
for (std::string str : data->plistFiles)
113+
for (const std::string& str : data->plistFiles)
114114
{
115115
SpriteFrameCacheHelper::getInstance()->removeSpriteFrameFromFile(str);
116116
}

Diff for: cocos/platform/CCDataManager.cpp

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/****************************************************************************
2+
Copyright (c) 2010-2012 cocos2d-x.org
3+
Copyright (c) 2013-2016 Chukong Technologies Inc.
4+
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5+
Copyright (c) 2019 Xiamen Yaji Software Co., Ltd.
6+
7+
http://www.cocos2d-x.org
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
****************************************************************************/
27+
28+
#include "platform/CCDataManager.h"
29+
30+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
31+
# include "platform/android/jni/JniHelper.h"
32+
# define DataManagerClassName "org/cocos2dx/lib/Cocos2dxDataManager"
33+
#endif
34+
35+
NS_CC_BEGIN
36+
37+
void DataManager::setProcessID(int pid){
38+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
39+
JniHelper::callStaticVoidMethod(DataManagerClassName, "setProcessID", pid);
40+
#endif
41+
}
42+
void DataManager::setFrameSize(int width, int height){
43+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
44+
JniHelper::callStaticVoidMethod(DataManagerClassName, "setFrameSize", width, height);
45+
#endif
46+
}
47+
void DataManager::onSceneLoaderBegin(){
48+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
49+
JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderBegin");
50+
#endif
51+
}
52+
void DataManager::onSceneLoaderEnd(){
53+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
54+
JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderEnd");
55+
#endif
56+
}
57+
void DataManager::onShaderLoaderBegin(){
58+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
59+
JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderBegin");
60+
#endif
61+
}
62+
void DataManager::onShaderLoaderEnd(){
63+
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
64+
JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderEnd");
65+
#endif
66+
}
67+
68+
NS_CC_END

Diff for: cocos/platform/CCDataManager.h

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/****************************************************************************
2+
Copyright (c) 2010-2012 cocos2d-x.org
3+
Copyright (c) 2013-2016 Chukong Technologies Inc.
4+
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5+
Copyright (c) 2019 Xiamen Yaji Software Co., Ltd.
6+
7+
http://www.cocos2d-x.org
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
****************************************************************************/
27+
28+
#ifndef __CC_DataManager_H__
29+
#define __CC_DataManager_H__
30+
31+
#include "platform/CCPlatformMacros.h"
32+
#include "base/ccTypes.h"
33+
34+
NS_CC_BEGIN
35+
36+
/**
37+
* @addtogroup platform
38+
* @{
39+
*/
40+
41+
class CC_DLL DataManager
42+
{
43+
public:
44+
static void setProcessID(int pid);
45+
static void setFrameSize(int width, int height);
46+
static void onSceneLoaderBegin();
47+
static void onSceneLoaderEnd();
48+
static void onShaderLoaderBegin();
49+
static void onShaderLoaderEnd();
50+
};
51+
52+
// end of platform group
53+
/** @} */
54+
55+
NS_CC_END
56+
57+
#endif // __CC_DataManager_H__

0 commit comments

Comments
 (0)