hero-image

Cocos2d-x

Cocos2d-x is a mature open source cross-platform game development framework that supports 2D and 3D game creation

V3.17.2

Publish Time: 2019.05.27

Version 3.17.2 focuses on bugs fixing and performance opimization on OPPO devices.

Highlights

  • Performance optimization on OPPO devices
  • Fixed bug thatFileUtils::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

More detail change log please refer to ChangeLog.

V3.17.1

Publish Time: 2018.12.15

The 3.17.1 release focuses on bug fixing.

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

This release contains more than 45 bugs fixed and 34 misc improvements, please refer to ChangeLog

V3.17

Publish Time: 2018.05.21

The 3.17 release focuses on stability and increased performance with some under the hood enhancements that will make cross-platform development easier.

Android Requirements

v3.17 has been tested using Android Studio (3.0, 3.1, 3.1.1) with NDK r16

Highlights

  • added support for iPhone X
  • added support Android Studio 3.0+
  • CMake is now supported on all platforms
  • upgraded Spine runtime to v3.6.39
  • upgraded GLFW to 3.2.1
  • misc bugs fix and stability improvements

Added support for iPhone X

3.17 brings support for iPhone X including supporting full screen mode, using Storyboards for launch images, safe area API and support for auto hiding the Home indicator. It is important to note exactly what and where the safe area is:

Developers can get the safe area easily by calling: Director::getSafeAreaRect().

Added support Android Studio 3.0+

Android Studio is the only official IDE for Google’s Android operating system.
Cocos2d-x supports Android Studio using NDK version r16. Gradle configurations have been updated, including simplifying Gradle PROP_* values, changing the deprecated compile to the new implementationin dependency declaration, and added Proguard configuration to reduce Release package size.

CMake is now supported on all platforms

CMake is now supported on all platforms, including Android(NDK), iOS, macOS, Windows (VC++ compiler), Linux. Supports precompile libraries for engine, and reusing precompiled libraries in the new build process. Your projects build time will be greatly reduced. For detailed usage, please refer to CMake Doc

Upgrade 3rd-party libraries

Spine skeleton animation is widely used in games developed by Cocos2d-x. Spine runtime has been upgraded to 3.6.39 to keep current.
GLFW has been upgraded to 3.2.1 to help fix joystick issues. You can also now use GLFW as a precompiled library.
Box2D hasn’t been updated in quite some time. A new production version has yet to be released so far in 2018. We felt GitHub commit was stable. You can also now use Box2D as a precompiled library.
Each Cocos2d-x release comes with a specific version of third-party libraries. If you want to upgrade third-party libraries due to your projects needs, please refer to: 3rd-party Doc

Remove outdated

Google officially deprecated ant build support starting in Android SDK Tools 25.3.0. The old ant based proj.android and been dropped and now proj.android is an Android Studio project. The default architecture is changed from armeabi to armeabi-v7a.

Visual Studio 2013 support has been dropped. Visual Studio 2015/2017 are still currently supported. The existing win32 project files is quite suitable for 2015. To use 2017, you can open a 2015 project file, modify the configuration to suit your needs, or use CMake (See above).

Misc bugs fix and stability improvements

This release contains more than 51 bugs fixed and 33 misc improvements, please refer to Changelog 

V3.16

Publish Time: 2017.10.10

Android tool version tested in this version:

  • Android Studio 2.3.3
  • NDK r14

Highlights

  • better support creator_to_cocos2dx creator plugin
  • add LayerRadiaGradientLayer
  • update to support Android Studio 2.3.3
  • fix the issue that lua projects will crash on iOS simulator with Xcode 8.0+
  • revert CocosStudio reader and flatbuffer
  • fix compling error with iOS 11
  • use prebuit bullet to improve compiling speed
  • remove supporting of Windows 10 metro, Windows Phones and Tizen
  • update to Spine v3.5.35 and support skeleton batching in web engine

Highlights in detail

Better support creator_to_cocos2dx

creator_to_cocos2dx is a Cocos Creator plugin that will export Scene information created by Cocos Creator for cocos2d-x C++/Lua projects. We mention it as plugin following.

With this plugin, you can use Cocos Creator as Scene editor for cocos2d-x. Curretly, the plugin supports these features, and will continue to add more features. As you can see, RichText img tag support only works in cocos2d-x v3.16+ because of cocos2d-x's limitation. So cocos2d-x will continue to be improved to support more Cocos Creator features.

More detail information and usage please refer to plugin's the README. You are appreciated if you can use it and give feedback.

Scene effect in cocos creator

Scene effect in cocos2d-x

LayerRaidalGradient

LayerRadialGradient is similar to LayerColor, but will only draw color in a circle.

Lua app crashed on iOS simulator with Xcode 8.0+

After updating to Xcode 8.0+, lua projects will crash on iOS simulator. It is a bug of luagit. In this version, the bug it is fixed. You can just update luajit if you don't want to update cocos2d-x.

Fix compiling error with iOS 11

Before cocos2d-x v3.16, CCFileUtils uses system( ) to remove a directory. iOS 11 remove system, so will cause compiling error with iOS 11. This version fixes this issue. The corresponding PR for this issue is here, you can apply this PR to fix it if you don't want to upgrade to v3.16.

Cocos Studio

coocs2d-x v3.15 updates flatbuffer, which breaks compatibility of Cocos Studio. In this version, we revert flatbuffer and Cocos Studio reader.
If you don't want to update cocos2d-x, you can replace flatbuffer and Cocos Studio reader shift in this version.

Improve compiling speed

As bullet is not needed for most developers, so we use prebuilt bullet. It will speed up compiling speed, and we will continue to use more prebuilt 3rd party libraries, such as 3d particles, Box2D and so on to speed up compiling speed.
We also fix many warnings too in this version. As some warnings are imported by 3rd party libaries, so we can not treat warnings as error, but we will continue to achieve it.

Remove some platforms support

As we are lack of human resources, so we remove some platforms.
MS maintians Win10 related platform, but it doesn't continue to maintain it. So we remove it. Which means cocos2d-x based games can not run on Win10 metro mode and Windows Phones, but you can run it in Win32 mode.
Tizen platform is removed too because of huaman resources.

V3.15.1

Publish Time: 2017.05.27

Highlights

  • add optimization codes for Huawei devices

V3.15

Publish Time: 2017.04.21

Highlights

  • full Android Studio supports: include editing, compiling and debugging c++ codes: doc
  • audio engine uses tremolo and MP3 Decoder Library to decode audio files on Android: high performance and more adaptable to different Android devices
  • WebSockets and SocketIO supports SSL
  • AssetsManagerEx is more stable
  • update Spine runtime to v3.5.35
  • update flatbuffer to v1.5
  • remove support for Windows 8.1 store and phone
  • update OpenSSL to v1.1.0
  • remove linux 32-bit support

Feature in detail

Full Android Studio supports

Since v3.15, can use Android Studio 2.3+ to edit, compile and debug c++ codes. What you need to do is just use Android Studio to open proj.android-studio(such as tests/cpp-empty-test/proj.android-studio), then click run menu button to run on Android devices or simulators.

Please refer to this doc for detail usage.

Audio engine improved on Android

Before v3.15, new Audio engine uses OpenSL ES to decode and play audio files. But many Android device manufacturers modify OpenSL ES decoding codes which cause issues. This thread lists many issues caused by it.
In order to fix these issues, we decide to use 3rd party audio decoding libraries tremolo and MP3 Decoder Library, which are used by Android have good performance and stability. What's exciting is what, after using tremolo, the audio engine's performance is highly improved too.

audio performance

Remove support for Windows 8.1 store and phone

MS guys maintain Windows 8.1. They think there is not need to support it, so they remove the support.

Remove linux 32-bit support

Most PC are 64-bit, so we decide to remove linux 32-bit support. By remove 32-bit linux support, cocos2d-x zip file is more less, and we can have more resource on more important things.
If you need linux 32-bit support, you can build the 3rd party libraries through cocos2d-x-3rd-party-libs-src repo by yourself.

Misc

Android SDK Tools 25.3.0+ removes ant script and android tool, which leads to that cocos command can not generate apk files with Eclipse projects(proj.android). Currently, cocos command will do nothing if using SDK Tools 25.3.0+, you can use these two methods to fix it:

  • copy tools folder from old Android SDK version
  • use Android Studio to build the app

It seems google doesn't want developers continue to use Eclipse to develope Android applications, so i suggest to switch to use Android Studio.

V3.14.1

Publish Time: 2017.01.22

This release brings bug fixes and API maintenance, as well as these highlights:

  • [NEW] Add Spine binary file format support
  • [NEW] Action: add a method to get the number of actions running in a given node with specific tag
  • [NEW] Action: new actions: ResizeBy and ResizeTo
  • [NEW] Button: can set title label
  • [NEW] Can disable multi touch on Android
  • [NEW] EventDispatcher: Add hasEventListener to check listener existance
  • [NEW] EditBox: add horizontal text alignment
  • [NEW] EventDispatcher: added hasEvent( ) to check if an event is added
  • [NEW] Sprite: support slice9 feature
  • [NEW] Slider: add methods to get _slidBallNormalRenderer
  • [NEW] Desktop: add a method to toggle between fullscreen and windowed
  • [NEW] Desktop: add events for window resize, focus and unfocus
  • [NEW] Mac: supports game controller
  • [NEW] JSB: add cc.sys.now() and perfromance.now(), the last one is more accurate
  • [NEW] Lua: add cc.vec3 functions: add, sub and dot
  • [NEW] Lua: use luajit 2.1.0-beta2
  • [NEW] Web: Add cc.CONCURRENCY_HTTP_REQUEST_COUNT to control max concurrent task count for XMLHttpRequest

 Fixes

  • [FIX] May crash if using Scene: : createWithPhysics( ) to create a scene and physics3d camera is not set
  • [FIX] May have link error because of glfw conflict on Linux
  • [FIX] Sprite: created from sprite frame with polygon information can not work correctly
  • [FIX] Lua: link error with VS2015
  • [FIX] Lua: compiling error if using cocos compile/run -p android --android --android-studio on Android

Read the full release notes .
Downloadit today!

V3.14

Publish Time: 2017.01.02

New features

  • Adds Spine binary file format support
  • Uses luajit 2.1.0-beta2 for all platforms
  • Adds new actions: ResizeBy and ResizeTo
  • Can disable multi-touch on Android
  • Sprite supports slice9 feature
  • Action adds a method to get the number of actions running on a given node with specific tag
  • Can set Button's title label
  • EditBox adds horizontal text alignment
  • Supports game controller on Mac

Features in detail

Uses luajit 2.1.0-beta2 for all platforms

In previous it is not convenient to generate luajit 64bit bytecode. You need to generate the bytecode in real devices, which means you should generate luajit 64bit bytecode on iOS 64bit devices.
Now, we can generate luajit 64bit bytecode on Mac OS X, windows or linux, so we change to use luajit for all platforms. If you use cocos command with -m release, it will generate bytecode automatically. And it will put 64bit bytecode into 64-bit folder. One exception is that, it doesn't generate luajit bytecode on linux, we don't know whether to generate 32bit or 64bit byte codes. So you should generate luajit bytecode yourself by using cocos luacompile command. Please refer to the help information of cocos luacompile -h for detail usage.

The generated bytecodes architecture are:

Platformgenerate 32bit luajit bytecodegenerate 64bit luajit bytecode
iOSyesyes
Androidyes if APP_ABI not only includes arm64-v8a, such as APP_ABI := arm64-v8ayes if APP_ABI includes arm64-v8a
Macnotyes
Windowsyesno
Linuxnono

Sprite supports slice9 feature

Now Sprite supports slice9 feature, you can use it like:

auto sprite = Sprite::create(...);
// set center rect
// the origin is top-left
sprite->setCenterRectNormalized(Rect(x, y, width, heigh));

More detail information please refer to the comments of Sprite::setCenterNormalized().

Known issue

lua project will crash on iOS simulator if using Xcode 8.2+. The issue is caused by luajit. We thought it is a but of Xcode because there is not problem if using Xcode 8.1 or lower version.
We can not fix it in v3.14, can track the issue for the progress of this issue.

V3.13.1

Publish Time: 2016.09.14

Bug fixed

  • Label color broken
  • application will crash in debug mode if don't specify a design resolution
  • may crash if coming from background by clicking application icon on Android
  • AudioEngine can not play audio if the audio lies outside APK on Android
  • AudioEngine::stop() will trigger finish callback on Android
  • application will crash if using SimpleAudioEngine or new AudioEngine to play audio on Android 2.3.x
  • object.setString() has not effect if passing a number on JSB

Cocos command modifications

Prior to 3.13 the cocos command would find an Android API level >= a specified
Android API level inorder to build source codes on Android. For example, if the contents of
APP_ROOT/proj.android/project.properties is:

target=android-13 // the default android api level
android.library.reference.1=../../../cocos/platform/android/java

then the cocos command will find android-13 in ANDROID_SDK_ROOT/platforms. If android-13
is not found then it will try to find android-14. If android-14 is not found, then it will find
android-15 and so on until it finds one.

This algorithm has a problem. If you only download Android 21, then your application will be built with
Android 21 even though the default API level is 13. If your application runs on a device with a lower Android OS,
such as Android 4.0, then your application may crash. Building with a higher API level does not ensure that your
application will run on devices with a lower Android OS.

Starting in 3.13.1, the cocos command will stop if it can not find a specific API level. The default
is android-13. If you want to build with a higher level Android SDK, you should explicitely specify it.
Example:

cocos compile -p android --ap android-19

Keep in mind that, after running this command, the contents of APP_ROOT/proj.android/project.properties will
be changed, android-19 will now be the default API level.

There is a map between Android API level and Android OS version that you can refer to for detailed information.
There is also more detailed information in our GitHub repo about this issue.

V3.13

Publish Time: 2016.08.29

We are happy to announce the release of Cocos2d-x v3.13!

Highlights

  • added VR plugins for Gear, Deepoon, Google Cardboard and Oculus.
  • support ETC1 alpha channel
  • fix AudioEngine performance for Android 4.2+
  • improve canvas renderer performance with dirty region
  • add Andorid arm-64 support
  • switch to use gcc 4.9
  • upgrade CURL to 7.50.0
  • upgrade Spine to 3.4
  • upgrade GLFW to 3.2

The main features in detail of Cocos2d-x v3.13

Added VR plugins

Support for Gear, Deepoon, Google Cardboard and Oculus has been added. Read about VR in our Programmers Guide

Support ETC1 alpha channel

Thanks halx99's contribution, now cocos2d-x supports ETC1 alpha channel by default.

If want to use ETC1 alpha chaneel, you should put xxx.pkm and xxx.pkm@alpha in the same folder, and use it like this:

auto sprite = Sprite::create("xxx.pkm");

xxx.pkm@alpha is the resource for alpha channel. @alpha subfix is required by engine to load alpha texture automatically.

More detail usage can refer to the implementation of Sprite1ETC1Alpha in tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp.

As you can see, the blue block in the middle of the picture is an ETC1 picture with alpha channel.

AudioEngine performance for Android 4.2+

AudioEngine uses OpenSL ES on Android, and it supports decoding audio source file to PCM data in codes since Android 4.2. Now AudioEngine uses this feature to fix the performance issue. The performane is the same as before if running on Android 4.1 or lower version. Should preload first, or there is not performance improved for first time playing of the audio.

Dirty region in canvas renderer

In v3.12, we improved WebGL renderer in the web engine, this version have brought the dirty region algorithm to improve canvas renderer performance. Basically, it detect every region that have been changed between frames, then only render these parts instead of refresh the whole canvas. This technique is beneficial for many games in which the dynamic region is often limited, it can improve frame rate and reduce CPU usage, power consumation. It's desactivated by default, to activate it, you can do the following:

// Enable dirty region algorithm
if (cc._renderType === cc.game.RENDER_TYPE_CANVAS) {
    cc.renderer.enableDirtyRegion(true);
    // Maximum dirty region count to activate the partial rendering process
    cc.renderer.setDirtyRegionCountThreshold(6);
}
// Detect if dirty is enabled
var enabled = isDirtyRegionEnabled();

Android arm-64 support

Now we provide arm-64 bit 3rd party libraries, which means can build 64-bit apps on Android. You can use the command to build 64-bit apps:

cocos run -p android --app-abi arm64-v8a

Switch to use gcc 4.9 on Android

cocos2d-x switch to use clang in v3.12, but developers reported some crash issue that caused by using clang+gnustl_static, so we switch to use gcc 4.9. We will change to use clang+c++_static when c++_static is stable.

Upgrade CURL to 7.50.0

Because CURL has a bug about connect to IPV4 numerical IP address in NAT64 environment, and it is fixed in v7.50.0, so we upgrade to this version when v7.50.0 is released.

V3.12

Publish Time: 2016.07.07

We are happy to announce the release of Cocos2d-x v3.12!

Runtime Requirements

  • Android 2.3.3+
  • iOS 5.0 or newer
  • OS X 10.7 or newer
  • Windows 7 or newer
  • Windows Phone 8.1
  • Windows 10 UWP
  • Linux Ubuntu 14.04 or newer
  • Mordern browsers and IE 9+ (On mobile platforms, only iOS and Android 5 activated WebGL support)

Compiler Requirements

  • Xcode 5.1 or newer for iOS or Mac
  • gcc 4.9 or newer for Linux
  • ndk-r11+ for Android
  • Visual Studio 2013 or newer for Windows (win32)
  • Visual Studio 2013 update4 or newer for Windows 8.1 universal Apps
  • Visual Studio 2015 or newer and Windows 10.0 (build 10074 or higher) for Windows 10.0 UWP Apps

How to run tests

Cocos Console

You can use Cocos Console command line tool to run the test cases on almost all supported platforms.

In console application:

// Enter cpp test folder
cd tests/cpp-tests
// Or enter js test folder
cd tests/js-tests
// Or enter lua test folder
cd tests/lua-tests

// Compile or run test case
cocos compile -p ios|mac|android|win32|win8_1|metro|web -m debug|release
cocos run -p ios|mac|android|win32|win8_1|metro|web -m debug|release

For example, if you want to run cpp test in release mode on Android, you can use the following command:

cocos run -p android -m release

Mac OSX & iOS

You can run the samples by:

  • Open cocos2d-x/build folder, open cocos2d_test.xcodeproj
  • Select cpp-tests, lua-tests, js-tests for iOS or OS X target in scheme toolbar
  • Click run button

Android

You can run the samples by either using the command-line or Eclipse:

Using command line:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10
$ adb install cocos2d-x/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 10.

Using Eclipse:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10

Next:

  • Import Cocos2d-x Android project into Eclipse, the path used to import is cocos/2d/platform/android
  • Import cpp-empty-test Android project into Eclipse, the path used to import is tests/cpp-empty-test/proj.android
  • Build cpp-empty-test Android project and run

Windows

You can run the samples by:

  • For win32 project, enter cocos2d-x/build, and open cocos2d-win32.sln
  • For win 8.1 project, enter cocos2d-x/build, and open cocos2d-win8.1-universal.sln
  • For win 10 project, enter cocos2d-x/build, and open cocos2d-win10.sln
  • Select running target
  • Click run button

Linux

You can run the samples by:

$ cd cocos2d-x/build
$ ./install-deps-linux.sh
$ cd ../..

Next:

$ mkdir build
$ cd build
$ cmake ../cocos2d-x
$ make -j4

Then run:

$ cd bin/cpp-empty-test
$ ./cpp-empty-test

How to start a new game

Use the cocos console app to create a new game:

cocos new -l cpp|js|lua MyNewGame

Highlights

  • add VR support in experimental
  • add Tizen support
  • improve Android performance issue
  • improve web engine performance in WebGL mode
  • support Android obb extension
  • use clang instead of gcc on Android, use NDK r11+

VR support

VR Support is now available! Currently there is support for Google Cardboard, Oculus Rift, Samsung Gear and Deepoon E2. Also provided is a generic VR renderer to help with testing. It should not be used to trust deploying a production VR game. In usual Cocos2d-x fashion it is very easy to get started with an easy to understand API. Read our chapter in the Programmers Guide for more information.

Tizen support

You can now develop for the Tizen mobile platform. The latest 2.4 SDK is supported. Tizen development uses it's own uniqie IDE as well as a simulator for testing applications. For setup instructions please read our documentation.

Improve Android performance

Thank you to our users for helping diagnose performance issues on some Android devices. It is because Cocos2d-x creates a big map buffer by default and fills the map buffer with actual data, which is less than the map buffer size. On some Android devices, it will transfer as much data as the map buffer size which causes performance issue.

More detail information and discussion can refer to the issue.

Improve web engine performance in WebGL mode

The web engine is receiving a big performance upgrade. The WebGL renderer have been completely refactored from the ground up. This means improved rendering and a reduced memory footprint.

Use clang on Android

Google deprecated gcc starting in NDK r11, Cocos2d-x now uses clang. We suggest using the NDK r11c.

We found an issue that, if using NDKr 10c + clang, then Node::enumerateChildren() will crash on Android.

Other changes

View our full changelog.

V3.11.1

Publish Time: 2016.05.20

Runtime Requirements

  • Android 2.3 or newer
  • iOS 5.0 or newer
  • OS X 10.7 or newer
  • Windows 7 or newer
  • Windows Phone 8.1
  • Windows 10 UWP
  • Linux Ubuntu 14.04 or newer
  • Mordern browsers and IE 9+ (On mobile platforms, only iOS and Android 5 activated WebGL support)

Compiler Requirements

  • Xcode 5.1 or newer for iOS or Mac
  • gcc 4.9 or newer for Linux
  • ndk-r10c for Android
  • Visual Studio 2013 or newer for Windows (win32)
  • Visual Studio 2013 update4 or newer for Windows 8.1 universal Apps
  • Visual Studio 2015 or newer and Windows 10.0 (build 10074 or higher) for Windows 10.0 UWP Apps

How to run tests

Cocos Console

You can use Cocos Console command line tool to run the test cases on almost all supported platforms.

In console application:

// Enter cpp test folder
cd tests/cpp-tests
// Or enter js test folder
cd tests/js-tests
// Or enter lua test folder
cd tests/lua-tests

// Compile or run test case
cocos compile -p ios|mac|android|win32|win8_1|metro|web -m debug|release
cocos run -p ios|mac|android|win32|win8_1|metro|web -m debug|release

For example, if you want to run cpp test in release mode on Android, you can use the following command:

cocos run -p android -m release

Mac OSX & iOS

You can run the samples by:

  • Open cocos2d-x/build folder, open cocos2d_test.xcodeproj
  • Select cpp-tests, lua-tests, js-tests for iOS or OS X target in scheme toolbar
  • Click run button

Android

You can run the samples by either using the command-line or Eclipse:

Using command line:
Perform the following steps:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10
$ adb install cocos2d-x/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 10.

Using Eclipse:
Perform the following steps:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10

Next:

  • Import cocos2d-x Android project into Eclipse, the path used to import is cocos/2d/platform/android
  • Import cpp-empty-test Android project into Eclipse, the path used to import is tests/cpp-empty-test/proj.android
  • Build cpp-empty-test Android project and run

Windows

You can run the samples by:

  • For win32 project, enter cocos2d-x/build, and open cocos2d-win32.sln
  • For win 8.1 project, enter cocos2d-x/build, and open cocos2d-win8.1-universal.sln
  • For win 10 project, enter cocos2d-x/build, and open cocos2d-win10.sln
  • Select running target
  • Click run button

Linux

You can run the samples by:

$ cd cocos2d-x/build
$ ./install-deps-linux.sh
$ cd ../..

Next:

$ mkdir build
$ cd build
$ cmake ../cocos2d-x
$ make -j4

Then run:

$ cd bin/cpp-empty-test
$ ./cpp-empty-test

How to start a new game

Use the cocos console app to create a new game:

cocos new -l cpp|js|lua MyNewGame

v3.11

Highlights features

  • upgrade Chipmunk to v7.0.1
  • use new memory model in JSB, don't have to invoke retain/release in JS, it is disabled by default
  • upgrade Curl to v7.48
  • upgrade OpenSSL to 1.0.2g
  • can use VSCode and new Firefox to debug cocos2d-x JSB programs
  • refactor WebGL renderer

The main features in detail of Cocos2d-x v3.11

New memory model in JSB

With new memory model, you don't have to care about object lifecycle. Which means you don't have to invoke retain/release in JS any more.
Though we have finished many tests about this new memory model, we can't make sure it is too perfect to enable it by default. But you are appreciated if you can enable it to have a try. If you want to enable it, you should change the value of CC_ENABLE_GC_FOR_NATIVE_OBJECTS to 1 in base/ccConfig.h like this:

#ifdef CC_ENABLE_SCRIPT_BINDING
  #ifndef CC_ENABLE_GC_FOR_NATIVE_OBJECTS
  #define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 1 // change to 1
  #endif
#endif

OpenSSL

Cocos2d-x has upgraded OpenSSL to version 1.0.2g.

Beginning July 11, 2016, Google Play will block publishing of any new apps or updates that use older versions of OpenSSL. It is important that you update the use of OpenSSL in your projects. More detail information can refer to this ticket.

If you use v2.x or use older versions of v3.x, you can just update CURL and OpenSSL.
To do this:

  • modify Cocos2d-x root/external/config.json to update the dependency version. For v3.x the dependency version is v3-deps-92, and for v2.x it is v2-deps-5
  • execute the download-deps.py script in your Cocos2d-x root.
(jtsm @ 15 ~) $ cd cocos2d-x

(jtsm @ 15 ~/cocos2d-x) $ ./download-deps.py

=======================================================
==> Prepare to download external libraries!
==> Ready to download 'v3-deps-92.zip' from 'https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-92.zip'
==> WARNING: Couldnt grab the file size from remote, use 'zip_file_size' section in '/Users/jtsm/Chukong-Inc/cocos2d-x/external/config.json'
==> Start to download, please wait ...
==> Downloading finished!
==> Extracting files, please wait ...
==> Extraction done! ==> Copying files...
==> Cleaning...

Cocos2d-x JSB program debugging

In previous version, can not use Firefox 30+ to debug cocos2d-x JSB programs. This limit is fixed since v3.11. And web console feature is added too. This documentation shows how to use Firefox to debug cocos2d-x JSB programs(this is a little difference from current usage).
Of course you can use VSCode to debug cocos2d-x JSB programs too. You can read about how to use VSCode to debug cocos2d-x JSB programs here.

New WebGL renderer

In v3.11, we have refactored the WebGL renderer in web engine, here is the detailed changes:

  • Activate WebGL on Android by default.
  • Add sprite auto batching in WebGL.
  • Shared rendering buffer for Sprites.

Compare with old version, the draw calls in your game should be significantly reduced if the textures is well managed. This improves also the CPU usage and memory usage. The above is just a first step of WebGL renderer upgrade, we will continue to investigate in this direction in the future versions.

Other changes

You can also take a look at the full changelog.

V3.10

Publish Time: 2016.01.18

Runtime Requirements

  • Android 2.3 or newer
  • iOS 5.0 or newer
  • OS X 10.7 or newer
  • Windows 7 or newer
  • Windows Phone 8.1
  • Windows 10 UWP
  • Linux Ubuntu 14.04 or newer
  • Mordern browsers and IE 9+ (On mobile platforms, only iOS and Android 5 activated WebGL support)

Compiler Requirements

  • Xcode 5.1 or newer for iOS or Mac
  • gcc 4.9 or newer for Linux
  • ndk-r10c for Android
  • Visual Studio 2013 or newer for Windows (win32)
  • Visual Studio 2013 update4 or newer for Windows 8.1 universal Apps
  • Visual Studio 2015 RC or newer and Windows 10.0 (build 10074 or higher) for Windows 10.0 UWP Apps

How to run tests

Cocos Console

You can use Cocos Console command line tool to run the test cases on almost all supported platforms.
In console application:

// Enter cpp test folder
cd tests/cpp-tests
// Or enter js test folder
cd tests/js-tests
// Or enter lua test folder
cd tests/lua-tests

// Compile or run test case
cocos compile -p ios|mac|android|win32|win8_1|metro|web -m debug|release
cocos run -p ios|mac|android|win32|win8_1|metro|web -m debug|release

For example, if you want to run cpp test in release mode on Android, you can use the following command:

cocos run -p android -m release

Mac OSX & iOS

  • Enter cocos2d-x/build folder, open cocos2d_test.xcodeproj
  • Select cpp-testslua-testsjs-tests for iOS or OS X target in scheme toolbar
  • Click run button

Android

You can run the samples…

Using command line:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10
$ adb install cocos2d-x/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 10.

Using Eclipse:

$ cd cocos2d-x
$ ./setup.py
$ cd build
$ ./android-build.py cpp-empty-test -p 10

Then

  • Import cocos2d-x Android project into Eclipse, the path used to import is cocos/2d/platform/android
  • Import cpp-empty-test Android project into Eclipse, the path used to import is tests/cpp-empty-test/proj.android
  • Build cpp-empty-test Android project and run

Windows

  • For win32 project, enter cocos2d-x/build, and open cocos2d-win32.sln
  • For win 8.1 project, enter cocos2d-x/build, and open cocos2d-win8.1-universal.sln
  • For win 10 project, enter cocos2d-x/build, and open cocos2d-win10.sln
  • Select running target
  • Click run button

Linux

$ cd cocos2d-x/build
$ ./install-deps-linux.sh
$ cd ../..

Then

$ mkdir build
$ cd build
$ cmake ../cocos2d-x
$ make -j4

Run

$ cd bin/cpp-empty-test
$ ./cpp-empty-test

How to start a new game

Use Cocos Console to create a new game:

cocos new -l cpp|js|lua MyNewGame

Highlights features, improvements and API updates of v3.10

We are happy to announce the release of Cocos2d-x v3.10. Following are the highlighted features, improvements and API updates in this version. 

  1. Provides a unified setup for both Cocos2d-x and Cocos. This allows you to stay up to date with the latest Cocos2d-x releases. This includes using precompiled binaries and source code, in a single place. As always the source code is available from GitHub but, there is no longer a .zip file available containing the source code. 
  2. New Cocos Launcher tool! Cocos Launcher allows:
  • One step to create a new project with the engine, by using precompiled libraries or source code.
  • Easy integration with SDKBOX for 3rd party services: Facebook, IAP and many more.
  • Developers to provide feedback and get support, directly within Cocos Launcher, making it simple to contact the engine team for help. 
  • Reimplemented Scale9Sprite to improve performance and reduce memory consumption.
  • Changed PageView to derive from ListViewPageView can add any widget as a child.
  • Added three new overflow types to LabelCLAMPSHRINKRESIZE_HEIGHT.
  • Fixed a bug in ClippingNode that corrects its behavior when being set as a child.
  • Improved JavaScript Bindings: follows SpiderMonkey GC best practices making it more robust.

Other changes

  • [TEST] Lua: Fixed pageViewTest Horizontal scroll won't work in Lua-test.
  • [NEW] RichText supported new line element.
  • [NEW] UIText::clone supports clone the text effect.
  • [NEW] UI: Added methods to query label effect state.
  • [REFINE] UI: Fixed boring deprecated warning in HttpRequest.
  • [REFINE] Network: Fixed Downloader bug on iOS & Android platform.
  • [REFINE] Studio: Fixed deprecation warning in SkeletonRenderer.
  • [REFINE] JS: Added js test case for fix, improve template.
  • [REFINE] Network: Permit http access to cocos2d-x.org in test projects on iOS.
  • [REFINE] Network: Crash when removing a remotely downloaded image from texture cache in js-binding.
  • [REFINE] Win10: WinRT project update version to v3.10.
  • [REFINE] Console: Added quiet option for Cocos Toolkit.
  • [REFINE] JS: New GC model for js-binding.
  • [REFINE] Doc: Fixed typos in documentation and comments.
  • [REFINE] UI: Updated controlButton size calculate with new Scale9Sprite logic.
  • [REFINE] Win10: Added missing _USRJSSTATIC preprocessor define for ARM builds.
  • [REFINE] JS: Added ccvector_to / ccmap_to converted to new js-binding API.
  • [REFINE] UI: Slider misprint fix.
  • [FIX] Core: Fixed premultiplyAlpha for mipmaps and compressed textures.
  • [FIX] UI: Fixed Scale9sprite rendering error when content size smaller than the sum of leftInset and rightInset.
  • [FIX] Win32: Fixed EditBox crash when removing an EditBox in a scheduler
  • [FIX] Android: Fixed cannot add view to mFrameLayout when extends Cocos2dxActivity.
  • [FIX] 2D: Fixed actionNode set at wrong position bug.
  • [FIX] 3D: Fixed the movement of PUParticle lags one frame.
  • [FIX] UI: Fixed the wront argument of setPlaceholderFontName in EditBox.
  • [FIX] UI: Fixed EditBox editBoxEditingDidEnd may use the original text after change the text of EditBox in user script.
  • [FIX] Audio: Fixed FinishCallback never be called in Windows.
  • [FIX] UI: Fixed Layout stencil clipping nested with Clipping Node rendering issue.
  • [FIX] UI: Keyboard doesn't hide when click the screen outside of EditBox on iOS platform.
  • [FIX] UI: Fixed a fatal bug in EditBox implement on Windows platform.
  • [FIX] UI: Fixed edit box setPlaceholderFontName and scale font size issue.
  • [FIX] Core: Fixed memory leak when initWithImage() failed.
  • [FIX] Network: CCDownloader on iOS is broken in v3.9 js-binding.
  • [FIX] JS: Bindings fixes for Menu, Sprite and Label.
  • [FIX] Studio: Removed weak reference in ActionNode.
  • [FIX] UI: shouldStartLoading method should return value to js in js-binding.
  • [FIX] UI: Fixed scrollview render error.
  • [FIX] JS: Fixed win32 js project crash issue.
  • [FIX] UI: Button touch doesn't work with scale9 enabled.
  • [FIX] JS: Fixed evalString doesn't return result issue.
  • [FIX] JS: Fixed ComponentJS proxy management issue in JSB.
  • [FIX] Android: Fixed include in cocos network module.
  • [FIX] Network: Fixed web socket crash.
  • [FIX] UI: Fixed TextField missing default password style text setting.
  • [TEST] S9SpriteTest: Scale9Sprite fade actions with cascade opacity.
  • [TEST] Web: Removed default focus block from UIFocusTestVertical.
  • [TEST] Lua: Fixed pageViewTest Horizontal scroll won't work in Lua-test.

You can also take a look at the full changelog.

NEW APIS

  1. RichText Added RichElementNewLine class to create new RichText Element. For more information: https://github.com/cocos2d/cocos2d-x/pull/14033
  2. PageViewIndicator Added PageViewIndicator class to create PageViewIndicator. For more information: https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/ui/UIPageViewIndicator.h
  3. PageView Changed PageView to derived from ListView.
    For more information: https://github.com/cocos2d/cocos2d-x/pull/14252
  4. ApplicationProtocol Added the API getVersion.
  5. PolygonInfo Added the API setTriangles.
  6. Scale9Sprite Added setRenderingType, getRenderingType.
  7. FontFNT Added setFontSize, getOriginalFontSize.
  8. Label Added setBMFontSize, getBMFontSize, enableWrap, isWrapEnabled, setOverflow, getOverflow, initWithTTF, isShadowEnabled, getShadowOffset, getShadowBlurRadius, getShadowColor, getOutlineSize, getLabelEffectType, getEffectColor.
  9. AudioEngineImpl Added AudioEngineImpl to implement FMOD.
  10. Lua Module Added luaval_to_node, node_to_luaval.
  11. JS Module Added js_cocos2dx_ComponentJS_create
  12. ui::Text Added isShadowEnabled, getShadowOffset, getShadowBlurRadius, getShadowColor, getOutlineSize, getLabelEffectType, getEffectColor.
  13. UITextTest_Clone Added UITextTest_Clone class.

V3.9

Publish Time: 2015.11.13

We are happy to announce the release of Cocos2d-x v3.9. Following are the highlighted features, improvements and API updates in this version.

3D Module

  • Added 3D MotionStreak to support streak effect.
  • Refined Sprite3D to support material system.

2D Module:

  • Added frame callback function and animation callback function.
  • Added script component system.
  • Reconstruction of 2D physics with Component.
  • Improved EditBox implementation on iOS and Win32 platform.
  • Removed dependence of libcurl on AssetsManager, AssetsManagerEx and Downloader(iOS & Android).
  • Improved particle performance.

Others

  • Supported Action inheritance, update function overwriting in JSB.
  • Improved ScrollView performance in Web engine.
  • Improved Scale9Sprite performance in Web engine.
  • Decoupled Sprite's setTexture() and updateColor() in Web engine.
  • Added support for debugging and release on real devices with Xcode7 and iOS9.