From 897b5fd0e97c16d37bcca27490689f0fa8f43bd1 Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Wed, 17 Jun 2015 18:37:19 +0800 Subject: [PATCH 01/30] add navmesh test project file and binding file --- .../js-bindings/proj.win32/libjscocos2d.vcxproj | 4 ++++ .../proj.win32/libjscocos2d.vcxproj.filters | 15 +++++++++++++++ tests/js-tests/project/Classes/AppDelegate.cpp | 7 +++++++ .../js-tests/project/proj.win32/js-tests.vcxproj | 2 +- tools/tojs/genbindings.py | 3 ++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index 4eb40ed7af..cde1d21742 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -17,6 +17,7 @@ + @@ -41,6 +42,7 @@ + @@ -56,6 +58,7 @@ + @@ -86,6 +89,7 @@ + diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters index c4e49936c6..083acea305 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters @@ -42,6 +42,9 @@ {3aaaf02d-80d8-4339-b4cd-89d89ade5293} + + {8c9f2cd3-9065-4bf5-a073-7697217022e2} + @@ -155,6 +158,12 @@ manual\physics3d + + auto + + + manual\navmesh + @@ -289,5 +298,11 @@ manual\physics3d + + auto + + + manual\navmesh + \ No newline at end of file diff --git a/tests/js-tests/project/Classes/AppDelegate.cpp b/tests/js-tests/project/Classes/AppDelegate.cpp index 03746d1ec3..ba4f3f2182 100644 --- a/tests/js-tests/project/Classes/AppDelegate.cpp +++ b/tests/js-tests/project/Classes/AppDelegate.cpp @@ -12,6 +12,8 @@ #include "jsb_cocos2dx_experimental.hpp" #include "jsb_cocos2dx_physics3d_auto.hpp" #include "physics3d/jsb_cocos2dx_physics3d_manual.h" +#include "jsb_cocos2dx_navmesh_auto.hpp" +#include "navmesh/jsb_cocos2dx_navmesh_manual.h" #include "experimental/jsb_cocos2dx_experimental_manual.h" #include "3d/jsb_cocos2dx_3d_manual.h" #include "extension/jsb_cocos2dx_extension_manual.h" @@ -125,6 +127,11 @@ bool AppDelegate::applicationDidFinishLaunching() sc->addRegisterCallback(register_all_cocos2dx_physics3d_manual); #endif +#if CC_USE_NAVMESH + sc->addRegisterCallback(register_all_cocos2dx_navmesh); + sc->addRegisterCallback(register_all_cocos2dx_navmesh_manual); +#endif + #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) diff --git a/tests/js-tests/project/proj.win32/js-tests.vcxproj b/tests/js-tests/project/proj.win32/js-tests.vcxproj index 4db3504798..e9f4400484 100644 --- a/tests/js-tests/project/proj.win32/js-tests.vcxproj +++ b/tests/js-tests/project/proj.win32/js-tests.vcxproj @@ -142,7 +142,7 @@ xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\res\resjs\" /e /Y js-tests_p.c - $(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(ProjectDir)..\Classes;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(ProjectDir)..\Classes;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) diff --git a/tools/tojs/genbindings.py b/tools/tojs/genbindings.py index b4db91e40f..3b94a4f03e 100755 --- a/tools/tojs/genbindings.py +++ b/tools/tojs/genbindings.py @@ -145,7 +145,8 @@ def main(): 'cocos2dx_experimental_webView.ini' : ('cocos2dx_experimental_webView', 'jsb_cocos2dx_experimental_webView_auto'), \ 'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'jsb_cocos2dx_experimental_video_auto'), \ 'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'jsb_cocos2dx_experimental'), \ - 'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'jsb_cocos2dx_physics3d_auto') + 'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'jsb_cocos2dx_physics3d_auto'), \ + 'cocos2dx_navmesh.ini' : ('cocos2dx_navmesh', 'jsb_cocos2dx_navmesh_auto'), } target = 'spidermonkey' generator_py = '%s/generator.py' % cxx_generator_root From b265033a414d2f07a8cf490496a9a72544aa76d6 Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Wed, 17 Jun 2015 18:38:18 +0800 Subject: [PATCH 02/30] add testcase and manual bindings --- .../navmesh/jsb_cocos2dx_navmesh_manual.cpp | 86 ++++ .../navmesh/jsb_cocos2dx_navmesh_manual.h | 37 ++ tests/js-tests/src/NavMeshTest/NavMeshTest.js | 379 ++++++++++++++++++ tests/js-tests/src/tests-main.js | 8 + 4 files changed, 510 insertions(+) create mode 100644 cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp create mode 100644 cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.h create mode 100644 tests/js-tests/src/NavMeshTest/NavMeshTest.js diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp new file mode 100644 index 0000000000..42dec115f3 --- /dev/null +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2011 Zynga Inc. +Copyright (c) 2013-2014 Chukong Technologies Inc. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "jsb_cocos2dx_navmesh_auto.hpp" +#if CC_USE_NAVMESH +#include "ScriptingCore.h" +#include "cocos2d_specifics.hpp" +#include "cocos2d.h" +#include "navmesh/CCNavMesh.h" +#include "js_manual_conversions.h" + +static bool jsb_cocos2dx_navmesh_NavMeshAgent_move(JSContext *cx, uint32_t argc, jsval *vp) +{ + JSObject *obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2(cobj, cx, false, "Invalid Native Object"); + + bool ok = true; + + if (argc == 1){ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + cocos2d::Vec3 arg0; + ok &= jsval_to_vector3(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "jsb_cocos2dx_navmesh_NavMeshAgent_move : Error processing arguments"); + cobj->move(arg0); + return true; + } + + if (argc == 2){ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + cocos2d::Vec3 arg0; + ok &= jsval_to_vector3(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "jsb_cocos2dx_navmesh_NavMeshAgent_move : Error processing arguments"); + + std::shared_ptr func(new JSFunctionWrapper(cx, obj, args.get(1))); + + cobj->move(arg0, [=](cocos2d::NavMeshAgent *agent, float totalTimeAfterMove)->void{ + jsval arg[2]; + js_proxy_t *proxy = js_get_or_create_proxy(cx, agent); + if (proxy) + arg[0] = OBJECT_TO_JSVAL(proxy->obj); + else + arg[0] = JSVAL_NULL; + arg[1] = DOUBLE_TO_JSVAL((double)totalTimeAfterMove); + JS::RootedValue rval(cx); + + bool ok = func->invoke(2, arg, &rval); + if (!ok && JS_IsExceptionPending(cx)) { + JS_ReportPendingException(cx); + } + }); + return true; + } +} + +extern JSObject *jsb_cocos2d_NavMeshAgent_prototype; + +void register_all_cocos2dx_navmesh_manual(JSContext *cx, JS::HandleObject global) +{ + JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_NavMeshAgent_prototype), "move", jsb_cocos2dx_navmesh_NavMeshAgent_move, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT); +} +#endif //#if CC_USE_NAVMESH diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.h b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.h new file mode 100644 index 0000000000..d86a108f32 --- /dev/null +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.h @@ -0,0 +1,37 @@ +/**************************************************************************** +Copyright (c) 2008-2010 Ricardo Quesada +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2011 Zynga Inc. +Copyright (c) 2013-2014 Chukong Technologies Inc. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "base/ccConfig.h" +#if CC_USE_NAVMESH +#ifndef __jsb_cocos2dx_navmesh_manual__ +#define __jsb_cocos2dx_navmesh_manual__ + +#include "jsapi.h" + +void register_all_cocos2dx_navmesh_manual(JSContext *cx, JS::HandleObject global); + +#endif // __jsb_cocos2dx_navmesh_manual__ +#endif //#if CC_USE_NAVMESH \ No newline at end of file diff --git a/tests/js-tests/src/NavMeshTest/NavMeshTest.js b/tests/js-tests/src/NavMeshTest/NavMeshTest.js new file mode 100644 index 0000000000..d89e0728a9 --- /dev/null +++ b/tests/js-tests/src/NavMeshTest/NavMeshTest.js @@ -0,0 +1,379 @@ +var NavMeshTestIdx = -1; + +var physicsScene = null; + +const START_POS_X = -0.5; +const START_POS_Y = -2.5; +const START_POS_Z = -0.5; + +const ARRAY_SIZE_X = 4; +const ARRAY_SIZE_Y = 3; +const ARRAY_SIZE_Z = 4; + +var NavMeshBaseTestDemo = cc.Layer.extend({ + _title:"NavMesh Test", + _camera:null, + _needMoveAgents:null, + _agents:null + ctor:function () { + this._super(); + + var size = cc.winSize; + this._camera = cc.Camera.createPerspective(30.0, size.width / size.height, 1.0, 1000.0); + this._camera.setPosition3D(cc.math.cc.math.vec3(0, 50, 100)); + this._camera.lookAt(cc.math.cc.math.vec3(0, 0, 0), cc.math.cc.math.vec3(0, 1, 0)); + this._camera.setCameraFlag(cc.CameraFlag.USER1); + this.addChild(this._camera); + + cc.eventManager.addListener({ + event:cc.EventListener.TOUCH_ALL_AT_ONCE, + onTouchesBegan:this.onTouchesBegan.bind(this), + onTouchesMoved:this.onTouchesMoved.bind(this), + onTouchesEnded:this.onTouchesEnded.bind(this) + }, this); + + this.initScene(); + this.scheduleUpdate(); + }, + + initScene:function () { + //create mesh + var trianglesList = jsb.Bundle3D.getTrianglesList("NavMesh/scene.obj"); + var rbDes = cc.physics3DRigidBodyDes(); + rbDes.mass = 0; + rbDes.shape = cc.Physics3DShape.createMesh(trianglesList[0], trianglesList.length/3); + var rigidBody = cc.Physics3DRigidBody.create(rbDes); + var component = cc.Physics3DComponent.create(rigidBody); + var sprite = cc.PhysicsSprite3D.create("NavMesh/scene.obj"); + sprite.addComponent(component); + sprite.setCameraMask(cc.CameraFlag.USER1); + this.addChild(sprite); + + physicsScene.setPhysics3DDebugCamera(this._camera); + + var navMesh = jsb.NavMesh.create("NavMesh/all_tiles_tilecache.bin", "NavMesh/geomset.txt"); + navMesh.setDebugDrawEnable(true); + setNavMesh(navMesh); + setNavMeshDebugCamera(this._camera); + + var ambientLight = jsb.AmbientLight.create(cc.color(64, 64, 64)); + ambientLight.setCameraMask(cc.CameraFlag.USER1); + this.addChild(ambientLight); + + var dirLight = jsb.DirectionLight.create(cc.math.cc.math.vec3(1.2f, -1.1f, 0.5f), cc.color(255, 255, 255)); + dirLight.setCameraMask(cc.CameraFlag.USER1); + this.addChild(dirLight); + }, + onMainMenuCallback:function () { + var scene = new cc.Scene(); + var layer = new TestController(); + scene.addChild(layer); + director.runScene(scene); + }, + runThisTest:function (num) { + NavMeshTestIdx = (num || num == 0) ? (num - 1) : -1; + var layer = nextNavMeshTest(); + this.addChild(layer); + + director.runScene(this); + }, + onTouchesBegan:function(touches, event){ + this._needMoveAgents = true; + }, + + onTouchesMoved:function(touches, event){ + if(touches.length > 0 && this._camera){ + var touch = touches[0]; + var delta = touch.getDelta(); + + this._angle -= cc.degreesToRadians(delta.x); + this._camera.setPosition3D(cc.math.cc.math.vec3(100*Math.sin(this._angle), 50, 100*Math.cos(this._angle))); + this._camera.lookAt(cc.math.cc.math.vec3(0, 0, 0), cc.math.cc.math.vec3(0, 1, 0)); + + if(delta.x * delta.x + delta.y + delta.y > 16) + this._needMoveAgents = false; + } + }, + + onTouchesEnded:function(touches, event){ + if(!this._needMoveAgents) + return; + if(touches.length > 0){ + var location = touches[0].getLocationInView(); + + var nearP = cc.math.vec3(location.x, location.y, -1); + var farP = cc.math.vec3(location.x, location.y, 1); + nearP = this._camera.unproject(nearP); + farP = this._camera.unproject(farP); + + var dir = cc.math.vec3Sub(farP, nearP); + + var result = {}; + this.getPhysics3DWorld().rayCast(nearp, farp, result); + this.moveAgents(result.hitPosition); + } + } + + + createAgent:function(pos){ + var filePath = "Sprite3DTest/girl.c3b"; + var param = {}; + param.radius = 2.0; + param.height = 8.0; + param.maxSpeed = 8.0; + var agent = jsb.NavMeshAgent.create(filePath); + var agentNode = jsb.Sprite3D.create(filePath); + agent.setOrientationRefAxes(cc.math.cc.math.vec3(-1.0f, 0.0f, 1.0f)); + + var data = {time:0}; + agent.setUserData(data); + agentNode.setScale(0.05); + agentNode.addComponent(agent); + + var node = new cc.Node(); + node.addChild(agentNode); + node.setPosition3D(pos); + node.setCameraMask(cc.CameraFlag.USER1); + this.addChild(node); + + var animation = jsb.Animation3D.create(filePath); + var animate = jsb.Animate3D.create(animation); + + if (animate){ + agentNode.runAction(new cc.RepeatForever(animate)); + animate.setSpeed(0); + } + + this._agents[this._agents.length] = {"agent":agent, "animate":animate}; + }, + createObstacle:function(pos){ + var obstacle = jsb.NavMeshObstacle.create(2.0, 8.0); + var obstacleNode = jsb.Sprite3D.create("Sprite3DTest/cylinder.c3b"); + obstacleNode.setPosition3D(cc.math.vec3(pos.x + 0.0, pos.y - 0.5, pos.z + 0.0)); + obstacleNode.setRotation3D(cc.math.vec3(-90.0, 0.0, 0.0)); + obstacleNode.setScale(0.3); + obstacleNode.addComponent(obstacle); + obstacleNode.setCameraMask(cc.CameraFlag.USER1); + this.addChild(obstacleNode); + }, + + jump:function(pV1, pV2, eight, t){ + var pOut; + pOut.x = pV1.x + t * (pV2.x - pV1.x); + pOut.y = pV1.y + t * (pV2.y - pV1.y); + pOut.z = pV1.z + t * (pV2.z - pV1.z); + pOut.y += height * cc.math.sinf(cc.math.M_PI * t); + return pOut; + }, + moveAgents:function(des){ + for (var index = 0; index < this._agents.length; index++){ + var callback = function(agent, totalTimeAfterMove){ + var data = agent.getUserData(); + if (agent.isOnOffMeshLink()){ + agent.setAutoTraverseOffMeshLink(false); + agent.setAutoOrientation(false); + var linkdata = agent.getCurrentOffMeshLinkData(); + + agent.getOwner().setPosition3D(jump(linkdata.startPosition, linkdata.endPosition, 10.0, data.time)); + var dir = cc.math.vec3(linkdata.endPosition.x - linkdata.startPosition.x, + linkdata.endPosition.y - linkdata.startPosition.y, linkdata.endPosition.z - linkdata.startPosition.z); + dir.y = 0.0; + dir.normalize(); + var axes; + var refAxes = cc.math.vec3(-1.0, 0.0, 1.0); + refAxes.normalize(); + cc.math.vec3.cross(refAxes, dir, &axes); + float angle = cc.math.vec3.dot(refAxes, dir); + agent.getOwner().setRotationQuat(Quaternion(axes, acosf(angle))); + data.time += 0.01; + if (1.0 < data.time){ + agent.completeOffMeshLink(); + agent.setAutoOrientation(true); + data.time = 0.0f; + } + } + }; + this._agents[index]["agent"].move(des, callback); + } + }, + update:function(dt) { + if (!this._agents) + { + return; + } + + for (var index = 0; index < this._agents.length; index++){ + var speed = this._agents[index]["agent"].getCurrentVelocity().length * 0.2 + this._agents[index]["animate"].setSpeed(speed) + } + + }, + // + // Menu + // + onEnter:function () { + this._super(); + + var label = new cc.LabelTTF(this._title, "Arial", 28); + this.addChild(label, 100, BASE_TEST_TITLE_TAG); + label.x = winSize.width / 2; + label.y = winSize.height - 50; + + var label2 = new cc.LabelTTF(this._subtitle, "Thonburi", 16); + this.addChild(label2, 101, BASE_TEST_SUBTITLE_TAG); + label2.x = winSize.width / 2; + label2.y = winSize.height - 80; + + var item1 = new cc.MenuItemImage(s_pathB1, s_pathB2, this.onBackCallback, this); + var item2 = new cc.MenuItemImage(s_pathR1, s_pathR2, this.onRestartCallback, this); + var item3 = new cc.MenuItemImage(s_pathF1, s_pathF2, this.onNextCallback, this); + + item1.tag = BASE_TEST_MENUITEM_PREV_TAG; + item2.tag = BASE_TEST_MENUITEM_RESET_TAG; + item3.tag = BASE_TEST_MENUITEM_NEXT_TAG; + + var menu = new cc.Menu(item1, item2, item3); + + menu.x = 0; + menu.y = 0; + var width = item2.width, height = item2.height; + item1.x = winSize.width/2 - width*2; + item1.y = height/2 ; + item2.x = winSize.width/2; + item2.y = height/2 ; + item3.x = winSize.width/2 + width*2; + item3.y = height/2 ; + + this.addChild(menu, 102, BASE_TEST_MENU_TAG); + }, + + onRestartCallback:function (sender) { + var s = new NavMeshTestScene(); + s.addChild(restartNavMeshTest()); + director.runScene(s); + }, + + onNextCallback:function (sender) { + var s = new NavMeshTestScene(); + s.addChild(nextNavMeshTest()); + director.runScene(s); + }, + + onBackCallback:function (sender) { + var s = new NavMeshTestScene(); + s.addChild(previousNavMeshTest()); + director.runScene(s); + } +}); + +var NavMeshBaseTestDemo = NavMeshBaseTestDemo.extend({ + _title:"Navigation Mesh Test", + _subtitle:"Basic Test", + ctor:function () { + this._super(); + + var label = new cc.LabelTTF("DebugDraw OFF"); + var menuItem = new cc.MenuItemLabel(label, function(){ + if(physicsScene.getPhysics3DWorld().isDebugDrawEnabled()){ + physicsScene.getPhysics3DWorld().setDebugDrawEnable(false); + label.setString("DebugDraw OFF"); + }else{ + physicsScene.getPhysics3DWorld().setDebugDrawEnable(true); + label.setString("DebugDraw ON"); + } + }, this); + + var menu = new cc.Menu(menuItem); + menu.setPosition(cc.p(0, 0)); + menuItem.setAnchorPoint(cc.p(0, 1)); + menuItem.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 50)); + this.addChild(menu); + + var result = {}; + this.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0), result); + this.createAgent(result.hitPosition); + } +}); + +var NavMeshAdvanceTestDemo = NavMeshBaseTestDemo.extend({ + _title:"Navigation Mesh Test", + _subtitle:"Advance Test", + ctor:function () { + this._super(); + + var label = new cc.LabelTTF(); + var label2 = new cc.LabelTTF(); + var label3 = new cc.LabelTTF(); + var menuItem = new cc.MenuItemFont("Create Obstacle", function(){ + if(physicsScene.getPhysics3DWorld().isDebugDrawEnabled()){ + physicsScene.getPhysics3DWorld().setDebugDrawEnable(false); + label.setString("DebugDraw OFF"); + }else{ + physicsScene.getPhysics3DWorld().setDebugDrawEnable(true); + label.setString("DebugDraw ON"); + } + }, this); + var menuItem2 = new cc.MenuItemFont("Create Agent", function(){ + + }, this); + var menuItem3 = new cc.MenuItemFont("DebugDraw OFF", function(){ + + }, this); + + var menu = new cc.Menu(menuItem, menuItem2, menuItem3); + menu.setPosition(cc.p(0, 0)); + menuItem.setAnchorPoint(cc.p(0, 1)); + menuItem.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 50)); + this.addChild(menu); + + var result = {}; + this.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0), result); + this.createAgent(result.hitPosition); + } +}); + +var NavMeshTestScene = cc.Scene.extend({ + + ctor:function () { + this._super(); + + var label = new cc.LabelTTF("Main Menu", "Arial", 20); + var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this); + + var menu = new cc.Menu(menuItem); + menu.x = 0; + menu.y = 0; + menuItem.x = winSize.width - 50; + menuItem.y = 25; + this.addChild(menu); + + this.initWithPhysics(); + this.getPhysics3DWorld().setDebugDrawEnable(false); + physicsScene = this; + } + +}); + +// +// Flow control +// +var arrayOfNavMeshTest = [ + NavMeshBaseTestDemo, +]; + +var nextNavMeshTest = function () { + NavMeshTestIdx++; + NavMeshTestIdx = NavMeshTestIdx % arrayOfNavMeshTest.length; + + return new arrayOfNavMeshTest[NavMeshTestIdx ](); +}; +var previousNavMeshTest = function () { + NavMeshTestIdx--; + if (NavMeshTestIdx < 0) + NavMeshTestIdx += arrayOfNavMeshTest.length; + + return new arrayOfNavMeshTest[NavMeshTestIdx ](); +}; +var restartNavMeshTest = function () { + return new arrayOfNavMeshTest[NavMeshTestIdx ](); +}; \ No newline at end of file diff --git a/tests/js-tests/src/tests-main.js b/tests/js-tests/src/tests-main.js index eb632b6722..4c478212dd 100644 --- a/tests/js-tests/src/tests-main.js +++ b/tests/js-tests/src/tests-main.js @@ -538,6 +538,14 @@ var testNames = [ return new Physics3DTestScene(); } }, + { + title:"NavMesh Test", + platforms: PLATFORM_JSB, + linksrc:"src/NavMeshTest/NavMeshTest.js", + testScene:function () { + return new Physics3DTestScene(); + } + }, { title:"ProgressActions Test", platforms: PLATFORM_ALL, From a94b49bdef870d64e1701f251c92934dc39c6dba Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 17 Jun 2015 23:41:12 +0800 Subject: [PATCH 03/30] Add nav mesh bindings --- .../jsb_cocos2dx_navmesh_conversions.cpp | 93 +++++++++++++++++++ .../jsb_cocos2dx_navmesh_conversions.h | 39 ++++++++ .../project.pbxproj | 48 +++++++++- tools/tojs/cocos2dx_navmesh.ini | 68 ++++++++++++++ 4 files changed, 246 insertions(+), 2 deletions(-) create mode 100644 cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp create mode 100644 cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h create mode 100644 tools/tojs/cocos2dx_navmesh.ini diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp new file mode 100644 index 0000000000..e1aab3205a --- /dev/null +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp @@ -0,0 +1,93 @@ +/* + * Created by Huabin LING on 17/6/15. + * Copyright (c) 2015 Chukong Technologies Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "jsb_cocos2dx_navmesh_conversions.h" +#include "cocos2d_specifics.hpp" +#include "js_manual_conversions.h" +#include "navmesh/CCNavMeshAgent.h" + +bool jsval_to_NavMeshAgentParam(JSContext *cx, JS::HandleValue v, cocos2d::NavMeshAgentParam* ret) +{ + JS::RootedObject tmp(cx); + JS::RootedValue jsr(cx); + JS::RootedValue jsh(cx); + JS::RootedValue jsmaxA(cx); + JS::RootedValue jsmaxS(cx); + JS::RootedValue jscQR(cx); + JS::RootedValue jspOR(cx); + JS::RootedValue jssW(cx); + JS::RootedValue jsuF(cx); + JS::RootedValue jsoAT(cx); + JS::RootedValue jsqFT(cx); + double radius, height, maxAcceleration, maxSpeed, collisionQueryRange, pathOptimizationRange, separationWeight, updateFlags, obstacleAvoidanceType, queryFilterType; + bool ok = v.isObject() && + JS_ValueToObject(cx, v, &tmp) && + JS_GetProperty(cx, tmp, "radius", &jsr) && + JS_GetProperty(cx, tmp, "height", &jsh) && + JS_GetProperty(cx, tmp, "maxAcceleration", &jsmaxA) && + JS_GetProperty(cx, tmp, "maxSpeed", &jsmaxS) && + JS_GetProperty(cx, tmp, "collisionQueryRange", &jscQR) && + JS_GetProperty(cx, tmp, "pathOptimizationRange", &jspOR) && + JS_GetProperty(cx, tmp, "separationWeight", &jssW) && + JS_GetProperty(cx, tmp, "updateFlags", &jsuF) && + JS_GetProperty(cx, tmp, "obstacleAvoidanceType", &jsoAT) && + JS_GetProperty(cx, tmp, "queryFilterType", &jsqFT) && + JS::ToNumber(cx, jsr, &radius) && + JS::ToNumber(cx, jsh, &height) && + JS::ToNumber(cx, jsmaxA, &maxAcceleration) && + JS::ToNumber(cx, jsmaxS, &maxSpeed) && + JS::ToNumber(cx, jscQR, &collisionQueryRange) && + JS::ToNumber(cx, jspOR, &pathOptimizationRange) && + JS::ToNumber(cx, jssW, &separationWeight) && + JS::ToNumber(cx, jsuF, &updateFlags) && + JS::ToNumber(cx, jsoAT, &obstacleAvoidanceType) && + JS::ToNumber(cx, jsoAT, &queryFilterType); + + JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); + + ret->radius = (float)radius; + ret->height = (float)height; + ret->maxAcceleration = (float)maxAcceleration; + ret->maxSpeed = (float)maxSpeed; + ret->collisionQueryRange = (float)collisionQueryRange; + ret->pathOptimizationRange = (float)pathOptimizationRange; + ret->separationWeight = (float)separationWeight; + ret->updateFlags = (unsigned char)updateFlags; + ret->obstacleAvoidanceType = (unsigned char)obstacleAvoidanceType; + ret->queryFilterType = (unsigned char)queryFilterType; + return true; +} + +jsval offMeshLinkData_to_jsval(JSContext* cx, const cocos2d::OffMeshLinkData& v) +{ + JS::RootedObject proto(cx); + JS::RootedObject parent(cx); + JS::RootedObject tmp(cx, JS_NewObject(cx, NULL, proto, parent)); + if (!tmp) return JSVAL_NULL; + bool ok = JS_DefineProperty(cx, tmp, "startPosition", JS::RootedValue(cx, vector3_to_jsval(cx, v.startPosition)), JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "endPosition", JS::RootedValue(cx, vector3_to_jsval(cx, v.endPosition)), JSPROP_ENUMERATE | JSPROP_PERMANENT); + if (ok) { + return OBJECT_TO_JSVAL(tmp); + } + return JSVAL_NULL; +} \ No newline at end of file diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h new file mode 100644 index 0000000000..ee31b0cf1f --- /dev/null +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h @@ -0,0 +1,39 @@ +/* + * Created by Huabin LING on 17/6/15. + * Copyright (c) 2015 Chukong Technologies Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#if CC_USE_NAVMESH +#ifndef __cocos2d_js_bindings__jsb_cocos2dx_navmesh_conversions__ +#define __cocos2d_js_bindings__jsb_cocos2dx_navmesh_conversions__ + +#include "jsapi.h" + +namespace cocos2d +{ + struct NavMeshAgentParam; +} + +bool jsval_to_NavMeshAgentParam(JSContext *cx, JS::HandleValue v, cocos2d::NavMeshAgentParam* ret); +jsval offMeshLinkData_to_jsval(JSContext* cx, const cocos2d::OffMeshLinkData& v); + +#endif /* defined(__cocos2d_js_bindings__jsb_cocos2dx_navmesh_conversions__) */ +#endif //#if CC_USE_NAVMESH diff --git a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj index 0d5d366619..cd1ab93c89 100644 --- a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj @@ -191,6 +191,18 @@ BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; }; BAEE4D731AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; }; BAEE4D741AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; }; + BAFA58FB1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */; }; + BAFA58FC1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */; }; + BAFA58FD1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */; }; + BAFA58FE1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */; }; + BAFA59031B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA59011B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp */; }; + BAFA59041B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA59011B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp */; }; + BAFA59051B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = BAFA59021B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h */; }; + BAFA59061B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = BAFA59021B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h */; }; + BAFA59091B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA59071B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp */; }; + BAFA590A1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAFA59071B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp */; }; + BAFA590B1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BAFA59081B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h */; }; + BAFA590C1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BAFA59081B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -307,6 +319,12 @@ BA623E17191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = jsb_cocos2dx_pluginx_auto.hpp; path = ../../../../plugin/jsbindings/auto/jsb_cocos2dx_pluginx_auto.hpp; sourceTree = ""; }; BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_extension_auto.cpp; sourceTree = ""; }; BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_extension_auto.hpp; sourceTree = ""; }; + BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_navmesh_auto.cpp; sourceTree = ""; }; + BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_navmesh_auto.hpp; sourceTree = ""; }; + BAFA59011B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_navmesh_manual.cpp; sourceTree = ""; }; + BAFA59021B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_navmesh_manual.h; sourceTree = ""; }; + BAFA59071B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_navmesh_conversions.cpp; sourceTree = ""; }; + BAFA59081B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_navmesh_conversions.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -377,6 +395,8 @@ 1AB5E62A18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp */, BA623E16191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp */, BA623E17191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp */, + BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */, + BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */, ); name = auto; path = ../auto; @@ -385,6 +405,7 @@ 1A119E4118BDF19200352BAA /* manual */ = { isa = PBXGroup; children = ( + BAFA59001B319F38004F9246 /* navmesh */, 426390011B0EC1C6004C53A2 /* physics3d */, 42AD25701AFF9DFC000176E2 /* experimental */, 420BBCF41AA48EE900493976 /* 3d */, @@ -602,6 +623,17 @@ name = pluginx; sourceTree = ""; }; + BAFA59001B319F38004F9246 /* navmesh */ = { + isa = PBXGroup; + children = ( + BAFA59071B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp */, + BAFA59081B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h */, + BAFA59011B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp */, + BAFA59021B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h */, + ); + path = navmesh; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -615,6 +647,7 @@ 83A5661B18DA878400FC31A0 /* jsb_socketio.h in Headers */, 1A1D3B7A18C44FD000922D3C /* jsb_event_dispatcher_manual.h in Headers */, 1A119EF518BDF19200352BAA /* js_bindings_system_registration.h in Headers */, + BAFA59051B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h in Headers */, 1A119EBF18BDF19200352BAA /* cocosbuilder_specifics.hpp in Headers */, 4B22F4AB1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */, 1A119ED118BDF19200352BAA /* js_bindings_config.h in Headers */, @@ -633,7 +666,9 @@ 1A119EDF18BDF19200352BAA /* jsb_helper.h in Headers */, 1A119ECB18BDF19200352BAA /* jsb_cocos2dx_extension_manual.h in Headers */, 1A119EEF18BDF19200352BAA /* js_bindings_system_functions.h in Headers */, + BAFA590B1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h in Headers */, 1A119EDD18BDF19200352BAA /* js_manual_conversions.h in Headers */, + BAFA58FD1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */, 1A119EFD18BDF19200352BAA /* XMLHTTPRequest.h in Headers */, 1AB5E63518D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */, 1A119EE318BDF19200352BAA /* jsb_opengl_functions.h in Headers */, @@ -667,10 +702,12 @@ 1A119EBE18BDF19200352BAA /* cocos2d_specifics.hpp in Headers */, 83A5661C18DA878400FC31A0 /* jsb_socketio.h in Headers */, 1A1D3B7B18C44FD000922D3C /* jsb_event_dispatcher_manual.h in Headers */, + BAFA59061B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.h in Headers */, 1A119EF618BDF19200352BAA /* js_bindings_system_registration.h in Headers */, BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */, 1A119EC018BDF19200352BAA /* cocosbuilder_specifics.hpp in Headers */, 1A119ED218BDF19200352BAA /* js_bindings_config.h in Headers */, + BAFA590C1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.h in Headers */, BAEE4D741AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */, 1A119EB618BDF19200352BAA /* js_bindings_chipmunk_manual.h in Headers */, 1A119EFA18BDF19200352BAA /* jsb_websocket.h in Headers */, @@ -707,6 +744,7 @@ 1A119EB018BDF19200352BAA /* js_bindings_chipmunk_functions.h in Headers */, 4BE089EC1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h in Headers */, BA623E0E191A195F00761F37 /* jsb_pluginx_manual_callback.h in Headers */, + BAFA58FE1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */, 1A119EB218BDF19200352BAA /* js_bindings_chipmunk_functions_registration.h in Headers */, 1A119EF218BDF19200352BAA /* js_bindings_system_functions_registration.h in Headers */, 1A119E8618BDF19200352BAA /* jsb_cocos2dx_auto.hpp in Headers */, @@ -796,6 +834,7 @@ 1A119EE918BDF19200352BAA /* jsb_opengl_registration.cpp in Sources */, 1A119EF718BDF19200352BAA /* jsb_websocket.cpp in Sources */, 1A119ED318BDF19200352BAA /* js_bindings_core.cpp in Sources */, + BAFA59031B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp in Sources */, 1A119EC118BDF19200352BAA /* js_bindings_ccbreader.cpp in Sources */, 1A119EFB18BDF19200352BAA /* XMLHTTPRequest.cpp in Sources */, BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */, @@ -819,8 +858,10 @@ 420BBCF01AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp in Sources */, 83A5661918DA878400FC31A0 /* jsb_socketio.cpp in Sources */, 1A119EE118BDF19200352BAA /* jsb_opengl_functions.cpp in Sources */, + BAFA59091B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */, 42638FFD1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */, 1A119EA718BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp in Sources */, + BAFA58FB1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp in Sources */, 1A119EFF18BDF19200352BAA /* ScriptingCore.cpp in Sources */, 1A1D3B7818C44FD000922D3C /* jsb_event_dispatcher_manual.cpp in Sources */, ); @@ -840,9 +881,11 @@ 1A119EF818BDF19200352BAA /* jsb_websocket.cpp in Sources */, 1A119ED418BDF19200352BAA /* js_bindings_core.cpp in Sources */, 420BBCF11AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp in Sources */, + BAFA58FC1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp in Sources */, 1A119EC218BDF19200352BAA /* js_bindings_ccbreader.cpp in Sources */, 1A119EFC18BDF19200352BAA /* XMLHTTPRequest.cpp in Sources */, 1A119EC618BDF19200352BAA /* jsb_cocos2dx_studio_manual.cpp in Sources */, + BAFA59041B319F38004F9246 /* jsb_cocos2dx_navmesh_manual.cpp in Sources */, 1A119E9018BDF19200352BAA /* jsb_cocos2dx_extension_auto.cpp in Sources */, 1A119ED818BDF19200352BAA /* js_bindings_opengl.cpp in Sources */, 1AB5E62C18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp in Sources */, @@ -871,6 +914,7 @@ BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */, BA623E0B191A195F00761F37 /* jsb_pluginx_extension_registration.cpp in Sources */, BA623E11191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp in Sources */, + BAFA590A1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */, BA623E18191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp in Sources */, 1A119F0018BDF19200352BAA /* ScriptingCore.cpp in Sources */, BA623E09191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp in Sources */, @@ -918,7 +962,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/navmesh $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual"; }; name = Debug; }; @@ -952,7 +996,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SKIP_INSTALL = YES; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../../../cocos $(SRCROOT)/../../../../cocos/base $(SRCROOT)/../../../../cocos/3d $(SRCROOT)/../../../../cocos/2d $(SRCROOT)/../../../../cocos/physics3d $(SRCROOT)/../../../../cocos/navmesh $(SRCROOT)/../../../../cocos/platform $(SRCROOT)/../../../../cocos/audio/include $(SRCROOT)/../../../../cocos/editor-support $(SRCROOT)/../../../../cocos/editor-support/cocosbuilder $(SRCROOT)/../../../../cocos/editor-support/cocostudio $(SRCROOT)/../../../../cocos/editor-support/spine $(SRCROOT)/../../../../cocos/ui $(SRCROOT)/../../../../cocos/storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external $(SRCROOT)/../auto $(SRCROOT)/../manual"; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/tools/tojs/cocos2dx_navmesh.ini b/tools/tojs/cocos2dx_navmesh.ini new file mode 100644 index 0000000000..adff64a872 --- /dev/null +++ b/tools/tojs/cocos2dx_navmesh.ini @@ -0,0 +1,68 @@ +[cocos2dx_navmesh] +# the prefix to be added to the generated functions. You might or might not use this in your own +# templates +prefix = cocos2dx_navmesh + +# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) +# all classes will be embedded in that namespace +target_namespace = jsb + +macro_judgement = #if CC_USE_NAVMESH + +android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include +android_flags = -D_SIZE_T_DEFINED_ + +clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include +clang_flags = -nostdinc -x c++ -std=c++11 -D CC_USE_NAVMESH + +win32_clang_flags = -U __SSE__ + +cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external -I%(cocosdir)s/external/recast/Detour -I%(cocosdir)s/external/recast/DetourCrowd -I%(cocosdir)s/external/recast/DetourTileCache -I%(cocosdir)s/external/recast/DebugUtils -I%(cocosdir)s/external/recast/fastlz -I%(cocosdir)s/external/recast/Recast -I%(cocosdir)s/cocos/scripting/js-bindings/manual -I%(cocosdir)s/external/spidermonkey/include/android + +cocos_flags = -DANDROID + +cxxgenerator_headers = + +# extra arguments for clang +extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s + +# what headers to parse +headers = %(cocosdir)s/cocos/navmesh/CCNavMesh.h + +cpp_headers = %(jsbdir)s/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h + +# what classes to produce code for. You can use regular expressions here. When testing the regular +# expression, it will be enclosed in "^$", like this: "^Menu*$". +classes = NavMesh NavMeshAgent NavMeshObstacle + +# what should we skip? in the format ClassName::[function function] +# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also +# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just +# add a single "*" as functions. See bellow for several examples. A special class name is "*", which +# will apply to all class names. This is a convenience wildcard to be able to skip similar named +# functions from all classes. + +skip = NavMesh::[findPath], + NavMeshObstacle::[setRadius setHeight], + NavMeshAgent::[move (g|s)etUserData] + +rename_functions = + +rename_classes = + +# for all class names, should we remove something when registering in the target VM? +remove_prefix = + +# classes for which there will be no "parent" lookup +classes_have_no_parents = NavMesh + +# base classes which will be skipped when their sub-classes found them. +base_classes_to_skip = + +# classes that create no constructor +# Set is special and we will use a hand-written constructor +abstract_classes = + +# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. +script_control_cpp = no + From 3975d44d3ba0761641918eaf08edbc7174b08b20 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 18 Jun 2015 00:58:03 +0800 Subject: [PATCH 04/30] Chain NavMeshTest --- tests/js-tests/project.json | 3 ++- tests/js-tests/src/tests-main.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/js-tests/project.json b/tests/js-tests/project.json index a014ce397f..401b3baac8 100644 --- a/tests/js-tests/project.json +++ b/tests/js-tests/project.json @@ -189,6 +189,7 @@ "src/SpritePolygonTest/SpritePolygonTest.js", "src/MaterialSystemTest/MaterialSystemTest.js", "src/TerrainTest/TerrainTest.js", - "src/Physics3DTest/Physics3DTest.js" + "src/Physics3DTest/Physics3DTest.js", + "src/NavMeshTest/NavMeshTest.js" ] } diff --git a/tests/js-tests/src/tests-main.js b/tests/js-tests/src/tests-main.js index 4c478212dd..702f3e5065 100644 --- a/tests/js-tests/src/tests-main.js +++ b/tests/js-tests/src/tests-main.js @@ -543,7 +543,7 @@ var testNames = [ platforms: PLATFORM_JSB, linksrc:"src/NavMeshTest/NavMeshTest.js", testScene:function () { - return new Physics3DTestScene(); + return new NavMeshTestScene(); } }, { From 4fe1542d17d323bb73d94c01f4960f86a9109f5b Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Thu, 18 Jun 2015 19:22:27 +0800 Subject: [PATCH 05/30] add navmesh tests --- .../js-bindings/manual/cocos2d_specifics.cpp | 91 +++++++ .../proj.win32/libjscocos2d.vcxproj | 4 +- .../proj.win32/libjscocos2d.vcxproj.filters | 6 + cocos/scripting/js-bindings/script/jsb.js | 3 + .../js-bindings/script/navmesh/jsb_navmesh.js | 41 +++ .../project/proj.win32/js-tests.vcxproj | 2 +- tests/js-tests/src/NavMeshTest/NavMeshTest.js | 236 ++++++++++-------- .../src/Physics3DTest/Physics3DTest.js | 2 +- tests/js-tests/src/tests-main.js | 2 +- 9 files changed, 275 insertions(+), 112 deletions(-) create mode 100644 cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index af03397abc..76fd0206f5 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5602,6 +5602,90 @@ bool js_cocos2dx_Scene_getPhysics3DWorld(JSContext *cx, uint32_t argc, jsval *vp return false; } #endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS +#if CC_USE_NAVMESH +bool js_cocos2dx_Scene_setNavMeshDebugCamera(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Invalid Native Object"); + if (argc == 1) { + cocos2d::Camera* arg0; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Error processing arguments"); + cobj->setNavMeshDebugCamera(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Scene_setNavMeshDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Scene_setNavMesh(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMesh : Invalid Native Object"); + if (argc == 1) { + cocos2d::NavMesh* arg0; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::NavMesh*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMesh : Error processing arguments"); + cobj->setNavMesh(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Scene_setNavMesh : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Scene_getNavMesh(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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_getNavMesh : Invalid Native Object"); + if (argc == 0) { + cocos2d::NavMesh* ret = cobj->getNavMesh(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::NavMesh*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } + else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Scene_getNavMesh : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +#endif //CC_USE_NAVMESH JSClass *jsb_cocos2d_PolygonInfo_class; JSObject *jsb_cocos2d_PolygonInfo_prototype; @@ -6336,4 +6420,11 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global) JS_DefineFunction(cx, tmpObj, "initWithPhysics", js_cocos2dx_Scene_initWithPhysics, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); JS_DefineFunction(cx, tmpObj, "getPhysics3DWorld", js_cocos2dx_Scene_getPhysics3DWorld, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); #endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS + +#if CC_USE_NAVMESH + tmpObj.set(jsb_cocos2d_Scene_prototype); + JS_DefineFunction(cx, tmpObj, "getNavMesh", js_cocos2dx_Scene_getNavMesh, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); + JS_DefineFunction(cx, tmpObj, "setNavMeshDebugCamera", js_cocos2dx_Scene_setNavMeshDebugCamera, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT); + JS_DefineFunction(cx, tmpObj, "setNavMesh", js_cocos2dx_Scene_setNavMesh, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT); +#endif CC_USE_NAVMESH } diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index a3062c7628..576cd3ccc8 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -40,6 +40,7 @@ + @@ -85,6 +86,7 @@ + @@ -181,7 +183,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" true true WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\navmesh;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings) true None diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters index d98acb7d08..5706864402 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters @@ -158,6 +158,9 @@ manual\navmesh + + manual\navmesh + @@ -292,5 +295,8 @@ manual\navmesh + + manual\navmesh + \ No newline at end of file diff --git a/cocos/scripting/js-bindings/script/jsb.js b/cocos/scripting/js-bindings/script/jsb.js index e88f281201..44e98bfdfe 100644 --- a/cocos/scripting/js-bindings/script/jsb.js +++ b/cocos/scripting/js-bindings/script/jsb.js @@ -140,3 +140,6 @@ if (jsb.ParticleSystem3D) { if(cc.Physics3DObject) require("script/physics3d/jsb_physics3d.js"); + +if(jsb.NavMeshAgent) + require("script/navmesh/jsb_navmesh.js"); diff --git a/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js b/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js new file mode 100644 index 0000000000..9eba194467 --- /dev/null +++ b/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js @@ -0,0 +1,41 @@ + +jsb.NavMesh.UpdateFlags = +{ + DT_CROWD_ANTICIPATE_TURNS:1, + DT_CROWD_OBSTACLE_AVOIDANCE:2, + DT_CROWD_SEPARATION:4, + DT_CROWD_OPTIMIZE_VIS:8, ///< Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path. + DT_CROWD_OPTIMIZE_TOPO:16, ///< Use dtPathCorridor::optimizePathTopology() to optimize the agent path. +}; + + +cc.NavMeshAgentParam = function(){ + this.radius = 0.6; + this.height = 2; + this.maxAcceleration = 8; + this.maxSpeed = 3.5; + this.collisionQueryRange = this.radius * 12; + this.pathOptimizationRange = this.radius * 30; + this.updateFlags = jsb.NavMesh.UpdateFlags.DT_CROWD_ANTICIPATE_TURNS | + jsb.NavMesh.UpdateFlags.DT_CROWD_OPTIMIZE_VIS | + jsb.NavMesh.UpdateFlags.DT_CROWD_OPTIMIZE_TOPO | + jsb.NavMesh.UpdateFlags.DT_CROWD_OBSTACLE_AVOIDANCE; + this.obstacleAvoidanceType = 3; + this.separationWeight = 2; + this.queryFilterType = 0; +} + +cc.navMeshAgentParam = function(){ + return new cc.NavMeshAgentParam(); +}; + +cc.AgentUserData = function(){ + this.time = 0; +}; + +cc.agentUserData = function(){ + return new cc.AgentUserData(); +}; + +jsb.NavMeshAgent.prototype.setUserData = cc.Node.prototype.setUserData; +jsb.NavMeshAgent.prototype.getUserData = cc.Node.prototype.getUserData; \ No newline at end of file diff --git a/tests/js-tests/project/proj.win32/js-tests.vcxproj b/tests/js-tests/project/proj.win32/js-tests.vcxproj index e9f4400484..4db3504798 100644 --- a/tests/js-tests/project/proj.win32/js-tests.vcxproj +++ b/tests/js-tests/project/proj.win32/js-tests.vcxproj @@ -142,7 +142,7 @@ xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\res\resjs\" /e /Y js-tests_p.c - $(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(ProjectDir)..\Classes;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(ProjectDir)..\Classes;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) diff --git a/tests/js-tests/src/NavMeshTest/NavMeshTest.js b/tests/js-tests/src/NavMeshTest/NavMeshTest.js index d89e0728a9..8ad38a8a26 100644 --- a/tests/js-tests/src/NavMeshTest/NavMeshTest.js +++ b/tests/js-tests/src/NavMeshTest/NavMeshTest.js @@ -1,27 +1,61 @@ var NavMeshTestIdx = -1; var physicsScene = null; +var START_POS_X = -0.5; +var START_POS_Y = -2.5; +var START_POS_Z = -0.5; -const START_POS_X = -0.5; -const START_POS_Y = -2.5; -const START_POS_Z = -0.5; +var ARRAY_SIZE_X = 4; +var ARRAY_SIZE_Y = 3; +var ARRAY_SIZE_Z = 4; -const ARRAY_SIZE_X = 4; -const ARRAY_SIZE_Y = 3; -const ARRAY_SIZE_Z = 4; +var NavMeshTestScene = cc.Scene.extend({ -var NavMeshBaseTestDemo = cc.Layer.extend({ - _title:"NavMesh Test", - _camera:null, - _needMoveAgents:null, - _agents:null ctor:function () { this._super(); + var label = new cc.LabelTTF("Main Menu", "Arial", 20); + var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this); + + var menu = new cc.Menu(menuItem); + menu.x = 0; + menu.y = 0; + menuItem.x = winSize.width - 50; + menuItem.y = 25; + this.addChild(menu); + + this.initWithPhysics(); + this.getPhysics3DWorld().setDebugDrawEnable(false); + physicsScene = this; + }, + onMainMenuCallback:function () { + var scene = new cc.Scene(); + var layer = new TestController(); + scene.addChild(layer); + director.runScene(scene); + }, + runThisTest:function (num) { + director.runScene(this); + } + +}); + +var NavMeshBaseTestDemo = NavMeshTestScene.extend({ + _title:"NavMesh Test", + _camera:null, + _needMoveAgents:null, + _agents:[], + _angle:null, + ctor:function () { + this._super(); + + this._agents = []; + this._angle = 0.0; + var size = cc.winSize; this._camera = cc.Camera.createPerspective(30.0, size.width / size.height, 1.0, 1000.0); - this._camera.setPosition3D(cc.math.cc.math.vec3(0, 50, 100)); - this._camera.lookAt(cc.math.cc.math.vec3(0, 0, 0), cc.math.cc.math.vec3(0, 1, 0)); + this._camera.setPosition3D(cc.math.vec3(0, 50, 100)); + this._camera.lookAt(cc.math.vec3(0, 0, 0), cc.math.vec3(0, 1, 0)); this._camera.setCameraFlag(cc.CameraFlag.USER1); this.addChild(this._camera); @@ -41,10 +75,10 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ var trianglesList = jsb.Bundle3D.getTrianglesList("NavMesh/scene.obj"); var rbDes = cc.physics3DRigidBodyDes(); rbDes.mass = 0; - rbDes.shape = cc.Physics3DShape.createMesh(trianglesList[0], trianglesList.length/3); + rbDes.shape = cc.Physics3DShape.createMesh(trianglesList, trianglesList.length/3); var rigidBody = cc.Physics3DRigidBody.create(rbDes); var component = cc.Physics3DComponent.create(rigidBody); - var sprite = cc.PhysicsSprite3D.create("NavMesh/scene.obj"); + var sprite = jsb.Sprite3D.create("NavMesh/scene.obj"); sprite.addComponent(component); sprite.setCameraMask(cc.CameraFlag.USER1); this.addChild(sprite); @@ -53,32 +87,21 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ var navMesh = jsb.NavMesh.create("NavMesh/all_tiles_tilecache.bin", "NavMesh/geomset.txt"); navMesh.setDebugDrawEnable(true); - setNavMesh(navMesh); - setNavMeshDebugCamera(this._camera); + physicsScene.setNavMesh(navMesh); + physicsScene.setNavMeshDebugCamera(this._camera); var ambientLight = jsb.AmbientLight.create(cc.color(64, 64, 64)); ambientLight.setCameraMask(cc.CameraFlag.USER1); this.addChild(ambientLight); - var dirLight = jsb.DirectionLight.create(cc.math.cc.math.vec3(1.2f, -1.1f, 0.5f), cc.color(255, 255, 255)); + var dirLight = jsb.DirectionLight.create(cc.math.vec3(1.2, -1.1, 0.5), cc.color(255, 255, 255)); dirLight.setCameraMask(cc.CameraFlag.USER1); this.addChild(dirLight); }, - onMainMenuCallback:function () { - var scene = new cc.Scene(); - var layer = new TestController(); - scene.addChild(layer); - director.runScene(scene); - }, - runThisTest:function (num) { - NavMeshTestIdx = (num || num == 0) ? (num - 1) : -1; - var layer = nextNavMeshTest(); - this.addChild(layer); - - director.runScene(this); - }, + onTouchesBegan:function(touches, event){ this._needMoveAgents = true; + return true; }, onTouchesMoved:function(touches, event){ @@ -87,8 +110,8 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ var delta = touch.getDelta(); this._angle -= cc.degreesToRadians(delta.x); - this._camera.setPosition3D(cc.math.cc.math.vec3(100*Math.sin(this._angle), 50, 100*Math.cos(this._angle))); - this._camera.lookAt(cc.math.cc.math.vec3(0, 0, 0), cc.math.cc.math.vec3(0, 1, 0)); + this._camera.setPosition3D(cc.math.vec3(100*Math.sin(this._angle), 50, 100*Math.cos(this._angle))); + this._camera.lookAt(cc.math.vec3(0, 0, 0), cc.math.vec3(0, 1, 0)); if(delta.x * delta.x + delta.y + delta.y > 16) this._needMoveAgents = false; @@ -105,27 +128,25 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ var farP = cc.math.vec3(location.x, location.y, 1); nearP = this._camera.unproject(nearP); farP = this._camera.unproject(farP); - - var dir = cc.math.vec3Sub(farP, nearP); - - var result = {}; - this.getPhysics3DWorld().rayCast(nearp, farp, result); + cc.log("ray cast before"); + var result = physicsScene.getPhysics3DWorld().rayCast(nearP, farP); + cc.log("ray cast after"); this.moveAgents(result.hitPosition); } - } + }, createAgent:function(pos){ var filePath = "Sprite3DTest/girl.c3b"; - var param = {}; + var param = cc.navMeshAgentParam(); param.radius = 2.0; param.height = 8.0; param.maxSpeed = 8.0; - var agent = jsb.NavMeshAgent.create(filePath); + var agent = jsb.NavMeshAgent.create(param); var agentNode = jsb.Sprite3D.create(filePath); - agent.setOrientationRefAxes(cc.math.cc.math.vec3(-1.0f, 0.0f, 1.0f)); + agent.setOrientationRefAxes(cc.math.vec3(-1.0, 0.0, 1.0)); - var data = {time:0}; + var data = cc.agentUserData(); agent.setUserData(data); agentNode.setScale(0.05); agentNode.addComponent(agent); @@ -134,7 +155,7 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ node.addChild(agentNode); node.setPosition3D(pos); node.setCameraMask(cc.CameraFlag.USER1); - this.addChild(node); + physicsScene.addChild(node); var animation = jsb.Animation3D.create(filePath); var animate = jsb.Animate3D.create(animation); @@ -157,15 +178,16 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ this.addChild(obstacleNode); }, - jump:function(pV1, pV2, eight, t){ - var pOut; + jump:function(pV1, pV2, height, t){ + var pOut = cc.math.vec3(); pOut.x = pV1.x + t * (pV2.x - pV1.x); pOut.y = pV1.y + t * (pV2.y - pV1.y); pOut.z = pV1.z + t * (pV2.z - pV1.z); - pOut.y += height * cc.math.sinf(cc.math.M_PI * t); + pOut.y += height * Math.sin(Math.PI * t); return pOut; }, moveAgents:function(des){ + var self = this; for (var index = 0; index < this._agents.length; index++){ var callback = function(agent, totalTimeAfterMove){ var data = agent.getUserData(); @@ -174,7 +196,7 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ agent.setAutoOrientation(false); var linkdata = agent.getCurrentOffMeshLinkData(); - agent.getOwner().setPosition3D(jump(linkdata.startPosition, linkdata.endPosition, 10.0, data.time)); + agent.getOwner().setPosition3D(self.jump(linkdata.startPosition, linkdata.endPosition, 10.0, data.time)); var dir = cc.math.vec3(linkdata.endPosition.x - linkdata.startPosition.x, linkdata.endPosition.y - linkdata.startPosition.y, linkdata.endPosition.z - linkdata.startPosition.z); dir.y = 0.0; @@ -182,14 +204,14 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ var axes; var refAxes = cc.math.vec3(-1.0, 0.0, 1.0); refAxes.normalize(); - cc.math.vec3.cross(refAxes, dir, &axes); - float angle = cc.math.vec3.dot(refAxes, dir); - agent.getOwner().setRotationQuat(Quaternion(axes, acosf(angle))); + axes = cc.math.vec3Cross(refAxes, dir); + var angle = cc.math.vec3Dot(refAxes, dir); + agent.getOwner().setRotationQuat(cc.math.quaternion(axes, Math.acos(angle))); data.time += 0.01; if (1.0 < data.time){ agent.completeOffMeshLink(); agent.setAutoOrientation(true); - data.time = 0.0f; + data.time = 0.0; } } }; @@ -197,14 +219,15 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ } }, update:function(dt) { + this._super(dt); if (!this._agents) { return; } for (var index = 0; index < this._agents.length; index++){ - var speed = this._agents[index]["agent"].getCurrentVelocity().length * 0.2 - this._agents[index]["animate"].setSpeed(speed) + var speed = cc.math.vec3Length( this._agents[index]["agent"].getCurrentVelocity() ) * 0.2 + this._agents[index]["animate"].setSpeed(0.0 < speed ? speed : 0.0) } }, @@ -248,25 +271,19 @@ var NavMeshBaseTestDemo = cc.Layer.extend({ }, onRestartCallback:function (sender) { - var s = new NavMeshTestScene(); - s.addChild(restartNavMeshTest()); - director.runScene(s); + director.runScene(restartNavMeshTest()); }, onNextCallback:function (sender) { - var s = new NavMeshTestScene(); - s.addChild(nextNavMeshTest()); - director.runScene(s); + director.runScene(nextNavMeshTest()); }, onBackCallback:function (sender) { - var s = new NavMeshTestScene(); - s.addChild(previousNavMeshTest()); - director.runScene(s); + director.runScene(previousNavMeshTest()); } }); -var NavMeshBaseTestDemo = NavMeshBaseTestDemo.extend({ +var NavMeshBasicTestDemo = NavMeshBaseTestDemo.extend({ _title:"Navigation Mesh Test", _subtitle:"Basic Test", ctor:function () { @@ -274,12 +291,13 @@ var NavMeshBaseTestDemo = NavMeshBaseTestDemo.extend({ var label = new cc.LabelTTF("DebugDraw OFF"); var menuItem = new cc.MenuItemLabel(label, function(){ - if(physicsScene.getPhysics3DWorld().isDebugDrawEnabled()){ - physicsScene.getPhysics3DWorld().setDebugDrawEnable(false); - label.setString("DebugDraw OFF"); - }else{ - physicsScene.getPhysics3DWorld().setDebugDrawEnable(true); - label.setString("DebugDraw ON"); + var enabledDebug = physicsScene.getNavMesh().isDebugDrawEnabled(); + physicsScene.getNavMesh().setDebugDrawEnable(!enabledDebug); + if (enabledDebug){ + label.setString("Debug Draw ON"); + } + else{ + label.setString("Debug Draw OFF"); } }, this); @@ -289,8 +307,12 @@ var NavMeshBaseTestDemo = NavMeshBaseTestDemo.extend({ menuItem.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 50)); this.addChild(menu); - var result = {}; - this.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0), result); + + }, + onEnter:function () { + this._super(); + + var result = physicsScene.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0)); this.createAgent(result.hitPosition); } }); @@ -304,61 +326,59 @@ var NavMeshAdvanceTestDemo = NavMeshBaseTestDemo.extend({ var label = new cc.LabelTTF(); var label2 = new cc.LabelTTF(); var label3 = new cc.LabelTTF(); - var menuItem = new cc.MenuItemFont("Create Obstacle", function(){ - if(physicsScene.getPhysics3DWorld().isDebugDrawEnabled()){ - physicsScene.getPhysics3DWorld().setDebugDrawEnable(false); - label.setString("DebugDraw OFF"); - }else{ - physicsScene.getPhysics3DWorld().setDebugDrawEnable(true); - label.setString("DebugDraw ON"); + var self = this; + var menuItem = new cc.MenuItemLabel(new cc.LabelTTF("Create Obstacle"), function(){ + var x = Math.random() * 100 - 50; + var z = Math.random() * 100 - 50; + var result = physicsScene.getPhysics3DWorld().rayCast(cc.math.vec3(x, 50, z), cc.math.vec3(x, -50, z)); + self.createObstacle(result.hitPosition); + }, this); + var menuItem2 = new cc.MenuItemLabel(new cc.LabelTTF("Create Agent"), function(){ + var x = Math.random() * 100 - 50; + var z = Math.random() * 100 - 50; + var result = physicsScene.getPhysics3DWorld().rayCast(cc.math.vec3(x, 50, z), cc.math.vec3(x, -50, z)); + self.createAgent(result.hitPosition); + }, this); + + var label = new cc.LabelTTF("DebugDraw OFF"); + var menuItem3 = new cc.MenuItemLabel(label, function(){ + var enabledDebug = physicsScene.getNavMesh().isDebugDrawEnabled(); + physicsScene.getNavMesh().setDebugDrawEnable(!enabledDebug); + if (enabledDebug){ + label.setString("Debug Draw ON"); + } + else{ + label.setString("Debug Draw OFF"); } - }, this); - var menuItem2 = new cc.MenuItemFont("Create Agent", function(){ - - }, this); - var menuItem3 = new cc.MenuItemFont("DebugDraw OFF", function(){ - }, this); var menu = new cc.Menu(menuItem, menuItem2, menuItem3); menu.setPosition(cc.p(0, 0)); menuItem.setAnchorPoint(cc.p(0, 1)); menuItem.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 50)); + menuItem2.setAnchorPoint(cc.p(0, 1)); + menuItem2.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 100)); + menuItem3.setAnchorPoint(cc.p(0, 1)); + menuItem3.setPosition(cc.p(cc.visibleRect.left.x, cc.visibleRect.top.y - 150)); this.addChild(menu); - var result = {}; - this.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0), result); + }, + onEnter:function () { + this._super(); + + var result = physicsScene.getPhysics3DWorld().rayCast(cc.math.vec3(0, 50, 0), cc.math.vec3(0, -50, 0)); this.createAgent(result.hitPosition); } }); -var NavMeshTestScene = cc.Scene.extend({ - ctor:function () { - this._super(); - - var label = new cc.LabelTTF("Main Menu", "Arial", 20); - var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this); - - var menu = new cc.Menu(menuItem); - menu.x = 0; - menu.y = 0; - menuItem.x = winSize.width - 50; - menuItem.y = 25; - this.addChild(menu); - - this.initWithPhysics(); - this.getPhysics3DWorld().setDebugDrawEnable(false); - physicsScene = this; - } - -}); // // Flow control // var arrayOfNavMeshTest = [ - NavMeshBaseTestDemo, + NavMeshBasicTestDemo, + NavMeshAdvanceTestDemo ]; var nextNavMeshTest = function () { diff --git a/tests/js-tests/src/Physics3DTest/Physics3DTest.js b/tests/js-tests/src/Physics3DTest/Physics3DTest.js index 1e87d6b773..db11146111 100644 --- a/tests/js-tests/src/Physics3DTest/Physics3DTest.js +++ b/tests/js-tests/src/Physics3DTest/Physics3DTest.js @@ -432,7 +432,7 @@ var Physics3DConstraintDemo = Physics3DTestDemo.extend({ farP = this._camera.unproject(size, farP); var result = this._world.rayCast(nearP, farP); - if(result !== false && result.hitObj.getObjType() == cc.Physics3DObject.PhysicsObjType.RIGID_BODY) + if(result.hitObj !== undefined && result.hitObj.getObjType() == cc.Physics3DObject.PhysicsObjType.RIGID_BODY) { var mat = cc.math.mat4GetInversed(result.hitObj.getWorldTransform()); var position = cc.math.mat4TransformPoint(mat, result.hitPosition); diff --git a/tests/js-tests/src/tests-main.js b/tests/js-tests/src/tests-main.js index 702f3e5065..0c2e8b26c1 100644 --- a/tests/js-tests/src/tests-main.js +++ b/tests/js-tests/src/tests-main.js @@ -543,7 +543,7 @@ var testNames = [ platforms: PLATFORM_JSB, linksrc:"src/NavMeshTest/NavMeshTest.js", testScene:function () { - return new NavMeshTestScene(); + return new nextNavMeshTest(); } }, { From e0b66707f994c19672b0df6a05c454c0d48cd23f Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Thu, 18 Jun 2015 19:30:05 +0800 Subject: [PATCH 06/30] add nerviest android file --- cocos/scripting/js-bindings/proj.android/Android.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cocos/scripting/js-bindings/proj.android/Android.mk b/cocos/scripting/js-bindings/proj.android/Android.mk index 4c9507b609..5e6931603b 100755 --- a/cocos/scripting/js-bindings/proj.android/Android.mk +++ b/cocos/scripting/js-bindings/proj.android/Android.mk @@ -40,6 +40,7 @@ LOCAL_SRC_FILES := ../auto/jsb_cocos2dx_3d_auto.cpp \ ../auto/jsb_cocos2dx_3d_extension_auto.cpp \ ../auto/jsb_cocos2dx_experimental_webView_auto.cpp \ ../auto/jsb_cocos2dx_experimental_video_auto.cpp \ + ../auto/jsb_cocos2dx_navmesh_auto.cpp \ ../auto/jsb_cocos2dx_spine_auto.cpp \ ../auto/jsb_cocos2dx_auto.cpp \ ../auto/jsb_cocos2dx_studio_auto.cpp \ @@ -73,6 +74,8 @@ LOCAL_SRC_FILES := ../auto/jsb_cocos2dx_3d_auto.cpp \ ../manual/network/XMLHTTPRequest.cpp \ ../manual/spine/jsb_cocos2dx_spine_manual.cpp \ ../manual/ui/jsb_cocos2dx_ui_manual.cpp \ + ../manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp \ + ../manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp \ ../manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp @@ -83,12 +86,14 @@ LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \ $(LOCAL_PATH)/../manual/cocostudio \ $(LOCAL_PATH)/../manual/spine \ + $(LOCAL_PATH)/../manual/navmesh \ $(LOCAL_PATH)/../auto \ $(LOCAL_PATH)/../../../2d \ $(LOCAL_PATH)/../../../3d \ $(LOCAL_PATH)/../../../physics3d \ $(LOCAL_PATH)/../../../base \ $(LOCAL_PATH)/../../../ui \ + $(LOCAL_PATH)/../../../navmesh \ $(LOCAL_PATH)/../../../audio/include \ $(LOCAL_PATH)/../../../storage \ $(LOCAL_PATH)/../../../../extensions \ From 05c40b13f9f47021b4d60f5f47022debace833a6 Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Thu, 18 Jun 2015 21:30:30 +0800 Subject: [PATCH 07/30] fix the win32 head error --- cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index 576cd3ccc8..dedd403230 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -157,7 +157,7 @@ Level3 Disabled WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - $(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\navmesh;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings) true false From 82c09e8d0c00f631a5407f73e5dec1339045606c Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Wed, 17 Jun 2015 17:10:31 +0800 Subject: [PATCH 08/30] Fixed a bug that xhr cross-domain error --- tests/js-tests/src/XHRTest/XHRTest.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/js-tests/src/XHRTest/XHRTest.js b/tests/js-tests/src/XHRTest/XHRTest.js index eee0ef2bb9..5d468363d6 100644 --- a/tests/js-tests/src/XHRTest/XHRTest.js +++ b/tests/js-tests/src/XHRTest/XHRTest.js @@ -104,10 +104,13 @@ var XHRTestLayer = cc.Layer.extend({ // 5 seconds for timeout xhr.timeout = 5000; - xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); - //set arguments with ?xxx=xxx&yyy=yyy - xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true); + if(cc.sys.isNative){ + xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true); + xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); + }else{ + xhr.open("GET", "http://httpbin.org/get?show_env=1", true); + } xhr.send(); }, @@ -127,7 +130,7 @@ var XHRTestLayer = cc.Layer.extend({ ensureLeftAligned(responseLabel); responseLabel.x = winSize.width / 10 * 3; responseLabel.y = winSize.height / 2; - + var xhr = cc.loader.getXMLHttpRequest(); streamXHREventsToLabel(xhr, statusPostLabel, responseLabel, "POST"); From 0a526875a8a2d8ca6a11d71106b2a48c84ad1eb8 Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Thu, 18 Jun 2015 09:23:15 +0800 Subject: [PATCH 09/30] Fixed a bug that xhr cross-domain error --- tests/js-tests/src/XHRTest/XHRTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/js-tests/src/XHRTest/XHRTest.js b/tests/js-tests/src/XHRTest/XHRTest.js index 5d468363d6..2334255201 100644 --- a/tests/js-tests/src/XHRTest/XHRTest.js +++ b/tests/js-tests/src/XHRTest/XHRTest.js @@ -107,10 +107,10 @@ var XHRTestLayer = cc.Layer.extend({ //set arguments with ?xxx=xxx&yyy=yyy if(cc.sys.isNative){ xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true); - xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); }else{ xhr.open("GET", "http://httpbin.org/get?show_env=1", true); } + xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); xhr.send(); }, From 77c3e9bdde62bf6cd2c203754242602e5e3b4241 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 18 Jun 2015 09:41:16 +0800 Subject: [PATCH 10/30] issue #12414:Add UIS9NinePatchTest for Lua and js --- tests/js-tests/project.json | 1 + tests/js-tests/src/GUITest/UISceneManager.js | 8 ++ .../CocoStudioGUITest/CocoStudioGUITest.lua | 78 +++++++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/tests/js-tests/project.json b/tests/js-tests/project.json index 401b3baac8..8203911ae1 100644 --- a/tests/js-tests/project.json +++ b/tests/js-tests/project.json @@ -171,6 +171,7 @@ "src/GUITest/UITextTest/UITextTest.js", "src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js", "src/GUITest/UIWebViewTest/UIWebViewTest.js", + "src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js", "src/CocoStudioTest/SceneTest/TriggerCode/Acts.js", "src/CocoStudioTest/SceneTest/TriggerCode/Cons.js", diff --git a/tests/js-tests/src/GUITest/UISceneManager.js b/tests/js-tests/src/GUITest/UISceneManager.js index 38c7824c63..b492f45c53 100644 --- a/tests/js-tests/src/GUITest/UISceneManager.js +++ b/tests/js-tests/src/GUITest/UISceneManager.js @@ -528,6 +528,14 @@ return new UIRichTextTest(); } } + ], + "UIS9NinePatchTest": [ + { + title: "UIS9NinePatchTest", + func: function () { + return new UIS9NinePatchTest(); + } + } ] }; diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua index 44626fee77..7f476084a6 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua @@ -4017,6 +4017,78 @@ function UIFocusTestNestedLayout3.create() return scene end +local UIS9NinePatchTest = class("UIS9NinePatchTest",UIScene) + +function UIS9NinePatchTest.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, UIS9NinePatchTest) + return target +end + +function UIS9NinePatchTest:initExtend() + self:init() + + local widgetSize = self._widget:getContentSize() + self._displayValueLabel = ccui.Text:create() + self._displayValueLabel:setString("UIS9NinePatchTest") + self._displayValueLabel:setFontName(font_TextName) + self._displayValueLabel:setFontSize(32) + self._displayValueLabel:setAnchorPoint(cc.p(0.5, -1)) + self._displayValueLabel:setPosition(cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0 + self._displayValueLabel:getContentSize().height * 1.8)) + self._uiLayer:addChild(self._displayValueLabel) + + cc.SpriteFrameCache:getInstance():addSpriteFrames("cocosui/android9patch.plist") + + local winSize = cc.Director:getInstance():getWinSize() + local x = winSize.width / 2 + local y = 0 + (winSize.height / 2 + 50) + + local preferedSize = cc.size(99,99) + + --9-patch sprite with filename + local playerSprite = ccui.Scale9Sprite:create("cocosui/player.9.png") + playerSprite:setPosition(x, y) + playerSprite:setContentSize(preferedSize) + local capInsets = playerSprite:getCapInsets() + print(string.format("player sprite capInset = %f, %f %f, %f", capInsets.x, + capInsets.y, capInsets.width, capInsets.height)) + self:addChild(playerSprite) + + local animationBtnSprite = ccui.Scale9Sprite:createWithSpriteFrameName("animationbuttonpressed.png") + animationBtnSprite:setPosition(x-100, y-100) + capInsets = animationBtnSprite:getCapInsets() + print(string.format("animationBtnSprite capInset = %f, %f %f, %f", capInsets.x, + capInsets.y, capInsets.width, capInsets.height)) + self:addChild(animationBtnSprite) + + + local monsterSprite = ccui.Scale9Sprite:createWithSpriteFrameName("monster.9.png") + monsterSprite:setPosition(x+100, y-100) + capInsets = monsterSprite:getCapInsets() + monsterSprite:setContentSize(preferedSize) + print(string.format("monsterSprite capInset = %f, %f %f, %f", capInsets.x, + capInsets.y, capInsets.width, capInsets.height)) + self:addChild(monsterSprite) + + local spriteFrame = cc.SpriteFrameCache:getInstance():getSpriteFrame("buttonnormal.9.png") + local buttonScale9Sprite = ccui.Scale9Sprite:createWithSpriteFrame(spriteFrame) + buttonScale9Sprite:setContentSize(cc.size(150,80)) + buttonScale9Sprite:setPosition(cc.p(100,200)) + self:addChild(buttonScale9Sprite) +end + +function UIS9NinePatchTest.create() + local scene = cc.Scene:create() + local layer = UIS9NinePatchTest.extend(cc.Layer:create()) + layer:initExtend() + scene:addChild(layer) + return scene +end + local cocoStudioGuiArray = { { @@ -4326,6 +4398,12 @@ local cocoStudioGuiArray = return UIRichTextTest.create() end }, + { + title = "UIS9NinePatchTest", + func = function() + return UIS9NinePatchTest.create() + end + }, } function guiSceneManager.nextUIScene() From 496ce50ff51f943692b809aa04a8d38a08727680 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 18 Jun 2015 09:43:05 +0800 Subject: [PATCH 11/30] issue #12414:Add UIS9NinePatchTest for js --- .../UIS9NinePatchTest/UIS9NinePatchTest.js | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js diff --git a/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js b/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js new file mode 100644 index 0000000000..e66ed79d78 --- /dev/null +++ b/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js @@ -0,0 +1,73 @@ +/**************************************************************************** + Copyright (c) 2011-2012 cocos2d-x.org + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +var UIS9NinePatchTest = UIScene.extend({ + init: function () { + if (this._super()) { + //init text + this._topDisplayLabel.setString(""); + this._bottomDisplayLabel.setString(""); + + cc.spriteFrameCache.addSpriteFrames("ccs-res/cocosui/android9patch.plist"); + + var winSize = director.getWinSize(); + var x = winSize.width / 2; + var y = 0 + (winSize.height / 2 + 50); + + var preferedSize = cc.size(99,99); + + //9-patch sprite with filename + var playerSprite = new cc.Scale9Sprite("ccs-res/cocosui/player.9.png"); + playerSprite.setPosition(x, y); + playerSprite.setContentSize(preferedSize); + var capInsets = playerSprite.getCapInsets(); + cc.log("player sprite capInset = " + capInsets.x + ", " + capInsets.y + " " + capInsets.width + ", " + capInsets.height); + this.addChild(playerSprite); + + var animationBtnSprite = new cc.Scale9Sprite("animationbuttonpressed.png"); + animationBtnSprite.setPosition(x-100, y-100); + capInsets = animationBtnSprite.getCapInsets(); + cc.log("animationBtnSprite capInset = " + capInsets.x + ", " + capInsets.y + " " + capInsets.width + ", " + capInsets.height); + this.addChild(animationBtnSprite); + + + var monsterSprite = new cc.Scale9Sprite("monster.9.png"); + monsterSprite.setPosition(x+100, y-100); + capInsets = monsterSprite.getCapInsets(); + monsterSprite.setContentSize(preferedSize); + cc.log("monsterSprite capInset = ", + capInsets.x + ", " + capInsets.y + " " + capInsets.width + ", " + capInsets.height); + this.addChild(monsterSprite); + + var spriteFrame = cc.spriteFrameCache.getSpriteFrame("buttonnormal.9.png"); + var buttonScale9Sprite = new cc.Scale9Sprite(spriteFrame); + buttonScale9Sprite.setContentSize(cc.size(150,80)); + buttonScale9Sprite.setPosition(cc.p(100,200)); + this.addChild(buttonScale9Sprite); + + return true; + } + return false; + } +}); \ No newline at end of file From cbfa92d3fd4b51a04d0eedb12241c6034be941a5 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 18 Jun 2015 09:44:47 +0800 Subject: [PATCH 12/30] Add a new line. --- .../js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js b/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js index e66ed79d78..cffd0efa11 100644 --- a/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js +++ b/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js @@ -70,4 +70,4 @@ var UIS9NinePatchTest = UIScene.extend({ } return false; } -}); \ No newline at end of file +}); From a98b4931513210cabbceaacc1a2cef39724e126d Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 18 Jun 2015 10:08:13 +0800 Subject: [PATCH 13/30] Update UIS9NinePatchTest for jsb --- tests/js-tests/src/GUITest/UISceneManager.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/js-tests/src/GUITest/UISceneManager.js b/tests/js-tests/src/GUITest/UISceneManager.js index b492f45c53..841d0e9ed3 100644 --- a/tests/js-tests/src/GUITest/UISceneManager.js +++ b/tests/js-tests/src/GUITest/UISceneManager.js @@ -528,16 +528,19 @@ return new UIRichTextTest(); } } - ], - "UIS9NinePatchTest": [ - { + ] + }; + + if (cc.sys.isNative) { + testingItems["UIS9NinePatchTest"] = [ + { title: "UIS9NinePatchTest", func: function () { return new UIS9NinePatchTest(); } } - ] - }; + ]; + } if (cc.sys.os == cc.sys.OS_ANDROID || cc.sys.os == cc.sys.OS_IOS || !cc.sys.isNative) { From b17702e6f13704cf30df56cc35e8e3f4c591188c Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Thu, 18 Jun 2015 11:15:45 +0800 Subject: [PATCH 14/30] fix compile error for linux --- cocos/2d/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CMakeLists.txt b/cocos/2d/CMakeLists.txt index c9c60f3bee..dadb7100bb 100644 --- a/cocos/2d/CMakeLists.txt +++ b/cocos/2d/CMakeLists.txt @@ -67,7 +67,7 @@ set(COCOS_2D_SRC 2d/CCSpriteFrameCache.cpp 2d/CCSpriteFrame.cpp 2d/CCAutoPolygon.cpp - ../../external/clipper/clipper.cpp + ../external/clipper/clipper.cpp 2d/CCTextFieldTTF.cpp 2d/CCTileMapAtlas.cpp 2d/CCTMXLayer.cpp From 3da67d3358aaab6a88ef4e3f935692c282312a1e Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Thu, 18 Jun 2015 11:54:25 +0800 Subject: [PATCH 15/30] change the seek to time --- .../js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js b/tests/js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js index af6afd3355..8461604551 100644 --- a/tests/js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js +++ b/tests/js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js @@ -53,7 +53,7 @@ var UIVideoPlayerTest = UIScene.extend({ video.resume(); }}, { name: "SEEKTO", func: function(){ - var sec = ((Math.random() * 3) * 100 | 0) / 100; + var sec = ((Math.random() * 59) * 100 | 0) / 100; cc.log("seekTo %f sec!", sec); video.seekTo(sec); }}, From 0806e58255c8aac6f3a9f7abbd119a571ecf0845 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 18 Jun 2015 12:03:30 +0800 Subject: [PATCH 16/30] Fix the error skip function error for Sprite. --- tools/tolua/cocos2dx.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 11c87fe934..f17ad11f04 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -36,7 +36,7 @@ classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* M # functions from all classes. skip = Node::[setGLServerState description getUserObject .*UserData getGLServerState .*schedule getPosition$ setContentSize setAnchorPoint enumerateChildren getonEnterTransitionDidFinishCallback getOnEnterCallback getOnExitCallback getonExitTransitionDidStartCallback setAdditionalTransform setRotationQuat getRotationQuat .*(Physics).*], - Sprite::[getQuad ^setPosition$ create setPolygonInfo initWithPolygon getPolygonInfo], + Sprite::[getQuad ^setPosition$ ^create$ setPolygonInfo initWithPolygon getPolygonInfo], SpriteBatchNode::[getDescendants], MotionStreak::[draw update], ParticleSystem::[updateQuadWithParticle initParticle], From c069da629e0977d68ec062adc413e7ef837b9673 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 18 Jun 2015 05:43:02 +0000 Subject: [PATCH 17/30] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../lua-bindings/auto/api/Sprite.lua | 30 ++++ .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 145 ++++++++++++++++++ .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 3 + 3 files changed, 178 insertions(+) diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Sprite.lua index 92bab73b70..44e61a83f3 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite.lua @@ -261,6 +261,36 @@ -- @param #rect_table rect -- @return Sprite#Sprite self (return value: cc.Sprite) +-------------------------------- +-- @overload self, cc.Texture2D, rect_table, bool +-- @overload self, cc.Texture2D +-- @function [parent=#Sprite] createWithTexture +-- @param self +-- @param #cc.Texture2D texture +-- @param #rect_table rect +-- @param #bool rotated +-- @return Sprite#Sprite ret (return value: cc.Sprite) + +-------------------------------- +-- Creates a sprite with an sprite frame name.
+-- A SpriteFrame will be fetched from the SpriteFrameCache by spriteFrameName param.
+-- If the SpriteFrame doesn't exist it will raise an exception.
+-- param spriteFrameName A null terminated string which indicates the sprite frame name.
+-- return An autoreleased sprite object. +-- @function [parent=#Sprite] createWithSpriteFrameName +-- @param self +-- @param #string spriteFrameName +-- @return Sprite#Sprite ret (return value: cc.Sprite) + +-------------------------------- +-- Creates a sprite with an sprite frame.
+-- param spriteFrame A sprite frame which involves a texture and a rect.
+-- return An autoreleased sprite object. +-- @function [parent=#Sprite] createWithSpriteFrame +-- @param self +-- @param #cc.SpriteFrame spriteFrame +-- @return Sprite#Sprite ret (return value: cc.Sprite) + -------------------------------- -- @overload self, cc.Node, int, string -- @overload self, cc.Node, int, int diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 54a1af7a02..ecc989f40b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -70206,6 +70206,148 @@ int lua_cocos2dx_Sprite_setVertexRect(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Sprite_createWithTexture(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 2) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 1) + { + cocos2d::Texture2D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.Sprite:createWithTexture"); + if (!ok) { break; } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithTexture(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite:createWithTexture",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithTexture'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_Sprite_createWithSpriteFrameName(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite:createWithSpriteFrameName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'", nullptr); + return 0; + } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrameName(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrameName",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrameName'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_Sprite_createWithSpriteFrame(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Sprite",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + cocos2d::SpriteFrame* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.SpriteFrame",&arg0, "cc.Sprite:createWithSpriteFrame"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'", nullptr); + return 0; + } + cocos2d::Sprite* ret = cocos2d::Sprite::createWithSpriteFrame(arg0); + object_to_luaval(tolua_S, "cc.Sprite",(cocos2d::Sprite*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite:createWithSpriteFrame",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Sprite_createWithSpriteFrame'.",&tolua_err); +#endif + return 0; +} int lua_cocos2dx_Sprite_constructor(lua_State* tolua_S) { int argc = 0; @@ -70287,6 +70429,9 @@ int lua_register_cocos2dx_Sprite(lua_State* tolua_S) tolua_function(tolua_S,"isFlippedX",lua_cocos2dx_Sprite_isFlippedX); tolua_function(tolua_S,"isFlippedY",lua_cocos2dx_Sprite_isFlippedY); tolua_function(tolua_S,"setVertexRect",lua_cocos2dx_Sprite_setVertexRect); + tolua_function(tolua_S,"createWithTexture", lua_cocos2dx_Sprite_createWithTexture); + tolua_function(tolua_S,"createWithSpriteFrameName", lua_cocos2dx_Sprite_createWithSpriteFrameName); + tolua_function(tolua_S,"createWithSpriteFrame", lua_cocos2dx_Sprite_createWithSpriteFrame); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::Sprite).name(); g_luaType[typeName] = "cc.Sprite"; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 5bf82ddefb..945d7349d5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2055,6 +2055,9 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + From e2f834e96b656e9bd2e843a00d4f0e8d64a20e0c Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Thu, 18 Jun 2015 14:24:52 +0800 Subject: [PATCH 18/30] Fixed warn --- cocos/2d/libcocos2d.vcxproj.filters | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index 3e2f377738..caea880765 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -273,6 +273,7 @@ {ff65e340-b79d-4f87-9b4c-ed46bda5d20f} + {0f3fa25d-9e2b-4a2e-a1df-834b796b3fb3} From 4073d0397b58c8c3c3cd2cf599c6561f29f4efc6 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 18 Jun 2015 15:08:39 +0800 Subject: [PATCH 19/30] Update bindings generator --- tools/bindings-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 23e98f0b99..301f566839 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 23e98f0b9942a2ef305f00c8e8771b1029fbbd00 +Subproject commit 301f566839fa6505d225dfc376bc3fab4673204f From 35842e1d2abe90cfb601e382dcca47a52191317b Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 18 Jun 2015 15:38:17 +0800 Subject: [PATCH 20/30] Update the reference of submodule cocos2d-console. --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index c6bc7c5583..24ff2f151e 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit c6bc7c55837faa461ada8980690ac5c83a14026b +Subproject commit 24ff2f151e6ebdb6cd94ce4157cb00983f911958 From e2268bb16fd7b6227b8f634f3708e0502ca564ff Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 18 Jun 2015 08:18:00 +0000 Subject: [PATCH 21/30] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../api/jsb_cocos2dx_physics3d_auto_api.js | 16 ----------- .../js-bindings/auto/jsb_cocos2dx_3d_auto.hpp | 1 - .../auto/jsb_cocos2dx_3d_extension_auto.hpp | 1 - .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 1 - .../auto/jsb_cocos2dx_builder_auto.hpp | 1 - .../jsb_cocos2dx_experimental_video_auto.hpp | 1 - ...jsb_cocos2dx_experimental_webView_auto.hpp | 1 - .../auto/jsb_cocos2dx_extension_auto.hpp | 1 - .../auto/jsb_cocos2dx_physics3d_auto.cpp | 28 ------------------- .../auto/jsb_cocos2dx_physics3d_auto.hpp | 2 -- .../auto/jsb_cocos2dx_spine_auto.hpp | 1 - .../auto/jsb_cocos2dx_studio_auto.hpp | 1 - .../js-bindings/auto/jsb_cocos2dx_ui_auto.hpp | 1 - .../auto/lua_cocos2dx_3d_auto.cpp | 1 - .../auto/lua_cocos2dx_audioengine_auto.cpp | 1 - .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 1 - .../auto/lua_cocos2dx_cocosbuilder_auto.cpp | 1 - .../auto/lua_cocos2dx_cocosdenshion_auto.cpp | 1 - .../auto/lua_cocos2dx_controller_auto.cpp | 1 - .../auto/lua_cocos2dx_csloader_auto.cpp | 1 - .../auto/lua_cocos2dx_experimental_auto.cpp | 1 - .../lua_cocos2dx_experimental_video_auto.cpp | 1 - ...lua_cocos2dx_experimental_webview_auto.cpp | 1 - .../auto/lua_cocos2dx_extension_auto.cpp | 1 - .../auto/lua_cocos2dx_navmesh_auto.cpp | 1 - .../auto/lua_cocos2dx_physics3d_auto.cpp | 1 - .../auto/lua_cocos2dx_physics_auto.cpp | 1 - .../auto/lua_cocos2dx_spine_auto.cpp | 1 - .../auto/lua_cocos2dx_studio_auto.cpp | 1 - .../auto/lua_cocos2dx_ui_auto.cpp | 1 - 30 files changed, 73 deletions(-) diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js index 86a3561a4f..6c5d114bb4 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js @@ -964,22 +964,6 @@ removeAllPhysics3DConstraints : function ( { }, -/** - * @method rayCast - * @param {vec3_object} arg0 - * @param {vec3_object} arg1 - * @param {cc.Physics3DWorld::HitResult} arg2 - * @return {bool} - */ -rayCast : function ( -vec3, -vec3, -hitresult -) -{ - return false; -}, - /** * @method getGravity * @return {vec3_object} diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp index 827cfd2f00..4b173e53a8 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_Animation3D_class; extern JSObject *jsb_cocos2d_Animation3D_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp index 8c8b5a502e..e71c2a6f30 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_ParticleSystem3D_class; extern JSObject *jsb_cocos2d_ParticleSystem3D_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index dea55ec6d1..b35d64be77 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_Texture2D_class; extern JSObject *jsb_cocos2d_Texture2D_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.hpp index 2fa664e2e1..f79109cf5c 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_builder_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocosbuilder_CCBAnimationManager_class; extern JSObject *jsb_cocosbuilder_CCBAnimationManager_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp index fd8db4ea42..e5360f8545 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp @@ -6,7 +6,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_experimental_ui_VideoPlayer_class; extern JSObject *jsb_cocos2d_experimental_ui_VideoPlayer_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp index 7aa60368d8..9fddb6e082 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp @@ -6,7 +6,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_experimental_ui_WebView_class; extern JSObject *jsb_cocos2d_experimental_ui_WebView_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp index ea61962114..cf67afea60 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_extension_Control_class; extern JSObject *jsb_cocos2d_extension_Control_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp index f739eb1d11..d0793ec44f 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp @@ -2428,33 +2428,6 @@ bool js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DConstraints(JSContex JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DConstraints : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_physics3d_Physics3DWorld_rayCast(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Physics3DWorld* cobj = (cocos2d::Physics3DWorld *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_rayCast : Invalid Native Object"); - if (argc == 3) { - cocos2d::Vec3 arg0; - cocos2d::Vec3 arg1; - cocos2d::Physics3DWorld::HitResult* arg2; - ok &= jsval_to_vector3(cx, args.get(0), &arg0); - ok &= jsval_to_vector3(cx, args.get(1), &arg1); - #pragma warning NO CONVERSION TO NATIVE FOR HitResult* - ok = false; - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_physics3d_Physics3DWorld_rayCast : Error processing arguments"); - bool ret = cobj->rayCast(arg0, arg1, arg2); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DWorld_rayCast : wrong number of arguments: %d, was expecting %d", argc, 3); - return false; -} bool js_cocos2dx_physics3d_Physics3DWorld_getGravity(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -2813,7 +2786,6 @@ void js_register_cocos2dx_physics3d_Physics3DWorld(JSContext *cx, JS::HandleObje JS_FN("removeAllPhysics3DObjects", js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DObjects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isDebugDrawEnabled", js_cocos2dx_physics3d_Physics3DWorld_isDebugDrawEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAllPhysics3DConstraints", js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DConstraints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("rayCast", js_cocos2dx_physics3d_Physics3DWorld_rayCast, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getGravity", js_cocos2dx_physics3d_Physics3DWorld_getGravity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removePhysics3DConstraint", js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DConstraint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addPhysics3DObject", js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp index 5381659653..dbb79c3cec 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp @@ -6,7 +6,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_Physics3DShape_class; extern JSObject *jsb_cocos2d_Physics3DShape_prototype; @@ -144,7 +143,6 @@ bool js_cocos2dx_physics3d_Physics3DWorld_init(JSContext *cx, uint32_t argc, jsv bool js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DObjects(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DWorld_isDebugDrawEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DWorld_removeAllPhysics3DConstraints(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_physics3d_Physics3DWorld_rayCast(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DWorld_getGravity(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DWorld_removePhysics3DConstraint(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DWorld_addPhysics3DObject(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp index fe554a9c82..fa5f388102 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_spine_SkeletonRenderer_class; extern JSObject *jsb_spine_SkeletonRenderer_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp index 4d751bed45..428c4be872 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocostudio_ActionObject_class; extern JSObject *jsb_cocostudio_ActionObject_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index caff837205..bf5380e81f 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -5,7 +5,6 @@ #include "jsapi.h" #include "jsfriendapi.h" - extern JSClass *jsb_cocos2d_ui_LayoutParameter_class; extern JSObject *jsb_cocos2d_ui_LayoutParameter_prototype; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp index b5c68cef39..ee5909a1ee 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_3d_Animation3D_initWithFile(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_audioengine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_audioengine_auto.cpp index 302f2a90d6..cd28c13787 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_audioengine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_audioengine_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_audioengine_AudioProfile_constructor(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index ecc989f40b..0dc75a1c0e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -6,7 +6,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_Ref_release(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosbuilder_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosbuilder_auto.cpp index c994d734dc..cdf7797978 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosbuilder_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosbuilder_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_cocosbuilder_CCBAnimationManager_moveAnimationsFromNode(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosdenshion_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosdenshion_auto.cpp index f0af6a019d..a5b8d213c4 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosdenshion_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_cocosdenshion_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_cocosdenshion_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_controller_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_controller_auto.cpp index bd5aae3bf9..d7c4d142af 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_controller_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_controller_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_controller_Controller_receiveExternalKeyEvent(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp index 8fbb5b5a57..4b3a08f182 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_csloader_CSLoader_createNodeFromJson(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.cpp index 5645e1fef7..cfce645d27 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_experimental_TMXLayer_getPositionAt(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp index c352e9276e..64d3c0f76d 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_experimental_video_VideoPlayer_getFileName(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.cpp index 5a4f222df2..8cec27f723 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_webview_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_experimental_webview_WebView_canGoBack(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp index 4be0cfc60c..4b8b6b0660 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_extension_Control_setEnabled(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_navmesh_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_navmesh_auto.cpp index 5b3b438592..d05e6bdfb2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_navmesh_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_navmesh_auto.cpp @@ -6,7 +6,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_navmesh_NavMeshAgent_setMaxSpeed(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp index b46047fb8a..166ad4e5ea 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_physics3d_Physics3DShape_getbtShape(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp index 3b2124eb3e..04bc6277ec 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_physics_PhysicsShape_getFriction(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp index b5310cc869..00a9ed6e1b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_spine_SkeletonRenderer_setTimeScale(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp index f0247e3ffd..e7b77f2c61 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp @@ -5,7 +5,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_studio_ActionFrame_getAction(lua_State* tolua_S) { int argc = 0; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index 85dddb9fec..418e5c2556 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -4,7 +4,6 @@ #include "LuaBasicConversions.h" - int lua_cocos2dx_ui_LayoutParameter_clone(lua_State* tolua_S) { int argc = 0; From a4ecfdb7e2f76767b0d8c48936f7e21f81b5ec1d Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 18 Jun 2015 17:22:30 +0800 Subject: [PATCH 22/30] Build engine with LOCAL_ARM_MODE=arm when building JS projects for android. --- cocos/Android.mk | 4 ++++ .../runtime-src/proj.android-studio/app/jni/Application.mk | 2 ++ .../frameworks/runtime-src/proj.android/jni/Application.mk | 2 ++ .../frameworks/runtime-src/proj.android/jni/Application.mk | 2 ++ .../project/proj.android-studio/app/jni/Application.mk | 2 ++ tests/js-tests/project/proj.android/jni/Application.mk | 2 ++ 6 files changed, 14 insertions(+) diff --git a/cocos/Android.mk b/cocos/Android.mk index 3888e6a025..0da2a8f4bb 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -6,6 +6,10 @@ LOCAL_MODULE := cocos2dx_internal_static LOCAL_MODULE_FILENAME := libcocos2dxinternal +ifeq ($(USE_ARM_MODE),1) +LOCAL_ARM_MODE := arm +endif + ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) MATHNEONFILE := math/MathUtil.cpp.neon else diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk b/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk index cefa839c79..9a598c3c01 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk +++ b/templates/js-template-default/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk @@ -6,6 +6,8 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic +USE_ARM_MODE := 1 + ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/jni/Application.mk b/templates/js-template-default/frameworks/runtime-src/proj.android/jni/Application.mk index cefa839c79..9a598c3c01 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/jni/Application.mk @@ -6,6 +6,8 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic +USE_ARM_MODE := 1 + ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug diff --git a/templates/js-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk b/templates/js-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk index 2079fca546..bbbb77dcc5 100644 --- a/templates/js-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/templates/js-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk @@ -6,6 +6,8 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic +USE_ARM_MODE := 1 + ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug diff --git a/tests/js-tests/project/proj.android-studio/app/jni/Application.mk b/tests/js-tests/project/proj.android-studio/app/jni/Application.mk index cefa839c79..9a598c3c01 100644 --- a/tests/js-tests/project/proj.android-studio/app/jni/Application.mk +++ b/tests/js-tests/project/proj.android-studio/app/jni/Application.mk @@ -6,6 +6,8 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic +USE_ARM_MODE := 1 + ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug diff --git a/tests/js-tests/project/proj.android/jni/Application.mk b/tests/js-tests/project/proj.android/jni/Application.mk index cefa839c79..9a598c3c01 100644 --- a/tests/js-tests/project/proj.android/jni/Application.mk +++ b/tests/js-tests/project/proj.android/jni/Application.mk @@ -6,6 +6,8 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic +USE_ARM_MODE := 1 + ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug From deaa048521ad936c61678adf9c7336e15ad5d0a4 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 18 Jun 2015 22:48:47 +0800 Subject: [PATCH 23/30] Improve auto bindings for navmesh --- tools/bindings-generator | 2 +- tools/tojs/cocos2dx_navmesh.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 301f566839..618fce7b25 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 301f566839fa6505d225dfc376bc3fab4673204f +Subproject commit 618fce7b257aa5d3c68c5671a9368a4685a6b823 diff --git a/tools/tojs/cocos2dx_navmesh.ini b/tools/tojs/cocos2dx_navmesh.ini index adff64a872..9ae8272478 100644 --- a/tools/tojs/cocos2dx_navmesh.ini +++ b/tools/tojs/cocos2dx_navmesh.ini @@ -29,7 +29,7 @@ extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s # what headers to parse headers = %(cocosdir)s/cocos/navmesh/CCNavMesh.h -cpp_headers = %(jsbdir)s/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h +cpp_headers = navmesh/jsb_cocos2dx_navmesh_conversions.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". From 56382aae37f893f27760ffb2365a846892f997a4 Mon Sep 17 00:00:00 2001 From: jianglong0156 <495916729@qq.com> Date: Thu, 18 Jun 2015 22:50:24 +0800 Subject: [PATCH 24/30] winphone project --- .../libjscocos2d.Shared.vcxitems | 6 ++++++ .../libjscocos2d.Shared.vcxitems.filters | 21 +++++++++++++++++++ .../libjscocos2d.Windows.vcxproj | 12 +++++------ .../libjscocos2d.WindowsPhone.vcxproj | 8 +++---- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems index bdd571d505..9f61b81d2e 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems @@ -19,6 +19,7 @@ + @@ -48,6 +49,8 @@ + + @@ -64,6 +67,7 @@ + @@ -87,6 +91,8 @@ + + diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems.filters b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems.filters index 8daf02c36d..89fcb884a1 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems.filters +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Shared/libjscocos2d.Shared.vcxitems.filters @@ -128,6 +128,15 @@ manual\physics3d + + manual\navmesh + + + manual\navmesh + + + auto + @@ -235,6 +244,15 @@ manual\physics3d + + manual\navmesh + + + manual\navmesh + + + auto + @@ -279,6 +297,9 @@ {511b128d-2604-48af-88e1-8cc0eba79e19} + + {39b1e456-740e-4665-a251-5dc38687acf8} + diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj index f740fc7a57..02d451990e 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj @@ -126,7 +126,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) @@ -146,7 +146,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manua\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) @@ -168,7 +168,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) @@ -188,7 +188,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manua\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) @@ -210,7 +210,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) @@ -230,7 +230,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manua\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj index 0d4d3dc118..f3c163ef26 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj @@ -91,7 +91,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) @@ -111,7 +111,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) @@ -133,7 +133,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) @@ -153,7 +153,7 @@ NotUsing true false - $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) From b75783723915381981d7a8865c8e88e33454f92c Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 18 Jun 2015 22:57:41 +0800 Subject: [PATCH 25/30] Move NavMesh to jsb namespace --- .../manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp | 11 +++++++---- .../js-bindings/script/navmesh/jsb_navmesh.js | 12 ++++++------ tests/js-tests/src/NavMeshTest/NavMeshTest.js | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp index 42dec115f3..6a6539958f 100644 --- a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp @@ -60,21 +60,24 @@ static bool jsb_cocos2dx_navmesh_NavMeshAgent_move(JSContext *cx, uint32_t argc, cobj->move(arg0, [=](cocos2d::NavMeshAgent *agent, float totalTimeAfterMove)->void{ jsval arg[2]; - js_proxy_t *proxy = js_get_or_create_proxy(cx, agent); + js_proxy_t *agentProxy = js_get_or_create_proxy(cx, agent); if (proxy) - arg[0] = OBJECT_TO_JSVAL(proxy->obj); + arg[0] = OBJECT_TO_JSVAL(agentProxy->obj); else arg[0] = JSVAL_NULL; arg[1] = DOUBLE_TO_JSVAL((double)totalTimeAfterMove); JS::RootedValue rval(cx); - bool ok = func->invoke(2, arg, &rval); - if (!ok && JS_IsExceptionPending(cx)) { + bool invokeOk = func->invoke(2, arg, &rval); + if (!invokeOk && JS_IsExceptionPending(cx)) { JS_ReportPendingException(cx); } }); return true; } + + JS_ReportError(cx, "jsb_cocos2dx_navmesh_NavMeshAgent_move : wrong number of arguments: %d, was expecting %d or %d", argc, 1, 2); + return false; } extern JSObject *jsb_cocos2d_NavMeshAgent_prototype; diff --git a/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js b/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js index 9eba194467..f3a379ec6c 100644 --- a/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js +++ b/cocos/scripting/js-bindings/script/navmesh/jsb_navmesh.js @@ -9,7 +9,7 @@ jsb.NavMesh.UpdateFlags = }; -cc.NavMeshAgentParam = function(){ +jsb.NavMeshAgentParam = function(){ this.radius = 0.6; this.height = 2; this.maxAcceleration = 8; @@ -25,16 +25,16 @@ cc.NavMeshAgentParam = function(){ this.queryFilterType = 0; } -cc.navMeshAgentParam = function(){ - return new cc.NavMeshAgentParam(); +jsb.navMeshAgentParam = function(){ + return new jsb.NavMeshAgentParam(); }; -cc.AgentUserData = function(){ +jsb.AgentUserData = function(){ this.time = 0; }; -cc.agentUserData = function(){ - return new cc.AgentUserData(); +jsb.agentUserData = function(){ + return new jsb.AgentUserData(); }; jsb.NavMeshAgent.prototype.setUserData = cc.Node.prototype.setUserData; diff --git a/tests/js-tests/src/NavMeshTest/NavMeshTest.js b/tests/js-tests/src/NavMeshTest/NavMeshTest.js index 8ad38a8a26..4131d4a37f 100644 --- a/tests/js-tests/src/NavMeshTest/NavMeshTest.js +++ b/tests/js-tests/src/NavMeshTest/NavMeshTest.js @@ -138,7 +138,7 @@ var NavMeshBaseTestDemo = NavMeshTestScene.extend({ createAgent:function(pos){ var filePath = "Sprite3DTest/girl.c3b"; - var param = cc.navMeshAgentParam(); + var param = jsb.navMeshAgentParam(); param.radius = 2.0; param.height = 8.0; param.maxSpeed = 8.0; @@ -146,7 +146,7 @@ var NavMeshBaseTestDemo = NavMeshTestScene.extend({ var agentNode = jsb.Sprite3D.create(filePath); agent.setOrientationRefAxes(cc.math.vec3(-1.0, 0.0, 1.0)); - var data = cc.agentUserData(); + var data = jsb.agentUserData(); agent.setUserData(data); agentNode.setScale(0.05); agentNode.addComponent(agent); From 8c97fec5afdb53e5bc255b3955ec49914b8562ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E9=BE=99?= Date: Thu, 18 Jun 2015 23:14:53 +0800 Subject: [PATCH 26/30] add navmesh project file path --- cocos/scripting/js-bindings/proj.android/Android.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/scripting/js-bindings/proj.android/Android.mk b/cocos/scripting/js-bindings/proj.android/Android.mk index 5e6931603b..1e2ca85211 100755 --- a/cocos/scripting/js-bindings/proj.android/Android.mk +++ b/cocos/scripting/js-bindings/proj.android/Android.mk @@ -103,6 +103,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../manual \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../manual \ + $(LOCAL_PATH)/../manual/navmesh \ $(LOCAL_PATH)/../auto \ $(LOCAL_PATH)/../../../audio/include From 61db9ef10334e8435e5317ba7adf4139875594e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E9=BE=99?= Date: Thu, 18 Jun 2015 23:21:53 +0800 Subject: [PATCH 27/30] =?UTF-8?q?modify=20cocos2d=5Fspecifics=20=EF=BC=8C?= =?UTF-8?q?=20add=20navmesh=20head=20file=E3=80=82=20modify=20template?= =?UTF-8?q?=E3=80=82add=20navmesh=20head=20file=20and=20register=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp | 2 +- .../frameworks/runtime-src/Classes/AppDelegate.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 76fd0206f5..87603e33ed 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -27,7 +27,7 @@ #include "js_bindings_config.h" #include "jsb_cocos2dx_auto.hpp" #include "jsb_event_dispatcher_manual.h" - +#include "navmesh/CCNavMesh.h" using namespace cocos2d; schedFunc_proxy_t *_schedFunc_target_ht = NULL; diff --git a/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp b/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp index a94c0b4487..4a197589ff 100644 --- a/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -23,6 +23,8 @@ #include "network/jsb_socketio.h" #include "jsb_cocos2dx_physics3d_auto.hpp" #include "physics3d/jsb_cocos2dx_physics3d_manual.h" +#include "jsb_cocos2dx_navmesh_auto.hpp" +#include "navmesh/jsb_cocos2dx_navmesh_manual.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/CCJavascriptJavaBridge.h" @@ -115,7 +117,12 @@ bool AppDelegate::applicationDidFinishLaunching() sc->addRegisterCallback(register_all_cocos2dx_physics3d); sc->addRegisterCallback(register_all_cocos2dx_physics3d_manual); #endif - + +#if CC_USE_NAVMESH + sc->addRegisterCallback(register_all_cocos2dx_navmesh); + sc->addRegisterCallback(register_all_cocos2dx_navmesh_manual); +#endif + #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) From 8fc5835dee38ec6b8f0b624c0af934dea4118fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E9=BE=99?= Date: Thu, 18 Jun 2015 23:29:04 +0800 Subject: [PATCH 28/30] modify linux file --- cocos/scripting/js-bindings/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cocos/scripting/js-bindings/CMakeLists.txt b/cocos/scripting/js-bindings/CMakeLists.txt index 05b0b1ee35..d26d835687 100644 --- a/cocos/scripting/js-bindings/CMakeLists.txt +++ b/cocos/scripting/js-bindings/CMakeLists.txt @@ -43,6 +43,7 @@ set(JSBINDING_SRC auto/jsb_cocos2dx_3d_auto.cpp auto/jsb_cocos2dx_3d_extension_auto.cpp auto/jsb_cocos2dx_physics3d_auto.cpp + auto/jsb_cocos2dx_navmesh_auto.cpp manual/ScriptingCore.cpp manual/cocos2d_specifics.cpp manual/js_manual_conversions.cpp @@ -69,6 +70,8 @@ set(JSBINDING_SRC manual/ui/jsb_cocos2dx_ui_manual.cpp manual/3d/jsb_cocos2dx_3d_manual.cpp manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp + manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp + manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp ${cocos_root}/cocos/storage/local-storage/LocalStorage.cpp ) @@ -77,6 +80,7 @@ include_directories( manual manual/cocostudio manual/spine + manual/navmesh ${cocos_root}/external/spidermonkey/include/${PLATFORM_FOLDER} ${cocos_root}/cocos/base ${cocos_root}/cocos/2d @@ -87,6 +91,7 @@ include_directories( ${cocos_root}/cocos/network ${cocos_root}/cocos/platform ${cocos_root}/cocos/physics3d + ${cocos_root}/cocos/navmesh ${cocos_root}/extensions ${cocos_root}/external ${cocos_root}/cocos/editor-support From f405d00336b3da4a4b9962da2b4e6cf69abadcf8 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 19 Jun 2015 01:14:16 +0800 Subject: [PATCH 29/30] Fix linux compilation --- cocos/scripting/js-bindings/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/scripting/js-bindings/CMakeLists.txt b/cocos/scripting/js-bindings/CMakeLists.txt index d26d835687..b610e671c2 100644 --- a/cocos/scripting/js-bindings/CMakeLists.txt +++ b/cocos/scripting/js-bindings/CMakeLists.txt @@ -82,6 +82,7 @@ include_directories( manual/spine manual/navmesh ${cocos_root}/external/spidermonkey/include/${PLATFORM_FOLDER} + ${cocos_root}/cocos ${cocos_root}/cocos/base ${cocos_root}/cocos/2d ${cocos_root}/cocos/3d From c6d4f283bb8445b9e749f2bfc99735e6b74f6e12 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 19 Jun 2015 08:11:45 +0800 Subject: [PATCH 30/30] Fix compilation issue in navmesh conversion --- .../manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp | 5 +++-- .../manual/navmesh/jsb_cocos2dx_navmesh_conversions.h | 2 ++ tests/js-tests/src/NavMeshTest/NavMeshTest.js | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp index e1aab3205a..6d8500e015 100644 --- a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp @@ -22,9 +22,9 @@ */ #include "jsb_cocos2dx_navmesh_conversions.h" +#if CC_USE_NAVMESH #include "cocos2d_specifics.hpp" #include "js_manual_conversions.h" -#include "navmesh/CCNavMeshAgent.h" bool jsval_to_NavMeshAgentParam(JSContext *cx, JS::HandleValue v, cocos2d::NavMeshAgentParam* ret) { @@ -90,4 +90,5 @@ jsval offMeshLinkData_to_jsval(JSContext* cx, const cocos2d::OffMeshLinkData& v) return OBJECT_TO_JSVAL(tmp); } return JSVAL_NULL; -} \ No newline at end of file +} +#endif //#if CC_USE_NAVMESH \ No newline at end of file diff --git a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h index ee31b0cf1f..05374dbcd3 100644 --- a/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h +++ b/cocos/scripting/js-bindings/manual/navmesh/jsb_cocos2dx_navmesh_conversions.h @@ -21,11 +21,13 @@ * THE SOFTWARE. */ +#include "base/ccConfig.h" #if CC_USE_NAVMESH #ifndef __cocos2d_js_bindings__jsb_cocos2dx_navmesh_conversions__ #define __cocos2d_js_bindings__jsb_cocos2dx_navmesh_conversions__ #include "jsapi.h" +#include "navmesh/CCNavMeshAgent.h" namespace cocos2d { diff --git a/tests/js-tests/src/NavMeshTest/NavMeshTest.js b/tests/js-tests/src/NavMeshTest/NavMeshTest.js index 4131d4a37f..65adf499a4 100644 --- a/tests/js-tests/src/NavMeshTest/NavMeshTest.js +++ b/tests/js-tests/src/NavMeshTest/NavMeshTest.js @@ -73,11 +73,11 @@ var NavMeshBaseTestDemo = NavMeshTestScene.extend({ initScene:function () { //create mesh var trianglesList = jsb.Bundle3D.getTrianglesList("NavMesh/scene.obj"); - var rbDes = cc.physics3DRigidBodyDes(); + var rbDes = jsb.physics3DRigidBodyDes(); rbDes.mass = 0; - rbDes.shape = cc.Physics3DShape.createMesh(trianglesList, trianglesList.length/3); - var rigidBody = cc.Physics3DRigidBody.create(rbDes); - var component = cc.Physics3DComponent.create(rigidBody); + rbDes.shape = jsb.Physics3DShape.createMesh(trianglesList, trianglesList.length/3); + var rigidBody = jsb.Physics3DRigidBody.create(rbDes); + var component = jsb.Physics3DComponent.create(rigidBody); var sprite = jsb.Sprite3D.create("NavMesh/scene.obj"); sprite.addComponent(component); sprite.setCameraMask(cc.CameraFlag.USER1);