Skip to content

Commit

Permalink
Merge commit '1528ea01d2749b4ef65e97f79cffa6135fe13c4d' into scgamex-v3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stevetranby committed Jun 3, 2019
2 parents 4930d15 + 1528ea0 commit 86a8811
Show file tree
Hide file tree
Showing 43 changed files with 367 additions and 64 deletions.
10 changes: 10 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
Checks: >
-*,
performance-faster-string-find,
performance-for-range-copy,
WarningsAsErrors: '*'
HeaderFilterRegex: '/(?!external)/.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,4 @@ temp/

# external libs zip
*.zip
**/simulator/
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ matrix:
- secure: M5lyDs0qai15mWHzJdkh0WPfVJJmVZu6SWtYULxatukGPXVwoQvmEtYAwAW+iz6aM+tXksQ/mk6nW5L8UFbHm+n6yrsa5bZU9sGXjilPE8p8bLFYDmIbPRazU+E6pBP3J2CDoAm0XnWkiYQ8feTxKTo6ysLnHAEjyaHTw0+Q1GM=
sudo: required
language: cpp
# clang-tidy
- os: linux
dist: xenial
env: BUILD_TARGET=linux_clang_tidy
language: cpp
sudo: required
# mac_cmake
- os: osx
env: BUILD_TARGET=mac_cmake
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
cocos2d-x-3.17.2 May.21 2019

[NEW] Network: added clear requests and responses method to httpclient
[NEW] UI: VideoPlayer added ability to enable/disable looping, resonding user input
[NEW] UI: VideoPlayer added function to set style
[NEW] IMEDispacher: added a function to check if any IME dispatcher is active
[NEW] Renderer: add a function to get current clearing color
[NEW] Lua: added binding codes for `EventDispathcer::addCustomEventListener()`

[REFINE] Android: added optimization codes for OPPO devcies
[REFINE] Network: improved websocket traces
[REFINE] Android: supported Android P cutout area
[REFINE] FontAtlas: font atlas texture initialization delayed
[REFINE] LOG: CCLOG may block thread on windows

[FIX] FileUtils:fixed a bug that `listFiles()` can not work correctly if the file path starts with `assets/` on Android
[FIX] AssetsManager: fixed a bug that `_percent` is always be 0 during the update process
[FIX] Texture2D: fixed memory leak if `Texture2D::setAlphaTexture()` is invoked many times
[FIX] FontAtlasCache: avoided crash if a file path is too long
[FIX] Audio: fixed crash on iOS
[FIX] UI: VideoPlayer could not play video in obb file on Android
[FIX] SpriteFrame: fixed performance issue in parsing plist files
[FIX] 3rd: unzip failed to uncompress files

cocos2d-x-3.17.1 Nov.19 2018

[REFINE] Renderer: properly reduce clear buffer times to save energy
Expand Down
14 changes: 14 additions & 0 deletions cocos/2d/CCScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ THE SOFTWARE.
#include "base/ccUTF8.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCFrameBuffer.h"
#include "platform/CCDataManager.h"

#if CC_USE_PHYSICS
#include "physics/CCPhysicsWorld.h"
Expand Down Expand Up @@ -76,6 +77,19 @@ Scene::Scene()
_event->retain();

Camera::_visitingCamera = nullptr;

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
DataManager::onSceneLoaderBegin();
#endif
}

void Scene::onEnter()
{
Node::onEnter();

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
DataManager::onSceneLoaderEnd();
#endif
}

Scene::~Scene()
Expand Down
9 changes: 9 additions & 0 deletions cocos/2d/CCScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ class CC_DLL Scene : public Node
/** override function */
virtual void removeAllChildren() override;

/**
* Event callback that is invoked every time when Node enters the 'stage'.
* If the Node enters the 'stage' with a transition, this event is called when the transition starts.
* During onEnter you can't access a "sister/brother" node.
* If you override onEnter, you shall call its parent's one, e.g., Node::onEnter().
* @lua NA
*/
virtual void onEnter() override;

CC_CONSTRUCTOR_ACCESS:
Scene();
virtual ~Scene();
Expand Down
11 changes: 7 additions & 4 deletions cocos/2d/CCSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,14 @@ void Sprite::setTexture(Texture2D *texture)
}
}

if ((_renderMode != RenderMode::QUAD_BATCHNODE) && (_texture != texture))
if (_renderMode != RenderMode::QUAD_BATCHNODE)
{
CC_SAFE_RETAIN(texture);
CC_SAFE_RELEASE(_texture);
_texture = texture;
if (_texture != texture)
{
CC_SAFE_RETAIN(texture);
CC_SAFE_RELEASE(_texture);
_texture = texture;
}
updateBlendFunc();
}
}
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCSpriteFrameCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ bool SpriteFrameCache::PlistFramesCache::erasePlistIndex(const std::string &plis
if (it == _indexPlist2Frames.end()) return false;

auto &frames = it->second;
for (auto f : frames)
for (const auto& f : frames)
{
// !!do not!! call `_spriteFrames.erase(f);` to erase SpriteFrame
// only erase index here
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCTMXXMLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char *name)
}

uint32_t* bufferPtr = reinterpret_cast<uint32_t*>(buffer);
for(auto gidToken : gidTokens) {
for(const auto& gidToken : gidTokens) {
auto tileGid = (uint32_t)strtoul(gidToken.c_str(), nullptr, 10);
*bufferPtr = tileGid;
bufferPtr++;
Expand Down
2 changes: 1 addition & 1 deletion cocos/3d/CCAnimate3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ void Animate3D::update(float t)
float prekeyTime = lastTime * getDuration() * _frameRate;
float keyTime = t * getDuration() * _frameRate;
std::vector<Animate3DDisplayedEventInfo*> eventInfos;
for (auto keyFrame : _keyFrameUserInfos)
for (const auto& keyFrame : _keyFrameUserInfos)
{
if ((!_playReverse && keyFrame.first >= prekeyTime && keyFrame.first < keyTime)
|| (_playReverse && keyFrame.first >= keyTime && keyFrame.first < prekeyTime))
Expand Down
5 changes: 3 additions & 2 deletions cocos/3d/CCAnimation3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ Animation3D::Animation3D()

Animation3D::~Animation3D()
{
for (auto itor : _boneCurves) {
CC_SAFE_DELETE(itor.second);
for (const auto& itor : _boneCurves) {
Curve* curve = itor.second;
CC_SAFE_DELETE(curve);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/3d/CCBundle3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,7 @@ std::vector<Vec3> Bundle3D::getTrianglesList(const std::string& path)
Bundle3D::destroyBundle(bundle);
for (auto iter : meshs.meshDatas){
int preVertexSize = iter->getPerVertexSize() / sizeof(float);
for (auto indexArray : iter->subMeshIndices){
for (const auto& indexArray : iter->subMeshIndices){
for (auto i : indexArray){
trianglesList.push_back(Vec3(iter->vertex[i * preVertexSize], iter->vertex[i * preVertexSize + 1], iter->vertex[i * preVertexSize + 2]));
}
Expand Down
2 changes: 1 addition & 1 deletion cocos/3d/CCSkeleton3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void Bone3D::updateLocalMat()
Quaternion quat(Quaternion::ZERO);

float total = 0.f;
for (auto it: _blendStates) {
for (const auto& it: _blendStates) {
total += it.weight;
}
if (total)
Expand Down
2 changes: 1 addition & 1 deletion cocos/3d/CCTerrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ bool Terrain::Chunk::getIntersectPointWithRay(const Ray& ray, Vec3& intersectPoi

float minDist = FLT_MAX;
bool isFind = false;
for (auto triangle : _trianglesList)
for (const auto& triangle : _trianglesList)
{
Vec3 p;
if (triangle.getIntersectPoint(ray, p))
Expand Down
1 change: 1 addition & 0 deletions cocos/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ cocos2d.cpp \
2d/CCAutoPolygon.cpp \
3d/CCFrustum.cpp \
3d/CCPlane.cpp \
platform/CCDataManager.cpp \
platform/CCFileUtils.cpp \
platform/CCGLView.cpp \
platform/CCImage.cpp \
Expand Down
2 changes: 1 addition & 1 deletion cocos/cocos2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NS_CC_BEGIN

CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x-3.17.1";
return "cocos2d-x-3.17.2";
}

NS_CC_END
Expand Down
2 changes: 1 addition & 1 deletion cocos/cocos2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ THE SOFTWARE.

// 0x00 HI ME LO
// 00 03 08 00
#define COCOS2D_VERSION 0x00031701
#define COCOS2D_VERSION 0x00031702

//
// all cocos2d include files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ActionTimeline* ActionTimeline::clone() const
newAction->setDuration(_duration);
newAction->setTimeSpeed(_timeSpeed);

for (auto timelines : _timelineMap)
for (const auto& timelines : _timelineMap)
{
for(auto timeline : timelines.second)
{
Expand All @@ -185,7 +185,7 @@ ActionTimeline* ActionTimeline::clone() const
}
}

for( auto info : _animationInfos)
for(const auto& info : _animationInfos)
{
newAction->addAnimationInfo(info.second);
}
Expand Down Expand Up @@ -416,7 +416,7 @@ void ActionTimeline::emitFrameEndCallFuncs(int frameIndex)
if (clipEndCallsIter != _frameEndCallFuncs.end())
{
auto clipEndCalls = (*clipEndCallsIter).second;
for (auto call : clipEndCalls)
for (const auto& call : clipEndCalls)
(call).second();
}
}
Expand Down
8 changes: 4 additions & 4 deletions cocos/editor-support/cocostudio/CCArmatureDataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ void ArmatureDataManager::removeArmatureFileInfo(const std::string& configFilePa
{
if (RelativeData *data = getRelativeData(configFilePath))
{
for (std::string str : data->armatures)
for (const std::string& str : data->armatures)
{
removeArmatureData(str);
}

for (std::string str : data->animations)
for (const std::string& str : data->animations)
{
removeAnimationData(str);
}

for (std::string str : data->textures)
for (const std::string& str : data->textures)
{
removeTextureData(str);
}

for (std::string str : data->plistFiles)
for (const std::string& str : data->plistFiles)
{
SpriteFrameCacheHelper::getInstance()->removeSpriteFrameFromFile(str);
}
Expand Down
68 changes: 68 additions & 0 deletions cocos/platform/CCDataManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#include "platform/CCDataManager.h"

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
# include "platform/android/jni/JniHelper.h"
# define DataManagerClassName "org/cocos2dx/lib/Cocos2dxDataManager"
#endif

NS_CC_BEGIN

void DataManager::setProcessID(int pid){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "setProcessID", pid);
#endif
}
void DataManager::setFrameSize(int width, int height){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "setFrameSize", width, height);
#endif
}
void DataManager::onSceneLoaderBegin(){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderBegin");
#endif
}
void DataManager::onSceneLoaderEnd(){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderEnd");
#endif
}
void DataManager::onShaderLoaderBegin(){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderBegin");
#endif
}
void DataManager::onShaderLoaderEnd(){
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderEnd");
#endif
}

NS_CC_END
57 changes: 57 additions & 0 deletions cocos/platform/CCDataManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

#ifndef __CC_DataManager_H__
#define __CC_DataManager_H__

#include "platform/CCPlatformMacros.h"
#include "base/ccTypes.h"

NS_CC_BEGIN

/**
* @addtogroup platform
* @{
*/

class CC_DLL DataManager
{
public:
static void setProcessID(int pid);
static void setFrameSize(int width, int height);
static void onSceneLoaderBegin();
static void onSceneLoaderEnd();
static void onShaderLoaderBegin();
static void onShaderLoaderEnd();
};

// end of platform group
/** @} */

NS_CC_END

#endif // __CC_DataManager_H__
Loading

0 comments on commit 86a8811

Please sign in to comment.