From 5b9b130223b953951f225f7d18ecd86795e346db Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 29 Jun 2015 18:23:01 +0800 Subject: [PATCH 1/3] Add video player and web view to template --- .../frameworks/runtime-src/Classes/AppDelegate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 4a197589ff..3cf4e2573f 100644 --- a/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -26,6 +26,11 @@ #include "jsb_cocos2dx_navmesh_auto.hpp" #include "navmesh/jsb_cocos2dx_navmesh_manual.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#include "experimental/jsb_cocos2dx_experimental_video_manual.h" +#include "experimental/jsb_cocos2dx_experimental_webView_manual.h" +#endif + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/CCJavascriptJavaBridge.h" #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) @@ -123,6 +128,11 @@ bool AppDelegate::applicationDidFinishLaunching() sc->addRegisterCallback(register_all_cocos2dx_navmesh_manual); #endif +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + sc->addRegisterCallback(register_all_cocos2dx_experimental_video_manual); + sc->addRegisterCallback(register_all_cocos2dx_experimental_webView_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 f67ad0352cd97f5e0e45af554c75673d6da6e613 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 29 Jun 2015 19:57:12 +0800 Subject: [PATCH 2/3] Fix simulator js modules --- .../runtime-src/Classes/js_module_register.h | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h b/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h index 37c482649e..e015edfe54 100644 --- a/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h +++ b/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h @@ -8,6 +8,9 @@ #include "jsb_cocos2dx_builder_auto.hpp" #include "jsb_cocos2dx_spine_auto.hpp" #include "jsb_cocos2dx_extension_auto.hpp" +#include "jsb_cocos2dx_3d_auto.hpp" +#include "jsb_cocos2dx_3d_extension_auto.hpp" +#include "3d/jsb_cocos2dx_3d_manual.h" #include "ui/jsb_cocos2dx_ui_manual.h" #include "cocostudio/jsb_cocos2dx_studio_manual.h" #include "cocosbuilder/js_bindings_ccbreader.h" @@ -19,7 +22,21 @@ #include "network/XMLHTTPRequest.h" #include "network/jsb_websocket.h" #include "network/jsb_socketio.h" -#include "cocos2d_specifics.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" + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) +#include "experimental/jsb_cocos2dx_experimental_video_manual.h" +#include "experimental/jsb_cocos2dx_experimental_webView_manual.h" +#endif + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#include "platform/android/CCJavascriptJavaBridge.h" +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) +#include "platform/ios/JavaScriptObjCBridge.h" +#endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/CCJavascriptJavaBridge.h" @@ -66,10 +83,33 @@ int js_module_register() sc->addRegisterCallback(register_jsb_websocket); // sokcet io can be commented out to reduce the package sc->addRegisterCallback(register_jsb_socketio); + + // 3d can be commented out to reduce the package + sc->addRegisterCallback(register_all_cocos2dx_3d); + sc->addRegisterCallback(register_all_cocos2dx_3d_manual); + // 3d extension can be commented out to reduce the package + sc->addRegisterCallback(register_all_cocos2dx_3d_extension); + +#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION + // Physics 3d can be commented out to reduce the package + 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 || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + sc->addRegisterCallback(register_all_cocos2dx_experimental_video_manual); + sc->addRegisterCallback(register_all_cocos2dx_experimental_webView_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) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) sc->addRegisterCallback(JavaScriptObjCBridge::_js_register); #endif return 1; From 1f93fcfc2a982a77095931f0e98420df27b8a306 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 29 Jun 2015 20:00:49 +0800 Subject: [PATCH 3/3] Remove duplicated code --- .../frameworks/runtime-src/Classes/js_module_register.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h b/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h index e015edfe54..866557a0ed 100644 --- a/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h +++ b/tools/simulator/frameworks/runtime-src/Classes/js_module_register.h @@ -38,12 +38,6 @@ #include "platform/ios/JavaScriptObjCBridge.h" #endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) -#include "platform/android/CCJavascriptJavaBridge.h" -#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) -#include "platform/ios/JavaScriptObjCBridge.h" -#endif - USING_NS_CC; int js_module_register() {