diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index cdbea4fd2f..2b2f87c8cd 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -2868,7 +2868,7 @@ bool js_BezierActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) if (argc == 2) { double arg0; cocos2d::_ccBezierConfig arg1; - ok &= JS::ToNumber( cx, JS::RootedValue(cx, args.get(0)), &arg0); + ok &= JS::ToNumber( cx, args.get(0), &arg0); int num; cocos2d::Vec2 *arr; diff --git a/templates/js-template-default/index.html b/templates/js-template-default/index.html index be7564a361..8d87f199ee 100644 --- a/templates/js-template-default/index.html +++ b/templates/js-template-default/index.html @@ -4,7 +4,7 @@ Cocos2d-html5 Hello World test - + @@ -23,6 +23,23 @@ + diff --git a/templates/js-template-runtime/index.html b/templates/js-template-runtime/index.html index be7564a361..8d87f199ee 100644 --- a/templates/js-template-runtime/index.html +++ b/templates/js-template-runtime/index.html @@ -4,7 +4,7 @@ Cocos2d-html5 Hello World test - + @@ -23,6 +23,23 @@ + diff --git a/tests/js-tests/main.js b/tests/js-tests/main.js index 0a1e22bb9c..6f55df4164 100644 --- a/tests/js-tests/main.js +++ b/tests/js-tests/main.js @@ -122,6 +122,8 @@ cc.game.onStart = function(){ } else { + cc.view.setDesignResolutionSize(800, 450, cc.ResolutionPolicy.SHOW_ALL); + cc.view.resizeWithBrowserSize(true); // js-test use cpptest resource in debug mode , and in the release mode, console will copy the resource into the res dir // so the respath will modify to res, if (cc.game.config[cc.game.CONFIG_KEY.engineDir] !== "frameworks/cocos2d-html5") { diff --git a/tests/js-tests/mobilePage.html b/tests/js-tests/mobilePage.html index da50765119..785b38179b 100644 --- a/tests/js-tests/mobilePage.html +++ b/tests/js-tests/mobilePage.html @@ -6,7 +6,6 @@ - - - + + + diff --git a/tests/js-tests/src/BakeLayerTest/BakeLayerTest.js b/tests/js-tests/src/BakeLayerTest/BakeLayerTest.js index 12b6af4993..b81142d341 100644 --- a/tests/js-tests/src/BakeLayerTest/BakeLayerTest.js +++ b/tests/js-tests/src/BakeLayerTest/BakeLayerTest.js @@ -127,12 +127,103 @@ var BakeLayerTest1 = BakeLayerBaseTest.extend({ } }); +var BakeLayerTest2 = BakeLayerBaseTest.extend({ + _bakeLayer: null, + + title:function () { + return "Test 2. Bake Layer with other layer (Canvas only)"; + }, + + subtitle: function () { + return "Changing top layer shouldn't increase draw call number"; + }, + + ctor: function(){ + this._super(); + + var winSize = cc.winSize; + var bakeItem = new cc.MenuItemFont("bake", this.onBake, this); + var unbakeItem = new cc.MenuItemFont("unbake", this.onUnbake, this); + var chTopItem = new cc.MenuItemFont("change top layer", this.onChangeZOrder, this); + var chBakeItem = new cc.MenuItemFont("change bake layer", this.onChangeBakeZOrder, this); + var menu = new cc.Menu(bakeItem, unbakeItem, chTopItem, chBakeItem); + + menu.alignItemsVertically(); + menu.x = winSize.width - 70; + menu.y = winSize.height - 120; + this.addChild(menu, 10); + + var rootLayer = new cc.Layer(); + rootLayer.setPosition(20,20); + this.addChild(rootLayer); + + var bakeLayer = new cc.Layer(); + bakeLayer.bake(); + bakeLayer.setRotation(30); + rootLayer.addChild(bakeLayer); + + for(var i = 0; i < 9; i++){ + var sprite1 = new cc.Sprite(s_pathGrossini); + if (i % 2 === 0) { + sprite1.setPosition(50 + i * 30, winSize.height / 2 - 150); + } else { + sprite1.setPosition(50 + i * 30, winSize.height / 2 - 100); + } + if(i === 4) + this._actionSprite = sprite1; + sprite1.rotation = 360 * Math.random(); + bakeLayer.addChild(sprite1); + } + this._bakeLayer = bakeLayer; + + var normalLayer = new cc.Layer(); + rootLayer.addChild(normalLayer); + + for(var i = 0; i < 9; i++){ + var sprite1 = new cc.Sprite(s_pathSister1); + if (i % 2 === 0) { + sprite1.setPosition(400 + i * 40, winSize.height / 2 - 50); + } else { + sprite1.setPosition(400 + i * 40, winSize.height / 2 + 50); + } + if(i === 4) + this._actionSprite = sprite1; + sprite1.rotation = 360 * Math.random(); + normalLayer.addChild(sprite1); + } + this._normalLayer = normalLayer; + + this.zOrder = 0; + }, + + onBake: function(){ + this._bakeLayer.bake(); + }, + + onUnbake: function(){ + this._bakeLayer.unbake(); + }, + + onChangeZOrder: function(){ + this.zOrder++; + var childId = Math.floor(Math.random() * 9); + this._normalLayer.children[childId].setLocalZOrder(this.zOrder); + this._normalLayer.children[childId].rotation = 360 * Math.random(); + }, + + onChangeBakeZOrder: function(){ + this.zOrder++; + var childId = Math.floor(Math.random() * 9); + this._bakeLayer.children[childId].setLocalZOrder(this.zOrder); + } +}); + var BakeLayerColorTest = BakeLayerBaseTest.extend({ _bakeLayer: null, _actionSprite: null, title:function () { - return "Test 2. Bake Layer Gradient (Canvas only)"; + return "Test 3. Bake Layer Gradient (Canvas only)"; }, ctor: function(){ @@ -210,6 +301,7 @@ var BakeLayerTestScene = TestScene.extend({ // var arrayOfBakeLayerTest = [ BakeLayerTest1, + BakeLayerTest2, BakeLayerColorTest ]; diff --git a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js index 4b5669184f..0f9a3b860c 100644 --- a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js +++ b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js @@ -130,6 +130,10 @@ var S9BatchNodeBasic = S9SpriteTestDemo.extend({ cc.log("this..addChild"); cc.log("... S9BatchNodeBasic done."); + + var moveBy = cc.moveBy(1, cc.p(80, 80)); + var moveByBack = moveBy.reverse(); + blocks.runAction(cc.sequence(moveBy,moveByBack)); } }); @@ -159,6 +163,10 @@ var S9FrameNameSpriteSheet = S9SpriteTestDemo.extend({ cc.log("this..addChild"); cc.log("... S9FrameNameSpriteSheet done."); + + var moveBy = cc.moveBy(1, cc.p(80, 80)); + var moveByBack = moveBy.reverse(); + blocks.runAction(cc.sequence(moveBy,moveByBack)); } }); diff --git a/web b/web index 56c240983a..116c3c9ac1 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 56c240983a8c7a6b221f840e3c45ed3d733ef102 +Subproject commit 116c3c9ac13354cd62e65dc4ef48738fa9872340