Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jamespaperboatapps/cocos2dx #20609

Open
wants to merge 9 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ temp/

# external libs zip
*.zip
**/simulator/
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
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
2 changes: 1 addition & 1 deletion cocos/platform/CCFileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ std::vector<std::string> FileUtils::listFiles(const std::string& dirPath) const
{
std::vector<std::string> files;
std::string fullpath = fullPathForDirectory(dirPath);
if (isDirectoryExist(fullpath))
if (!fullpath.empty() && isDirectoryExist(fullpath))
{
tinydir_dir dir;
std::string fullpathstr = fullpath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
****************************************************************************/


#include "scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h"
#include "scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h"

#include <android/log.h>

Expand Down
2 changes: 1 addition & 1 deletion cocos/scripting/lua-bindings/proj.android/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LOCAL_MODULE_FILENAME := libluaccandroid
LOCAL_ARM_MODE := arm

LOCAL_SRC_FILES := ../manual/platform/android/CCLuaJavaBridge.cpp \
../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
../manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. \
$(LOCAL_PATH)/../manual \
Expand Down
2 changes: 1 addition & 1 deletion cocos/scripting/lua-bindings/proj.android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(${target_name})

set(${target_name}_src
../manual/platform/android/CCLuaJavaBridge.cpp
../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp
../manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp
)

add_library(${target_name} STATIC
Expand Down
22 changes: 8 additions & 14 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Cocos2d-x 3.17.1 Release Notes](#cocos2d-x-3171-release-notes)
- [Cocos2d-x 3.17.2 Release Notes](#cocos2d-x-3172-release-notes)
- [Highlights](#highlights)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Cocos2d-x 3.17.1 Release Notes #
# Cocos2d-x 3.17.2 Release Notes #

The 3.17.1 release focuses on bug fixing.
Version 3.17.2 focuses on bugs fixing and performance opimization on OPPO devices.

## Highlights

- Fix Lua loading performance drop bug introduced in 3.17
- Renderer limit glClear invoke times, reduce power consuming
- optimize CMake script,fix some linking issues
- Android use CMake as default PROP_BUILD_TYPE value
- Android upgrade Gradle to 4.6, SDK 28, android gradle plugin 3.1.0
- upgrade LuaJIT to 2.1.0-beta3, fix random crash in 3.17 Lua release mode
- upgrade libwebsockets to 2.4.2
- FileUtils provide thread-safe implementation and add missing cross-platform interfaces
- limit Labels text length to fix render error
- add Downloader binding to Lua
- Performance optimization on OPPO devices
- Fixed bug that`FileUtils::listFiles()` can not work correctly if the file path starts with `assets/` on Android
- Fixed crash caused by Audio on iOS
- Fixed bug that `VideoPlayer` can not play video in obb file on Android

This release contains more than 45 bugs fixed and 34 misc improvements, please refer to [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
More detail change log please refer to [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG).
22 changes: 8 additions & 14 deletions docs/RELEASE_NOTES_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Cocos2d-x 3.17.1 Release Notes](#cocos2d-x-3171-release-notes)
- [Cocos2d-x 3.17.2 Release Notes](#cocos2d-x-3172-release-notes)
- [版本变动](#%E7%89%88%E6%9C%AC%E5%8F%98%E5%8A%A8)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Cocos2d-x 3.17.1 Release Notes #
# Cocos2d-x 3.17.2 Release Notes #

Cocos2d-x 3.17.1 侧重于稳定性的提升, 已有问题的修复
Cocos2d-x 3.17.2 侧重于稳定性的提升, 已有问题的修复和针对 OPPO 手机的性能优化

## 版本变动

- 修复 3.17 引入的 Lua 加载性能下降的 BUG
- 减少渲染中 glClear 的调用次数,降低电量消耗
- CMake 脚本优化,解决存在的链接问题
- Android 默认启用 CMake 方式编译
- Android 升级 Gradle 到 4.6, SDK 28, plugin 3.1.0
- 升级 LuaJIT 到 2.1.0-beta3,修复 3.17 Lua 项目的闪退问题
- 升级 libwebsockets 到 2.4.2
- FileUtils 内部加锁,增加线程安全,完善接口实现
- 限制 Label 长度,避免绘制错误
- 增加 Downloader 的 Lua 绑定
- 针对 OPPO 手机的性能优化
- 修复 bug:在安卓设备,当文件路径开头为 `assets/` 时, `FileUtils::listFiles()` 无法正常工作
- 修复了 Audio 在 iOS 设备上的崩溃问题
- 修复了在安卓设备, `VideoPlayer` 无法播放 OBB 包里的视频文件的问题

当前版本包含 45 项 bugs 修复和 34 项小改进,不再列举,请参考 [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)。
详细的改动请参考 [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)。
2 changes: 1 addition & 1 deletion docs/doxygen.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = Cocos2d-x
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v3.17.1
PROJECT_NUMBER = v3.17.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions templates/cocos2dx_files.json
Original file line number Diff line number Diff line change
Expand Up @@ -5517,8 +5517,8 @@
"cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.h",
"cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp",
"cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h",
"cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp",
"cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h",
"cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp",
"cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h",
"cocos/scripting/lua-bindings/manual/platform/ios/CCLuaObjcBridge.h",
"cocos/scripting/lua-bindings/manual/platform/ios/CCLuaObjcBridge.mm",
"cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
5 changes: 0 additions & 5 deletions templates/lua-template-default/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ set(res_res_folders
set(res_src_folders
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
set(res_script_folders
"${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/script"
)
if(APPLE OR VS)
cocos_mark_multi_resources(res_res RES_TO "Resources/res" FOLDERS ${res_res_folders})
cocos_mark_multi_resources(res_src RES_TO "Resources/src" FOLDERS ${res_src_folders})
cocos_mark_multi_resources(res_script RES_TO "Resources/src/cocos" FOLDERS ${res_script_folders})
set(cc_common_res ${res_res} ${res_src} ${res_script})
endif()

Expand Down Expand Up @@ -171,5 +167,4 @@ if(LINUX OR WINDOWS)
set(APP_RES_DIR "$<TARGET_FILE_DIR:${APP_NAME}>/Resources")
cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders})
cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders})
endif()
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ void TestIsFileExistRejectFolder::onEnter()
auto isDirectory = FileUtils::getInstance()->isDirectoryExist("NavMesh/maps");

char cntBuffer[200] = { 0 };
snprintf(cntBuffer, 200, "isDir: %s, isFile: %s, %s", isDirectory ? "true": "false" , exists ? "true" : "false", exists ? "failure!" : "ok!" );
snprintf(cntBuffer, 200, "isDir: %s, isFile: %s", isDirectory ? "true": "false" , exists ? "true" : "false");
cntLabel->setString(cntBuffer);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,16 @@ void SpritePolygonTestSlider::initSliders()
slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
slider->loadProgressBarTexture("cocosui/sliderProgress.png");
slider->setPosition(Vec2(vsize.width/2, vsize.height/4));

slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this));
slider->setPercent((int)(sqrtf(1.0f/19.0f)*100));


auto ttfConfig = TTFConfig("fonts/arial.ttf", 8);
_epsilonLabel = Label::createWithTTF(ttfConfig, "Epsilon: 2.0");
addChild(_epsilonLabel);
_epsilonLabel->setPosition(Vec2(vsize.width/2, vsize.height/4 + 15));
addChild(slider);

slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this));
slider->setPercent((int)(sqrtf(1.0f/19.0f)*100));

}

void SpritePolygonTestSlider::makeSprites(const std::string* list, const int count, const float y)
Expand Down
22 changes: 19 additions & 3 deletions tests/cpp-tests/proj.ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,28 @@
</dict>
<key>UIAppFonts</key>
<array>
<string>fonts/A Damn Mess.ttf</string>
<string>fonts/Abberancy.ttf</string>
<string>fonts/American Typewriter.ttf</string>
<string>fonts/Abduction.ttf</string>
<string>fonts/ThonburiBold.ttf</string>
<string>fonts/Fingerpop.ttf</string>
<string>fonts/Paint Boy.ttf</string>
<string>fonts/Schwarzwald.ttf</string>
<string>fonts/A Damn Mess.ttf</string>
<string>fonts/Schwarzwald Regular.ttf</string>
<string>fonts/Courier New.ttf</string>
<string>fonts/Japanese.ttf</string>
<string>fonts/xingkai-incomplete.ttf</string>
<string>fonts/arial.ttf</string>
<string>fonts/Scissor Cuts.ttf</string>
<string>fonts/FingerpopGap.ttf</string>
<string>fonts/NotoEmoji-Regular.ttf</string>
<string>fonts/Marker Felt.ttf</string>
<string>fonts/Schwarzwald.ttf</string>
<string>fonts/cyril.ttf</string>
<string>fonts/tahoma.ttf</string>
<string>fonts/HKYuanMini.ttf</string>
<string>fonts/cyrillic.ttf</string>
<string>fonts/Abberancy.ttf</string>
<string>fonts/Thonburi.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
Expand Down
11 changes: 9 additions & 2 deletions tests/js-tests/project/proj.android/app/get_environment.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
24 changes: 18 additions & 6 deletions tests/js-tests/project/proj.ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,30 @@
</dict>
<key>UIAppFonts</key>
<array>
<string>res/fonts/A Damn Mess.ttf</string>
<string>res/fonts/Abberancy.ttf</string>
<string>res/fonts/Abduction.ttf</string>
<string>res/ccb/comic andy.ttf</string>
<string>res/fonts/American Typewriter.ttf</string>
<string>res/fonts/Courier New.ttf</string>
<string>res/fonts/Marker Felt.ttf</string>
<string>res/fonts/Abduction.ttf</string>
<string>res/fonts/ThonburiBold.ttf</string>
<string>res/fonts/Fingerpop.ttf</string>
<string>res/fonts/Paint Boy.ttf</string>
<string>res/fonts/A Damn Mess.ttf</string>
<string>res/fonts/Schwarzwald Regular.ttf</string>
<string>res/fonts/Courier New.ttf</string>
<string>res/fonts/Japanese.ttf</string>
<string>res/fonts/xingkai-incomplete.ttf</string>
<string>res/fonts/arial.ttf</string>
<string>res/fonts/Scissor Cuts.ttf</string>
<string>res/fonts/FingerpopGap.ttf</string>
<string>res/fonts/NotoEmoji-Regular.ttf</string>
<string>res/fonts/Marker Felt.ttf</string>
<string>res/fonts/Schwarzwald.ttf</string>
<string>res/fonts/cyril.ttf</string>
<string>res/fonts/tahoma.ttf</string>
<string>res/fonts/HKYuanMini.ttf</string>
<string>res/fonts/cyrillic.ttf</string>
<string>res/fonts/Abberancy.ttf</string>
<string>res/fonts/Thonburi.ttf</string>
<string>res/fonts/ThonburiBold.ttf</string>
<string>res/resjs/ccb/comic andy.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
Expand Down
10 changes: 9 additions & 1 deletion tests/lua-empty-test/project/proj.android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,19 @@ def getCocosCommandPath() {
return 'cocos.bat'
}
else {

def env_console_path = System.getenv("COCOS_CONSOLE_ROOT")

if (env_console_path != null && !env_console_path.trim().isEmpty()) {
return new File(env_console_path.trim() + '/cocos').absolutePath
}

// on unix like system, can not get environments variables easily
// so run a shell script to get environment variable sets by cocos2d-x setup.py
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = project.file('get_environment.sh')
executable = "/bin/bash"
args = [ "-i", project.file('get_environment.sh')]
standardOutput = os
}
ext.console_path = os.toString().trim()
Expand Down
11 changes: 9 additions & 2 deletions tests/lua-empty-test/project/proj.android/app/get_environment.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

source ~/.bash_profile
echo $COCOS_CONSOLE_ROOT
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi

if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile
fi

echo $COCOS_CONSOLE_ROOT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 14 17:47:54 CST 2017
#Fri May 10 15:15:29 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Loading