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
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Igor Mats @IgorMats Added outline shader sample

G17hao @G17hao Fixed an typo issue in jsb_boot.js

Simon de Lang @simondel Fixed use of deprecated cc, ccs and ccui create functions.

Cocos2d-JS can not grow so fast without the active community.
Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.
36 changes: 36 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
ChangeLog:

Cocos2d-JS v3.2 @ Dec.29, 2014

* Replaced `transform` function with `setTransform` function under canvas render mode for better performance.
* Added a timer in `cc.audioEngine` to check audio element loading event, prevent the loading process being stucked when load audio file failed.
* Added some new browser types to `cc.sys`.
* Added some audio resource loading codes to ensure compatibility with Wechat browser.
* Added check for WebAudio support to ensure compatibility.
* [JSB]Upgraded Cocos2d-x to v3.3 Final.
* [JSB]Added `getSearchPaths` API to `jsb.Manifest` to support better script hot update.
* [JSB]Polished restart game feature.
* [JSB]Added a sample usage case for `jsb.AssetsManager`'s script hot update ability.
* [JSB]Skipped FlatBuffer related bindings.
* [JSB]Canceled modifications in Spine due to License restriction and removed new constructor for `sp.SkeletonAnimation`.

* Bug fixes:
1. Fixed an issue that `cc.InputManager` doesn't trigger touch event on chrome mobile emulator.
2. Fixed an issue that `cc.game.setFrameRate` doesn't work.
3. Fixed an issue that `cc.view` can't remove resize event listener.
4. Fixed an issue that `cc.EventManager` didn't set register flag to false when a listener is removed.
5. Fixed an issue that `cc.audioEngine` doesn't play some audios on some iOS devices.
6. Fixed an issue of ccui controls that their `setColor` doesn't work when cascade color is enabled.
7. Fixed an issue that `ccs.Armature`'s `setColor` doesn't work in canvas render mode.
8. Fixed an issue that `ccs.Armature` crashes when adding a child to it.
9. Fixed an issue that `cc.SpriteBatchNode`'s status is incorrect in WebGL render mode.
10. Fixed an issue of `cc.Layer` that its position is incorrect under bake mode.
11. Fixed an issue of `ccui.RichText` that its `setContentSize` doesn't work.
12. Fixed an issue of `cc.LabelTTF` that its `setColor` doesn't work when cascade color is enabled.
13. Fixed an issue of spine that its skeletons position is incorrect when scaleX equals to -1 and scaleY equals to 1.
14. Fixed `sp.Skeleton`'s API inconsistence by renaming `boundingBox` to `getBoundingBox`.
15. Removed all usages of deprecated create functions in the test cases.
16. [JSB]Fixed an issue of `ccui.ScrollView`'s `innerWidth` and `innerHeight` properties.
17. [JSB]Fixed an issue that setting `cc.Node`'s userData property will crash.
18. [JSB]Fixed API inconsistence by renaming `jsb.fileUtils`'s `getByteArrayFromFile` to `getDataFromFile`.
19. [JSB]Fixed a script file cache check issue in ScriptingCore.cpp.
20. [JSB]Fixed an issue of `ccs.Armature`'s constructore.

Cocos2d-JS v3.2 RC0 @ Dec.11, 2014

* Refactoration of web engine by separating the render logic, the arthictecture level refactoration is now completed and brounght great performance improvement.
Expand Down
16 changes: 8 additions & 8 deletions docs/release-note-v3.2rc0.md → docs/release-note-v3.2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cocos2d-JS v3.2 RC0 release note
# Cocos2d-JS v3.2 release note

<img src="http://files.cocos2d-x.org/images/orgsite/logo.png" height=180>

Expand Down Expand Up @@ -28,9 +28,9 @@ For JSB build, there are some restrictions :

## Download

- [Cocos2d-JS v3.2 RC0](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.2-rc0.zip)
- [Cocos2d-JS v3.2](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.2.zip)
- [Online API reference](http://www.cocos2d-x.org/reference/html5-js/V3.0/index.html)
- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.2-RC0-API.zip)
- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.2-API.zip)
- [Online test cases](http://cocos2d-x.org/js-tests/)

## Workflows
Expand All @@ -45,22 +45,22 @@ For JSB build, there are some restrictions :

Read more about all the features and bug fixes

- [Cocos2d-JS v3.2 RC0 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/changelog/en)
- [Cocos2d-JS v3.2 RC0 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/upgrade-guide/en)
- [Cocos2d-JS v3.2 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2/changelog/en)
- [Cocos2d-JS v3.2 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.2rc0/upgrade-guide/en)

## Upgrade your project from previous versions

If you want to upgrade your game based on v3.0 previous version to the v3.2 RC0 version, you should follow these steps:
If you want to upgrade your game based on v3.x previous version to the v3.2 version, you should follow these steps:

1. Download the Cocos2d-JS v3.2 RC0 package.
1. Download the Cocos2d-JS v3.2 package.
2. Upgrade cocos command with `setup.py`.
3. Create a new project with `cocos new` command.
4. Replace the "src", "res", "index.html", "project.json", "main.js" etc with your old project.
5. Then you may need to refer to the upgrade guide to solve some API change issues.

## About Cocos2d family

- Cocos2d-JS v3.2 RC0 uses Cocos2d-x v3.3rc1 as base of JSB solution
- Cocos2d-JS v3.2 uses Cocos2d-x v3.3 as base of JSB solution
- Cocos2d-JS v3.2 is compatible with Cocos Code IDE v1.1.0
- Cocos2d-JS v3.2 is compatible with Cocos Studio v1.2 - v1.6, Cocos Studio 2 support have been removed because flat buffer binary file can't be parsed in JS, we will support Cocos Studio 2 in v3.3 with a JSON format parser.

Expand Down
127 changes: 127 additions & 0 deletions docs/upgrade-guide-from-3.1-to-3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#Upgrade guide from Cocos2d-JS v3.1 to Cocos2d-JS v3.2

## 0. Upgrade to Cocos2d-JS v3.1

If you are still using Cocos2d-html5 or previous version of Cocos2d-JS, you need to read the previous upgrade guide first : [Upgrade guide to Cocos2d-JS v3.1](../../v3.0rc0/upgrade-guide/en.md)

## 1. Reduce package size with modulirization in JSB

In Cocos2d-JS v3.2, during compilation, Cocos2d-x modules and related JavaScript Bindings code can be automatically excluded from the final package if they are not used. As you may already know, our web engine support modularization with `modules` section in project.json file. However, this configuration doesn't take effect in JSB, you should do the following to exclude any module you don't need in JSB.

In AppDelegate.cpp, you will find `applicationDidFinishLaunching` function in which all JSB bindings are registered. If the registration code for a module is commented out, then the base Cocos2d-x module won't be used, during linking the linker will exclude it. This is a common optimization in linker, so it will take effect for both Android and iOS apps. Of course, all modules that you don't register their bindings won't be available in your JavaScript code.

At last, you only need to compile your project. The minimum size of Android package in Cocos2d-JS v3.2 is 4.4mb.

```
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = cocos2d::GLViewImpl::createWithRect("Release3_2", Rect(0,0,900,640));
director->setOpenGLView(glview);
}
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_cocos2dx_js_core);
sc->addRegisterCallback(register_cocos2dx_js_extensions);
sc->addRegisterCallback(jsb_register_system);
// extension can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
// chipmunk can be commented out to reduce the package
sc->addRegisterCallback(jsb_register_chipmunk);
// opengl can be commented out to reduce the package
sc->addRegisterCallback(JSB_register_opengl);
// builder can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_builder);
sc->addRegisterCallback(register_CCBuilderReader);
// ui can be commented out to reduce the package, attension studio need ui module
sc->addRegisterCallback(register_all_cocos2dx_ui);
sc->addRegisterCallback(register_all_cocos2dx_ui_manual);
// studio can be commented out to reduce the package,
sc->addRegisterCallback(register_all_cocos2dx_studio);
sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
// spine can be commented out to reduce the package
sc->addRegisterCallback(register_all_cocos2dx_spine);
sc->addRegisterCallback(register_all_cocos2dx_spine_manual);
// XmlHttpRequest can be commented out to reduce the package
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
// websocket can be commented out to reduce the package
sc->addRegisterCallback(register_jsb_websocket);
// sokcet io can be commented out to reduce the package
sc->addRegisterCallback(register_jsb_socketio);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
sc->addRegisterCallback(JavaScriptObjCBridge::_js_register);
#endif
sc->start();
sc->runScript("script/jsb_boot.js");
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
ScriptEngineManager::getInstance()->setScriptEngine(engine);
ScriptingCore::getInstance()->runScript("main.js");
return true;
}
```

## 2. Restart game and hot update related APIs

Since Cocos2d-JS v3.0 Beta, we have provided AssetsManager for assets and scripts hot update ability. Ever since, its stability is greatly improved and become reliable. Thank to our developers, we have also collected many great suggestions and feature requests. In v3.2, we decided to add two importants ones:

1. Clean a script's cache

A script will be cached in JSB, so even if you updated it with AssetsManager, it won't take effect even if you require it again. In this case, we provided `cleanScript` API to clean its cache.

```
cc.sys.cleanScript(scriptPath);
```
2. Restart game
Very often, when the hot update is done, the game need to be restarted entirely. So we provided restart game API, it will do the following steps:
1. Clean up Cocos2d-x's environment
2. Restart the JavaScript VM
3. Register all script bindings
4. Re-execute the main.js
The API is
```
cc.game.restart()
```
3. Manifest's new API: getSearchPaths
If you want the new JavaScript files updated via AssetsManager to take effect, there are two requirements to be satisfied:
1. JavaScript files must be updated correctly.
2. Everytime before the game start up, the search paths for the new scripts must be prepended before the execution of `cc.game.run()`. Then in `cc.game.run`, the engine will load the updated scripts.
This means the search paths of the updated assets must be stored locally, so we have provided a new API of Manifest to retrieve the search pahts. Then the local storage can be used to save the search paths, it's our recommended way, but developers can also use whatever they want to save the paths persistantly. Here is an recommended process after the scripts hot update via AssetsManager:
```
// After update succeeded, updated manifest will become the new local manifest.
var searchPaths = assetsManager.getLocalManifest().getSearchPaths();
// The search paths can be coded to JSON string then stored in cc.sys.localStorage, so that it can be retrieved and preppended to jsb.fileUtils during the game restart.
cc.sys.localStorage.setItem("AssetsSearchPaths", JSON.stringify(searchPaths));
// Restart the game to let new scripts take effect.
cc.game.restart();
```
Hope these new APIs will make hot update in your game much eaiser.
2 changes: 1 addition & 1 deletion frameworks/js-bindings/cocos2d-x
2 changes: 1 addition & 1 deletion samples/js-tests/src/SpineTest/SpineTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var SpineTest = BaseTestLayer.extend({
// Make Spine's Animated skeleton Node
// You need 'json + atlas + image' resource files to make it.
// No JS binding for spine-c in this version. So, only file loading is supported.
var spineBoy = new sp.SkeletonAnimation('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
var spineBoy = sp.SkeletonAnimation.create('res/skeletons/spineboy.json', 'res/skeletons/spineboy.atlas');
spineBoy.setPosition(cc.p(size.width / 2, size.height / 2 - 150));
spineBoy.setAnimation(0, 'walk', true);
spineBoy.setMix('walk', 'jump', 0.2);
Expand Down