Merge branch 'v3.7-release' of https://github.com/cocos2d/cocos2d-x into v3

Conflicts:
	cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp
	docs/RELEASE_NOTES.md
	tools/cocos2d-console
	tools/tojs/cocos2dx.ini
This commit is contained in:
pandamicro 2015-07-21 11:39:24 +08:00
commit 85d4ce0d5a
25 changed files with 311 additions and 134 deletions

View File

@ -4,6 +4,17 @@ cocos2d-x-3.8 ??
[FIX] renderer: UI component can't click correctly by moving UI and camera far away of origin.
[FIX] JS: Fixed issue of iOS/JS reflection `callStaticMethod` with bool arg
cocos2d-x-3.7final July.21 2015
[REFINE] JS: Improve manual binding code for `retain`, `release`, `onEnter`, `onExit`, `onEnterTransitionDidFinish` and `onExitTransitionDidStart`
[REFINE] web: Add compatible Uint16Array defintion
[FIX] Scale9Sprite: Fixed Scale9Sprite gray state issue while `setCapInsets` called
[FIX] studio: Fixed parser issue by checking texture existance
[FIX] studio: Fixed Armature parser issue
[FIX] JS: Fixed cleanup overriding issue in JS that it will cause `too much recursion` error
[FIX] web: Fixed url check regular expression not supporting localhost issue
[FIX] web: Fixed issue that sprite doesn't update texture rect correctly in some condition
cocos2d-x-3.7rc1 July.14 2015
[REFINE] framework: Used msbuild to generating engine prebuilt libs on win32.
[REFINE] 3d: Used shader with normal while creating mesh with normals

View File

@ -13,7 +13,7 @@ cocos2d-x
[cocos2d-x][1] is a multi-platform framework for building 2d games, interactive books, demos and other graphical applications.
It is based on [cocos2d-iphone][2], but instead of using Objective-C, it uses C++.
It works on iOS, Android, Windows Phone and Store Apps, OS X, Windows and Linux.
It works on iOS, Android, Windows Phone and Store Apps, OS X, Windows, Linux and Web platforms.
cocos2d-x is:
@ -38,6 +38,12 @@ Git user attention
cocos2d-x $ git submodule update --init
Download stable versions
-----------------------
* [Cocos2d-x stable versions](http://www.cocos2d-x.org/download)
* [Cocos2d-JS Lite version](http://www.cocos2d-x.org/filecenter/jsbuilder)
How to start a new game
-----------------------
@ -53,6 +59,8 @@ Example:
$ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
$ cd NEW_PROJECTS_DIR/MyGame
You can also create a JS project or Lua project with `-l js` or `-l lua`.
### Build and run a new project for Android ###
$ cocos run -p android -j 4
@ -67,7 +75,7 @@ Example:
### Build and run a new project for Linux ###
if you never run cocos2d-x on Linux, you need to install all dependencies by the
If you never run cocos2d-x on Linux, you need to install all dependencies by the
script in **cocos2d/build/install-deps-linux.sh**
$ cd cocos2d-x/build
@ -100,6 +108,29 @@ Starting with Cocos2d-x v3.6 there will no longer be support for Windows Phone 8
See more info on How to install and Create games on Windows RT (Windows and Windows Phone 8.1) at http://msopentech.github.io/cocos2d-x/
### Build and run new project for web ###
Only JS project can be published to web platforms, so you will need to create a JS project first:
$ cocos new -l js WebGame
Then you can run your game in a web browser:
$ cocos run -p web
Or you can publish your game to `publish/html5/` folder:
$ cocos run -p web -m release [--advanced]
Documentations and samples
-------------
* [Online API Reference](http://cocos2d-x.org/wiki/Reference) _Note that Cocos2d-x and Cocos2d-JS have different API set_
* [Programmers Guide](http://cocos2d-x.org/programmersguide/)
* [Temporary Cocos2d-JS documents](http://cocos2d-x.org/docs/manual/framework/html5/en)
* [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)
* [Cocos2d sample games](https://github.com/cocos2d/cocos2d-x-samples) _More samples will be added in v3.8_
Main features
-------------
@ -141,9 +172,8 @@ Build Requirements
* or Windows 7+, VS 2013+
* Python 2.7.5
* NDK r10c+ is required to build Android games
* Windows Phone/Store 8.0 VS 2013+
* Windows Phone/Store 8.1 VS 2013 Update 3+
* Windows Phone/Store 8.1 VS 2013 Update 4+
* JRE or JDK 1.6+ is required for web publishing
Runtime Requirements
--------------------
@ -153,13 +183,28 @@ Runtime Requirements
* Windows 10.0 for Windows Phone/Store 10.0 games
* OS X v10.6+ for Mac games
* Windows 7+ for Win games
* Modern browsers and IE 9+ for web games
Running Tests
--------------------
Select the test you want from Xcode Scheme chooser.
* Cocos Console
```
// 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 OS X / iOS
```

View File

@ -221,20 +221,22 @@ bool Node::init()
void Node::cleanup()
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnCleanup))
return;
}
else if (_scriptType == kScriptTypeLua)
{
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnCleanup);
}
#endif // #if CC_ENABLE_SCRIPT_BINDING
// actions
this->stopAllActions();
this->unscheduleAllCallbacks();
#if CC_ENABLE_SCRIPT_BINDING
if ( _scriptType != kScriptTypeNone)
{
int action = kNodeOnCleanup;
BasicScriptData data(this,(void*)&action);
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
}
#endif // #if CC_ENABLE_SCRIPT_BINDING
// timers
for( const auto &child: _children)
child->cleanup();

View File

@ -63,6 +63,14 @@ ProtectedNode * ProtectedNode::create(void)
void ProtectedNode::cleanup()
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnCleanup))
return;
}
#endif // #if CC_ENABLE_SCRIPT_BINDING
Node::cleanup();
// timers
for( const auto &child: _protectedChildren)

View File

@ -191,6 +191,14 @@ void TransitionScene::onExit()
// custom cleanup
void TransitionScene::cleanup()
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnCleanup))
return;
}
#endif // #if CC_ENABLE_SCRIPT_BINDING
Scene::cleanup();
if( _isSendCleanupToScene )

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x-3.7rc1";
return "cocos2d-x-3.7";
}
NS_CC_END

View File

@ -1719,14 +1719,6 @@ char
{
},
/**
* @method cleanup
*/
cleanup : function (
)
{
},
/**
* @method getComponent
* @param {String} arg0

View File

@ -5248,6 +5248,16 @@ disableCascadeOpacity : function (
{
},
/**
* @method getState
* @return {ccui.Scale9Sprite::State}
*/
getState : function (
)
{
return 0;
},
/**
* @method setState
* @param {ccui.Scale9Sprite::State} arg0

View File

@ -4193,22 +4193,6 @@ bool js_cocos2dx_Node_setOpacity(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Node_setOpacity : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_cleanup : Invalid Native Object");
if (argc == 0) {
cobj->cleanup();
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_cleanup : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -5008,7 +4992,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) {
JS_FN("setLocalZOrder", js_cocos2dx_Node_setLocalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCascadeColorEnabled", js_cocos2dx_Node_setCascadeColorEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOpacity", js_cocos2dx_Node_setOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("cleanup", js_cocos2dx_Node_cleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getComponent", js_cocos2dx_Node_getComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getContentSize", js_cocos2dx_Node_getContentSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("stopAllActionsByTag", js_cocos2dx_Node_stopAllActionsByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -206,7 +206,6 @@ bool js_cocos2dx_Node_getScaleX(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_setLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_setCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_setOpacity(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_getContentSize(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_stopAllActionsByTag(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -14045,6 +14045,24 @@ bool js_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity(JSContext *cx, uint32_t a
JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Scale9Sprite_getState(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ui::Scale9Sprite* cobj = (cocos2d::ui::Scale9Sprite *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Scale9Sprite_getState : Invalid Native Object");
if (argc == 0) {
int ret = (int)cobj->getState();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_Scale9Sprite_getState : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_Scale9Sprite_setState(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -15052,6 +15070,7 @@ void js_register_cocos2dx_ui_Scale9Sprite(JSContext *cx, JS::HandleObject global
JS_FN("setFlippedX", js_cocos2dx_ui_Scale9Sprite_setFlippedX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("resizableSpriteWithCapInsets", js_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("disableCascadeOpacity", js_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getState", js_cocos2dx_ui_Scale9Sprite_getState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setState", js_cocos2dx_ui_Scale9Sprite_setState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setInsetBottom", js_cocos2dx_ui_Scale9Sprite_setInsetBottom, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithSpriteFrameName", js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),

View File

@ -726,6 +726,7 @@ bool js_cocos2dx_ui_Scale9Sprite_setFlippedY(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_ui_Scale9Sprite_setFlippedX(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_getState(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_setState(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_setInsetBottom(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -39,7 +39,7 @@
#include <assert.h>
#include <memory>
#define ENGINE_VERSION "Cocos2d-JS v3.7 RC1"
#define ENGINE_VERSION "Cocos2d-JS v3.7"
void js_log(const char *format, ...);

View File

@ -2371,90 +2371,98 @@ bool js_forceGC(JSContext *cx, uint32_t argc, jsval *vp) {
bool js_cocos2dx_retain(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
((Ref *)proxy->ptr)->retain();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_retain : Invalid Native Object");
cobj->retain();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_release(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
((Ref *)proxy->ptr)->release();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_release : Invalid Native Object");
cobj->release();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_Node_onEnter(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
ScriptingCore::getInstance()->setCalledFromScript(true);
static_cast<Node*>(proxy->ptr)->onEnter();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_onEnter : Invalid Native Object");
ScriptingCore::getInstance()->setCalledFromScript(true);
cobj->onEnter();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_Node_onExit(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
ScriptingCore::getInstance()->setCalledFromScript(true);
static_cast<Node*>(proxy->ptr)->onExit();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_onExit : Invalid Native Object");
ScriptingCore::getInstance()->setCalledFromScript(true);
cobj->onExit();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_Node_onEnterTransitionDidFinish(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
ScriptingCore::getInstance()->setCalledFromScript(true);
static_cast<Node*>(proxy->ptr)->onEnterTransitionDidFinish();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_onEnterTransitionDidFinish : Invalid Native Object");
ScriptingCore::getInstance()->setCalledFromScript(true);
cobj->onEnterTransitionDidFinish();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_Node_onExitTransitionDidStart(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *thisObj = JS_THIS_OBJECT(cx, vp);
if (thisObj) {
js_proxy_t *proxy = jsb_get_js_proxy(thisObj);
if (proxy) {
ScriptingCore::getInstance()->setCalledFromScript(true);
static_cast<Node*>(proxy->ptr)->onExitTransitionDidStart();
return true;
}
}
JS_ReportError(cx, "Invalid Native Object.");
return false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_onExitTransitionDidStart : Invalid Native Object");
ScriptingCore::getInstance()->setCalledFromScript(true);
cobj->onExitTransitionDidStart();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_cleanup : Invalid Native Object");
ScriptingCore::getInstance()->setCalledFromScript(true);
cobj->cleanup();
args.rval().setUndefined();
return true;
}
bool js_cocos2dx_CCNode_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
@ -6146,6 +6154,7 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
JS_DefineFunction(cx, tmpObj, "onExit", js_cocos2dx_Node_onExit, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "onEnterTransitionDidFinish", js_cocos2dx_Node_onEnterTransitionDidFinish, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "onExitTransitionDidStart", js_cocos2dx_Node_onExitTransitionDidStart, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "cleanup", js_cocos2dx_Node_cleanup, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "schedule", js_CCNode_schedule, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "scheduleOnce", js_CCNode_scheduleOnce, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "scheduleUpdateWithPriority", js_cocos2dx_CCNode_scheduleUpdateWithPriority, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);

View File

@ -262,6 +262,7 @@ bool js_cocos2dx_Node_onEnter(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_onExit(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_onEnterTransitionDidFinish(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_onExitTransitionDidStart(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Component_onEnter(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_Component_onExit(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -26,7 +26,7 @@
// CCConfig.js
//
cc.ENGINE_VERSION = "Cocos2d-JS v3.7 RC1";
cc.ENGINE_VERSION = "Cocos2d-JS v3.7";
cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0};

View File

@ -349,8 +349,8 @@
positionXPercent = PrePosition["X"] || 0;
positionYPercent = PrePosition["Y"] || 0;
}
var sizeXPercentEnable = json["PercentWidthEnable"] || false;
var sizeYPercentEnable = json["PercentHeightEnable"] || false;
var sizeXPercentEnable = json["PercentWidthEnable"] || json["PercentWidthEnabled"] || false;
var sizeYPercentEnable = json["PercentHeightEnable"]|| json["PercentHeightEnabled"] || false;
var sizeXPercent = 0,
sizeYPercent = 0,
PreSize = json["PreSize"];
@ -548,7 +548,7 @@
if (cc.sys.isNative) {
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
} else {
fontName = path.match(/([^\/]+)\.ttf/);
fontName = path.match(/([^\/]+)\.(\S+)/);
fontName = fontName ? fontName[1] : "";
}
widget.setFontName(fontName);
@ -632,7 +632,7 @@
if (cc.sys.isNative) {
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
} else {
fontName = path.match(/([^\/]+)\.ttf/);
fontName = path.match(/([^\/]+)\.(\S+)/);
fontName = fontName ? fontName[1] : "";
}
widget.setTitleFontName(fontName);
@ -1101,7 +1101,7 @@
if (cc.sys.isNative) {
fontName = cc.path.join(cc.loader.resPath, resourcePath, path);
} else {
fontName = path.match(/([^\/]+)\.ttf/);
fontName = path.match(/([^\/]+)\.(\S+)/);
fontName = fontName ? fontName[1] : "";
}
widget.setFontName(fontName);
@ -1217,8 +1217,6 @@
var currentAnimationName = json["CurrentAnimationName"];
parser.generalAttributes(node, json);
loadTexture(json["FileData"], resourcePath, function(path, type){
var plists, pngs;
var armJson = cc.loader.getRes(path);
@ -1236,8 +1234,15 @@
node.init(getFileName(path));
if(isAutoPlay)
node.getAnimation().play(currentAnimationName, -1, isLoop);
else{
node.getAnimation().play(currentAnimationName);
node.getAnimation().gotoAndPause(0);
}
});
parser.generalAttributes(node, json);
node.setColor(getColor(json["CColor"]));
return node;
};
@ -1257,13 +1262,16 @@
loadedPlist[resourcePath + plist] = true;
cc.spriteFrameCache.addSpriteFrames(resourcePath + plist);
}else{
if(!loadedPlist[resourcePath + plist])
if(!loadedPlist[resourcePath + plist] && !cc.spriteFrameCache.getSpriteFrame(path))
cc.log("%s need to be preloaded", resourcePath + plist);
}
}
if(type !== 0)
cb(path, type);
else
if(type !== 0){
if(cc.spriteFrameCache.getSpriteFrame(path))
cb(path, type);
else
cc.log("failed to get spriteFrame: %s", path);
}else
cb(resourcePath + path, type);
}
};

View File

@ -78,6 +78,14 @@
-- @param self
-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite)
--------------------------------
-- Query the current bright state.<br>
-- return @see `State`<br>
-- since v3.7
-- @function [parent=#Scale9Sprite] getState
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Change the state of 9-slice sprite.<br>
-- see `State`<br>

View File

@ -21788,6 +21788,53 @@ int lua_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Scale9Sprite_getState(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Scale9Sprite* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_getState'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Scale9Sprite_getState'", nullptr);
return 0;
}
int ret = (int)cobj->getState();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:getState",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Scale9Sprite_getState'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Scale9Sprite_setState(lua_State* tolua_S)
{
int argc = 0;
@ -23348,6 +23395,7 @@ int lua_register_cocos2dx_ui_Scale9Sprite(lua_State* tolua_S)
tolua_function(tolua_S,"setFlippedX",lua_cocos2dx_ui_Scale9Sprite_setFlippedX);
tolua_function(tolua_S,"resizableSpriteWithCapInsets",lua_cocos2dx_ui_Scale9Sprite_resizableSpriteWithCapInsets);
tolua_function(tolua_S,"disableCascadeOpacity",lua_cocos2dx_ui_Scale9Sprite_disableCascadeOpacity);
tolua_function(tolua_S,"getState",lua_cocos2dx_ui_Scale9Sprite_getState);
tolua_function(tolua_S,"setState",lua_cocos2dx_ui_Scale9Sprite_setState);
tolua_function(tolua_S,"setInsetBottom",lua_cocos2dx_ui_Scale9Sprite_setInsetBottom);
tolua_function(tolua_S,"initWithSpriteFrameName",lua_cocos2dx_ui_Scale9Sprite_initWithSpriteFrameName);

View File

@ -58,6 +58,7 @@ namespace ui {
,_flippedX(false)
,_flippedY(false)
,_isPatch9(false)
,_brightState(State::NORMAL)
{
this->setAnchorPoint(Vec2(0.5,0.5));
@ -556,6 +557,7 @@ namespace ui {
}
applyBlendFunc();
this->setState(_brightState);
if(this->_isPatch9)
{
size.width = size.width - 2;
@ -1051,7 +1053,11 @@ namespace ui {
CC_SAFE_DELETE(pReturn);
return NULL;
}
Scale9Sprite::State Scale9Sprite::getState()const
{
return _brightState;
}
void Scale9Sprite::setState(cocos2d::ui::Scale9Sprite::State state)
{
@ -1070,7 +1076,7 @@ namespace ui {
default:
break;
}
if (nullptr != _scale9Image)
{
_scale9Image->setGLProgramState(glState);
@ -1083,6 +1089,7 @@ namespace ui {
sp->setGLProgramState(glState);
}
}
_brightState = state;
}
/** sets the opacity.
@ -1385,6 +1392,14 @@ namespace ui {
void Scale9Sprite::cleanup()
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnCleanup))
return;
}
#endif // #if CC_ENABLE_SCRIPT_BINDING
Node::cleanup();
// timers
for( const auto &child: _protectedChildren)

View File

@ -466,6 +466,13 @@ namespace ui {
*/
void setState(State state);
/**
* Query the current bright state.
* @return @see `State`
* @since v3.7
*/
State getState()const;
/**
* @brief Query the sprite's original size.
*
@ -743,6 +750,7 @@ namespace ui {
bool _flippedX;
bool _flippedY;
bool _isPatch9;
State _brightState;
};
}} //end of namespace

View File

@ -2,7 +2,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Cocos2d-x v3.7 RC0 Release Notes](#cocos2d-x-v37-rc0-release-notes)
- [Cocos2d-x v3.7 Release Notes](#cocos2d-x-v37-release-notes)
- [Misc Information](#misc-information)
- [Requirements](#requirements)
- [Runtime Requirements](#runtime-requirements)
@ -32,7 +32,7 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Cocos2d-x v3.7 RC0 Release Notes #
# Cocos2d-x v3.7 Release Notes #
# Misc Information
@ -48,14 +48,15 @@
* Windows 7 or newer
* Windows Phone 8.1
* 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 or newer for Windows Phone 8
* Visual Studio 2013 or newer for Windows (win32)
* Visual Studio 2013 update4 or newer for Windows Phone 8
## How to run tests
@ -120,7 +121,6 @@ Then
* For win32 project, enter `cocos2d-x/build`, and open `cocos2d-win32.sln` or `cocos2d-js-win32.sln`
* For win 8.1 project, enter `cocos2d-x/build`, and open `cocos2d-win8.1-universal.sln` or `cocos2d-js-win8.1-universal.sln`
* For win 10 project, enter `cocos2d-x/build`, and open `cocos2d-win10.sln`
* Select running target
* Click run button
@ -169,11 +169,11 @@ cocos new -l cpp|js|lua MyGame
* JS: Merged JSB and web engine into Cocos2d-x for a All-in-one engine
* JS: Added `ccui.VideoPlayer` and `ccui.WebView` for iOS/Android/Web
* console: Supported build & run Android Studio project with cocos console
* sdkbox: super EASY way to integrate 3rd party SDKs into cocos2d-x
* SDKBOX: super EASY way to integrate 3rd party SDKs into cocos2d-x
## Download
[Cocos2d-x v3.7 RC0](http://www.cocos2d-x.org/filedown/cocos2d-x-3.7rc0.zip) including : C++, Lua & JS
[Cocos2d-x v3.7](http://www.cocos2d-x.org/filedown/cocos2d-x-3.7.zip) including : C++, Lua & JS
## The main features in detail:
@ -237,11 +237,14 @@ Samsung have provided a series of Enhanced API to optimize Cocos2d-x games for S
In the previous versions, the resources file name's case is ignored on win32 platform, but not ignored in other platforms. This will lead to some unexpected issues, especially when user develop with win32 platform and pulish to other platforms like Android. In win32, the file name may be found without matching the case, but on other platforms it won't be found. So we decided to make win32 platform's resources case sensitive. Please make sure you are using the correct file name for your resources.
### SDKBOX
SDKBOX is a project that's built by part of the cocos2d-x team, in order to makes integrating 3rd party SDKs super EASY.
With SDKBOX you can integrate services like In App Purchase with one command
```
sdkbox import -b iap
```
Currently supported service including
* [Tune](http://cocos2d-x.org/sdkbox/tune)
@ -253,9 +256,6 @@ Currently supported service including
* [Google Analytics](http://cocos2d-x.org/sdkbox/googleanalytics)
* [Flurry Analytics](http://cocos2d-x.org/sdkbox/flurryanalytics)
## The Next Step
As you can see, in v3.7, we have enhanced our 2d rendering with material system and integrated polygon sprite. More importantly, our 3d features become more and more complete, 3d Physics and Navigation Mesh with the previous Camera, 3d Sprite, 3d Particle System, 3d Light, 3d Terrain, Skybox, now you can really start to use Cocos to make a 3d game.

View File

@ -1009,6 +1009,8 @@ bool UIButtonDisableDefaultTest::init()
button->setZoomScale(0.4f);
button->setPressedActionEnabled(true);
button->setBright(false);
button->setScale9Enabled(true);
button->setCapInsets(Rect(3,3,5,5));
button->addClickEventListener([=](Ref*){
button->setBright(true);
});

@ -1 +1 @@
Subproject commit 69f709f86f2507e45563e3ae474299541b3cc387
Subproject commit f3768083be951e019a2983703847e05b2e284e7d

View File

@ -103,7 +103,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
CardinalSpline.*::[create actionWithDuration setPoints initWithDuration],
Scheduler::[pause resume ^unschedule$ unscheduleUpdate unscheduleAllForTarget schedule isTargetPaused isScheduled],
TextureCache::[addPVRTCImage],
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener operator.+],
*::[copyWith.* ^cleanup$ onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener operator.+],
FileUtils::[getFileData getDataFromFile writeDataToFile setFilenameLookupDictionary destroyInstance getFullPathCache],
Application::[^application.* ^run$ getCurrentLanguageCode setAnimationInterval],
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],