Skip to content
Merged
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
103 changes: 103 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,106 @@
cocos2d-x-3.17 May.21 2018

[HIGHLIGHT] Android: support Android Studio 3.0, NDK 16
[HIGHLIGHT] iOS: support full screen for iPhone X and uses Storyboard for launch screen
[HIGHLIGHT] 3rd: upgrade Spine runtime to v3.6.39
[HIGHLIGHT] 3rd: upgrade GLFW to 3.2.1
[HIGHLIGHT] CMake support all platforms, and support prebuilt engine libs

[NEW] Engine: multisampling support
[NEW] Label: support non-breaking characters
[NEW] Label: support belarusian language
[NEW] UI: add blend function for Text
[NEW] UI: add ScrollView API to stop overall scroll
[NEW] iOS: add auto hide home indicator for iPhone X
[NEW] iOS: provides an interface for getting SafeArea
[NEW] Andorid: add one more android return button types

[REFINE] Engine: support reading object.rotation attribute in TMX
[REFINE] Engine: make the sort behavior is same on 32bit and 64bit
[REFINE] Engine: static analize fixes
[REFINE] Engine: improve comments in ccConfig.h, JniHelper.h
[REFINE] Engine: remove plugin submodule
[REFINE] Engine: improve StringUtils::format implementation
[REFINE] Label: don't count spaces at the end of line as part of the line width
[REFENE] UI: partial cursor support with system font in TextField
[REFINE] UI: support BMFont in TextField
[REFINE] UI: improve EditBox on win32 platform
[REFINE] UI: RichText improvements, get the real height by automatically customize ContentSize, refactor split algorithm
[REFINE] UI: remove autorelease mark from UIWebViewWrapper and manage memory manually
[REFINE] Lua: implementation conversion Lua table to ObjC Dictionary
[REFINE] Lua: improve loader, support standerd Lua package require
[REFINE] Web: upgrade Spine Javascript runtime to v3.6.39
[REFINE] Windows: speed up build by supporting precompiled header
[REFINE] Windows: remove Visual Studio 2013 support
[REFINE] Windows: Windows 10 update compiler to PlatformToolset v141
[REFINE] iOS: uses Images.xcassets instead of several icon png files
[REFINE] Android: support Android Studio 3.0.0, switch to libc++, simplify PROP_* valuse, add default Proguard Config for cocos
[REFINE] Android: remove ant project
[REFINE] Android: update NDK from r14 to r16
[REFINE] Andorid: improve Android.mk, not have to set NDK_MODULE_PATH in project settings
[REFINE] Android: detail comments for cddandroidAndroidJavaEngine.h, Cocos2dxSound.java
[REFINE] Linux: provide prebuilt version of GLFW
[REFINE] cocos console: remove ant build support
[REFINE] cocos console: support building release APK without key information
[REFINE] 3rd: remove Visual Studio 2013 libs
[REFINE] 3rd: remove Android armeabi libs since it is deprecated and will be removed in r17
[REFINE] 3rd: rebuild all Android libs with clang in ndk-r16
[REFINE] 3rd: cmake build support for partial libs
[REFENE] 3rd: update Box2D to latest commit f655c603ba9d83
[REFINE] 3rd: use prebuilt Box2D

[FIX] Engine: capture image loses quality when using RenderTexture
[FIX] Engine: RenderTexture DepthAndStencil issue on Android
[FIX] Engine: race condition resulting in deadlock infrequently in TextureCache
[FIX] Engine: CCConsole.cpp compile error with C++17 and clang
[FIX] Engine: TrianglesCommand hashing technique doesn't take padding into account
[FIX] Engine: default GLView bit depth is too low on desktop
[FIX] Engine: cocos2d::log va_list re-use bug
[FIX] Engine: cocos2d::Image::saveImageToPNG saves image in wrong PNG format
[FIX] Engine: CameraBackgroundColorBrush cannot use alpha
[FIX] Engine: crash in Allocator if there are no allocated pages
[FIX] Engine: crash when the UserDefault.xml file is empty
[FIX] Engine: memory leak in ObjectFactory destroyInstance, UserDefault::deleteValueForKey
[FIX] Engine: replace ptr_fun with lambda, fix compile error with C++17 and clang
[FIX] Engine: fix some warning issues
[FIX] Label: memory leak when using TTF labels
[FIX] Label: memory leak in FontFreeType::create
[FIX] Label: Non-TTF Label Shadow issue, make it follow Label opacity
[FIX] UI: RichText issue caused by Label when its string is very long
[FIX] UI: EditBox right padding error
[FIX] UI: win32 EditBox has wrong scale factor
[FIX] UI: TableView button click event not response when the button is a cell
[FIX] UI: correct bugs with cursor in TextField
[FIX] UI: Android EditBox use 'setSelection' error when the text beyond the border
[FIX] UI: iOS EditBox will penetrate the underlying UI event
[FIX] UI: use setTextColor for EditBox placeholder
[FIX] UI: returning UNKNOWN event for return type key SEARCH/SEND in EditBox
[FIX] UI: crash when call TextFieldTTF::setCursorFromPoint
[FIX] UI: ListView, avoid of type overflow while list size calculation
[FIX] Audio: miss return value of onWavClose function
[FIX] Audio: wrong header include in mp3reader.cpp, apple/AudioEngine-inl.h
[FIX] Audio: wrong status check in apple/AudioDecoder.mm
[FIX] Lua: should set listener to null when unregister spine event handler
[FIX] Lua: event condition bugs on ParticleTest.lua
[FIX] JSB: some memory leaks and crashes
[FIX] JSB: miss GetterSetter define for the placeHolder of TextField
[FIX] Web: out-of-date submodule commmit of cocos2d-html5 repo
[FIX] Web: bugs for Performance Test for Spine on WebGL
[FIX] iOS: fix bug about delayed creation UIWebView on iOS
[FIX] Andorid: infinite loop when counting text lines on Android in some situations
[FIX] Android: crash when network error message is too long
[FIX] Android: JniHelper no longer thread safe
[FIX] Android: proguard-rules.pro error for tests project
[FIX] Andorid: some violations about I/O operation on UI thread, which may lead to ANR
[FIX] Android: AppAcitivity is recreated which causes crash
[FIX] Android: Emulator blank screen 0x501 and 0x502 problems
[FIX] Android: Emulator stensil fix
[FIX] Android: Fix endian detection (node render order)
[FIX] Android: issue with not stable 60 fps
[FIX] Android: issue with accelerometer on Android on reverse landscape/portrait
[FIX] WinRT: fix keyBoard bug when input chinese
[FIX] cocos console: fix archive issue with Xcode 9

cocos2d-x-3.16 Oct.9 2017
[NEW] Add RadialGradientLayer
[NEW] Web: Add GLProgramState and upgrade web shader usage APIs
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ Cocos2d-x supports CMake, a cross-platform build system. Example usage:
$ mkdir cmake-build && cd cmake-build
$ cmake ..

* [Detail CMake Guide](cmake/README.md)

Documentations and samples
-------------
* [All Docs in a single place!](http://cocos2d-x.org/docs/)
Expand Down Expand Up @@ -163,17 +165,17 @@ Build Requirements
------------------

* Mac OS X 10.7+, Xcode 8+
* or Ubuntu 12.10+, CMake 2.6+
* or Ubuntu 14.04+, CMake 3.1+
* or Windows 7+, VS 2015
* Python 2.7.5
* Python 2.7.5+(NOT Python 3)
* NDK r16+ is required to build Android games
* Android Studio 2.3.3+ to build Android games(tested with 2.3.3)
* Android Studio 3.0.0+ to build Android games(tested with 3.0.0)
* JRE or JDK 1.6+ is required for web publishing

Runtime Requirements
--------------------
* iOS 8.0+ for iPhone / iPad games
* Android 2.3.3+ for Android
* Android 3.0.0+ for Android
* OS X v10.9+ for Mac games
* Windows 7+ for Win games
* Modern browsers and IE 9+ for web games
Expand Down Expand Up @@ -210,20 +212,20 @@ $ open cocos2d_tests.xcodeproj
```
$ cd cocos2d-x/build
$ ./install-deps-linux.sh
$ cmake ..
$ make
$ mkdir linux-build
$ cd linux-build
$ cmake ../..
```

Run Samples

```
$ bin/cpp-empty-test/cpp-empty-test
$ bin/Debug/cpp-empty-test/cpp-empty-test
or
$ bin/lua-empty-test/lua-empty-test
$ bin/Debug/lua-empty-test/lua-empty-test
```

You may meet building errors when building libGLFW.so. It is because libGL.so directs to an error target,
you should make it to direct to a correct one. `install-deps-linux.sh` only has to be run once.
> You may meet building errors when building libGLFW.so. It is because libGL.so directs to an error target, you should make it to direct to a correct one. `install-deps-linux.sh` only has to be run once.

* For Windows

Expand All @@ -239,7 +241,7 @@ $ adb install ../tests/cpp-empty-test/proj.android/bin/CppEmptyTest-debug.apk

Then click item on Android device to run tests. Available value of `-p` is the API level, cocos2d-x supports from level 14.

* [Detail CMake Guide](cmake/README.md)
Or you can import the project located at `tests/cpp-empty-test/proj.android` using Android Studio 3.0.0+.

Learning Resources
--------------------------------
Expand Down Expand Up @@ -269,15 +271,16 @@ You can see exactly what we are planning to do with the Cocos family of products
Where to get help
--------------------------------

* [Forums](http://discuss.cocos2d-x.org)
* [English Forums](http://discuss.cocos2d-x.org)
* [中文社区](http://forum.cocos.com/c/cocos2d-x)
* [Bug Tracker](https://github.com/cocos2d/cocos2d-x/issues)
* [API Reference](http://cocos2d-x.org/docs/api-ref/index.html).
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
* IRC. We are in [Freenode](https://webchat.freenode.net/) in the _#cocos2d_ channel
* `cpp-tests` project. This project is our basis for testing. Use this project to
learn how we implement the functionality of the engine. This project is located in
__cocos2d-x_root/build.__
* [API Reference](http://cocos2d-x.org/docs/api-ref/index.html).
* [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md)
* [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)

Contributing to the Project
--------------------------------
Expand Down
1 change: 1 addition & 0 deletions cmake/Modules/CocosPickLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ foreach(_lib ${all_prebuilt_libs})
endif(EXISTS ${_dir})
endforeach()
if(include_dirs)
list(REMOVE_DUPLICATES include_dirs)
set(${_prefix}_INCLUDE_DIRS ${include_dirs} CACHE PATH "Path to includes for ${_prefix}" FORCE)
message(STATUS "${_lib} ${_prefix}_INCLUDE_DIRS: ${${_prefix}_INCLUDE_DIRS}")
# don't find lib, if not find include in once ${_root} search
Expand Down
7 changes: 4 additions & 3 deletions cmake/Modules/CocosUseLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ macro(cocos2d_depend_libs)
set(PREBUILT_SPECIFIC_LIBS)

if(WINDOWS)
foreach(_pkg OPENGL GLEW GLFW3 VORBIS MPG123 OPENAL)
foreach(_pkg OPENGL GLEW GLFW3 VORBIS MPG123 OPENAL SQLITE3)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 winmm Version Iphlpapi)
Expand All @@ -15,7 +15,7 @@ macro(cocos2d_depend_libs)
elseif(LINUX)
# need review those libs: X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m
list(APPEND PLATFORM_SPECIFIC_LIBS dl X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m)
foreach(_pkg OPENGL GLEW GLFW3 FMOD FONTCONFIG THREADS GTK3)
foreach(_pkg OPENGL GLEW GLFW3 FMOD FONTCONFIG THREADS GTK3 SQLITE3)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()
elseif(ANDROID)
Expand Down Expand Up @@ -77,7 +77,7 @@ macro(cocos2d_depend_libs)
endif()
endif()

foreach(_pkg ZLIB MINIZIP TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS XXHASH SQLITE3)
foreach(_pkg ZLIB MINIZIP TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS XXHASH)
list(APPEND PREBUILT_SPECIFIC_LIBS ${_pkg})
endforeach()

Expand Down Expand Up @@ -166,6 +166,7 @@ macro(jscocos2d_depend_libs)
if(APPLE)
find_library(GAME_CONTROLLER GameController)
list(APPEND PLATFORM_SPECIFIC_LIBS ${GAME_CONTROLLER})
list(APPEND PREBUILT_SPECIFIC_LIBS SQLITE3)
endif()
endmacro()

Expand Down
42 changes: 23 additions & 19 deletions cmake/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@

# CMake Guide

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice.
CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generates native makefiles and workspaces that can be used in the compiler environment of your choice.

## Requirement

1. Open your terminal, input `cmake --version`, if the cmake version is lower than 3.1, please upgrade
1. Open your terminal and execute:
```sh
cmake --version
```
if the CMake version is lower than 3.1, please upgrade.

2. You should use out-of-source build, that is said you need to create a different directory from `cocos2d-x` to execute cmake command.
2. You should use __out-of-source__ builds, this means you need to create a different directory than __cocos2d-x__ to execute the `cmake` command.

## Step by Step

### Build in Linux
### Linux

```sh
cd cocos2d-x
Expand All @@ -22,15 +25,15 @@ make

Execute `make help` to see all build targets, `make <target>` build specified target

### Generate Visual Studio project
### Generate Visual Studio projects

```sh
cd cocos2d-x
mkdir win32-build && cd win32-build
cmake .. -G"Visual Studio 15 2017" -Tv141
```

Execute `cmake --build .` to compile, or open `Cocos2d-x.sln` in Explorer to use the generated project.
Execute `cmake --build .` to compile, or open __Cocos2d-x.sln__ in Explorer to use the generated project.

### Generate macOS Project

Expand All @@ -50,11 +53,11 @@ cmake .. -GXcode -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.toolchain.cmake
open Cocos2d-x.xcodeproj
```

The default build is for iOS device, if you want to run on simulator, please add `-DIOS_PLATFORM=SIMULATOR` for architecture i386 or `-DIOS_PLATFORM=SIMULATOR64` for x86_64.
The default build is for running on actual iOS hardware, if you want to run in the simulator, please add `-DIOS_PLATFORM=SIMULATOR` for architecture i386 or `-DIOS_PLATFORM=SIMULATOR64` for x86_64.

### CMake in Android Studio
### Android Studio

We use the Gradle to Android applacition, and Gradle use cmake to build the native code, see the [property](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/gradle.properties#L38): `PROP_NDK_MODE`, it control the way of native build
We use the Gradle for Android applications, and Gradle use cmake to build the native code, see [gradle.properties](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/gradle.properties#L38): `PROP_NDK_MODE`, it controls how native builds work.

```sh
# android native code build type
Expand All @@ -64,15 +67,15 @@ We use the Gradle to Android applacition, and Gradle use cmake to build the nati
PROP_BUILD_TYPE=ndk-build
```

If you want to add cmake build arguments, please add it at [externalNativeBuild](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/app/build.gradle#L25) block of [app/build.gradle] file.
If you want to add cmake build arguments, please add it at [external Native Build](https://github.com/cocos2d/cocos2d-x/blob/84be684e3858393a6f3efc50e3f95d4e0ac92a20/tests/cpp-empty-test/proj.android/app/build.gradle#L25) block of __app/build.gradle__ file.

## Prebuilt feature
## Prebuilt libraries feature

To solve the problem that compiling engine sources spends too long time, we add the feature of pre-builds libs. Using this feature you only need build engine sources once for a specific environment.
To solve long compilation times of the engine source code one can use prebuilt libraries. Using this feature you only need build engine sources once for a specific environment or again when the engine version changes and you wish to utilize the new version.

### Example

This is an example of build cpp libs once, and use it in different cpp project.
This is an example of building c++ libs once, and use them in different c++ projects.

```sh
cocos new -l cpp -p my.pack.app1 test_app1
Expand All @@ -81,7 +84,7 @@ cmake ../test_app1 -DGEN_COCOS_PREBUILT=ON
make prebuilt
```

Close option `GEN_COCOS_PREBUILT` and open `USE_COCOS_PREBUILT` to use prebuilt in the same project
Change option `GEN_COCOS_PREBUILT` and use instead `USE_COCOS_PREBUILT` to use prebuilt in the same project

```sh
cmake ../test_app1 -DGEN_COCOS_PREBUILT=OFF -DUSE_COCOS_PREBUILT=ON
Expand All @@ -98,13 +101,14 @@ cmake ../test_app2 -DUSE_COCOS_PREBUILT=ON
make TemplateCpp
open bin/TemplateCpp.app
```

> Any other cpp project can use prebuilt in this way

Using this feature on Android exists a little difference, for CMake can't find system environment when build in Gradle. So you need to [supply a path](https://github.com/cocos2d/cocos2d-x/blob/c087be314c2c56a757bf66163b173746b5d6ad34/tests/cpp-empty-test/proj.android/app/build.gradle#L34) as the location of prebuilt libs.
When using the prebuilt libraries on Android there is a small difference as CMake can't find system environment when built using Gradle. You need to [supply a path](https://github.com/cocos2d/cocos2d-x/blob/c087be314c2c56a757bf66163b173746b5d6ad34/tests/cpp-empty-test/proj.android/app/build.gradle#L34) as the location of prebuilt libs.

## Build Options

### CMake Common
### CMake Common Build Options

1. __`-G`__, generate native build project you specified, for example

Expand Down Expand Up @@ -141,8 +145,8 @@ Using this feature on Android exists a little difference, for CMake can't find s

## Useful Links

* Official website: [cmake.org](https://cmake.org/)
* CMake Official website: [cmake.org](https://cmake.org/)

* Documentation: [cmake.org/documentation](https://cmake.org/documentation/)
* CMake Documentation: [cmake.org/documentation](https://cmake.org/documentation/)

* CMake FAQ: [Wiki/CMake_FAQ](https://cmake.org/Wiki/CMake_FAQ)
Loading