diff --git a/.gitignore b/.gitignore
index 50ab47ece0..df04587784 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ Thumbs.db
*.pdb
*.aps
*.vcproj.*.user
+*.vcxproj.user
*.vspscc
*_i.c
*.i
@@ -32,6 +33,11 @@ _ReSharper*/
[Tt]est[Rr]esult*
ipch/
*.opensdf
+Generated Files
+AppPackages
+
+# Ignore zip file created by download-deps.py if saved by user
+*-deps-*.zip
# Ignore files build by ndk and eclipse
libs/
@@ -104,3 +110,5 @@ frameworks/js-bindings/bindings/proj.ios_mac/build/
# Ignore files copied in compilation
samples/*/project/proj.android/src
+
+*.jsc
diff --git a/AUTHORS b/AUTHORS
index e4f2b9368f..9af4441312 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -31,6 +31,8 @@ Name GithubID Main contribution
seobyeongky @seobyeongky XMLHTTPRequest bug fixes
GLProgram_setUniformLocationWith4f bug fixed
Corrent value of cc.REPEAT_FOREVER
+ Improved JavaScriptObjCBridge's import order
+ Added some useful callbacks to XMLHttpRequest
Liang Wu @akira-cn No default font Arial on android bug fix
@@ -59,17 +61,33 @@ Minh Quy @MQuy Fix url matching regex issue
Park Hyun Chen @sincntx Fix cc.ScrollView constructor issue in JSB
Added cc.rectOverlapsRect function in JSB
+ Fix issue that string value with line break character will cause cc.plistParser fail to parse
Vincent Chou @go3k Update README.md, add submodule update command suggestion
Fix bug: Runtime.cpp protobuf object parseFromString may result in an incomplete protobuf object
Fix bug: PrebuiltRuntime ios version can't support portrait orientation.
Igor Mats @IgorMats Added outline shader sample
+ Add SkeletonAnimation and GLProgram to the list of extendable classes
G17hao @G17hao Fixed an typo issue in jsb_boot.js
Simon de Lang @simondel Fixed use of deprecated cc, ccs and ccui create functions.
+Craig P Jolicoeur @cpjolicoeur Fix typos in setup.py
+
+Dale Stammen @Stammen Add Windows Phone 8 support
+ Add Windows Universal app support
+
+Jeff Oh @redsim Fixed http response header parsing bug
+
+Thomas Jablonski @thomas-jablonski
+ Add cocos attr to the script element in templates
+
+James Chen @dumganhar Support to set custom scheduler & actionmanager for node
+
+小马哥 @andot Patch xhr.send for ArrayBuffer & ArrayBufferView.
+
Cocos2d-JS can not grow so fast without the active community.
Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.
diff --git a/CHANGELOG b/CHANGELOG
index ccbc22db7c..ec5098315b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,230 @@
ChangeLog:
+Cocos2d-JS v3.5 @ April 1 2015
+
+* Supported Windows Universal application publish which includes Windows, Windows RT, Windows Phone 8.1 platforms.
+* Updated Cocos2d-x v3.5.
+* Upgraded Cocos Studio parser to support Cocos Studio v2.2.
+* Supported Cocos Studio 3D scene editing.
+* Upgraded runtime tempalte to support Cocos Code IDE 1.2.0.
+* Upgraded Spine support to v2.1, added spine test case with FFD. FFD is supported in native but not in web, both engine can parse the new version file correctly, but the web engine will ignore FFD informations.
+* Replaced '==' with '===' for better performance.
+* Added `path` parameter in `ccs.load` to support modifying cocostudio project resource path.
+* Added animationList to Cocostudio ActionTimeline to support playing animation by name.
+* Made ParticleSystem support creation from an map object.
+* Added missing functions to `cc.Grid3D` and `cc.PageTurn3D`.
+* Added tip message functions to `cc.TextFieldTTF` for mobile browser.
+* Added a function `cc.sys.openURL`.
+* Disabled retina display by default for better performance.
+* Added Bower support.
+* Updated `cc.sys.OS_XXX` informations for supported systems.
+* [JSB] Moved 3D modules to `jsb` namespace.
+* [JSB] Bound `ParticleSystem3D` and `PUParticleSystem3D` which support Particle Universe editor.
+* [JSB] Improved bindings registration code.
+* [JSB] Supported setting custom scheduler or action manager for node.
+* [JSB] Added `enableStroke`, `setBoundingWidth`, `setBoundingHeight` to `cc.Label` to fit web engine API.
+* [JSB] Supported ArrayBuffer and ArrayBufferView in `XMLHTTPRequest`'s `send` function.
+* [JSB] Made remote image loading fully asynchonous.
+* [JSB] Made `cc.Camera`'s `unproject` function support one argument.
+
+* Bug fixes:
+ 1. Fixed a bug of chipmunk.js that it doesn't work under closure compiler advanced mode.
+ 2. Fixed a bug of Cocos Studio parser that widget didn't set its layout component.
+ 3. Fixed grammatical mistakes in cocostudio parser logs.
+ 4. Fixed memory leak issue in `cc.LabelBMFont`.
+ 5. Fixed a bug of `cc.Scale9Sprite` that its `updateDisplayColor` doesn't take effect.
+ 6. Fixed a bug of Cocos Studio parser that `cc.Scale9Sprite` doesn't display correctly if its texture isn't preloaded.
+ 7. Fixed a bug of `cc.MenuItemSprite` that the construction will fail when parameter `selectedSprite` is a Scale9Sprite instance.
+ 8. Fixed a bug of Cocos Studio parser that the background color of `ccui.Layout` can't be parsed correctly.
+ 9. Fixed a bug of `cc.ClippingNode` that it doesn't work when set `inverted` to true in Canvas Mode.
+ 10. Fixed a bug of `ccs.Armature` that its name was modified to animation name when loading from json files.
+ 11. Fixed a bug of `ccui.PageView` that it cancel child touch during movment of page view.
+ 12. Fixed a bug of `cc.Scheduler` that its parameter `repeat` is invalid in schedule function.
+ 13. Fixed a bug of `cc.Scheduler` that `unschedule` function may fail.
+ 14. [JSB] Fixed a crash issue that `ccui.Checkbox` will crash due to conflict usage of `setUserObject`.
+ 15. [JSB] Fixed an issue that `cc.Node`'s `init` function is empty implemented and can't be overrided.
+ 16. [JSB] Fixed `cc.ClippingNode`'s `init` function issue that it didn't support arguments.
+ 17. [JSB] Fixed an issue that TTF Cocos Studio parser can not correctly set TTF font for widgets.
+ 18. [JSB] Fixed relocation overflow compilation issue by adding `LOCAL_ARM_MODE := arm`.
+
+Cocos2d-JS v3.4 Beta0 @ March 19 2015
+
+* Added Windows Phone 8.0 platform support.
+* Upgraded SpiderMonkey to v33, greatly improved JS object garbage collection and performance.
+* Bound 3D modules including camera, light, sprite 3d, animation 3d, billboard, etc.
+* Improved `cc.FontDefinition` & `ccui.RichText` in the web engine.
+* Added gradient stops feature to `cc.LayerGradient` [Web exclusive].
+* Upgraded `cc.Scheduler` in the web engine with Cocos2d-x v3.4 implementation.
+* Added a loading screen when scripts are loading.
+* Improved performance by replacing `Object.defineProperties` with `cc.defineGetterSetter`.
+* Supported loading sprite frames from json object.
+* Refactored math library to improve web engine performance.
+* Removed some variables from `cc` namespace to improve web engine performance.
+* Added the Firefox OS Web manifest to support Firefox OS apps.
+* Added `cocos` attr to the script element in templates.
+* Moved loading.js to res folder for Cocos Console release mode.
+* [JSB] Defined properties for TextureData.
+* [JSB] Upgrade auto and manual bindings to SpiderMonkey v33.
+* [JSB] Added 3D object conversions.
+* [JSB] Added full featured 3D test cases including: camera, light, sprite 3d, animation 3d, billboard, effect.
+* [JSB] Improved auto and manual bindings rooting code for creating objects.
+* [JSB] Added 3d transform getter functions to `cc.Node`.
+* [JSB] Added some useful callbacks to XMLHttpRequest.
+
+* Bug fixes:
+ 1. Added `getSpriteFrame` to `cc.Sprite` to fix API inconsistency.
+ 2. Added `getObejct` to `cc.TMXObjectGroup` to fix API inconsistency.
+ 3. Added `addImageAsync` to `cc.textureCache` to fix API inconsistency.
+ 4. Fixed a bug of `cc.text` that its default font name is incorrect.
+ 5. Fixed a bug of `ccui.PageView` that its `getPage` doesn't work.
+ 6. Fixed a bug of `ccui.ImageView` that its `loadTexture` doesn't work while it's invoked multiple times at the same frame.
+ 7. Fixed a bug of `ccui` that its load event callbacks have some mistakes.
+ 8. Fixed a bug of `cc.Layer` that its bake function doesn't work when the layer has a parent node.
+ 9. Fixed typos in `cc.ClippingNode.WebGLRenderCmd` and `cc.ParticleSystem.WebGLRenderCmd` creation.
+ 10. Fixed a bug of `cc.Sprite` in `setTextureRect`.
+ 11. Fixed a bug of `cc.Screen`.
+ 12. Fixed a bug of `cc.view` that it doesn't work on iOS 8.1.2.
+ 13. Fixed a bug of cc.DrawNode that its lineWidth is always to default value when set linewidth to zero.
+ 14. Fixed a bug in hack for particles performance on canvas.
+ 15. Fixed a bug of `cc.audioEngine` that it doesn't work after minified/compiled.
+ 16. Fixed a bug in `CCBoot.js` that WebGL is not activated in web view of iOS 8.
+ 17. Fixed a bug of `cc.CheckBox` that its position is incorrect when its texture isn't preloaded.
+ 18. Fixed a bug of `cc.TMXLayer` that it stops to work after `setTileGID` called.
+ 19. Fixed a bug of Cocos parser 2.x that it doesn't set widget's LayoutComponent.
+ 20. Fixed a bug of `cc.isObject` that it considered function as an object.
+ 21. [JSB] Fixed runScript error on win32 platform.
+ 22. [JSB] Fixed issues of generated binding codes for spine and ccs.
+ 23. [JSB] Fixed char16_t redefinition issue for wp8.
+ 24. [JSB] Fixed an issue that string value with line break characters will cause cc.plistParser fail to parse.
+ 25. [JSB] Refactored `cc.textureCache.addImageAsync` to support fully asynchronoused remote image loading.
+ 26. [JSB] Fixed an issue of `GLProgramState::setVertexAttribPointer` function binding.
+ 27. [JSB] Fixed a bug in `GLProgram`'s constructor.
+ 28. [JSB] Fixed http response header parsing issue.
+ 29. [JSB] Fixed jsc file check issue on windows.
+ 30. [JSB] Fixed `jsval_to_long_long` conversion issue.
+ 31. [JSB] Fixed `strtoll` undefined error in visual studio.
+ 32. [JSB] Fixed an issue that `cc.MenuItem`'s `setCallback` function invoked with wrong this object.
+ 33. [JSB] Fixed parameter issue for constructor of `cc.MenuItemImage`.
+ 34. [JSB] Fixed `ccs.Armature`'s `setBlendFunc` parameter inconsistency issue.
+ 35. [JSB] Fixed `JSStringWrapper` issue on windows platform.
+ 36. [JSB] Fixed a chinese character issue on WP8.
+ 37. [JSB] Fixed new object failed issue on windows.
+ 38. [JSB] Fixed an issue that `cc.Label.createWithTTF` is undefined.
+ 39. [JSB] Fixed audio loader absent issue.
+ 40. [JSB] Fixed a test case issue of native feature usage.
+
+
+Cocos2d-JS v3.3 @ Feb.9, 2015
+
+* Upgraded spine runtime to support the latest version and updated its test case.
+* Added an option "noCache" for debugging on browsers.
+* Set the default value of `cc.ParticleSystem`'s draw mode to texture mode.
+* Added message to `ccs.load` when loading armature json file.
+* Improved particle system test case.
+* [JSB] Bound `cc.Image` and `cc.GLProgram`.
+* [JSB] Supported extending `sp.SkeletonAnimation`.
+
+* Bug fixes:
+ 1. Fixed a bug of `cc.Sprite` that its `setSpriteFrame` doesn't work when sprite frame's `rotated` property is true.
+ 2. Fixed a bug of `cc.ClippingNode` when its stencil is `cc.Node` object in canvas mode.
+ 3. Fixed a ccui bug that the position of widgets is incorrect after loaded v2.x json file with `ccs.load`.
+ 4. Fixed a bug of `cc.PhysicsSprite` that `setIgnoreBodyRotation` function doesn't work.
+ 5. Fixed a bug of `ccui.Button` that setting pressed texture doesn't work when scale9 enabled.
+ 6. Fixed a bug of `ccui.ScrollView` that its `dir` property is null when passing `DIR_NONE` as `direction` in `_endRecordSlidAction` function.
+ 7. [JSB] Fixed spine animation listener binding issues.
+ 8. [JSB] Fixed `cc.MenuItemToggle`'s `setCallback` issue.
+
+Cocos2d-JS v3.3 RC0 @ Feb.1, 2015
+
+* Added web exclusive functions: `_getFontStyle`, `_setFontStyle`, `_getFontWeight` and `_setFontWeight` APIs to `cc.LabelTTF`.
+* Observed orientation change event on mobile for resolution policy adaptation.
+* [JSB] Added bindings for `ccs.TextureData` and `ccs.ContourData`.
+
+* Bug fixes:
+ 1. Fixed Cocos Studio JSON parser's issues for parsing nested animation.
+ 2. Fixed Cocos Studio JSON parser's parameters parsing issues.
+ 3. Fixed Cocos Studio JSON parser's issue for parsing layer.
+ 4. Fixed Cocos Studio JSON action parser's issues.
+ 5. Fixed Cocos Studio JSON parser's issue for parsing Scale9Sprite.
+ 6. Fixed Cocos Studio JSON parser's issues caused by parsing process order.
+ 7. Fixed Cocos Studio JSON parser's issue for parsing loading bar's direction.
+ 8. Fixed UI layout system issues.
+ 9. Fixed `cc.EditBox`'s position issue under certain resolution policies.
+ 10. Fixed `ccui.ListView`'s issue for setting direction.
+ 11. Fixed an issue of `cc.Tween` that its `_currentPercent` is incorrect in `updateHandler` function.
+ 12. Fixed an issue of `ccui.Button` that its state is incorrect in `_onPressStateChangedToNormal`.
+ 13. Fixed an issue of `cc.ArmatureAnimation`'s `setMovementEventCallFunc`.
+ 14. Fixed an issue of `cc.Sequence` action when it's repeated.
+ 15. Fixed `_anchorPointInPoints` usage issue.
+ 16. Fixed an issue of `cc.GLProgram` that it doesn't work on some devices which didn't support highp float precision.
+ 17. Fixed an issue of fade actions that they don't work when duration is 0.
+ 18. Fixed `onended` callback issue of audio engine on iOS.
+ 19. Fixed Cocos Builder's parser issue for auto playing animations.
+ 20. Added a message to `ccs.Armature` that it doesn't support adding widget as its child.
+ 21. Improved test cases for stability.
+ 22. [JSB]Fixed `setBackGroundColorVector` parameter issue.
+ 23. [JSB]Fixed `animationInfo` manual conversion issue.
+ 24. [JSB]Added `ccs.AnimationInfo` struct.
+ 25. [JSB]Improved JavaScriptObjCBridge's import order.
+ 26. [JSB]Fixed `cc.SpriteBatchNode.DEFAULT_CAPACITY` inconsistency issue.
+ 27. [JSB]Fixed `cc.MenuItemImage`'s children class's callback issue.
+ 28. [JSB]Enhanced `executeJSFunctionFromReservedSpot` function.
+ 29. [JSB]Fixed `cc.LabelTTF`'s `setDimensions` API inconsistency issue.
+
+Cocos2d-JS v3.3 Beta @ Jan.24, 2015
+
+* Added Cocos Studio v2.x parser and refactored 1.x parser.
+* Upgraded new flow layout UI system in web engine.
+* Refactored `load` events of texture2d, sprite and so on to be more intuitive.
+* Added JavaScript file loader.
+* Allowed set texture to null in `cc.Sprite`.
+* Added full test cases for Cocos Studio v2.x parser and the new flow layout UI system.
+* Upgraded MoonWarriors sample's UI and graphic design.
+* [JSB] Upgraded Cocos2d-x to v3.4 RC1.
+* [JSB] Unified keycode between web engine and native engine to web standard values.
+* [JSB] Added animation info's manual conversion for bindings.
+* [JSB] Made local IP address url pass the url check of `cc.loader.loadImg` function.
+* [JSB] Bound `ccs.AlphaFrame` for Cocos Studio animations.
+* [JSB] Moved manual conversions of chipmunk to its own manual bindings file for better module support.
+
+* Bug fixes:
+ 1. Fixed a bug of Cocos2d UI, their focus event has been supported.
+ 2. Fixed a buf of `ccui.Widget` that its percent position doesn't work.
+ 3. Fixed a bug of `ccs.Armature` that its position doesn't update in visit on WebGL render mode.
+ 4. Fixed a bug of `cc.Sprite` that its `setTextureRect` function doesn't work when `setColor` invoked.
+ 5. Fixed a bug of `cc.PhysicsSprite` that its position is incorrect.
+ 6. Fixed a bug of `ccs.Bone` that its `setOpacity` and `setColor` doesn't work.
+ 7. Fixed a bug of `cc.LabelBMFont` that its word wrap doesn't work.
+ 8. Fixed a bug of `cc.sys` that it gets the incorrect OS type when system is Linux.
+ 9. Fixed a bug of `cc.audioEngine` that its loading path is incorrect.
+ 10. Fixed a bug of `ccui.Widget` that it can't touch when it's reused.
+ 11. Fixed a bug of UI system that the `setNormalizedPosition` doesn't work.
+ 12. Fixed a bug of `cc.ActionInterval` that its `_times` conflict with `cc.Blink`.
+ 13. Fixed release texture issue in canvas mode.
+ 14. Fixed a bug of `ccs.actionManager` that its `getActionByName` doesn't work.
+ 15. Fixed a bug of `cc.Sprite` that it can't draw without texture on WebGL mode.
+ 16. Fixed a bug of `cc.audioEngine` that it doesn't work on baidu browser.
+ 17. Fixed a bug of `cc.EditBox` that its position is incorrect on Canvas Mode and its string value is wrong when PlaceHolder is showing.
+ 18. Fixed a bug of `cc.loader` that its `loadImg` function doesn't work when image is accessed cross origin.
+ 19. Fixed a bug of `ccui.TextField` that its `contentSize` is incorrect in text field event.
+ 20. [JSB] Fixed restart game feature issue that action manager is not rescheduled after restarting game.
+ 21. [JSB] Fixed `jsb.AssetsManager`'s issue that manifest files progression is inversed.
+ 22. [JSB] Fixed `jsb.AssetsManager`'s issue that asset id isn't dispatched with progression event.
+ 23. [JSB] Fixed `Vec3` conversion issue.
+ 24. [JSB] Added missed `cc.AnimationFrame`'s `_ctor` function.
+ 25. [JSB] Added `cc.MenuItemToggle`'s `selectedItem` function to fix API inconsistence.
+ 26. [JSB] Fixed `LayoutParameter`'s `setMargin` function's API inconsistence with web engine.
+ 27. [JSB] Fixed `ccui.Button`'s constructor issue.
+ 28. [JSB] Fixed `ccui.Button`'s `setNormalizedPosition` function's API inconsistence with web engine.
+ 29. [JSB] Fixed `ccui.CheckBox`'s intialization issue.
+ 30. [JSB] Fixed `ccui.ImageView`'s constructor issue.
+ 31. [JSB] Fixed JSON parse issue in `XMLHTTPRequest`.
+ 32. [JSB] Fixed a wired compilation issue which reports `JSVAL_TO_IMPL` is not a function on win32.
+ 33. [JSB] Fixed image view test's implementation bug.
+ 34. [JSB] Fixed an UI button test's implementation bug.
+ 35. [JSB] Fixed list view test case's bug.
+ 36. [JSB] Fixed issues of `ccui.TextField`'s test cases.
+
Cocos2d-JS v3.2 @ Dec.29, 2014
* Replaced `transform` function with `setTransform` function under canvas render mode for better performance.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index baf38af98c..99ac98e54f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -233,28 +233,16 @@ cocos_find_package(TIFF TIFF REQUIRED)
cocos_find_package(WEBSOCKETS WEBSOCKETS REQUIRED)
cocos_find_package(CURL CURL REQUIRED)
-# protobuf-lite (not prebuilded, exists as source)
-# TODO: for now we can't use upstream protobuf because these files:
-# cocos/editor-support/cocostudio/CSParseBinary.pb.h
-# cocos/editor-support/cocostudio/CSParseBinary.pb.cc
-# was generated by concrete version of protobuf compiler
-# and source file not provided. So these files can be
-# compiled only with our in-source version of protobuf-lite
-## if(USE_PREBUILT_LIBS)
- add_subdirectory(frameworks/js-bindings/cocos2d-x/external/protobuf-lite)
- set(PROTOBUF_LITE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/js-bindings/cocos2d-x/external/protobuf-lite/src)
- set(PROTOBUF_LITE_LIBRARIES protobuf)
-## else()
-## cocos_find_package(Protobuf REQUIRED PROTOBUF_LITE_LIBRARIES)
-## set(PROTOBUF_LITE_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
-## endif()
-message(STATUS "Protobuf lite libs: ${PROTOBUF_LITE_LIBRARIES}")
-message(STATUS "Protobuf include dirs: ${PROTOBUF_LITE_INCLUDE_DIRS}")
-
-# build for 3rd party libraries
-if(LINUX OR APPLE)
+
+add_subdirectory(frameworks/js-bindings/cocos2d-x/external/flatbuffers)
+set(FLATBUFFERS_INCLUDE_DIRS frameworks/js-bindings/cocos2d-x/external)
+message(STATUS "Flatbuffers include dirs: ${FLATBUFFERS_INCLUDE_DIRS}")
+
+
+# build xxhash
add_subdirectory(frameworks/js-bindings/cocos2d-x/external/xxhash)
-endif()
+include_directories(frameworks/js-bindings/cocos2d-x/external/xxhash)
+
# cocos2d library
add_subdirectory(frameworks/js-bindings/cocos2d-x/cocos)
diff --git a/README.md b/README.md
index e486c5321d..54f2ff6b46 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
Cocos2d-JS
===========
@@ -33,7 +33,6 @@ Furthermore, JavaScript friendly APIs make your game development experience a br
- [Getting Started with Cocos2d-JS](http://www.cocos2d-x.org/docs/manual/framework/html5/en)
- [Cocos2d-JS release notes](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/en)
-- [Cocos2d-JS v3.0 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.0rc0/upgrade-guide/en)
## About Cocos2d family
@@ -73,8 +72,8 @@ Example:
* Compile and run project in Cocos2d-JSB :
```
- cocos compile -p ios|mac|android|web
- cocos run -p ios|mac|android|web
+ cocos compile -p ios|mac|android|win32|web
+ cocos run -p ios|mac|android|win32|web
```
You may need to provide your Android NDK, Android SDK and ANT's paths during the setup. Note that this tool is developed with python, so you will need python (32bit) 2.7.5 or later installed on your machine (but it doesn't support Python3). Please refer to [Cocos Console document](http://www.cocos2d-x.org/docs/manual/framework/html5/v2/cocos-console/en).
@@ -103,16 +102,18 @@ There are two prebuilt projects in Cocos2d-JS repo:
- Test cases, located in `samples/js-tests`
- ```
- cd samples/js-tests
- run -p ios|mac|android|web
- ```
+```
+cd samples/js-tests
+run -p ios|mac|android|win32|web
+```
+
- Game sample : Moon Warriors, located in `samples/js-moonwarriors`
```
cd samples/js-moonwarriors
-run -p ios|mac|android|web
+run -p ios|mac|android|win32|web
```
+
And they share the same project files which are located in `build` folder, there are Xcode and Visual Studio projects.
##Main features
@@ -153,7 +154,7 @@ And they share the same project files which are located in `build` folder, there
For JSB build, there are some restrictions :
-- [Android build] NDK version must be r9d
+- [Android build] NDK version must be r10c
- [iOS build] Xcode version must be 5.1.1 +
##Github note
@@ -165,12 +166,3 @@ If you fork our github repository or download the package from github, you will
- Run `tools/cocos2d-console/download-bin.py` to download bin files for some cocos2d-console plugins like Google Closure Compiler and JSC Compiler.
Otherwise, you will fail to compile your JSB projects.
-
-## Roadmap
-
-Cocos2d-JS have greatly simplified cross platform development. For the next step, we will focus on improving performance on mobile web, toolchain enhancement and completing documentation. Here is a list of main tasks we consider to accomplish in v3.1 :
-
-- The research for performance improvement on Web engine have already made great progress, the new renderer for canvas render mode is ready and will be merged in v3.1. The performance is upto 50% better than v3.0 based on various tests.
-- Facebook SDK for Cocos2d-JS will be released with v3.1, developers can use all Facebook features on iOS/Android/Web with the same JavaScript code.
-- Continue the research of memory model in JSB, improve the stability and simplify the usage.
-- Complete the Cocos2d-JS Programming Guide document to cover all important aspects about Cocos2d-JS development.
diff --git a/build/cocos2d-jsb-samples-win8.1-universal.sln b/build/cocos2d-jsb-samples-win8.1-universal.sln
new file mode 100644
index 0000000000..587f85ed1c
--- /dev/null
+++ b/build/cocos2d-jsb-samples-win8.1-universal.sln
@@ -0,0 +1,264 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.31101.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d", "libcocos2d", "{B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{85630454-74EA-4B5B-9B62-0E459B4476CB}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbox2d", "libbox2d", "{B3D1A3D5-9F54-43AF-9322-230B53242B78}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libSpine", "libSpine", "{6FEB795C-C98C-4C8C-A88B-A35DEE205348}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.WindowsPhone", "..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.WindowsPhone\libcocos2d_8_1.WindowsPhone.vcxproj", "{22F3B9DF-1209-4574-8331-003966F562BF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Shared", "..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems", "{4A3C6BA8-C227-498B-AA21-40BDA27B461F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Windows", "..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.Windows\libbox2d.Windows.vcxproj", "{3B26A12D-3A44-47EA-82D2-282660FC844D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.WindowsPhone", "..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.WindowsPhone\libbox2d.WindowsPhone.vcxproj", "{22F798D8-BFFF-4754-996F-A5395343D5EC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems", "{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.WindowsPhone", "..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.WindowsPhone\libSpine.WindowsPhone.vcxproj", "{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libJSBinding", "libJSBinding", "{A826A599-D986-4743-9DAA-B0C4505521C8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding.Shared", "..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.Shared\libJSBinding.Shared.vcxitems", "{BEA66276-51DD-4C53-92A8-F3D1FEA50892}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding.Windows", "..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.Windows\libJSBinding.Windows.vcxproj", "{BCF5546D-66A0-4998-AFD6-C5514F618930}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding.WindowsPhone", "..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.WindowsPhone\libJSBinding.WindowsPhone.vcxproj", "{CA082EC4-17CE-430B-8207-D1E947A5D1E9}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "js-moonwarriors", "js-moonwarriors", "{1211CA2E-A0F7-45D7-874A-C87218D3EC9C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "js-tests", "js-tests", "{7B5C0FC9-D570-481A-B8D8-5FDF307C477E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.Shared", "..\samples\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems", "{AE6763F6-1549-441E-AFB5-377BE1C776DC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.Windows", "..\samples\js-tests\project\proj.win8.1-universal\App.Windows\js-tests.Windows.vcxproj", "{70914FC8-7709-4CD6-B86B-C63FDE5478DB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.WindowsPhone", "..\samples\js-tests\project\proj.win8.1-universal\App.WindowsPhone\js-tests.WindowsPhone.vcxproj", "{94874B5B-398F-448A-A366-35A35DC1DB9C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-moonwarriors.Shared", "..\samples\js-moonwarriors\project\proj.win8.1-universal\App.Shared\js-moonwarriors.Shared.vcxitems", "{A3AD93E4-0B2F-4C58-9181-69BED2E42E3E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-moonwarriors.Windows", "..\samples\js-moonwarriors\project\proj.win8.1-universal\App.Windows\js-moonwarriors.Windows.vcxproj", "{79A8FCDA-4B12-4DD1-B676-FF148D651638}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-moonwarriors.WindowsPhone", "..\samples\js-moonwarriors\project\proj.win8.1-universal\App.WindowsPhone\js-moonwarriors.WindowsPhone.vcxproj", "{396FE85E-BB05-4B92-BCCB-F89AED4EA41A}"
+EndProject
+Global
+ GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ ..\samples\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{ae6763f6-1549-441e-afb5-377be1c776dc}*SharedItemsImports = 9
+ ..\samples\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{94874b5b-398f-448a-a366-35a35dc1db9c}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4
+ ..\samples\js-moonwarriors\project\proj.win8.1-universal\App.Shared\js-moonwarriors.Shared.vcxitems*{a3ad93e4-0b2f-4c58-9181-69bed2e42e3e}*SharedItemsImports = 9
+ ..\samples\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{70914fc8-7709-4cd6-b86b-c63fde5478db}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
+ ..\samples\js-moonwarriors\project\proj.win8.1-universal\App.Shared\js-moonwarriors.Shared.vcxitems*{79a8fcda-4b12-4dd1-b676-ff148d651638}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9
+ ..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.Shared\libJSBinding.Shared.vcxitems*{ca082ec4-17ce-430b-8207-d1e947a5d1e9}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9
+ ..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.Shared\libJSBinding.Shared.vcxitems*{bea66276-51dd-4c53-92a8-f3d1fea50892}*SharedItemsImports = 9
+ ..\frameworks\js-bindings\bindings\proj.win8.1-universal\libJSBinding\libJSBinding.Shared\libJSBinding.Shared.vcxitems*{bcf5546d-66a0-4998-afd6-c5514f618930}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{3b26a12d-3a44-47ea-82d2-282660fc844d}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{22f3b9df-1209-4574-8331-003966f562bf}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{22f798d8-bfff-4754-996f-a5395343d5ec}*SharedItemsImports = 4
+ ..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{f3550fe0-c795-44f6-8feb-093eb68143ae}*SharedItemsImports = 4
+ ..\samples\js-moonwarriors\project\proj.win8.1-universal\App.Shared\js-moonwarriors.Shared.vcxitems*{396fe85e-bb05-4b92-bccb-f89aed4ea41a}*SharedItemsImports = 4
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|ARM = Release|ARM
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64
+ {9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.ActiveCfg = Debug|ARM
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.Build.0 = Debug|ARM
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.Build.0 = Debug|Win32
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Debug|x64.ActiveCfg = Debug|Win32
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.ActiveCfg = Release|ARM
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.Build.0 = Release|ARM
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.ActiveCfg = Release|Win32
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.Build.0 = Release|Win32
+ {22F3B9DF-1209-4574-8331-003966F562BF}.Release|x64.ActiveCfg = Release|Win32
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.ActiveCfg = Debug|ARM
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.Build.0 = Debug|ARM
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.Build.0 = Debug|Win32
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.ActiveCfg = Debug|x64
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.Build.0 = Debug|x64
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.ActiveCfg = Release|ARM
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.Build.0 = Release|ARM
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.ActiveCfg = Release|Win32
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.Build.0 = Release|Win32
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.ActiveCfg = Release|x64
+ {3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.Build.0 = Release|x64
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.ActiveCfg = Debug|ARM
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.Build.0 = Debug|ARM
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.Build.0 = Debug|Win32
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|x64.ActiveCfg = Debug|Win32
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.ActiveCfg = Release|ARM
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.Build.0 = Release|ARM
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.ActiveCfg = Release|Win32
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.Build.0 = Release|Win32
+ {22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|x64.ActiveCfg = Release|Win32
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.ActiveCfg = Debug|ARM
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.Build.0 = Debug|ARM
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.Build.0 = Debug|Win32
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.ActiveCfg = Debug|x64
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.Build.0 = Debug|x64
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.ActiveCfg = Release|ARM
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.Build.0 = Release|ARM
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.ActiveCfg = Release|Win32
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.ActiveCfg = Debug|ARM
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.Build.0 = Debug|ARM
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.Build.0 = Debug|Win32
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|x64.ActiveCfg = Debug|Win32
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.ActiveCfg = Release|ARM
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.Build.0 = Release|ARM
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.ActiveCfg = Release|Win32
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.Build.0 = Release|Win32
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|x64.ActiveCfg = Release|Win32
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|ARM.ActiveCfg = Debug|ARM
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|ARM.Build.0 = Debug|ARM
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|Win32.Build.0 = Debug|Win32
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|x64.ActiveCfg = Debug|x64
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|x64.Build.0 = Debug|x64
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|ARM.ActiveCfg = Release|ARM
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|ARM.Build.0 = Release|ARM
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|Win32.ActiveCfg = Release|Win32
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|Win32.Build.0 = Release|Win32
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|x64.ActiveCfg = Release|x64
+ {BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|x64.Build.0 = Release|x64
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|ARM.ActiveCfg = Debug|ARM
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|ARM.Build.0 = Debug|ARM
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|Win32.Build.0 = Debug|Win32
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|x64.ActiveCfg = Debug|Win32
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|ARM.ActiveCfg = Release|ARM
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|ARM.Build.0 = Release|ARM
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.ActiveCfg = Release|Win32
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.Build.0 = Release|Win32
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|x64.ActiveCfg = Release|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.ActiveCfg = Debug|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.Build.0 = Debug|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.Deploy.0 = Debug|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.Build.0 = Debug|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.Deploy.0 = Debug|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.ActiveCfg = Debug|x64
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.Build.0 = Debug|x64
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.Deploy.0 = Debug|x64
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.ActiveCfg = Release|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.Build.0 = Release|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.Deploy.0 = Release|ARM
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.ActiveCfg = Release|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.Build.0 = Release|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.Deploy.0 = Release|Win32
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.ActiveCfg = Release|x64
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.Build.0 = Release|x64
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.Deploy.0 = Release|x64
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.ActiveCfg = Debug|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.Build.0 = Debug|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.Deploy.0 = Debug|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.Build.0 = Debug|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.Deploy.0 = Debug|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|x64.ActiveCfg = Debug|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.ActiveCfg = Release|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.Build.0 = Release|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.Deploy.0 = Release|ARM
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.ActiveCfg = Release|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.Build.0 = Release|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.Deploy.0 = Release|Win32
+ {94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|x64.ActiveCfg = Release|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.ActiveCfg = Debug|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Build.0 = Debug|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|ARM.Deploy.0 = Debug|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.ActiveCfg = Debug|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Build.0 = Debug|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|Win32.Deploy.0 = Debug|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.ActiveCfg = Debug|x64
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Build.0 = Debug|x64
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Debug|x64.Deploy.0 = Debug|x64
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.ActiveCfg = Release|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Build.0 = Release|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|ARM.Deploy.0 = Release|ARM
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.ActiveCfg = Release|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Build.0 = Release|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|Win32.Deploy.0 = Release|Win32
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.ActiveCfg = Release|x64
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Build.0 = Release|x64
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638}.Release|x64.Deploy.0 = Release|x64
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.ActiveCfg = Debug|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Build.0 = Debug|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|ARM.Deploy.0 = Debug|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Build.0 = Debug|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|Win32.Deploy.0 = Debug|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Debug|x64.ActiveCfg = Debug|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.ActiveCfg = Release|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Build.0 = Release|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|ARM.Deploy.0 = Release|ARM
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.ActiveCfg = Release|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Build.0 = Release|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|Win32.Deploy.0 = Release|Win32
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A}.Release|x64.ActiveCfg = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {B3D1A3D5-9F54-43AF-9322-230B53242B78} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
+ {6FEB795C-C98C-4C8C-A88B-A35DEE205348} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
+ {5D6F020F-7E72-4494-90A0-2DF11D235DF9} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
+ {9335005F-678E-4E8E-9B84-50037216AEC8} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
+ {22F3B9DF-1209-4574-8331-003966F562BF} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
+ {4A3C6BA8-C227-498B-AA21-40BDA27B461F} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
+ {3B26A12D-3A44-47EA-82D2-282660FC844D} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
+ {22F798D8-BFFF-4754-996F-A5395343D5EC} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
+ {ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
+ {F3550FE0-C795-44F6-8FEB-093EB68143AE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
+ {CC1DA216-A80D-4BE4-B309-ACB6AF313AFF} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
+ {BEA66276-51DD-4C53-92A8-F3D1FEA50892} = {A826A599-D986-4743-9DAA-B0C4505521C8}
+ {BCF5546D-66A0-4998-AFD6-C5514F618930} = {A826A599-D986-4743-9DAA-B0C4505521C8}
+ {CA082EC4-17CE-430B-8207-D1E947A5D1E9} = {A826A599-D986-4743-9DAA-B0C4505521C8}
+ {AE6763F6-1549-441E-AFB5-377BE1C776DC} = {7B5C0FC9-D570-481A-B8D8-5FDF307C477E}
+ {70914FC8-7709-4CD6-B86B-C63FDE5478DB} = {7B5C0FC9-D570-481A-B8D8-5FDF307C477E}
+ {94874B5B-398F-448A-A366-35A35DC1DB9C} = {7B5C0FC9-D570-481A-B8D8-5FDF307C477E}
+ {A3AD93E4-0B2F-4C58-9181-69BED2E42E3E} = {1211CA2E-A0F7-45D7-874A-C87218D3EC9C}
+ {79A8FCDA-4B12-4DD1-B676-FF148D651638} = {1211CA2E-A0F7-45D7-874A-C87218D3EC9C}
+ {396FE85E-BB05-4B92-BCCB-F89AED4EA41A} = {1211CA2E-A0F7-45D7-874A-C87218D3EC9C}
+ EndGlobalSection
+EndGlobal
diff --git a/build/cocos2d-jsb-samples.wp8.sln b/build/cocos2d-jsb-samples.wp8.sln
new file mode 100644
index 0000000000..f8cc297563
--- /dev/null
+++ b/build/cocos2d-jsb-samples.wp8.sln
@@ -0,0 +1,235 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\frameworks\js-bindings\cocos2d-x\cocos\editor-support\spine\proj.wp8\libSpine.vcxproj", "{7D4FC6EB-9497-4804-98F3-3EAEDC896154}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box2D", "..\frameworks\js-bindings\cocos2d-x\external\Box2D\proj.wp8\Box2D.vcxproj", "{C55734A3-702C-4FA1-B950-32C8E169302F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_wp8", "..\frameworks\js-bindings\cocos2d-x\cocos\2d\libcocos2d_wp8.vcxproj", "{7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding", "..\frameworks\js-bindings\bindings\proj.wp8\libJSBinding.vcxproj", "{DD11890A-006E-4D4B-BBE6-A577601288A2}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "js-moonwarriors-wp8-xaml", "js-moonwarriors-wp8-xaml", "{A5EDCD95-9C67-4438-A3AE-9F29AE2BD775}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-moonwarriorsComponent", "..\samples\js-moonwarriors\project\proj.wp8-xaml\js-moonwarriorsComponent\js-moonwarriorsComponent.vcxproj", "{F5D665F8-AE19-4F3F-99A7-230A1E8305D2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "js-moonwarriors", "..\samples\js-moonwarriors\project\proj.wp8-xaml\js-moonwarriors\js-moonwarriors.csproj", "{5921FE12-7EF3-4847-8453-42EF286DDBE7}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "js-tests-wp8-xaml", "js-tests-wp8-xaml", "{43CCF70A-4690-4153-8C03-BE593E34B99A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-testsComponent", "..\samples\js-tests\project\proj.wp8-xaml\js-testsComponent\js-testsComponent.vcxproj", "{878A2939-C627-4E6E-907D-38381FF35E5A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "js-tests", "..\samples\js-tests\project\proj.wp8-xaml\js-tests\js-tests.csproj", "{8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|ARM = Debug|ARM
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|ARM = Release|ARM
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|ARM.ActiveCfg = Debug|ARM
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|ARM.Build.0 = Debug|ARM
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|Win32.Build.0 = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|x64.ActiveCfg = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|x86.ActiveCfg = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Debug|x86.Build.0 = Debug|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|Any CPU.ActiveCfg = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|ARM.ActiveCfg = Release|ARM
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|ARM.Build.0 = Release|ARM
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|Win32.ActiveCfg = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|Win32.Build.0 = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|x64.ActiveCfg = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|x86.ActiveCfg = Release|Win32
+ {7D4FC6EB-9497-4804-98F3-3EAEDC896154}.Release|x86.Build.0 = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|ARM.ActiveCfg = Debug|ARM
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|ARM.Build.0 = Debug|ARM
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|Win32.Build.0 = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|x64.ActiveCfg = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|x86.ActiveCfg = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Debug|x86.Build.0 = Debug|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|Any CPU.ActiveCfg = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|ARM.ActiveCfg = Release|ARM
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|ARM.Build.0 = Release|ARM
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|Win32.ActiveCfg = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|Win32.Build.0 = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|x64.ActiveCfg = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|x86.ActiveCfg = Release|Win32
+ {C55734A3-702C-4FA1-B950-32C8E169302F}.Release|x86.Build.0 = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|ARM.ActiveCfg = Debug|ARM
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|ARM.Build.0 = Debug|ARM
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|Win32.Build.0 = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|x64.ActiveCfg = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|x86.ActiveCfg = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Debug|x86.Build.0 = Debug|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|Any CPU.ActiveCfg = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|ARM.ActiveCfg = Release|ARM
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|ARM.Build.0 = Release|ARM
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|Win32.ActiveCfg = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|Win32.Build.0 = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|x64.ActiveCfg = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|x86.ActiveCfg = Release|Win32
+ {7C5DBC42-27F6-4978-AABC-02BA77E2A7F0}.Release|x86.Build.0 = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|ARM.ActiveCfg = Debug|ARM
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|ARM.Build.0 = Debug|ARM
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|Win32.Build.0 = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|x64.ActiveCfg = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|x86.ActiveCfg = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Debug|x86.Build.0 = Debug|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|Any CPU.ActiveCfg = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|ARM.ActiveCfg = Release|ARM
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|ARM.Build.0 = Release|ARM
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|Win32.ActiveCfg = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|Win32.Build.0 = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|x64.ActiveCfg = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|x86.ActiveCfg = Release|Win32
+ {DD11890A-006E-4D4B-BBE6-A577601288A2}.Release|x86.Build.0 = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|ARM.ActiveCfg = Debug|ARM
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|ARM.Build.0 = Debug|ARM
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|Win32.Build.0 = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|x64.ActiveCfg = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|x86.ActiveCfg = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Debug|x86.Build.0 = Debug|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|Any CPU.ActiveCfg = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|ARM.ActiveCfg = Release|ARM
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|ARM.Build.0 = Release|ARM
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|Win32.ActiveCfg = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|Win32.Build.0 = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|x64.ActiveCfg = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|x86.ActiveCfg = Release|Win32
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2}.Release|x86.Build.0 = Release|Win32
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|ARM.ActiveCfg = Debug|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|ARM.Build.0 = Debug|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|ARM.Deploy.0 = Debug|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Mixed Platforms.Deploy.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Win32.ActiveCfg = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Win32.Build.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|Win32.Deploy.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|x86.ActiveCfg = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|x86.Build.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Debug|x86.Deploy.0 = Debug|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|ARM.ActiveCfg = Release|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|ARM.Build.0 = Release|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|ARM.Deploy.0 = Release|ARM
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Mixed Platforms.Build.0 = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Mixed Platforms.Deploy.0 = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Win32.ActiveCfg = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Win32.Build.0 = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|Win32.Deploy.0 = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|x64.ActiveCfg = Release|Any CPU
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|x86.ActiveCfg = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|x86.Build.0 = Release|x86
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7}.Release|x86.Deploy.0 = Release|x86
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|ARM.ActiveCfg = Debug|ARM
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|ARM.Build.0 = Debug|ARM
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|Win32.Build.0 = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|x64.ActiveCfg = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|x86.ActiveCfg = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Debug|x86.Build.0 = Debug|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|Any CPU.ActiveCfg = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|ARM.ActiveCfg = Release|ARM
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|ARM.Build.0 = Release|ARM
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|Win32.ActiveCfg = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|Win32.Build.0 = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|x64.ActiveCfg = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|x86.ActiveCfg = Release|Win32
+ {878A2939-C627-4E6E-907D-38381FF35E5A}.Release|x86.Build.0 = Release|Win32
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|ARM.ActiveCfg = Debug|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|ARM.Build.0 = Debug|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|ARM.Deploy.0 = Debug|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Mixed Platforms.Deploy.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Win32.ActiveCfg = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Win32.Build.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|Win32.Deploy.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|x86.ActiveCfg = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|x86.Build.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Debug|x86.Deploy.0 = Debug|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|ARM.ActiveCfg = Release|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|ARM.Build.0 = Release|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|ARM.Deploy.0 = Release|ARM
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Mixed Platforms.Build.0 = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Mixed Platforms.Deploy.0 = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Win32.ActiveCfg = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Win32.Build.0 = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|Win32.Deploy.0 = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|x64.ActiveCfg = Release|Any CPU
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|x86.ActiveCfg = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|x86.Build.0 = Release|x86
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {F5D665F8-AE19-4F3F-99A7-230A1E8305D2} = {A5EDCD95-9C67-4438-A3AE-9F29AE2BD775}
+ {5921FE12-7EF3-4847-8453-42EF286DDBE7} = {A5EDCD95-9C67-4438-A3AE-9F29AE2BD775}
+ {878A2939-C627-4E6E-907D-38381FF35E5A} = {43CCF70A-4690-4153-8C03-BE593E34B99A}
+ {8443AB1A-BE8A-4E80-A55E-37FB2AA1360E} = {43CCF70A-4690-4153-8C03-BE593E34B99A}
+ EndGlobalSection
+EndGlobal
diff --git a/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj b/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj
index 67750e8852..a8284e4be1 100644
--- a/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj
+++ b/build/cocos2d_jsb_samples.xcodeproj/project.pbxproj
@@ -13,7 +13,6 @@
05F48C13192C9178008FB408 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05F48C12192C9178008FB408 /* Security.framework */; };
05F48C15192C9180008FB408 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05F48C14192C9180008FB408 /* CoreTelephony.framework */; };
05FBD794195C0910006CC37F /* libPluginFacebook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BAC904F7195ADA7600307000 /* libPluginFacebook.a */; };
- 05FBD796195C1835006CC37F /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05FBD795195C1835006CC37F /* FacebookSDK.framework */; };
1A2B735118D2952200ED9E74 /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A604F1218BF1D1D00CC9A93 /* libcocos2d Mac.a */; };
1A2B735418D2952200ED9E74 /* libjsbindings Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A604F2B18BF1D2000CC9A93 /* libjsbindings Mac.a */; };
1A2B735518D2952200ED9E74 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A035A71117822E9E00987F6C /* libsqlite3.dylib */; };
@@ -97,6 +96,10 @@
1A604FB518BF1EE900CC9A93 /* libjsbindings Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A604F2B18BF1D2000CC9A93 /* libjsbindings Mac.a */; };
1A604FC118BF1EFC00CC9A93 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A604F1C18BF1D1D00CC9A93 /* libcocos2d iOS.a */; };
1A604FC418BF1EFC00CC9A93 /* libjsbindings iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A604F2D18BF1D2000CC9A93 /* libjsbindings iOS.a */; };
+ 420BBD111AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */; };
+ 420BBD121AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */; };
+ 42BCD4A31AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */; };
+ 42BCD4A41AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */; };
A01E17661784C06E00B0CA4A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; };
A01E17671784C06E00B0CA4A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; };
A01E17681784C06E00B0CA4A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482C165F3988007D4F18 /* AudioToolbox.framework */; };
@@ -117,6 +120,8 @@
A035A5E71782290400987F6C /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; };
A035A5E81782290400987F6C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; };
A035A71217822E9E00987F6C /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A035A71117822E9E00987F6C /* libsqlite3.dylib */; };
+ BA0613B51AC23B2D003118D6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0613B41AC23B2D003118D6 /* Security.framework */; };
+ BA0613CB1AC23EC4003118D6 /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0613CA1AC23EC4003118D6 /* FacebookSDK.framework */; };
BA1BF912195AA72900B47F4E /* libPluginIAP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BA1BF81D195A6A7400B47F4E /* libPluginIAP.a */; };
BA2350551948262700E17B2A /* script in Resources */ = {isa = PBXBuildFile; fileRef = BA2350541948262700E17B2A /* script */; };
BA2350561948262700E17B2A /* script in Resources */ = {isa = PBXBuildFile; fileRef = BA2350541948262700E17B2A /* script */; };
@@ -420,6 +425,10 @@
1A604F6218BF1D6600CC9A93 /* Test_Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Test_Info.plist; sourceTree = ""; };
1A604F6318BF1D6600CC9A93 /* Test_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test_Prefix.pch; sourceTree = ""; };
1A9F808C177E98A600D9A1CB /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; };
+ 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_DrawNode3D_bindings.cpp; sourceTree = ""; };
+ 420BBD101AA8840E00493976 /* js_DrawNode3D_bindings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_DrawNode3D_bindings.h; sourceTree = ""; };
+ 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_Effect3D_bindings.cpp; sourceTree = ""; };
+ 42BCD4A21AAF3BF500D035E5 /* js_Effect3D_bindings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_Effect3D_bindings.h; sourceTree = ""; };
A01E17721784C06E00B0CA4A /* js-tests iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "js-tests iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A035A5EC1782290400987F6C /* js-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "js-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A035A71117822E9E00987F6C /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
@@ -427,6 +436,8 @@
A07A52B91783AE900073F6A7 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
A07A52BB1783AEB80073F6A7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
A07A52C11783B01F0073F6A7 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
+ BA0613B41AC23B2D003118D6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+ BA0613CA1AC23EC4003118D6 /* FacebookSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FacebookSDK.framework; path = "../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios/FacebookSDK.framework"; sourceTree = ""; };
BA2350541948262700E17B2A /* script */ = {isa = PBXFileReference; lastKnownFileType = folder; name = script; path = ../../../../bindings/script; sourceTree = ""; };
BA34A78F195AA8DA002D0ECD /* PluginFacebook.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginFacebook.xcodeproj; path = "../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios/PluginFacebook.xcodeproj"; sourceTree = ""; };
BA623DD1191A13DB00761F37 /* PluginAdmob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginAdmob.xcodeproj; path = "../frameworks/js-bindings/cocos2d-x/plugin/plugins/admob/proj.ios/PluginAdmob.xcodeproj"; sourceTree = ""; };
@@ -508,7 +519,7 @@
BA623DEF191A14EB00761F37 /* libPluginAdmob.a in Frameworks */,
BA623DF0191A14EB00761F37 /* libPluginFlurry.a in Frameworks */,
BA623DF1191A14EB00761F37 /* libPluginTwitter.a in Frameworks */,
- 05FBD796195C1835006CC37F /* FacebookSDK.framework in Frameworks */,
+ BA0613CB1AC23EC4003118D6 /* FacebookSDK.framework in Frameworks */,
BA623DF2191A14EB00761F37 /* libPluginUmeng.a in Frameworks */,
BA623DF3191A14EB00761F37 /* libPluginWeibo.a in Frameworks */,
1A604FC118BF1EFC00CC9A93 /* libcocos2d iOS.a in Frameworks */,
@@ -531,6 +542,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ BA0613B51AC23B2D003118D6 /* Security.framework in Frameworks */,
0541A77A19750F7A00E45470 /* AppKit.framework in Frameworks */,
1A604FB218BF1EE800CC9A93 /* libcocos2d Mac.a in Frameworks */,
1A604FB518BF1EE900CC9A93 /* libjsbindings Mac.a in Frameworks */,
@@ -678,6 +690,10 @@
1A604F3618BF1D5600CC9A93 /* Classes */ = {
isa = PBXGroup;
children = (
+ 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */,
+ 42BCD4A21AAF3BF500D035E5 /* js_Effect3D_bindings.h */,
+ 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */,
+ 420BBD101AA8840E00493976 /* js_DrawNode3D_bindings.h */,
0541A75C19738D5A00E45470 /* NativeOcClass.h */,
0541A75D19738D5A00E45470 /* NativeOcClass.m */,
1A604F3718BF1D5600CC9A93 /* AppDelegate.cpp */,
@@ -744,6 +760,8 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
+ BA0613CA1AC23EC4003118D6 /* FacebookSDK.framework */,
+ BA0613B41AC23B2D003118D6 /* Security.framework */,
BAB1575019F041BB00BDF3AD /* GameController.framework */,
0541A77919750F7A00E45470 /* AppKit.framework */,
05FBD795195C1835006CC37F /* FacebookSDK.framework */,
@@ -1226,6 +1244,8 @@
files = (
0541A76319738D8C00E45470 /* NativeOcClass.m in Sources */,
1A604F5A18BF1D6000CC9A93 /* RootViewController.mm in Sources */,
+ 42BCD4A41AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */,
+ 420BBD121AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */,
1A604F3A18BF1D5600CC9A93 /* AppDelegate.cpp in Sources */,
1A604F5918BF1D6000CC9A93 /* main.m in Sources */,
1A604F4D18BF1D6000CC9A93 /* AppController.mm in Sources */,
@@ -1238,6 +1258,8 @@
files = (
0541A77819750DE700E45470 /* NativeOcClass.m in Sources */,
1A604F6718BF1D6600CC9A93 /* main.cpp in Sources */,
+ 42BCD4A31AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */,
+ 420BBD111AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */,
1A604F3918BF1D5600CC9A93 /* AppDelegate.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1475,8 +1497,7 @@
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
- "$(SRCROOT)/../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios/sdk",
- "$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks",
+ "$(SRCROOT)/../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios",
);
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
@@ -1509,8 +1530,7 @@
COMPRESS_PNG_FILES = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
- "$(SRCROOT)/../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios/sdk",
- "$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks",
+ "$(SRCROOT)/../frameworks/js-bindings/cocos2d-x/plugin/plugins/facebook/proj.ios",
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
diff --git a/docs/gradient-color-stop.jpg b/docs/gradient-color-stop.jpg
new file mode 100644
index 0000000000..d71c151460
Binary files /dev/null and b/docs/gradient-color-stop.jpg differ
diff --git a/docs/release-note-v3.3.md b/docs/release-note-v3.3.md
new file mode 100644
index 0000000000..a0f86a8891
--- /dev/null
+++ b/docs/release-note-v3.3.md
@@ -0,0 +1,78 @@
+# Cocos2d-JS v3.3 release note
+
+
+
+Cocos2d-JS is Cocos2d-x engine's JavaScript version that includes Cocos2d-html5 and Cocos2d-x JavaScript Bindings. It equips your game with cross-browser and cross-platform abilities, accompanied by full Cocos2d-x features and simplified JavaScript friendly APIs.
+
+Cocos2d-JS reinvented workflows for all platforms in v3.x, it provides a consistent development experience for whichever platform you want to distribute to, no matter web and native. "Code once, run everywhere" is incredibly easy and natural in Cocos2d-JS. With one single JavaScript code base, you can run your game on all web browsers and native platforms including Mac OS, Windows, iOS and Android. This will bring your game great opportunities in almost all channels of distribution. On the other hand, if you are only interested in casual games on the web, you can embed directly in your web page the Cocos2d-JS Lite Version which is extremely easy to use and light as a feather.
+
+In addition, Cocos2d-JS v3.x is super powerful along with all these cool new features: Editors Support, Assets Manager, Object Pool, JS to Objective-C/JAVA reflection, etc.
+
+One more thing, Facebook Integration for Cocos2d-JS have brought a huge opportunity for game developers who want to integrate Facebook functionality into their games. With a single code base, they can release fully cross-platform games across Facebook Canvas, iOS and Android.
+
+## Highlights
+
+* Supported [Cocos Studio 2.x](http://cocos2d-x.org/download) with its JSON format export, the web engine and native engine share exactly the same parser, so that its result's consistency will be guaranteed for all platforms.
+* Supported latest versioin of [Spine animation editor](http://esotericsoftware.com/).
+* Upgraded UI system with the new flow layout system and added full featured test cases.
+* Provided [Cocos Dev Tool](http://h5.cocoachina.com/static/cocos-devtools/index-en.html) beta version. It's a web based playground for manipulating all coocs nodes in runtime. It will greatly improve your developement and debug experience.
+
+
+
+## Notice
+
+For JSB build, there are some restrictions :
+
+- [Android build] Suggested NDK version is r10c, if you don't need Android 5.0 compatibility, you can also use r9d, other NDKs are not supported.
+- [iOS build] Xcode version must be 5.1.1 +
+- [Web code obfuscation] JRE or JDK version must be 1.6+
+
+## Download
+
+- [Cocos2d-JS v3.3](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.3.zip)
+- [Cocos2d-JS Lite Version](http://cocos2d-x.org/filecenter/jsbuilder/)
+- [Cocos Dev Tool](http://h5.cocos.com/static/cocos-devtools/index-en.html)
+- [Online API reference](http://www.cocos2d-x.org/wiki/reference/)
+- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.3-API.zip)
+- [Online test cases](http://cocos2d-x.org/js-tests/)
+
+## The roadmap
+
+We are very glad to share some plans for the future versions of Cocos2d-JS:
+
+- Upgrade SpiderMonkey to v33, this will improve native engine performance and stability.
+- Support Windows Phone 8 for the native engine.
+- Add 3D module bindings for the native engine.
+- Add Box2d engine with a emscripten version in both web and native engine.
+- Upgrade Spine runtime's API.
+- Improve Web engine UI system performance.
+
+## More information
+
+Read more about all the features and bug fixes
+
+- [Cocos2d-JS v3.3 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.3/changelog/en)
+- [Cocos2d-JS v3.3 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.3b/upgrade-guide/en)
+
+## Upgrade your project from previous versions
+
+If you want to upgrade your game based on v3.0 previous version to the v3.3, you should follow these steps:
+
+1. Download the Cocos2d-JS v3.3 package.
+2. Upgrade cocos command with `setup.py`.
+3. Create a new project with `cocos new` command.
+4. Replace the "src", "res", "index.html", "project.json", "main.js" etc with your old project.
+5. Then you may need to refer to the upgrade guide to solve some API change issues.
+
+## About Cocos2d family
+
+- Cocos2d-JS v3.3 uses Cocos2d-x v3.4 as base of JSB solution
+- Cocos2d-JS v3.3 is compatible with Cocos Code IDE v1.1.0
+- Cocos2d-JS v3.3 is compatible with Cocos Studio v1.2 - v1.6 and Cocos Studio 2.1+. Cocos Studio 2.x support need JSON export file, and Cocos2d-JS won't support flatbuffer files.
+
+With any problems you might have, our communities are happy to help:
+
+- [Online forum](http://discuss.cocos2d-x.org/category/cocos2d-x/javascript)
+- [Document root](http://cocos2d-x.org/wiki/Cocos2d-JS)
+- [Github repository](https://github.com/cocos2d/cocos2d-js)
+- [Issue tracker](https://github.com/cocos2d/cocos2d-js/issues)
\ No newline at end of file
diff --git a/docs/release-note-v3.5.md b/docs/release-note-v3.5.md
new file mode 100644
index 0000000000..9af976adfc
--- /dev/null
+++ b/docs/release-note-v3.5.md
@@ -0,0 +1,72 @@
+# Cocos2d-JS v3.5 release note
+
+
+
+Cocos2d-JS is Cocos2d-x engine's JavaScript version that includes Cocos2d-html5 and Cocos2d-x JavaScript Bindings. It equips your game with cross-browser and cross-platform abilities, accompanied by full Cocos2d-x features and simplified JavaScript friendly APIs.
+
+Cocos2d-JS reinvented workflows for all platforms in v3.x, it provides a consistent development experience for whichever platform you want to distribute to, no matter web and native. "Code once, run everywhere" is incredibly easy and natural in Cocos2d-JS. With one single JavaScript code base, you can run your game on all web browsers and native platforms including Mac OS, Windows, iOS and Android. This will bring your game great opportunities in almost all channels of distribution. On the other hand, if you are only interested in casual games on the web, you can embed directly in your web page the Cocos2d-JS Lite Version which is extremely easy to use and light as a feather.
+
+In addition, Cocos2d-JS v3.x is super powerful along with all these cool new features: Editors Support, Assets Manager, Object Pool, JS to Objective-C/JAVA reflection, etc.
+
+One more thing, Facebook Integration for Cocos2d-JS have brought a huge opportunity for game developers who want to integrate Facebook functionality into their games. With a single code base, they can release fully cross-platform games across Facebook Canvas, iOS and Android.
+
+## Version notice
+
+The version v3.4 is renamed to v3.5, because we have upgraded the internal Cocos2d-x to v3.5 and we don't want our user to get confused about the version mapping between Cocos2d-JS and Cocos2d-x.
+
+## Highlights
+
+* 3D feature ready! Bound 3D modules including camera, light, sprite 3d, animation 3d, billboard, 3D particle system with Particle Universe etc.
+* Supported Cocos Studio 2.2 3D scene editing.
+* Windows Phone 8.0 and Windows Universal support are finally ready! Thanks to the contribution from Microsoft.
+* Upgraded SpiderMonkey to v33, greatly improved JavaScript memory management and performance.
+* Supported latest version of Spine editor.
+* Continuously improved web engine performance.
+
+## Notice
+
+For JSB build, there are some restrictions :
+
+- [Android build] Suggested NDK version is r10c +, if you don't need Android 5.0 compatibility, you can also use r9d, other NDKs are not supported.
+- [iOS build] Xcode version must be 5.1.1 +
+- [Web code obfuscation] JRE or JDK version must be 1.6+
+
+## Download
+
+- [Cocos2d-JS v3.5](http://www.cocos2d-x.org/filedown/cocos2d-js-v3.5.zip)
+- [Cocos2d-JS Lite Version](http://cocos2d-x.org/filecenter/jsbuilder/)
+- [Cocos Dev Tool](http://h5.cocos.com/static/cocos-devtools/index-en.html)
+- [Online API reference](http://www.cocos2d-x.org/wiki/reference/)
+- [Downloadable API Reference](http://www.cocos2d-x.org/filedown/Cocos2d-JS-v3.5-API.zip)
+- [Online test cases](http://cocos2d-x.org/js-tests/)
+
+## More information
+
+Read more about all the features and bug fixes
+
+- [Cocos2d-JS v3.5 changelog](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.5/changelog/en)
+- [Cocos2d-JS v3.5 upgrade guide](http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.5/upgrade-guide/en)
+
+## Upgrade your project from previous versions
+
+If you want to upgrade your game based on v3.0 previous version to the v3.5, you should follow these steps:
+
+1. Download the Cocos2d-JS v3.5 package.
+2. Upgrade cocos command with `setup.py`.
+3. Create a new project with `cocos new` command.
+4. Replace the "src", "res", "index.html", "project.json", "main.js" etc with your old project.
+5. Then you may need to refer to the upgrade guide to solve some API change issues.
+
+## About Cocos2d family
+
+- Cocos2d-JS v3.5 uses Cocos2d-x v3.5 as base of JSB solution.
+- Cocos2d-JS v3.5 uses SpiderMonkey v33 as builtin JavaScript engine.
+- Cocos2d-JS v3.5 is compatible with Cocos Code IDE v1.2.0.
+- Cocos2d-JS v3.5 is compatible with Cocos Studio v1.2 - v1.6 and Cocos Studio 2.1+..
+
+With any problems you might have, our communities are happy to help:
+
+- [Online forum](http://discuss.cocos2d-x.org/category/cocos2d-x/javascript)
+- [Document root](http://cocos2d-x.org/wiki/Cocos2d-JS)
+- [Github repository](https://github.com/cocos2d/cocos2d-js)
+- [Issue tracker](https://github.com/cocos2d/cocos2d-js/issues)
\ No newline at end of file
diff --git a/docs/upgrade-guide-from-3.2-to-3.3.md b/docs/upgrade-guide-from-3.2-to-3.3.md
new file mode 100644
index 0000000000..0d1afa5d55
--- /dev/null
+++ b/docs/upgrade-guide-from-3.2-to-3.3.md
@@ -0,0 +1,46 @@
+#Upgrade guide from Cocos2d-JS v3.2 to Cocos2d-JS v3.3
+
+## 0. Upgrade to Cocos2d-JS v3.2
+
+If you are still using Cocos2d-html5 or previous version of Cocos2d-JS, you may need to read the previous upgrade guide first : [Upgrade guide to Cocos2d-JS v3.2](../../v3.2rc0/upgrade-guide/en.md)
+
+## 1. New Cocos Studio JSON parser
+
+In Cocos2d-JS v3.3 we have introduced one new API for all versions of Cocos Studio JSON export files.
+
+```
+// nodeAndAction is something like: {node: cc.Node, action: cc.Action}
+var nodeAndAction = ccs.load(file);
+```
+
+This API covers Cocos Studio 1.* versions for the JSON export files, including UI parser, Node parser, Action parser and Scene parser. This API also covers Cocos Studio 2.1 + for the JSON export files, including Node parser and Action parser.
+
+Again, please be noted that this new API **only** support JSON files, if you are using Cocos Studio 2.1 +, please export your project to JSON, the flatbuffer format is **not** supported in Cocos2d-JS, neither for the web engine nor for the native engine.
+
+1. Parameter
+
+ `ccs.load` accept the JSON file path as its only parameter.
+
+2. Return value
+
+ The return value is an object which is composed of two properties: `node` and `action`. `node` value is absolutly included in the result, but depends on the project itself, `action` may be `null` in the result when no action is presented in the project. When the parser process failed, the result will be:
+
+ ```
+ {node: null, action: null}
+ ```
+
+3. Preload resources obligated in web engine
+
+ As we all know, in the web engine, you must preload all related resources before entering the scene and using them, it applies to the Cocos Studio resources too. What you need to preload is not only the JSON file, but also all its dependencies, that means all related image files, plist files, json files, audio files, and so on. In the web engine, you must add all these files into the preload list and preload them before entering the scene. Otherwise you will receive a warning in the console like this one:
+
+ ```
+ res/cocosui/UIEditorTest/2.0.5/res/Default/SliderNode_Disable.png need to be preloaded
+ ```
+
+ If you find such warning when debugging, you need to add the reported resources into the preload list.
+
+ But in the native engine, this won't be necessary, you can just ignore the preload phase for all local resources because they are loaded with the application itself.
+
+4. 1.* parser API
+
+ The Cocos Studio 1.* parser API still works as before.
\ No newline at end of file
diff --git a/docs/upgrade-guide-from-3.3-to-3.5.md b/docs/upgrade-guide-from-3.3-to-3.5.md
new file mode 100644
index 0000000000..52b05132f3
--- /dev/null
+++ b/docs/upgrade-guide-from-3.3-to-3.5.md
@@ -0,0 +1,114 @@
+#Upgrade guide from Cocos2d-JS v3.3 to Cocos2d-JS v3.4
+
+## 0. Upgrade to Cocos2d-JS v3.3
+
+If you are still using Cocos2d-html5 or previous version of Cocos2d-JS, you may need to read the previous upgrade guides first : [Historic upgrade guides](../../en.md)
+
+## 1. Pulish to Windows Phone 8 (Windows Phone 8.1 is not supported yet)
+
+Follow these steps can help you upgrade to v3.4, then create a project and at last working for Windows Phone 8.
+
+1. You need to upgrade cocos console with the `setup.py` in Cocos2d-JS v3.4 package:
+
+ ```
+ $ cd cocos2d-js-v3.4
+ $ ./setup.py
+ ```
+
+2. Create a Cocos2d-JS v3.4 project:
+
+ ```
+ $ cocos new -l js WinPhone8Game
+ ```
+
+3. Open the Windows Phone 8 project in `WinPhone8Game/frameworks/runtime-src/proj.wp8-xaml/WinPhone8Game.sln`. Note that you need Visual Studio 2012 to open it.
+
+4. Now you can start to compile or publish the Cocos2d-JS project for Windows Phone 8.
+
+## 2. [Native Exclusive] Create 3D games
+
+The biggest feature in Cocos2d-JS v3.4 is the 3D modules. We have bound Cocos2d-x's 3D modules to JSB, so that you can now code 3D games using JavaScript. Please note that it's a native engine exclusive feature, you can not use 3D classes in the web engine. We are not planning to support 3D for the web in the near future.
+
+All bound 3D classes or objects are listed here:
+
+```
+jsb.Animate3D
+jsb.Animation3D
+jsb.Sprite3D
+jsb.Skeleton3D
+jsb.Mesh
+jsb.AttachNode
+jsb.BillBoard
+jsb.sprite3DCache
+jsb.ParticleSystem3D
+jsb.PUParticleSystem3D
+jsb.BaseLight
+jsb.DirectionLight
+jsb.PointLight
+jsb.SpotLight
+jsb.AmbientLight
+```
+
+Sorry that we don't have a complete JavaScript document for 3D modules, we will add them as soon as possible.
+
+To know how to use the new 3D modules, please refer to the following documents:
+
+- Cocos [3d module's API reference](http://www.cocos2d-x.org/reference/native-cpp/V3.4/dir_0cec398151724e9e1c180a4e8f99801b.html)
+- Cocos [Camera API reference](http://www.cocos2d-x.org/reference/native-cpp/V3.4/d6/d2b/classcocos2d_1_1_camera.html)
+- Cocos [Light API reference](http://www.cocos2d-x.org/reference/native-cpp/V3.4/d2/d85/classcocos2d_1_1_base_light.html)
+- Test cases in the Cocos2d-JS v3.4 package, run it with projects in `build` folder or using `cocos run` command under `samples/js-tests` folder. You can refer to the following test cases:
+ - BillBoardTest: source code in `samples/js-tests/src/BillBoardTest`.
+ - Camera3DTest: source code in `samples/js-tests/src/Camera3DTest`.
+ - LightTest: source code in `samples/js-tests/src/LightTest`.
+ - Sprite3DTest: source code in `samples/js-tests/src/Sprite3DTest`.
+
+## 3. [Web Exclusive] cc.LayerGradient with color stops
+
+In the web engine of Cocos2d-JS v3.4, you can now define color stops for a layer gradient. It's a web exclusive feature but it's safe to use the same code in native engine.
+
+API:
+
+```
+new cc.LayerGradient(beginColor, endColor, positionInPercent, colorStops);
+```
+
+Sample code:
+
+```
+// Color stops is represented by an array, where each entry is an object composed by positionInPercent and the color.
+var colorStops = [
+ {p: 0.25, color: cc.color(0, 0, 255, 128)},
+ {p: 0.5, color: cc.color(128, 128, 128, 128)},
+ {p: 0.75, color: cc.color(255, 255, 0, 128)}
+ ];
+
+var gradient = new cc.LayerGradient(cc.color(255, 0, 0, 255), cc.color(0, 255, 0, 255), cc.p(0, 1), colorStops);
+this.addChild(gradient, 10);
+```
+
+Result:
+
+
+
+## 4. cc.sys.OpenURL
+
+You can now use `cc.sys.OpenURL(url)` to open the targeted url in web browser.
+In case of web engine, it will open another page in the current browser.
+In case of native engine, it will open the url in an external web browser.
+
+## 5. [Web Exclusive] Tip message in cc.TextFieldTTF
+
+We have added a tip message getter/setter for `cc.TextFieldTTF`. APIs are:
+
+```
+textFieldTTF.setTipMessage(tipMessage);
+var message = textFieldTTF.getTipMessage();
+```
+
+## 6. Load cocos studio resources within a relative path
+
+You can now pass a `path` parameter to `ccs.load` to specify a relative path for resources linked by the targeted json file.
+
+```
+ccs.load(jsonFile, path);
+```
\ No newline at end of file
diff --git a/frameworks/cocos2d-html5 b/frameworks/cocos2d-html5
index a0cee92a3f..d47f061c0a 160000
--- a/frameworks/cocos2d-html5
+++ b/frameworks/cocos2d-html5
@@ -1 +1 @@
-Subproject commit a0cee92a3f345aefb5f973074a9222eabc941ea4
+Subproject commit d47f061c0ae13078e08c637fa69e629a54177ffe
diff --git a/frameworks/js-bindings/bindings/Android.mk b/frameworks/js-bindings/bindings/Android.mk
index 6ea045a576..c0819bbb7e 100644
--- a/frameworks/js-bindings/bindings/Android.mk
+++ b/frameworks/js-bindings/bindings/Android.mk
@@ -6,12 +6,16 @@ LOCAL_MODULE := cocos_jsb_static
LOCAL_MODULE_FILENAME := libcocos2dxjsb
+LOCAL_ARM_MODE := arm
+
LOCAL_SRC_FILES := auto/jsb_cocos2dx_auto.cpp \
auto/jsb_cocos2dx_builder_auto.cpp \
auto/jsb_cocos2dx_extension_auto.cpp \
auto/jsb_cocos2dx_spine_auto.cpp \
auto/jsb_cocos2dx_studio_auto.cpp \
auto/jsb_cocos2dx_ui_auto.cpp \
+ auto/jsb_cocos2dx_3d_auto.cpp \
+ auto/jsb_cocos2dx_3d_extension_auto.cpp \
manual/ScriptingCore.cpp \
manual/cocos2d_specifics.cpp \
manual/js_manual_conversions.cpp \
@@ -27,6 +31,7 @@ LOCAL_SRC_FILES := auto/jsb_cocos2dx_auto.cpp \
manual/chipmunk/js_bindings_chipmunk_manual.cpp \
manual/chipmunk/js_bindings_chipmunk_registration.cpp \
manual/cocosbuilder/js_bindings_ccbreader.cpp \
+ manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp \
manual/cocostudio/jsb_cocos2dx_studio_manual.cpp \
manual/extension/jsb_cocos2dx_extension_manual.cpp \
manual/localstorage/js_bindings_system_functions.cpp \
@@ -35,7 +40,8 @@ LOCAL_SRC_FILES := auto/jsb_cocos2dx_auto.cpp \
manual/network/jsb_websocket.cpp \
manual/network/XMLHTTPRequest.cpp \
manual/spine/jsb_cocos2dx_spine_manual.cpp \
- manual/ui/jsb_cocos2dx_ui_manual.cpp
+ manual/ui/jsb_cocos2dx_ui_manual.cpp \
+ manual/3d/jsb_cocos2dx_3d_manual.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
@@ -43,6 +49,8 @@ LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH)/manual \
+ $(LOCAL_PATH)/manual/cocostudio \
+ $(LOCAL_PATH)/manual/spine \
$(LOCAL_PATH)/auto \
$(LOCAL_PATH)/../cocos2d-x/cocos/2d \
$(LOCAL_PATH)/../cocos2d-x/cocos/base \
diff --git a/frameworks/js-bindings/bindings/CMakeLists.txt b/frameworks/js-bindings/bindings/CMakeLists.txt
index a0f55deab4..7b56b7535d 100644
--- a/frameworks/js-bindings/bindings/CMakeLists.txt
+++ b/frameworks/js-bindings/bindings/CMakeLists.txt
@@ -38,6 +38,8 @@ set(JSBINDING_SRC
auto/jsb_cocos2dx_spine_auto.cpp
auto/jsb_cocos2dx_studio_auto.cpp
auto/jsb_cocos2dx_ui_auto.cpp
+ auto/jsb_cocos2dx_3d_auto.cpp
+ auto/jsb_cocos2dx_3d_extension_auto.cpp
manual/ScriptingCore.cpp
manual/cocos2d_specifics.cpp
manual/js_manual_conversions.cpp
@@ -53,6 +55,7 @@ set(JSBINDING_SRC
manual/chipmunk/js_bindings_chipmunk_registration.cpp
manual/cocosbuilder/js_bindings_ccbreader.cpp
manual/cocostudio/jsb_cocos2dx_studio_manual.cpp
+ manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp
manual/extension/jsb_cocos2dx_extension_manual.cpp
manual/localstorage/js_bindings_system_functions.cpp
manual/localstorage/js_bindings_system_registration.cpp
@@ -61,12 +64,15 @@ set(JSBINDING_SRC
manual/network/jsb_socketio.cpp
manual/spine/jsb_cocos2dx_spine_manual.cpp
manual/ui/jsb_cocos2dx_ui_manual.cpp
+ manual/3d/jsb_cocos2dx_3d_manual.cpp
../cocos2d-x/cocos/storage/local-storage/LocalStorage.cpp
)
include_directories(
auto
manual
+ manual/cocostudio
+ manual/spine
../external/spidermonkey/include/${PLATFORM_FOLDER}
../cocos2d-x/cocos/base
../cocos2d-x/cocos/2d
@@ -91,6 +97,7 @@ add_library(jsbindings STATIC
target_link_libraries(jsbindings
sqlite3
js_static
+ xxhash
)
set_target_properties(jsbindings
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_auto_api.js
new file mode 100644
index 0000000000..bdfedfa5a9
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_auto_api.js
@@ -0,0 +1,1109 @@
+/**
+ * @module cocos2dx_3d
+ */
+var jsb = jsb || {};
+
+/**
+ * @class Skeleton3D
+ */
+jsb.Skeleton3D = {
+
+/**
+ * @method removeAllBones
+ */
+removeAllBones : function (
+)
+{
+},
+
+/**
+ * @method addBone
+ * @param {cc.Bone3D} arg0
+ */
+addBone : function (
+bone3d
+)
+{
+},
+
+/**
+ * @method getBoneByName
+ * @param {String} arg0
+ * @return {cc.Bone3D}
+ */
+getBoneByName : function (
+str
+)
+{
+ return cc.Bone3D;
+},
+
+/**
+ * @method getRootBone
+ * @param {int} arg0
+ * @return {cc.Bone3D}
+ */
+getRootBone : function (
+int
+)
+{
+ return cc.Bone3D;
+},
+
+/**
+ * @method updateBoneMatrix
+ */
+updateBoneMatrix : function (
+)
+{
+},
+
+/**
+ * @method getBoneByIndex
+ * @param {unsigned int} arg0
+ * @return {cc.Bone3D}
+ */
+getBoneByIndex : function (
+int
+)
+{
+ return cc.Bone3D;
+},
+
+/**
+ * @method getRootCount
+ * @return {long}
+ */
+getRootCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getBoneIndex
+ * @param {cc.Bone3D} arg0
+ * @return {int}
+ */
+getBoneIndex : function (
+bone3d
+)
+{
+ return 0;
+},
+
+/**
+ * @method getBoneCount
+ * @return {long}
+ */
+getBoneCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method Skeleton3D
+ * @constructor
+ */
+Skeleton3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Sprite3D
+ */
+jsb.Sprite3D = {
+
+/**
+ * @method setCullFaceEnabled
+ * @param {bool} arg0
+ */
+setCullFaceEnabled : function (
+bool
+)
+{
+},
+
+/**
+ * @method setTexture
+* @param {cc.Texture2D|String} texture2d
+*/
+setTexture : function(
+str
+)
+{
+},
+
+/**
+ * @method getLightMask
+ * @return {unsigned int}
+ */
+getLightMask : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method createAttachSprite3DNode
+ * @param {cc.NodeData} arg0
+ * @param {cc.MaterialDatas} arg1
+ */
+createAttachSprite3DNode : function (
+nodedata,
+materialdatas
+)
+{
+},
+
+/**
+ * @method loadFromFile
+ * @param {String} arg0
+ * @param {cc.NodeDatas} arg1
+ * @param {cc.MeshDatas} arg2
+ * @param {cc.MaterialDatas} arg3
+ * @return {bool}
+ */
+loadFromFile : function (
+str,
+nodedatas,
+meshdatas,
+materialdatas
+)
+{
+ return false;
+},
+
+/**
+ * @method setCullFace
+ * @param {unsigned int} arg0
+ */
+setCullFace : function (
+int
+)
+{
+},
+
+/**
+ * @method addMesh
+ * @param {cc.Mesh} arg0
+ */
+addMesh : function (
+mesh
+)
+{
+},
+
+/**
+ * @method removeAllAttachNode
+ */
+removeAllAttachNode : function (
+)
+{
+},
+
+/**
+ * @method genGLProgramState
+ */
+genGLProgramState : function (
+)
+{
+},
+
+/**
+ * @method getMesh
+ * @return {cc.Mesh}
+ */
+getMesh : function (
+)
+{
+ return cc.Mesh;
+},
+
+/**
+ * @method createSprite3DNode
+ * @param {cc.NodeData} arg0
+ * @param {cc.ModelData} arg1
+ * @param {cc.MaterialDatas} arg2
+ * @return {cc.Sprite3D}
+ */
+createSprite3DNode : function (
+nodedata,
+modeldata,
+materialdatas
+)
+{
+ return cc.Sprite3D;
+},
+
+/**
+ * @method getMeshCount
+ * @return {long}
+ */
+getMeshCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method onAABBDirty
+ */
+onAABBDirty : function (
+)
+{
+},
+
+/**
+ * @method getMeshByIndex
+ * @param {int} arg0
+ * @return {cc.Mesh}
+ */
+getMeshByIndex : function (
+int
+)
+{
+ return cc.Mesh;
+},
+
+/**
+ * @method createNode
+ * @param {cc.NodeData} arg0
+ * @param {cc.Node} arg1
+ * @param {cc.MaterialDatas} arg2
+ * @param {bool} arg3
+ */
+createNode : function (
+nodedata,
+node,
+materialdatas,
+bool
+)
+{
+},
+
+/**
+ * @method isForceDepthWrite
+ * @return {bool}
+ */
+isForceDepthWrite : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
+ */
+getBlendFunc : function (
+)
+{
+ return cc.BlendFunc;
+},
+
+/**
+ * @method getMeshIndexData
+ * @param {String} arg0
+ * @return {cc.MeshIndexData}
+ */
+getMeshIndexData : function (
+str
+)
+{
+ return cc.MeshIndexData;
+},
+
+/**
+ * @method removeAttachNode
+ * @param {String} arg0
+ */
+removeAttachNode : function (
+str
+)
+{
+},
+
+/**
+ * @method setLightMask
+ * @param {unsigned int} arg0
+ */
+setLightMask : function (
+int
+)
+{
+},
+
+/**
+ * @method afterAsyncLoad
+ * @param {void} arg0
+ */
+afterAsyncLoad : function (
+void
+)
+{
+},
+
+/**
+ * @method loadFromCache
+ * @param {String} arg0
+ * @return {bool}
+ */
+loadFromCache : function (
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method initFrom
+ * @param {cc.NodeDatas} arg0
+ * @param {cc.MeshDatas} arg1
+ * @param {cc.MaterialDatas} arg2
+ * @return {bool}
+ */
+initFrom : function (
+nodedatas,
+meshdatas,
+materialdatas
+)
+{
+ return false;
+},
+
+/**
+ * @method getAttachNode
+ * @param {String} arg0
+ * @return {cc.AttachNode}
+ */
+getAttachNode : function (
+str
+)
+{
+ return cc.AttachNode;
+},
+
+/**
+ * @method initWithFile
+ * @param {String} arg0
+ * @return {bool}
+ */
+initWithFile : function (
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method setBlendFunc
+ * @param {cc.BlendFunc} arg0
+ */
+setBlendFunc : function (
+blendfunc
+)
+{
+},
+
+/**
+ * @method getSkeleton
+ * @return {cc.Skeleton3D}
+ */
+getSkeleton : function (
+)
+{
+ return cc.Skeleton3D;
+},
+
+/**
+ * @method setForceDepthWrite
+ * @param {bool} arg0
+ */
+setForceDepthWrite : function (
+bool
+)
+{
+},
+
+/**
+ * @method getMeshByName
+ * @param {String} arg0
+ * @return {cc.Mesh}
+ */
+getMeshByName : function (
+str
+)
+{
+ return cc.Mesh;
+},
+
+/**
+ * @method create
+* @param {String|String} str
+* @param {String} str
+* @return {cc.Sprite3D|cc.Sprite3D|cc.Sprite3D}
+*/
+create : function(
+str,
+str
+)
+{
+ return cc.Sprite3D;
+},
+
+/**
+ * @method Sprite3D
+ * @constructor
+ */
+Sprite3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Sprite3DCache
+ */
+jsb.Sprite3DCache = {
+
+/**
+ * @method removeSprite3DData
+ * @param {String} arg0
+ */
+removeSprite3DData : function (
+str
+)
+{
+},
+
+/**
+ * @method removeAllSprite3DData
+ */
+removeAllSprite3DData : function (
+)
+{
+},
+
+/**
+ * @method destroyInstance
+ */
+destroyInstance : function (
+)
+{
+},
+
+/**
+ * @method getInstance
+ * @return {cc.Sprite3DCache}
+ */
+getInstance : function (
+)
+{
+ return cc.Sprite3DCache;
+},
+
+};
+
+/**
+ * @class Mesh
+ */
+jsb.Mesh = {
+
+/**
+ * @method setTexture
+* @param {cc.Texture2D|String} texture2d
+*/
+setTexture : function(
+str
+)
+{
+},
+
+/**
+ * @method getTexture
+ * @return {cc.Texture2D}
+ */
+getTexture : function (
+)
+{
+ return cc.Texture2D;
+},
+
+/**
+ * @method getSkin
+ * @return {cc.MeshSkin}
+ */
+getSkin : function (
+)
+{
+ return cc.MeshSkin;
+},
+
+/**
+ * @method getVertexSizeInBytes
+ * @return {int}
+ */
+getVertexSizeInBytes : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getName
+ * @return {String}
+ */
+getName : function (
+)
+{
+ return ;
+},
+
+/**
+ * @method getIndexFormat
+ * @return {unsigned int}
+ */
+getIndexFormat : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getGLProgramState
+ * @return {cc.GLProgramState}
+ */
+getGLProgramState : function (
+)
+{
+ return cc.GLProgramState;
+},
+
+/**
+ * @method getVertexBuffer
+ * @return {unsigned int}
+ */
+getVertexBuffer : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method calculateAABB
+ */
+calculateAABB : function (
+)
+{
+},
+
+/**
+ * @method hasVertexAttrib
+ * @param {int} arg0
+ * @return {bool}
+ */
+hasVertexAttrib : function (
+int
+)
+{
+ return false;
+},
+
+/**
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
+ */
+getBlendFunc : function (
+)
+{
+ return cc.BlendFunc;
+},
+
+/**
+ * @method getMeshIndexData
+ * @return {cc.MeshIndexData}
+ */
+getMeshIndexData : function (
+)
+{
+ return cc.MeshIndexData;
+},
+
+/**
+ * @method setName
+ * @param {String} arg0
+ */
+setName : function (
+str
+)
+{
+},
+
+/**
+ * @method isVisible
+ * @return {bool}
+ */
+isVisible : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method getIndexCount
+ * @return {long}
+ */
+getIndexCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method bindMeshCommand
+ */
+bindMeshCommand : function (
+)
+{
+},
+
+/**
+ * @method setMeshIndexData
+ * @param {cc.MeshIndexData} arg0
+ */
+setMeshIndexData : function (
+meshindexdata
+)
+{
+},
+
+/**
+ * @method getMeshVertexAttribCount
+ * @return {long}
+ */
+getMeshVertexAttribCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setBlendFunc
+ * @param {cc.BlendFunc} arg0
+ */
+setBlendFunc : function (
+blendfunc
+)
+{
+},
+
+/**
+ * @method getPrimitiveType
+ * @return {unsigned int}
+ */
+getPrimitiveType : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setSkin
+ * @param {cc.MeshSkin} arg0
+ */
+setSkin : function (
+meshskin
+)
+{
+},
+
+/**
+ * @method getIndexBuffer
+ * @return {unsigned int}
+ */
+getIndexBuffer : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setGLProgramState
+ * @param {cc.GLProgramState} arg0
+ */
+setGLProgramState : function (
+glprogramstate
+)
+{
+},
+
+/**
+ * @method setVisible
+ * @param {bool} arg0
+ */
+setVisible : function (
+bool
+)
+{
+},
+
+/**
+ * @method Mesh
+ * @constructor
+ */
+Mesh : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Animation3D
+ */
+jsb.Animation3D = {
+
+/**
+ * @method initWithFile
+ * @param {String} arg0
+ * @param {String} arg1
+ * @return {bool}
+ */
+initWithFile : function (
+str,
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method init
+ * @param {cc.Animation3DData} arg0
+ * @return {bool}
+ */
+init : function (
+animation3ddata
+)
+{
+ return false;
+},
+
+/**
+ * @method getBoneCurveByName
+ * @param {String} arg0
+ * @return {cc.Animation3D::Curve}
+ */
+getBoneCurveByName : function (
+str
+)
+{
+ return cc.Animation3D::Curve;
+},
+
+/**
+ * @method getDuration
+ * @return {float}
+ */
+getDuration : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method create
+ * @param {String} arg0
+ * @param {String} arg1
+ * @return {cc.Animation3D}
+ */
+create : function (
+str,
+str
+)
+{
+ return cc.Animation3D;
+},
+
+/**
+ * @method Animation3D
+ * @constructor
+ */
+Animation3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Animate3D
+ */
+jsb.Animate3D = {
+
+/**
+ * @method getSpeed
+ * @return {float}
+ */
+getSpeed : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method removeFromMap
+ */
+removeFromMap : function (
+)
+{
+},
+
+/**
+ * @method setWeight
+ * @param {float} arg0
+ */
+setWeight : function (
+float
+)
+{
+},
+
+/**
+ * @method initWithFrames
+ * @param {cc.Animation3D} arg0
+ * @param {int} arg1
+ * @param {int} arg2
+ * @param {float} arg3
+ * @return {bool}
+ */
+initWithFrames : function (
+animation3d,
+int,
+int,
+float
+)
+{
+ return false;
+},
+
+/**
+ * @method getOriginInterval
+ * @return {float}
+ */
+getOriginInterval : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setSpeed
+ * @param {float} arg0
+ */
+setSpeed : function (
+float
+)
+{
+},
+
+/**
+ * @method init
+* @param {cc.Animation3D|cc.Animation3D} animation3d
+* @param {float} float
+* @param {float} float
+* @return {bool|bool}
+*/
+init : function(
+animation3d,
+float,
+float
+)
+{
+ return false;
+},
+
+/**
+ * @method setOriginInterval
+ * @param {float} arg0
+ */
+setOriginInterval : function (
+float
+)
+{
+},
+
+/**
+ * @method getWeight
+ * @return {float}
+ */
+getWeight : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method create
+* @param {cc.Animation3D|cc.Animation3D} animation3d
+* @param {float} float
+* @param {float} float
+* @return {cc.Animate3D|cc.Animate3D}
+*/
+create : function(
+animation3d,
+float,
+float
+)
+{
+ return cc.Animate3D;
+},
+
+/**
+ * @method getTransitionTime
+ * @return {float}
+ */
+getTransitionTime : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method createWithFrames
+ * @param {cc.Animation3D} arg0
+ * @param {int} arg1
+ * @param {int} arg2
+ * @param {float} arg3
+ * @return {cc.Animate3D}
+ */
+createWithFrames : function (
+animation3d,
+int,
+int,
+float
+)
+{
+ return cc.Animate3D;
+},
+
+/**
+ * @method setTransitionTime
+ * @param {float} arg0
+ */
+setTransitionTime : function (
+float
+)
+{
+},
+
+/**
+ * @method Animate3D
+ * @constructor
+ */
+Animate3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class AttachNode
+ */
+jsb.AttachNode = {
+
+/**
+ * @method create
+ * @param {cc.Bone3D} arg0
+ * @return {cc.AttachNode}
+ */
+create : function (
+bone3d
+)
+{
+ return cc.AttachNode;
+},
+
+/**
+ * @method AttachNode
+ * @constructor
+ */
+AttachNode : function (
+)
+{
+},
+
+};
+
+/**
+ * @class BillBoard
+ */
+jsb.BillBoard = {
+
+/**
+ * @method getMode
+ * @return {cc.BillBoard::Mode}
+ */
+getMode : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setMode
+ * @param {cc.BillBoard::Mode} arg0
+ */
+setMode : function (
+mode
+)
+{
+},
+
+/**
+ * @method create
+* @param {String|cc.BillBoard::Mode|String} str
+* @param {cc.BillBoard::Mode|rect_object} mode
+* @param {cc.BillBoard::Mode} mode
+* @return {cc.BillBoard|cc.BillBoard|cc.BillBoard}
+*/
+create : function(
+str,
+rect,
+mode
+)
+{
+ return cc.BillBoard;
+},
+
+/**
+ * @method createWithTexture
+ * @param {cc.Texture2D} arg0
+ * @param {cc.BillBoard::Mode} arg1
+ * @return {cc.BillBoard}
+ */
+createWithTexture : function (
+texture2d,
+mode
+)
+{
+ return cc.BillBoard;
+},
+
+/**
+ * @method BillBoard
+ * @constructor
+ */
+BillBoard : function (
+)
+{
+},
+
+};
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js
new file mode 100644
index 0000000000..a10423dfbd
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js
@@ -0,0 +1,496 @@
+/**
+ * @module cocos2dx_3d_extension
+ */
+var jsb = jsb || {};
+
+/**
+ * @class ParticleSystem3D
+ */
+jsb.ParticleSystem3D = {
+
+/**
+ * @method resumeParticleSystem
+ */
+resumeParticleSystem : function (
+)
+{
+},
+
+/**
+ * @method startParticleSystem
+ */
+startParticleSystem : function (
+)
+{
+},
+
+/**
+ * @method isEnabled
+ * @return {bool}
+ */
+isEnabled : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method isKeepLocal
+ * @return {bool}
+ */
+isKeepLocal : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method setEnabled
+ * @param {bool} arg0
+ */
+setEnabled : function (
+bool
+)
+{
+},
+
+/**
+ * @method getParticleQuota
+ * @return {unsigned int}
+ */
+getParticleQuota : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
+ */
+getBlendFunc : function (
+)
+{
+ return cc.BlendFunc;
+},
+
+/**
+ * @method pauseParticleSystem
+ */
+pauseParticleSystem : function (
+)
+{
+},
+
+/**
+ * @method getState
+ * @return {cc.ParticleSystem3D::State}
+ */
+getState : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getAliveParticleCount
+ * @return {int}
+ */
+getAliveParticleCount : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setParticleQuota
+ * @param {unsigned int} arg0
+ */
+setParticleQuota : function (
+int
+)
+{
+},
+
+/**
+ * @method setBlendFunc
+ * @param {cc.BlendFunc} arg0
+ */
+setBlendFunc : function (
+blendfunc
+)
+{
+},
+
+/**
+ * @method stopParticleSystem
+ */
+stopParticleSystem : function (
+)
+{
+},
+
+/**
+ * @method setKeepLocal
+ * @param {bool} arg0
+ */
+setKeepLocal : function (
+bool
+)
+{
+},
+
+/**
+ * @method ParticleSystem3D
+ * @constructor
+ */
+ParticleSystem3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class PUParticleSystem3D
+ */
+jsb.PUParticleSystem3D = {
+
+/**
+ * @method getParticleSystemScaleVelocity
+ * @return {float}
+ */
+getParticleSystemScaleVelocity : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setEmittedSystemQuota
+ * @param {unsigned int} arg0
+ */
+setEmittedSystemQuota : function (
+int
+)
+{
+},
+
+/**
+ * @method getDefaultDepth
+ * @return {float}
+ */
+getDefaultDepth : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getEmittedSystemQuota
+ * @return {unsigned int}
+ */
+getEmittedSystemQuota : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method clearAllParticles
+ */
+clearAllParticles : function (
+)
+{
+},
+
+/**
+ * @method getMaterialName
+ * @return {String}
+ */
+getMaterialName : function (
+)
+{
+ return ;
+},
+
+/**
+ * @method calulateRotationOffset
+ */
+calulateRotationOffset : function (
+)
+{
+},
+
+/**
+ * @method getMaxVelocity
+ * @return {float}
+ */
+getMaxVelocity : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method forceUpdate
+ * @param {float} arg0
+ */
+forceUpdate : function (
+float
+)
+{
+},
+
+/**
+ * @method getTimeElapsedSinceStart
+ * @return {float}
+ */
+getTimeElapsedSinceStart : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getEmittedEmitterQuota
+ * @return {unsigned int}
+ */
+getEmittedEmitterQuota : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method isMarkedForEmission
+ * @return {bool}
+ */
+isMarkedForEmission : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method getDefaultWidth
+ * @return {float}
+ */
+getDefaultWidth : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setEmittedEmitterQuota
+ * @param {unsigned int} arg0
+ */
+setEmittedEmitterQuota : function (
+int
+)
+{
+},
+
+/**
+ * @method setMarkedForEmission
+ * @param {bool} arg0
+ */
+setMarkedForEmission : function (
+bool
+)
+{
+},
+
+/**
+ * @method clone
+ * @return {cc.PUParticleSystem3D}
+ */
+clone : function (
+)
+{
+ return cc.PUParticleSystem3D;
+},
+
+/**
+ * @method setDefaultWidth
+ * @param {float} arg0
+ */
+setDefaultWidth : function (
+float
+)
+{
+},
+
+/**
+ * @method copyAttributesTo
+ * @param {cc.PUParticleSystem3D} arg0
+ */
+copyAttributesTo : function (
+puparticlesystem3d
+)
+{
+},
+
+/**
+ * @method setMaterialName
+ * @param {String} arg0
+ */
+setMaterialName : function (
+str
+)
+{
+},
+
+/**
+ * @method getParentParticleSystem
+ * @return {cc.PUParticleSystem3D}
+ */
+getParentParticleSystem : function (
+)
+{
+ return cc.PUParticleSystem3D;
+},
+
+/**
+ * @method setMaxVelocity
+ * @param {float} arg0
+ */
+setMaxVelocity : function (
+float
+)
+{
+},
+
+/**
+ * @method getDefaultHeight
+ * @return {float}
+ */
+getDefaultHeight : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getDerivedPosition
+ * @return {vec3_object}
+ */
+getDerivedPosition : function (
+)
+{
+ return cc.Vec3;
+},
+
+/**
+ * @method rotationOffset
+ * @param {vec3_object} arg0
+ */
+rotationOffset : function (
+vec3
+)
+{
+},
+
+/**
+ * @method getDerivedOrientation
+ * @return {cc.Quaternion}
+ */
+getDerivedOrientation : function (
+)
+{
+ return cc.Quaternion;
+},
+
+/**
+ * @method removeAllEmitter
+ */
+removeAllEmitter : function (
+)
+{
+},
+
+/**
+ * @method setParticleSystemScaleVelocity
+ * @param {float} arg0
+ */
+setParticleSystemScaleVelocity : function (
+float
+)
+{
+},
+
+/**
+ * @method getDerivedScale
+ * @return {vec3_object}
+ */
+getDerivedScale : function (
+)
+{
+ return cc.Vec3;
+},
+
+/**
+ * @method setDefaultHeight
+ * @param {float} arg0
+ */
+setDefaultHeight : function (
+float
+)
+{
+},
+
+/**
+ * @method removeAllListener
+ */
+removeAllListener : function (
+)
+{
+},
+
+/**
+ * @method initSystem
+ * @param {String} arg0
+ * @return {bool}
+ */
+initSystem : function (
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method setDefaultDepth
+ * @param {float} arg0
+ */
+setDefaultDepth : function (
+float
+)
+{
+},
+
+/**
+ * @method create
+* @param {String|String} str
+* @param {String} str
+* @return {cc.PUParticleSystem3D|cc.PUParticleSystem3D|cc.PUParticleSystem3D}
+*/
+create : function(
+str,
+str
+)
+{
+ return cc.PUParticleSystem3D;
+},
+
+/**
+ * @method PUParticleSystem3D
+ * @constructor
+ */
+PUParticleSystem3D : function (
+)
+{
+},
+
+};
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_auto_api.js
index 4a7777384b..ea91717974 100644
--- a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_auto_api.js
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_auto_api.js
@@ -762,26 +762,6 @@ EventTouch : function (
};
-/**
- * @class EventKeyboard
- */
-cc.EventKeyboard = {
-
-/**
- * @method EventKeyboard
- * @constructor
- * @param {cc.EventKeyboard::KeyCode} arg0
- * @param {bool} arg1
- */
-EventKeyboard : function (
-keycode,
-bool
-)
-{
-},
-
-};
-
/**
* @class Node
*/
@@ -833,6 +813,18 @@ getGLProgram : function (
return cc.GLProgram;
},
+/**
+ * @method updateTransformFromPhysics
+ * @param {mat4_object} arg0
+ * @param {unsigned int} arg1
+ */
+updateTransformFromPhysics : function (
+mat4,
+int
+)
+{
+},
+
/**
* @method getDescription
* @return {String}
@@ -1066,23 +1058,23 @@ getonEnterTransitionDidFinishCallback : function (
},
/**
- * @method getNodeToWorldAffineTransform
- * @return {cc.AffineTransform}
+ * @method isOpacityModifyRGB
+ * @return {bool}
*/
-getNodeToWorldAffineTransform : function (
+isOpacityModifyRGB : function (
)
{
- return cc.AffineTransform;
+ return false;
},
/**
- * @method getNodeToWorldTransform
- * @return {mat4_object}
+ * @method getNodeToWorldAffineTransform
+ * @return {cc.AffineTransform}
*/
-getNodeToWorldTransform : function (
+getNodeToWorldAffineTransform : function (
)
{
- return cc.Mat4;
+ return cc.AffineTransform;
},
/**
@@ -1232,13 +1224,13 @@ getRotationSkewY : function (
},
/**
- * @method getNodeToParentAffineTransform
- * @return {cc.AffineTransform}
+ * @method getNodeToWorldTransform
+ * @return {mat4_object}
*/
-getNodeToParentAffineTransform : function (
+getNodeToWorldTransform : function (
)
{
- return cc.AffineTransform;
+ return cc.Mat4;
},
/**
@@ -1282,13 +1274,13 @@ getRotation3D : function (
},
/**
- * @method getNodeToParentTransform
- * @return {mat4_object}
+ * @method getNodeToParentAffineTransform
+ * @return {cc.AffineTransform}
*/
-getNodeToParentTransform : function (
+getNodeToParentAffineTransform : function (
)
{
- return cc.Mat4;
+ return cc.AffineTransform;
},
/**
@@ -1443,6 +1435,16 @@ getChildrenCount : function (
return 0;
},
+/**
+ * @method getNodeToParentTransform
+ * @return {mat4_object}
+ */
+getNodeToParentTransform : function (
+)
+{
+ return cc.Mat4;
+},
+
/**
* @method convertToNodeSpaceAR
* @param {vec2_object} arg0
@@ -1479,6 +1481,20 @@ action
return cc.Action;
},
+/**
+ * @method visit
+* @param {cc.Renderer} renderer
+* @param {mat4_object} mat4
+* @param {unsigned int} int
+*/
+visit : function(
+renderer,
+mat4,
+int
+)
+{
+},
+
/**
* @method setGLProgram
* @param {cc.GLProgram} arg0
@@ -1510,17 +1526,13 @@ getAnchorPointInPoints : function (
},
/**
- * @method visit
-* @param {cc.Renderer} renderer
-* @param {mat4_object} mat4
-* @param {unsigned int} int
-*/
-visit : function(
-renderer,
-mat4,
-int
+ * @method getRotationQuat
+ * @return {cc.Quaternion}
+ */
+getRotationQuat : function (
)
{
+ return cc.Quaternion;
},
/**
@@ -1658,11 +1670,17 @@ str
},
/**
- * @method setAdditionalTransform
-* @param {cc.AffineTransform|mat4_object} affinetransform
-*/
-setAdditionalTransform : function(
-mat4
+ * @method updatePhysicsBodyTransform
+ * @param {mat4_object} arg0
+ * @param {unsigned int} arg1
+ * @param {float} arg2
+ * @param {float} arg3
+ */
+updatePhysicsBodyTransform : function (
+mat4,
+int,
+float,
+float
)
{
},
@@ -1697,16 +1715,6 @@ getScheduler : function(
return cc.Scheduler;
},
-/**
- * @method getParentToNodeAffineTransform
- * @return {cc.AffineTransform}
- */
-getParentToNodeAffineTransform : function (
-)
-{
- return cc.AffineTransform;
-},
-
/**
* @method getOrderOfArrival
* @return {int}
@@ -1760,6 +1768,16 @@ getParent : function(
return cc.Node;
},
+/**
+ * @method getWorldToNodeTransform
+ * @return {mat4_object}
+ */
+getWorldToNodeTransform : function (
+)
+{
+ return cc.Mat4;
+},
+
/**
* @method getPositionY
* @return {float}
@@ -1823,13 +1841,13 @@ bool
},
/**
- * @method getParentToNodeTransform
- * @return {mat4_object}
+ * @method getParentToNodeAffineTransform
+ * @return {cc.AffineTransform}
*/
-getParentToNodeTransform : function (
+getParentToNodeAffineTransform : function (
)
{
- return cc.Mat4;
+ return cc.AffineTransform;
},
/**
@@ -1936,16 +1954,6 @@ int
{
},
-/**
- * @method getWorldToNodeAffineTransform
- * @return {cc.AffineTransform}
- */
-getWorldToNodeAffineTransform : function (
-)
-{
- return cc.AffineTransform;
-},
-
/**
* @method setCascadeColorEnabled
* @param {bool} arg0
@@ -2121,13 +2129,13 @@ sortAllChildren : function (
},
/**
- * @method getWorldToNodeTransform
- * @return {mat4_object}
+ * @method getWorldToNodeAffineTransform
+ * @return {cc.AffineTransform}
*/
-getWorldToNodeTransform : function (
+getWorldToNodeAffineTransform : function (
)
{
- return cc.Mat4;
+ return cc.AffineTransform;
},
/**
@@ -2150,6 +2158,16 @@ getNormalizedPosition : function (
return cc.Vec2;
},
+/**
+ * @method getParentToNodeTransform
+ * @return {mat4_object}
+ */
+getParentToNodeTransform : function (
+)
+{
+ return cc.Mat4;
+},
+
/**
* @method convertToNodeSpace
* @param {vec2_object} arg0
@@ -2183,13 +2201,13 @@ isCascadeColorEnabled : function (
},
/**
- * @method isOpacityModifyRGB
- * @return {bool}
+ * @method setRotationQuat
+ * @param {cc.Quaternion} arg0
*/
-isOpacityModifyRGB : function (
+setRotationQuat : function (
+quaternion
)
{
- return false;
},
/**
@@ -2264,6 +2282,14 @@ initWithPhysics : function (
return false;
},
+/**
+ * @method setCameraOrderDirty
+ */
+setCameraOrderDirty : function (
+)
+{
+},
+
/**
* @method render
* @param {cc.Renderer} arg0
@@ -2284,16 +2310,6 @@ eventcustom
{
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method getPhysicsWorld
* @return {cc.PhysicsWorld}
@@ -2316,6 +2332,16 @@ size
return false;
},
+/**
+ * @method getDefaultCamera
+ * @return {cc.Camera}
+ */
+getDefaultCamera : function (
+)
+{
+ return cc.Camera;
+},
+
/**
* @method createWithSize
* @param {size_object} arg0
@@ -2454,6 +2480,16 @@ isOpenGLReady : function (
return false;
},
+/**
+ * @method setCursorVisible
+ * @param {bool} arg0
+ */
+setCursorVisible : function (
+bool
+)
+{
+},
+
/**
* @method getScaleY
* @return {float}
@@ -3023,6 +3059,16 @@ isNextDeltaTimeZero : function (
return false;
},
+/**
+ * @method setClearColor
+ * @param {color4f_object} arg0
+ */
+setClearColor : function (
+color4f
+)
+{
+},
+
/**
* @method setOpenGLView
* @param {cc.GLView} arg0
@@ -3306,6 +3352,16 @@ float
{
},
+/**
+ * @method update
+ * @param {float} arg0
+ */
+update : function (
+float
+)
+{
+},
+
/**
* @method performFunctionInCocosThread
* @param {function} arg0
@@ -3590,6 +3646,16 @@ str
return ;
},
+/**
+ * @method setWritablePath
+ * @param {String} arg0
+ */
+setWritablePath : function (
+str
+)
+{
+},
+
/**
* @method setPopupNotify
* @param {bool} arg0
@@ -3612,6 +3678,16 @@ str
return false;
},
+/**
+ * @method setDefaultResourceRootPath
+ * @param {String} arg0
+ */
+setDefaultResourceRootPath : function (
+str
+)
+{
+},
+
/**
* @method getSearchResolutionsOrder
* @return {Array}
@@ -3644,6 +3720,16 @@ getWritablePath : function (
return ;
},
+/**
+ * @method setDelegate
+ * @param {cc.FileUtils} arg0
+ */
+setDelegate : function (
+fileutils
+)
+{
+},
+
/**
* @method getInstance
* @return {cc.FileUtils}
@@ -4310,16 +4396,6 @@ init : function (
return false;
},
-/**
- * @method create
- * @return {cc.EventListenerFocus}
- */
-create : function (
-)
-{
- return cc.EventListenerFocus;
-},
-
/**
* @method EventListenerFocus
* @constructor
@@ -5593,12 +5669,12 @@ cc.MoveBy = {
/**
* @method initWithDuration
- * @param {float} arg0
- * @param {vec2_object} arg1
- * @return {bool}
- */
-initWithDuration : function (
-float,
+* @param {float|float} float
+* @param {vec3_object|vec2_object} vec3
+* @return {bool|bool}
+*/
+initWithDuration : function(
+float,
vec2
)
{
@@ -5607,12 +5683,12 @@ vec2
/**
* @method create
- * @param {float} arg0
- * @param {vec2_object} arg1
- * @return {cc.MoveBy}
- */
-create : function (
-float,
+* @param {float|float} float
+* @param {vec3_object|vec2_object} vec3
+* @return {cc.MoveBy|cc.MoveBy}
+*/
+create : function(
+float,
vec2
)
{
@@ -5637,12 +5713,12 @@ cc.MoveTo = {
/**
* @method initWithDuration
- * @param {float} arg0
- * @param {vec2_object} arg1
- * @return {bool}
- */
-initWithDuration : function (
-float,
+* @param {float|float} float
+* @param {vec3_object|vec2_object} vec3
+* @return {bool|bool}
+*/
+initWithDuration : function(
+float,
vec2
)
{
@@ -5651,12 +5727,12 @@ vec2
/**
* @method create
- * @param {float} arg0
- * @param {vec2_object} arg1
- * @return {cc.MoveTo}
- */
-create : function (
-float,
+* @param {float|float} float
+* @param {vec3_object|vec2_object} vec3
+* @return {cc.MoveTo|cc.MoveTo}
+*/
+create : function(
+float,
vec2
)
{
@@ -5827,6 +5903,24 @@ JumpBy : function (
*/
cc.JumpTo = {
+/**
+ * @method initWithDuration
+ * @param {float} arg0
+ * @param {vec2_object} arg1
+ * @param {float} arg2
+ * @param {int} arg3
+ * @return {bool}
+ */
+initWithDuration : function (
+float,
+vec2,
+float,
+int
+)
+{
+ return false;
+},
+
/**
* @method create
* @param {float} arg0
@@ -6163,16 +6257,16 @@ char
/**
* @method create
- * @param {float} arg0
- * @param {unsigned char} arg1
- * @param {unsigned char} arg2
- * @param {unsigned char} arg3
- * @return {cc.TintTo}
- */
-create : function (
-float,
-char,
-char,
+* @param {float|float} float
+* @param {color3b_object|unsigned char} color3b
+* @param {unsigned char} char
+* @param {unsigned char} char
+* @return {cc.TintTo|cc.TintTo}
+*/
+create : function(
+float,
+char,
+char,
char
)
{
@@ -8167,16 +8261,6 @@ size
*/
cc.Grid3DAction = {
-/**
- * @method getGrid
- * @return {cc.GridBase}
- */
-getGrid : function (
-)
-{
- return cc.GridBase;
-},
-
};
/**
@@ -8184,16 +8268,6 @@ getGrid : function (
*/
cc.TiledGrid3DAction = {
-/**
- * @method getGrid
- * @return {cc.GridBase}
- */
-getGrid : function (
-)
-{
- return cc.GridBase;
-},
-
};
/**
@@ -9023,16 +9097,6 @@ Twirl : function (
*/
cc.PageTurn3D = {
-/**
- * @method getGrid
- * @return {cc.GridBase}
- */
-getGrid : function (
-)
-{
- return cc.GridBase;
-},
-
/**
* @method create
* @param {float} arg0
@@ -9440,18 +9504,6 @@ FadeOutBLTiles : function (
*/
cc.FadeOutUpTiles = {
-/**
- * @method transformTile
- * @param {vec2_object} arg0
- * @param {float} arg1
- */
-transformTile : function (
-vec2,
-float
-)
-{
-},
-
/**
* @method create
* @param {float} arg0
@@ -10275,26 +10327,6 @@ mat4
{
},
-/**
- * @method setVertexAttribPointer
- * @param {String} arg0
- * @param {int} arg1
- * @param {unsigned int} arg2
- * @param {unsigned char} arg3
- * @param {int} arg4
- * @param {void} arg5
- */
-setVertexAttribPointer : function (
-str,
-int,
-int,
-char,
-int,
-void
-)
-{
-},
-
/**
* @method getGLProgram
* @return {cc.GLProgram}
@@ -10522,13 +10554,15 @@ color4f
/**
* @method drawPoints
- * @param {vec2_object} arg0
- * @param {unsigned int} arg1
- * @param {color4f_object} arg2
- */
-drawPoints : function (
-vec2,
-int,
+* @param {vec2_object|vec2_object} vec2
+* @param {unsigned int|unsigned int} int
+* @param {float|color4f_object} float
+* @param {color4f_object} color4f
+*/
+drawPoints : function(
+vec2,
+int,
+float,
color4f
)
{
@@ -10586,16 +10620,6 @@ int
{
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method drawDot
* @param {vec2_object} arg0
@@ -10900,14 +10924,6 @@ int
return false;
},
-/**
- * @method updateAtlasValues
- */
-updateAtlasValues : function (
-)
-{
-},
-
/**
* @method getString
* @return {String}
@@ -11291,71 +11307,65 @@ sprite
},
/**
- * @method reorderBatch
- * @param {bool} arg0
+ * @method addSpriteWithoutQuad
+ * @param {cc.Sprite} arg0
+ * @param {int} arg1
+ * @param {int} arg2
+ * @return {cc.SpriteBatchNode}
*/
-reorderBatch : function (
-bool
+addSpriteWithoutQuad : function (
+sprite,
+int,
+int
)
{
+ return cc.SpriteBatchNode;
},
/**
- * @method getTexture
- * @return {cc.Texture2D}
+ * @method reorderBatch
+ * @param {bool} arg0
*/
-getTexture : function (
+reorderBatch : function (
+bool
)
{
- return cc.Texture2D;
},
/**
- * @method setTexture
+ * @method initWithTexture
* @param {cc.Texture2D} arg0
+ * @param {long} arg1
+ * @return {bool}
*/
-setTexture : function (
-texture2d
+initWithTexture : function (
+texture2d,
+long
)
{
+ return false;
},
/**
- * @method removeChildAtIndex
- * @param {long} arg0
- * @param {bool} arg1
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
*/
-removeChildAtIndex : function (
-long,
-bool
+getBlendFunc : function (
)
{
+ return cc.BlendFunc;
},
/**
- * @method removeSpriteFromAtlas
+ * @method lowestAtlasIndexInChild
* @param {cc.Sprite} arg0
+ * @return {long}
*/
-removeSpriteFromAtlas : function (
+lowestAtlasIndexInChild : function (
sprite
)
{
-},
-
-/**
- * @method addSpriteWithoutQuad
- * @param {cc.Sprite} arg0
- * @param {int} arg1
- * @param {int} arg2
- * @return {cc.SpriteBatchNode}
- */
-addSpriteWithoutQuad : function (
-sprite,
-int,
-int
-)
-{
- return cc.SpriteBatchNode;
+ return 0;
},
/**
@@ -11373,67 +11383,55 @@ int
},
/**
- * @method increaseAtlasCapacity
+ * @method setTextureAtlas
+ * @param {cc.TextureAtlas} arg0
*/
-increaseAtlasCapacity : function (
+setTextureAtlas : function (
+textureatlas
)
{
},
/**
- * @method init
+ * @method initWithFile
+ * @param {String} arg0
+ * @param {long} arg1
* @return {bool}
*/
-init : function (
+initWithFile : function (
+str,
+long
)
{
return false;
},
/**
- * @method lowestAtlasIndexInChild
- * @param {cc.Sprite} arg0
- * @return {long}
+ * @method getTexture
+ * @return {cc.Texture2D}
*/
-lowestAtlasIndexInChild : function (
-sprite
+getTexture : function (
)
{
- return 0;
+ return cc.Texture2D;
},
/**
- * @method getBlendFunc
- * @return {cc.BlendFunc}
+ * @method increaseAtlasCapacity
*/
-getBlendFunc : function (
+increaseAtlasCapacity : function (
)
{
- return cc.BlendFunc;
},
/**
- * @method initWithTexture
- * @param {cc.Texture2D} arg0
- * @param {long} arg1
- * @return {bool}
+ * @method getTextureAtlas
+ * @return {cc.TextureAtlas}
*/
-initWithTexture : function (
-texture2d,
-long
-)
-{
- return false;
-},
-
-/**
- * @method setTextureAtlas
- * @param {cc.TextureAtlas} arg0
- */
-setTextureAtlas : function (
-textureatlas
+getTextureAtlas : function (
)
{
+ return cc.TextureAtlas;
},
/**
@@ -11449,63 +11447,71 @@ long
},
/**
- * @method initWithFile
- * @param {String} arg0
- * @param {long} arg1
- * @return {bool}
+ * @method setTexture
+ * @param {cc.Texture2D} arg0
*/
-initWithFile : function (
-str,
-long
+setTexture : function (
+texture2d
)
{
- return false;
},
/**
- * @method setBlendFunc
- * @param {cc.BlendFunc} arg0
+ * @method rebuildIndexInOrder
+ * @param {cc.Sprite} arg0
+ * @param {long} arg1
+ * @return {long}
*/
-setBlendFunc : function (
-blendfunc
+rebuildIndexInOrder : function (
+sprite,
+long
)
{
+ return 0;
},
/**
- * @method rebuildIndexInOrder
+ * @method highestAtlasIndexInChild
* @param {cc.Sprite} arg0
- * @param {long} arg1
* @return {long}
*/
-rebuildIndexInOrder : function (
-sprite,
-long
+highestAtlasIndexInChild : function (
+sprite
)
{
return 0;
},
/**
- * @method getTextureAtlas
- * @return {cc.TextureAtlas}
+ * @method removeChildAtIndex
+ * @param {long} arg0
+ * @param {bool} arg1
*/
-getTextureAtlas : function (
+removeChildAtIndex : function (
+long,
+bool
)
{
- return cc.TextureAtlas;
},
/**
- * @method highestAtlasIndexInChild
+ * @method removeSpriteFromAtlas
* @param {cc.Sprite} arg0
- * @return {long}
*/
-highestAtlasIndexInChild : function (
+removeSpriteFromAtlas : function (
sprite
)
{
- return 0;
+},
+
+/**
+ * @method setBlendFunc
+ * @param {cc.BlendFunc} arg0
+ */
+setBlendFunc : function (
+blendfunc
+)
+{
},
/**
@@ -11572,12 +11578,12 @@ enableShadow : function (
/**
* @method setDimensions
- * @param {unsigned int} arg0
- * @param {unsigned int} arg1
+ * @param {float} arg0
+ * @param {float} arg1
*/
setDimensions : function (
-int,
-int
+float,
+float
)
{
},
@@ -11594,7 +11600,7 @@ getString : function (
/**
* @method getHeight
- * @return {unsigned int}
+ * @return {float}
*/
getHeight : function (
)
@@ -11622,17 +11628,17 @@ getTextColor : function (
/**
* @method setWidth
- * @param {unsigned int} arg0
+ * @param {float} arg0
*/
setWidth : function (
-int
+float
)
{
},
/**
* @method getMaxLineWidth
- * @return {unsigned int}
+ * @return {float}
*/
getMaxLineWidth : function (
)
@@ -11804,10 +11810,10 @@ getDimensions : function (
/**
* @method setMaxLineWidth
- * @param {unsigned int} arg0
+ * @param {float} arg0
*/
setMaxLineWidth : function (
-int
+float
)
{
},
@@ -11874,17 +11880,17 @@ color4b
/**
* @method setHeight
- * @param {unsigned int} arg0
+ * @param {float} arg0
*/
setHeight : function (
-int
+float
)
{
},
/**
* @method getWidth
- * @return {unsigned int}
+ * @return {float}
*/
getWidth : function (
)
@@ -12090,16 +12096,6 @@ getBlendFunc : function (
return cc.BlendFunc;
},
-/**
- * @method isOpacityModifyRGB
- * @return {bool}
- */
-isOpacityModifyRGB : function (
-)
-{
- return false;
-},
-
/**
* @method getLetter
* @param {int} arg0
@@ -12162,16 +12158,6 @@ vec2
return false;
},
-/**
- * @method setOpacityModifyRGB
- * @param {bool} arg0
- */
-setOpacityModifyRGB : function (
-bool
-)
-{
-},
-
/**
* @method getFntFile
* @return {String}
@@ -12349,7 +12335,7 @@ float
* @param {color4b_object|color4b_object} color4b
* @param {float} float
* @param {float} float
-* @return {bool|bool|bool}
+* @return {bool|bool}
*/
initWithColor : function(
color4b,
@@ -12482,16 +12468,6 @@ getVector : function (
return cc.Vec2;
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method setEndColor
* @param {color3b_object} arg0
@@ -12592,16 +12568,6 @@ array
return false;
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method switchToAndReleaseMe
* @param {int} arg0
@@ -13029,16 +12995,6 @@ TransitionSlideInL : function (
*/
cc.TransitionSlideInR = {
-/**
- * @method action
- * @return {cc.ActionInterval}
- */
-action : function (
-)
-{
- return cc.ActionInterval;
-},
-
/**
* @method create
* @param {float} arg0
@@ -13069,16 +13025,6 @@ TransitionSlideInR : function (
*/
cc.TransitionSlideInB = {
-/**
- * @method action
- * @return {cc.ActionInterval}
- */
-action : function (
-)
-{
- return cc.ActionInterval;
-},
-
/**
* @method create
* @param {float} arg0
@@ -13109,16 +13055,6 @@ TransitionSlideInB : function (
*/
cc.TransitionSlideInT = {
-/**
- * @method action
- * @return {cc.ActionInterval}
- */
-action : function (
-)
-{
- return cc.ActionInterval;
-},
-
/**
* @method create
* @param {float} arg0
@@ -14631,16 +14567,6 @@ isEnabled : function (
return false;
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method alignItemsHorizontallyWithPadding
* @param {float} arg0
@@ -14725,18 +14651,6 @@ getAlphaThreshold : function (
return 0;
},
-/**
- * @method init
-* @param {cc.Node} node
-* @return {bool|bool}
-*/
-init : function(
-node
-)
-{
- return false;
-},
-
/**
* @method getStencil
* @return {cc.Node}
@@ -15179,18 +15093,6 @@ float
{
},
-/**
- * @method initWithSpriteFrameName
- * @param {String} arg0
- * @return {bool}
- */
-initWithSpriteFrameName : function (
-str
-)
-{
- return false;
-},
-
/**
* @method initWithTexture
* @param {cc.Texture2D|cc.Texture2D|cc.Texture2D} texture2d
@@ -15237,14 +15139,6 @@ bool
{
},
-/**
- * @method updateTransform
- */
-updateTransform : function (
-)
-{
-},
-
/**
* @method setTextureRect
* @param {rect_object|rect_object} rect
@@ -15260,10 +15154,12 @@ size
},
/**
- * @method init
+ * @method initWithSpriteFrameName
+ * @param {String} arg0
* @return {bool}
*/
-init : function (
+initWithSpriteFrameName : function (
+str
)
{
return false;
@@ -15535,65 +15431,259 @@ Sprite : function (
};
/**
- * @class RenderTexture
+ * @class Image
*/
-cc.RenderTexture = {
+cc.Image = {
/**
- * @method setVirtualViewport
- * @param {vec2_object} arg0
- * @param {rect_object} arg1
- * @param {rect_object} arg2
+ * @method hasPremultipliedAlpha
+ * @return {bool}
*/
-setVirtualViewport : function (
-vec2,
-rect,
-rect
+hasPremultipliedAlpha : function (
)
{
+ return false;
},
/**
- * @method clearStencil
- * @param {int} arg0
+ * @method getDataLen
+ * @return {long}
*/
-clearStencil : function (
-int
+getDataLen : function (
)
{
+ return 0;
},
/**
- * @method getClearDepth
- * @return {float}
+ * @method saveToFile
+ * @param {String} arg0
+ * @param {bool} arg1
+ * @return {bool}
*/
-getClearDepth : function (
+saveToFile : function (
+str,
+bool
)
{
- return 0;
+ return false;
},
/**
- * @method getClearStencil
- * @return {int}
+ * @method hasAlpha
+ * @return {bool}
*/
-getClearStencil : function (
+hasAlpha : function (
)
{
- return 0;
+ return false;
},
/**
- * @method end
+ * @method isCompressed
+ * @return {bool}
*/
-end : function (
+isCompressed : function (
)
{
+ return false;
},
/**
- * @method setClearStencil
- * @param {int} arg0
+ * @method getHeight
+ * @return {int}
+ */
+getHeight : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method initWithImageFile
+ * @param {String} arg0
+ * @return {bool}
+ */
+initWithImageFile : function (
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method getWidth
+ * @return {int}
+ */
+getWidth : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getBitPerPixel
+ * @return {int}
+ */
+getBitPerPixel : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getFileType
+ * @return {cc.Image::Format}
+ */
+getFileType : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getNumberOfMipmaps
+ * @return {int}
+ */
+getNumberOfMipmaps : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getRenderFormat
+ * @return {cc.Texture2D::PixelFormat}
+ */
+getRenderFormat : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getData
+ * @return {unsigned char}
+ */
+getData : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getMipmaps
+ * @return {cc._MipmapInfo}
+ */
+getMipmaps : function (
+)
+{
+ return cc._MipmapInfo;
+},
+
+/**
+ * @method initWithRawData
+ * @param {unsigned char} arg0
+ * @param {long} arg1
+ * @param {int} arg2
+ * @param {int} arg3
+ * @param {int} arg4
+ * @param {bool} arg5
+ * @return {bool}
+ */
+initWithRawData : function (
+char,
+long,
+int,
+int,
+int,
+bool
+)
+{
+ return false;
+},
+
+/**
+ * @method setPVRImagesHavePremultipliedAlpha
+ * @param {bool} arg0
+ */
+setPVRImagesHavePremultipliedAlpha : function (
+bool
+)
+{
+},
+
+/**
+ * @method Image
+ * @constructor
+ */
+Image : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RenderTexture
+ */
+cc.RenderTexture = {
+
+/**
+ * @method setVirtualViewport
+ * @param {vec2_object} arg0
+ * @param {rect_object} arg1
+ * @param {rect_object} arg2
+ */
+setVirtualViewport : function (
+vec2,
+rect,
+rect
+)
+{
+},
+
+/**
+ * @method clearStencil
+ * @param {int} arg0
+ */
+clearStencil : function (
+int
+)
+{
+},
+
+/**
+ * @method getClearDepth
+ * @return {float}
+ */
+getClearDepth : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getClearStencil
+ * @return {int}
+ */
+getClearStencil : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method end
+ */
+end : function (
+)
+{
+},
+
+/**
+ * @method setClearStencil
+ * @param {int} arg0
*/
setClearStencil : function (
int
@@ -16157,16 +16247,6 @@ getRadialAccelVar : function (
return 0;
},
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method getEndSizeVar
* @return {float}
@@ -16177,16 +16257,6 @@ getEndSizeVar : function (
return 0;
},
-/**
- * @method setRotation
- * @param {float} arg0
- */
-setRotation : function (
-float
-)
-{
-},
-
/**
* @method setTangentialAccel
* @param {float} arg0
@@ -16197,26 +16267,6 @@ float
{
},
-/**
- * @method setScaleY
- * @param {float} arg0
- */
-setScaleY : function (
-float
-)
-{
-},
-
-/**
- * @method setScaleX
- * @param {float} arg0
- */
-setScaleX : function (
-float
-)
-{
-},
-
/**
* @method getRadialAccel
* @return {float}
@@ -16545,16 +16595,6 @@ getEndRadius : function (
return 0;
},
-/**
- * @method isOpacityModifyRGB
- * @return {bool}
- */
-isOpacityModifyRGB : function (
-)
-{
- return false;
-},
-
/**
* @method isActive
* @return {bool}
@@ -16895,16 +16935,6 @@ getRotationIsDir : function (
return false;
},
-/**
- * @method setScale
- * @param {float} arg0
- */
-setScale : function (
-float
-)
-{
-},
-
/**
* @method getEmissionRate
* @return {float}
@@ -16945,16 +16975,6 @@ float
{
},
-/**
- * @method setOpacityModifyRGB
- * @param {bool} arg0
- */
-setOpacityModifyRGB : function (
-bool
-)
-{
-},
-
/**
* @method addParticle
* @return {bool}
@@ -17221,16 +17241,6 @@ ParticleSystemQuad : function (
*/
cc.ParticleFire = {
-/**
- * @method init
- * @return {bool}
- */
-init : function (
-)
-{
- return false;
-},
-
/**
* @method create
* @return {cc.ParticleFire}
@@ -18034,87 +18044,520 @@ int
},
/**
- * @method isActive
- * @return {bool}
+ * @method isActive
+ * @return {bool}
+ */
+isActive : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method reuse
+ */
+reuse : function (
+)
+{
+},
+
+/**
+ * @method create
+* @param {size_object|size_object} size
+* @param {cc.Texture2D} texture2d
+* @param {bool} bool
+* @return {cc.GridBase|cc.GridBase}
+*/
+create : function(
+size,
+texture2d,
+bool
+)
+{
+ return cc.GridBase;
+},
+
+};
+
+/**
+ * @class Grid3D
+ */
+cc.Grid3D = {
+
+/**
+ * @method getNeedDepthTestForBlit
+ * @return {bool}
+ */
+getNeedDepthTestForBlit : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method setNeedDepthTestForBlit
+ * @param {bool} arg0
+ */
+setNeedDepthTestForBlit : function (
+bool
+)
+{
+},
+
+/**
+ * @method create
+* @param {size_object|size_object} size
+* @param {cc.Texture2D} texture2d
+* @param {bool} bool
+* @return {cc.Grid3D|cc.Grid3D}
+*/
+create : function(
+size,
+texture2d,
+bool
+)
+{
+ return cc.Grid3D;
+},
+
+/**
+ * @method Grid3D
+ * @constructor
+ */
+Grid3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class TiledGrid3D
+ */
+cc.TiledGrid3D = {
+
+/**
+ * @method create
+* @param {size_object|size_object} size
+* @param {cc.Texture2D} texture2d
+* @param {bool} bool
+* @return {cc.TiledGrid3D|cc.TiledGrid3D}
+*/
+create : function(
+size,
+texture2d,
+bool
+)
+{
+ return cc.TiledGrid3D;
+},
+
+/**
+ * @method TiledGrid3D
+ * @constructor
+ */
+TiledGrid3D : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Camera
+ */
+cc.Camera = {
+
+/**
+ * @method setScene
+ * @param {cc.Scene} arg0
+ */
+setScene : function (
+scene
+)
+{
+},
+
+/**
+ * @method initPerspective
+ * @param {float} arg0
+ * @param {float} arg1
+ * @param {float} arg2
+ * @param {float} arg3
+ * @return {bool}
+ */
+initPerspective : function (
+float,
+float,
+float,
+float
+)
+{
+ return false;
+},
+
+/**
+ * @method getProjectionMatrix
+ * @return {mat4_object}
+ */
+getProjectionMatrix : function (
+)
+{
+ return cc.Mat4;
+},
+
+/**
+ * @method getViewProjectionMatrix
+ * @return {mat4_object}
+ */
+getViewProjectionMatrix : function (
+)
+{
+ return cc.Mat4;
+},
+
+/**
+ * @method getViewMatrix
+ * @return {mat4_object}
+ */
+getViewMatrix : function (
+)
+{
+ return cc.Mat4;
+},
+
+/**
+ * @method getCameraFlag
+ * @return {cc.CameraFlag}
+ */
+getCameraFlag : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getType
+ * @return {cc.Camera::Type}
+ */
+getType : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method initDefault
+ * @return {bool}
+ */
+initDefault : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method project
+ * @param {vec3_object} arg0
+ * @return {vec2_object}
+ */
+project : function (
+vec3
+)
+{
+ return cc.Vec2;
+},
+
+/**
+ * @method getDepthInView
+ * @param {mat4_object} arg0
+ * @return {float}
+ */
+getDepthInView : function (
+mat4
+)
+{
+ return 0;
+},
+
+/**
+ * @method lookAt
+ * @param {vec3_object} arg0
+ * @param {vec3_object} arg1
+ */
+lookAt : function (
+vec3,
+vec3
+)
+{
+},
+
+/**
+ * @method setCameraFlag
+ * @param {cc.CameraFlag} arg0
+ */
+setCameraFlag : function (
+cameraflag
+)
+{
+},
+
+/**
+ * @method initOrthographic
+ * @param {float} arg0
+ * @param {float} arg1
+ * @param {float} arg2
+ * @param {float} arg3
+ * @return {bool}
+ */
+initOrthographic : function (
+float,
+float,
+float,
+float
+)
+{
+ return false;
+},
+
+/**
+ * @method setAdditionalProjection
+ * @param {mat4_object} arg0
+ */
+setAdditionalProjection : function (
+mat4
+)
+{
+},
+
+/**
+ * @method getDepth
+ * @return {int}
+ */
+getDepth : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setDepth
+ * @param {int} arg0
+ */
+setDepth : function (
+int
+)
+{
+},
+
+/**
+ * @method create
+ * @return {cc.Camera}
+ */
+create : function (
+)
+{
+ return cc.Camera;
+},
+
+/**
+ * @method createPerspective
+ * @param {float} arg0
+ * @param {float} arg1
+ * @param {float} arg2
+ * @param {float} arg3
+ * @return {cc.Camera}
+ */
+createPerspective : function (
+float,
+float,
+float,
+float
+)
+{
+ return cc.Camera;
+},
+
+/**
+ * @method createOrthographic
+ * @param {float} arg0
+ * @param {float} arg1
+ * @param {float} arg2
+ * @param {float} arg3
+ * @return {cc.Camera}
+ */
+createOrthographic : function (
+float,
+float,
+float,
+float
+)
+{
+ return cc.Camera;
+},
+
+/**
+ * @method getDefaultCamera
+ * @return {cc.Camera}
+ */
+getDefaultCamera : function (
+)
+{
+ return cc.Camera;
+},
+
+/**
+ * @method getVisitingCamera
+ * @return {cc.Camera}
+ */
+getVisitingCamera : function (
+)
+{
+ return cc.Camera;
+},
+
+/**
+ * @method Camera
+ * @constructor
+ */
+Camera : function (
+)
+{
+},
+
+};
+
+/**
+ * @class BaseLight
+ */
+cc.BaseLight = {
+
+/**
+ * @method setEnabled
+ * @param {bool} arg0
+ */
+setEnabled : function (
+bool
+)
+{
+},
+
+/**
+ * @method getIntensity
+ * @return {float}
+ */
+getIntensity : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method isEnabled
+ * @return {bool}
+ */
+isEnabled : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method getLightType
+ * @return {cc.LightType}
+ */
+getLightType : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setLightFlag
+ * @param {cc.LightFlag} arg0
*/
-isActive : function (
+setLightFlag : function (
+lightflag
)
{
- return false;
},
/**
- * @method reuse
+ * @method setIntensity
+ * @param {float} arg0
*/
-reuse : function (
+setIntensity : function (
+float
)
{
},
/**
- * @method create
-* @param {size_object|size_object} size
-* @param {cc.Texture2D} texture2d
-* @param {bool} bool
-* @return {cc.GridBase|cc.GridBase}
-*/
-create : function(
-size,
-texture2d,
-bool
+ * @method getLightFlag
+ * @return {cc.LightFlag}
+ */
+getLightFlag : function (
)
{
- return cc.GridBase;
+ return 0;
},
};
/**
- * @class Grid3D
+ * @class DirectionLight
*/
-cc.Grid3D = {
+cc.DirectionLight = {
/**
- * @method getNeedDepthTestForBlit
- * @return {bool}
+ * @method getDirection
+ * @return {vec3_object}
*/
-getNeedDepthTestForBlit : function (
+getDirection : function (
)
{
- return false;
+ return cc.Vec3;
},
/**
- * @method setNeedDepthTestForBlit
- * @param {bool} arg0
+ * @method getDirectionInWorld
+ * @return {vec3_object}
*/
-setNeedDepthTestForBlit : function (
-bool
+getDirectionInWorld : function (
+)
+{
+ return cc.Vec3;
+},
+
+/**
+ * @method setDirection
+ * @param {vec3_object} arg0
+ */
+setDirection : function (
+vec3
)
{
},
/**
* @method create
-* @param {size_object|size_object} size
-* @param {cc.Texture2D} texture2d
-* @param {bool} bool
-* @return {cc.Grid3D|cc.Grid3D}
-*/
-create : function(
-size,
-texture2d,
-bool
+ * @param {vec3_object} arg0
+ * @param {color3b_object} arg1
+ * @return {cc.DirectionLight}
+ */
+create : function (
+vec3,
+color3b
)
{
- return cc.Grid3D;
+ return cc.DirectionLight;
},
/**
- * @method Grid3D
+ * @method DirectionLight
* @constructor
*/
-Grid3D : function (
+DirectionLight : function (
)
{
},
@@ -18122,241 +18565,227 @@ Grid3D : function (
};
/**
- * @class TiledGrid3D
+ * @class PointLight
*/
-cc.TiledGrid3D = {
+cc.PointLight = {
/**
- * @method create
-* @param {size_object|size_object} size
-* @param {cc.Texture2D} texture2d
-* @param {bool} bool
-* @return {cc.TiledGrid3D|cc.TiledGrid3D}
-*/
-create : function(
-size,
-texture2d,
-bool
+ * @method getRange
+ * @return {float}
+ */
+getRange : function (
)
{
- return cc.TiledGrid3D;
+ return 0;
},
/**
- * @method TiledGrid3D
- * @constructor
+ * @method setRange
+ * @param {float} arg0
*/
-TiledGrid3D : function (
+setRange : function (
+float
)
{
},
-};
-
-/**
- * @class Camera
- */
-cc.Camera = {
-
/**
- * @method setScene
- * @param {cc.Scene} arg0
+ * @method create
+ * @param {vec3_object} arg0
+ * @param {color3b_object} arg1
+ * @param {float} arg2
+ * @return {point_object}
*/
-setScene : function (
-scene
+create : function (
+vec3,
+color3b,
+float
)
{
+ return cc.PointLight;
},
/**
- * @method getProjectionMatrix
- * @return {mat4_object}
+ * @method PointLight
+ * @constructor
*/
-getProjectionMatrix : function (
+PointLight : function (
)
{
- return cc.Mat4;
},
+};
+
/**
- * @method getViewProjectionMatrix
- * @return {mat4_object}
+ * @class SpotLight
*/
-getViewProjectionMatrix : function (
+cc.SpotLight = {
+
+/**
+ * @method getRange
+ * @return {float}
+ */
+getRange : function (
)
{
- return cc.Mat4;
+ return 0;
},
/**
- * @method getViewMatrix
- * @return {mat4_object}
+ * @method setDirection
+ * @param {vec3_object} arg0
*/
-getViewMatrix : function (
+setDirection : function (
+vec3
)
{
- return cc.Mat4;
},
/**
- * @method getCameraFlag
- * @return {cc.CameraFlag}
+ * @method getCosInnerAngle
+ * @return {float}
*/
-getCameraFlag : function (
+getCosInnerAngle : function (
)
{
return 0;
},
/**
- * @method getType
- * @return {cc.Camera::Type}
+ * @method getOuterAngle
+ * @return {float}
*/
-getType : function (
+getOuterAngle : function (
)
{
return 0;
},
/**
- * @method lookAt
- * @param {vec3_object} arg0
- * @param {vec3_object} arg1
+ * @method getInnerAngle
+ * @return {float}
*/
-lookAt : function (
-vec3,
-vec3
+getInnerAngle : function (
)
{
+ return 0;
},
/**
- * @method setCameraFlag
- * @param {cc.CameraFlag} arg0
+ * @method getDirection
+ * @return {vec3_object}
*/
-setCameraFlag : function (
-cameraflag
+getDirection : function (
)
{
+ return cc.Vec3;
},
/**
- * @method initOrthographic
- * @param {float} arg0
- * @param {float} arg1
- * @param {float} arg2
- * @param {float} arg3
- * @return {bool}
+ * @method getCosOuterAngle
+ * @return {float}
*/
-initOrthographic : function (
-float,
-float,
-float,
-float
+getCosOuterAngle : function (
)
{
- return false;
+ return 0;
},
/**
- * @method initPerspective
+ * @method setOuterAngle
* @param {float} arg0
- * @param {float} arg1
- * @param {float} arg2
- * @param {float} arg3
- * @return {bool}
*/
-initPerspective : function (
-float,
-float,
-float,
+setOuterAngle : function (
float
)
{
- return false;
},
/**
- * @method initDefault
- * @return {bool}
+ * @method setInnerAngle
+ * @param {float} arg0
*/
-initDefault : function (
+setInnerAngle : function (
+float
)
{
- return false;
},
/**
- * @method setAdditionalProjection
- * @param {mat4_object} arg0
+ * @method getDirectionInWorld
+ * @return {vec3_object}
*/
-setAdditionalProjection : function (
-mat4
+getDirectionInWorld : function (
)
{
+ return cc.Vec3;
},
/**
- * @method create
- * @return {cc.Camera}
+ * @method setRange
+ * @param {float} arg0
*/
-create : function (
+setRange : function (
+float
)
{
- return cc.Camera;
},
/**
- * @method createPerspective
- * @param {float} arg0
- * @param {float} arg1
- * @param {float} arg2
+ * @method create
+ * @param {vec3_object} arg0
+ * @param {vec3_object} arg1
+ * @param {color3b_object} arg2
* @param {float} arg3
- * @return {cc.Camera}
+ * @param {float} arg4
+ * @param {float} arg5
+ * @return {cc.SpotLight}
*/
-createPerspective : function (
-float,
+create : function (
+vec3,
+vec3,
+color3b,
float,
float,
float
)
{
- return cc.Camera;
+ return cc.SpotLight;
},
/**
- * @method createOrthographic
- * @param {float} arg0
- * @param {float} arg1
- * @param {float} arg2
- * @param {float} arg3
- * @return {cc.Camera}
+ * @method SpotLight
+ * @constructor
*/
-createOrthographic : function (
-float,
-float,
-float,
-float
+SpotLight : function (
)
{
- return cc.Camera;
},
+};
+
/**
- * @method getVisitingCamera
- * @return {cc.Camera}
+ * @class AmbientLight
*/
-getVisitingCamera : function (
+cc.AmbientLight = {
+
+/**
+ * @method create
+ * @param {color3b_object} arg0
+ * @return {cc.AmbientLight}
+ */
+create : function (
+color3b
)
{
- return cc.Camera;
+ return cc.AmbientLight;
},
/**
- * @method Camera
+ * @method AmbientLight
* @constructor
*/
-Camera : function (
+AmbientLight : function (
)
{
},
@@ -21040,3 +21469,38 @@ getInstance : function (
},
};
+
+/**
+ * @class AsyncTaskPool
+ */
+cc.AsyncTaskPool = {
+
+/**
+ * @method stopTasks
+ * @param {cc.AsyncTaskPool::TaskType} arg0
+ */
+stopTasks : function (
+tasktype
+)
+{
+},
+
+/**
+ * @method destoryInstance
+ */
+destoryInstance : function (
+)
+{
+},
+
+/**
+ * @method getInstance
+ * @return {cc.AsyncTaskPool}
+ */
+getInstance : function (
+)
+{
+ return cc.AsyncTaskPool;
+},
+
+};
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_extension_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_extension_auto_api.js
index c0cdf69eb5..89a1e3796d 100644
--- a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_extension_auto_api.js
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_extension_auto_api.js
@@ -166,16 +166,6 @@ isPushed : function (
return false;
},
-/**
- * @method setSelected
- * @param {bool} arg0
- */
-setSelected : function (
-bool
-)
-{
-},
-
/**
* @method setTitleLabelForState
* @param {cc.Node} arg0
@@ -198,26 +188,6 @@ bool
{
},
-/**
- * @method setHighlighted
- * @param {bool} arg0
- */
-setHighlighted : function (
-bool
-)
-{
-},
-
-/**
- * @method setZoomOnTouchDown
- * @param {bool} arg0
- */
-setZoomOnTouchDown : function (
-bool
-)
-{
-},
-
/**
* @method setTitleForState
* @param {String} arg0
@@ -329,10 +299,10 @@ getCurrentTitleColor : function (
},
/**
- * @method setEnabled
+ * @method setZoomOnTouchDown
* @param {bool} arg0
*/
-setEnabled : function (
+setZoomOnTouchDown : function (
bool
)
{
@@ -370,14 +340,6 @@ getHorizontalOrigin : function (
return 0;
},
-/**
- * @method needsLayout
- */
-needsLayout : function (
-)
-{
-},
-
/**
* @method initWithTitleAndFontNameAndFontSize
* @param {String} arg0
@@ -395,13 +357,15 @@ float
},
/**
- * @method getCurrentTitle
-* @return {String|String}
-*/
-getCurrentTitle : function(
+ * @method setTitleBMFontForState
+ * @param {String} arg0
+ * @param {cc.Control::State} arg1
+ */
+setTitleBMFontForState : function (
+str,
+state
)
{
- return ;
},
/**
@@ -505,17 +469,15 @@ float
},
/**
- * @method initWithLabelAndBackgroundSprite
- * @param {cc.Node} arg0
- * @param {ccui.Scale9Sprite} arg1
- * @return {bool}
+ * @method getTitleBMFontForState
+ * @param {cc.Control::State} arg0
+ * @return {String}
*/
-initWithLabelAndBackgroundSprite : function (
-node,
-scale9sprite
+getTitleBMFontForState : function (
+state
)
{
- return false;
+ return ;
},
/**
@@ -573,27 +535,27 @@ int
},
/**
- * @method setTitleBMFontForState
- * @param {String} arg0
- * @param {cc.Control::State} arg1
- */
-setTitleBMFontForState : function (
-str,
-state
+ * @method getCurrentTitle
+* @return {String|String}
+*/
+getCurrentTitle : function(
)
{
+ return ;
},
/**
- * @method getTitleBMFontForState
- * @param {cc.Control::State} arg0
- * @return {String}
+ * @method initWithLabelAndBackgroundSprite
+ * @param {cc.Node} arg0
+ * @param {ccui.Scale9Sprite} arg1
+ * @return {bool}
*/
-getTitleBMFontForState : function (
-state
+initWithLabelAndBackgroundSprite : function (
+node,
+scale9sprite
)
{
- return ;
+ return false;
},
/**
@@ -650,16 +612,6 @@ ControlButton : function (
*/
cc.ControlHuePicker = {
-/**
- * @method setEnabled
- * @param {bool} arg0
- */
-setEnabled : function (
-bool
-)
-{
-},
-
/**
* @method initWithTargetAndPos
* @param {cc.Node} arg0
@@ -838,16 +790,6 @@ getOverlay : function (
return cc.Sprite;
},
-/**
- * @method setEnabled
- * @param {bool} arg0
- */
-setEnabled : function (
-bool
-)
-{
-},
-
/**
* @method getSlider
* @return {cc.Sprite}
@@ -919,11 +861,13 @@ ControlSaturationBrightnessPicker : function (
cc.ControlColourPicker = {
/**
- * @method setEnabled
- * @param {bool} arg0
+ * @method hueSliderValueChanged
+ * @param {cc.Ref} arg0
+ * @param {cc.Control::EventType} arg1
*/
-setEnabled : function (
-bool
+hueSliderValueChanged : function (
+ref,
+eventtype
)
{
},
@@ -938,28 +882,6 @@ getHuePicker : function (
return cc.ControlHuePicker;
},
-/**
- * @method setColor
- * @param {color3b_object} arg0
- */
-setColor : function (
-color3b
-)
-{
-},
-
-/**
- * @method hueSliderValueChanged
- * @param {cc.Ref} arg0
- * @param {cc.Control::EventType} arg1
- */
-hueSliderValueChanged : function (
-ref,
-eventtype
-)
-{
-},
-
/**
* @method getcolourPicker
* @return {cc.ControlSaturationBrightnessPicker}
@@ -1279,55 +1201,41 @@ ControlPotentiometer : function (
cc.ControlSlider = {
/**
- * @method getSelectedThumbSprite
- * @return {cc.Sprite}
- */
-getSelectedThumbSprite : function (
-)
-{
- return cc.Sprite;
-},
-
-/**
- * @method locationFromTouch
- * @param {cc.Touch} arg0
- * @return {vec2_object}
- */
-locationFromTouch : function (
-touch
-)
-{
- return cc.Vec2;
-},
-
-/**
- * @method setSelectedThumbSprite
+ * @method setBackgroundSprite
* @param {cc.Sprite} arg0
*/
-setSelectedThumbSprite : function (
+setBackgroundSprite : function (
sprite
)
{
},
/**
- * @method setProgressSprite
- * @param {cc.Sprite} arg0
+ * @method getMaximumAllowedValue
+ * @return {float}
*/
-setProgressSprite : function (
-sprite
+getMaximumAllowedValue : function (
)
{
+ return 0;
},
/**
- * @method getMaximumAllowedValue
- * @return {float}
- */
-getMaximumAllowedValue : function (
+ * @method initWithSprites
+* @param {cc.Sprite|cc.Sprite} sprite
+* @param {cc.Sprite|cc.Sprite} sprite
+* @param {cc.Sprite|cc.Sprite} sprite
+* @param {cc.Sprite} sprite
+* @return {bool|bool}
+*/
+initWithSprites : function(
+sprite,
+sprite,
+sprite,
+sprite
)
{
- return 0;
+ return false;
},
/**
@@ -1341,81 +1249,73 @@ getMinimumAllowedValue : function (
},
/**
- * @method getMinimumValue
+ * @method getMaximumValue
* @return {float}
*/
-getMinimumValue : function (
+getMaximumValue : function (
)
{
return 0;
},
/**
- * @method setThumbSprite
- * @param {cc.Sprite} arg0
+ * @method getSelectedThumbSprite
+ * @return {cc.Sprite}
*/
-setThumbSprite : function (
-sprite
+getSelectedThumbSprite : function (
)
{
+ return cc.Sprite;
},
/**
- * @method setMinimumValue
- * @param {float} arg0
+ * @method setProgressSprite
+ * @param {cc.Sprite} arg0
*/
-setMinimumValue : function (
-float
+setProgressSprite : function (
+sprite
)
{
},
/**
- * @method setMinimumAllowedValue
+ * @method setMaximumValue
* @param {float} arg0
*/
-setMinimumAllowedValue : function (
+setMaximumValue : function (
float
)
{
},
/**
- * @method setEnabled
- * @param {bool} arg0
- */
-setEnabled : function (
-bool
-)
-{
-},
-
-/**
- * @method setValue
- * @param {float} arg0
+ * @method getMinimumValue
+ * @return {float}
*/
-setValue : function (
-float
+getMinimumValue : function (
)
{
+ return 0;
},
/**
- * @method setMaximumValue
- * @param {float} arg0
+ * @method setThumbSprite
+ * @param {cc.Sprite} arg0
*/
-setMaximumValue : function (
-float
+setThumbSprite : function (
+sprite
)
{
},
/**
- * @method needsLayout
+ * @method getValue
+ * @return {float}
*/
-needsLayout : function (
+getValue : function (
)
{
+ return 0;
},
/**
@@ -1429,63 +1329,55 @@ getBackgroundSprite : function (
},
/**
- * @method initWithSprites
-* @param {cc.Sprite|cc.Sprite} sprite
-* @param {cc.Sprite|cc.Sprite} sprite
-* @param {cc.Sprite|cc.Sprite} sprite
-* @param {cc.Sprite} sprite
-* @return {bool|bool}
-*/
-initWithSprites : function(
-sprite,
-sprite,
-sprite,
-sprite
+ * @method getThumbSprite
+ * @return {cc.Sprite}
+ */
+getThumbSprite : function (
)
{
- return false;
+ return cc.Sprite;
},
/**
- * @method getMaximumValue
- * @return {float}
+ * @method setValue
+ * @param {float} arg0
*/
-getMaximumValue : function (
+setValue : function (
+float
)
{
- return 0;
},
/**
- * @method isTouchInside
+ * @method locationFromTouch
* @param {cc.Touch} arg0
- * @return {bool}
+ * @return {vec2_object}
*/
-isTouchInside : function (
+locationFromTouch : function (
touch
)
{
- return false;
+ return cc.Vec2;
},
/**
- * @method getValue
- * @return {float}
+ * @method setMinimumValue
+ * @param {float} arg0
*/
-getValue : function (
+setMinimumValue : function (
+float
)
{
- return 0;
},
/**
- * @method getThumbSprite
- * @return {cc.Sprite}
+ * @method setMinimumAllowedValue
+ * @param {float} arg0
*/
-getThumbSprite : function (
+setMinimumAllowedValue : function (
+float
)
{
- return cc.Sprite;
},
/**
@@ -1499,10 +1391,10 @@ getProgressSprite : function (
},
/**
- * @method setBackgroundSprite
+ * @method setSelectedThumbSprite
* @param {cc.Sprite} arg0
*/
-setBackgroundSprite : function (
+setSelectedThumbSprite : function (
sprite
)
{
@@ -1553,75 +1445,79 @@ ControlSlider : function (
cc.ControlStepper = {
/**
- * @method setMinusSprite
- * @param {cc.Sprite} arg0
+ * @method getMinusSprite
+ * @return {cc.Sprite}
*/
-setMinusSprite : function (
-sprite
+getMinusSprite : function (
)
{
+ return cc.Sprite;
},
/**
- * @method getMinusLabel
- * @return {cc.Label}
+ * @method setValue
+ * @param {double} arg0
*/
-getMinusLabel : function (
+setValue : function (
+double
)
{
- return cc.Label;
},
/**
- * @method setWraps
- * @param {bool} arg0
+ * @method setStepValue
+ * @param {double} arg0
*/
-setWraps : function (
-bool
+setStepValue : function (
+double
)
{
},
/**
- * @method isContinuous
+ * @method initWithMinusSpriteAndPlusSprite
+ * @param {cc.Sprite} arg0
+ * @param {cc.Sprite} arg1
* @return {bool}
*/
-isContinuous : function (
+initWithMinusSpriteAndPlusSprite : function (
+sprite,
+sprite
)
{
return false;
},
/**
- * @method getMinusSprite
- * @return {cc.Sprite}
+ * @method setValueWithSendingEvent
+ * @param {double} arg0
+ * @param {bool} arg1
*/
-getMinusSprite : function (
+setValueWithSendingEvent : function (
+double,
+bool
)
{
- return cc.Sprite;
},
/**
- * @method updateLayoutUsingTouchLocation
- * @param {vec2_object} arg0
+ * @method setMaximumValue
+ * @param {double} arg0
*/
-updateLayoutUsingTouchLocation : function (
-vec2
+setMaximumValue : function (
+double
)
{
},
/**
- * @method setValueWithSendingEvent
- * @param {double} arg0
- * @param {bool} arg1
+ * @method getMinusLabel
+ * @return {cc.Label}
*/
-setValueWithSendingEvent : function (
-double,
-bool
+getMinusLabel : function (
)
{
+ return cc.Label;
},
/**
@@ -1635,131 +1531,117 @@ getPlusLabel : function (
},
/**
- * @method stopAutorepeat
+ * @method setWraps
+ * @param {bool} arg0
*/
-stopAutorepeat : function (
+setWraps : function (
+bool
)
{
},
/**
- * @method setMinimumValue
- * @param {double} arg0
+ * @method setMinusLabel
+ * @param {cc.Label} arg0
*/
-setMinimumValue : function (
-double
+setMinusLabel : function (
+label
)
{
},
/**
- * @method getPlusSprite
- * @return {cc.Sprite}
+ * @method startAutorepeat
*/
-getPlusSprite : function (
+startAutorepeat : function (
)
{
- return cc.Sprite;
},
/**
- * @method setPlusSprite
- * @param {cc.Sprite} arg0
+ * @method updateLayoutUsingTouchLocation
+ * @param {vec2_object} arg0
*/
-setPlusSprite : function (
-sprite
+updateLayoutUsingTouchLocation : function (
+vec2
)
{
},
/**
- * @method setMinusLabel
- * @param {cc.Label} arg0
+ * @method isContinuous
+ * @return {bool}
*/
-setMinusLabel : function (
-label
+isContinuous : function (
)
{
+ return false;
},
/**
- * @method setValue
- * @param {double} arg0
+ * @method stopAutorepeat
*/
-setValue : function (
-double
+stopAutorepeat : function (
)
{
},
/**
- * @method setStepValue
+ * @method setMinimumValue
* @param {double} arg0
*/
-setStepValue : function (
+setMinimumValue : function (
double
)
{
},
/**
- * @method setMaximumValue
- * @param {double} arg0
+ * @method setPlusLabel
+ * @param {cc.Label} arg0
*/
-setMaximumValue : function (
-double
+setPlusLabel : function (
+label
)
{
},
/**
- * @method update
- * @param {float} arg0
+ * @method getValue
+ * @return {double}
*/
-update : function (
-float
+getValue : function (
)
{
+ return 0;
},
/**
- * @method startAutorepeat
+ * @method getPlusSprite
+ * @return {cc.Sprite}
*/
-startAutorepeat : function (
+getPlusSprite : function (
)
{
+ return cc.Sprite;
},
/**
- * @method initWithMinusSpriteAndPlusSprite
+ * @method setPlusSprite
* @param {cc.Sprite} arg0
- * @param {cc.Sprite} arg1
- * @return {bool}
*/
-initWithMinusSpriteAndPlusSprite : function (
-sprite,
+setPlusSprite : function (
sprite
)
{
- return false;
},
/**
- * @method getValue
- * @return {double}
- */
-getValue : function (
-)
-{
- return 0;
-},
-
-/**
- * @method setPlusLabel
- * @param {cc.Label} arg0
+ * @method setMinusSprite
+ * @param {cc.Sprite} arg0
*/
-setPlusLabel : function (
-label
+setMinusSprite : function (
+sprite
)
{
},
@@ -1794,16 +1676,6 @@ ControlStepper : function (
*/
cc.ControlSwitch = {
-/**
- * @method setEnabled
- * @param {bool} arg0
- */
-setEnabled : function (
-bool
-)
-{
-},
-
/**
* @method setOn
* @param {bool|bool} bool
@@ -1816,6 +1688,18 @@ bool
{
},
+/**
+ * @method locationFromTouch
+ * @param {cc.Touch} arg0
+ * @return {vec2_object}
+ */
+locationFromTouch : function (
+touch
+)
+{
+ return cc.Vec2;
+},
+
/**
* @method isOn
* @return {bool}
@@ -1858,18 +1742,6 @@ hasMoved : function (
return false;
},
-/**
- * @method locationFromTouch
- * @param {cc.Touch} arg0
- * @return {vec2_object}
- */
-locationFromTouch : function (
-touch
-)
-{
- return cc.Vec2;
-},
-
/**
* @method create
* @param {cc.Sprite|cc.Sprite} sprite
@@ -2067,13 +1939,13 @@ direction
},
/**
- * @method init
- * @return {bool}
+ * @method setBounceable
+ * @param {bool} arg0
*/
-init : function (
+setBounceable : function (
+bool
)
{
- return false;
},
/**
@@ -2188,16 +2060,6 @@ maxContainerOffset : function (
return cc.Vec2;
},
-/**
- * @method setBounceable
- * @param {bool} arg0
- */
-setBounceable : function (
-bool
-)
-{
-},
-
/**
* @method isTouchMoved
* @return {bool}
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_spine_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_spine_auto_api.js
index 664f1adfe5..04f48ea510 100644
--- a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_spine_auto_api.js
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_spine_auto_api.js
@@ -19,51 +19,65 @@ float
},
/**
- * @method isOpacityModifyRGB
+ * @method getDebugSlotsEnabled
* @return {bool}
*/
-isOpacityModifyRGB : function (
+getDebugSlotsEnabled : function (
)
{
return false;
},
/**
- * @method drawSkeleton
- * @param {mat4_object} arg0
- * @param {unsigned int} arg1
+ * @method setAttachment
+ * @param {String} arg0
+ * @param {String} arg1
+ * @return {bool}
*/
-drawSkeleton : function (
-mat4,
-int
+setAttachment : function (
+str,
+str
)
{
+ return false;
},
/**
- * @method setDebugSlotsEnabled
- * @param {bool} arg0
+ * @method setBonesToSetupPose
*/
-setDebugSlotsEnabled : function (
-bool
+setBonesToSetupPose : function (
)
{
},
/**
- * @method getDebugSlotsEnabled
+ * @method isOpacityModifyRGB
* @return {bool}
*/
-getDebugSlotsEnabled : function (
+isOpacityModifyRGB : function (
)
{
return false;
},
/**
- * @method setBonesToSetupPose
+ * @method initWithData
+ * @param {spSkeletonData} arg0
+ * @param {bool} arg1
*/
-setBonesToSetupPose : function (
+initWithData : function (
+spskeletondata,
+bool
+)
+{
+},
+
+/**
+ * @method setDebugSlotsEnabled
+ * @param {bool} arg0
+ */
+setDebugSlotsEnabled : function (
+bool
)
{
},
@@ -77,45 +91,41 @@ setSlotsToSetupPose : function (
},
/**
- * @method setAttachment
- * @param {String} arg0
- * @param {String} arg1
- * @return {bool}
+ * @method setOpacityModifyRGB
+ * @param {bool} arg0
*/
-setAttachment : function (
-str,
-str
+setOpacityModifyRGB : function (
+bool
)
{
- return false;
},
/**
- * @method getBlendFunc
- * @return {cc.BlendFunc}
+ * @method setToSetupPose
*/
-getBlendFunc : function (
+setToSetupPose : function (
)
{
- return cc.BlendFunc;
},
/**
- * @method setSkin
- * @param {String} arg0
- * @return {bool}
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
*/
-setSkin : function (
-str
+getBlendFunc : function (
)
{
- return false;
+ return cc.BlendFunc;
},
/**
- * @method setToSetupPose
+ * @method drawSkeleton
+ * @param {mat4_object} arg0
+ * @param {unsigned int} arg1
*/
-setToSetupPose : function (
+drawSkeleton : function (
+mat4,
+int
)
{
},
@@ -129,11 +139,9 @@ updateWorldTransform : function (
},
/**
- * @method setOpacityModifyRGB
- * @param {bool} arg0
+ * @method initialize
*/
-setOpacityModifyRGB : function (
-bool
+initialize : function (
)
{
},
@@ -149,23 +157,37 @@ bool
},
/**
- * @method getSkeleton
- * @return {spSkeleton}
+ * @method getDebugBonesEnabled
+ * @return {bool}
*/
-getSkeleton : function (
+getDebugBonesEnabled : function (
)
{
- return spSkeleton;
+ return false;
},
/**
- * @method getDebugBonesEnabled
- * @return {bool}
+ * @method getTimeScale
+ * @return {float}
*/
-getDebugBonesEnabled : function (
+getTimeScale : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method initWithFile
+* @param {String|String} str
+* @param {String|spAtlas} str
+* @param {float|float} float
+*/
+initWithFile : function(
+str,
+spatlas,
+float
)
{
- return false;
},
/**
@@ -179,13 +201,25 @@ blendfunc
},
/**
- * @method getTimeScale
- * @return {float}
+ * @method setSkin
+ * @param {String} arg0
+ * @return {bool}
*/
-getTimeScale : function (
+setSkin : function (
+str
)
{
- return 0;
+ return false;
+},
+
+/**
+ * @method getSkeleton
+ * @return {spSkeleton}
+ */
+getSkeleton : function (
+)
+{
+ return spSkeleton;
},
/**
@@ -204,6 +238,21 @@ float
return sp.SkeletonRenderer;
},
+/**
+ * @method SkeletonRenderer
+ * @constructor
+* @param {spSkeletonData|String|String} spskeletondata
+* @param {bool|spAtlas|String} bool
+* @param {float|float} float
+*/
+SkeletonRenderer : function(
+str,
+str,
+float
+)
+{
+},
+
};
/**
@@ -349,6 +398,14 @@ func
{
},
+/**
+ * @method initialize
+ */
+initialize : function (
+)
+{
+},
+
/**
* @method clearTracks
*/
@@ -397,4 +454,19 @@ float
return sp.SkeletonAnimation;
},
+/**
+ * @method SkeletonAnimation
+ * @constructor
+* @param {spSkeletonData|String|String} spskeletondata
+* @param {spAtlas|String} spatlas
+* @param {float|float} float
+*/
+SkeletonAnimation : function(
+str,
+str,
+float
+)
+{
+},
+
};
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_studio_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_studio_auto_api.js
index eb7d72428b..8ef5dca4aa 100644
--- a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_studio_auto_api.js
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_studio_auto_api.js
@@ -444,6 +444,110 @@ AnimationData : function (
};
+/**
+ * @class ContourData
+ */
+ccs.ContourData = {
+
+/**
+ * @method init
+ * @return {bool}
+ */
+init : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method addVertex
+ * @param {vec2_object} arg0
+ */
+addVertex : function (
+vec2
+)
+{
+},
+
+/**
+ * @method create
+ * @return {ccs.ContourData}
+ */
+create : function (
+)
+{
+ return ccs.ContourData;
+},
+
+/**
+ * @method ContourData
+ * @constructor
+ */
+ContourData : function (
+)
+{
+},
+
+};
+
+/**
+ * @class TextureData
+ */
+ccs.TextureData = {
+
+/**
+ * @method getContourData
+ * @param {int} arg0
+ * @return {ccs.ContourData}
+ */
+getContourData : function (
+int
+)
+{
+ return ccs.ContourData;
+},
+
+/**
+ * @method init
+ * @return {bool}
+ */
+init : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method addContourData
+ * @param {ccs.ContourData} arg0
+ */
+addContourData : function (
+contourdata
+)
+{
+},
+
+/**
+ * @method create
+ * @return {ccs.TextureData}
+ */
+create : function (
+)
+{
+ return ccs.TextureData;
+},
+
+/**
+ * @method TextureData
+ * @constructor
+ */
+TextureData : function (
+)
+{
+},
+
+};
+
/**
* @class ProcessBase
*/
@@ -1566,50 +1670,6 @@ getSpeedScale : function (
return 0;
},
-/**
- * @method pause
- */
-pause : function (
-)
-{
-},
-
-/**
- * @method setSpeedScale
- * @param {float} arg0
- */
-setSpeedScale : function (
-float
-)
-{
-},
-
-/**
- * @method init
- * @param {ccs.Armature} arg0
- * @return {bool}
- */
-init : function (
-armature
-)
-{
- return false;
-},
-
-/**
- * @method playWithIndexes
- * @param {Array} arg0
- * @param {int} arg1
- * @param {bool} arg2
- */
-playWithIndexes : function (
-array,
-int,
-bool
-)
-{
-},
-
/**
* @method play
* @param {String} arg0
@@ -1635,26 +1695,34 @@ int
},
/**
- * @method resume
+ * @method playWithIndexes
+ * @param {Array} arg0
+ * @param {int} arg1
+ * @param {bool} arg2
*/
-resume : function (
+playWithIndexes : function (
+array,
+int,
+bool
)
{
},
/**
- * @method stop
+ * @method setAnimationData
+ * @param {ccs.AnimationData} arg0
*/
-stop : function (
+setAnimationData : function (
+animationdata
)
{
},
/**
- * @method update
+ * @method setSpeedScale
* @param {float} arg0
*/
-update : function (
+setSpeedScale : function (
float
)
{
@@ -1671,71 +1739,73 @@ getAnimationData : function (
},
/**
- * @method playWithIndex
+ * @method gotoAndPlay
* @param {int} arg0
- * @param {int} arg1
- * @param {int} arg2
*/
-playWithIndex : function (
-int,
-int,
+gotoAndPlay : function (
int
)
{
},
/**
- * @method getCurrentMovementID
- * @return {String}
+ * @method init
+ * @param {ccs.Armature} arg0
+ * @return {bool}
*/
-getCurrentMovementID : function (
+init : function (
+armature
)
{
- return ;
+ return false;
},
/**
- * @method setAnimationData
- * @param {ccs.AnimationData} arg0
+ * @method playWithNames
+ * @param {Array} arg0
+ * @param {int} arg1
+ * @param {bool} arg2
*/
-setAnimationData : function (
-animationdata
+playWithNames : function (
+array,
+int,
+bool
)
{
},
/**
- * @method gotoAndPlay
- * @param {int} arg0
+ * @method getMovementCount
+ * @return {long}
*/
-gotoAndPlay : function (
-int
+getMovementCount : function (
)
{
+ return 0;
},
/**
- * @method playWithNames
- * @param {Array} arg0
+ * @method playWithIndex
+ * @param {int} arg0
* @param {int} arg1
- * @param {bool} arg2
+ * @param {int} arg2
*/
-playWithNames : function (
-array,
+playWithIndex : function (
int,
-bool
+int,
+int
)
{
},
/**
- * @method getMovementCount
- * @return {long}
+ * @method getCurrentMovementID
+ * @return {String}
*/
-getMovementCount : function (
+getCurrentMovementID : function (
)
{
- return 0;
+ return ;
},
/**
@@ -2353,6 +2423,20 @@ float
return 0;
},
+/**
+ * @method getBool
+ * @param {String} arg0
+ * @param {bool} arg1
+ * @return {bool}
+ */
+getBool : function (
+str,
+bool
+)
+{
+ return false;
+},
+
/**
* @method getString
* @param {String} arg0
@@ -2391,20 +2475,6 @@ str
{
},
-/**
- * @method getBool
- * @param {String} arg0
- * @param {bool} arg1
- * @return {bool}
- */
-getBool : function (
-str,
-bool
-)
-{
- return false;
-},
-
/**
* @method setInt
* @param {String} arg0
@@ -2465,6 +2535,15 @@ create : function (
return ccs.ComAttribute;
},
+/**
+ * @method ComAttribute
+ * @constructor
+ */
+ComAttribute : function (
+)
+{
+},
+
};
/**
@@ -2734,6 +2813,15 @@ create : function (
return ccs.ComAudio;
},
+/**
+ * @method ComAudio
+ * @constructor
+ */
+ComAudio : function (
+)
+{
+},
+
};
/**
@@ -2875,23 +2963,23 @@ ComController : function (
ccs.ComRender = {
/**
- * @method setNode
- * @param {cc.Node} arg0
+ * @method getNode
+ * @return {cc.Node}
*/
-setNode : function (
-node
+getNode : function (
)
{
+ return cc.Node;
},
/**
- * @method getNode
- * @return {cc.Node}
+ * @method setNode
+ * @param {cc.Node} arg0
*/
-getNode : function (
+setNode : function (
+node
)
{
- return cc.Node;
},
/**
@@ -2908,257 +2996,17 @@ char
return ccs.ComRender;
},
-};
-
-/**
- * @class GUIReader
- */
-ccs.GUIReader = {
-
-/**
- * @method setFilePath
- * @param {String} arg0
- */
-setFilePath : function (
-str
-)
-{
-},
-
-/**
- * @method widgetFromJsonFile
- * @param {char} arg0
- * @return {ccui.Widget}
- */
-widgetFromJsonFile : function (
-char
-)
-{
- return ccui.Widget;
-},
-
-/**
- * @method getFilePath
- * @return {String}
- */
-getFilePath : function (
-)
-{
- return ;
-},
-
-/**
- * @method widgetFromBinaryFile
- * @param {char} arg0
- * @return {ccui.Widget}
- */
-widgetFromBinaryFile : function (
-char
-)
-{
- return ccui.Widget;
-},
-
/**
- * @method getVersionInteger
- * @param {char} arg0
- * @return {int}
- */
-getVersionInteger : function (
+ * @method ComRender
+ * @constructor
+* @param {cc.Node} node
+* @param {char} char
+*/
+ComRender : function(
+node,
char
)
{
- return 0;
-},
-
-/**
- * @method destroyInstance
- */
-destroyInstance : function (
-)
-{
-},
-
-/**
- * @method getInstance
- * @return {ccs.GUIReader}
- */
-getInstance : function (
-)
-{
- return ccs.GUIReader;
-},
-
-};
-
-/**
- * @class SceneReader
- */
-ccs.SceneReader = {
-
-/**
- * @method createNodeWithSceneFile
- * @param {String} arg0
- * @param {ccs.SceneReader::AttachComponentType} arg1
- * @return {cc.Node}
- */
-createNodeWithSceneFile : function (
-str,
-attachcomponenttype
-)
-{
- return cc.Node;
-},
-
-/**
- * @method getAttachComponentType
- * @return {ccs.SceneReader::AttachComponentType}
- */
-getAttachComponentType : function (
-)
-{
- return 0;
-},
-
-/**
- * @method getNodeByTag
- * @param {int} arg0
- * @return {cc.Node}
- */
-getNodeByTag : function (
-int
-)
-{
- return cc.Node;
-},
-
-/**
- * @method destroyInstance
- */
-destroyInstance : function (
-)
-{
-},
-
-/**
- * @method sceneReaderVersion
- * @return {char}
- */
-sceneReaderVersion : function (
-)
-{
- return 0;
-},
-
-/**
- * @method getInstance
- * @return {ccs.SceneReader}
- */
-getInstance : function (
-)
-{
- return ccs.SceneReader;
-},
-
-};
-
-/**
- * @class ActionTimelineCache
- */
-ccs.ActionTimelineCache = {
-
-/**
- * @method createActionFromJson
- * @param {String} arg0
- * @return {ccs.timeline::ActionTimeline}
- */
-createActionFromJson : function (
-str
-)
-{
- return ccs.timeline::ActionTimeline;
-},
-
-/**
- * @method purge
- */
-purge : function (
-)
-{
-},
-
-/**
- * @method init
- */
-init : function (
-)
-{
-},
-
-/**
- * @method loadAnimationActionWithFile
- * @param {String} arg0
- * @return {ccs.timeline::ActionTimeline}
- */
-loadAnimationActionWithFile : function (
-str
-)
-{
- return ccs.timeline::ActionTimeline;
-},
-
-/**
- * @method loadAnimationActionWithContent
- * @param {String} arg0
- * @param {String} arg1
- * @return {ccs.timeline::ActionTimeline}
- */
-loadAnimationActionWithContent : function (
-str,
-str
-)
-{
- return ccs.timeline::ActionTimeline;
-},
-
-/**
- * @method removeAction
- * @param {String} arg0
- */
-removeAction : function (
-str
-)
-{
-},
-
-/**
- * @method destroyInstance
- */
-destroyInstance : function (
-)
-{
-},
-
-/**
- * @method createAction
- * @param {String} arg0
- * @return {ccs.timeline::ActionTimeline}
- */
-createAction : function (
-str
-)
-{
- return ccs.timeline::ActionTimeline;
-},
-
-/**
- * @method getInstance
- * @return {ccs.timeline::ActionTimelineCache}
- */
-getInstance : function (
-)
-{
- return ccs.timeline::ActionTimelineCache;
},
};
@@ -3341,16 +3189,6 @@ getTextureName : function (
return ;
},
-/**
- * @method setNode
- * @param {cc.Node} arg0
- */
-setNode : function (
-node
-)
-{
-},
-
/**
* @method setTextureName
* @param {String} arg0
@@ -3733,6 +3571,26 @@ AnchorPointFrame : function (
*/
ccs.InnerActionFrame = {
+/**
+ * @method getEndFrameIndex
+ * @return {int}
+ */
+getEndFrameIndex : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getStartFrameIndex
+ * @return {int}
+ */
+getStartFrameIndex : function (
+)
+{
+ return 0;
+},
+
/**
* @method getInnerActionType
* @return {ccs.timeline::InnerActionType}
@@ -3743,6 +3601,36 @@ getInnerActionType : function (
return 0;
},
+/**
+ * @method setEndFrameIndex
+ * @param {int} arg0
+ */
+setEndFrameIndex : function (
+int
+)
+{
+},
+
+/**
+ * @method setEnterWithName
+ * @param {bool} arg0
+ */
+setEnterWithName : function (
+bool
+)
+{
+},
+
+/**
+ * @method setSingleFrameIndex
+ * @param {int} arg0
+ */
+setSingleFrameIndex : function (
+int
+)
+{
+},
+
/**
* @method setStartFrameIndex
* @param {int} arg0
@@ -3753,6 +3641,16 @@ int
{
},
+/**
+ * @method getSingleFrameIndex
+ * @return {int}
+ */
+getSingleFrameIndex : function (
+)
+{
+ return 0;
+},
+
/**
* @method setInnerActionType
* @param {ccs.timeline::InnerActionType} arg0
@@ -3764,13 +3662,13 @@ inneractiontype
},
/**
- * @method getStartFrameIndex
- * @return {int}
+ * @method setAnimationName
+ * @param {String} arg0
*/
-getStartFrameIndex : function (
+setAnimationName : function (
+str
)
{
- return 0;
},
/**
@@ -3799,16 +3697,6 @@ InnerActionFrame : function (
*/
ccs.ColorFrame = {
-/**
- * @method getAlpha
- * @return {unsigned char}
- */
-getAlpha : function (
-)
-{
- return 0;
-},
-
/**
* @method getColor
* @return {color3b_object}
@@ -3819,16 +3707,6 @@ getColor : function (
return cc.Color3B;
},
-/**
- * @method setAlpha
- * @param {unsigned char} arg0
- */
-setAlpha : function (
-char
-)
-{
-},
-
/**
* @method setColor
* @param {color3b_object} arg0
@@ -3860,6 +3738,52 @@ ColorFrame : function (
};
+/**
+ * @class AlphaFrame
+ */
+ccs.AlphaFrame = {
+
+/**
+ * @method getAlpha
+ * @return {unsigned char}
+ */
+getAlpha : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setAlpha
+ * @param {unsigned char} arg0
+ */
+setAlpha : function (
+char
+)
+{
+},
+
+/**
+ * @method create
+ * @return {ccs.timeline::AlphaFrame}
+ */
+create : function (
+)
+{
+ return ccs.timeline::AlphaFrame;
+},
+
+/**
+ * @method AlphaFrame
+ * @constructor
+ */
+AlphaFrame : function (
+)
+{
+},
+
+};
+
/**
* @class EventFrame
*/
@@ -4133,6 +4057,18 @@ int
{
},
+/**
+ * @method init
+ * @param {int} arg0
+ * @return {bool}
+ */
+init : function (
+int
+)
+{
+ return false;
+},
+
/**
* @method getActionTag
* @return {int}
@@ -4155,6 +4091,15 @@ int
return ccs.timeline::ActionTimelineData;
},
+/**
+ * @method ActionTimelineData
+ * @constructor
+ */
+ActionTimelineData : function (
+)
+{
+},
+
};
/**
@@ -4230,6 +4175,14 @@ timeline
{
},
+/**
+ * @method clearFrameEventCallFunc
+ */
+clearFrameEventCallFunc : function (
+)
+{
+},
+
/**
* @method setLastFrameCallFunc
* @param {function} arg0
@@ -4250,6 +4203,30 @@ getTimelines : function (
return new Array();
},
+/**
+ * @method play
+ * @param {String} arg0
+ * @param {bool} arg1
+ */
+play : function (
+str,
+bool
+)
+{
+},
+
+/**
+ * @method getAnimationInfo
+ * @param {String} arg0
+ * @return {ccs.timeline::AnimationInfo}
+ */
+getAnimationInfo : function (
+str
+)
+{
+ return ccs.timeline::AnimationInfo;
+},
+
/**
* @method resume
*/
@@ -4258,6 +4235,16 @@ resume : function (
{
},
+/**
+ * @method removeAnimationInfo
+ * @param {String} arg0
+ */
+removeAnimationInfo : function (
+str
+)
+{
+},
+
/**
* @method getTimeSpeed
* @return {float}
@@ -4268,6 +4255,16 @@ getTimeSpeed : function (
return 0;
},
+/**
+ * @method addAnimationInfo
+ * @param {ccs.timeline::AnimationInfo} arg0
+ */
+addAnimationInfo : function (
+animationinfo
+)
+{
+},
+
/**
* @method getDuration
* @return {int}
@@ -4315,11 +4312,15 @@ bool
},
/**
- * @method clearFrameEventCallFunc
+ * @method IsAnimationInfoExists
+ * @param {String} arg0
+ * @return {bool}
*/
-clearFrameEventCallFunc : function (
+IsAnimationInfoExists : function (
+str
)
{
+ return false;
},
/**
@@ -4392,160 +4393,77 @@ ActionTimeline : function (
};
/**
- * @class CSLoader
- */
-ccs.CSLoader = {
-
-/**
- * @method setJsonPath
- * @param {String} arg0
+ * @class ObjectExtensionData
*/
-setJsonPath : function (
-str
-)
-{
-},
+ccs.ObjectExtensionData = {
/**
- * @method createNodeFromJson
- * @param {String} arg0
- * @return {cc.Node}
+ * @method setActionTag
+ * @param {int} arg0
*/
-createNodeFromJson : function (
-str
+setActionTag : function (
+int
)
{
- return cc.Node;
},
/**
- * @method loadNodeWithFile
+ * @method setCustomProperty
* @param {String} arg0
- * @return {cc.Node}
*/
-loadNodeWithFile : function (
+setCustomProperty : function (
str
)
-{
- return cc.Node;
-},
-
-/**
- * @method bindCallback
- * @param {String} arg0
- * @param {String} arg1
- * @param {ccui.Widget} arg2
- * @param {cc.Node} arg3
- * @return {bool}
- */
-bindCallback : function (
-str,
-str,
-widget,
-node
-)
-{
- return false;
-},
-
-/**
- * @method purge
- */
-purge : function (
-)
{
},
/**
* @method init
- */
-init : function (
-)
-{
-},
-
-/**
- * @method loadNodeWithContent
- * @param {String} arg0
- * @return {cc.Node}
- */
-loadNodeWithContent : function (
-str
-)
-{
- return cc.Node;
-},
-
-/**
- * @method isRecordJsonPath
* @return {bool}
*/
-isRecordJsonPath : function (
+init : function (
)
{
return false;
},
/**
- * @method getJsonPath
+ * @method getCustomProperty
* @return {String}
*/
-getJsonPath : function (
+getCustomProperty : function (
)
{
return ;
},
/**
- * @method setRecordJsonPath
- * @param {bool} arg0
- */
-setRecordJsonPath : function (
-bool
-)
-{
-},
-
-/**
- * @method destroyInstance
- */
-destroyInstance : function (
-)
-{
-},
-
-/**
- * @method createNode
- * @param {String} arg0
- * @return {cc.Node}
+ * @method getActionTag
+ * @return {int}
*/
-createNode : function (
-str
+getActionTag : function (
)
{
- return cc.Node;
+ return 0;
},
/**
- * @method createTimeline
- * @param {String} arg0
- * @return {ccs.timeline::ActionTimeline}
+ * @method create
+ * @return {ccs.ObjectExtensionData}
*/
-createTimeline : function (
-str
+create : function (
)
{
- return ccs.timeline::ActionTimeline;
+ return ccs.ObjectExtensionData;
},
/**
- * @method getInstance
- * @return {cc.CSLoader}
+ * @method ObjectExtensionData
+ * @constructor
*/
-getInstance : function (
+ObjectExtensionData : function (
)
{
- return cc.CSLoader;
},
};
diff --git a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_ui_auto_api.js
index cf4a7f39d5..68377648e1 100644
--- a/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_ui_auto_api.js
+++ b/frameworks/js-bindings/bindings/auto/api/jsb_cocos2dx_ui_auto_api.js
@@ -206,6 +206,16 @@ RelativeLayoutParameter : function (
*/
ccui.Widget = {
+/**
+ * @method setLayoutComponentEnabled
+ * @param {bool} arg0
+ */
+setLayoutComponentEnabled : function (
+bool
+)
+{
+},
+
/**
* @method setSizePercent
* @param {vec2_object} arg0
@@ -704,6 +714,16 @@ vec2
return false;
},
+/**
+ * @method isLayoutComponentEnabled
+ * @return {bool}
+ */
+isLayoutComponentEnabled : function (
+)
+{
+ return false;
+},
+
/**
* @method requestFocus
*/
@@ -1294,6 +1314,16 @@ Layout : function (
*/
ccui.Button = {
+/**
+ * @method getNormalTextureSize
+ * @return {size_object}
+ */
+getNormalTextureSize : function (
+)
+{
+ return cc.Size;
+},
+
/**
* @method getTitleText
* @return {String}
@@ -1716,6 +1746,16 @@ texturerestype
{
},
+/**
+ * @method getZoomScale
+ * @return {float}
+ */
+getZoomScale : function (
+)
+{
+ return 0;
+},
+
/**
* @method loadTextureBackGround
* @param {String} arg0
@@ -1728,6 +1768,16 @@ texturerestype
{
},
+/**
+ * @method setZoomScale
+ * @param {float} arg0
+ */
+setZoomScale : function (
+float
+)
+{
+},
+
/**
* @method loadTextureFrontCrossDisabled
* @param {String} arg0
@@ -1742,13 +1792,13 @@ texturerestype
/**
* @method create
-* @param {String} str
-* @param {String} str
-* @param {String} str
+* @param {String|String} str
+* @param {String|String} str
+* @param {String|ccui.Widget::TextureResType} str
* @param {String} str
* @param {String} str
* @param {ccui.Widget::TextureResType} texturerestype
-* @return {ccui.CheckBox|ccui.CheckBox}
+* @return {ccui.CheckBox|ccui.CheckBox|ccui.CheckBox}
*/
create : function(
str,
@@ -2046,6 +2096,16 @@ getStringLength : function (
return 0;
},
+/**
+ * @method getAutoRenderSize
+ * @return {size_object}
+ */
+getAutoRenderSize : function (
+)
+{
+ return cc.Size;
+},
+
/**
* @method enableOutline
* @param {color4b_object} arg0
@@ -2376,12 +2436,14 @@ getPercent : function (
/**
* @method create
-* @param {String} str
+* @param {String|String} str
+* @param {float|ccui.Widget::TextureResType} float
* @param {float} float
-* @return {ccui.LoadingBar|ccui.LoadingBar}
+* @return {ccui.LoadingBar|ccui.LoadingBar|ccui.LoadingBar}
*/
create : function(
str,
+texturerestype,
float
)
{
@@ -3096,6 +3158,16 @@ bool
{
},
+/**
+ * @method setZoomScale
+ * @param {float} arg0
+ */
+setZoomScale : function (
+float
+)
+{
+},
+
/**
* @method setCapInsets
* @param {rect_object} arg0
@@ -3106,6 +3178,16 @@ rect
{
},
+/**
+ * @method getZoomScale
+ * @return {float}
+ */
+getZoomScale : function (
+)
+{
+ return 0;
+},
+
/**
* @method loadSlidBallTexturePressed
* @param {String} arg0
@@ -3150,9 +3232,15 @@ getPercent : function (
/**
* @method create
- * @return {ccui.Slider}
- */
-create : function (
+* @param {String} str
+* @param {String} str
+* @param {ccui.Widget::TextureResType} texturerestype
+* @return {ccui.Slider|ccui.Slider}
+*/
+create : function(
+str,
+str,
+texturerestype
)
{
return ccui.Slider;
@@ -3180,46 +3268,38 @@ Slider : function (
};
/**
- * @class TextField
- */
-ccui.TextField = {
-
-/**
- * @method setAttachWithIME
- * @param {bool} arg0
+ * @class UICCTextField
*/
-setAttachWithIME : function (
-bool
-)
-{
-},
+ccui.UICCTextField = {
/**
- * @method getFontSize
- * @return {int}
+ * @method onTextFieldAttachWithIME
+ * @param {cc.TextFieldTTF} arg0
+ * @return {bool}
*/
-getFontSize : function (
+onTextFieldAttachWithIME : function (
+textfieldttf
)
{
- return 0;
+ return false;
},
/**
- * @method getString
- * @return {String}
+ * @method setPasswordText
+ * @param {String} arg0
*/
-getString : function (
+setPasswordText : function (
+str
)
{
- return ;
},
/**
- * @method setPasswordStyleText
- * @param {char} arg0
+ * @method setAttachWithIME
+ * @param {bool} arg0
*/
-setPasswordStyleText : function (
-char
+setAttachWithIME : function (
+bool
)
{
},
@@ -3234,16 +3314,6 @@ getDeleteBackward : function (
return false;
},
-/**
- * @method getPlaceHolder
- * @return {String}
- */
-getPlaceHolder : function (
-)
-{
- return ;
-},
-
/**
* @method getAttachWithIME
* @return {bool}
@@ -3255,13 +3325,19 @@ getAttachWithIME : function (
},
/**
- * @method setFontName
- * @param {String} arg0
+ * @method onTextFieldDeleteBackward
+ * @param {cc.TextFieldTTF} arg0
+ * @param {char} arg1
+ * @param {unsigned long} arg2
+ * @return {bool}
*/
-setFontName : function (
-str
+onTextFieldDeleteBackward : function (
+textfieldttf,
+char,
+long
)
{
+ return false;
},
/**
@@ -3275,21 +3351,19 @@ getInsertText : function (
},
/**
- * @method setInsertText
- * @param {bool} arg0
+ * @method deleteBackward
*/
-setInsertText : function (
-bool
+deleteBackward : function (
)
{
},
/**
- * @method setString
- * @param {String} arg0
+ * @method setInsertText
+ * @param {bool} arg0
*/
-setString : function (
-str
+setInsertText : function (
+bool
)
{
},
@@ -3305,631 +3379,590 @@ getDetachWithIME : function (
},
/**
- * @method setTextVerticalAlignment
- * @param {cc.TextVAlignment} arg0
+ * @method getCharCount
+ * @return {int}
*/
-setTextVerticalAlignment : function (
-textvalignment
+getCharCount : function (
)
{
+ return 0;
},
/**
- * @method didNotSelectSelf
+ * @method closeIME
*/
-didNotSelectSelf : function (
+closeIME : function (
)
{
},
/**
- * @method getFontName
- * @return {String}
+ * @method setPasswordEnabled
+ * @param {bool} arg0
*/
-getFontName : function (
+setPasswordEnabled : function (
+bool
)
{
- return ;
},
/**
- * @method setTextAreaSize
- * @param {size_object} arg0
+ * @method setMaxLengthEnabled
+ * @param {bool} arg0
*/
-setTextAreaSize : function (
-size
+setMaxLengthEnabled : function (
+bool
)
{
},
/**
- * @method attachWithIME
+ * @method isPasswordEnabled
+ * @return {bool}
*/
-attachWithIME : function (
+isPasswordEnabled : function (
)
{
+ return false;
},
/**
- * @method getStringLength
- * @return {int}
+ * @method insertText
+ * @param {char} arg0
+ * @param {unsigned long} arg1
*/
-getStringLength : function (
+insertText : function (
+char,
+long
)
{
- return 0;
},
/**
- * @method setPasswordEnabled
- * @param {bool} arg0
+ * @method setPasswordStyleText
+ * @param {String} arg0
*/
-setPasswordEnabled : function (
-bool
+setPasswordStyleText : function (
+str
)
{
},
/**
- * @method getPlaceHolderColor
- * @return {color4b_object}
+ * @method onTextFieldInsertText
+ * @param {cc.TextFieldTTF} arg0
+ * @param {char} arg1
+ * @param {unsigned long} arg2
+ * @return {bool}
*/
-getPlaceHolderColor : function (
+onTextFieldInsertText : function (
+textfieldttf,
+char,
+long
)
{
- return cc.Color4B;
+ return false;
},
/**
- * @method getPasswordStyleText
- * @return {char}
+ * @method onTextFieldDetachWithIME
+ * @param {cc.TextFieldTTF} arg0
+ * @return {bool}
*/
-getPasswordStyleText : function (
+onTextFieldDetachWithIME : function (
+textfieldttf
)
{
- return 0;
+ return false;
},
/**
- * @method setMaxLengthEnabled
- * @param {bool} arg0
+ * @method getMaxLength
+ * @return {int}
*/
-setMaxLengthEnabled : function (
-bool
+getMaxLength : function (
)
{
+ return 0;
},
/**
- * @method isPasswordEnabled
+ * @method isMaxLengthEnabled
* @return {bool}
*/
-isPasswordEnabled : function (
+isMaxLengthEnabled : function (
)
{
return false;
},
/**
- * @method setDeleteBackward
- * @param {bool} arg0
+ * @method openIME
*/
-setDeleteBackward : function (
-bool
+openIME : function (
)
{
},
/**
- * @method setFontSize
- * @param {int} arg0
+ * @method setDetachWithIME
+ * @param {bool} arg0
*/
-setFontSize : function (
-int
+setDetachWithIME : function (
+bool
)
{
},
/**
- * @method setPlaceHolder
- * @param {String} arg0
+ * @method setMaxLength
+ * @param {int} arg0
*/
-setPlaceHolder : function (
-str
+setMaxLength : function (
+int
)
{
},
/**
- * @method setPlaceHolderColor
-* @param {color4b_object|color3b_object} color4b
-*/
-setPlaceHolderColor : function(
-color3b
+ * @method setDeleteBackward
+ * @param {bool} arg0
+ */
+setDeleteBackward : function (
+bool
)
{
},
/**
- * @method setTextHorizontalAlignment
- * @param {cc.TextHAlignment} arg0
+ * @method create
+ * @param {String} arg0
+ * @param {String} arg1
+ * @param {float} arg2
+ * @return {ccui.UICCTextField}
*/
-setTextHorizontalAlignment : function (
-texthalignment
+create : function (
+str,
+str,
+float
)
{
+ return ccui.UICCTextField;
},
/**
- * @method setTextColor
- * @param {color4b_object} arg0
+ * @method UICCTextField
+ * @constructor
*/
-setTextColor : function (
-color4b
+UICCTextField : function (
)
{
},
+};
+
/**
- * @method getMaxLength
- * @return {int}
+ * @class TextField
*/
-getMaxLength : function (
+ccui.TextField = {
+
+/**
+ * @method setAttachWithIME
+ * @param {bool} arg0
+ */
+setAttachWithIME : function (
+bool
)
{
- return 0;
},
/**
- * @method isMaxLengthEnabled
- * @return {bool}
+ * @method getFontSize
+ * @return {int}
*/
-isMaxLengthEnabled : function (
+getFontSize : function (
)
{
- return false;
+ return 0;
},
/**
- * @method setDetachWithIME
- * @param {bool} arg0
+ * @method getString
+ * @return {String}
*/
-setDetachWithIME : function (
-bool
+getString : function (
)
{
+ return ;
},
/**
- * @method setTouchAreaEnabled
- * @param {bool} arg0
+ * @method setPasswordStyleText
+ * @param {char} arg0
*/
-setTouchAreaEnabled : function (
-bool
+setPasswordStyleText : function (
+char
)
{
},
/**
- * @method hitTest
- * @param {vec2_object} arg0
+ * @method getDeleteBackward
* @return {bool}
*/
-hitTest : function (
-vec2
+getDeleteBackward : function (
)
{
return false;
},
/**
- * @method setMaxLength
- * @param {int} arg0
+ * @method getPlaceHolder
+ * @return {String}
*/
-setMaxLength : function (
-int
+getPlaceHolder : function (
)
{
+ return ;
},
/**
- * @method setTouchSize
- * @param {size_object} arg0
+ * @method getAttachWithIME
+ * @return {bool}
*/
-setTouchSize : function (
-size
+getAttachWithIME : function (
)
{
+ return false;
},
/**
- * @method getTouchSize
- * @return {size_object}
+ * @method setFontName
+ * @param {String} arg0
*/
-getTouchSize : function (
+setFontName : function (
+str
)
{
- return cc.Size;
},
/**
- * @method create
-* @param {String} str
-* @param {String} str
-* @param {int} int
-* @return {ccui.TextField|ccui.TextField}
-*/
-create : function(
-str,
-str,
-int
+ * @method getInsertText
+ * @return {bool}
+ */
+getInsertText : function (
)
{
- return ccui.TextField;
+ return false;
},
/**
- * @method createInstance
- * @return {cc.Ref}
+ * @method setInsertText
+ * @param {bool} arg0
*/
-createInstance : function (
+setInsertText : function (
+bool
)
{
- return cc.Ref;
},
/**
- * @method TextField
- * @constructor
+ * @method setString
+ * @param {String} arg0
*/
-TextField : function (
+setString : function (
+str
)
{
},
-};
-
-/**
- * @class TextBMFont
- */
-ccui.TextBMFont = {
-
/**
- * @method setFntFile
- * @param {String} arg0
+ * @method getDetachWithIME
+ * @return {bool}
*/
-setFntFile : function (
-str
+getDetachWithIME : function (
)
{
+ return false;
},
/**
- * @method getStringLength
- * @return {long}
+ * @method setTextVerticalAlignment
+ * @param {cc.TextVAlignment} arg0
*/
-getStringLength : function (
+setTextVerticalAlignment : function (
+textvalignment
)
{
- return 0;
},
/**
- * @method setString
- * @param {String} arg0
+ * @method didNotSelectSelf
*/
-setString : function (
-str
+didNotSelectSelf : function (
)
{
},
/**
- * @method getString
+ * @method getFontName
* @return {String}
*/
-getString : function (
+getFontName : function (
)
{
return ;
},
/**
- * @method create
-* @param {String} str
-* @param {String} str
-* @return {ccui.TextBMFont|ccui.TextBMFont}
-*/
-create : function(
-str,
-str
+ * @method setTextAreaSize
+ * @param {size_object} arg0
+ */
+setTextAreaSize : function (
+size
)
{
- return ccui.TextBMFont;
},
/**
- * @method createInstance
- * @return {cc.Ref}
+ * @method attachWithIME
*/
-createInstance : function (
+attachWithIME : function (
)
{
- return cc.Ref;
},
/**
- * @method TextBMFont
- * @constructor
+ * @method getStringLength
+ * @return {int}
*/
-TextBMFont : function (
+getStringLength : function (
)
{
+ return 0;
},
-};
-
-/**
- * @class PageView
- */
-ccui.PageView = {
-
/**
- * @method getCustomScrollThreshold
- * @return {float}
+ * @method getAutoRenderSize
+ * @return {size_object}
*/
-getCustomScrollThreshold : function (
+getAutoRenderSize : function (
)
{
- return 0;
+ return cc.Size;
},
/**
- * @method getCurPageIndex
- * @return {long}
+ * @method setPasswordEnabled
+ * @param {bool} arg0
*/
-getCurPageIndex : function (
+setPasswordEnabled : function (
+bool
)
{
- return 0;
},
/**
- * @method addWidgetToPage
- * @param {ccui.Widget} arg0
- * @param {long} arg1
- * @param {bool} arg2
+ * @method getPlaceHolderColor
+ * @return {color4b_object}
*/
-addWidgetToPage : function (
-widget,
-long,
-bool
+getPlaceHolderColor : function (
)
{
+ return cc.Color4B;
},
/**
- * @method isUsingCustomScrollThreshold
- * @return {bool}
+ * @method getPasswordStyleText
+ * @return {char}
*/
-isUsingCustomScrollThreshold : function (
+getPasswordStyleText : function (
)
{
- return false;
+ return 0;
},
/**
- * @method getPage
- * @param {long} arg0
- * @return {ccui.Layout}
+ * @method setMaxLengthEnabled
+ * @param {bool} arg0
*/
-getPage : function (
-long
+setMaxLengthEnabled : function (
+bool
)
{
- return ccui.Layout;
},
/**
- * @method removePage
- * @param {ccui.Layout} arg0
+ * @method isPasswordEnabled
+ * @return {bool}
*/
-removePage : function (
-layout
+isPasswordEnabled : function (
)
{
+ return false;
},
/**
- * @method setUsingCustomScrollThreshold
+ * @method setDeleteBackward
* @param {bool} arg0
*/
-setUsingCustomScrollThreshold : function (
+setDeleteBackward : function (
bool
)
{
},
/**
- * @method setCustomScrollThreshold
- * @param {float} arg0
+ * @method setFontSize
+ * @param {int} arg0
*/
-setCustomScrollThreshold : function (
-float
+setFontSize : function (
+int
)
{
},
/**
- * @method insertPage
- * @param {ccui.Layout} arg0
- * @param {int} arg1
+ * @method setPlaceHolder
+ * @param {String} arg0
*/
-insertPage : function (
-layout,
-int
+setPlaceHolder : function (
+str
)
{
},
/**
- * @method scrollToPage
- * @param {long} arg0
- */
-scrollToPage : function (
-long
+ * @method setPlaceHolderColor
+* @param {color4b_object|color3b_object} color4b
+*/
+setPlaceHolderColor : function(
+color3b
)
{
},
/**
- * @method removePageAtIndex
- * @param {long} arg0
+ * @method setTextHorizontalAlignment
+ * @param {cc.TextHAlignment} arg0
*/
-removePageAtIndex : function (
-long
+setTextHorizontalAlignment : function (
+texthalignment
)
{
},
/**
- * @method getPages
- * @return {Array}
+ * @method setTextColor
+ * @param {color4b_object} arg0
*/
-getPages : function (
+setTextColor : function (
+color4b
)
{
- return new Array();
},
/**
- * @method removeAllPages
+ * @method getMaxLength
+ * @return {int}
*/
-removeAllPages : function (
+getMaxLength : function (
)
{
+ return 0;
},
/**
- * @method addPage
- * @param {ccui.Layout} arg0
+ * @method isMaxLengthEnabled
+ * @return {bool}
*/
-addPage : function (
-layout
+isMaxLengthEnabled : function (
)
{
+ return false;
},
/**
- * @method create
- * @return {ccui.PageView}
+ * @method setDetachWithIME
+ * @param {bool} arg0
*/
-create : function (
+setDetachWithIME : function (
+bool
)
{
- return ccui.PageView;
},
/**
- * @method createInstance
- * @return {cc.Ref}
+ * @method setTouchAreaEnabled
+ * @param {bool} arg0
*/
-createInstance : function (
+setTouchAreaEnabled : function (
+bool
)
{
- return cc.Ref;
},
/**
- * @method PageView
- * @constructor
+ * @method setMaxLength
+ * @param {int} arg0
*/
-PageView : function (
+setMaxLength : function (
+int
)
{
},
-};
-
-/**
- * @class Helper
- */
-ccui.Helper = {
-
/**
- * @method getSubStringOfUTF8String
- * @param {String} arg0
- * @param {unsigned long} arg1
- * @param {unsigned long} arg2
- * @return {String}
+ * @method setTouchSize
+ * @param {size_object} arg0
*/
-getSubStringOfUTF8String : function (
-str,
-long,
-long
+setTouchSize : function (
+size
)
{
- return ;
},
/**
- * @method changeLayoutSystemActiveState
- * @param {bool} arg0
+ * @method getTouchSize
+ * @return {size_object}
*/
-changeLayoutSystemActiveState : function (
-bool
+getTouchSize : function (
)
{
+ return cc.Size;
},
/**
- * @method seekActionWidgetByActionTag
- * @param {ccui.Widget} arg0
- * @param {int} arg1
- * @return {ccui.Widget}
- */
-seekActionWidgetByActionTag : function (
-widget,
+ * @method create
+* @param {String} str
+* @param {String} str
+* @param {int} int
+* @return {ccui.TextField|ccui.TextField}
+*/
+create : function(
+str,
+str,
int
)
{
- return ccui.Widget;
-},
-
-/**
- * @method seekWidgetByName
- * @param {ccui.Widget} arg0
- * @param {String} arg1
- * @return {ccui.Widget}
- */
-seekWidgetByName : function (
-widget,
-str
-)
-{
- return ccui.Widget;
+ return ccui.TextField;
},
/**
- * @method seekWidgetByTag
- * @param {ccui.Widget} arg0
- * @param {int} arg1
- * @return {ccui.Widget}
+ * @method createInstance
+ * @return {cc.Ref}
*/
-seekWidgetByTag : function (
-widget,
-int
+createInstance : function (
)
{
- return ccui.Widget;
+ return cc.Ref;
},
/**
- * @method doLayout
- * @param {cc.Node} arg0
+ * @method TextField
+ * @constructor
*/
-doLayout : function (
-node
+TextField : function (
)
{
},
@@ -3937,91 +3970,79 @@ node
};
/**
- * @class RichElement
+ * @class TextBMFont
*/
-ccui.RichElement = {
+ccui.TextBMFont = {
/**
- * @method init
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @return {bool}
+ * @method setFntFile
+ * @param {String} arg0
*/
-init : function (
-int,
-color3b,
-char
+setFntFile : function (
+str
)
{
- return false;
},
/**
- * @method RichElement
- * @constructor
+ * @method getStringLength
+ * @return {long}
*/
-RichElement : function (
+getStringLength : function (
)
{
+ return 0;
},
-};
-
/**
- * @class RichElementText
+ * @method setString
+ * @param {String} arg0
*/
-ccui.RichElementText = {
+setString : function (
+str
+)
+{
+},
/**
- * @method init
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @param {String} arg3
- * @param {String} arg4
- * @param {float} arg5
- * @return {bool}
+ * @method getString
+ * @return {String}
*/
-init : function (
-int,
-color3b,
-char,
-str,
-str,
-float
+getString : function (
)
{
- return false;
+ return ;
},
/**
* @method create
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @param {String} arg3
- * @param {String} arg4
- * @param {float} arg5
- * @return {ccui.RichElementText}
+* @param {String} str
+* @param {String} str
+* @return {ccui.TextBMFont|ccui.TextBMFont}
+*/
+create : function(
+str,
+str
+)
+{
+ return ccui.TextBMFont;
+},
+
+/**
+ * @method createInstance
+ * @return {cc.Ref}
*/
-create : function (
-int,
-color3b,
-char,
-str,
-str,
-float
+createInstance : function (
)
{
- return ccui.RichElementText;
+ return cc.Ref;
},
/**
- * @method RichElementText
+ * @method TextBMFont
* @constructor
*/
-RichElementText : function (
+TextBMFont : function (
)
{
},
@@ -4029,103 +4050,1090 @@ RichElementText : function (
};
/**
- * @class RichElementImage
+ * @class PageView
*/
-ccui.RichElementImage = {
+ccui.PageView = {
/**
- * @method init
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @param {String} arg3
- * @return {bool}
+ * @method getCustomScrollThreshold
+ * @return {float}
*/
-init : function (
-int,
-color3b,
-char,
-str
+getCustomScrollThreshold : function (
)
{
- return false;
+ return 0;
},
/**
- * @method create
+ * @method getCurPageIndex
+ * @return {long}
+ */
+getCurPageIndex : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method addWidgetToPage
+ * @param {ccui.Widget} arg0
+ * @param {long} arg1
+ * @param {bool} arg2
+ */
+addWidgetToPage : function (
+widget,
+long,
+bool
+)
+{
+},
+
+/**
+ * @method isUsingCustomScrollThreshold
+ * @return {bool}
+ */
+isUsingCustomScrollThreshold : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method getPage
+ * @param {long} arg0
+ * @return {ccui.Layout}
+ */
+getPage : function (
+long
+)
+{
+ return ccui.Layout;
+},
+
+/**
+ * @method removePage
+ * @param {ccui.Layout} arg0
+ */
+removePage : function (
+layout
+)
+{
+},
+
+/**
+ * @method setUsingCustomScrollThreshold
+ * @param {bool} arg0
+ */
+setUsingCustomScrollThreshold : function (
+bool
+)
+{
+},
+
+/**
+ * @method setCustomScrollThreshold
+ * @param {float} arg0
+ */
+setCustomScrollThreshold : function (
+float
+)
+{
+},
+
+/**
+ * @method insertPage
+ * @param {ccui.Layout} arg0
+ * @param {int} arg1
+ */
+insertPage : function (
+layout,
+int
+)
+{
+},
+
+/**
+ * @method scrollToPage
+ * @param {long} arg0
+ */
+scrollToPage : function (
+long
+)
+{
+},
+
+/**
+ * @method removePageAtIndex
+ * @param {long} arg0
+ */
+removePageAtIndex : function (
+long
+)
+{
+},
+
+/**
+ * @method getPages
+ * @return {Array}
+ */
+getPages : function (
+)
+{
+ return new Array();
+},
+
+/**
+ * @method removeAllPages
+ */
+removeAllPages : function (
+)
+{
+},
+
+/**
+ * @method addPage
+ * @param {ccui.Layout} arg0
+ */
+addPage : function (
+layout
+)
+{
+},
+
+/**
+ * @method create
+ * @return {ccui.PageView}
+ */
+create : function (
+)
+{
+ return ccui.PageView;
+},
+
+/**
+ * @method createInstance
+ * @return {cc.Ref}
+ */
+createInstance : function (
+)
+{
+ return cc.Ref;
+},
+
+/**
+ * @method PageView
+ * @constructor
+ */
+PageView : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Helper
+ */
+ccui.Helper = {
+
+/**
+ * @method getSubStringOfUTF8String
+ * @param {String} arg0
+ * @param {unsigned long} arg1
+ * @param {unsigned long} arg2
+ * @return {String}
+ */
+getSubStringOfUTF8String : function (
+str,
+long,
+long
+)
+{
+ return ;
+},
+
+/**
+ * @method changeLayoutSystemActiveState
+ * @param {bool} arg0
+ */
+changeLayoutSystemActiveState : function (
+bool
+)
+{
+},
+
+/**
+ * @method seekActionWidgetByActionTag
+ * @param {ccui.Widget} arg0
+ * @param {int} arg1
+ * @return {ccui.Widget}
+ */
+seekActionWidgetByActionTag : function (
+widget,
+int
+)
+{
+ return ccui.Widget;
+},
+
+/**
+ * @method seekWidgetByName
+ * @param {ccui.Widget} arg0
+ * @param {String} arg1
+ * @return {ccui.Widget}
+ */
+seekWidgetByName : function (
+widget,
+str
+)
+{
+ return ccui.Widget;
+},
+
+/**
+ * @method seekWidgetByTag
+ * @param {ccui.Widget} arg0
+ * @param {int} arg1
+ * @return {ccui.Widget}
+ */
+seekWidgetByTag : function (
+widget,
+int
+)
+{
+ return ccui.Widget;
+},
+
+/**
+ * @method restrictCapInsetRect
+ * @param {rect_object} arg0
+ * @param {size_object} arg1
+ * @return {rect_object}
+ */
+restrictCapInsetRect : function (
+rect,
+size
+)
+{
+ return cc.Rect;
+},
+
+/**
+ * @method doLayout
+ * @param {cc.Node} arg0
+ */
+doLayout : function (
+node
+)
+{
+},
+
+};
+
+/**
+ * @class RichElement
+ */
+ccui.RichElement = {
+
+/**
+ * @method init
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @return {bool}
+ */
+init : function (
+int,
+color3b,
+char
+)
+{
+ return false;
+},
+
+/**
+ * @method RichElement
+ * @constructor
+ */
+RichElement : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RichElementText
+ */
+ccui.RichElementText = {
+
+/**
+ * @method init
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @param {String} arg3
+ * @param {String} arg4
+ * @param {float} arg5
+ * @return {bool}
+ */
+init : function (
+int,
+color3b,
+char,
+str,
+str,
+float
+)
+{
+ return false;
+},
+
+/**
+ * @method create
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @param {String} arg3
+ * @param {String} arg4
+ * @param {float} arg5
+ * @return {ccui.RichElementText}
+ */
+create : function (
+int,
+color3b,
+char,
+str,
+str,
+float
+)
+{
+ return ccui.RichElementText;
+},
+
+/**
+ * @method RichElementText
+ * @constructor
+ */
+RichElementText : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RichElementImage
+ */
+ccui.RichElementImage = {
+
+/**
+ * @method init
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @param {String} arg3
+ * @return {bool}
+ */
+init : function (
+int,
+color3b,
+char,
+str
+)
+{
+ return false;
+},
+
+/**
+ * @method create
* @param {int} arg0
* @param {color3b_object} arg1
* @param {unsigned char} arg2
* @param {String} arg3
* @return {ccui.RichElementImage}
*/
-create : function (
-int,
-color3b,
-char,
-str
+create : function (
+int,
+color3b,
+char,
+str
+)
+{
+ return ccui.RichElementImage;
+},
+
+/**
+ * @method RichElementImage
+ * @constructor
+ */
+RichElementImage : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RichElementCustomNode
+ */
+ccui.RichElementCustomNode = {
+
+/**
+ * @method init
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @param {cc.Node} arg3
+ * @return {bool}
+ */
+init : function (
+int,
+color3b,
+char,
+node
+)
+{
+ return false;
+},
+
+/**
+ * @method create
+ * @param {int} arg0
+ * @param {color3b_object} arg1
+ * @param {unsigned char} arg2
+ * @param {cc.Node} arg3
+ * @return {ccui.RichElementCustomNode}
+ */
+create : function (
+int,
+color3b,
+char,
+node
+)
+{
+ return ccui.RichElementCustomNode;
+},
+
+/**
+ * @method RichElementCustomNode
+ * @constructor
+ */
+RichElementCustomNode : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RichText
+ */
+ccui.RichText = {
+
+/**
+ * @method insertElement
+ * @param {ccui.RichElement} arg0
+ * @param {int} arg1
+ */
+insertElement : function (
+richelement,
+int
+)
+{
+},
+
+/**
+ * @method pushBackElement
+ * @param {ccui.RichElement} arg0
+ */
+pushBackElement : function (
+richelement
+)
+{
+},
+
+/**
+ * @method setVerticalSpace
+ * @param {float} arg0
+ */
+setVerticalSpace : function (
+float
+)
+{
+},
+
+/**
+ * @method formatText
+ */
+formatText : function (
+)
+{
+},
+
+/**
+ * @method removeElement
+* @param {ccui.RichElement|int} richelement
+*/
+removeElement : function(
+int
+)
+{
+},
+
+/**
+ * @method create
+ * @return {ccui.RichText}
+ */
+create : function (
+)
+{
+ return ccui.RichText;
+},
+
+/**
+ * @method RichText
+ * @constructor
+ */
+RichText : function (
+)
+{
+},
+
+};
+
+/**
+ * @class HBox
+ */
+ccui.HBox = {
+
+/**
+ * @method initWithSize
+ * @param {size_object} arg0
+ * @return {bool}
+ */
+initWithSize : function (
+size
+)
+{
+ return false;
+},
+
+/**
+ * @method create
+* @param {size_object} size
+* @return {ccui.HBox|ccui.HBox}
+*/
+create : function(
+size
+)
+{
+ return ccui.HBox;
+},
+
+/**
+ * @method HBox
+ * @constructor
+ */
+HBox : function (
+)
+{
+},
+
+};
+
+/**
+ * @class VBox
+ */
+ccui.VBox = {
+
+/**
+ * @method initWithSize
+ * @param {size_object} arg0
+ * @return {bool}
+ */
+initWithSize : function (
+size
+)
+{
+ return false;
+},
+
+/**
+ * @method create
+* @param {size_object} size
+* @return {ccui.VBox|ccui.VBox}
+*/
+create : function(
+size
+)
+{
+ return ccui.VBox;
+},
+
+/**
+ * @method VBox
+ * @constructor
+ */
+VBox : function (
+)
+{
+},
+
+};
+
+/**
+ * @class RelativeBox
+ */
+ccui.RelativeBox = {
+
+/**
+ * @method initWithSize
+ * @param {size_object} arg0
+ * @return {bool}
+ */
+initWithSize : function (
+size
+)
+{
+ return false;
+},
+
+/**
+ * @method create
+* @param {size_object} size
+* @return {ccui.RelativeBox|ccui.RelativeBox}
+*/
+create : function(
+size
+)
+{
+ return ccui.RelativeBox;
+},
+
+/**
+ * @method RelativeBox
+ * @constructor
+ */
+RelativeBox : function (
+)
+{
+},
+
+};
+
+/**
+ * @class Scale9Sprite
+ */
+ccui.Scale9Sprite = {
+
+/**
+ * @method disableCascadeColor
+ */
+disableCascadeColor : function (
+)
+{
+},
+
+/**
+ * @method updateWithSprite
+* @param {cc.Sprite|cc.Sprite} sprite
+* @param {rect_object|rect_object} rect
+* @param {bool|bool} bool
+* @param {vec2_object|rect_object} vec2
+* @param {size_object} size
+* @param {rect_object} rect
+* @return {bool|bool}
+*/
+updateWithSprite : function(
+sprite,
+rect,
+bool,
+vec2,
+size,
+rect
+)
+{
+ return false;
+},
+
+/**
+ * @method isFlippedX
+ * @return {bool}
+ */
+isFlippedX : function (
+)
+{
+ return false;
+},
+
+/**
+ * @method setScale9Enabled
+ * @param {bool} arg0
+ */
+setScale9Enabled : function (
+bool
+)
+{
+},
+
+/**
+ * @method setFlippedY
+ * @param {bool} arg0
+ */
+setFlippedY : function (
+bool
+)
+{
+},
+
+/**
+ * @method setFlippedX
+ * @param {bool} arg0
+ */
+setFlippedX : function (
+bool
+)
+{
+},
+
+/**
+ * @method resizableSpriteWithCapInsets
+ * @param {rect_object} arg0
+ * @return {ccui.Scale9Sprite}
+ */
+resizableSpriteWithCapInsets : function (
+rect
+)
+{
+ return ccui.Scale9Sprite;
+},
+
+/**
+ * @method disableCascadeOpacity
+ */
+disableCascadeOpacity : function (
+)
+{
+},
+
+/**
+ * @method setState
+ * @param {ccui.Scale9Sprite::State} arg0
+ */
+setState : function (
+state
+)
+{
+},
+
+/**
+ * @method setInsetBottom
+ * @param {float} arg0
+ */
+setInsetBottom : function (
+float
+)
+{
+},
+
+/**
+ * @method initWithSpriteFrameName
+* @param {String|String} str
+* @param {rect_object} rect
+* @return {bool|bool}
+*/
+initWithSpriteFrameName : function(
+str,
+rect
+)
+{
+ return false;
+},
+
+/**
+ * @method getSprite
+ * @return {cc.Sprite}
+ */
+getSprite : function (
+)
+{
+ return cc.Sprite;
+},
+
+/**
+ * @method setInsetTop
+ * @param {float} arg0
+ */
+setInsetTop : function (
+float
+)
+{
+},
+
+/**
+ * @method init
+* @param {cc.Sprite|cc.Sprite|cc.Sprite} sprite
+* @param {rect_object|rect_object|rect_object} rect
+* @param {rect_object|bool|bool} rect
+* @param {rect_object|vec2_object} rect
+* @param {size_object} size
+* @param {rect_object} rect
+* @return {bool|bool|bool}
+*/
+init : function(
+sprite,
+rect,
+bool,
+vec2,
+size,
+rect
+)
+{
+ return false;
+},
+
+/**
+ * @method setPreferredSize
+ * @param {size_object} arg0
+ */
+setPreferredSize : function (
+size
+)
+{
+},
+
+/**
+ * @method setSpriteFrame
+ * @param {cc.SpriteFrame} arg0
+ * @param {rect_object} arg1
+ */
+setSpriteFrame : function (
+spriteframe,
+rect
+)
+{
+},
+
+/**
+ * @method getBlendFunc
+ * @return {cc.BlendFunc}
+ */
+getBlendFunc : function (
+)
+{
+ return cc.BlendFunc;
+},
+
+/**
+ * @method getInsetBottom
+ * @return {float}
+ */
+getInsetBottom : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method getCapInsets
+ * @return {rect_object}
+ */
+getCapInsets : function (
)
{
- return ccui.RichElementImage;
+ return cc.Rect;
},
/**
- * @method RichElementImage
- * @constructor
+ * @method isScale9Enabled
+ * @return {bool}
*/
-RichElementImage : function (
+isScale9Enabled : function (
)
{
+ return false;
},
-};
+/**
+ * @method getInsetRight
+ * @return {float}
+ */
+getInsetRight : function (
+)
+{
+ return 0;
+},
/**
- * @class RichElementCustomNode
+ * @method getOriginalSize
+ * @return {size_object}
*/
-ccui.RichElementCustomNode = {
+getOriginalSize : function (
+)
+{
+ return cc.Size;
+},
/**
- * @method init
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @param {cc.Node} arg3
+ * @method initWithFile
+* @param {String|String|rect_object|String} str
+* @param {rect_object|rect_object|String} rect
+* @param {rect_object} rect
+* @return {bool|bool|bool|bool}
+*/
+initWithFile : function(
+str,
+rect,
+rect
+)
+{
+ return false;
+},
+
+/**
+ * @method setBlendFunc
+ * @param {cc.BlendFunc} arg0
+ */
+setBlendFunc : function (
+blendfunc
+)
+{
+},
+
+/**
+ * @method getInsetTop
+ * @return {float}
+ */
+getInsetTop : function (
+)
+{
+ return 0;
+},
+
+/**
+ * @method setInsetLeft
+ * @param {float} arg0
+ */
+setInsetLeft : function (
+float
+)
+{
+},
+
+/**
+ * @method initWithSpriteFrame
+* @param {cc.SpriteFrame|cc.SpriteFrame} spriteframe
+* @param {rect_object} rect
+* @return {bool|bool}
+*/
+initWithSpriteFrame : function(
+spriteframe,
+rect
+)
+{
+ return false;
+},
+
+/**
+ * @method getPreferredSize
+ * @return {size_object}
+ */
+getPreferredSize : function (
+)
+{
+ return cc.Size;
+},
+
+/**
+ * @method setCapInsets
+ * @param {rect_object} arg0
+ */
+setCapInsets : function (
+rect
+)
+{
+},
+
+/**
+ * @method isFlippedY
* @return {bool}
*/
-init : function (
-int,
-color3b,
-char,
-node
+isFlippedY : function (
)
{
return false;
},
/**
- * @method create
- * @param {int} arg0
- * @param {color3b_object} arg1
- * @param {unsigned char} arg2
- * @param {cc.Node} arg3
- * @return {ccui.RichElementCustomNode}
+ * @method getInsetLeft
+ * @return {float}
*/
-create : function (
-int,
-color3b,
-char,
-node
+getInsetLeft : function (
)
{
- return ccui.RichElementCustomNode;
+ return 0;
},
/**
- * @method RichElementCustomNode
+ * @method setInsetRight
+ * @param {float} arg0
+ */
+setInsetRight : function (
+float
+)
+{
+},
+
+/**
+ * @method create
+* @param {String|rect_object|String|String} str
+* @param {rect_object|String|rect_object} rect
+* @param {rect_object} rect
+* @return {ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite}
+*/
+create : function(
+str,
+rect,
+rect
+)
+{
+ return ccui.Scale9Sprite;
+},
+
+/**
+ * @method createWithSpriteFrameName
+* @param {String|String} str
+* @param {rect_object} rect
+* @return {ccui.Scale9Sprite|ccui.Scale9Sprite}
+*/
+createWithSpriteFrameName : function(
+str,
+rect
+)
+{
+ return ccui.Scale9Sprite;
+},
+
+/**
+ * @method createWithSpriteFrame
+* @param {cc.SpriteFrame|cc.SpriteFrame} spriteframe
+* @param {rect_object} rect
+* @return {ccui.Scale9Sprite|ccui.Scale9Sprite}
+*/
+createWithSpriteFrame : function(
+spriteframe,
+rect
+)
+{
+ return ccui.Scale9Sprite;
+},
+
+/**
+ * @method Scale9Sprite
* @constructor
*/
-RichElementCustomNode : function (
+Scale9Sprite : function (
)
{
},
@@ -4133,215 +5141,223 @@ RichElementCustomNode : function (
};
/**
- * @class RichText
+ * @class EditBox
*/
-ccui.RichText = {
+ccui.EditBox = {
/**
- * @method insertElement
- * @param {ccui.RichElement} arg0
- * @param {int} arg1
+ * @method getText
+ * @return {char}
*/
-insertElement : function (
-richelement,
-int
+getText : function (
)
{
+ return 0;
},
/**
- * @method setAnchorPoint
- * @param {vec2_object} arg0
+ * @method setFontSize
+ * @param {int} arg0
*/
-setAnchorPoint : function (
-vec2
+setFontSize : function (
+int
)
{
},
/**
- * @method pushBackElement
- * @param {ccui.RichElement} arg0
+ * @method setPlaceholderFontName
+ * @param {char} arg0
*/
-pushBackElement : function (
-richelement
+setPlaceholderFontName : function (
+char
)
{
},
/**
- * @method ignoreContentAdaptWithSize
- * @param {bool} arg0
+ * @method getPlaceHolder
+ * @return {char}
*/
-ignoreContentAdaptWithSize : function (
-bool
+getPlaceHolder : function (
)
{
+ return 0;
},
/**
- * @method setVerticalSpace
- * @param {float} arg0
+ * @method setFontName
+ * @param {char} arg0
*/
-setVerticalSpace : function (
-float
+setFontName : function (
+char
)
{
},
/**
- * @method formatText
+ * @method setText
+ * @param {char} arg0
*/
-formatText : function (
+setText : function (
+char
)
{
},
/**
- * @method removeElement
-* @param {ccui.RichElement|int} richelement
-*/
-removeElement : function(
+ * @method setPlaceholderFontSize
+ * @param {int} arg0
+ */
+setPlaceholderFontSize : function (
int
)
{
},
/**
- * @method create
- * @return {ccui.RichText}
+ * @method setInputMode
+ * @param {ccui.EditBox::InputMode} arg0
*/
-create : function (
+setInputMode : function (
+inputmode
)
{
- return ccui.RichText;
},
/**
- * @method RichText
- * @constructor
- */
-RichText : function (
+ * @method setPlaceholderFontColor
+* @param {color4b_object|color3b_object} color4b
+*/
+setPlaceholderFontColor : function(
+color3b
)
{
},
-};
-
/**
- * @class HBox
- */
-ccui.HBox = {
+ * @method setFontColor
+* @param {color4b_object|color3b_object} color4b
+*/
+setFontColor : function(
+color3b
+)
+{
+},
/**
- * @method initWithSize
- * @param {size_object} arg0
- * @return {bool}
+ * @method setPlaceholderFont
+ * @param {char} arg0
+ * @param {int} arg1
*/
-initWithSize : function (
-size
+setPlaceholderFont : function (
+char,
+int
)
{
- return false;
},
/**
- * @method create
-* @param {size_object} size
-* @return {ccui.HBox|ccui.HBox}
+ * @method initWithSizeAndBackgroundSprite
+* @param {size_object|size_object} size
+* @param {ccui.Scale9Sprite|String} scale9sprite
+* @param {ccui.Widget::TextureResType} texturerestype
+* @return {bool|bool}
*/
-create : function(
-size
+initWithSizeAndBackgroundSprite : function(
+size,
+str,
+texturerestype
)
{
- return ccui.HBox;
+ return false;
},
/**
- * @method HBox
- * @constructor
+ * @method setPlaceHolder
+ * @param {char} arg0
*/
-HBox : function (
+setPlaceHolder : function (
+char
)
{
},
-};
-
-/**
- * @class VBox
- */
-ccui.VBox = {
-
/**
- * @method initWithSize
- * @param {size_object} arg0
- * @return {bool}
+ * @method setReturnType
+ * @param {ccui.EditBox::KeyboardReturnType} arg0
*/
-initWithSize : function (
-size
+setReturnType : function (
+keyboardreturntype
)
{
- return false;
},
/**
- * @method create
-* @param {size_object} size
-* @return {ccui.VBox|ccui.VBox}
-*/
-create : function(
-size
+ * @method setInputFlag
+ * @param {ccui.EditBox::InputFlag} arg0
+ */
+setInputFlag : function (
+inputflag
)
{
- return ccui.VBox;
},
/**
- * @method VBox
- * @constructor
+ * @method getMaxLength
+ * @return {int}
*/
-VBox : function (
+getMaxLength : function (
)
{
+ return 0;
},
-};
-
/**
- * @class RelativeBox
+ * @method setMaxLength
+ * @param {int} arg0
*/
-ccui.RelativeBox = {
+setMaxLength : function (
+int
+)
+{
+},
/**
- * @method initWithSize
- * @param {size_object} arg0
- * @return {bool}
+ * @method setFont
+ * @param {char} arg0
+ * @param {int} arg1
*/
-initWithSize : function (
-size
+setFont : function (
+char,
+int
)
{
- return false;
},
/**
* @method create
-* @param {size_object} size
-* @return {ccui.RelativeBox|ccui.RelativeBox}
+* @param {size_object|size_object} size
+* @param {String|ccui.Scale9Sprite} str
+* @param {ccui.Widget::TextureResType|ccui.Scale9Sprite} texturerestype
+* @param {ccui.Scale9Sprite} scale9sprite
+* @return {ccui.EditBox|ccui.EditBox}
*/
create : function(
-size
+size,
+scale9sprite,
+scale9sprite,
+scale9sprite
)
{
- return ccui.RelativeBox;
+ return ccui.EditBox;
},
/**
- * @method RelativeBox
+ * @method EditBox
* @constructor
*/
-RelativeBox : function (
+EditBox : function (
)
{
},
@@ -4349,611 +5365,525 @@ RelativeBox : function (
};
/**
- * @class Scale9Sprite
+ * @class LayoutComponent
*/
-ccui.Scale9Sprite = {
+ccui.LayoutComponent = {
/**
- * @method disableCascadeColor
+ * @method setStretchWidthEnabled
+ * @param {bool} arg0
*/
-disableCascadeColor : function (
+setStretchWidthEnabled : function (
+bool
)
{
},
/**
- * @method updateWithSprite
-* @param {cc.Sprite|cc.Sprite} sprite
-* @param {rect_object|rect_object} rect
-* @param {bool|bool} bool
-* @param {vec2_object|rect_object} vec2
-* @param {size_object} size
-* @param {rect_object} rect
-* @return {bool|bool}
-*/
-updateWithSprite : function(
-sprite,
-rect,
-bool,
-vec2,
-size,
-rect
+ * @method setPercentWidth
+ * @param {float} arg0
+ */
+setPercentWidth : function (
+float
)
{
- return false;
},
/**
- * @method isFlippedX
- * @return {bool}
+ * @method getAnchorPosition
+ * @return {vec2_object}
*/
-isFlippedX : function (
+getAnchorPosition : function (
)
{
- return false;
+ return cc.Vec2;
},
/**
- * @method setFlippedY
+ * @method setPositionPercentXEnabled
* @param {bool} arg0
*/
-setFlippedY : function (
+setPositionPercentXEnabled : function (
bool
)
{
},
/**
- * @method setFlippedX
+ * @method setStretchHeightEnabled
* @param {bool} arg0
*/
-setFlippedX : function (
+setStretchHeightEnabled : function (
bool
)
{
},
/**
- * @method setScale9Enabled
+ * @method setActiveEnabled
* @param {bool} arg0
*/
-setScale9Enabled : function (
+setActiveEnabled : function (
bool
)
{
},
/**
- * @method disableCascadeOpacity
+ * @method getRightMargin
+ * @return {float}
*/
-disableCascadeOpacity : function (
+getRightMargin : function (
)
{
+ return 0;
},
/**
- * @method setInsetBottom
- * @param {float} arg0
+ * @method getSize
+ * @return {size_object}
*/
-setInsetBottom : function (
-float
+getSize : function (
)
{
+ return cc.Size;
},
/**
- * @method initWithSpriteFrameName
-* @param {String|String} str
-* @param {rect_object} rect
-* @return {bool|bool}
-*/
-initWithSpriteFrameName : function(
-str,
-rect
+ * @method setAnchorPosition
+ * @param {vec2_object} arg0
+ */
+setAnchorPosition : function (
+vec2
)
{
- return false;
},
/**
- * @method getSprite
- * @return {cc.Sprite}
+ * @method refreshLayout
*/
-getSprite : function (
+refreshLayout : function (
)
{
- return cc.Sprite;
},
/**
- * @method setInsetTop
- * @param {float} arg0
+ * @method isPercentWidthEnabled
+ * @return {bool}
*/
-setInsetTop : function (
-float
+isPercentWidthEnabled : function (
)
{
+ return false;
},
/**
- * @method init
-* @param {cc.Sprite|cc.Sprite|cc.Sprite} sprite
-* @param {rect_object|rect_object|rect_object} rect
-* @param {bool|rect_object|bool} bool
-* @param {rect_object|vec2_object} rect
-* @param {size_object} size
-* @param {rect_object} rect
-* @return {bool|bool|bool|bool}
-*/
-init : function(
-sprite,
-rect,
-bool,
-vec2,
-size,
-rect
+ * @method setVerticalEdge
+ * @param {ccui.LayoutComponent::VerticalEdge} arg0
+ */
+setVerticalEdge : function (
+verticaledge
)
{
- return false;
},
/**
- * @method setPreferredSize
- * @param {size_object} arg0
+ * @method getTopMargin
+ * @return {float}
*/
-setPreferredSize : function (
-size
+getTopMargin : function (
)
{
+ return 0;
},
/**
- * @method getInsetRight
- * @return {float}
+ * @method setSizeWidth
+ * @param {float} arg0
*/
-getInsetRight : function (
+setSizeWidth : function (
+float
)
{
- return 0;
},
/**
- * @method setSpriteFrame
- * @param {cc.SpriteFrame} arg0
- * @param {rect_object} arg1
+ * @method getPercentContentSize
+ * @return {vec2_object}
*/
-setSpriteFrame : function (
-spriteframe,
-rect
+getPercentContentSize : function (
)
{
+ return cc.Vec2;
},
/**
- * @method getInsetBottom
- * @return {float}
+ * @method getVerticalEdge
+ * @return {ccui.LayoutComponent::VerticalEdge}
*/
-getInsetBottom : function (
+getVerticalEdge : function (
)
{
return 0;
},
/**
- * @method resizableSpriteWithCapInsets
- * @param {rect_object} arg0
- * @return {ccui.Scale9Sprite}
+ * @method setPercentWidthEnabled
+ * @param {bool} arg0
*/
-resizableSpriteWithCapInsets : function (
-rect
+setPercentWidthEnabled : function (
+bool
)
{
- return ccui.Scale9Sprite;
},
/**
- * @method isScale9Enabled
+ * @method isStretchWidthEnabled
* @return {bool}
*/
-isScale9Enabled : function (
+isStretchWidthEnabled : function (
)
{
return false;
},
/**
- * @method getCapInsets
- * @return {rect_object}
+ * @method setLeftMargin
+ * @param {float} arg0
*/
-getCapInsets : function (
+setLeftMargin : function (
+float
)
{
- return cc.Rect;
},
/**
- * @method getOriginalSize
- * @return {size_object}
+ * @method getSizeWidth
+ * @return {float}
*/
-getOriginalSize : function (
+getSizeWidth : function (
)
{
- return cc.Size;
+ return 0;
},
/**
- * @method initWithFile
-* @param {String|String|rect_object|String} str
-* @param {rect_object|rect_object|String} rect
-* @param {rect_object} rect
-* @return {bool|bool|bool|bool}
-*/
-initWithFile : function(
-str,
-rect,
-rect
+ * @method setPositionPercentYEnabled
+ * @param {bool} arg0
+ */
+setPositionPercentYEnabled : function (
+bool
)
{
- return false;
},
/**
- * @method getInsetTop
+ * @method getSizeHeight
* @return {float}
*/
-getInsetTop : function (
+getSizeHeight : function (
)
{
return 0;
},
/**
- * @method setInsetLeft
- * @param {float} arg0
+ * @method getPositionPercentY
+ * @return {float}
*/
-setInsetLeft : function (
-float
+getPositionPercentY : function (
)
{
+ return 0;
},
/**
- * @method initWithSpriteFrame
-* @param {cc.SpriteFrame|cc.SpriteFrame} spriteframe
-* @param {rect_object} rect
-* @return {bool|bool}
-*/
-initWithSpriteFrame : function(
-spriteframe,
-rect
+ * @method getPositionPercentX
+ * @return {float}
+ */
+getPositionPercentX : function (
)
{
- return false;
+ return 0;
},
/**
- * @method getPreferredSize
- * @return {size_object}
+ * @method setTopMargin
+ * @param {float} arg0
*/
-getPreferredSize : function (
+setTopMargin : function (
+float
)
{
- return cc.Size;
},
/**
- * @method setCapInsets
- * @param {rect_object} arg0
+ * @method getPercentHeight
+ * @return {float}
*/
-setCapInsets : function (
-rect
+getPercentHeight : function (
)
{
+ return 0;
},
/**
- * @method isFlippedY
+ * @method getUsingPercentContentSize
* @return {bool}
*/
-isFlippedY : function (
+getUsingPercentContentSize : function (
)
{
return false;
},
/**
- * @method getInsetLeft
- * @return {float}
+ * @method setPositionPercentY
+ * @param {float} arg0
*/
-getInsetLeft : function (
+setPositionPercentY : function (
+float
)
{
- return 0;
},
/**
- * @method setInsetRight
+ * @method setPositionPercentX
* @param {float} arg0
*/
-setInsetRight : function (
+setPositionPercentX : function (
float
)
{
},
/**
- * @method create
-* @param {String|rect_object|String|String} str
-* @param {rect_object|String|rect_object} rect
-* @param {rect_object} rect
-* @return {ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite|ccui.Scale9Sprite}
-*/
-create : function(
-str,
-rect,
-rect
+ * @method setRightMargin
+ * @param {float} arg0
+ */
+setRightMargin : function (
+float
)
{
- return ccui.Scale9Sprite;
},
/**
- * @method createWithSpriteFrameName
-* @param {String|String} str
-* @param {rect_object} rect
-* @return {ccui.Scale9Sprite|ccui.Scale9Sprite}
-*/
-createWithSpriteFrameName : function(
-str,
-rect
+ * @method isPositionPercentYEnabled
+ * @return {bool}
+ */
+isPositionPercentYEnabled : function (
)
{
- return ccui.Scale9Sprite;
+ return false;
},
/**
- * @method createWithSpriteFrame
-* @param {cc.SpriteFrame|cc.SpriteFrame} spriteframe
-* @param {rect_object} rect
-* @return {ccui.Scale9Sprite|ccui.Scale9Sprite}
-*/
-createWithSpriteFrame : function(
-spriteframe,
-rect
+ * @method setPercentHeight
+ * @param {float} arg0
+ */
+setPercentHeight : function (
+float
)
{
- return ccui.Scale9Sprite;
},
/**
- * @method Scale9Sprite
- * @constructor
+ * @method setPercentOnlyEnabled
+ * @param {bool} arg0
*/
-Scale9Sprite : function (
+setPercentOnlyEnabled : function (
+bool
)
{
},
-};
-
/**
- * @class EditBox
- */
-ccui.EditBox = {
-
-/**
- * @method getText
- * @return {char}
+ * @method setHorizontalEdge
+ * @param {ccui.LayoutComponent::HorizontalEdge} arg0
*/
-getText : function (
+setHorizontalEdge : function (
+horizontaledge
)
{
- return 0;
},
/**
- * @method setFontSize
- * @param {int} arg0
+ * @method setPosition
+ * @param {vec2_object} arg0
*/
-setFontSize : function (
-int
+setPosition : function (
+vec2
)
{
},
/**
- * @method setPlaceholderFontName
- * @param {char} arg0
+ * @method setUsingPercentContentSize
+ * @param {bool} arg0
*/
-setPlaceholderFontName : function (
-char
+setUsingPercentContentSize : function (
+bool
)
{
},
/**
- * @method getPlaceHolder
- * @return {char}
+ * @method getLeftMargin
+ * @return {float}
*/
-getPlaceHolder : function (
+getLeftMargin : function (
)
{
return 0;
},
/**
- * @method setFontName
- * @param {char} arg0
+ * @method getPosition
+ * @return {vec2_object}
*/
-setFontName : function (
-char
+getPosition : function (
)
{
+ return cc.Vec2;
},
/**
- * @method setText
- * @param {char} arg0
+ * @method setSizeHeight
+ * @param {float} arg0
*/
-setText : function (
-char
+setSizeHeight : function (
+float
)
{
},
/**
- * @method setPlaceholderFontSize
- * @param {int} arg0
+ * @method isPositionPercentXEnabled
+ * @return {bool}
*/
-setPlaceholderFontSize : function (
-int
+isPositionPercentXEnabled : function (
)
{
+ return false;
},
/**
- * @method setInputMode
- * @param {ccui.EditBox::InputMode} arg0
+ * @method getBottomMargin
+ * @return {float}
*/
-setInputMode : function (
-inputmode
+getBottomMargin : function (
)
{
+ return 0;
},
/**
- * @method setPlaceholderFontColor
- * @param {color3b_object} arg0
+ * @method setPercentHeightEnabled
+ * @param {bool} arg0
*/
-setPlaceholderFontColor : function (
-color3b
+setPercentHeightEnabled : function (
+bool
)
{
},
/**
- * @method setFontColor
- * @param {color3b_object} arg0
+ * @method setPercentContentSize
+ * @param {vec2_object} arg0
*/
-setFontColor : function (
-color3b
+setPercentContentSize : function (
+vec2
)
{
},
/**
- * @method setPlaceholderFont
- * @param {char} arg0
- * @param {int} arg1
+ * @method isPercentHeightEnabled
+ * @return {bool}
*/
-setPlaceholderFont : function (
-char,
-int
-)
-{
-},
-
-/**
- * @method initWithSizeAndBackgroundSprite
-* @param {size_object|size_object} size
-* @param {ccui.Scale9Sprite|String} scale9sprite
-* @param {ccui.Widget::TextureResType} texturerestype
-* @return {bool|bool}
-*/
-initWithSizeAndBackgroundSprite : function(
-size,
-str,
-texturerestype
+isPercentHeightEnabled : function (
)
{
return false;
},
/**
- * @method setPlaceHolder
- * @param {char} arg0
+ * @method getPercentWidth
+ * @return {float}
*/
-setPlaceHolder : function (
-char
+getPercentWidth : function (
)
{
+ return 0;
},
/**
- * @method setReturnType
- * @param {ccui.EditBox::KeyboardReturnType} arg0
+ * @method getHorizontalEdge
+ * @return {ccui.LayoutComponent::HorizontalEdge}
*/
-setReturnType : function (
-keyboardreturntype
+getHorizontalEdge : function (
)
{
+ return 0;
},
/**
- * @method setInputFlag
- * @param {ccui.EditBox::InputFlag} arg0
+ * @method isStretchHeightEnabled
+ * @return {bool}
*/
-setInputFlag : function (
-inputflag
+isStretchHeightEnabled : function (
)
{
+ return false;
},
/**
- * @method getMaxLength
- * @return {int}
+ * @method setBottomMargin
+ * @param {float} arg0
*/
-getMaxLength : function (
+setBottomMargin : function (
+float
)
{
- return 0;
},
/**
- * @method setMaxLength
- * @param {int} arg0
+ * @method setSize
+ * @param {size_object} arg0
*/
-setMaxLength : function (
-int
+setSize : function (
+size
)
{
},
/**
- * @method setFont
- * @param {char} arg0
- * @param {int} arg1
+ * @method create
+ * @return {ccui.LayoutComponent}
*/
-setFont : function (
-char,
-int
+create : function (
)
{
+ return ccui.LayoutComponent;
},
/**
- * @method create
-* @param {size_object|size_object} size
-* @param {String|ccui.Scale9Sprite} str
-* @param {ccui.Widget::TextureResType|ccui.Scale9Sprite} texturerestype
-* @param {ccui.Scale9Sprite} scale9sprite
-* @return {ccui.EditBox|ccui.EditBox}
-*/
-create : function(
-size,
-scale9sprite,
-scale9sprite,
-scale9sprite
+ * @method bindLayoutComponent
+ * @param {cc.Node} arg0
+ * @return {ccui.LayoutComponent}
+ */
+bindLayoutComponent : function (
+node
)
{
- return ccui.EditBox;
+ return ccui.LayoutComponent;
},
/**
- * @method EditBox
+ * @method LayoutComponent
* @constructor
*/
-EditBox : function (
+LayoutComponent : function (
)
{
},
diff --git a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.cpp b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.cpp
new file mode 100644
index 0000000000..4ca9eedcc6
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.cpp
@@ -0,0 +1,3229 @@
+#include "jsb_cocos2dx_3d_auto.hpp"
+#include "cocos2d_specifics.hpp"
+#include "cocos2d.h"
+
+template
+static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedValue initializing(cx);
+ bool isNewValid = true;
+ JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject());
+ isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && initializing.toBoolean();
+ if (isNewValid)
+ {
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject _tmp(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+
+ args.rval().set(OBJECT_TO_JSVAL(_tmp));
+ return true;
+ }
+
+ JS_ReportError(cx, "Constructor for the requested class is not available, please refer to the API reference.");
+ return false;
+}
+
+static bool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
+ return false;
+}
+
+static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ args.rval().setBoolean(true);
+ return true;
+}
+JSClass *jsb_cocos2d_Skeleton3D_class;
+JSObject *jsb_cocos2d_Skeleton3D_prototype;
+
+bool js_cocos2dx_3d_Skeleton3D_removeAllBones(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_removeAllBones : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeAllBones();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_removeAllBones : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_addBone(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_addBone : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Bone3D* arg0;
+ do {
+ 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::Bone3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_addBone : Error processing arguments");
+ cobj->addBone(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_addBone : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getBoneByName(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByName : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByName : Error processing arguments");
+ cocos2d::Bone3D* ret = cobj->getBoneByName(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Bone3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getBoneByName : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getRootBone(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getRootBone : Invalid Native Object");
+ if (argc == 1) {
+ int arg0;
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getRootBone : Error processing arguments");
+ cocos2d::Bone3D* ret = cobj->getRootBone(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Bone3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getRootBone : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_updateBoneMatrix(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_updateBoneMatrix : Invalid Native Object");
+ if (argc == 0) {
+ cobj->updateBoneMatrix();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_updateBoneMatrix : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getBoneByIndex(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByIndex : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneByIndex : Error processing arguments");
+ cocos2d::Bone3D* ret = cobj->getBoneByIndex(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Bone3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getBoneByIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getRootCount(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getRootCount : Invalid Native Object");
+ if (argc == 0) {
+ ssize_t ret = cobj->getRootCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = ssize_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getRootCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getBoneIndex(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneIndex : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Bone3D* arg0;
+ do {
+ 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::Bone3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneIndex : Error processing arguments");
+ int ret = cobj->getBoneIndex(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = int32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getBoneIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_getBoneCount(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::Skeleton3D* cobj = (cocos2d::Skeleton3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Skeleton3D_getBoneCount : Invalid Native Object");
+ if (argc == 0) {
+ ssize_t ret = cobj->getBoneCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = ssize_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Skeleton3D_getBoneCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Skeleton3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::Skeleton3D* cobj = new (std::nothrow) cocos2d::Skeleton3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Skeleton3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+
+void js_cocos2d_Skeleton3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Skeleton3D)", obj);
+}
+
+void js_register_cocos2dx_3d_Skeleton3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Skeleton3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Skeleton3D_class->name = "Skeleton3D";
+ jsb_cocos2d_Skeleton3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Skeleton3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Skeleton3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Skeleton3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Skeleton3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Skeleton3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Skeleton3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Skeleton3D_class->finalize = js_cocos2d_Skeleton3D_finalize;
+ jsb_cocos2d_Skeleton3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("removeAllBones", js_cocos2dx_3d_Skeleton3D_removeAllBones, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("addBone", js_cocos2dx_3d_Skeleton3D_addBone, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBoneByName", js_cocos2dx_3d_Skeleton3D_getBoneByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getRootBone", js_cocos2dx_3d_Skeleton3D_getRootBone, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("updateBoneMatrix", js_cocos2dx_3d_Skeleton3D_updateBoneMatrix, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBoneByIndex", js_cocos2dx_3d_Skeleton3D_getBoneByIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getRootCount", js_cocos2dx_3d_Skeleton3D_getRootCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBoneIndex", js_cocos2dx_3d_Skeleton3D_getBoneIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBoneCount", js_cocos2dx_3d_Skeleton3D_getBoneCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ JSFunctionSpec *st_funcs = NULL;
+
+ jsb_cocos2d_Skeleton3D_prototype = JS_InitClass(
+ cx, global,
+ JS::NullPtr(), // parent proto
+ jsb_cocos2d_Skeleton3D_class,
+ js_cocos2dx_3d_Skeleton3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Skeleton3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Skeleton3D_class;
+ p->proto = jsb_cocos2d_Skeleton3D_prototype;
+ p->parentProto = NULL;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_Sprite3D_class;
+JSObject *jsb_cocos2d_Sprite3D_prototype;
+
+bool js_cocos2dx_3d_Sprite3D_setCullFaceEnabled(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFaceEnabled : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFaceEnabled : Error processing arguments");
+ cobj->setCullFaceEnabled(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setCullFaceEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ JS::RootedObject obj(cx);
+ cocos2d::Sprite3D* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setTexture : Invalid Native Object");
+ do {
+ if (argc == 1) {
+ cocos2d::Texture2D* arg0;
+ do {
+ 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::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ cobj->setTexture(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ do {
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cobj->setTexture(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setTexture : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getLightMask(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getLightMask : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getLightMask();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getLightMask : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode : Invalid Native Object");
+ if (argc == 2) {
+ cocos2d::NodeData* arg0;
+ cocos2d::MaterialDatas arg1;
+ #pragma warning NO CONVERSION TO NATIVE FOR NodeData*
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode : Error processing arguments");
+ cobj->createAttachSprite3DNode(arg0, arg1);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode : wrong number of arguments: %d, was expecting %d", argc, 2);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_loadFromFile(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_loadFromFile : Invalid Native Object");
+ if (argc == 4) {
+ std::string arg0;
+ cocos2d::NodeDatas* arg1;
+ cocos2d::MeshDatas* arg2;
+ cocos2d::MaterialDatas* arg3;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ #pragma warning NO CONVERSION TO NATIVE FOR NodeDatas*
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MeshDatas*
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas*
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_loadFromFile : Error processing arguments");
+ bool ret = cobj->loadFromFile(arg0, arg1, arg2, arg3);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_loadFromFile : wrong number of arguments: %d, was expecting %d", argc, 4);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_setCullFace(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFace : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setCullFace : Error processing arguments");
+ cobj->setCullFace(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setCullFace : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_addMesh(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_addMesh : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Mesh* arg0;
+ do {
+ 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::Mesh*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_addMesh : Error processing arguments");
+ cobj->addMesh(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_addMesh : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_removeAllAttachNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_removeAllAttachNode : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeAllAttachNode();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_removeAllAttachNode : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_genGLProgramState(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_genGLProgramState : Invalid Native Object");
+ if (argc == 0) {
+ cobj->genGLProgramState();
+ args.rval().setUndefined();
+ return true;
+ }
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_genGLProgramState : Error processing arguments");
+ cobj->genGLProgramState(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_genGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getMesh(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMesh : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Mesh* ret = cobj->getMesh();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Mesh*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getMesh : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_createSprite3DNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createSprite3DNode : Invalid Native Object");
+ if (argc == 3) {
+ cocos2d::NodeData* arg0;
+ cocos2d::ModelData* arg1;
+ cocos2d::MaterialDatas arg2;
+ #pragma warning NO CONVERSION TO NATIVE FOR NodeData*
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR ModelData*
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_createSprite3DNode : Error processing arguments");
+ cocos2d::Sprite3D* ret = cobj->createSprite3DNode(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Sprite3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_createSprite3DNode : wrong number of arguments: %d, was expecting %d", argc, 3);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getMeshCount(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshCount : Invalid Native Object");
+ if (argc == 0) {
+ ssize_t ret = cobj->getMeshCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = ssize_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getMeshCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_onAABBDirty(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_onAABBDirty : Invalid Native Object");
+ if (argc == 0) {
+ cobj->onAABBDirty();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_onAABBDirty : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getMeshByIndex(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByIndex : Invalid Native Object");
+ if (argc == 1) {
+ int arg0;
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByIndex : Error processing arguments");
+ cocos2d::Mesh* ret = cobj->getMeshByIndex(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Mesh*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getMeshByIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_createNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_createNode : Invalid Native Object");
+ if (argc == 4) {
+ cocos2d::NodeData* arg0;
+ cocos2d::Node* arg1;
+ cocos2d::MaterialDatas arg2;
+ bool arg3;
+ #pragma warning NO CONVERSION TO NATIVE FOR NodeData*
+ ok = false;
+ do {
+ if (!args.get(1).isObject()) { ok = false; break; }
+ js_proxy_t *jsProxy;
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
+ jsProxy = jsb_get_js_proxy(tmpObj);
+ arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
+ } while (0);
+ #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas
+ ok = false;
+ arg3 = JS::ToBoolean(args.get(3));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_createNode : Error processing arguments");
+ cobj->createNode(arg0, arg1, arg2, arg3);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_createNode : wrong number of arguments: %d, was expecting %d", argc, 4);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_isForceDepthWrite(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_isForceDepthWrite : Invalid Native Object");
+ if (argc == 0) {
+ bool ret = cobj->isForceDepthWrite();
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_isForceDepthWrite : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getBlendFunc(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getBlendFunc : Invalid Native Object");
+ if (argc == 0) {
+ const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
+ jsval jsret = JSVAL_NULL;
+ jsret = blendfunc_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getMeshIndexData(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshIndexData : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshIndexData : Error processing arguments");
+ cocos2d::MeshIndexData* ret = cobj->getMeshIndexData(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MeshIndexData*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getMeshIndexData : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_removeAttachNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_removeAttachNode : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_removeAttachNode : Error processing arguments");
+ cobj->removeAttachNode(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_removeAttachNode : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_setLightMask(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setLightMask : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setLightMask : Error processing arguments");
+ cobj->setLightMask(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setLightMask : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_afterAsyncLoad(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_afterAsyncLoad : Invalid Native Object");
+ if (argc == 1) {
+ void* arg0;
+ #pragma warning NO CONVERSION TO NATIVE FOR void*
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_afterAsyncLoad : Error processing arguments");
+ cobj->afterAsyncLoad(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_afterAsyncLoad : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_loadFromCache(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_loadFromCache : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_loadFromCache : Error processing arguments");
+ bool ret = cobj->loadFromCache(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_loadFromCache : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_initFrom(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_initFrom : Invalid Native Object");
+ if (argc == 3) {
+ cocos2d::NodeDatas arg0;
+ cocos2d::MeshDatas arg1;
+ cocos2d::MaterialDatas arg2;
+ #pragma warning NO CONVERSION TO NATIVE FOR NodeDatas
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MeshDatas
+ ok = false;
+ #pragma warning NO CONVERSION TO NATIVE FOR MaterialDatas
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_initFrom : Error processing arguments");
+ bool ret = cobj->initFrom(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_initFrom : wrong number of arguments: %d, was expecting %d", argc, 3);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getAttachNode(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getAttachNode : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getAttachNode : Error processing arguments");
+ cocos2d::AttachNode* ret = cobj->getAttachNode(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::AttachNode*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getAttachNode : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_initWithFile(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_initWithFile : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_initWithFile : Error processing arguments");
+ bool ret = cobj->initWithFile(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_initWithFile : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_setBlendFunc(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setBlendFunc : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::BlendFunc arg0;
+ ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setBlendFunc : Error processing arguments");
+ cobj->setBlendFunc(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getSkeleton(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getSkeleton : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Skeleton3D* ret = cobj->getSkeleton();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Skeleton3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getSkeleton : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_setForceDepthWrite(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setForceDepthWrite : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setForceDepthWrite : Error processing arguments");
+ cobj->setForceDepthWrite(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setForceDepthWrite : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_getMeshByName(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByName : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_getMeshByName : Error processing arguments");
+ cocos2d::Mesh* ret = cobj->getMeshByName(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Mesh*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_getMeshByName : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ do {
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Sprite3D* ret = cocos2d::Sprite3D::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Sprite3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 0) {
+ cocos2d::Sprite3D* ret = cocos2d::Sprite3D::create();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Sprite3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 2) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ std::string arg1;
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::Sprite3D* ret = cocos2d::Sprite3D::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Sprite3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_create : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::Sprite3D* cobj = new (std::nothrow) cocos2d::Sprite3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Sprite3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_Node_prototype;
+
+void js_cocos2d_Sprite3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Sprite3D)", obj);
+}
+
+static bool js_cocos2d_Sprite3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
+ cocos2d::Sprite3D *nobj = new (std::nothrow) cocos2d::Sprite3D();
+ if (nobj) {
+ nobj->autorelease();
+ }
+ js_proxy_t* p = jsb_new_proxy(nobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Sprite3D");
+ bool isFound = false;
+ if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
+ return true;
+}
+void js_register_cocos2dx_3d_Sprite3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Sprite3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Sprite3D_class->name = "Sprite3D";
+ jsb_cocos2d_Sprite3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Sprite3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Sprite3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Sprite3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Sprite3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Sprite3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Sprite3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Sprite3D_class->finalize = js_cocos2d_Sprite3D_finalize;
+ jsb_cocos2d_Sprite3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("setCullFaceEnabled", js_cocos2dx_3d_Sprite3D_setCullFaceEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setTexture", js_cocos2dx_3d_Sprite3D_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getLightMask", js_cocos2dx_3d_Sprite3D_getLightMask, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("createAttachSprite3DNode", js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("loadFromFile", js_cocos2dx_3d_Sprite3D_loadFromFile, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setCullFace", js_cocos2dx_3d_Sprite3D_setCullFace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("addMesh", js_cocos2dx_3d_Sprite3D_addMesh, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeAllAttachNode", js_cocos2dx_3d_Sprite3D_removeAllAttachNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("genGLProgramState", js_cocos2dx_3d_Sprite3D_genGLProgramState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMesh", js_cocos2dx_3d_Sprite3D_getMesh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("createSprite3DNode", js_cocos2dx_3d_Sprite3D_createSprite3DNode, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshCount", js_cocos2dx_3d_Sprite3D_getMeshCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("onAABBDirty", js_cocos2dx_3d_Sprite3D_onAABBDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshByIndex", js_cocos2dx_3d_Sprite3D_getMeshByIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("createNode", js_cocos2dx_3d_Sprite3D_createNode, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isForceDepthWrite", js_cocos2dx_3d_Sprite3D_isForceDepthWrite, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBlendFunc", js_cocos2dx_3d_Sprite3D_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshIndexData", js_cocos2dx_3d_Sprite3D_getMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeAttachNode", js_cocos2dx_3d_Sprite3D_removeAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setLightMask", js_cocos2dx_3d_Sprite3D_setLightMask, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("afterAsyncLoad", js_cocos2dx_3d_Sprite3D_afterAsyncLoad, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("loadFromCache", js_cocos2dx_3d_Sprite3D_loadFromCache, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("initFrom", js_cocos2dx_3d_Sprite3D_initFrom, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getAttachNode", js_cocos2dx_3d_Sprite3D_getAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("initWithFile", js_cocos2dx_3d_Sprite3D_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setBlendFunc", js_cocos2dx_3d_Sprite3D_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getSkeleton", js_cocos2dx_3d_Sprite3D_getSkeleton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setForceDepthWrite", js_cocos2dx_3d_Sprite3D_setForceDepthWrite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshByName", js_cocos2dx_3d_Sprite3D_getMeshByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("ctor", js_cocos2d_Sprite3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_Sprite3D_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_Sprite3D_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
+ jsb_cocos2d_Sprite3D_class,
+ js_cocos2dx_3d_Sprite3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Sprite3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Sprite3D_class;
+ p->proto = jsb_cocos2d_Sprite3D_prototype;
+ p->parentProto = jsb_cocos2d_Node_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_Sprite3DCache_class;
+JSObject *jsb_cocos2d_Sprite3DCache_prototype;
+
+bool js_cocos2dx_3d_Sprite3DCache_removeSprite3DData(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::Sprite3DCache* cobj = (cocos2d::Sprite3DCache *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3DCache_removeSprite3DData : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3DCache_removeSprite3DData : Error processing arguments");
+ cobj->removeSprite3DData(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3DCache_removeSprite3DData : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData(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::Sprite3DCache* cobj = (cocos2d::Sprite3DCache *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeAllSprite3DData();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Sprite3DCache_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ if (argc == 0) {
+ cocos2d::Sprite3DCache::destroyInstance();
+ args.rval().setUndefined();
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3DCache_destroyInstance : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_Sprite3DCache_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ if (argc == 0) {
+ cocos2d::Sprite3DCache* ret = cocos2d::Sprite3DCache::getInstance();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Sprite3DCache*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Sprite3DCache_getInstance : wrong number of arguments");
+ return false;
+}
+
+
+
+void js_cocos2d_Sprite3DCache_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Sprite3DCache)", obj);
+}
+
+void js_register_cocos2dx_3d_Sprite3DCache(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Sprite3DCache_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Sprite3DCache_class->name = "Sprite3DCache";
+ jsb_cocos2d_Sprite3DCache_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Sprite3DCache_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Sprite3DCache_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Sprite3DCache_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Sprite3DCache_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Sprite3DCache_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Sprite3DCache_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Sprite3DCache_class->finalize = js_cocos2d_Sprite3DCache_finalize;
+ jsb_cocos2d_Sprite3DCache_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("removeSprite3DData", js_cocos2dx_3d_Sprite3DCache_removeSprite3DData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeAllSprite3DData", js_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("destroyInstance", js_cocos2dx_3d_Sprite3DCache_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getInstance", js_cocos2dx_3d_Sprite3DCache_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_Sprite3DCache_prototype = JS_InitClass(
+ cx, global,
+ JS::NullPtr(), // parent proto
+ jsb_cocos2d_Sprite3DCache_class,
+ empty_constructor, 0,
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Sprite3DCache", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Sprite3DCache_class;
+ p->proto = jsb_cocos2d_Sprite3DCache_prototype;
+ p->parentProto = NULL;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_Mesh_class;
+JSObject *jsb_cocos2d_Mesh_prototype;
+
+bool js_cocos2dx_3d_Mesh_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ JS::RootedObject obj(cx);
+ cocos2d::Mesh* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setTexture : Invalid Native Object");
+ do {
+ if (argc == 1) {
+ cocos2d::Texture2D* arg0;
+ do {
+ 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::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ cobj->setTexture(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ do {
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cobj->setTexture(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setTexture : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getTexture : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Texture2D* ret = cobj->getTexture();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Texture2D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getSkin(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getSkin : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::MeshSkin* ret = cobj->getSkin();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MeshSkin*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getSkin : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getVertexSizeInBytes : Invalid Native Object");
+ if (argc == 0) {
+ int ret = cobj->getVertexSizeInBytes();
+ jsval jsret = JSVAL_NULL;
+ jsret = int32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getVertexSizeInBytes : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getName(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getName : Invalid Native Object");
+ if (argc == 0) {
+ const std::string& ret = cobj->getName();
+ jsval jsret = JSVAL_NULL;
+ jsret = std_string_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getIndexFormat(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getIndexFormat : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getIndexFormat();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getIndexFormat : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getGLProgramState(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getGLProgramState : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::GLProgramState* ret = cobj->getGLProgramState();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::GLProgramState*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getVertexBuffer(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getVertexBuffer : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getVertexBuffer();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getVertexBuffer : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_calculateAABB(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_calculateAABB : Invalid Native Object");
+ if (argc == 0) {
+ cobj->calculateAABB();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_calculateAABB : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_hasVertexAttrib(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_hasVertexAttrib : Invalid Native Object");
+ if (argc == 1) {
+ int arg0;
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_hasVertexAttrib : Error processing arguments");
+ bool ret = cobj->hasVertexAttrib(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_hasVertexAttrib : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getBlendFunc(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getBlendFunc : Invalid Native Object");
+ if (argc == 0) {
+ const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
+ jsval jsret = JSVAL_NULL;
+ jsret = blendfunc_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getMeshIndexData(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getMeshIndexData : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::MeshIndexData* ret = cobj->getMeshIndexData();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MeshIndexData*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getMeshIndexData : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setName(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setName : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setName : Error processing arguments");
+ cobj->setName(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_isVisible(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_isVisible : Invalid Native Object");
+ if (argc == 0) {
+ bool ret = cobj->isVisible();
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_isVisible : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getIndexCount(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getIndexCount : Invalid Native Object");
+ if (argc == 0) {
+ ssize_t ret = cobj->getIndexCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = ssize_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getIndexCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_bindMeshCommand(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_bindMeshCommand : Invalid Native Object");
+ if (argc == 0) {
+ cobj->bindMeshCommand();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_bindMeshCommand : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setMeshIndexData(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setMeshIndexData : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::MeshIndexData* arg0;
+ do {
+ 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::MeshIndexData*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setMeshIndexData : Error processing arguments");
+ cobj->setMeshIndexData(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setMeshIndexData : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getMeshVertexAttribCount : Invalid Native Object");
+ if (argc == 0) {
+ ssize_t ret = cobj->getMeshVertexAttribCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = ssize_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getMeshVertexAttribCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setBlendFunc(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setBlendFunc : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::BlendFunc arg0;
+ ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setBlendFunc : Error processing arguments");
+ cobj->setBlendFunc(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getPrimitiveType(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getPrimitiveType : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getPrimitiveType();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getPrimitiveType : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setSkin(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setSkin : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::MeshSkin* arg0;
+ do {
+ 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::MeshSkin*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setSkin : Error processing arguments");
+ cobj->setSkin(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setSkin : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_getIndexBuffer(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_getIndexBuffer : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getIndexBuffer();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getIndexBuffer : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setGLProgramState(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setGLProgramState : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::GLProgramState* arg0;
+ do {
+ 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::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setGLProgramState : Error processing arguments");
+ cobj->setGLProgramState(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_setVisible(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setVisible : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setVisible : Error processing arguments");
+ cobj->setVisible(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setVisible : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Mesh_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::Mesh* cobj = new (std::nothrow) cocos2d::Mesh();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Mesh");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+
+void js_cocos2d_Mesh_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Mesh)", obj);
+}
+
+void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Mesh_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Mesh_class->name = "Mesh";
+ jsb_cocos2d_Mesh_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Mesh_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Mesh_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Mesh_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Mesh_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Mesh_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Mesh_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Mesh_class->finalize = js_cocos2d_Mesh_finalize;
+ jsb_cocos2d_Mesh_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("setTexture", js_cocos2dx_3d_Mesh_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getTexture", js_cocos2dx_3d_Mesh_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getSkin", js_cocos2dx_3d_Mesh_getSkin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getVertexSizeInBytes", js_cocos2dx_3d_Mesh_getVertexSizeInBytes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getName", js_cocos2dx_3d_Mesh_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getIndexFormat", js_cocos2dx_3d_Mesh_getIndexFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getGLProgramState", js_cocos2dx_3d_Mesh_getGLProgramState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getVertexBuffer", js_cocos2dx_3d_Mesh_getVertexBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("calculateAABB", js_cocos2dx_3d_Mesh_calculateAABB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("hasVertexAttrib", js_cocos2dx_3d_Mesh_hasVertexAttrib, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBlendFunc", js_cocos2dx_3d_Mesh_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshIndexData", js_cocos2dx_3d_Mesh_getMeshIndexData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setName", js_cocos2dx_3d_Mesh_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isVisible", js_cocos2dx_3d_Mesh_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getIndexCount", js_cocos2dx_3d_Mesh_getIndexCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("bindMeshCommand", js_cocos2dx_3d_Mesh_bindMeshCommand, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setMeshIndexData", js_cocos2dx_3d_Mesh_setMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMeshVertexAttribCount", js_cocos2dx_3d_Mesh_getMeshVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setBlendFunc", js_cocos2dx_3d_Mesh_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getPrimitiveType", js_cocos2dx_3d_Mesh_getPrimitiveType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setSkin", js_cocos2dx_3d_Mesh_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getIndexBuffer", js_cocos2dx_3d_Mesh_getIndexBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setGLProgramState", js_cocos2dx_3d_Mesh_setGLProgramState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setVisible", js_cocos2dx_3d_Mesh_setVisible, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ JSFunctionSpec *st_funcs = NULL;
+
+ jsb_cocos2d_Mesh_prototype = JS_InitClass(
+ cx, global,
+ JS::NullPtr(), // parent proto
+ jsb_cocos2d_Mesh_class,
+ js_cocos2dx_3d_Mesh_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Mesh", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Mesh_class;
+ p->proto = jsb_cocos2d_Mesh_prototype;
+ p->parentProto = NULL;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_Animation3D_class;
+JSObject *jsb_cocos2d_Animation3D_prototype;
+
+bool js_cocos2dx_3d_Animation3D_initWithFile(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::Animation3D* cobj = (cocos2d::Animation3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animation3D_initWithFile : Invalid Native Object");
+ if (argc == 2) {
+ std::string arg0;
+ std::string arg1;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animation3D_initWithFile : Error processing arguments");
+ bool ret = cobj->initWithFile(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animation3D_initWithFile : wrong number of arguments: %d, was expecting %d", argc, 2);
+ return false;
+}
+bool js_cocos2dx_3d_Animation3D_init(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::Animation3D* cobj = (cocos2d::Animation3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animation3D_init : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Animation3DData arg0;
+ #pragma warning NO CONVERSION TO NATIVE FOR Animation3DData
+ ok = false;
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animation3D_init : Error processing arguments");
+ bool ret = cobj->init(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animation3D_init : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Animation3D_getBoneCurveByName(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::Animation3D* cobj = (cocos2d::Animation3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animation3D_getBoneCurveByName : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animation3D_getBoneCurveByName : Error processing arguments");
+ cocos2d::Animation3D::Curve* ret = cobj->getBoneCurveByName(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animation3D::Curve*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animation3D_getBoneCurveByName : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Animation3D_getDuration(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::Animation3D* cobj = (cocos2d::Animation3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animation3D_getDuration : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getDuration();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animation3D_getDuration : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Animation3D_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animation3D_create : Error processing arguments");
+ cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animation3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ if (argc == 2) {
+ std::string arg0;
+ std::string arg1;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animation3D_create : Error processing arguments");
+ cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animation3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Animation3D_create : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_Animation3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::Animation3D* cobj = new (std::nothrow) cocos2d::Animation3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animation3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+
+void js_cocos2d_Animation3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Animation3D)", obj);
+}
+
+void js_register_cocos2dx_3d_Animation3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Animation3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Animation3D_class->name = "Animation3D";
+ jsb_cocos2d_Animation3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Animation3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Animation3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Animation3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Animation3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Animation3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Animation3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Animation3D_class->finalize = js_cocos2d_Animation3D_finalize;
+ jsb_cocos2d_Animation3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("initWithFile", js_cocos2dx_3d_Animation3D_initWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("init", js_cocos2dx_3d_Animation3D_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBoneCurveByName", js_cocos2dx_3d_Animation3D_getBoneCurveByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDuration", js_cocos2dx_3d_Animation3D_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_Animation3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_Animation3D_prototype = JS_InitClass(
+ cx, global,
+ JS::NullPtr(), // parent proto
+ jsb_cocos2d_Animation3D_class,
+ js_cocos2dx_3d_Animation3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Animation3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Animation3D_class;
+ p->proto = jsb_cocos2d_Animation3D_prototype;
+ p->parentProto = NULL;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_Animate3D_class;
+JSObject *jsb_cocos2d_Animate3D_prototype;
+
+bool js_cocos2dx_3d_Animate3D_getSpeed(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_getSpeed : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getSpeed();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_getSpeed : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_removeFromMap(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_removeFromMap : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeFromMap();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_removeFromMap : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_setWeight(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setWeight : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setWeight : Error processing arguments");
+ cobj->setWeight(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_setWeight : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_initWithFrames(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_initWithFrames : Invalid Native Object");
+ if (argc == 4) {
+ cocos2d::Animation3D* arg0;
+ int arg1;
+ int arg2;
+ double arg3;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_initWithFrames : Error processing arguments");
+ bool ret = cobj->initWithFrames(arg0, arg1, arg2, arg3);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_initWithFrames : wrong number of arguments: %d, was expecting %d", argc, 4);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_getOriginInterval(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_getOriginInterval : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getOriginInterval();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_getOriginInterval : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_setSpeed(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setSpeed : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setSpeed : Error processing arguments");
+ cobj->setSpeed(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_setSpeed : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_init(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ JS::RootedObject obj(cx);
+ cocos2d::Animate3D* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_init : Invalid Native Object");
+ do {
+ if (argc == 3) {
+ cocos2d::Animation3D* arg0;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ double arg1;
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ if (!ok) { ok = true; break; }
+ double arg2;
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->init(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
+
+ do {
+ if (argc == 1) {
+ cocos2d::Animation3D* arg0;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->init(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_init : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_setOriginInterval(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_setOriginInterval : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setOriginInterval : Error processing arguments");
+ cobj->setOriginInterval(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_setOriginInterval : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_getWeight(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::Animate3D* cobj = (cocos2d::Animate3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Animate3D_getWeight : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getWeight();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_getWeight : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ do {
+ if (argc == 3) {
+ cocos2d::Animation3D* arg0;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ double arg1;
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ if (!ok) { ok = true; break; }
+ double arg2;
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ if (!ok) { ok = true; break; }
+ cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animate3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 1) {
+ cocos2d::Animation3D* arg0;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animate3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_create : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_Animate3D_getTransitionTime(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ if (argc == 0) {
+ double ret = cocos2d::Animate3D::getTransitionTime();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_getTransitionTime : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_Animate3D_createWithFrames(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 3) {
+ cocos2d::Animation3D* arg0;
+ int arg1;
+ int arg2;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_createWithFrames : Error processing arguments");
+ cocos2d::Animate3D* ret = cocos2d::Animate3D::createWithFrames(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animate3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ if (argc == 4) {
+ cocos2d::Animation3D* arg0;
+ int arg1;
+ int arg2;
+ double arg3;
+ do {
+ 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::Animation3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_createWithFrames : Error processing arguments");
+ cocos2d::Animate3D* ret = cocos2d::Animate3D::createWithFrames(arg0, arg1, arg2, arg3);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Animate3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_createWithFrames : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_Animate3D_setTransitionTime(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Animate3D_setTransitionTime : Error processing arguments");
+ cocos2d::Animate3D::setTransitionTime(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_Animate3D_setTransitionTime : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_Animate3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::Animate3D* cobj = new (std::nothrow) cocos2d::Animate3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animate3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_ActionInterval_prototype;
+
+void js_cocos2d_Animate3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (Animate3D)", obj);
+}
+
+void js_register_cocos2dx_3d_Animate3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_Animate3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_Animate3D_class->name = "Animate3D";
+ jsb_cocos2d_Animate3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_Animate3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_Animate3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_Animate3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_Animate3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_Animate3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_Animate3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_Animate3D_class->finalize = js_cocos2d_Animate3D_finalize;
+ jsb_cocos2d_Animate3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("getSpeed", js_cocos2dx_3d_Animate3D_getSpeed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeFromMap", js_cocos2dx_3d_Animate3D_removeFromMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setWeight", js_cocos2dx_3d_Animate3D_setWeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("initWithFrames", js_cocos2dx_3d_Animate3D_initWithFrames, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getOriginInterval", js_cocos2dx_3d_Animate3D_getOriginInterval, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setSpeed", js_cocos2dx_3d_Animate3D_setSpeed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("init", js_cocos2dx_3d_Animate3D_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setOriginInterval", js_cocos2dx_3d_Animate3D_setOriginInterval, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getWeight", js_cocos2dx_3d_Animate3D_getWeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_Animate3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getTransitionTime", js_cocos2dx_3d_Animate3D_getTransitionTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("createWithFrames", js_cocos2dx_3d_Animate3D_createWithFrames, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setTransitionTime", js_cocos2dx_3d_Animate3D_setTransitionTime, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_Animate3D_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
+ jsb_cocos2d_Animate3D_class,
+ js_cocos2dx_3d_Animate3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "Animate3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_Animate3D_class;
+ p->proto = jsb_cocos2d_Animate3D_prototype;
+ p->parentProto = jsb_cocos2d_ActionInterval_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_AttachNode_class;
+JSObject *jsb_cocos2d_AttachNode_prototype;
+
+bool js_cocos2dx_3d_AttachNode_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 1) {
+ cocos2d::Bone3D* arg0;
+ do {
+ 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::Bone3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_AttachNode_create : Error processing arguments");
+ cocos2d::AttachNode* ret = cocos2d::AttachNode::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::AttachNode*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_AttachNode_create : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_AttachNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::AttachNode* cobj = new (std::nothrow) cocos2d::AttachNode();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::AttachNode");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_Node_prototype;
+
+void js_cocos2d_AttachNode_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (AttachNode)", obj);
+}
+
+void js_register_cocos2dx_3d_AttachNode(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_AttachNode_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_AttachNode_class->name = "AttachNode";
+ jsb_cocos2d_AttachNode_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_AttachNode_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_AttachNode_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_AttachNode_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_AttachNode_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_AttachNode_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_AttachNode_class->convert = JS_ConvertStub;
+ jsb_cocos2d_AttachNode_class->finalize = js_cocos2d_AttachNode_finalize;
+ jsb_cocos2d_AttachNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_AttachNode_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_AttachNode_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
+ jsb_cocos2d_AttachNode_class,
+ js_cocos2dx_3d_AttachNode_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "AttachNode", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_AttachNode_class;
+ p->proto = jsb_cocos2d_AttachNode_prototype;
+ p->parentProto = jsb_cocos2d_Node_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_BillBoard_class;
+JSObject *jsb_cocos2d_BillBoard_prototype;
+
+bool js_cocos2dx_3d_BillBoard_getMode(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::BillBoard* cobj = (cocos2d::BillBoard *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_BillBoard_getMode : Invalid Native Object");
+ if (argc == 0) {
+ int ret = (int)cobj->getMode();
+ jsval jsret = JSVAL_NULL;
+ jsret = int32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_BillBoard_getMode : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_BillBoard_setMode(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::BillBoard* cobj = (cocos2d::BillBoard *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_BillBoard_setMode : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::BillBoard::Mode arg0;
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_BillBoard_setMode : Error processing arguments");
+ cobj->setMode(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_BillBoard_setMode : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_BillBoard_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ do {
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ do {
+ if (argc == 2) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard::Mode arg1;
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 0) {
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ do {
+ if (argc == 1) {
+ cocos2d::BillBoard::Mode arg0;
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 2) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Rect arg1;
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ do {
+ if (argc == 3) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Rect arg1;
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard::Mode arg2;
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
+ if (!ok) { ok = true; break; }
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::create(arg0, arg1, arg2);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ JS_ReportError(cx, "js_cocos2dx_3d_BillBoard_create : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_BillBoard_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 1) {
+ cocos2d::Texture2D* arg0;
+ do {
+ 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::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_BillBoard_createWithTexture : Error processing arguments");
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::createWithTexture(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ if (argc == 2) {
+ cocos2d::Texture2D* arg0;
+ cocos2d::BillBoard::Mode arg1;
+ do {
+ 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::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_BillBoard_createWithTexture : Error processing arguments");
+ cocos2d::BillBoard* ret = cocos2d::BillBoard::createWithTexture(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::BillBoard*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_3d_BillBoard_createWithTexture : wrong number of arguments");
+ return false;
+}
+
+bool js_cocos2dx_3d_BillBoard_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::BillBoard* cobj = new (std::nothrow) cocos2d::BillBoard();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::BillBoard");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_Sprite_prototype;
+
+void js_cocos2d_BillBoard_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (BillBoard)", obj);
+}
+
+void js_register_cocos2dx_3d_BillBoard(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_BillBoard_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_BillBoard_class->name = "BillBoard";
+ jsb_cocos2d_BillBoard_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_BillBoard_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_BillBoard_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_BillBoard_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_BillBoard_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_BillBoard_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_BillBoard_class->convert = JS_ConvertStub;
+ jsb_cocos2d_BillBoard_class->finalize = js_cocos2d_BillBoard_finalize;
+ jsb_cocos2d_BillBoard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("getMode", js_cocos2dx_3d_BillBoard_getMode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setMode", js_cocos2dx_3d_BillBoard_setMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_BillBoard_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("createWithTexture", js_cocos2dx_3d_BillBoard_createWithTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_BillBoard_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_Sprite_prototype),
+ jsb_cocos2d_BillBoard_class,
+ js_cocos2dx_3d_BillBoard_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "BillBoard", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_BillBoard_class;
+ p->proto = jsb_cocos2d_BillBoard_prototype;
+ p->parentProto = jsb_cocos2d_Sprite_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj) {
+ // Get the ns
+ JS::RootedObject ns(cx);
+ get_or_create_js_obj(cx, obj, "jsb", &ns);
+
+ js_register_cocos2dx_3d_Animate3D(cx, ns);
+ js_register_cocos2dx_3d_Sprite3D(cx, ns);
+ js_register_cocos2dx_3d_AttachNode(cx, ns);
+ js_register_cocos2dx_3d_Sprite3DCache(cx, ns);
+ js_register_cocos2dx_3d_BillBoard(cx, ns);
+ js_register_cocos2dx_3d_Animation3D(cx, ns);
+ js_register_cocos2dx_3d_Skeleton3D(cx, ns);
+ js_register_cocos2dx_3d_Mesh(cx, ns);
+}
+
diff --git a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.hpp b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.hpp
new file mode 100644
index 0000000000..08d6b225d8
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_auto.hpp
@@ -0,0 +1,169 @@
+#ifndef __cocos2dx_3d_h__
+#define __cocos2dx_3d_h__
+
+#include "jsapi.h"
+#include "jsfriendapi.h"
+
+
+extern JSClass *jsb_cocos2d_Skeleton3D_class;
+extern JSObject *jsb_cocos2d_Skeleton3D_prototype;
+
+bool js_cocos2dx_3d_Skeleton3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Skeleton3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Skeleton3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Skeleton3D_removeAllBones(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_addBone(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getBoneByName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getRootBone(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_updateBoneMatrix(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getBoneByIndex(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getRootCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getBoneIndex(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_getBoneCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Skeleton3D_Skeleton3D(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_Sprite3D_class;
+extern JSObject *jsb_cocos2d_Sprite3D_prototype;
+
+bool js_cocos2dx_3d_Sprite3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Sprite3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Sprite3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Sprite3D_setCullFaceEnabled(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_setTexture(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getLightMask(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_createAttachSprite3DNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_loadFromFile(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_setCullFace(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_addMesh(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_removeAllAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_genGLProgramState(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getMesh(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_createSprite3DNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getMeshCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_onAABBDirty(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getMeshByIndex(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_createNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_isForceDepthWrite(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_removeAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_setLightMask(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_afterAsyncLoad(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_loadFromCache(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_initFrom(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_initWithFile(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getSkeleton(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_setForceDepthWrite(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_getMeshByName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3D_Sprite3D(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_Sprite3DCache_class;
+extern JSObject *jsb_cocos2d_Sprite3DCache_prototype;
+
+bool js_cocos2dx_3d_Sprite3DCache_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Sprite3DCache_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Sprite3DCache(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Sprite3DCache_removeSprite3DData(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3DCache_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Sprite3DCache_getInstance(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_Mesh_class;
+extern JSObject *jsb_cocos2d_Mesh_prototype;
+
+bool js_cocos2dx_3d_Mesh_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Mesh_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Mesh_setTexture(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getTexture(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getSkin(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getIndexFormat(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getVertexBuffer(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_calculateAABB(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_hasVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_bindMeshCommand(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_getIndexBuffer(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_setVisible(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Mesh_Mesh(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_Animation3D_class;
+extern JSObject *jsb_cocos2d_Animation3D_prototype;
+
+bool js_cocos2dx_3d_Animation3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Animation3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Animation3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Animation3D_initWithFile(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animation3D_init(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animation3D_getBoneCurveByName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animation3D_getDuration(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animation3D_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animation3D_Animation3D(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_Animate3D_class;
+extern JSObject *jsb_cocos2d_Animate3D_prototype;
+
+bool js_cocos2dx_3d_Animate3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_Animate3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_Animate3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_Animate3D_getSpeed(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_removeFromMap(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_setWeight(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_initWithFrames(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_getOriginInterval(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_setSpeed(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_init(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_setOriginInterval(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_getWeight(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_getTransitionTime(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_createWithFrames(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_setTransitionTime(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_Animate3D_Animate3D(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_AttachNode_class;
+extern JSObject *jsb_cocos2d_AttachNode_prototype;
+
+bool js_cocos2dx_3d_AttachNode_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_AttachNode_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_AttachNode(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_AttachNode_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_AttachNode_AttachNode(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_BillBoard_class;
+extern JSObject *jsb_cocos2d_BillBoard_prototype;
+
+bool js_cocos2dx_3d_BillBoard_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_BillBoard_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_BillBoard(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_BillBoard_getMode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_BillBoard_setMode(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_BillBoard_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_BillBoard_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_BillBoard_BillBoard(JSContext *cx, uint32_t argc, jsval *vp);
+#endif
+
diff --git a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp
new file mode 100644
index 0000000000..44e3b01f4f
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp
@@ -0,0 +1,1219 @@
+#include "jsb_cocos2dx_3d_extension_auto.hpp"
+#include "cocos2d_specifics.hpp"
+#include "cocos-ext.h"
+
+template
+static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedValue initializing(cx);
+ bool isNewValid = true;
+ JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject());
+ isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && initializing.toBoolean();
+ if (isNewValid)
+ {
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject _tmp(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+
+ args.rval().set(OBJECT_TO_JSVAL(_tmp));
+ return true;
+ }
+
+ JS_ReportError(cx, "Constructor for the requested class is not available, please refer to the API reference.");
+ return false;
+}
+
+static bool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
+ return false;
+}
+
+static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ args.rval().setBoolean(true);
+ return true;
+}
+JSClass *jsb_cocos2d_ParticleSystem3D_class;
+JSObject *jsb_cocos2d_ParticleSystem3D_prototype;
+
+bool js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem : Invalid Native Object");
+ if (argc == 0) {
+ cobj->resumeParticleSystem();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem : Invalid Native Object");
+ if (argc == 0) {
+ cobj->startParticleSystem();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled : Invalid Native Object");
+ if (argc == 0) {
+ bool ret = cobj->isEnabled();
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal : Invalid Native Object");
+ if (argc == 0) {
+ bool ret = cobj->isKeepLocal();
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled : Error processing arguments");
+ cobj->setEnabled(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getParticleQuota();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getBlendFunc(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getBlendFunc : Invalid Native Object");
+ if (argc == 0) {
+ const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
+ jsval jsret = JSVAL_NULL;
+ jsret = blendfunc_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_pauseParticleSystem(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_pauseParticleSystem : Invalid Native Object");
+ if (argc == 0) {
+ cobj->pauseParticleSystem();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_pauseParticleSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getState(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cocos2d::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getState : Invalid Native Object");
+ if (argc == 0) {
+ int ret = (int)cobj->getState();
+ jsval jsret = JSVAL_NULL;
+ jsret = int32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getState : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getAliveParticleCount(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getAliveParticleCount : Invalid Native Object");
+ if (argc == 0) {
+ int ret = cobj->getAliveParticleCount();
+ jsval jsret = JSVAL_NULL;
+ jsret = int32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getAliveParticleCount : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota : Error processing arguments");
+ cobj->setParticleQuota(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::BlendFunc arg0;
+ ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc : Error processing arguments");
+ cobj->setBlendFunc(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_stopParticleSystem(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_stopParticleSystem : Invalid Native Object");
+ if (argc == 0) {
+ cobj->stopParticleSystem();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_stopParticleSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal : Error processing arguments");
+ cobj->setKeepLocal(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_ParticleSystem3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::ParticleSystem3D* cobj = new (std::nothrow) cocos2d::ParticleSystem3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ParticleSystem3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_Node_prototype;
+
+void js_cocos2d_ParticleSystem3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (ParticleSystem3D)", obj);
+}
+
+void js_register_cocos2dx_3d_extension_ParticleSystem3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_ParticleSystem3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_ParticleSystem3D_class->name = "ParticleSystem3D";
+ jsb_cocos2d_ParticleSystem3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_ParticleSystem3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_ParticleSystem3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_ParticleSystem3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_ParticleSystem3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_ParticleSystem3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_ParticleSystem3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_ParticleSystem3D_class->finalize = js_cocos2d_ParticleSystem3D_finalize;
+ jsb_cocos2d_ParticleSystem3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("resumeParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("startParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isKeepLocal", js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getParticleQuota", js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getBlendFunc", js_cocos2dx_3d_extension_ParticleSystem3D_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("pauseParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_pauseParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getState", js_cocos2dx_3d_extension_ParticleSystem3D_getState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getAliveParticleCount", js_cocos2dx_3d_extension_ParticleSystem3D_getAliveParticleCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setParticleQuota", js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setBlendFunc", js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("stopParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_stopParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setKeepLocal", js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ JSFunctionSpec *st_funcs = NULL;
+
+ jsb_cocos2d_ParticleSystem3D_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
+ jsb_cocos2d_ParticleSystem3D_class,
+ js_cocos2dx_3d_extension_ParticleSystem3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "ParticleSystem3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_ParticleSystem3D_class;
+ p->proto = jsb_cocos2d_ParticleSystem3D_prototype;
+ p->parentProto = jsb_cocos2d_Node_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+JSClass *jsb_cocos2d_PUParticleSystem3D_class;
+JSObject *jsb_cocos2d_PUParticleSystem3D_prototype;
+
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getParticleSystemScaleVelocity(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getParticleSystemScaleVelocity : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getParticleSystemScaleVelocity();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getParticleSystemScaleVelocity : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota : Error processing arguments");
+ cobj->setEmittedSystemQuota(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultDepth(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultDepth : Invalid Native Object");
+ if (argc == 0) {
+ const float ret = cobj->getDefaultDepth();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultDepth : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedSystemQuota(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedSystemQuota : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getEmittedSystemQuota();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedSystemQuota : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_clearAllParticles(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_clearAllParticles : Invalid Native Object");
+ if (argc == 0) {
+ cobj->clearAllParticles();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_clearAllParticles : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getMaterialName(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getMaterialName : Invalid Native Object");
+ if (argc == 0) {
+ const std::string ret = cobj->getMaterialName();
+ jsval jsret = JSVAL_NULL;
+ jsret = std_string_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getMaterialName : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_calulateRotationOffset(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_calulateRotationOffset : Invalid Native Object");
+ if (argc == 0) {
+ cobj->calulateRotationOffset();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_calulateRotationOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getMaxVelocity(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getMaxVelocity : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getMaxVelocity();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getMaxVelocity : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate : Error processing arguments");
+ cobj->forceUpdate(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getTimeElapsedSinceStart(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getTimeElapsedSinceStart : Invalid Native Object");
+ if (argc == 0) {
+ double ret = cobj->getTimeElapsedSinceStart();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getTimeElapsedSinceStart : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedEmitterQuota(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedEmitterQuota : Invalid Native Object");
+ if (argc == 0) {
+ unsigned int ret = cobj->getEmittedEmitterQuota();
+ jsval jsret = JSVAL_NULL;
+ jsret = uint32_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedEmitterQuota : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_isMarkedForEmission(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_isMarkedForEmission : Invalid Native Object");
+ if (argc == 0) {
+ bool ret = cobj->isMarkedForEmission();
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_isMarkedForEmission : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultWidth(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultWidth : Invalid Native Object");
+ if (argc == 0) {
+ const float ret = cobj->getDefaultWidth();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota : Invalid Native Object");
+ if (argc == 1) {
+ unsigned int arg0;
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota : Error processing arguments");
+ cobj->setEmittedEmitterQuota(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission : Error processing arguments");
+ cobj->setMarkedForEmission(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_clone(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_clone : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::PUParticleSystem3D* ret = cobj->clone();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PUParticleSystem3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth : Error processing arguments");
+ cobj->setDefaultWidth(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::PUParticleSystem3D* arg0;
+ do {
+ 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::PUParticleSystem3D*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo : Error processing arguments");
+ cobj->copyAttributesTo(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName : Error processing arguments");
+ cobj->setMaterialName(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getParentParticleSystem(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getParentParticleSystem : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::PUParticleSystem3D* ret = cobj->getParentParticleSystem();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PUParticleSystem3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getParentParticleSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity : Error processing arguments");
+ cobj->setMaxVelocity(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultHeight(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultHeight : Invalid Native Object");
+ if (argc == 0) {
+ const float ret = cobj->getDefaultHeight();
+ jsval jsret = JSVAL_NULL;
+ jsret = DOUBLE_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultHeight : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedPosition(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedPosition : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Vec3 ret = cobj->getDerivedPosition();
+ jsval jsret = JSVAL_NULL;
+ jsret = vector3_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Vec3 arg0;
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset : Error processing arguments");
+ cobj->rotationOffset(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedOrientation(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedOrientation : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Quaternion ret = cobj->getDerivedOrientation();
+ jsval jsret = JSVAL_NULL;
+ jsret = quaternion_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedOrientation : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllEmitter(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllEmitter : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeAllEmitter();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllEmitter : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity : Error processing arguments");
+ cobj->setParticleSystemScaleVelocity(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Vec3 ret = cobj->getDerivedScale();
+ jsval jsret = JSVAL_NULL;
+ jsret = vector3_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight : Error processing arguments");
+ cobj->setDefaultHeight(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener : Invalid Native Object");
+ if (argc == 0) {
+ cobj->removeAllListener();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : Error processing arguments");
+ bool ret = cobj->initSystem(arg0);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth(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::PUParticleSystem3D* cobj = (cocos2d::PUParticleSystem3D *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth : Error processing arguments");
+ cobj->setDefaultDepth(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_create(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ do {
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::PUParticleSystem3D* ret = cocos2d::PUParticleSystem3D::create(arg0);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PUParticleSystem3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 0) {
+ cocos2d::PUParticleSystem3D* ret = cocos2d::PUParticleSystem3D::create();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PUParticleSystem3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 2) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ if (!ok) { ok = true; break; }
+ std::string arg1;
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::PUParticleSystem3D* ret = cocos2d::PUParticleSystem3D::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::PUParticleSystem3D*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+ JS_ReportError(cx, "js_cocos2dx_3d_extension_PUParticleSystem3D_create : wrong number of arguments");
+ return false;
+}
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ cocos2d::PUParticleSystem3D* cobj = new (std::nothrow) cocos2d::PUParticleSystem3D();
+ cocos2d::Ref *_ccobj = dynamic_cast(cobj);
+ if (_ccobj) {
+ _ccobj->autorelease();
+ }
+ TypeTest t;
+ js_type_class_t *typeClass = nullptr;
+ std::string typeName = t.s_name();
+ auto typeMapIter = _js_global_type_map.find(typeName);
+ CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
+ typeClass = typeMapIter->second;
+ CCASSERT(typeClass, "The value is null.");
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
+ // link the native object with the javascript object
+ js_proxy_t* p = jsb_new_proxy(cobj, obj);
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::PUParticleSystem3D");
+ if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ return true;
+}
+
+
+extern JSObject *jsb_cocos2d_ParticleSystem3D_prototype;
+
+void js_cocos2d_PUParticleSystem3D_finalize(JSFreeOp *fop, JSObject *obj) {
+ CCLOGINFO("jsbindings: finalizing JS object %p (PUParticleSystem3D)", obj);
+}
+
+void js_register_cocos2dx_3d_extension_PUParticleSystem3D(JSContext *cx, JS::HandleObject global) {
+ jsb_cocos2d_PUParticleSystem3D_class = (JSClass *)calloc(1, sizeof(JSClass));
+ jsb_cocos2d_PUParticleSystem3D_class->name = "PUParticleSystem3D";
+ jsb_cocos2d_PUParticleSystem3D_class->addProperty = JS_PropertyStub;
+ jsb_cocos2d_PUParticleSystem3D_class->delProperty = JS_DeletePropertyStub;
+ jsb_cocos2d_PUParticleSystem3D_class->getProperty = JS_PropertyStub;
+ jsb_cocos2d_PUParticleSystem3D_class->setProperty = JS_StrictPropertyStub;
+ jsb_cocos2d_PUParticleSystem3D_class->enumerate = JS_EnumerateStub;
+ jsb_cocos2d_PUParticleSystem3D_class->resolve = JS_ResolveStub;
+ jsb_cocos2d_PUParticleSystem3D_class->convert = JS_ConvertStub;
+ jsb_cocos2d_PUParticleSystem3D_class->finalize = js_cocos2d_PUParticleSystem3D_finalize;
+ jsb_cocos2d_PUParticleSystem3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
+
+ static JSPropertySpec properties[] = {
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
+ };
+
+ static JSFunctionSpec funcs[] = {
+ JS_FN("getParticleSystemScaleVelocity", js_cocos2dx_3d_extension_PUParticleSystem3D_getParticleSystemScaleVelocity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setEmittedSystemQuota", js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDefaultDepth", js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultDepth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getEmittedSystemQuota", js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedSystemQuota, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("clearAllParticles", js_cocos2dx_3d_extension_PUParticleSystem3D_clearAllParticles, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMaterialName", js_cocos2dx_3d_extension_PUParticleSystem3D_getMaterialName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("calulateRotationOffset", js_cocos2dx_3d_extension_PUParticleSystem3D_calulateRotationOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getMaxVelocity", js_cocos2dx_3d_extension_PUParticleSystem3D_getMaxVelocity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("forceUpdate", js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getTimeElapsedSinceStart", js_cocos2dx_3d_extension_PUParticleSystem3D_getTimeElapsedSinceStart, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getEmittedEmitterQuota", js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedEmitterQuota, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isMarkedForEmission", js_cocos2dx_3d_extension_PUParticleSystem3D_isMarkedForEmission, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDefaultWidth", js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setEmittedEmitterQuota", js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setMarkedForEmission", js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("clone", js_cocos2dx_3d_extension_PUParticleSystem3D_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setDefaultWidth", js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("copyAttributesTo", js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setMaterialName", js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getParentParticleSystem", js_cocos2dx_3d_extension_PUParticleSystem3D_getParentParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setMaxVelocity", js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDefaultHeight", js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDerivedPosition", js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("rotationOffset", js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDerivedOrientation", js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedOrientation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeAllEmitter", js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllEmitter, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setParticleSystemScaleVelocity", js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDerivedScale", js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setDefaultHeight", js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("removeAllListener", js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("initSystem", js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setDefaultDepth", js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ static JSFunctionSpec st_funcs[] = {
+ JS_FN("create", js_cocos2dx_3d_extension_PUParticleSystem3D_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FS_END
+ };
+
+ jsb_cocos2d_PUParticleSystem3D_prototype = JS_InitClass(
+ cx, global,
+ JS::RootedObject(cx, jsb_cocos2d_ParticleSystem3D_prototype),
+ jsb_cocos2d_PUParticleSystem3D_class,
+ js_cocos2dx_3d_extension_PUParticleSystem3D_constructor, 0, // constructor
+ properties,
+ funcs,
+ NULL, // no static properties
+ st_funcs);
+ // make the class enumerable in the registered namespace
+// bool found;
+//FIXME: Removed in Firefox v27
+// JS_SetPropertyAttributes(cx, global, "PUParticleSystem3D", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
+
+ // add the proto and JSClass to the type->js info hash table
+ TypeTest t;
+ js_type_class_t *p;
+ std::string typeName = t.s_name();
+ if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
+ {
+ p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
+ p->jsclass = jsb_cocos2d_PUParticleSystem3D_class;
+ p->proto = jsb_cocos2d_PUParticleSystem3D_prototype;
+ p->parentProto = jsb_cocos2d_ParticleSystem3D_prototype;
+ _js_global_type_map.insert(std::make_pair(typeName, p));
+ }
+}
+
+void register_all_cocos2dx_3d_extension(JSContext* cx, JS::HandleObject obj) {
+ // Get the ns
+ JS::RootedObject ns(cx);
+ get_or_create_js_obj(cx, obj, "jsb", &ns);
+
+ js_register_cocos2dx_3d_extension_ParticleSystem3D(cx, ns);
+ js_register_cocos2dx_3d_extension_PUParticleSystem3D(cx, ns);
+}
+
diff --git a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp
new file mode 100644
index 0000000000..e299d97b2f
--- /dev/null
+++ b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp
@@ -0,0 +1,73 @@
+#ifndef __cocos2dx_3d_extension_h__
+#define __cocos2dx_3d_extension_h__
+
+#include "jsapi.h"
+#include "jsfriendapi.h"
+
+
+extern JSClass *jsb_cocos2d_ParticleSystem3D_class;
+extern JSObject *jsb_cocos2d_ParticleSystem3D_prototype;
+
+bool js_cocos2dx_3d_extension_ParticleSystem3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_extension_ParticleSystem3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_extension_ParticleSystem3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d_extension(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_pauseParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getState(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_getAliveParticleCount(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setParticleQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_stopParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_setKeepLocal(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_ParticleSystem3D_ParticleSystem3D(JSContext *cx, uint32_t argc, jsval *vp);
+
+extern JSClass *jsb_cocos2d_PUParticleSystem3D_class;
+extern JSObject *jsb_cocos2d_PUParticleSystem3D_prototype;
+
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_constructor(JSContext *cx, uint32_t argc, jsval *vp);
+void js_cocos2dx_3d_extension_PUParticleSystem3D_finalize(JSContext *cx, JSObject *obj);
+void js_register_cocos2dx_3d_extension_PUParticleSystem3D(JSContext *cx, JS::HandleObject global);
+void register_all_cocos2dx_3d_extension(JSContext* cx, JS::HandleObject obj);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getParticleSystemScaleVelocity(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedSystemQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultDepth(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedSystemQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_clearAllParticles(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getMaterialName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_calulateRotationOffset(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getMaxVelocity(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_forceUpdate(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getTimeElapsedSinceStart(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getEmittedEmitterQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_isMarkedForEmission(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultWidth(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setEmittedEmitterQuota(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMarkedForEmission(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_clone(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultWidth(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_copyAttributesTo(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMaterialName(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getParentParticleSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setMaxVelocity(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDefaultHeight(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedPosition(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_rotationOffset(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedOrientation(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllEmitter(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setParticleSystemScaleVelocity(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_getDerivedScale(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultHeight(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_removeAllListener(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_initSystem(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_setDefaultDepth(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_create(JSContext *cx, uint32_t argc, jsval *vp);
+bool js_cocos2dx_3d_extension_PUParticleSystem3D_PUParticleSystem3D(JSContext *cx, uint32_t argc, jsval *vp);
+#endif
+
diff --git a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_auto.cpp b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_auto.cpp
index b77e207551..d24a9359b6 100644
--- a/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_auto.cpp
+++ b/frameworks/js-bindings/bindings/auto/jsb_cocos2dx_auto.cpp
@@ -3,13 +3,15 @@
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
#include "CCProtectedNode.h"
+#include "CCAsyncTaskPool.h"
template
static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedValue initializing(cx);
bool isNewValid = true;
- JSObject* global = ScriptingCore::getInstance()->getGlobalObject();
- isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && JSVAL_TO_BOOLEAN(initializing);
+ JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject());
+ isNewValid = JS_GetProperty(cx, global, "initializing", &initializing) && initializing.toBoolean();
if (isNewValid)
{
TypeTest t;
@@ -20,8 +22,11 @@ static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *_tmp = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject _tmp(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+
+ args.rval().set(OBJECT_TO_JSVAL(_tmp));
return true;
}
@@ -33,9 +38,10 @@ static bool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
return false;
}
-static bool js_is_native_obj(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
+static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp)
{
- vp.set(BOOLEAN_TO_JSVAL(true));
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ args.rval().setBoolean(true);
return true;
}
JSClass *jsb_cocos2d_Configuration_class;
@@ -43,20 +49,20 @@ JSObject *jsb_cocos2d_Configuration_prototype;
bool js_cocos2dx_Configuration_checkForGLExtension(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_checkForGLExtension : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_checkForGLExtension : Error processing arguments");
bool ret = cobj->checkForGLExtension(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -65,7 +71,8 @@ bool js_cocos2dx_Configuration_checkForGLExtension(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Configuration_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_init : Invalid Native Object");
@@ -73,7 +80,7 @@ bool js_cocos2dx_Configuration_init(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -82,7 +89,8 @@ bool js_cocos2dx_Configuration_init(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsS3TC : Invalid Native Object");
@@ -90,7 +98,7 @@ bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->supportsS3TC();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -99,7 +107,8 @@ bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsPVRTC : Invalid Native Object");
@@ -107,7 +116,7 @@ bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->supportsPVRTC();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -116,7 +125,8 @@ bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Configuration_supportsShareableVAO(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsShareableVAO : Invalid Native Object");
@@ -124,7 +134,7 @@ bool js_cocos2dx_Configuration_supportsShareableVAO(JSContext *cx, uint32_t argc
bool ret = cobj->supportsShareableVAO();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -133,7 +143,8 @@ bool js_cocos2dx_Configuration_supportsShareableVAO(JSContext *cx, uint32_t argc
}
bool js_cocos2dx_Configuration_getInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getInfo : Invalid Native Object");
@@ -141,7 +152,7 @@ bool js_cocos2dx_Configuration_getInfo(JSContext *cx, uint32_t argc, jsval *vp)
std::string ret = cobj->getInfo();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -150,7 +161,8 @@ bool js_cocos2dx_Configuration_getInfo(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Configuration_getMaxSupportSpotLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportSpotLightInShader : Invalid Native Object");
@@ -158,7 +170,7 @@ bool js_cocos2dx_Configuration_getMaxSupportSpotLightInShader(JSContext *cx, uin
int ret = cobj->getMaxSupportSpotLightInShader();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -167,7 +179,8 @@ bool js_cocos2dx_Configuration_getMaxSupportSpotLightInShader(JSContext *cx, uin
}
bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxTextureUnits : Invalid Native Object");
@@ -175,7 +188,7 @@ bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc,
int ret = cobj->getMaxTextureUnits();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -184,7 +197,8 @@ bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Configuration_supportsNPOT(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsNPOT : Invalid Native Object");
@@ -192,7 +206,7 @@ bool js_cocos2dx_Configuration_supportsNPOT(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->supportsNPOT();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -201,7 +215,8 @@ bool js_cocos2dx_Configuration_supportsNPOT(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxModelviewStackDepth : Invalid Native Object");
@@ -209,7 +224,7 @@ bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t
int ret = cobj->getMaxModelviewStackDepth();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -218,7 +233,8 @@ bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t
}
bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsDiscardFramebuffer : Invalid Native Object");
@@ -226,7 +242,7 @@ bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_
bool ret = cobj->supportsDiscardFramebuffer();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -235,7 +251,8 @@ bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_
}
bool js_cocos2dx_Configuration_supportsATITC(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsATITC : Invalid Native Object");
@@ -243,7 +260,7 @@ bool js_cocos2dx_Configuration_supportsATITC(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->supportsATITC();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -252,20 +269,20 @@ bool js_cocos2dx_Configuration_supportsATITC(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Configuration_setValue(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_setValue : Invalid Native Object");
if (argc == 2) {
std::string arg0;
cocos2d::Value arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- ok &= jsval_to_ccvalue(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_ccvalue(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_setValue : Error processing arguments");
cobj->setValue(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -274,13 +291,14 @@ bool js_cocos2dx_Configuration_setValue(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Configuration_gatherGPUInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_gatherGPUInfo : Invalid Native Object");
if (argc == 0) {
cobj->gatherGPUInfo();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -289,7 +307,8 @@ bool js_cocos2dx_Configuration_gatherGPUInfo(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Configuration_supportsETC(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsETC : Invalid Native Object");
@@ -297,7 +316,7 @@ bool js_cocos2dx_Configuration_supportsETC(JSContext *cx, uint32_t argc, jsval *
bool ret = cobj->supportsETC();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -306,7 +325,8 @@ bool js_cocos2dx_Configuration_supportsETC(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Configuration_getMaxSupportDirLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportDirLightInShader : Invalid Native Object");
@@ -314,7 +334,7 @@ bool js_cocos2dx_Configuration_getMaxSupportDirLightInShader(JSContext *cx, uint
int ret = cobj->getMaxSupportDirLightInShader();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -323,7 +343,8 @@ bool js_cocos2dx_Configuration_getMaxSupportDirLightInShader(JSContext *cx, uint
}
bool js_cocos2dx_Configuration_getMaxSupportPointLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportPointLightInShader : Invalid Native Object");
@@ -331,7 +352,7 @@ bool js_cocos2dx_Configuration_getMaxSupportPointLightInShader(JSContext *cx, ui
int ret = cobj->getMaxSupportPointLightInShader();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -340,18 +361,18 @@ bool js_cocos2dx_Configuration_getMaxSupportPointLightInShader(JSContext *cx, ui
}
bool js_cocos2dx_Configuration_loadConfigFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_loadConfigFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_loadConfigFile : Error processing arguments");
cobj->loadConfigFile(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -360,32 +381,32 @@ bool js_cocos2dx_Configuration_loadConfigFile(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Configuration_getValue(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getValue : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_getValue : Error processing arguments");
const cocos2d::Value& ret = cobj->getValue(arg0);
jsval jsret = JSVAL_NULL;
jsret = ccvalue_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
std::string arg0;
cocos2d::Value arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- ok &= jsval_to_ccvalue(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_ccvalue(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_getValue : Error processing arguments");
const cocos2d::Value& ret = cobj->getValue(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = ccvalue_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -394,7 +415,8 @@ bool js_cocos2dx_Configuration_getValue(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Configuration_getMaxTextureSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxTextureSize : Invalid Native Object");
@@ -402,7 +424,7 @@ bool js_cocos2dx_Configuration_getMaxTextureSize(JSContext *cx, uint32_t argc, j
int ret = cobj->getMaxTextureSize();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -411,7 +433,8 @@ bool js_cocos2dx_Configuration_getMaxTextureSize(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_Configuration_supportsBGRA8888(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsBGRA8888 : Invalid Native Object");
@@ -419,7 +442,7 @@ bool js_cocos2dx_Configuration_supportsBGRA8888(JSContext *cx, uint32_t argc, js
bool ret = cobj->supportsBGRA8888();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -428,9 +451,10 @@ bool js_cocos2dx_Configuration_supportsBGRA8888(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Configuration_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Configuration::destroyInstance();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Configuration_destroyInstance : wrong number of arguments");
@@ -439,6 +463,7 @@ bool js_cocos2dx_Configuration_destroyInstance(JSContext *cx, uint32_t argc, jsv
bool js_cocos2dx_Configuration_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Configuration* ret = cocos2d::Configuration::getInstance();
jsval jsret = JSVAL_NULL;
@@ -450,7 +475,7 @@ bool js_cocos2dx_Configuration_getInstance(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Configuration_getInstance : wrong number of arguments");
@@ -463,7 +488,7 @@ void js_cocos2d_Configuration_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Configuration)", obj);
}
-void js_register_cocos2dx_Configuration(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Configuration_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Configuration_class->name = "Configuration";
jsb_cocos2d_Configuration_class->addProperty = JS_PropertyStub;
@@ -477,8 +502,8 @@ void js_register_cocos2dx_Configuration(JSContext *cx, JSObject *global) {
jsb_cocos2d_Configuration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -514,7 +539,7 @@ void js_register_cocos2dx_Configuration(JSContext *cx, JSObject *global) {
jsb_cocos2d_Configuration_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Configuration_class,
empty_constructor, 0,
properties,
@@ -545,7 +570,8 @@ JSObject *jsb_cocos2d_Texture2D_prototype;
bool js_cocos2dx_Texture2D_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getGLProgram : Invalid Native Object");
@@ -560,7 +586,7 @@ bool js_cocos2dx_Texture2D_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -569,7 +595,8 @@ bool js_cocos2dx_Texture2D_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_getMaxT(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getMaxT : Invalid Native Object");
@@ -577,7 +604,7 @@ bool js_cocos2dx_Texture2D_getMaxT(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getMaxT();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -586,7 +613,8 @@ bool js_cocos2dx_Texture2D_getMaxT(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_getStringForFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getStringForFormat : Invalid Native Object");
@@ -594,7 +622,7 @@ bool js_cocos2dx_Texture2D_getStringForFormat(JSContext *cx, uint32_t argc, jsva
const char* ret = cobj->getStringForFormat();
jsval jsret = JSVAL_NULL;
jsret = c_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -603,12 +631,12 @@ bool js_cocos2dx_Texture2D_getStringForFormat(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Texture2D* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithImage : Invalid Native Object");
@@ -616,21 +644,21 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp
if (argc == 2) {
cocos2d::Image* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Texture2D::PixelFormat arg1;
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithImage(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -639,9 +667,9 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp
if (argc == 1) {
cocos2d::Image* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -650,7 +678,7 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->initWithImage(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -660,25 +688,25 @@ bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setGLProgram : Invalid Native Object");
if (argc == 1) {
cocos2d::GLProgram* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setGLProgram : Error processing arguments");
cobj->setGLProgram(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -687,7 +715,8 @@ bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getMaxS : Invalid Native Object");
@@ -695,7 +724,7 @@ bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getMaxS();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -704,13 +733,14 @@ bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_releaseGLTexture : Invalid Native Object");
if (argc == 0) {
cobj->releaseGLTexture();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -719,7 +749,8 @@ bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_hasPremultipliedAlpha : Invalid Native Object");
@@ -727,7 +758,7 @@ bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, j
bool ret = cobj->hasPremultipliedAlpha();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -736,9 +767,9 @@ bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Invalid Native Object");
@@ -750,15 +781,15 @@ bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *
int arg4;
#pragma warning NO CONVERSION TO NATIVE FOR _MipmapInfo*
ok = false;
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
- ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
- ok &= jsval_to_int32(cx, argv[3], (int32_t *)&arg3);
- ok &= jsval_to_int32(cx, argv[4], (int32_t *)&arg4);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
+ ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
+ ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Error processing arguments");
bool ret = cobj->initWithMipmaps(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -767,7 +798,8 @@ bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelsHigh : Invalid Native Object");
@@ -775,7 +807,7 @@ bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp
int ret = cobj->getPixelsHigh();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -784,24 +816,24 @@ bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Texture2D* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getBitsPerPixelForFormat : Invalid Native Object");
do {
if (argc == 1) {
cocos2d::Texture2D::PixelFormat arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
if (!ok) { ok = true; break; }
unsigned int ret = cobj->getBitsPerPixelForFormat(arg0);
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -811,7 +843,7 @@ bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc
unsigned int ret = cobj->getBitsPerPixelForFormat();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -821,7 +853,8 @@ bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc
}
bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getName : Invalid Native Object");
@@ -829,7 +862,7 @@ bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp)
unsigned int ret = cobj->getName();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -838,27 +871,27 @@ bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Texture2D* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithString : Invalid Native Object");
do {
if (argc == 2) {
const char* arg0;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = true; break; }
cocos2d::FontDefinition arg1;
- ok &= jsval_to_FontDefinition(cx, argv[1], &arg1);
+ ok &= jsval_to_FontDefinition(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithString(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -866,18 +899,18 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 3) {
const char* arg0;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = true; break; }
std::string arg1;
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithString(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -885,21 +918,21 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 4) {
const char* arg0;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = true; break; }
std::string arg1;
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::Size arg3;
- ok &= jsval_to_ccsize(cx, argv[3], &arg3);
+ ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -907,24 +940,24 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 5) {
const char* arg0;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = true; break; }
std::string arg1;
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::Size arg3;
- ok &= jsval_to_ccsize(cx, argv[3], &arg3);
+ ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::TextHAlignment arg4;
- ok &= jsval_to_int32(cx, argv[4], (int32_t *)&arg4);
+ ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -932,27 +965,27 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 6) {
const char* arg0;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
if (!ok) { ok = true; break; }
std::string arg1;
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::Size arg3;
- ok &= jsval_to_ccsize(cx, argv[3], &arg3);
+ ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::TextHAlignment arg4;
- ok &= jsval_to_int32(cx, argv[4], (int32_t *)&arg4);
+ ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
if (!ok) { ok = true; break; }
cocos2d::TextVAlignment arg5;
- ok &= jsval_to_int32(cx, argv[5], (int32_t *)&arg5);
+ ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -962,18 +995,18 @@ bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxT : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxT : Error processing arguments");
cobj->setMaxT(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -982,18 +1015,18 @@ bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_drawInRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_drawInRect : Invalid Native Object");
if (argc == 1) {
cocos2d::Rect arg0;
- ok &= jsval_to_ccrect(cx, argv[0], &arg0);
+ ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_drawInRect : Error processing arguments");
cobj->drawInRect(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1002,7 +1035,8 @@ bool js_cocos2dx_Texture2D_drawInRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getContentSize : Invalid Native Object");
@@ -1010,7 +1044,7 @@ bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *v
cocos2d::Size ret = cobj->getContentSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1019,13 +1053,14 @@ bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setAliasTexParameters : Invalid Native Object");
if (argc == 0) {
cobj->setAliasTexParameters();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1034,13 +1069,14 @@ bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_Texture2D_setAntiAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setAntiAliasTexParameters : Invalid Native Object");
if (argc == 0) {
cobj->setAntiAliasTexParameters();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1049,13 +1085,14 @@ bool js_cocos2dx_Texture2D_setAntiAliasTexParameters(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_Texture2D_generateMipmap(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_generateMipmap : Invalid Native Object");
if (argc == 0) {
cobj->generateMipmap();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1064,7 +1101,8 @@ bool js_cocos2dx_Texture2D_generateMipmap(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Texture2D_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getDescription : Invalid Native Object");
@@ -1072,7 +1110,7 @@ bool js_cocos2dx_Texture2D_getDescription(JSContext *cx, uint32_t argc, jsval *v
std::string ret = cobj->getDescription();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1081,7 +1119,8 @@ bool js_cocos2dx_Texture2D_getDescription(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Texture2D_getPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelFormat : Invalid Native Object");
@@ -1089,7 +1128,7 @@ bool js_cocos2dx_Texture2D_getPixelFormat(JSContext *cx, uint32_t argc, jsval *v
int ret = (int)cobj->getPixelFormat();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1098,7 +1137,8 @@ bool js_cocos2dx_Texture2D_getPixelFormat(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Texture2D_getContentSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getContentSizeInPixels : Invalid Native Object");
@@ -1106,7 +1146,7 @@ bool js_cocos2dx_Texture2D_getContentSizeInPixels(JSContext *cx, uint32_t argc,
const cocos2d::Size& ret = cobj->getContentSizeInPixels();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1115,7 +1155,8 @@ bool js_cocos2dx_Texture2D_getContentSizeInPixels(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Texture2D_getPixelsWide(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelsWide : Invalid Native Object");
@@ -1123,7 +1164,7 @@ bool js_cocos2dx_Texture2D_getPixelsWide(JSContext *cx, uint32_t argc, jsval *vp
int ret = cobj->getPixelsWide();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1132,18 +1173,18 @@ bool js_cocos2dx_Texture2D_getPixelsWide(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Texture2D_drawAtPoint(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_drawAtPoint : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_drawAtPoint : Error processing arguments");
cobj->drawAtPoint(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1152,7 +1193,8 @@ bool js_cocos2dx_Texture2D_drawAtPoint(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_hasMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_hasMipmaps : Invalid Native Object");
@@ -1160,7 +1202,7 @@ bool js_cocos2dx_Texture2D_hasMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->hasMipmaps();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1169,18 +1211,18 @@ bool js_cocos2dx_Texture2D_hasMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_setMaxS(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxS : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxS : Error processing arguments");
cobj->setMaxS(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1189,14 +1231,14 @@ bool js_cocos2dx_Texture2D_setMaxS(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Texture2D::PixelFormat arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat : Error processing arguments");
cocos2d::Texture2D::setDefaultAlphaPixelFormat(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat : wrong number of arguments");
@@ -1205,11 +1247,12 @@ bool js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat(JSContext *cx, uint32_t ar
bool js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
int ret = (int)cocos2d::Texture2D::getDefaultAlphaPixelFormat();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat : wrong number of arguments");
@@ -1218,7 +1261,7 @@ bool js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat(JSContext *cx, uint32_t ar
bool js_cocos2dx_Texture2D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Texture2D* cobj = new (std::nothrow) cocos2d::Texture2D();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -1232,13 +1275,16 @@ bool js_cocos2dx_Texture2D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Texture2D");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Texture2D");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -1248,7 +1294,7 @@ void js_cocos2d_Texture2D_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Texture2D)", obj);
}
-void js_register_cocos2dx_Texture2D(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Texture2D_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Texture2D_class->name = "Texture2D";
jsb_cocos2d_Texture2D_class->addProperty = JS_PropertyStub;
@@ -1262,8 +1308,8 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Texture2D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -1304,7 +1350,7 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Texture2D_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Texture2D_class,
js_cocos2dx_Texture2D_constructor, 0, // constructor
properties,
@@ -1335,7 +1381,8 @@ JSObject *jsb_cocos2d_Touch_prototype;
bool js_cocos2dx_Touch_getPreviousLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getPreviousLocationInView : Invalid Native Object");
@@ -1343,7 +1390,7 @@ bool js_cocos2dx_Touch_getPreviousLocationInView(JSContext *cx, uint32_t argc, j
cocos2d::Vec2 ret = cobj->getPreviousLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1352,7 +1399,8 @@ bool js_cocos2dx_Touch_getPreviousLocationInView(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_Touch_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getLocation : Invalid Native Object");
@@ -1360,7 +1408,7 @@ bool js_cocos2dx_Touch_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec2 ret = cobj->getLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1369,7 +1417,8 @@ bool js_cocos2dx_Touch_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Touch_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getDelta : Invalid Native Object");
@@ -1377,7 +1426,7 @@ bool js_cocos2dx_Touch_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec2 ret = cobj->getDelta();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1386,7 +1435,8 @@ bool js_cocos2dx_Touch_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Touch_getStartLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getStartLocationInView : Invalid Native Object");
@@ -1394,7 +1444,7 @@ bool js_cocos2dx_Touch_getStartLocationInView(JSContext *cx, uint32_t argc, jsva
cocos2d::Vec2 ret = cobj->getStartLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1403,7 +1453,8 @@ bool js_cocos2dx_Touch_getStartLocationInView(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Touch_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getStartLocation : Invalid Native Object");
@@ -1411,7 +1462,7 @@ bool js_cocos2dx_Touch_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec2 ret = cobj->getStartLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1420,7 +1471,8 @@ bool js_cocos2dx_Touch_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Touch_getID(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getID : Invalid Native Object");
@@ -1428,7 +1480,7 @@ bool js_cocos2dx_Touch_getID(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getID();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1437,9 +1489,9 @@ bool js_cocos2dx_Touch_getID(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_setTouchInfo : Invalid Native Object");
@@ -1447,12 +1499,12 @@ bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp)
int arg0;
double arg1;
double arg2;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Touch_setTouchInfo : Error processing arguments");
cobj->setTouchInfo(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1461,7 +1513,8 @@ bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Touch_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getLocationInView : Invalid Native Object");
@@ -1469,7 +1522,7 @@ bool js_cocos2dx_Touch_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Vec2 ret = cobj->getLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1478,7 +1531,8 @@ bool js_cocos2dx_Touch_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Touch_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getPreviousLocation : Invalid Native Object");
@@ -1486,7 +1540,7 @@ bool js_cocos2dx_Touch_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *
cocos2d::Vec2 ret = cobj->getPreviousLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1495,7 +1549,7 @@ bool js_cocos2dx_Touch_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Touch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Touch* cobj = new (std::nothrow) cocos2d::Touch();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -1509,13 +1563,16 @@ bool js_cocos2dx_Touch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Touch");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Touch");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -1525,7 +1582,7 @@ void js_cocos2d_Touch_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Touch)", obj);
}
-void js_register_cocos2dx_Touch(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Touch(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Touch_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Touch_class->name = "Touch";
jsb_cocos2d_Touch_class->addProperty = JS_PropertyStub;
@@ -1539,8 +1596,8 @@ void js_register_cocos2dx_Touch(JSContext *cx, JSObject *global) {
jsb_cocos2d_Touch_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -1560,7 +1617,7 @@ void js_register_cocos2dx_Touch(JSContext *cx, JSObject *global) {
jsb_cocos2d_Touch_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Touch_class,
js_cocos2dx_Touch_constructor, 0, // constructor
properties,
@@ -1591,7 +1648,8 @@ JSObject *jsb_cocos2d_Event_prototype;
bool js_cocos2dx_Event_isStopped(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_isStopped : Invalid Native Object");
@@ -1599,7 +1657,7 @@ bool js_cocos2dx_Event_isStopped(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isStopped();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1608,7 +1666,8 @@ bool js_cocos2dx_Event_isStopped(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Event_getType(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_getType : Invalid Native Object");
@@ -1616,7 +1675,7 @@ bool js_cocos2dx_Event_getType(JSContext *cx, uint32_t argc, jsval *vp)
int ret = (int)cobj->getType();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1625,7 +1684,8 @@ bool js_cocos2dx_Event_getType(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Event_getCurrentTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_getCurrentTarget : Invalid Native Object");
@@ -1640,7 +1700,7 @@ bool js_cocos2dx_Event_getCurrentTarget(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1649,13 +1709,14 @@ bool js_cocos2dx_Event_getCurrentTarget(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Event_stopPropagation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_stopPropagation : Invalid Native Object");
if (argc == 0) {
cobj->stopPropagation();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1664,10 +1725,10 @@ bool js_cocos2dx_Event_stopPropagation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Event_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Event::Type arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Event_constructor : Error processing arguments");
cocos2d::Event* cobj = new (std::nothrow) cocos2d::Event(arg0);
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -1681,13 +1742,16 @@ bool js_cocos2dx_Event_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Event");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Event");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -1697,7 +1761,7 @@ void js_cocos2d_Event_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Event)", obj);
}
-void js_register_cocos2dx_Event(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Event(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Event_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Event_class->name = "Event";
jsb_cocos2d_Event_class->addProperty = JS_PropertyStub;
@@ -1711,8 +1775,8 @@ void js_register_cocos2dx_Event(JSContext *cx, JSObject *global) {
jsb_cocos2d_Event_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -1727,7 +1791,7 @@ void js_register_cocos2dx_Event(JSContext *cx, JSObject *global) {
jsb_cocos2d_Event_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Event_class,
js_cocos2dx_Event_constructor, 0, // constructor
properties,
@@ -1758,7 +1822,8 @@ JSObject *jsb_cocos2d_EventTouch_prototype;
bool js_cocos2dx_EventTouch_getEventCode(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventTouch* cobj = (cocos2d::EventTouch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventTouch_getEventCode : Invalid Native Object");
@@ -1766,7 +1831,7 @@ bool js_cocos2dx_EventTouch_getEventCode(JSContext *cx, uint32_t argc, jsval *vp
int ret = (int)cobj->getEventCode();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -1775,18 +1840,18 @@ bool js_cocos2dx_EventTouch_getEventCode(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_EventTouch_setEventCode(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventTouch* cobj = (cocos2d::EventTouch *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventTouch_setEventCode : Invalid Native Object");
if (argc == 1) {
cocos2d::EventTouch::EventCode arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventTouch_setEventCode : Error processing arguments");
cobj->setEventCode(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -1795,7 +1860,7 @@ bool js_cocos2dx_EventTouch_setEventCode(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_EventTouch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventTouch* cobj = new (std::nothrow) cocos2d::EventTouch();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -1809,13 +1874,16 @@ bool js_cocos2dx_EventTouch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventTouch");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventTouch");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -1826,7 +1894,7 @@ void js_cocos2d_EventTouch_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventTouch)", obj);
}
-void js_register_cocos2dx_EventTouch(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventTouch(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventTouch_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventTouch_class->name = "EventTouch";
jsb_cocos2d_EventTouch_class->addProperty = JS_PropertyStub;
@@ -1840,8 +1908,8 @@ void js_register_cocos2dx_EventTouch(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventTouch_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -1854,7 +1922,7 @@ void js_register_cocos2dx_EventTouch(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventTouch_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Event_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Event_prototype),
jsb_cocos2d_EventTouch_class,
js_cocos2dx_EventTouch_constructor, 0, // constructor
properties,
@@ -1880,110 +1948,17 @@ void js_register_cocos2dx_EventTouch(JSContext *cx, JSObject *global) {
}
}
-JSClass *jsb_cocos2d_EventKeyboard_class;
-JSObject *jsb_cocos2d_EventKeyboard_prototype;
-
-bool js_cocos2dx_EventKeyboard_constructor(JSContext *cx, uint32_t argc, jsval *vp)
-{
- jsval *argv = JS_ARGV(cx, vp);
- bool ok = true;
- cocos2d::EventKeyboard::KeyCode arg0;
- bool arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventKeyboard_constructor : Error processing arguments");
- cocos2d::EventKeyboard* cobj = new (std::nothrow) cocos2d::EventKeyboard(arg0, arg1);
- cocos2d::Ref *_ccobj = dynamic_cast(cobj);
- if (_ccobj) {
- _ccobj->autorelease();
- }
- TypeTest t;
- js_type_class_t *typeClass = nullptr;
- std::string typeName = t.s_name();
- auto typeMapIter = _js_global_type_map.find(typeName);
- CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
- typeClass = typeMapIter->second;
- CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
- // link the native object with the javascript object
- js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventKeyboard");
- if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- return true;
-}
-
-
-extern JSObject *jsb_cocos2d_Event_prototype;
-
-void js_cocos2d_EventKeyboard_finalize(JSFreeOp *fop, JSObject *obj) {
- CCLOGINFO("jsbindings: finalizing JS object %p (EventKeyboard)", obj);
-}
-
-void js_register_cocos2dx_EventKeyboard(JSContext *cx, JSObject *global) {
- jsb_cocos2d_EventKeyboard_class = (JSClass *)calloc(1, sizeof(JSClass));
- jsb_cocos2d_EventKeyboard_class->name = "EventKeyboard";
- jsb_cocos2d_EventKeyboard_class->addProperty = JS_PropertyStub;
- jsb_cocos2d_EventKeyboard_class->delProperty = JS_DeletePropertyStub;
- jsb_cocos2d_EventKeyboard_class->getProperty = JS_PropertyStub;
- jsb_cocos2d_EventKeyboard_class->setProperty = JS_StrictPropertyStub;
- jsb_cocos2d_EventKeyboard_class->enumerate = JS_EnumerateStub;
- jsb_cocos2d_EventKeyboard_class->resolve = JS_ResolveStub;
- jsb_cocos2d_EventKeyboard_class->convert = JS_ConvertStub;
- jsb_cocos2d_EventKeyboard_class->finalize = js_cocos2d_EventKeyboard_finalize;
- jsb_cocos2d_EventKeyboard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
-
- static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
- };
-
- static JSFunctionSpec funcs[] = {
- JS_FS_END
- };
-
- JSFunctionSpec *st_funcs = NULL;
-
- jsb_cocos2d_EventKeyboard_prototype = JS_InitClass(
- cx, global,
- jsb_cocos2d_Event_prototype,
- jsb_cocos2d_EventKeyboard_class,
- js_cocos2dx_EventKeyboard_constructor, 0, // constructor
- properties,
- funcs,
- NULL, // no static properties
- st_funcs);
- // make the class enumerable in the registered namespace
-// bool found;
-//FIXME: Removed in Firefox v27
-// JS_SetPropertyAttributes(cx, global, "EventKeyboard", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
-
- // add the proto and JSClass to the type->js info hash table
- TypeTest t;
- js_type_class_t *p;
- std::string typeName = t.s_name();
- if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
- {
- p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
- p->jsclass = jsb_cocos2d_EventKeyboard_class;
- p->proto = jsb_cocos2d_EventKeyboard_prototype;
- p->parentProto = jsb_cocos2d_Event_prototype;
- _js_global_type_map.insert(std::make_pair(typeName, p));
- }
-}
-
JSClass *jsb_cocos2d_Node_class;
JSObject *jsb_cocos2d_Node_prototype;
bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addChild : Invalid Native Object");
@@ -1991,19 +1966,19 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 2) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
int arg1;
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
if (!ok) { ok = true; break; }
cobj->addChild(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -2012,16 +1987,16 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cobj->addChild(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -2030,22 +2005,22 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 3) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
int arg1;
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
if (!ok) { ok = true; break; }
int arg2;
- ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
if (!ok) { ok = true; break; }
cobj->addChild(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -2054,22 +2029,22 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 3) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
int arg1;
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
if (!ok) { ok = true; break; }
std::string arg2;
- ok &= jsval_to_std_string(cx, argv[2], &arg2);
+ ok &= jsval_to_std_string(cx, args.get(2), &arg2);
if (!ok) { ok = true; break; }
cobj->addChild(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -2079,12 +2054,12 @@ bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeComponent : Invalid Native Object");
@@ -2092,9 +2067,9 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 1) {
cocos2d::Component* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -2103,7 +2078,7 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->removeComponent(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -2111,12 +2086,12 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
bool ret = cobj->removeComponent(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -2126,25 +2101,25 @@ bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPhysicsBody : Invalid Native Object");
if (argc == 1) {
cocos2d::PhysicsBody* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::PhysicsBody*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPhysicsBody : Error processing arguments");
cobj->setPhysicsBody(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2153,7 +2128,8 @@ bool js_cocos2dx_Node_setPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGLProgram : Invalid Native Object");
@@ -2168,16 +2144,39 @@ bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_Node_updateTransformFromPhysics(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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateTransformFromPhysics : Invalid Native Object");
+ if (argc == 2) {
+ cocos2d::Mat4 arg0;
+ unsigned int arg1;
+ ok &= jsval_to_matrix(cx, args.get(0), &arg0);
+ ok &= jsval_to_uint32(cx, args.get(1), &arg1);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateTransformFromPhysics : Error processing arguments");
+ cobj->updateTransformFromPhysics(arg0, arg1);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Node_updateTransformFromPhysics : wrong number of arguments: %d, was expecting %d", argc, 2);
+ return false;
+}
bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDescription : Invalid Native Object");
@@ -2185,7 +2184,7 @@ bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
std::string ret = cobj->getDescription();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2194,18 +2193,18 @@ bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOpacityModifyRGB : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOpacityModifyRGB : Error processing arguments");
cobj->setOpacityModifyRGB(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2214,18 +2213,18 @@ bool js_cocos2dx_Node_setOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Node_setCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCascadeOpacityEnabled : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCascadeOpacityEnabled : Error processing arguments");
cobj->setCascadeOpacityEnabled(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2234,12 +2233,12 @@ bool js_cocos2dx_Node_setCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildren : Invalid Native Object");
@@ -2248,7 +2247,7 @@ bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vector& ret = cobj->getChildren();
jsval jsret = JSVAL_NULL;
jsret = ccvector_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -2258,7 +2257,7 @@ bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vector& ret = cobj->getChildren();
jsval jsret = JSVAL_NULL;
jsret = ccvector_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -2268,21 +2267,22 @@ bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOnExitCallback : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=]() -> void {
- jsval rval;
- bool ok = func->invoke(0, nullptr, rval);
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(0, nullptr, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -2297,7 +2297,7 @@ bool js_cocos2dx_Node_setOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOnExitCallback : Error processing arguments");
cobj->setOnExitCallback(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2306,20 +2306,20 @@ bool js_cocos2dx_Node_setOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_convertToWorldSpaceAR(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToWorldSpaceAR : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToWorldSpaceAR : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToWorldSpaceAR(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2328,7 +2328,8 @@ bool js_cocos2dx_Node_convertToWorldSpaceAR(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Node_isIgnoreAnchorPointForPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isIgnoreAnchorPointForPosition : Invalid Native Object");
@@ -2336,7 +2337,7 @@ bool js_cocos2dx_Node_isIgnoreAnchorPointForPosition(JSContext *cx, uint32_t arg
bool ret = cobj->isIgnoreAnchorPointForPosition();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2345,15 +2346,15 @@ bool js_cocos2dx_Node_isIgnoreAnchorPointForPosition(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_Node_getChildByName(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildByName : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getChildByName : Error processing arguments");
cocos2d::Node* ret = cobj->getChildByName(arg0);
jsval jsret = JSVAL_NULL;
@@ -2365,7 +2366,7 @@ bool js_cocos2dx_Node_getChildByName(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2374,18 +2375,18 @@ bool js_cocos2dx_Node_getChildByName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_updateDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateDisplayedOpacity : Invalid Native Object");
if (argc == 1) {
uint16_t arg0;
- ok &= jsval_to_uint16(cx, argv[0], &arg0);
+ ok &= jsval_to_uint16(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateDisplayedOpacity : Error processing arguments");
cobj->updateDisplayedOpacity(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2394,7 +2395,8 @@ bool js_cocos2dx_Node_updateDisplayedOpacity(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Node_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_init : Invalid Native Object");
@@ -2402,7 +2404,7 @@ bool js_cocos2dx_Node_init(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2411,7 +2413,8 @@ bool js_cocos2dx_Node_init(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getCameraMask : Invalid Native Object");
@@ -2419,7 +2422,7 @@ bool js_cocos2dx_Node_getCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
unsigned short ret = cobj->getCameraMask();
jsval jsret = JSVAL_NULL;
jsret = ushort_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2428,18 +2431,18 @@ bool js_cocos2dx_Node_getCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setRotation(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotation : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotation : Error processing arguments");
cobj->setRotation(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2448,18 +2451,18 @@ bool js_cocos2dx_Node_setRotation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleZ : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleZ : Error processing arguments");
cobj->setScaleZ(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2468,18 +2471,18 @@ bool js_cocos2dx_Node_setScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setScaleY(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleY : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleY : Error processing arguments");
cobj->setScaleY(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2488,18 +2491,18 @@ bool js_cocos2dx_Node_setScaleY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setScaleX(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleX : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleX : Error processing arguments");
cobj->setScaleX(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2508,7 +2511,8 @@ bool js_cocos2dx_Node_setScaleX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getColor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getColor : Invalid Native Object");
@@ -2516,7 +2520,7 @@ bool js_cocos2dx_Node_getColor(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Color3B& ret = cobj->getColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor3b_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2525,21 +2529,22 @@ bool js_cocos2dx_Node_getColor(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=]() -> void {
- jsval rval;
- bool ok = func->invoke(0, nullptr, rval);
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(0, nullptr, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -2554,7 +2559,7 @@ bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint3
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : Error processing arguments");
cobj->setonEnterTransitionDidFinishCallback(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2563,13 +2568,14 @@ bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint3
}
bool js_cocos2dx_Node_removeFromPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeFromPhysicsWorld : Invalid Native Object");
if (argc == 0) {
cobj->removeFromPhysicsWorld();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2578,13 +2584,14 @@ bool js_cocos2dx_Node_removeFromPhysicsWorld(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeAllComponents : Invalid Native Object");
if (argc == 0) {
cobj->removeAllComponents();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2593,7 +2600,8 @@ bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOpacity : Invalid Native Object");
@@ -2601,7 +2609,7 @@ bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp)
uint16_t ret = cobj->getOpacity();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2610,28 +2618,28 @@ bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCameraMask : Invalid Native Object");
if (argc == 1) {
unsigned short arg0;
- ok &= jsval_to_ushort(cx, argv[0], &arg0);
+ ok &= jsval_to_ushort(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCameraMask : Error processing arguments");
cobj->setCameraMask(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
unsigned short arg0;
bool arg1;
- ok &= jsval_to_ushort(cx, argv[0], &arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ ok &= jsval_to_ushort(cx, args.get(0), &arg0);
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCameraMask : Error processing arguments");
cobj->setCameraMask(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2640,7 +2648,8 @@ bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getTag : Invalid Native Object");
@@ -2648,7 +2657,7 @@ bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getTag();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2657,7 +2666,8 @@ bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : Invalid Native Object");
@@ -2665,50 +2675,53 @@ bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint3
const std::function& ret = cobj->getonEnterTransitionDidFinishCallback();
jsval jsret = JSVAL_NULL;
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldAffineTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isOpacityModifyRGB : Invalid Native Object");
if (argc == 0) {
- cocos2d::AffineTransform ret = cobj->getNodeToWorldAffineTransform();
+ bool ret = cobj->isOpacityModifyRGB();
jsval jsret = JSVAL_NULL;
- jsret = ccaffinetransform_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_isOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_getNodeToWorldTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldAffineTransform : Invalid Native Object");
if (argc == 0) {
- cocos2d::Mat4 ret = cobj->getNodeToWorldTransform();
+ cocos2d::AffineTransform ret = cobj->getNodeToWorldAffineTransform();
jsval jsret = JSVAL_NULL;
- jsret = matrix_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = ccaffinetransform_to_jsval(cx, ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_getPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition3D : Invalid Native Object");
@@ -2716,7 +2729,7 @@ bool js_cocos2dx_Node_getPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec3 ret = cobj->getPosition3D();
jsval jsret = JSVAL_NULL;
jsret = vector3_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2725,42 +2738,42 @@ bool js_cocos2dx_Node_getPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChild : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChild : Error processing arguments");
cobj->removeChild(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
cocos2d::Node* arg0;
bool arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChild : Error processing arguments");
cobj->removeChild(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2769,20 +2782,20 @@ bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_convertToWorldSpace(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToWorldSpace : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToWorldSpace : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToWorldSpace(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2791,7 +2804,8 @@ bool js_cocos2dx_Node_convertToWorldSpace(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScene : Invalid Native Object");
@@ -2806,7 +2820,7 @@ bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2815,7 +2829,8 @@ bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getEventDispatcher : Invalid Native Object");
@@ -2830,7 +2845,7 @@ bool js_cocos2dx_Node_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -2839,18 +2854,18 @@ bool js_cocos2dx_Node_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Node_setSkewX(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewX : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewX : Error processing arguments");
cobj->setSkewX(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2859,25 +2874,25 @@ bool js_cocos2dx_Node_setSkewX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgramState : Invalid Native Object");
if (argc == 1) {
cocos2d::GLProgramState* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGLProgramState : Error processing arguments");
cobj->setGLProgramState(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2886,21 +2901,22 @@ bool js_cocos2dx_Node_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOnEnterCallback : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=]() -> void {
- jsval rval;
- bool ok = func->invoke(0, nullptr, rval);
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(0, nullptr, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -2915,7 +2931,7 @@ bool js_cocos2dx_Node_setOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOnEnterCallback : Error processing arguments");
cobj->setOnEnterCallback(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2924,18 +2940,18 @@ bool js_cocos2dx_Node_setOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Node_setNormalizedPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setNormalizedPosition : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setNormalizedPosition : Error processing arguments");
cobj->setNormalizedPosition(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2944,21 +2960,22 @@ bool js_cocos2dx_Node_setNormalizedPosition(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Node_setonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setonExitTransitionDidStartCallback : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=]() -> void {
- jsval rval;
- bool ok = func->invoke(0, nullptr, rval);
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(0, nullptr, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -2973,7 +2990,7 @@ bool js_cocos2dx_Node_setonExitTransitionDidStartCallback(JSContext *cx, uint32_
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setonExitTransitionDidStartCallback : Error processing arguments");
cobj->setonExitTransitionDidStartCallback(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -2982,18 +2999,18 @@ bool js_cocos2dx_Node_setonExitTransitionDidStartCallback(JSContext *cx, uint32_
}
bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpace : Invalid Native Object");
if (argc == 1) {
cocos2d::Touch* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Touch*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -3002,7 +3019,7 @@ bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsva
cocos2d::Vec2 ret = cobj->convertTouchToNodeSpace(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3011,21 +3028,21 @@ bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeAllChildrenWithCleanup : Invalid Native Object");
do {
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
cobj->removeAllChildrenWithCleanup(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -3033,7 +3050,7 @@ bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc,
do {
if (argc == 0) {
cobj->removeAllChildren();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -3043,7 +3060,8 @@ bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Node_getRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationSkewX : Invalid Native Object");
@@ -3051,7 +3069,7 @@ bool js_cocos2dx_Node_getRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getRotationSkewX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3060,7 +3078,8 @@ bool js_cocos2dx_Node_getRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationSkewY : Invalid Native Object");
@@ -3068,33 +3087,35 @@ bool js_cocos2dx_Node_getRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getRotationSkewY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getRotationSkewY : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getNodeToWorldTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldTransform : Invalid Native Object");
if (argc == 0) {
- cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform();
+ cocos2d::Mat4 ret = cobj->getNodeToWorldTransform();
jsval jsret = JSVAL_NULL;
- jsret = ccaffinetransform_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = matrix_to_jsval(cx, ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isCascadeOpacityEnabled : Invalid Native Object");
@@ -3102,7 +3123,7 @@ bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsva
bool ret = cobj->isCascadeOpacityEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3111,25 +3132,25 @@ bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setParent : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setParent : Error processing arguments");
cobj->setParent(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3138,7 +3159,8 @@ bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getName : Invalid Native Object");
@@ -3146,7 +3168,7 @@ bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp)
std::string ret = cobj->getName();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3155,7 +3177,8 @@ bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotation3D : Invalid Native Object");
@@ -3163,44 +3186,45 @@ bool js_cocos2dx_Node_getRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec3 ret = cobj->getRotation3D();
jsval jsret = JSVAL_NULL;
jsret = vector3_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getRotation3D : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object");
if (argc == 0) {
- const cocos2d::Mat4& ret = cobj->getNodeToParentTransform();
+ cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform();
jsval jsret = JSVAL_NULL;
- jsret = matrix_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = ccaffinetransform_to_jsval(cx, ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpaceAR : Invalid Native Object");
if (argc == 1) {
cocos2d::Touch* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Touch*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -3209,7 +3233,7 @@ bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, js
cocos2d::Vec2 ret = cobj->convertTouchToNodeSpaceAR(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3218,7 +3242,8 @@ bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnEnterCallback : Invalid Native Object");
@@ -3226,7 +3251,7 @@ bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp
const std::function& ret = cobj->getOnEnterCallback();
jsval jsret = JSVAL_NULL;
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3235,7 +3260,8 @@ bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPhysicsBody : Invalid Native Object");
@@ -3250,7 +3276,7 @@ bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3259,18 +3285,18 @@ bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopActionByTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopActionByTag : Error processing arguments");
cobj->stopActionByTag(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3279,9 +3305,9 @@ bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_reorderChild : Invalid Native Object");
@@ -3289,17 +3315,17 @@ bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Node* arg0;
int arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_reorderChild : Error processing arguments");
cobj->reorderChild(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3308,18 +3334,18 @@ bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_ignoreAnchorPointForPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_ignoreAnchorPointForPosition : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_ignoreAnchorPointForPosition : Error processing arguments");
cobj->ignoreAnchorPointForPosition(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3328,18 +3354,18 @@ bool js_cocos2dx_Node_ignoreAnchorPointForPosition(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Node_setSkewY(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewY : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewY : Error processing arguments");
cobj->setSkewY(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3348,18 +3374,18 @@ bool js_cocos2dx_Node_setSkewY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotation3D : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec3 arg0;
- ok &= jsval_to_vector3(cx, argv[0], &arg0);
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotation3D : Error processing arguments");
cobj->setRotation3D(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3368,18 +3394,18 @@ bool js_cocos2dx_Node_setRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setPositionX(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionX : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionX : Error processing arguments");
cobj->setPositionX(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3388,18 +3414,18 @@ bool js_cocos2dx_Node_setPositionX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setNodeToParentTransform : Invalid Native Object");
if (argc == 1) {
cocos2d::Mat4 arg0;
- ok &= jsval_to_matrix(cx, argv[0], &arg0);
+ ok &= jsval_to_matrix(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setNodeToParentTransform : Error processing arguments");
cobj->setNodeToParentTransform(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3408,7 +3434,8 @@ bool js_cocos2dx_Node_setNodeToParentTransform(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Node_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getAnchorPoint : Invalid Native Object");
@@ -3416,7 +3443,7 @@ bool js_cocos2dx_Node_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec2& ret = cobj->getAnchorPoint();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3425,7 +3452,8 @@ bool js_cocos2dx_Node_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getNumberOfRunningActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNumberOfRunningActions : Invalid Native Object");
@@ -3433,7 +3461,7 @@ bool js_cocos2dx_Node_getNumberOfRunningActions(JSContext *cx, uint32_t argc, js
ssize_t ret = cobj->getNumberOfRunningActions();
jsval jsret = JSVAL_NULL;
jsret = ssize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3442,13 +3470,14 @@ bool js_cocos2dx_Node_getNumberOfRunningActions(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Node_updateTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateTransform : Invalid Native Object");
if (argc == 0) {
cobj->updateTransform();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3457,7 +3486,8 @@ bool js_cocos2dx_Node_updateTransform(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_isVisible(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isVisible : Invalid Native Object");
@@ -3465,7 +3495,7 @@ bool js_cocos2dx_Node_isVisible(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isVisible();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3474,7 +3504,8 @@ bool js_cocos2dx_Node_isVisible(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getChildrenCount(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildrenCount : Invalid Native Object");
@@ -3482,29 +3513,47 @@ bool js_cocos2dx_Node_getChildrenCount(JSContext *cx, uint32_t argc, jsval *vp)
ssize_t ret = cobj->getChildrenCount();
jsval jsret = JSVAL_NULL;
jsret = ssize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getChildrenCount : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object");
+ if (argc == 0) {
+ const cocos2d::Mat4& ret = cobj->getNodeToParentTransform();
+ jsval jsret = JSVAL_NULL;
+ jsret = matrix_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
bool js_cocos2dx_Node_convertToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToNodeSpaceAR : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToNodeSpaceAR : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToNodeSpaceAR(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3513,18 +3562,18 @@ bool js_cocos2dx_Node_convertToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Node_addComponent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addComponent : Invalid Native Object");
if (argc == 1) {
cocos2d::Component* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -3533,7 +3582,7 @@ bool js_cocos2dx_Node_addComponent(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->addComponent(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3542,18 +3591,18 @@ bool js_cocos2dx_Node_addComponent(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_runAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_runAction : Invalid Native Object");
if (argc == 1) {
cocos2d::Action* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -3569,34 +3618,80 @@ bool js_cocos2dx_Node_runAction(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_runAction : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
+bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+
+ JS::RootedObject obj(cx);
+ cocos2d::Node* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_visit : Invalid Native Object");
+ do {
+ if (argc == 0) {
+ cobj->visit();
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ do {
+ if (argc == 3) {
+ cocos2d::Renderer* arg0;
+ do {
+ 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::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Mat4 arg1;
+ ok &= jsval_to_matrix(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ unsigned int arg2;
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
+ if (!ok) { ok = true; break; }
+ cobj->visit(arg0, arg1, arg2);
+ args.rval().setUndefined();
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_Node_visit : wrong number of arguments");
+ return false;
+}
bool js_cocos2dx_Node_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgram : Invalid Native Object");
if (argc == 1) {
cocos2d::GLProgram* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGLProgram : Error processing arguments");
cobj->setGLProgram(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3605,7 +3700,8 @@ bool js_cocos2dx_Node_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getRotation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotation : Invalid Native Object");
@@ -3613,7 +3709,7 @@ bool js_cocos2dx_Node_getRotation(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getRotation();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3622,7 +3718,8 @@ bool js_cocos2dx_Node_getRotation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getAnchorPointInPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getAnchorPointInPoints : Invalid Native Object");
@@ -3630,83 +3727,55 @@ bool js_cocos2dx_Node_getAnchorPointInPoints(JSContext *cx, uint32_t argc, jsval
const cocos2d::Vec2& ret = cobj->getAnchorPointInPoints();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getAnchorPointInPoints : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getRotationQuat(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- bool ok = true;
-
- JSObject *obj = NULL;
- cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_visit : Invalid Native Object");
- do {
- if (argc == 0) {
- cobj->visit();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
- return true;
- }
- } while(0);
-
- do {
- if (argc == 3) {
- cocos2d::Renderer* arg0;
- do {
- if (!argv[0].isObject()) { ok = false; break; }
- js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
- jsProxy = jsb_get_js_proxy(tmpObj);
- arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
- JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
- } while (0);
- if (!ok) { ok = true; break; }
- cocos2d::Mat4 arg1;
- ok &= jsval_to_matrix(cx, argv[1], &arg1);
- if (!ok) { ok = true; break; }
- unsigned int arg2;
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
- if (!ok) { ok = true; break; }
- cobj->visit(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
- return true;
- }
- } while(0);
+ cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationQuat : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Quaternion ret = cobj->getRotationQuat();
+ jsval jsret = JSVAL_NULL;
+ jsret = quaternion_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
- JS_ReportError(cx, "js_cocos2dx_Node_visit : wrong number of arguments");
+ JS_ReportError(cx, "js_cocos2dx_Node_getRotationQuat : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_removeChildByName(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChildByName : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByName : Error processing arguments");
cobj->removeChildByName(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
std::string arg0;
bool arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByName : Error processing arguments");
cobj->removeChildByName(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3715,18 +3784,18 @@ bool js_cocos2dx_Node_removeChildByName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionZ : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionZ : Error processing arguments");
cobj->setPositionZ(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3735,7 +3804,8 @@ bool js_cocos2dx_Node_setPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGLProgramState : Invalid Native Object");
@@ -3750,7 +3820,7 @@ bool js_cocos2dx_Node_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3759,25 +3829,25 @@ bool js_cocos2dx_Node_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScheduler : Invalid Native Object");
if (argc == 1) {
cocos2d::Scheduler* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Scheduler*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScheduler : Error processing arguments");
cobj->setScheduler(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3786,13 +3856,14 @@ bool js_cocos2dx_Node_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_stopAllActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAllActions : Invalid Native Object");
if (argc == 0) {
cobj->stopAllActions();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3801,7 +3872,8 @@ bool js_cocos2dx_Node_stopAllActions(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getSkewX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getSkewX : Invalid Native Object");
@@ -3809,7 +3881,7 @@ bool js_cocos2dx_Node_getSkewX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getSkewX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3818,7 +3890,8 @@ bool js_cocos2dx_Node_getSkewX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getSkewY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getSkewY : Invalid Native Object");
@@ -3826,7 +3899,7 @@ bool js_cocos2dx_Node_getSkewY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getSkewY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3835,20 +3908,20 @@ bool js_cocos2dx_Node_getSkewY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_isScheduled(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isScheduled : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_isScheduled : Error processing arguments");
bool ret = cobj->isScheduled(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3857,7 +3930,8 @@ bool js_cocos2dx_Node_isScheduled(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDisplayedColor : Invalid Native Object");
@@ -3865,7 +3939,7 @@ bool js_cocos2dx_Node_getDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Color3B& ret = cobj->getDisplayedColor();
jsval jsret = JSVAL_NULL;
jsret = cccolor3b_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3874,15 +3948,15 @@ bool js_cocos2dx_Node_getDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getActionByTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getActionByTag : Error processing arguments");
cocos2d::Action* ret = cobj->getActionByTag(arg0);
jsval jsret = JSVAL_NULL;
@@ -3894,7 +3968,7 @@ bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -3903,18 +3977,18 @@ bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewX : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewX : Error processing arguments");
cobj->setRotationSkewX(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3923,18 +3997,18 @@ bool js_cocos2dx_Node_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewY : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewY : Error processing arguments");
cobj->setRotationSkewY(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -3943,70 +4017,54 @@ bool js_cocos2dx_Node_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setName(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setName : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setName : Error processing arguments");
cobj->setName(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
-bool js_cocos2dx_Node_setAdditionalTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_updatePhysicsBodyTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
-
- JSObject *obj = NULL;
- cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setAdditionalTransform : Invalid Native Object");
- do {
- if (argc == 1) {
- cocos2d::AffineTransform arg0;
- ok &= jsval_to_ccaffinetransform(cx, argv[0], &arg0);
- if (!ok) { ok = true; break; }
- cobj->setAdditionalTransform(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
- return true;
- }
- } while(0);
-
- do {
- if (argc == 1) {
- cocos2d::Mat4* arg0;
- do {
- if (!argv[0].isObject()) { ok = false; break; }
- js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
- jsProxy = jsb_get_js_proxy(tmpObj);
- arg0 = (cocos2d::Mat4*)(jsProxy ? jsProxy->ptr : NULL);
- JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
- } while (0);
- if (!ok) { ok = true; break; }
- cobj->setAdditionalTransform(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
- return true;
- }
- } while(0);
+ cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updatePhysicsBodyTransform : Invalid Native Object");
+ if (argc == 4) {
+ cocos2d::Mat4 arg0;
+ unsigned int arg1;
+ double arg2;
+ double arg3;
+ ok &= jsval_to_matrix(cx, args.get(0), &arg0);
+ ok &= jsval_to_uint32(cx, args.get(1), &arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updatePhysicsBodyTransform : Error processing arguments");
+ cobj->updatePhysicsBodyTransform(arg0, arg1, arg2, arg3);
+ args.rval().setUndefined();
+ return true;
+ }
- JS_ReportError(cx, "js_cocos2dx_Node_setAdditionalTransform : wrong number of arguments");
+ JS_ReportError(cx, "js_cocos2dx_Node_updatePhysicsBodyTransform : wrong number of arguments: %d, was expecting %d", argc, 4);
return false;
}
bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDisplayedOpacity : Invalid Native Object");
@@ -4014,7 +4072,7 @@ bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *v
uint16_t ret = cobj->getDisplayedOpacity();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4023,7 +4081,8 @@ bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getLocalZOrder : Invalid Native Object");
@@ -4031,7 +4090,7 @@ bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getLocalZOrder();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4040,12 +4099,12 @@ bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScheduler : Invalid Native Object");
@@ -4061,7 +4120,7 @@ bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -4078,7 +4137,7 @@ bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -4086,26 +4145,10 @@ bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Node_getScheduler : wrong number of arguments");
return false;
}
-bool js_cocos2dx_Node_getParentToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
-{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
- js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeAffineTransform : Invalid Native Object");
- if (argc == 0) {
- cocos2d::AffineTransform ret = cobj->getParentToNodeAffineTransform();
- jsval jsret = JSVAL_NULL;
- jsret = ccaffinetransform_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
-
- JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
- return false;
-}
bool js_cocos2dx_Node_getOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOrderOfArrival : Invalid Native Object");
@@ -4113,7 +4156,7 @@ bool js_cocos2dx_Node_getOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getOrderOfArrival();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4122,25 +4165,25 @@ bool js_cocos2dx_Node_getOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setActionManager(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setActionManager : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionManager* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionManager*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setActionManager : Error processing arguments");
cobj->setActionManager(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4149,12 +4192,12 @@ bool js_cocos2dx_Node_setActionManager(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition : Invalid Native Object");
@@ -4169,7 +4212,7 @@ bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
ok = false;
if (!ok) { ok = true; break; }
cobj->getPosition(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4179,7 +4222,7 @@ bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec2& ret = cobj->getPosition();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -4189,7 +4232,8 @@ bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_isRunning(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isRunning : Invalid Native Object");
@@ -4197,7 +4241,7 @@ bool js_cocos2dx_Node_isRunning(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isRunning();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4206,12 +4250,12 @@ bool js_cocos2dx_Node_isRunning(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParent : Invalid Native Object");
@@ -4227,7 +4271,7 @@ bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -4244,7 +4288,7 @@ bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -4252,9 +4296,28 @@ bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_Node_getParent : wrong number of arguments");
return false;
}
+bool js_cocos2dx_Node_getWorldToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeTransform : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Mat4 ret = cobj->getWorldToNodeTransform();
+ jsval jsret = JSVAL_NULL;
+ jsret = matrix_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
bool js_cocos2dx_Node_getPositionY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionY : Invalid Native Object");
@@ -4262,7 +4325,7 @@ bool js_cocos2dx_Node_getPositionY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getPositionY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4271,7 +4334,8 @@ bool js_cocos2dx_Node_getPositionY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getPositionX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionX : Invalid Native Object");
@@ -4279,7 +4343,7 @@ bool js_cocos2dx_Node_getPositionX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getPositionX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4288,28 +4352,28 @@ bool js_cocos2dx_Node_getPositionX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_removeChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChildByTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByTag : Error processing arguments");
cobj->removeChildByTag(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
int arg0;
bool arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByTag : Error processing arguments");
cobj->removeChildByTag(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4318,18 +4382,18 @@ bool js_cocos2dx_Node_removeChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setPositionY(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionY : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionY : Error processing arguments");
cobj->setPositionY(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4338,18 +4402,18 @@ bool js_cocos2dx_Node_setPositionY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_updateDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateDisplayedColor : Invalid Native Object");
if (argc == 1) {
cocos2d::Color3B arg0;
- ok &= jsval_to_cccolor3b(cx, argv[0], &arg0);
+ ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateDisplayedColor : Error processing arguments");
cobj->updateDisplayedColor(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4358,44 +4422,46 @@ bool js_cocos2dx_Node_updateDisplayedColor(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Node_setVisible(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setVisible : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setVisible : Error processing arguments");
cobj->setVisible(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_setVisible : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
-bool js_cocos2dx_Node_getParentToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getParentToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeAffineTransform : Invalid Native Object");
if (argc == 0) {
- const cocos2d::Mat4& ret = cobj->getParentToNodeTransform();
+ cocos2d::AffineTransform ret = cobj->getParentToNodeAffineTransform();
jsval jsret = JSVAL_NULL;
- jsret = matrix_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = ccaffinetransform_to_jsval(cx, ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionZ : Invalid Native Object");
@@ -4403,7 +4469,7 @@ bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getPositionZ();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4412,18 +4478,18 @@ bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Error processing arguments");
cobj->setGlobalZOrder(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4432,25 +4498,25 @@ bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScale : Invalid Native Object");
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cobj->setScale(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4458,10 +4524,10 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
cobj->setScale(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4471,7 +4537,8 @@ bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnExitCallback : Invalid Native Object");
@@ -4479,7 +4546,7 @@ bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
const std::function& ret = cobj->getOnExitCallback();
jsval jsret = JSVAL_NULL;
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4488,15 +4555,15 @@ bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildByTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getChildByTag : Error processing arguments");
cocos2d::Node* ret = cobj->getChildByTag(arg0);
jsval jsret = JSVAL_NULL;
@@ -4508,7 +4575,7 @@ bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4517,18 +4584,18 @@ bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOrderOfArrival : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOrderOfArrival : Error processing arguments");
cobj->setOrderOfArrival(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4537,7 +4604,8 @@ bool js_cocos2dx_Node_setOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleZ : Invalid Native Object");
@@ -4545,7 +4613,7 @@ bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScaleZ();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4554,7 +4622,8 @@ bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleY : Invalid Native Object");
@@ -4562,7 +4631,7 @@ bool js_cocos2dx_Node_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScaleY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4571,7 +4640,8 @@ bool js_cocos2dx_Node_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleX : Invalid Native Object");
@@ -4579,7 +4649,7 @@ bool js_cocos2dx_Node_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScaleX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4588,55 +4658,38 @@ bool js_cocos2dx_Node_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setLocalZOrder : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setLocalZOrder : Error processing arguments");
cobj->setLocalZOrder(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_setLocalZOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
-bool js_cocos2dx_Node_getWorldToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
-{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
- js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeAffineTransform : Invalid Native Object");
- if (argc == 0) {
- cocos2d::AffineTransform ret = cobj->getWorldToNodeAffineTransform();
- jsval jsret = JSVAL_NULL;
- jsret = ccaffinetransform_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
-
- JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
- return false;
-}
bool js_cocos2dx_Node_setCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCascadeColorEnabled : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCascadeColorEnabled : Error processing arguments");
cobj->setCascadeColorEnabled(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4645,18 +4698,18 @@ bool js_cocos2dx_Node_setCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Node_setOpacity(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOpacity : Invalid Native Object");
if (argc == 1) {
uint16_t arg0;
- ok &= jsval_to_uint16(cx, argv[0], &arg0);
+ ok &= jsval_to_uint16(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOpacity : Error processing arguments");
cobj->setOpacity(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4665,13 +4718,14 @@ bool js_cocos2dx_Node_setOpacity(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_cleanup : Invalid Native Object");
if (argc == 0) {
cobj->cleanup();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4680,15 +4734,15 @@ bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getComponent : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getComponent : Error processing arguments");
cocos2d::Component* ret = cobj->getComponent(arg0);
jsval jsret = JSVAL_NULL;
@@ -4700,7 +4754,7 @@ bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4709,7 +4763,8 @@ bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getContentSize : Invalid Native Object");
@@ -4717,7 +4772,7 @@ bool js_cocos2dx_Node_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Size& ret = cobj->getContentSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4726,18 +4781,18 @@ bool js_cocos2dx_Node_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_stopAllActionsByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Error processing arguments");
cobj->stopAllActionsByTag(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4746,7 +4801,8 @@ bool js_cocos2dx_Node_stopAllActionsByTag(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Node_getBoundingBox(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getBoundingBox : Invalid Native Object");
@@ -4754,7 +4810,7 @@ bool js_cocos2dx_Node_getBoundingBox(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Rect ret = cobj->getBoundingBox();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4763,25 +4819,25 @@ bool js_cocos2dx_Node_getBoundingBox(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setEventDispatcher : Invalid Native Object");
if (argc == 1) {
cocos2d::EventDispatcher* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventDispatcher*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setEventDispatcher : Error processing arguments");
cobj->setEventDispatcher(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4790,7 +4846,8 @@ bool js_cocos2dx_Node_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGlobalZOrder : Invalid Native Object");
@@ -4798,7 +4855,7 @@ bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getGlobalZOrder();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4807,19 +4864,19 @@ bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_draw : Invalid Native Object");
do {
if (argc == 0) {
cobj->draw();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4828,22 +4885,22 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 3) {
cocos2d::Renderer* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Mat4 arg1;
- ok &= jsval_to_matrix(cx, argv[1], &arg1);
+ ok &= jsval_to_matrix(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
unsigned int arg2;
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
if (!ok) { ok = true; break; }
cobj->draw(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4853,25 +4910,25 @@ bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setUserObject : Invalid Native Object");
if (argc == 1) {
cocos2d::Ref* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Ref*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setUserObject : Error processing arguments");
cobj->setUserObject(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4880,21 +4937,22 @@ bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_enumerateChildren : Invalid Native Object");
if (argc == 2) {
std::string arg0;
std::function arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
do {
- if(JS_TypeOfValue(cx, argv[1]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[1]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(1)));
auto lambda = [=](cocos2d::Node* larg0) -> bool {
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
jsval largv[1];
do {
if (larg0) {
@@ -4904,13 +4962,13 @@ bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp)
largv[0] = JSVAL_NULL;
}
} while (0);
- jsval rval;
- bool ok = func->invoke(1, &largv[0], rval);
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(1, &largv[0], &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
bool ret;
- ret = JS::ToBoolean(JS::RootedValue(cx, rval));
+ ret = JS::ToBoolean(rval);
return ret;
};
arg1 = lambda;
@@ -4923,7 +4981,7 @@ bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp)
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_enumerateChildren : Error processing arguments");
cobj->enumerateChildren(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -4932,7 +4990,8 @@ bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonExitTransitionDidStartCallback : Invalid Native Object");
@@ -4940,7 +4999,7 @@ bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_
const std::function& ret = cobj->getonExitTransitionDidStartCallback();
jsval jsret = JSVAL_NULL;
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -4949,21 +5008,21 @@ bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_
}
bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeFromParentAndCleanup : Invalid Native Object");
do {
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
cobj->removeFromParentAndCleanup(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4971,7 +5030,7 @@ bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, j
do {
if (argc == 0) {
cobj->removeFromParent();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -4981,18 +5040,18 @@ bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_Node_setPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPosition3D : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec3 arg0;
- ok &= jsval_to_vector3(cx, argv[0], &arg0);
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPosition3D : Error processing arguments");
cobj->setPosition3D(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5001,18 +5060,18 @@ bool js_cocos2dx_Node_setPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_update : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_update : Error processing arguments");
cobj->update(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5021,39 +5080,42 @@ bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_sortAllChildren(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_sortAllChildren : Invalid Native Object");
if (argc == 0) {
cobj->sortAllChildren();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_sortAllChildren : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_getWorldToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_getWorldToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeTransform : Invalid Native Object");
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeAffineTransform : Invalid Native Object");
if (argc == 0) {
- cocos2d::Mat4 ret = cobj->getWorldToNodeTransform();
+ cocos2d::AffineTransform ret = cobj->getWorldToNodeAffineTransform();
jsval jsret = JSVAL_NULL;
- jsret = matrix_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ jsret = ccaffinetransform_to_jsval(cx, ret);
+ args.rval().set(jsret);
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_Node_getScale(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScale : Invalid Native Object");
@@ -5061,7 +5123,7 @@ bool js_cocos2dx_Node_getScale(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScale();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -5070,7 +5132,8 @@ bool js_cocos2dx_Node_getScale(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getNormalizedPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNormalizedPosition : Invalid Native Object");
@@ -5078,29 +5141,47 @@ bool js_cocos2dx_Node_getNormalizedPosition(JSContext *cx, uint32_t argc, jsval
const cocos2d::Vec2& ret = cobj->getNormalizedPosition();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_getNormalizedPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_Node_getParentToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
+ js_proxy_t *proxy = jsb_get_js_proxy(obj);
+ cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeTransform : Invalid Native Object");
+ if (argc == 0) {
+ const cocos2d::Mat4& ret = cobj->getParentToNodeTransform();
+ jsval jsret = JSVAL_NULL;
+ jsret = matrix_to_jsval(cx, ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
bool js_cocos2dx_Node_convertToNodeSpace(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToNodeSpace : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToNodeSpace : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToNodeSpace(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -5109,18 +5190,18 @@ bool js_cocos2dx_Node_convertToNodeSpace(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Node_setTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setTag : Error processing arguments");
cobj->setTag(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5129,7 +5210,8 @@ bool js_cocos2dx_Node_setTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_isCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isCascadeColorEnabled : Invalid Native Object");
@@ -5137,51 +5219,54 @@ bool js_cocos2dx_Node_isCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->isCascadeColorEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_isCascadeColorEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp)
+bool js_cocos2dx_Node_setRotationQuat(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isOpacityModifyRGB : Invalid Native Object");
- if (argc == 0) {
- bool ret = cobj->isOpacityModifyRGB();
- jsval jsret = JSVAL_NULL;
- jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationQuat : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Quaternion arg0;
+ ok &= jsval_to_quaternion(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationQuat : Error processing arguments");
+ cobj->setRotationQuat(arg0);
+ args.rval().setUndefined();
return true;
}
- JS_ReportError(cx, "js_cocos2dx_Node_isOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 0);
+ JS_ReportError(cx, "js_cocos2dx_Node_setRotationQuat : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Node_stopAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAction : Invalid Native Object");
if (argc == 1) {
cocos2d::Action* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopAction : Error processing arguments");
cobj->stopAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5190,12 +5275,12 @@ bool js_cocos2dx_Node_stopAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Node* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getActionManager : Invalid Native Object");
@@ -5211,7 +5296,7 @@ bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -5228,7 +5313,7 @@ bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -5238,6 +5323,7 @@ bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Node_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Node* ret = cocos2d::Node::create();
jsval jsret = JSVAL_NULL;
@@ -5249,7 +5335,7 @@ bool js_cocos2dx_Node_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_create : wrong number of arguments");
@@ -5258,7 +5344,7 @@ bool js_cocos2dx_Node_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Node_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Node* cobj = new (std::nothrow) cocos2d::Node();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -5272,13 +5358,16 @@ bool js_cocos2dx_Node_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Node");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Node");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -5290,21 +5379,21 @@ void js_cocos2d_Node_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_Node_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::Node *nobj = new (std::nothrow) cocos2d::Node();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Node");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Node");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Node_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Node_class->name = "Node";
jsb_cocos2d_Node_class->addProperty = JS_PropertyStub;
@@ -5318,8 +5407,8 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
jsb_cocos2d_Node_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -5327,6 +5416,7 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("removeComponent", js_cocos2dx_Node_removeComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setPhysicsBody", js_cocos2dx_Node_setPhysicsBody, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getShaderProgram", js_cocos2dx_Node_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("updateTransformFromPhysics", js_cocos2dx_Node_updateTransformFromPhysics, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getDescription", js_cocos2dx_Node_getDescription, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOpacityModifyRGB", js_cocos2dx_Node_setOpacityModifyRGB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCascadeOpacityEnabled", js_cocos2dx_Node_setCascadeOpacityEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5350,8 +5440,8 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("setCameraMask", js_cocos2dx_Node_setCameraMask, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTag", js_cocos2dx_Node_getTag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getonEnterTransitionDidFinishCallback", js_cocos2dx_Node_getonEnterTransitionDidFinishCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getNodeToWorldAffineTransform", js_cocos2dx_Node_getNodeToWorldAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getNodeToWorldTransform", js_cocos2dx_Node_getNodeToWorldTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getNodeToWorldTransform", js_cocos2dx_Node_getNodeToWorldAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPosition3D", js_cocos2dx_Node_getPosition3D, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeChild", js_cocos2dx_Node_removeChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("convertToWorldSpace", js_cocos2dx_Node_convertToWorldSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5366,12 +5456,12 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("removeAllChildren", js_cocos2dx_Node_removeAllChildrenWithCleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRotationX", js_cocos2dx_Node_getRotationSkewX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRotationY", js_cocos2dx_Node_getRotationSkewY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getNodeToParentAffineTransform", js_cocos2dx_Node_getNodeToParentAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getNodeToWorldTransform3D", js_cocos2dx_Node_getNodeToWorldTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isCascadeOpacityEnabled", js_cocos2dx_Node_isCascadeOpacityEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setParent", js_cocos2dx_Node_setParent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getName", js_cocos2dx_Node_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRotation3D", js_cocos2dx_Node_getRotation3D, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getNodeToParentTransform", js_cocos2dx_Node_getNodeToParentTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getNodeToParentTransform", js_cocos2dx_Node_getNodeToParentAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("convertTouchToNodeSpaceAR", js_cocos2dx_Node_convertTouchToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOnEnterCallback", js_cocos2dx_Node_getOnEnterCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPhysicsBody", js_cocos2dx_Node_getPhysicsBody, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5387,13 +5477,15 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("updateTransform", js_cocos2dx_Node_updateTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isVisible", js_cocos2dx_Node_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getChildrenCount", js_cocos2dx_Node_getChildrenCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getNodeToParentTransform3D", js_cocos2dx_Node_getNodeToParentTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("convertToNodeSpaceAR", js_cocos2dx_Node_convertToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("addComponent", js_cocos2dx_Node_addComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("runAction", js_cocos2dx_Node_runAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("visit", js_cocos2dx_Node_visit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setShaderProgram", js_cocos2dx_Node_setGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRotation", js_cocos2dx_Node_getRotation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getAnchorPointInPoints", js_cocos2dx_Node_getAnchorPointInPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("visit", js_cocos2dx_Node_visit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getRotationQuat", js_cocos2dx_Node_getRotationQuat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeChildByName", js_cocos2dx_Node_removeChildByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setVertexZ", js_cocos2dx_Node_setPositionZ, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getGLProgramState", js_cocos2dx_Node_getGLProgramState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5407,23 +5499,23 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("setRotationX", js_cocos2dx_Node_setRotationSkewX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setRotationY", js_cocos2dx_Node_setRotationSkewY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setName", js_cocos2dx_Node_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("setAdditionalTransform", js_cocos2dx_Node_setAdditionalTransform, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("updatePhysicsBodyTransform", js_cocos2dx_Node_updatePhysicsBodyTransform, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getDisplayedOpacity", js_cocos2dx_Node_getDisplayedOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getLocalZOrder", js_cocos2dx_Node_getLocalZOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getScheduler", js_cocos2dx_Node_getScheduler, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getParentToNodeAffineTransform", js_cocos2dx_Node_getParentToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOrderOfArrival", js_cocos2dx_Node_getOrderOfArrival, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setActionManager", js_cocos2dx_Node_setActionManager, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPosition", js_cocos2dx_Node_getPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isRunning", js_cocos2dx_Node_isRunning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getParent", js_cocos2dx_Node_getParent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getWorldToNodeTransform3D", js_cocos2dx_Node_getWorldToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPositionY", js_cocos2dx_Node_getPositionY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPositionX", js_cocos2dx_Node_getPositionX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("removeChildByTag", js_cocos2dx_Node_removeChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setPositionY", js_cocos2dx_Node_setPositionY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("updateDisplayedColor", js_cocos2dx_Node_updateDisplayedColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setVisible", js_cocos2dx_Node_setVisible, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getParentToNodeTransform", js_cocos2dx_Node_getParentToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getParentToNodeTransform", js_cocos2dx_Node_getParentToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVertexZ", js_cocos2dx_Node_getPositionZ, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setGlobalZOrder", js_cocos2dx_Node_setGlobalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setScale", js_cocos2dx_Node_setScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5434,7 +5526,6 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("getScaleY", js_cocos2dx_Node_getScaleY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getScaleX", js_cocos2dx_Node_getScaleX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setLocalZOrder", js_cocos2dx_Node_setLocalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getWorldToNodeAffineTransform", js_cocos2dx_Node_getWorldToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setCascadeColorEnabled", js_cocos2dx_Node_setCascadeColorEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOpacity", js_cocos2dx_Node_setOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("cleanup", js_cocos2dx_Node_cleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5452,13 +5543,14 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
JS_FN("setPosition3D", js_cocos2dx_Node_setPosition3D, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("update", js_cocos2dx_Node_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("sortAllChildren", js_cocos2dx_Node_sortAllChildren, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("getWorldToNodeTransform", js_cocos2dx_Node_getWorldToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getWorldToNodeTransform", js_cocos2dx_Node_getWorldToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getScale", js_cocos2dx_Node_getScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getNormalizedPosition", js_cocos2dx_Node_getNormalizedPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getParentToNodeTransform3D", js_cocos2dx_Node_getParentToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("convertToNodeSpace", js_cocos2dx_Node_convertToNodeSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTag", js_cocos2dx_Node_setTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isCascadeColorEnabled", js_cocos2dx_Node_isCascadeColorEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setRotationQuat", js_cocos2dx_Node_setRotationQuat, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("stopAction", js_cocos2dx_Node_stopAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getActionManager", js_cocos2dx_Node_getActionManager, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("ctor", js_cocos2d_Node_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -5472,7 +5564,7 @@ void js_register_cocos2dx_Node(JSContext *cx, JSObject *global) {
jsb_cocos2d_Node_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Node_class,
js_cocos2dx_Node_constructor, 0, // constructor
properties,
@@ -5503,7 +5595,7 @@ JSObject *jsb_cocos2d___NodeRGBA_prototype;
bool js_cocos2dx___NodeRGBA_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::__NodeRGBA* cobj = new (std::nothrow) cocos2d::__NodeRGBA();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -5517,13 +5609,16 @@ bool js_cocos2dx___NodeRGBA_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::__NodeRGBA");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::__NodeRGBA");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -5536,21 +5631,21 @@ void js_cocos2d___NodeRGBA_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d___NodeRGBA_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::__NodeRGBA *nobj = new (std::nothrow) cocos2d::__NodeRGBA();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::__NodeRGBA");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::__NodeRGBA");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx___NodeRGBA(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx___NodeRGBA(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d___NodeRGBA_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d___NodeRGBA_class->name = "NodeRGBA";
jsb_cocos2d___NodeRGBA_class->addProperty = JS_PropertyStub;
@@ -5564,8 +5659,8 @@ void js_register_cocos2dx___NodeRGBA(JSContext *cx, JSObject *global) {
jsb_cocos2d___NodeRGBA_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -5577,7 +5672,7 @@ void js_register_cocos2dx___NodeRGBA(JSContext *cx, JSObject *global) {
jsb_cocos2d___NodeRGBA_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Node_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
jsb_cocos2d___NodeRGBA_class,
js_cocos2dx___NodeRGBA_constructor, 0, // constructor
properties,
@@ -5608,7 +5703,8 @@ JSObject *jsb_cocos2d_Scene_prototype;
bool js_cocos2dx_Scene_initWithPhysics(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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_initWithPhysics : Invalid Native Object");
@@ -5616,34 +5712,50 @@ bool js_cocos2dx_Scene_initWithPhysics(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->initWithPhysics();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_initWithPhysics : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_Scene_setCameraOrderDirty(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_setCameraOrderDirty : Invalid Native Object");
+ if (argc == 0) {
+ cobj->setCameraOrderDirty();
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Scene_setCameraOrderDirty : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
bool js_cocos2dx_Scene_render(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, 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_render : Invalid Native Object");
if (argc == 1) {
cocos2d::Renderer* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_render : Error processing arguments");
cobj->render(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5652,51 +5764,35 @@ bool js_cocos2dx_Scene_render(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Scene_onProjectionChanged(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, 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_onProjectionChanged : Invalid Native Object");
if (argc == 1) {
cocos2d::EventCustom* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventCustom*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_onProjectionChanged : Error processing arguments");
cobj->onProjectionChanged(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_onProjectionChanged : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
-bool js_cocos2dx_Scene_init(JSContext *cx, uint32_t argc, jsval *vp)
-{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
- 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_init : Invalid Native Object");
- if (argc == 0) {
- bool ret = cobj->init();
- jsval jsret = JSVAL_NULL;
- jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
-
- JS_ReportError(cx, "js_cocos2dx_Scene_init : wrong number of arguments: %d, was expecting %d", argc, 0);
- return false;
-}
bool js_cocos2dx_Scene_getPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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_getPhysicsWorld : Invalid Native Object");
@@ -5711,7 +5807,7 @@ bool js_cocos2dx_Scene_getPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -5720,33 +5816,58 @@ bool js_cocos2dx_Scene_getPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Scene_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, 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_initWithSize : Invalid Native Object");
if (argc == 1) {
cocos2d::Size arg0;
- ok &= jsval_to_ccsize(cx, argv[0], &arg0);
+ ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_initWithSize : Error processing arguments");
bool ret = cobj->initWithSize(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_initWithSize : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
+bool js_cocos2dx_Scene_getDefaultCamera(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_getDefaultCamera : Invalid Native Object");
+ if (argc == 0) {
+ cocos2d::Camera* ret = cobj->getDefaultCamera();
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Camera*)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_getDefaultCamera : wrong number of arguments: %d, was expecting %d", argc, 0);
+ return false;
+}
bool js_cocos2dx_Scene_createWithSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Size arg0;
- ok &= jsval_to_ccsize(cx, argv[0], &arg0);
+ ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_createWithSize : Error processing arguments");
cocos2d::Scene* ret = cocos2d::Scene::createWithSize(arg0);
jsval jsret = JSVAL_NULL;
@@ -5758,7 +5879,7 @@ bool js_cocos2dx_Scene_createWithSize(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_createWithSize : wrong number of arguments");
@@ -5767,6 +5888,7 @@ bool js_cocos2dx_Scene_createWithSize(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Scene_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Scene* ret = cocos2d::Scene::create();
jsval jsret = JSVAL_NULL;
@@ -5778,7 +5900,7 @@ bool js_cocos2dx_Scene_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_create : wrong number of arguments");
@@ -5787,6 +5909,7 @@ bool js_cocos2dx_Scene_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Scene_createWithPhysics(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Scene* ret = cocos2d::Scene::createWithPhysics();
jsval jsret = JSVAL_NULL;
@@ -5798,7 +5921,7 @@ bool js_cocos2dx_Scene_createWithPhysics(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_createWithPhysics : wrong number of arguments");
@@ -5807,7 +5930,7 @@ bool js_cocos2dx_Scene_createWithPhysics(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_Scene_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Scene* cobj = new (std::nothrow) cocos2d::Scene();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -5821,13 +5944,16 @@ bool js_cocos2dx_Scene_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scene");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scene");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -5840,21 +5966,21 @@ void js_cocos2d_Scene_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_Scene_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::Scene *nobj = new (std::nothrow) cocos2d::Scene();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scene");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scene");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_Scene(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Scene(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Scene_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Scene_class->name = "Scene";
jsb_cocos2d_Scene_class->addProperty = JS_PropertyStub;
@@ -5868,17 +5994,18 @@ void js_register_cocos2dx_Scene(JSContext *cx, JSObject *global) {
jsb_cocos2d_Scene_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
JS_FN("initWithPhysics", js_cocos2dx_Scene_initWithPhysics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setCameraOrderDirty", js_cocos2dx_Scene_setCameraOrderDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("render", js_cocos2dx_Scene_render, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("onProjectionChanged", js_cocos2dx_Scene_onProjectionChanged, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FN("init", js_cocos2dx_Scene_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getPhysicsWorld", js_cocos2dx_Scene_getPhysicsWorld, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("initWithSize", js_cocos2dx_Scene_initWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("getDefaultCamera", js_cocos2dx_Scene_getDefaultCamera, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("ctor", js_cocos2d_Scene_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@@ -5892,7 +6019,7 @@ void js_register_cocos2dx_Scene(JSContext *cx, JSObject *global) {
jsb_cocos2d_Scene_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Node_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Node_prototype),
jsb_cocos2d_Scene_class,
js_cocos2dx_Scene_constructor, 0, // constructor
properties,
@@ -5923,20 +6050,20 @@ JSObject *jsb_cocos2d_GLView_prototype;
bool js_cocos2dx_GLView_setFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameSize : Invalid Native Object");
if (argc == 2) {
double arg0;
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameSize : Error processing arguments");
cobj->setFrameSize(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -5945,7 +6072,8 @@ bool js_cocos2dx_GLView_setFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getViewPortRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getViewPortRect : Invalid Native Object");
@@ -5953,7 +6081,7 @@ bool js_cocos2dx_GLView_getViewPortRect(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Rect& ret = cobj->getViewPortRect();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -5962,20 +6090,20 @@ bool js_cocos2dx_GLView_getViewPortRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Error processing arguments");
bool ret = cobj->setContentScaleFactor(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -5984,7 +6112,8 @@ bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getContentScaleFactor : Invalid Native Object");
@@ -5992,7 +6121,7 @@ bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsva
double ret = cobj->getContentScaleFactor();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6001,18 +6130,18 @@ bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_GLView_setIMEKeyboardState(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setIMEKeyboardState : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setIMEKeyboardState : Error processing arguments");
cobj->setIMEKeyboardState(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6021,9 +6150,9 @@ bool js_cocos2dx_GLView_setIMEKeyboardState(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setScissorInPoints : Invalid Native Object");
@@ -6032,13 +6161,13 @@ bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *
double arg1;
double arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setScissorInPoints : Error processing arguments");
cobj->setScissorInPoints(arg0, arg1, arg2, arg3);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6047,7 +6176,8 @@ bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_GLView_getViewName(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getViewName : Invalid Native Object");
@@ -6055,7 +6185,7 @@ bool js_cocos2dx_GLView_getViewName(JSContext *cx, uint32_t argc, jsval *vp)
const std::string& ret = cobj->getViewName();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6064,7 +6194,8 @@ bool js_cocos2dx_GLView_getViewName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_isOpenGLReady(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isOpenGLReady : Invalid Native Object");
@@ -6072,16 +6203,37 @@ bool js_cocos2dx_GLView_isOpenGLReady(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isOpenGLReady();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_GLView_isOpenGLReady : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_GLView_setCursorVisible(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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setCursorVisible : Invalid Native Object");
+ if (argc == 1) {
+ bool arg0;
+ arg0 = JS::ToBoolean(args.get(0));
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setCursorVisible : Error processing arguments");
+ cobj->setCursorVisible(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_GLView_setCursorVisible : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
bool js_cocos2dx_GLView_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScaleY : Invalid Native Object");
@@ -6089,7 +6241,7 @@ bool js_cocos2dx_GLView_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScaleY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6098,7 +6250,8 @@ bool js_cocos2dx_GLView_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScaleX : Invalid Native Object");
@@ -6106,7 +6259,7 @@ bool js_cocos2dx_GLView_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScaleX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6115,7 +6268,8 @@ bool js_cocos2dx_GLView_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleOrigin : Invalid Native Object");
@@ -6123,7 +6277,7 @@ bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Vec2 ret = cobj->getVisibleOrigin();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6132,7 +6286,8 @@ bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameSize : Invalid Native Object");
@@ -6140,7 +6295,7 @@ bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Size& ret = cobj->getFrameSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6149,18 +6304,18 @@ bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Error processing arguments");
cobj->setFrameZoomFactor(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6169,7 +6324,8 @@ bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_GLView_getFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameZoomFactor : Invalid Native Object");
@@ -6177,7 +6333,7 @@ bool js_cocos2dx_GLView_getFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *
double ret = cobj->getFrameZoomFactor();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6186,7 +6342,8 @@ bool js_cocos2dx_GLView_getFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_GLView_getDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getDesignResolutionSize : Invalid Native Object");
@@ -6194,7 +6351,7 @@ bool js_cocos2dx_GLView_getDesignResolutionSize(JSContext *cx, uint32_t argc, js
const cocos2d::Size& ret = cobj->getDesignResolutionSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6203,7 +6360,8 @@ bool js_cocos2dx_GLView_getDesignResolutionSize(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_windowShouldClose : Invalid Native Object");
@@ -6211,7 +6369,7 @@ bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *v
bool ret = cobj->windowShouldClose();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6220,9 +6378,9 @@ bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setDesignResolutionSize : Invalid Native Object");
@@ -6230,12 +6388,12 @@ bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, js
double arg0;
double arg1;
ResolutionPolicy arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setDesignResolutionSize : Error processing arguments");
cobj->setDesignResolutionSize(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6244,7 +6402,8 @@ bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_GLView_getResolutionPolicy(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getResolutionPolicy : Invalid Native Object");
@@ -6252,7 +6411,7 @@ bool js_cocos2dx_GLView_getResolutionPolicy(JSContext *cx, uint32_t argc, jsval
int ret = (int)cobj->getResolutionPolicy();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6261,7 +6420,8 @@ bool js_cocos2dx_GLView_getResolutionPolicy(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_GLView_isRetinaDisplay(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isRetinaDisplay : Invalid Native Object");
@@ -6269,7 +6429,7 @@ bool js_cocos2dx_GLView_isRetinaDisplay(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isRetinaDisplay();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6278,9 +6438,9 @@ bool js_cocos2dx_GLView_isRetinaDisplay(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Invalid Native Object");
@@ -6289,13 +6449,13 @@ bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval
double arg1;
double arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Error processing arguments");
cobj->setViewPortInPoints(arg0, arg1, arg2, arg3);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6304,7 +6464,8 @@ bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScissorRect : Invalid Native Object");
@@ -6312,7 +6473,7 @@ bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Rect ret = cobj->getScissorRect();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6321,7 +6482,8 @@ bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getRetinaFactor : Invalid Native Object");
@@ -6329,7 +6491,7 @@ bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getRetinaFactor();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6338,18 +6500,18 @@ bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_setViewName(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewName : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewName : Error processing arguments");
cobj->setViewName(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6358,7 +6520,8 @@ bool js_cocos2dx_GLView_setViewName(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getVisibleRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleRect : Invalid Native Object");
@@ -6366,7 +6529,7 @@ bool js_cocos2dx_GLView_getVisibleRect(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Rect ret = cobj->getVisibleRect();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6375,7 +6538,8 @@ bool js_cocos2dx_GLView_getVisibleRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleSize : Invalid Native Object");
@@ -6383,7 +6547,7 @@ bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Size ret = cobj->getVisibleSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6392,7 +6556,8 @@ bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isScissorEnabled : Invalid Native Object");
@@ -6400,7 +6565,7 @@ bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->isScissorEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6409,13 +6574,14 @@ bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_GLView_pollEvents(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_pollEvents : Invalid Native Object");
if (argc == 0) {
cobj->pollEvents();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6424,7 +6590,7 @@ bool js_cocos2dx_GLView_pollEvents(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
GLContextAttrs arg0;
@@ -6432,7 +6598,7 @@ bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *v
ok = false;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setGLContextAttrs : Error processing arguments");
cocos2d::GLView::setGLContextAttrs(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_GLView_setGLContextAttrs : wrong number of arguments");
@@ -6441,11 +6607,12 @@ bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *v
bool js_cocos2dx_GLView_getGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
GLContextAttrs ret = cocos2d::GLView::getGLContextAttrs();
jsval jsret = JSVAL_NULL;
#pragma warning NO CONVERSION FROM NATIVE FOR GLContextAttrs;
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_GLView_getGLContextAttrs : wrong number of arguments");
@@ -6458,7 +6625,7 @@ void js_cocos2d_GLView_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (GLView)", obj);
}
-void js_register_cocos2dx_GLView(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_GLView(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_GLView_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_GLView_class->name = "GLView";
jsb_cocos2d_GLView_class->addProperty = JS_PropertyStub;
@@ -6472,8 +6639,8 @@ void js_register_cocos2dx_GLView(JSContext *cx, JSObject *global) {
jsb_cocos2d_GLView_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -6485,6 +6652,7 @@ void js_register_cocos2dx_GLView(JSContext *cx, JSObject *global) {
JS_FN("setScissorInPoints", js_cocos2dx_GLView_setScissorInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getViewName", js_cocos2dx_GLView_getViewName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isOpenGLReady", js_cocos2dx_GLView_isOpenGLReady, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setCursorVisible", js_cocos2dx_GLView_setCursorVisible, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getScaleY", js_cocos2dx_GLView_getScaleY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getScaleX", js_cocos2dx_GLView_getScaleX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVisibleOrigin", js_cocos2dx_GLView_getVisibleOrigin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -6515,7 +6683,7 @@ void js_register_cocos2dx_GLView(JSContext *cx, JSObject *global) {
jsb_cocos2d_GLView_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_GLView_class,
empty_constructor, 0,
properties,
@@ -6546,13 +6714,14 @@ JSObject *jsb_cocos2d_Director_prototype;
bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pause : Invalid Native Object");
if (argc == 0) {
cobj->pause();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6561,25 +6730,25 @@ bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setEventDispatcher : Invalid Native Object");
if (argc == 1) {
cocos2d::EventDispatcher* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventDispatcher*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setEventDispatcher : Error processing arguments");
cobj->setEventDispatcher(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6588,18 +6757,18 @@ bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Error processing arguments");
cobj->setContentScaleFactor(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6608,7 +6777,8 @@ bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getContentScaleFactor : Invalid Native Object");
@@ -6616,7 +6786,7 @@ bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, js
double ret = cobj->getContentScaleFactor();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6625,7 +6795,8 @@ bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Director_getWinSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getWinSizeInPixels : Invalid Native Object");
@@ -6633,7 +6804,7 @@ bool js_cocos2dx_Director_getWinSizeInPixels(JSContext *cx, uint32_t argc, jsval
cocos2d::Size ret = cobj->getWinSizeInPixels();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6642,7 +6813,8 @@ bool js_cocos2dx_Director_getWinSizeInPixels(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_getDeltaTime(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getDeltaTime : Invalid Native Object");
@@ -6650,7 +6822,7 @@ bool js_cocos2dx_Director_getDeltaTime(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getDeltaTime();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6659,13 +6831,14 @@ bool js_cocos2dx_Director_getDeltaTime(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setGLDefaultValues(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setGLDefaultValues : Invalid Native Object");
if (argc == 0) {
cobj->setGLDefaultValues();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6674,25 +6847,25 @@ bool js_cocos2dx_Director_setGLDefaultValues(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_setActionManager(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setActionManager : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionManager* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionManager*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setActionManager : Error processing arguments");
cobj->setActionManager(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6701,18 +6874,18 @@ bool js_cocos2dx_Director_setActionManager(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_setAlphaBlending(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setAlphaBlending : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setAlphaBlending : Error processing arguments");
cobj->setAlphaBlending(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6721,13 +6894,14 @@ bool js_cocos2dx_Director_setAlphaBlending(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_popToRootScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popToRootScene : Invalid Native Object");
if (argc == 0) {
cobj->popToRootScene();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6736,20 +6910,20 @@ bool js_cocos2dx_Director_popToRootScene(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_loadMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadMatrix : Invalid Native Object");
if (argc == 2) {
cocos2d::MATRIX_STACK_TYPE arg0;
cocos2d::Mat4 arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
- ok &= jsval_to_matrix(cx, argv[1], &arg1);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ ok &= jsval_to_matrix(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadMatrix : Error processing arguments");
cobj->loadMatrix(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6758,7 +6932,8 @@ bool js_cocos2dx_Director_loadMatrix(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getNotificationNode(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getNotificationNode : Invalid Native Object");
@@ -6773,7 +6948,7 @@ bool js_cocos2dx_Director_getNotificationNode(JSContext *cx, uint32_t argc, jsva
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6782,7 +6957,8 @@ bool js_cocos2dx_Director_getNotificationNode(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Director_getWinSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getWinSize : Invalid Native Object");
@@ -6790,7 +6966,7 @@ bool js_cocos2dx_Director_getWinSize(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Size& ret = cobj->getWinSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6799,13 +6975,14 @@ bool js_cocos2dx_Director_getWinSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_end(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_end : Invalid Native Object");
if (argc == 0) {
cobj->end();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6814,7 +6991,8 @@ bool js_cocos2dx_Director_end(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getTextureCache(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getTextureCache : Invalid Native Object");
@@ -6829,7 +7007,7 @@ bool js_cocos2dx_Director_getTextureCache(JSContext *cx, uint32_t argc, jsval *v
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6838,7 +7016,8 @@ bool js_cocos2dx_Director_getTextureCache(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Director_isSendCleanupToScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isSendCleanupToScene : Invalid Native Object");
@@ -6846,7 +7025,7 @@ bool js_cocos2dx_Director_isSendCleanupToScene(JSContext *cx, uint32_t argc, jsv
bool ret = cobj->isSendCleanupToScene();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6855,7 +7034,8 @@ bool js_cocos2dx_Director_isSendCleanupToScene(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Director_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getVisibleOrigin : Invalid Native Object");
@@ -6863,7 +7043,7 @@ bool js_cocos2dx_Director_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *
cocos2d::Vec2 ret = cobj->getVisibleOrigin();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6872,13 +7052,14 @@ bool js_cocos2dx_Director_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_mainLoop(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_mainLoop : Invalid Native Object");
if (argc == 0) {
cobj->mainLoop();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6887,18 +7068,18 @@ bool js_cocos2dx_Director_mainLoop(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setDepthTest(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDepthTest : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setDepthTest : Error processing arguments");
cobj->setDepthTest(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6907,7 +7088,8 @@ bool js_cocos2dx_Director_setDepthTest(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getFrameRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getFrameRate : Invalid Native Object");
@@ -6915,7 +7097,7 @@ bool js_cocos2dx_Director_getFrameRate(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getFrameRate();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6924,7 +7106,8 @@ bool js_cocos2dx_Director_getFrameRate(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getSecondsPerFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getSecondsPerFrame : Invalid Native Object");
@@ -6932,7 +7115,7 @@ bool js_cocos2dx_Director_getSecondsPerFrame(JSContext *cx, uint32_t argc, jsval
double ret = cobj->getSecondsPerFrame();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6941,13 +7124,14 @@ bool js_cocos2dx_Director_getSecondsPerFrame(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_resetMatrixStack(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_resetMatrixStack : Invalid Native Object");
if (argc == 0) {
cobj->resetMatrixStack();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6956,20 +7140,20 @@ bool js_cocos2dx_Director_resetMatrixStack(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_convertToUI(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_convertToUI : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_convertToUI : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToUI(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -6978,18 +7162,18 @@ bool js_cocos2dx_Director_convertToUI(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_pushMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushMatrix : Invalid Native Object");
if (argc == 1) {
cocos2d::MATRIX_STACK_TYPE arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_pushMatrix : Error processing arguments");
cobj->pushMatrix(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -6998,13 +7182,14 @@ bool js_cocos2dx_Director_pushMatrix(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setDefaultValues(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDefaultValues : Invalid Native Object");
if (argc == 0) {
cobj->setDefaultValues();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7013,7 +7198,8 @@ bool js_cocos2dx_Director_setDefaultValues(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_init : Invalid Native Object");
@@ -7021,7 +7207,7 @@ bool js_cocos2dx_Director_init(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7030,25 +7216,25 @@ bool js_cocos2dx_Director_init(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setScheduler : Invalid Native Object");
if (argc == 1) {
cocos2d::Scheduler* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Scheduler*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setScheduler : Error processing arguments");
cobj->setScheduler(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7057,20 +7243,20 @@ bool js_cocos2dx_Director_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getMatrix : Invalid Native Object");
if (argc == 1) {
cocos2d::MATRIX_STACK_TYPE arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_getMatrix : Error processing arguments");
const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
jsval jsret = JSVAL_NULL;
jsret = matrix_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7079,13 +7265,14 @@ bool js_cocos2dx_Director_getMatrix(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_startAnimation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_startAnimation : Invalid Native Object");
if (argc == 0) {
cobj->startAnimation();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7094,7 +7281,8 @@ bool js_cocos2dx_Director_startAnimation(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_getOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getOpenGLView : Invalid Native Object");
@@ -7109,7 +7297,7 @@ bool js_cocos2dx_Director_getOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7118,7 +7306,8 @@ bool js_cocos2dx_Director_getOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getRunningScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getRunningScene : Invalid Native Object");
@@ -7133,7 +7322,7 @@ bool js_cocos2dx_Director_getRunningScene(JSContext *cx, uint32_t argc, jsval *v
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7142,13 +7331,14 @@ bool js_cocos2dx_Director_getRunningScene(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Director_setViewport(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setViewport : Invalid Native Object");
if (argc == 0) {
cobj->setViewport();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7157,13 +7347,14 @@ bool js_cocos2dx_Director_setViewport(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_stopAnimation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_stopAnimation : Invalid Native Object");
if (argc == 0) {
cobj->stopAnimation();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7172,18 +7363,18 @@ bool js_cocos2dx_Director_stopAnimation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_popToSceneStackLevel(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Error processing arguments");
cobj->popToSceneStackLevel(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7192,13 +7383,14 @@ bool js_cocos2dx_Director_popToSceneStackLevel(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Director_resume(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_resume : Invalid Native Object");
if (argc == 0) {
cobj->resume();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7207,7 +7399,8 @@ bool js_cocos2dx_Director_resume(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_isNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isNextDeltaTimeZero : Invalid Native Object");
@@ -7215,34 +7408,54 @@ bool js_cocos2dx_Director_isNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsva
bool ret = cobj->isNextDeltaTimeZero();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Director_isNextDeltaTimeZero : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_Director_setClearColor(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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setClearColor : Invalid Native Object");
+ if (argc == 1) {
+ cocos2d::Color4F arg0;
+ ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setClearColor : Error processing arguments");
+ cobj->setClearColor(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Director_setClearColor : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
bool js_cocos2dx_Director_setOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setOpenGLView : Invalid Native Object");
if (argc == 1) {
cocos2d::GLView* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::GLView*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setOpenGLView : Error processing arguments");
cobj->setOpenGLView(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7251,20 +7464,20 @@ bool js_cocos2dx_Director_setOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_convertToGL(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_convertToGL : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_convertToGL : Error processing arguments");
cocos2d::Vec2 ret = cobj->convertToGL(arg0);
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7273,13 +7486,14 @@ bool js_cocos2dx_Director_convertToGL(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_purgeCachedData(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_purgeCachedData : Invalid Native Object");
if (argc == 0) {
cobj->purgeCachedData();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7288,7 +7502,8 @@ bool js_cocos2dx_Director_purgeCachedData(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Director_getTotalFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getTotalFrames : Invalid Native Object");
@@ -7296,7 +7511,7 @@ bool js_cocos2dx_Director_getTotalFrames(JSContext *cx, uint32_t argc, jsval *vp
unsigned int ret = cobj->getTotalFrames();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7305,25 +7520,25 @@ bool js_cocos2dx_Director_getTotalFrames(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_runWithScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_runWithScene : Invalid Native Object");
if (argc == 1) {
cocos2d::Scene* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_runWithScene : Error processing arguments");
cobj->runWithScene(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7332,25 +7547,25 @@ bool js_cocos2dx_Director_runWithScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setNotificationNode(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setNotificationNode : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setNotificationNode : Error processing arguments");
cobj->setNotificationNode(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7359,13 +7574,14 @@ bool js_cocos2dx_Director_setNotificationNode(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Director_drawScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_drawScene : Invalid Native Object");
if (argc == 0) {
cobj->drawScene();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7374,13 +7590,14 @@ bool js_cocos2dx_Director_drawScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_restart(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_restart : Invalid Native Object");
if (argc == 0) {
cobj->restart();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7389,13 +7606,14 @@ bool js_cocos2dx_Director_restart(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_popScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popScene : Invalid Native Object");
if (argc == 0) {
cobj->popScene();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7404,18 +7622,18 @@ bool js_cocos2dx_Director_popScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_loadIdentityMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadIdentityMatrix : Invalid Native Object");
if (argc == 1) {
cocos2d::MATRIX_STACK_TYPE arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadIdentityMatrix : Error processing arguments");
cobj->loadIdentityMatrix(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7424,7 +7642,8 @@ bool js_cocos2dx_Director_loadIdentityMatrix(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_isDisplayStats(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isDisplayStats : Invalid Native Object");
@@ -7432,7 +7651,7 @@ bool js_cocos2dx_Director_isDisplayStats(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->isDisplayStats();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7441,18 +7660,18 @@ bool js_cocos2dx_Director_isDisplayStats(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_setProjection(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setProjection : Invalid Native Object");
if (argc == 1) {
cocos2d::Director::Projection arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setProjection : Error processing arguments");
cobj->setProjection(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7461,20 +7680,20 @@ bool js_cocos2dx_Director_setProjection(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_multiplyMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_multiplyMatrix : Invalid Native Object");
if (argc == 2) {
cocos2d::MATRIX_STACK_TYPE arg0;
cocos2d::Mat4 arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
- ok &= jsval_to_matrix(cx, argv[1], &arg1);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
+ ok &= jsval_to_matrix(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_multiplyMatrix : Error processing arguments");
cobj->multiplyMatrix(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7483,7 +7702,8 @@ bool js_cocos2dx_Director_multiplyMatrix(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_getZEye(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getZEye : Invalid Native Object");
@@ -7491,7 +7711,7 @@ bool js_cocos2dx_Director_getZEye(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getZEye();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7500,18 +7720,18 @@ bool js_cocos2dx_Director_getZEye(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setNextDeltaTimeZero : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setNextDeltaTimeZero : Error processing arguments");
cobj->setNextDeltaTimeZero(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7520,18 +7740,18 @@ bool js_cocos2dx_Director_setNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Director_popMatrix(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popMatrix : Invalid Native Object");
if (argc == 1) {
cocos2d::MATRIX_STACK_TYPE arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popMatrix : Error processing arguments");
cobj->popMatrix(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7540,7 +7760,8 @@ bool js_cocos2dx_Director_popMatrix(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getVisibleSize : Invalid Native Object");
@@ -7548,7 +7769,7 @@ bool js_cocos2dx_Director_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Size ret = cobj->getVisibleSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7557,7 +7778,8 @@ bool js_cocos2dx_Director_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Director_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getScheduler : Invalid Native Object");
@@ -7572,7 +7794,7 @@ bool js_cocos2dx_Director_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7581,25 +7803,25 @@ bool js_cocos2dx_Director_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_pushScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushScene : Invalid Native Object");
if (argc == 1) {
cocos2d::Scene* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_pushScene : Error processing arguments");
cobj->pushScene(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7608,7 +7830,8 @@ bool js_cocos2dx_Director_pushScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getAnimationInterval : Invalid Native Object");
@@ -7616,7 +7839,7 @@ bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsv
double ret = cobj->getAnimationInterval();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7625,7 +7848,8 @@ bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isPaused : Invalid Native Object");
@@ -7633,7 +7857,7 @@ bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isPaused();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7642,18 +7866,18 @@ bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setDisplayStats(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDisplayStats : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setDisplayStats : Error processing arguments");
cobj->setDisplayStats(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7662,7 +7886,8 @@ bool js_cocos2dx_Director_setDisplayStats(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getEventDispatcher : Invalid Native Object");
@@ -7677,7 +7902,7 @@ bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7686,25 +7911,25 @@ bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_replaceScene : Invalid Native Object");
if (argc == 1) {
cocos2d::Scene* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_replaceScene : Error processing arguments");
cobj->replaceScene(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7713,18 +7938,18 @@ bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setAnimationInterval : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setAnimationInterval : Error processing arguments");
cobj->setAnimationInterval(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7733,7 +7958,8 @@ bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getActionManager : Invalid Native Object");
@@ -7748,7 +7974,7 @@ bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7757,6 +7983,7 @@ bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Director* ret = cocos2d::Director::getInstance();
jsval jsret = JSVAL_NULL;
@@ -7768,7 +7995,7 @@ bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Director_getInstance : wrong number of arguments");
@@ -7781,7 +8008,7 @@ void js_cocos2d_Director_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Director)", obj);
}
-void js_register_cocos2dx_Director(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Director_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Director_class->name = "Director";
jsb_cocos2d_Director_class->addProperty = JS_PropertyStub;
@@ -7795,8 +8022,8 @@ void js_register_cocos2dx_Director(JSContext *cx, JSObject *global) {
jsb_cocos2d_Director_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -7836,6 +8063,7 @@ void js_register_cocos2dx_Director(JSContext *cx, JSObject *global) {
JS_FN("popToSceneStackLevel", js_cocos2dx_Director_popToSceneStackLevel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("resume", js_cocos2dx_Director_resume, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isNextDeltaTimeZero", js_cocos2dx_Director_isNextDeltaTimeZero, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setClearColor", js_cocos2dx_Director_setClearColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOpenGLView", js_cocos2dx_Director_setOpenGLView, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("convertToGL", js_cocos2dx_Director_convertToGL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("purgeCachedData", js_cocos2dx_Director_purgeCachedData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -7872,7 +8100,7 @@ void js_register_cocos2dx_Director(JSContext *cx, JSObject *global) {
jsb_cocos2d_Director_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Director_class,
empty_constructor, 0,
properties,
@@ -7903,41 +8131,62 @@ JSObject *jsb_cocos2d_Scheduler_prototype;
bool js_cocos2dx_Scheduler_setTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Error processing arguments");
cobj->setTimeScale(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scheduler_setTimeScale : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
+bool js_cocos2dx_Scheduler_update(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::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_update : Invalid Native Object");
+ if (argc == 1) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_update : Error processing arguments");
+ cobj->update(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_Scheduler_update : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
bool js_cocos2dx_Scheduler_performFunctionInCocosThread(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_performFunctionInCocosThread : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=]() -> void {
- jsval rval;
- bool ok = func->invoke(0, nullptr, rval);
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(0, nullptr, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -7952,7 +8201,7 @@ bool js_cocos2dx_Scheduler_performFunctionInCocosThread(JSContext *cx, uint32_t
;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_performFunctionInCocosThread : Error processing arguments");
cobj->performFunctionInCocosThread(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -7961,7 +8210,8 @@ bool js_cocos2dx_Scheduler_performFunctionInCocosThread(JSContext *cx, uint32_t
}
bool js_cocos2dx_Scheduler_getTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_getTimeScale : Invalid Native Object");
@@ -7969,7 +8219,7 @@ bool js_cocos2dx_Scheduler_getTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getTimeScale();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -7978,7 +8228,7 @@ bool js_cocos2dx_Scheduler_getTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Scheduler_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Scheduler* cobj = new (std::nothrow) cocos2d::Scheduler();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -7992,13 +8242,16 @@ bool js_cocos2dx_Scheduler_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scheduler");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Scheduler");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -8008,7 +8261,7 @@ void js_cocos2d_Scheduler_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Scheduler)", obj);
}
-void js_register_cocos2dx_Scheduler(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Scheduler(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Scheduler_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Scheduler_class->name = "Scheduler";
jsb_cocos2d_Scheduler_class->addProperty = JS_PropertyStub;
@@ -8022,12 +8275,13 @@ void js_register_cocos2dx_Scheduler(JSContext *cx, JSObject *global) {
jsb_cocos2d_Scheduler_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
JS_FN("setTimeScale", js_cocos2dx_Scheduler_setTimeScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("update", js_cocos2dx_Scheduler_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("performFunctionInCocosThread", js_cocos2dx_Scheduler_performFunctionInCocosThread, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTimeScale", js_cocos2dx_Scheduler_getTimeScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
@@ -8037,7 +8291,7 @@ void js_register_cocos2dx_Scheduler(JSContext *cx, JSObject *global) {
jsb_cocos2d_Scheduler_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Scheduler_class,
js_cocos2dx_Scheduler_constructor, 0, // constructor
properties,
@@ -8068,20 +8322,20 @@ JSObject *jsb_cocos2d_FileUtils_prototype;
bool js_cocos2dx_FileUtils_fullPathForFilename(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_fullPathForFilename : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_fullPathForFilename : Error processing arguments");
std::string ret = cobj->fullPathForFilename(arg0);
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8090,20 +8344,20 @@ bool js_cocos2dx_FileUtils_fullPathForFilename(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_FileUtils_getStringFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getStringFromFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getStringFromFile : Error processing arguments");
std::string ret = cobj->getStringFromFile(arg0);
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8112,20 +8366,20 @@ bool js_cocos2dx_FileUtils_getStringFromFile(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_FileUtils_removeFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_removeFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_removeFile : Error processing arguments");
bool ret = cobj->removeFile(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8134,20 +8388,20 @@ bool js_cocos2dx_FileUtils_removeFile(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FileUtils_isAbsolutePath(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isAbsolutePath : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isAbsolutePath : Error processing arguments");
bool ret = cobj->isAbsolutePath(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8156,9 +8410,9 @@ bool js_cocos2dx_FileUtils_isAbsolutePath(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_renameFile : Invalid Native Object");
@@ -8166,14 +8420,14 @@ bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp)
std::string arg0;
std::string arg1;
std::string arg2;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
- ok &= jsval_to_std_string(cx, argv[2], &arg2);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
+ ok &= jsval_to_std_string(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_renameFile : Error processing arguments");
bool ret = cobj->renameFile(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8182,18 +8436,18 @@ bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile : Error processing arguments");
cobj->loadFilenameLookupDictionaryFromFile(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8202,7 +8456,8 @@ bool js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile(JSContext *cx, u
}
bool js_cocos2dx_FileUtils_isPopupNotify(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isPopupNotify : Invalid Native Object");
@@ -8210,7 +8465,7 @@ bool js_cocos2dx_FileUtils_isPopupNotify(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->isPopupNotify();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8219,20 +8474,20 @@ bool js_cocos2dx_FileUtils_isPopupNotify(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_FileUtils_getValueVectorFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueVectorFromFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueVectorFromFile : Error processing arguments");
cocos2d::ValueVector ret = cobj->getValueVectorFromFile(arg0);
jsval jsret = JSVAL_NULL;
jsret = ccvaluevector_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8241,7 +8496,8 @@ bool js_cocos2dx_FileUtils_getValueVectorFromFile(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_FileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getSearchPaths : Invalid Native Object");
@@ -8249,7 +8505,7 @@ bool js_cocos2dx_FileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *v
const std::vector& ret = cobj->getSearchPaths();
jsval jsret = JSVAL_NULL;
jsret = std_vector_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8258,22 +8514,22 @@ bool js_cocos2dx_FileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FileUtils_writeToFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeToFile : Invalid Native Object");
if (argc == 2) {
cocos2d::ValueMap arg0;
std::string arg1;
- ok &= jsval_to_ccvaluemap(cx, argv[0], &arg0);
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeToFile : Error processing arguments");
bool ret = cobj->writeToFile(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8282,20 +8538,20 @@ bool js_cocos2dx_FileUtils_writeToFile(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FileUtils_getValueMapFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueMapFromFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueMapFromFile : Error processing arguments");
cocos2d::ValueMap ret = cobj->getValueMapFromFile(arg0);
jsval jsret = JSVAL_NULL;
jsret = ccvaluemap_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8304,22 +8560,22 @@ bool js_cocos2dx_FileUtils_getValueMapFromFile(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Invalid Native Object");
if (argc == 2) {
const char* arg0;
int arg1;
- std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Error processing arguments");
cocos2d::ValueMap ret = cobj->getValueMapFromData(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = ccvaluemap_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8328,20 +8584,20 @@ bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_FileUtils_removeDirectory(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_removeDirectory : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_removeDirectory : Error processing arguments");
bool ret = cobj->removeDirectory(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8350,18 +8606,18 @@ bool js_cocos2dx_FileUtils_removeDirectory(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Invalid Native Object");
if (argc == 1) {
std::vector arg0;
- ok &= jsval_to_std_vector_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Error processing arguments");
cobj->setSearchPaths(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8370,20 +8626,20 @@ bool js_cocos2dx_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getFileSize : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getFileSize : Error processing arguments");
long ret = cobj->getFileSize(arg0);
jsval jsret = JSVAL_NULL;
jsret = long_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8392,18 +8648,18 @@ bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setSearchResolutionsOrder : Invalid Native Object");
if (argc == 1) {
std::vector arg0;
- ok &= jsval_to_std_vector_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setSearchResolutionsOrder : Error processing arguments");
cobj->setSearchResolutionsOrder(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8412,28 +8668,28 @@ bool js_cocos2dx_FileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_FileUtils_addSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Error processing arguments");
cobj->addSearchResolutionsOrder(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
std::string arg0;
bool arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Error processing arguments");
cobj->addSearchResolutionsOrder(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8442,28 +8698,28 @@ bool js_cocos2dx_FileUtils_addSearchResolutionsOrder(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_FileUtils_addSearchPath(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Error processing arguments");
cobj->addSearchPath(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
std::string arg0;
bool arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Error processing arguments");
cobj->addSearchPath(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8472,20 +8728,20 @@ bool js_cocos2dx_FileUtils_addSearchPath(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_FileUtils_isFileExist(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isFileExist : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isFileExist : Error processing arguments");
bool ret = cobj->isFileExist(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8494,13 +8750,14 @@ bool js_cocos2dx_FileUtils_isFileExist(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FileUtils_purgeCachedEntries(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_purgeCachedEntries : Invalid Native Object");
if (argc == 0) {
cobj->purgeCachedEntries();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8509,42 +8766,62 @@ bool js_cocos2dx_FileUtils_purgeCachedEntries(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_FileUtils_fullPathFromRelativeFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : Invalid Native Object");
if (argc == 2) {
std::string arg0;
std::string arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
- ok &= jsval_to_std_string(cx, argv[1], &arg1);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ ok &= jsval_to_std_string(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : Error processing arguments");
std::string ret = cobj->fullPathFromRelativeFile(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : wrong number of arguments: %d, was expecting %d", argc, 2);
return false;
}
+bool js_cocos2dx_FileUtils_setWritablePath(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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setWritablePath : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setWritablePath : Error processing arguments");
+ cobj->setWritablePath(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_FileUtils_setWritablePath : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
bool js_cocos2dx_FileUtils_setPopupNotify(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setPopupNotify : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setPopupNotify : Error processing arguments");
cobj->setPopupNotify(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8553,29 +8830,50 @@ bool js_cocos2dx_FileUtils_setPopupNotify(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FileUtils_isDirectoryExist(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isDirectoryExist : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isDirectoryExist : Error processing arguments");
bool ret = cobj->isDirectoryExist(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FileUtils_isDirectoryExist : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
+bool js_cocos2dx_FileUtils_setDefaultResourceRootPath(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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : Invalid Native Object");
+ if (argc == 1) {
+ std::string arg0;
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : Error processing arguments");
+ cobj->setDefaultResourceRootPath(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : wrong number of arguments: %d, was expecting %d", argc, 1);
+ return false;
+}
bool js_cocos2dx_FileUtils_getSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getSearchResolutionsOrder : Invalid Native Object");
@@ -8583,7 +8881,7 @@ bool js_cocos2dx_FileUtils_getSearchResolutionsOrder(JSContext *cx, uint32_t arg
const std::vector& ret = cobj->getSearchResolutionsOrder();
jsval jsret = JSVAL_NULL;
jsret = std_vector_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8592,20 +8890,20 @@ bool js_cocos2dx_FileUtils_getSearchResolutionsOrder(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_FileUtils_createDirectory(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_createDirectory : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_createDirectory : Error processing arguments");
bool ret = cobj->createDirectory(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8614,7 +8912,8 @@ bool js_cocos2dx_FileUtils_createDirectory(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_FileUtils_getWritablePath(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getWritablePath : Invalid Native Object");
@@ -8622,15 +8921,39 @@ bool js_cocos2dx_FileUtils_getWritablePath(JSContext *cx, uint32_t argc, jsval *
std::string ret = cobj->getWritablePath();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FileUtils_getWritablePath : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
+bool js_cocos2dx_FileUtils_setDelegate(JSContext *cx, uint32_t argc, jsval *vp)
+{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ bool ok = true;
+ if (argc == 1) {
+ cocos2d::FileUtils* arg0;
+ do {
+ 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::FileUtils*)(jsProxy ? jsProxy->ptr : NULL);
+ JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
+ } while (0);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setDelegate : Error processing arguments");
+ cocos2d::FileUtils::setDelegate(arg0);
+ args.rval().setUndefined();
+ return true;
+ }
+ JS_ReportError(cx, "js_cocos2dx_FileUtils_setDelegate : wrong number of arguments");
+ return false;
+}
+
bool js_cocos2dx_FileUtils_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::FileUtils* ret = cocos2d::FileUtils::getInstance();
jsval jsret = JSVAL_NULL;
@@ -8642,7 +8965,7 @@ bool js_cocos2dx_FileUtils_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FileUtils_getInstance : wrong number of arguments");
@@ -8655,7 +8978,7 @@ void js_cocos2d_FileUtils_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FileUtils)", obj);
}
-void js_register_cocos2dx_FileUtils(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FileUtils(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FileUtils_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FileUtils_class->name = "FileUtils";
jsb_cocos2d_FileUtils_class->addProperty = JS_PropertyStub;
@@ -8669,8 +8992,8 @@ void js_register_cocos2dx_FileUtils(JSContext *cx, JSObject *global) {
jsb_cocos2d_FileUtils_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -8695,8 +9018,10 @@ void js_register_cocos2dx_FileUtils(JSContext *cx, JSObject *global) {
JS_FN("isFileExist", js_cocos2dx_FileUtils_isFileExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("purgeCachedEntries", js_cocos2dx_FileUtils_purgeCachedEntries, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("fullPathFromRelativeFile", js_cocos2dx_FileUtils_fullPathFromRelativeFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setWritablePath", js_cocos2dx_FileUtils_setWritablePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setPopupNotify", js_cocos2dx_FileUtils_setPopupNotify, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("isDirectoryExist", js_cocos2dx_FileUtils_isDirectoryExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("setDefaultResourceRootPath", js_cocos2dx_FileUtils_setDefaultResourceRootPath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getSearchResolutionsOrder", js_cocos2dx_FileUtils_getSearchResolutionsOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("createDirectory", js_cocos2dx_FileUtils_createDirectory, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getWritablePath", js_cocos2dx_FileUtils_getWritablePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@@ -8704,13 +9029,14 @@ void js_register_cocos2dx_FileUtils(JSContext *cx, JSObject *global) {
};
static JSFunctionSpec st_funcs[] = {
+ JS_FN("setDelegate", js_cocos2dx_FileUtils_setDelegate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getInstance", js_cocos2dx_FileUtils_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
jsb_cocos2d_FileUtils_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_FileUtils_class,
empty_constructor, 0,
properties,
@@ -8741,18 +9067,18 @@ JSObject *jsb_cocos2d_EventListener_prototype;
bool js_cocos2dx_EventListener_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_setEnabled : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListener_setEnabled : Error processing arguments");
cobj->setEnabled(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8761,7 +9087,8 @@ bool js_cocos2dx_EventListener_setEnabled(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_EventListener_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_isEnabled : Invalid Native Object");
@@ -8769,7 +9096,7 @@ bool js_cocos2dx_EventListener_isEnabled(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->isEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8778,7 +9105,8 @@ bool js_cocos2dx_EventListener_isEnabled(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_EventListener_clone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_clone : Invalid Native Object");
@@ -8793,7 +9121,7 @@ bool js_cocos2dx_EventListener_clone(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8802,7 +9130,8 @@ bool js_cocos2dx_EventListener_clone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventListener_checkAvailable(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_checkAvailable : Invalid Native Object");
@@ -8810,7 +9139,7 @@ bool js_cocos2dx_EventListener_checkAvailable(JSContext *cx, uint32_t argc, jsva
bool ret = cobj->checkAvailable();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -8823,7 +9152,7 @@ void js_cocos2d_EventListener_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventListener)", obj);
}
-void js_register_cocos2dx_EventListener(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListener(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListener_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListener_class->name = "EventListener";
jsb_cocos2d_EventListener_class->addProperty = JS_PropertyStub;
@@ -8837,8 +9166,8 @@ void js_register_cocos2dx_EventListener(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListener_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -8853,7 +9182,7 @@ void js_register_cocos2dx_EventListener(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListener_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_EventListener_class,
empty_constructor, 0,
properties,
@@ -8884,18 +9213,18 @@ JSObject *jsb_cocos2d_EventDispatcher_prototype;
bool js_cocos2dx_EventDispatcher_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_setEnabled : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_setEnabled : Error processing arguments");
cobj->setEnabled(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8904,13 +9233,14 @@ bool js_cocos2dx_EventDispatcher_setEnabled(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_EventDispatcher_removeAllEventListeners(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeAllEventListeners : Invalid Native Object");
if (argc == 0) {
cobj->removeAllEventListeners();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8919,9 +9249,9 @@ bool js_cocos2dx_EventDispatcher_removeAllEventListeners(JSContext *cx, uint32_t
}
bool js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : Invalid Native Object");
@@ -8929,24 +9259,24 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority(JSContex
cocos2d::EventListener* arg0;
cocos2d::Node* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : Error processing arguments");
cobj->addEventListenerWithSceneGraphPriority(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -8955,21 +9285,22 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority(JSContex
}
bool js_cocos2dx_EventDispatcher_addCustomEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addCustomEventListener : Invalid Native Object");
if (argc == 2) {
std::string arg0;
std::function arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
do {
- if(JS_TypeOfValue(cx, argv[1]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[1]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(1)));
auto lambda = [=](cocos2d::EventCustom* larg0) -> void {
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
jsval largv[1];
do {
if (larg0) {
@@ -8979,8 +9310,8 @@ bool js_cocos2dx_EventDispatcher_addCustomEventListener(JSContext *cx, uint32_t
largv[0] = JSVAL_NULL;
}
} while (0);
- jsval rval;
- bool ok = func->invoke(1, &largv[0], rval);
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(1, &largv[0], &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -9004,7 +9335,7 @@ bool js_cocos2dx_EventDispatcher_addCustomEventListener(JSContext *cx, uint32_t
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9013,9 +9344,9 @@ bool js_cocos2dx_EventDispatcher_addCustomEventListener(JSContext *cx, uint32_t
}
bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : Invalid Native Object");
@@ -9023,17 +9354,17 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx
cocos2d::EventListener* arg0;
int arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : Error processing arguments");
cobj->addEventListenerWithFixedPriority(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9042,12 +9373,12 @@ bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx
}
bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::EventDispatcher* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListenersForTarget : Invalid Native Object");
@@ -9055,16 +9386,16 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cobj->removeEventListenersForTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -9073,18 +9404,18 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui
if (argc == 2) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
bool arg1;
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ arg1 = JS::ToBoolean(args.get(1));
cobj->removeEventListenersForTarget(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -9092,10 +9423,10 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui
do {
if (argc == 1) {
cocos2d::EventListener::Type arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
if (!ok) { ok = true; break; }
cobj->removeEventListenersForType(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -9105,42 +9436,42 @@ bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, ui
}
bool js_cocos2dx_EventDispatcher_resumeEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Error processing arguments");
cobj->resumeEventListenersForTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
cocos2d::Node* arg0;
bool arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Error processing arguments");
cobj->resumeEventListenersForTarget(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9149,9 +9480,9 @@ bool js_cocos2dx_EventDispatcher_resumeEventListenersForTarget(JSContext *cx, ui
}
bool js_cocos2dx_EventDispatcher_setPriority(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_setPriority : Invalid Native Object");
@@ -9159,17 +9490,17 @@ bool js_cocos2dx_EventDispatcher_setPriority(JSContext *cx, uint32_t argc, jsval
cocos2d::EventListener* arg0;
int arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_setPriority : Error processing arguments");
cobj->setPriority(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9178,25 +9509,25 @@ bool js_cocos2dx_EventDispatcher_setPriority(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_EventDispatcher_dispatchEvent(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_dispatchEvent : Invalid Native Object");
if (argc == 1) {
cocos2d::Event* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Event*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_dispatchEvent : Error processing arguments");
cobj->dispatchEvent(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9205,42 +9536,42 @@ bool js_cocos2dx_EventDispatcher_dispatchEvent(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_EventDispatcher_pauseEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Error processing arguments");
cobj->pauseEventListenersForTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
if (argc == 2) {
cocos2d::Node* arg0;
bool arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- arg1 = JS::ToBoolean(JS::RootedValue(cx, argv[1]));
+ arg1 = JS::ToBoolean(args.get(1));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Error processing arguments");
cobj->pauseEventListenersForTarget(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9249,18 +9580,18 @@ bool js_cocos2dx_EventDispatcher_pauseEventListenersForTarget(JSContext *cx, uin
}
bool js_cocos2dx_EventDispatcher_removeCustomEventListeners(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeCustomEventListeners : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_removeCustomEventListeners : Error processing arguments");
cobj->removeCustomEventListeners(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9269,25 +9600,25 @@ bool js_cocos2dx_EventDispatcher_removeCustomEventListeners(JSContext *cx, uint3
}
bool js_cocos2dx_EventDispatcher_removeEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListener : Invalid Native Object");
if (argc == 1) {
cocos2d::EventListener* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_removeEventListener : Error processing arguments");
cobj->removeEventListener(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9296,7 +9627,8 @@ bool js_cocos2dx_EventDispatcher_removeEventListener(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_EventDispatcher_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_isEnabled : Invalid Native Object");
@@ -9304,7 +9636,7 @@ bool js_cocos2dx_EventDispatcher_isEnabled(JSContext *cx, uint32_t argc, jsval *
bool ret = cobj->isEnabled();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9313,7 +9645,7 @@ bool js_cocos2dx_EventDispatcher_isEnabled(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_EventDispatcher_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventDispatcher* cobj = new (std::nothrow) cocos2d::EventDispatcher();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -9327,13 +9659,16 @@ bool js_cocos2dx_EventDispatcher_constructor(JSContext *cx, uint32_t argc, jsval
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventDispatcher");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventDispatcher");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -9343,7 +9678,7 @@ void js_cocos2d_EventDispatcher_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventDispatcher)", obj);
}
-void js_register_cocos2dx_EventDispatcher(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventDispatcher(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventDispatcher_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventDispatcher_class->name = "EventDispatcher";
jsb_cocos2d_EventDispatcher_class->addProperty = JS_PropertyStub;
@@ -9357,8 +9692,8 @@ void js_register_cocos2dx_EventDispatcher(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventDispatcher_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -9382,7 +9717,7 @@ void js_register_cocos2dx_EventDispatcher(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventDispatcher_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_EventDispatcher_class,
js_cocos2dx_EventDispatcher_constructor, 0, // constructor
properties,
@@ -9413,7 +9748,8 @@ JSObject *jsb_cocos2d_EventListenerTouchOneByOne_prototype;
bool js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches : Invalid Native Object");
@@ -9421,7 +9757,7 @@ bool js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches(JSContext *cx, uint
bool ret = cobj->isSwallowTouches();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9430,18 +9766,18 @@ bool js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches(JSContext *cx, uint
}
bool js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches : Error processing arguments");
cobj->setSwallowTouches(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9450,7 +9786,8 @@ bool js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches(JSContext *cx, uin
}
bool js_cocos2dx_EventListenerTouchOneByOne_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_init : Invalid Native Object");
@@ -9458,7 +9795,7 @@ bool js_cocos2dx_EventListenerTouchOneByOne_init(JSContext *cx, uint32_t argc, j
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9467,7 +9804,7 @@ bool js_cocos2dx_EventListenerTouchOneByOne_init(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_EventListenerTouchOneByOne_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerTouchOneByOne* cobj = new (std::nothrow) cocos2d::EventListenerTouchOneByOne();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -9481,13 +9818,16 @@ bool js_cocos2dx_EventListenerTouchOneByOne_constructor(JSContext *cx, uint32_t
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerTouchOneByOne");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerTouchOneByOne");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -9498,7 +9838,7 @@ void js_cocos2d_EventListenerTouchOneByOne_finalize(JSFreeOp *fop, JSObject *obj
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerTouchOneByOne)", obj);
}
-void js_register_cocos2dx_EventListenerTouchOneByOne(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerTouchOneByOne(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerTouchOneByOne_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerTouchOneByOne_class->name = "EventListenerTouchOneByOne";
jsb_cocos2d_EventListenerTouchOneByOne_class->addProperty = JS_PropertyStub;
@@ -9512,8 +9852,8 @@ void js_register_cocos2dx_EventListenerTouchOneByOne(JSContext *cx, JSObject *gl
jsb_cocos2d_EventListenerTouchOneByOne_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -9527,7 +9867,7 @@ void js_register_cocos2dx_EventListenerTouchOneByOne(JSContext *cx, JSObject *gl
jsb_cocos2d_EventListenerTouchOneByOne_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerTouchOneByOne_class,
js_cocos2dx_EventListenerTouchOneByOne_constructor, 0, // constructor
properties,
@@ -9558,7 +9898,8 @@ JSObject *jsb_cocos2d_EventListenerTouchAllAtOnce_prototype;
bool js_cocos2dx_EventListenerTouchAllAtOnce_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerTouchAllAtOnce* cobj = (cocos2d::EventListenerTouchAllAtOnce *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchAllAtOnce_init : Invalid Native Object");
@@ -9566,7 +9907,7 @@ bool js_cocos2dx_EventListenerTouchAllAtOnce_init(JSContext *cx, uint32_t argc,
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9575,7 +9916,7 @@ bool js_cocos2dx_EventListenerTouchAllAtOnce_init(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_EventListenerTouchAllAtOnce_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerTouchAllAtOnce* cobj = new (std::nothrow) cocos2d::EventListenerTouchAllAtOnce();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -9589,13 +9930,16 @@ bool js_cocos2dx_EventListenerTouchAllAtOnce_constructor(JSContext *cx, uint32_t
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerTouchAllAtOnce");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerTouchAllAtOnce");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -9606,7 +9950,7 @@ void js_cocos2d_EventListenerTouchAllAtOnce_finalize(JSFreeOp *fop, JSObject *ob
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerTouchAllAtOnce)", obj);
}
-void js_register_cocos2dx_EventListenerTouchAllAtOnce(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerTouchAllAtOnce(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerTouchAllAtOnce_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerTouchAllAtOnce_class->name = "EventListenerTouchAllAtOnce";
jsb_cocos2d_EventListenerTouchAllAtOnce_class->addProperty = JS_PropertyStub;
@@ -9620,8 +9964,8 @@ void js_register_cocos2dx_EventListenerTouchAllAtOnce(JSContext *cx, JSObject *g
jsb_cocos2d_EventListenerTouchAllAtOnce_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -9633,7 +9977,7 @@ void js_register_cocos2dx_EventListenerTouchAllAtOnce(JSContext *cx, JSObject *g
jsb_cocos2d_EventListenerTouchAllAtOnce_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerTouchAllAtOnce_class,
js_cocos2dx_EventListenerTouchAllAtOnce_constructor, 0, // constructor
properties,
@@ -9664,7 +10008,8 @@ JSObject *jsb_cocos2d_EventListenerKeyboard_prototype;
bool js_cocos2dx_EventListenerKeyboard_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerKeyboard* cobj = (cocos2d::EventListenerKeyboard *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerKeyboard_init : Invalid Native Object");
@@ -9672,7 +10017,7 @@ bool js_cocos2dx_EventListenerKeyboard_init(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9681,7 +10026,7 @@ bool js_cocos2dx_EventListenerKeyboard_init(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_EventListenerKeyboard_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerKeyboard* cobj = new (std::nothrow) cocos2d::EventListenerKeyboard();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -9695,13 +10040,16 @@ bool js_cocos2dx_EventListenerKeyboard_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerKeyboard");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerKeyboard");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -9712,7 +10060,7 @@ void js_cocos2d_EventListenerKeyboard_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerKeyboard)", obj);
}
-void js_register_cocos2dx_EventListenerKeyboard(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerKeyboard(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerKeyboard_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerKeyboard_class->name = "EventListenerKeyboard";
jsb_cocos2d_EventListenerKeyboard_class->addProperty = JS_PropertyStub;
@@ -9726,8 +10074,8 @@ void js_register_cocos2dx_EventListenerKeyboard(JSContext *cx, JSObject *global)
jsb_cocos2d_EventListenerKeyboard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -9739,7 +10087,7 @@ void js_register_cocos2dx_EventListenerKeyboard(JSContext *cx, JSObject *global)
jsb_cocos2d_EventListenerKeyboard_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerKeyboard_class,
js_cocos2dx_EventListenerKeyboard_constructor, 0, // constructor
properties,
@@ -9770,7 +10118,8 @@ JSObject *jsb_cocos2d_EventMouse_prototype;
bool js_cocos2dx_EventMouse_getMouseButton(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getMouseButton : Invalid Native Object");
@@ -9778,7 +10127,7 @@ bool js_cocos2dx_EventMouse_getMouseButton(JSContext *cx, uint32_t argc, jsval *
int ret = cobj->getMouseButton();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9787,7 +10136,8 @@ bool js_cocos2dx_EventMouse_getMouseButton(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_EventMouse_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getLocation : Invalid Native Object");
@@ -9795,7 +10145,7 @@ bool js_cocos2dx_EventMouse_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec2 ret = cobj->getLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9804,18 +10154,18 @@ bool js_cocos2dx_EventMouse_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_setMouseButton(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Error processing arguments");
cobj->setMouseButton(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9824,20 +10174,20 @@ bool js_cocos2dx_EventMouse_setMouseButton(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_EventMouse_setScrollData(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setScrollData : Invalid Native Object");
if (argc == 2) {
double arg0;
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setScrollData : Error processing arguments");
cobj->setScrollData(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9846,7 +10196,8 @@ bool js_cocos2dx_EventMouse_setScrollData(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_EventMouse_getPreviousLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getPreviousLocationInView : Invalid Native Object");
@@ -9854,7 +10205,7 @@ bool js_cocos2dx_EventMouse_getPreviousLocationInView(JSContext *cx, uint32_t ar
cocos2d::Vec2 ret = cobj->getPreviousLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9863,7 +10214,8 @@ bool js_cocos2dx_EventMouse_getPreviousLocationInView(JSContext *cx, uint32_t ar
}
bool js_cocos2dx_EventMouse_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getDelta : Invalid Native Object");
@@ -9871,7 +10223,7 @@ bool js_cocos2dx_EventMouse_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::Vec2 ret = cobj->getDelta();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9880,7 +10232,8 @@ bool js_cocos2dx_EventMouse_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getStartLocation : Invalid Native Object");
@@ -9888,7 +10241,7 @@ bool js_cocos2dx_EventMouse_getStartLocation(JSContext *cx, uint32_t argc, jsval
cocos2d::Vec2 ret = cobj->getStartLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9897,7 +10250,8 @@ bool js_cocos2dx_EventMouse_getStartLocation(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_EventMouse_getCursorY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getCursorY : Invalid Native Object");
@@ -9905,7 +10259,7 @@ bool js_cocos2dx_EventMouse_getCursorY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getCursorY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9914,7 +10268,8 @@ bool js_cocos2dx_EventMouse_getCursorY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_getCursorX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getCursorX : Invalid Native Object");
@@ -9922,7 +10277,7 @@ bool js_cocos2dx_EventMouse_getCursorX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getCursorX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9931,7 +10286,8 @@ bool js_cocos2dx_EventMouse_getCursorX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getLocationInView : Invalid Native Object");
@@ -9939,7 +10295,7 @@ bool js_cocos2dx_EventMouse_getLocationInView(JSContext *cx, uint32_t argc, jsva
cocos2d::Vec2 ret = cobj->getLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9948,7 +10304,8 @@ bool js_cocos2dx_EventMouse_getLocationInView(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_EventMouse_getScrollY(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getScrollY : Invalid Native Object");
@@ -9956,7 +10313,7 @@ bool js_cocos2dx_EventMouse_getScrollY(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScrollY();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -9965,20 +10322,20 @@ bool js_cocos2dx_EventMouse_getScrollY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_setCursorPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Invalid Native Object");
if (argc == 2) {
double arg0;
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Error processing arguments");
cobj->setCursorPosition(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -9987,7 +10344,8 @@ bool js_cocos2dx_EventMouse_setCursorPosition(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_EventMouse_getScrollX(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getScrollX : Invalid Native Object");
@@ -9995,7 +10353,7 @@ bool js_cocos2dx_EventMouse_getScrollX(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getScrollX();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10004,7 +10362,8 @@ bool js_cocos2dx_EventMouse_getScrollX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EventMouse_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getPreviousLocation : Invalid Native Object");
@@ -10012,7 +10371,7 @@ bool js_cocos2dx_EventMouse_getPreviousLocation(JSContext *cx, uint32_t argc, js
cocos2d::Vec2 ret = cobj->getPreviousLocation();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10021,7 +10380,8 @@ bool js_cocos2dx_EventMouse_getPreviousLocation(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_EventMouse_getStartLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getStartLocationInView : Invalid Native Object");
@@ -10029,7 +10389,7 @@ bool js_cocos2dx_EventMouse_getStartLocationInView(JSContext *cx, uint32_t argc,
cocos2d::Vec2 ret = cobj->getStartLocationInView();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10038,10 +10398,10 @@ bool js_cocos2dx_EventMouse_getStartLocationInView(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_EventMouse_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventMouse::MouseEventType arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_constructor : Error processing arguments");
cocos2d::EventMouse* cobj = new (std::nothrow) cocos2d::EventMouse(arg0);
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10055,13 +10415,16 @@ bool js_cocos2dx_EventMouse_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventMouse");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventMouse");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10072,7 +10435,7 @@ void js_cocos2d_EventMouse_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventMouse)", obj);
}
-void js_register_cocos2dx_EventMouse(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventMouse(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventMouse_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventMouse_class->name = "EventMouse";
jsb_cocos2d_EventMouse_class->addProperty = JS_PropertyStub;
@@ -10086,8 +10449,8 @@ void js_register_cocos2dx_EventMouse(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventMouse_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10113,7 +10476,7 @@ void js_register_cocos2dx_EventMouse(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventMouse_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Event_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Event_prototype),
jsb_cocos2d_EventMouse_class,
js_cocos2dx_EventMouse_constructor, 0, // constructor
properties,
@@ -10144,7 +10507,8 @@ JSObject *jsb_cocos2d_EventListenerMouse_prototype;
bool js_cocos2dx_EventListenerMouse_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerMouse* cobj = (cocos2d::EventListenerMouse *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerMouse_init : Invalid Native Object");
@@ -10152,7 +10516,7 @@ bool js_cocos2dx_EventListenerMouse_init(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10161,7 +10525,7 @@ bool js_cocos2dx_EventListenerMouse_init(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_EventListenerMouse_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerMouse* cobj = new (std::nothrow) cocos2d::EventListenerMouse();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10175,13 +10539,16 @@ bool js_cocos2dx_EventListenerMouse_constructor(JSContext *cx, uint32_t argc, js
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerMouse");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerMouse");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10192,7 +10559,7 @@ void js_cocos2d_EventListenerMouse_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerMouse)", obj);
}
-void js_register_cocos2dx_EventListenerMouse(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerMouse(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerMouse_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerMouse_class->name = "EventListenerMouse";
jsb_cocos2d_EventListenerMouse_class->addProperty = JS_PropertyStub;
@@ -10206,8 +10573,8 @@ void js_register_cocos2dx_EventListenerMouse(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListenerMouse_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10219,7 +10586,7 @@ void js_register_cocos2dx_EventListenerMouse(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListenerMouse_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerMouse_class,
js_cocos2dx_EventListenerMouse_constructor, 0, // constructor
properties,
@@ -10250,10 +10617,10 @@ JSObject *jsb_cocos2d_EventAcceleration_prototype;
bool js_cocos2dx_EventAcceleration_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Acceleration arg0;
- ok &= jsval_to_ccacceleration(cx, argv[0], &arg0);
+ ok &= jsval_to_ccacceleration(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventAcceleration_constructor : Error processing arguments");
cocos2d::EventAcceleration* cobj = new (std::nothrow) cocos2d::EventAcceleration(arg0);
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10267,13 +10634,16 @@ bool js_cocos2dx_EventAcceleration_constructor(JSContext *cx, uint32_t argc, jsv
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventAcceleration");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventAcceleration");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10284,7 +10654,7 @@ void js_cocos2d_EventAcceleration_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventAcceleration)", obj);
}
-void js_register_cocos2dx_EventAcceleration(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventAcceleration(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventAcceleration_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventAcceleration_class->name = "EventAcceleration";
jsb_cocos2d_EventAcceleration_class->addProperty = JS_PropertyStub;
@@ -10298,8 +10668,8 @@ void js_register_cocos2dx_EventAcceleration(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventAcceleration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10310,7 +10680,7 @@ void js_register_cocos2dx_EventAcceleration(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventAcceleration_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Event_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Event_prototype),
jsb_cocos2d_EventAcceleration_class,
js_cocos2dx_EventAcceleration_constructor, 0, // constructor
properties,
@@ -10341,19 +10711,20 @@ JSObject *jsb_cocos2d_EventListenerAcceleration_prototype;
bool js_cocos2dx_EventListenerAcceleration_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EventListenerAcceleration* cobj = (cocos2d::EventListenerAcceleration *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerAcceleration_init : Invalid Native Object");
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=](cocos2d::Acceleration* larg0, cocos2d::Event* larg1) -> void {
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
jsval largv[2];
largv[0] = ccacceleration_to_jsval(cx, *larg0);
do {
@@ -10364,8 +10735,8 @@ bool js_cocos2dx_EventListenerAcceleration_init(JSContext *cx, uint32_t argc, js
largv[1] = JSVAL_NULL;
}
} while (0);
- jsval rval;
- bool ok = func->invoke(2, &largv[0], rval);
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(2, &largv[0], &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -10382,7 +10753,7 @@ bool js_cocos2dx_EventListenerAcceleration_init(JSContext *cx, uint32_t argc, js
bool ret = cobj->init(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10391,15 +10762,16 @@ bool js_cocos2dx_EventListenerAcceleration_init(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_EventListenerAcceleration_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
std::function arg0;
do {
- if(JS_TypeOfValue(cx, argv[0]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[0]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(0)));
auto lambda = [=](cocos2d::Acceleration* larg0, cocos2d::Event* larg1) -> void {
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
jsval largv[2];
largv[0] = ccacceleration_to_jsval(cx, *larg0);
do {
@@ -10410,8 +10782,8 @@ bool js_cocos2dx_EventListenerAcceleration_create(JSContext *cx, uint32_t argc,
largv[1] = JSVAL_NULL;
}
} while (0);
- jsval rval;
- bool ok = func->invoke(2, &largv[0], rval);
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(2, &largv[0], &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -10435,7 +10807,7 @@ bool js_cocos2dx_EventListenerAcceleration_create(JSContext *cx, uint32_t argc,
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EventListenerAcceleration_create : wrong number of arguments");
@@ -10444,7 +10816,7 @@ bool js_cocos2dx_EventListenerAcceleration_create(JSContext *cx, uint32_t argc,
bool js_cocos2dx_EventListenerAcceleration_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerAcceleration* cobj = new (std::nothrow) cocos2d::EventListenerAcceleration();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10458,13 +10830,16 @@ bool js_cocos2dx_EventListenerAcceleration_constructor(JSContext *cx, uint32_t a
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerAcceleration");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerAcceleration");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10475,7 +10850,7 @@ void js_cocos2d_EventListenerAcceleration_finalize(JSFreeOp *fop, JSObject *obj)
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerAcceleration)", obj);
}
-void js_register_cocos2dx_EventListenerAcceleration(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerAcceleration(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerAcceleration_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerAcceleration_class->name = "EventListenerAcceleration";
jsb_cocos2d_EventListenerAcceleration_class->addProperty = JS_PropertyStub;
@@ -10489,8 +10864,8 @@ void js_register_cocos2dx_EventListenerAcceleration(JSContext *cx, JSObject *glo
jsb_cocos2d_EventListenerAcceleration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10505,7 +10880,7 @@ void js_register_cocos2dx_EventListenerAcceleration(JSContext *cx, JSObject *glo
jsb_cocos2d_EventListenerAcceleration_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerAcceleration_class,
js_cocos2dx_EventListenerAcceleration_constructor, 0, // constructor
properties,
@@ -10536,7 +10911,8 @@ JSObject *jsb_cocos2d_EventCustom_prototype;
bool js_cocos2dx_EventCustom_getEventName(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventCustom* cobj = (cocos2d::EventCustom *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventCustom_getEventName : Invalid Native Object");
@@ -10544,7 +10920,7 @@ bool js_cocos2dx_EventCustom_getEventName(JSContext *cx, uint32_t argc, jsval *v
const std::string& ret = cobj->getEventName();
jsval jsret = JSVAL_NULL;
jsret = std_string_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -10553,10 +10929,10 @@ bool js_cocos2dx_EventCustom_getEventName(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_EventCustom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventCustom_constructor : Error processing arguments");
cocos2d::EventCustom* cobj = new (std::nothrow) cocos2d::EventCustom(arg0);
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10570,13 +10946,16 @@ bool js_cocos2dx_EventCustom_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventCustom");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventCustom");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10587,7 +10966,7 @@ void js_cocos2d_EventCustom_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventCustom)", obj);
}
-void js_register_cocos2dx_EventCustom(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventCustom(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventCustom_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventCustom_class->name = "EventCustom";
jsb_cocos2d_EventCustom_class->addProperty = JS_PropertyStub;
@@ -10601,8 +10980,8 @@ void js_register_cocos2dx_EventCustom(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventCustom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10614,7 +10993,7 @@ void js_register_cocos2dx_EventCustom(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventCustom_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Event_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Event_prototype),
jsb_cocos2d_EventCustom_class,
js_cocos2dx_EventCustom_constructor, 0, // constructor
properties,
@@ -10645,17 +11024,18 @@ JSObject *jsb_cocos2d_EventListenerCustom_prototype;
bool js_cocos2dx_EventListenerCustom_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
std::string arg0;
std::function arg1;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
do {
- if(JS_TypeOfValue(cx, argv[1]) == JSTYPE_FUNCTION)
+ if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
{
- std::shared_ptr func(new JSFunctionWrapper(cx, JS_THIS_OBJECT(cx, vp), argv[1]));
+ std::shared_ptr func(new JSFunctionWrapper(cx, args.thisv().toObjectOrNull(), args.get(1)));
auto lambda = [=](cocos2d::EventCustom* larg0) -> void {
+ JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
jsval largv[1];
do {
if (larg0) {
@@ -10665,8 +11045,8 @@ bool js_cocos2dx_EventListenerCustom_create(JSContext *cx, uint32_t argc, jsval
largv[0] = JSVAL_NULL;
}
} while (0);
- jsval rval;
- bool ok = func->invoke(1, &largv[0], rval);
+ JS::RootedValue rval(cx);
+ bool ok = func->invoke(1, &largv[0], &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
@@ -10690,7 +11070,7 @@ bool js_cocos2dx_EventListenerCustom_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EventListenerCustom_create : wrong number of arguments");
@@ -10699,7 +11079,7 @@ bool js_cocos2dx_EventListenerCustom_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EventListenerCustom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerCustom* cobj = new (std::nothrow) cocos2d::EventListenerCustom();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10713,13 +11093,16 @@ bool js_cocos2dx_EventListenerCustom_constructor(JSContext *cx, uint32_t argc, j
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerCustom");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerCustom");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10730,7 +11113,7 @@ void js_cocos2d_EventListenerCustom_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerCustom)", obj);
}
-void js_register_cocos2dx_EventListenerCustom(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerCustom(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerCustom_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerCustom_class->name = "EventListenerCustom";
jsb_cocos2d_EventListenerCustom_class->addProperty = JS_PropertyStub;
@@ -10744,8 +11127,8 @@ void js_register_cocos2dx_EventListenerCustom(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListenerCustom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10759,7 +11142,7 @@ void js_register_cocos2dx_EventListenerCustom(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListenerCustom_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerCustom_class,
js_cocos2dx_EventListenerCustom_constructor, 0, // constructor
properties,
@@ -10790,22 +11173,22 @@ JSObject *jsb_cocos2d_EventFocus_prototype;
bool js_cocos2dx_EventFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ui::Widget* arg0;
cocos2d::ui::Widget* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -10823,13 +11206,16 @@ bool js_cocos2dx_EventFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventFocus");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventFocus");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10840,7 +11226,7 @@ void js_cocos2d_EventFocus_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventFocus)", obj);
}
-void js_register_cocos2dx_EventFocus(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventFocus(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventFocus_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventFocus_class->name = "EventFocus";
jsb_cocos2d_EventFocus_class->addProperty = JS_PropertyStub;
@@ -10854,8 +11240,8 @@ void js_register_cocos2dx_EventFocus(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventFocus_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10866,7 +11252,7 @@ void js_register_cocos2dx_EventFocus(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventFocus_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Event_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Event_prototype),
jsb_cocos2d_EventFocus_class,
js_cocos2dx_EventFocus_constructor, 0, // constructor
properties,
@@ -10897,7 +11283,8 @@ JSObject *jsb_cocos2d_EventListenerFocus_prototype;
bool js_cocos2dx_EventListenerFocus_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EventListenerFocus* cobj = (cocos2d::EventListenerFocus *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerFocus_init : Invalid Native Object");
@@ -10905,36 +11292,16 @@ bool js_cocos2dx_EventListenerFocus_init(JSContext *cx, uint32_t argc, jsval *vp
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EventListenerFocus_init : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
-bool js_cocos2dx_EventListenerFocus_create(JSContext *cx, uint32_t argc, jsval *vp)
-{
- if (argc == 0) {
- cocos2d::EventListenerFocus* ret = cocos2d::EventListenerFocus::create();
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::EventListenerFocus*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
- }
- } while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
- JS_ReportError(cx, "js_cocos2dx_EventListenerFocus_create : wrong number of arguments");
- return false;
-}
-
bool js_cocos2dx_EventListenerFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EventListenerFocus* cobj = new (std::nothrow) cocos2d::EventListenerFocus();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -10948,13 +11315,16 @@ bool js_cocos2dx_EventListenerFocus_constructor(JSContext *cx, uint32_t argc, js
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerFocus");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventListenerFocus");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -10965,7 +11335,7 @@ void js_cocos2d_EventListenerFocus_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EventListenerFocus)", obj);
}
-void js_register_cocos2dx_EventListenerFocus(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EventListenerFocus(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EventListenerFocus_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EventListenerFocus_class->name = "EventListenerFocus";
jsb_cocos2d_EventListenerFocus_class->addProperty = JS_PropertyStub;
@@ -10979,8 +11349,8 @@ void js_register_cocos2dx_EventListenerFocus(JSContext *cx, JSObject *global) {
jsb_cocos2d_EventListenerFocus_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -10988,14 +11358,11 @@ void js_register_cocos2dx_EventListenerFocus(JSContext *cx, JSObject *global) {
JS_FS_END
};
- static JSFunctionSpec st_funcs[] = {
- JS_FN("create", js_cocos2dx_EventListenerFocus_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
- JS_FS_END
- };
+ JSFunctionSpec *st_funcs = NULL;
jsb_cocos2d_EventListenerFocus_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EventListener_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EventListener_prototype),
jsb_cocos2d_EventListenerFocus_class,
js_cocos2dx_EventListenerFocus_constructor, 0, // constructor
properties,
@@ -11026,25 +11393,25 @@ JSObject *jsb_cocos2d_Action_prototype;
bool js_cocos2dx_Action_startWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_startWithTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_startWithTarget : Error processing arguments");
cobj->startWithTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11053,25 +11420,25 @@ bool js_cocos2dx_Action_startWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_setOriginalTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setOriginalTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setOriginalTarget : Error processing arguments");
cobj->setOriginalTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11080,7 +11447,8 @@ bool js_cocos2dx_Action_setOriginalTarget(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Action_clone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_clone : Invalid Native Object");
@@ -11095,7 +11463,7 @@ bool js_cocos2dx_Action_clone(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11104,7 +11472,8 @@ bool js_cocos2dx_Action_clone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_getOriginalTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getOriginalTarget : Invalid Native Object");
@@ -11119,7 +11488,7 @@ bool js_cocos2dx_Action_getOriginalTarget(JSContext *cx, uint32_t argc, jsval *v
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11128,13 +11497,14 @@ bool js_cocos2dx_Action_getOriginalTarget(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Action_stop(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_stop : Invalid Native Object");
if (argc == 0) {
cobj->stop();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11143,18 +11513,18 @@ bool js_cocos2dx_Action_stop(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_update(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_update : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_update : Error processing arguments");
cobj->update(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11163,7 +11533,8 @@ bool js_cocos2dx_Action_update(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_getTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getTarget : Invalid Native Object");
@@ -11178,7 +11549,7 @@ bool js_cocos2dx_Action_getTarget(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11187,18 +11558,18 @@ bool js_cocos2dx_Action_getTarget(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_step(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_step : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_step : Error processing arguments");
cobj->step(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11207,18 +11578,18 @@ bool js_cocos2dx_Action_step(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_setTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTag : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setTag : Error processing arguments");
cobj->setTag(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11227,7 +11598,8 @@ bool js_cocos2dx_Action_setTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_getTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getTag : Invalid Native Object");
@@ -11235,7 +11607,7 @@ bool js_cocos2dx_Action_getTag(JSContext *cx, uint32_t argc, jsval *vp)
int ret = cobj->getTag();
jsval jsret = JSVAL_NULL;
jsret = int32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11244,25 +11616,25 @@ bool js_cocos2dx_Action_getTag(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_setTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setTarget : Error processing arguments");
cobj->setTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11271,7 +11643,8 @@ bool js_cocos2dx_Action_setTarget(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_isDone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_isDone : Invalid Native Object");
@@ -11279,7 +11652,7 @@ bool js_cocos2dx_Action_isDone(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isDone();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11288,7 +11661,8 @@ bool js_cocos2dx_Action_isDone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Action_reverse(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_reverse : Invalid Native Object");
@@ -11303,7 +11677,7 @@ bool js_cocos2dx_Action_reverse(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11316,7 +11690,7 @@ void js_cocos2d_Action_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Action)", obj);
}
-void js_register_cocos2dx_Action(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Action(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Action_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Action_class->name = "Action";
jsb_cocos2d_Action_class->addProperty = JS_PropertyStub;
@@ -11330,8 +11704,8 @@ void js_register_cocos2dx_Action(JSContext *cx, JSObject *global) {
jsb_cocos2d_Action_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -11355,7 +11729,7 @@ void js_register_cocos2dx_Action(JSContext *cx, JSObject *global) {
jsb_cocos2d_Action_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Action_class,
empty_constructor, 0,
properties,
@@ -11386,18 +11760,18 @@ JSObject *jsb_cocos2d_FiniteTimeAction_prototype;
bool js_cocos2dx_FiniteTimeAction_setDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FiniteTimeAction* cobj = (cocos2d::FiniteTimeAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Error processing arguments");
cobj->setDuration(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11406,7 +11780,8 @@ bool js_cocos2dx_FiniteTimeAction_setDuration(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_FiniteTimeAction_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::FiniteTimeAction* cobj = (cocos2d::FiniteTimeAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FiniteTimeAction_getDuration : Invalid Native Object");
@@ -11414,7 +11789,7 @@ bool js_cocos2dx_FiniteTimeAction_getDuration(JSContext *cx, uint32_t argc, jsva
double ret = cobj->getDuration();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11428,7 +11803,7 @@ void js_cocos2d_FiniteTimeAction_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FiniteTimeAction)", obj);
}
-void js_register_cocos2dx_FiniteTimeAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FiniteTimeAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FiniteTimeAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FiniteTimeAction_class->name = "FiniteTimeAction";
jsb_cocos2d_FiniteTimeAction_class->addProperty = JS_PropertyStub;
@@ -11442,8 +11817,8 @@ void js_register_cocos2dx_FiniteTimeAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_FiniteTimeAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -11456,7 +11831,7 @@ void js_register_cocos2dx_FiniteTimeAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_FiniteTimeAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Action_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Action_prototype),
jsb_cocos2d_FiniteTimeAction_class,
empty_constructor, 0,
properties,
@@ -11487,25 +11862,25 @@ JSObject *jsb_cocos2d_Speed_prototype;
bool js_cocos2dx_Speed_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setInnerAction : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_setInnerAction : Error processing arguments");
cobj->setInnerAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11514,7 +11889,8 @@ bool js_cocos2dx_Speed_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Speed_getSpeed(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_getSpeed : Invalid Native Object");
@@ -11522,7 +11898,7 @@ bool js_cocos2dx_Speed_getSpeed(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getSpeed();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11531,18 +11907,18 @@ bool js_cocos2dx_Speed_getSpeed(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Speed_setSpeed(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setSpeed : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_setSpeed : Error processing arguments");
cobj->setSpeed(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11551,9 +11927,9 @@ bool js_cocos2dx_Speed_setSpeed(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Speed_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_initWithAction : Invalid Native Object");
@@ -11561,19 +11937,19 @@ bool js_cocos2dx_Speed_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_initWithAction : Error processing arguments");
bool ret = cobj->initWithAction(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11582,7 +11958,8 @@ bool js_cocos2dx_Speed_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Speed_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_getInnerAction : Invalid Native Object");
@@ -11597,7 +11974,7 @@ bool js_cocos2dx_Speed_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11606,20 +11983,20 @@ bool js_cocos2dx_Speed_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Speed_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_create : Error processing arguments");
cocos2d::Speed* ret = cocos2d::Speed::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -11631,7 +12008,7 @@ bool js_cocos2dx_Speed_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Speed_create : wrong number of arguments");
@@ -11640,7 +12017,7 @@ bool js_cocos2dx_Speed_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Speed_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Speed* cobj = new (std::nothrow) cocos2d::Speed();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -11654,13 +12031,16 @@ bool js_cocos2dx_Speed_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Speed");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Speed");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -11671,7 +12051,7 @@ void js_cocos2d_Speed_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Speed)", obj);
}
-void js_register_cocos2dx_Speed(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Speed(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Speed_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Speed_class->name = "Speed";
jsb_cocos2d_Speed_class->addProperty = JS_PropertyStub;
@@ -11685,8 +12065,8 @@ void js_register_cocos2dx_Speed(JSContext *cx, JSObject *global) {
jsb_cocos2d_Speed_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -11705,7 +12085,7 @@ void js_register_cocos2dx_Speed(JSContext *cx, JSObject *global) {
jsb_cocos2d_Speed_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Action_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Action_prototype),
jsb_cocos2d_Speed_class,
js_cocos2dx_Speed_constructor, 0, // constructor
properties,
@@ -11736,18 +12116,18 @@ JSObject *jsb_cocos2d_Follow_prototype;
bool js_cocos2dx_Follow_setBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_setBoundarySet : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_setBoundarySet : Error processing arguments");
cobj->setBoundarySet(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -11756,18 +12136,18 @@ bool js_cocos2dx_Follow_setBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_initWithTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -11776,26 +12156,26 @@ bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->initWithTarget(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
cocos2d::Node* arg0;
cocos2d::Rect arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_initWithTarget : Error processing arguments");
bool ret = cobj->initWithTarget(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11804,7 +12184,8 @@ bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Follow_isBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_isBoundarySet : Invalid Native Object");
@@ -11812,7 +12193,7 @@ bool js_cocos2dx_Follow_isBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isBoundarySet();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11821,14 +12202,14 @@ bool js_cocos2dx_Follow_isBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -11844,21 +12225,21 @@ bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
cocos2d::Node* arg0;
cocos2d::Rect arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_create : Error processing arguments");
cocos2d::Follow* ret = cocos2d::Follow::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -11870,7 +12251,7 @@ bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Follow_create : wrong number of arguments");
@@ -11879,7 +12260,7 @@ bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Follow_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Follow* cobj = new (std::nothrow) cocos2d::Follow();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -11893,13 +12274,16 @@ bool js_cocos2dx_Follow_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Follow");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Follow");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -11910,7 +12294,7 @@ void js_cocos2d_Follow_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Follow)", obj);
}
-void js_register_cocos2dx_Follow(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Follow(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Follow_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Follow_class->name = "Follow";
jsb_cocos2d_Follow_class->addProperty = JS_PropertyStub;
@@ -11924,8 +12308,8 @@ void js_register_cocos2dx_Follow(JSContext *cx, JSObject *global) {
jsb_cocos2d_Follow_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -11942,7 +12326,7 @@ void js_register_cocos2dx_Follow(JSContext *cx, JSObject *global) {
jsb_cocos2d_Follow_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Action_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Action_prototype),
jsb_cocos2d_Follow_class,
js_cocos2dx_Follow_constructor, 0, // constructor
properties,
@@ -11973,7 +12357,8 @@ JSObject *jsb_cocos2d_SpriteFrame_prototype;
bool js_cocos2dx_SpriteFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_clone : Invalid Native Object");
@@ -11988,7 +12373,7 @@ bool js_cocos2dx_SpriteFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -11997,18 +12382,18 @@ bool js_cocos2dx_SpriteFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_setRotated(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRotated : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRotated : Error processing arguments");
cobj->setRotated(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12017,25 +12402,25 @@ bool js_cocos2dx_SpriteFrame_setRotated(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setTexture : Invalid Native Object");
if (argc == 1) {
cocos2d::Texture2D* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setTexture : Error processing arguments");
cobj->setTexture(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12044,7 +12429,8 @@ bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_getOffset(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOffset : Invalid Native Object");
@@ -12052,7 +12438,7 @@ bool js_cocos2dx_SpriteFrame_getOffset(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec2& ret = cobj->getOffset();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12061,18 +12447,18 @@ bool js_cocos2dx_SpriteFrame_getOffset(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_setRectInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRectInPixels : Invalid Native Object");
if (argc == 1) {
cocos2d::Rect arg0;
- ok &= jsval_to_ccrect(cx, argv[0], &arg0);
+ ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRectInPixels : Error processing arguments");
cobj->setRectInPixels(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12081,7 +12467,8 @@ bool js_cocos2dx_SpriteFrame_setRectInPixels(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_SpriteFrame_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getTexture : Invalid Native Object");
@@ -12096,7 +12483,7 @@ bool js_cocos2dx_SpriteFrame_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12105,7 +12492,8 @@ bool js_cocos2dx_SpriteFrame_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_getRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getRect : Invalid Native Object");
@@ -12113,7 +12501,7 @@ bool js_cocos2dx_SpriteFrame_getRect(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Rect& ret = cobj->getRect();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12122,18 +12510,18 @@ bool js_cocos2dx_SpriteFrame_getRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_setOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOffsetInPixels : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOffsetInPixels : Error processing arguments");
cobj->setOffsetInPixels(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12142,7 +12530,8 @@ bool js_cocos2dx_SpriteFrame_setOffsetInPixels(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_SpriteFrame_getRectInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getRectInPixels : Invalid Native Object");
@@ -12150,7 +12539,7 @@ bool js_cocos2dx_SpriteFrame_getRectInPixels(JSContext *cx, uint32_t argc, jsval
const cocos2d::Rect& ret = cobj->getRectInPixels();
jsval jsret = JSVAL_NULL;
jsret = ccrect_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12159,18 +12548,18 @@ bool js_cocos2dx_SpriteFrame_getRectInPixels(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_SpriteFrame_setOriginalSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSize : Invalid Native Object");
if (argc == 1) {
cocos2d::Size arg0;
- ok &= jsval_to_ccsize(cx, argv[0], &arg0);
+ ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSize : Error processing arguments");
cobj->setOriginalSize(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12179,7 +12568,8 @@ bool js_cocos2dx_SpriteFrame_setOriginalSize(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_SpriteFrame_getOriginalSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOriginalSizeInPixels : Invalid Native Object");
@@ -12187,7 +12577,7 @@ bool js_cocos2dx_SpriteFrame_getOriginalSizeInPixels(JSContext *cx, uint32_t arg
const cocos2d::Size& ret = cobj->getOriginalSizeInPixels();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12196,18 +12586,18 @@ bool js_cocos2dx_SpriteFrame_getOriginalSizeInPixels(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_SpriteFrame_setOriginalSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : Invalid Native Object");
if (argc == 1) {
cocos2d::Size arg0;
- ok &= jsval_to_ccsize(cx, argv[0], &arg0);
+ ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : Error processing arguments");
cobj->setOriginalSizeInPixels(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12216,18 +12606,18 @@ bool js_cocos2dx_SpriteFrame_setOriginalSizeInPixels(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_SpriteFrame_setOffset(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOffset : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOffset : Error processing arguments");
cobj->setOffset(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12236,12 +12626,12 @@ bool js_cocos2dx_SpriteFrame_setOffset(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::SpriteFrame* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTexture : Invalid Native Object");
@@ -12249,29 +12639,29 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval
if (argc == 5) {
cocos2d::Texture2D* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool arg2;
- arg2 = JS::ToBoolean(JS::RootedValue(cx, argv[2]));
+ arg2 = JS::ToBoolean(args.get(2));
cocos2d::Vec2 arg3;
- ok &= jsval_to_vector2(cx, argv[3], &arg3);
+ ok &= jsval_to_vector2(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::Size arg4;
- ok &= jsval_to_ccsize(cx, argv[4], &arg4);
+ ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithTexture(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12280,21 +12670,21 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval
if (argc == 2) {
cocos2d::Texture2D* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithTexture(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12304,7 +12694,8 @@ bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_isRotated : Invalid Native Object");
@@ -12312,7 +12703,7 @@ bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->isRotated();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12321,35 +12712,35 @@ bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::SpriteFrame* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTextureFilename : Invalid Native Object");
do {
if (argc == 5) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool arg2;
- arg2 = JS::ToBoolean(JS::RootedValue(cx, argv[2]));
+ arg2 = JS::ToBoolean(args.get(2));
cocos2d::Vec2 arg3;
- ok &= jsval_to_vector2(cx, argv[3], &arg3);
+ ok &= jsval_to_vector2(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::Size arg4;
- ok &= jsval_to_ccsize(cx, argv[4], &arg4);
+ ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithTextureFilename(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12357,15 +12748,15 @@ bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t arg
do {
if (argc == 2) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithTextureFilename(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12375,18 +12766,18 @@ bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_SpriteFrame_setRect(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRect : Invalid Native Object");
if (argc == 1) {
cocos2d::Rect arg0;
- ok &= jsval_to_ccrect(cx, argv[0], &arg0);
+ ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRect : Error processing arguments");
cobj->setRect(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12395,7 +12786,8 @@ bool js_cocos2dx_SpriteFrame_setRect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOffsetInPixels : Invalid Native Object");
@@ -12403,7 +12795,7 @@ bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsv
const cocos2d::Vec2& ret = cobj->getOffsetInPixels();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12412,7 +12804,8 @@ bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_SpriteFrame_getOriginalSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOriginalSize : Invalid Native Object");
@@ -12420,7 +12813,7 @@ bool js_cocos2dx_SpriteFrame_getOriginalSize(JSContext *cx, uint32_t argc, jsval
const cocos2d::Size& ret = cobj->getOriginalSize();
jsval jsret = JSVAL_NULL;
jsret = ccsize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12429,25 +12822,25 @@ bool js_cocos2dx_SpriteFrame_getOriginalSize(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 5) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool arg2;
- arg2 = JS::ToBoolean(JS::RootedValue(cx, argv[2]));
+ arg2 = JS::ToBoolean(args.get(2));
if (!ok) { ok = true; break; }
cocos2d::Vec2 arg3;
- ok &= jsval_to_vector2(cx, argv[3], &arg3);
+ ok &= jsval_to_vector2(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::Size arg4;
- ok &= jsval_to_ccsize(cx, argv[4], &arg4);
+ ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
if (!ok) { ok = true; break; }
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
@@ -12459,7 +12852,7 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -12467,10 +12860,10 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -12482,7 +12875,7 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -12491,32 +12884,32 @@ bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 5) {
cocos2d::Texture2D* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool arg2;
- arg2 = JS::ToBoolean(JS::RootedValue(cx, argv[2]));
+ arg2 = JS::ToBoolean(args.get(2));
if (!ok) { ok = true; break; }
cocos2d::Vec2 arg3;
- ok &= jsval_to_vector2(cx, argv[3], &arg3);
+ ok &= jsval_to_vector2(cx, args.get(3), &arg3);
if (!ok) { ok = true; break; }
cocos2d::Size arg4;
- ok &= jsval_to_ccsize(cx, argv[4], &arg4);
+ ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
if (!ok) { ok = true; break; }
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1, arg2, arg3, arg4);
jsval jsret = JSVAL_NULL;
@@ -12528,7 +12921,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -12537,16 +12930,16 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv
if (argc == 2) {
cocos2d::Texture2D* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -12558,7 +12951,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -12567,7 +12960,7 @@ bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_SpriteFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::SpriteFrame* cobj = new (std::nothrow) cocos2d::SpriteFrame();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -12581,13 +12974,16 @@ bool js_cocos2dx_SpriteFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::SpriteFrame");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::SpriteFrame");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -12599,21 +12995,21 @@ void js_cocos2d_SpriteFrame_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_SpriteFrame_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::SpriteFrame *nobj = new (std::nothrow) cocos2d::SpriteFrame();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::SpriteFrame");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::SpriteFrame");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_SpriteFrame(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_SpriteFrame(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_SpriteFrame_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_SpriteFrame_class->name = "SpriteFrame";
jsb_cocos2d_SpriteFrame_class->addProperty = JS_PropertyStub;
@@ -12627,8 +13023,8 @@ void js_register_cocos2dx_SpriteFrame(JSContext *cx, JSObject *global) {
jsb_cocos2d_SpriteFrame_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -12663,7 +13059,7 @@ void js_register_cocos2dx_SpriteFrame(JSContext *cx, JSObject *global) {
jsb_cocos2d_SpriteFrame_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_SpriteFrame_class,
js_cocos2dx_SpriteFrame_constructor, 0, // constructor
properties,
@@ -12694,25 +13090,25 @@ JSObject *jsb_cocos2d_AnimationFrame_prototype;
bool js_cocos2dx_AnimationFrame_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setSpriteFrame : Invalid Native Object");
if (argc == 1) {
cocos2d::SpriteFrame* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setSpriteFrame : Error processing arguments");
cobj->setSpriteFrame(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12721,12 +13117,12 @@ bool js_cocos2dx_AnimationFrame_setSpriteFrame(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::AnimationFrame* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getUserInfo : Invalid Native Object");
@@ -12735,7 +13131,7 @@ bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval
cocos2d::ValueMap& ret = cobj->getUserInfo();
jsval jsret = JSVAL_NULL;
jsret = ccvaluemap_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12745,7 +13141,7 @@ bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval
const cocos2d::ValueMap& ret = cobj->getUserInfo();
jsval jsret = JSVAL_NULL;
jsret = ccvaluemap_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -12755,18 +13151,18 @@ bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_AnimationFrame_setDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Error processing arguments");
cobj->setDelayUnits(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12775,7 +13171,8 @@ bool js_cocos2dx_AnimationFrame_setDelayUnits(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_AnimationFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_clone : Invalid Native Object");
@@ -12790,7 +13187,7 @@ bool js_cocos2dx_AnimationFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12799,7 +13196,8 @@ bool js_cocos2dx_AnimationFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_AnimationFrame_getSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getSpriteFrame : Invalid Native Object");
@@ -12814,7 +13212,7 @@ bool js_cocos2dx_AnimationFrame_getSpriteFrame(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12823,7 +13221,8 @@ bool js_cocos2dx_AnimationFrame_getSpriteFrame(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_AnimationFrame_getDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getDelayUnits : Invalid Native Object");
@@ -12831,7 +13230,7 @@ bool js_cocos2dx_AnimationFrame_getDelayUnits(JSContext *cx, uint32_t argc, jsva
double ret = cobj->getDelayUnits();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12840,18 +13239,18 @@ bool js_cocos2dx_AnimationFrame_getDelayUnits(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_AnimationFrame_setUserInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setUserInfo : Invalid Native Object");
if (argc == 1) {
cocos2d::ValueMap arg0;
- ok &= jsval_to_ccvaluemap(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setUserInfo : Error processing arguments");
cobj->setUserInfo(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -12860,9 +13259,9 @@ bool js_cocos2dx_AnimationFrame_setUserInfo(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_AnimationFrame_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : Invalid Native Object");
@@ -12871,20 +13270,20 @@ bool js_cocos2dx_AnimationFrame_initWithSpriteFrame(JSContext *cx, uint32_t argc
double arg1;
cocos2d::ValueMap arg2;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_ccvaluemap(cx, argv[2], &arg2);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_ccvaluemap(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : Error processing arguments");
bool ret = cobj->initWithSpriteFrame(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -12893,22 +13292,22 @@ bool js_cocos2dx_AnimationFrame_initWithSpriteFrame(JSContext *cx, uint32_t argc
}
bool js_cocos2dx_AnimationFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 3) {
cocos2d::SpriteFrame* arg0;
double arg1;
cocos2d::ValueMap arg2;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_ccvaluemap(cx, argv[2], &arg2);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_ccvaluemap(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_create : Error processing arguments");
cocos2d::AnimationFrame* ret = cocos2d::AnimationFrame::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -12920,7 +13319,7 @@ bool js_cocos2dx_AnimationFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_create : wrong number of arguments");
@@ -12929,7 +13328,7 @@ bool js_cocos2dx_AnimationFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_AnimationFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::AnimationFrame* cobj = new (std::nothrow) cocos2d::AnimationFrame();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -12943,13 +13342,16 @@ bool js_cocos2dx_AnimationFrame_constructor(JSContext *cx, uint32_t argc, jsval
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::AnimationFrame");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::AnimationFrame");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -12959,7 +13361,7 @@ void js_cocos2d_AnimationFrame_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AnimationFrame)", obj);
}
-void js_register_cocos2dx_AnimationFrame(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_AnimationFrame(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_AnimationFrame_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_AnimationFrame_class->name = "AnimationFrame";
jsb_cocos2d_AnimationFrame_class->addProperty = JS_PropertyStub;
@@ -12973,8 +13375,8 @@ void js_register_cocos2dx_AnimationFrame(JSContext *cx, JSObject *global) {
jsb_cocos2d_AnimationFrame_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -12996,7 +13398,7 @@ void js_register_cocos2dx_AnimationFrame(JSContext *cx, JSObject *global) {
jsb_cocos2d_AnimationFrame_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_AnimationFrame_class,
js_cocos2dx_AnimationFrame_constructor, 0, // constructor
properties,
@@ -13027,7 +13429,8 @@ JSObject *jsb_cocos2d_Animation_prototype;
bool js_cocos2dx_Animation_getLoops(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getLoops : Invalid Native Object");
@@ -13035,7 +13438,7 @@ bool js_cocos2dx_Animation_getLoops(JSContext *cx, uint32_t argc, jsval *vp)
unsigned int ret = cobj->getLoops();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13044,25 +13447,25 @@ bool js_cocos2dx_Animation_getLoops(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_addSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrame : Invalid Native Object");
if (argc == 1) {
cocos2d::SpriteFrame* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrame : Error processing arguments");
cobj->addSpriteFrame(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13071,18 +13474,18 @@ bool js_cocos2dx_Animation_addSpriteFrame(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Animation_setRestoreOriginalFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setRestoreOriginalFrame : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setRestoreOriginalFrame : Error processing arguments");
cobj->setRestoreOriginalFrame(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13091,7 +13494,8 @@ bool js_cocos2dx_Animation_setRestoreOriginalFrame(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Animation_clone(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_clone : Invalid Native Object");
@@ -13106,7 +13510,7 @@ bool js_cocos2dx_Animation_clone(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13115,7 +13519,8 @@ bool js_cocos2dx_Animation_clone(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getDuration : Invalid Native Object");
@@ -13123,7 +13528,7 @@ bool js_cocos2dx_Animation_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getDuration();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13132,9 +13537,9 @@ bool js_cocos2dx_Animation_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_initWithAnimationFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_initWithAnimationFrames : Invalid Native Object");
@@ -13142,14 +13547,14 @@ bool js_cocos2dx_Animation_initWithAnimationFrames(JSContext *cx, uint32_t argc,
cocos2d::Vector arg0;
double arg1;
unsigned int arg2;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithAnimationFrames : Error processing arguments");
bool ret = cobj->initWithAnimationFrames(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13158,7 +13563,8 @@ bool js_cocos2dx_Animation_initWithAnimationFrames(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Animation_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_init : Invalid Native Object");
@@ -13166,7 +13572,7 @@ bool js_cocos2dx_Animation_init(JSContext *cx, uint32_t argc, jsval *vp)
bool ret = cobj->init();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13175,18 +13581,18 @@ bool js_cocos2dx_Animation_init(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_setFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setFrames : Invalid Native Object");
if (argc == 1) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setFrames : Error processing arguments");
cobj->setFrames(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13195,7 +13601,8 @@ bool js_cocos2dx_Animation_setFrames(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_getFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getFrames : Invalid Native Object");
@@ -13203,7 +13610,7 @@ bool js_cocos2dx_Animation_getFrames(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vector& ret = cobj->getFrames();
jsval jsret = JSVAL_NULL;
jsret = ccvector_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13212,18 +13619,18 @@ bool js_cocos2dx_Animation_getFrames(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_setLoops(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setLoops : Invalid Native Object");
if (argc == 1) {
unsigned int arg0;
- ok &= jsval_to_uint32(cx, argv[0], &arg0);
+ ok &= jsval_to_uint32(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setLoops : Error processing arguments");
cobj->setLoops(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13232,18 +13639,18 @@ bool js_cocos2dx_Animation_setLoops(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_setDelayPerUnit(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Error processing arguments");
cobj->setDelayPerUnit(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13252,18 +13659,18 @@ bool js_cocos2dx_Animation_setDelayPerUnit(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Animation_addSpriteFrameWithFile(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithFile : Invalid Native Object");
if (argc == 1) {
std::string arg0;
- ok &= jsval_to_std_string(cx, argv[0], &arg0);
+ ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithFile : Error processing arguments");
cobj->addSpriteFrameWithFile(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13272,7 +13679,8 @@ bool js_cocos2dx_Animation_addSpriteFrameWithFile(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Animation_getTotalDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getTotalDelayUnits : Invalid Native Object");
@@ -13280,7 +13688,7 @@ bool js_cocos2dx_Animation_getTotalDelayUnits(JSContext *cx, uint32_t argc, jsva
double ret = cobj->getTotalDelayUnits();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13289,7 +13697,8 @@ bool js_cocos2dx_Animation_getTotalDelayUnits(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_Animation_getDelayPerUnit(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getDelayPerUnit : Invalid Native Object");
@@ -13297,7 +13706,7 @@ bool js_cocos2dx_Animation_getDelayPerUnit(JSContext *cx, uint32_t argc, jsval *
double ret = cobj->getDelayPerUnit();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13306,46 +13715,46 @@ bool js_cocos2dx_Animation_getDelayPerUnit(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Animation_initWithSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Invalid Native Object");
if (argc == 1) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
bool ret = cobj->initWithSpriteFrames(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
cocos2d::Vector arg0;
double arg1;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
bool ret = cobj->initWithSpriteFrames(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 3) {
cocos2d::Vector arg0;
double arg1;
unsigned int arg2;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
bool ret = cobj->initWithSpriteFrames(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13354,7 +13763,8 @@ bool js_cocos2dx_Animation_initWithSpriteFrames(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_Animation_getRestoreOriginalFrame(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getRestoreOriginalFrame : Invalid Native Object");
@@ -13362,7 +13772,7 @@ bool js_cocos2dx_Animation_getRestoreOriginalFrame(JSContext *cx, uint32_t argc,
bool ret = cobj->getRestoreOriginalFrame();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13371,9 +13781,9 @@ bool js_cocos2dx_Animation_getRestoreOriginalFrame(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithTexture : Invalid Native Object");
@@ -13381,17 +13791,17 @@ bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t arg
cocos2d::Texture2D* arg0;
cocos2d::Rect arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_ccrect(cx, argv[1], &arg1);
+ ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithTexture : Error processing arguments");
cobj->addSpriteFrameWithTexture(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13400,16 +13810,16 @@ bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 2) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -13421,20 +13831,20 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
do {
if (argc == 3) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
unsigned int arg2;
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
if (!ok) { ok = true; break; }
cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -13446,7 +13856,7 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -13463,7 +13873,7 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -13472,11 +13882,11 @@ bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
cocos2d::Animation* ret = cocos2d::Animation::createWithSpriteFrames(arg0);
jsval jsret = JSVAL_NULL;
@@ -13488,14 +13898,14 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc,
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
cocos2d::Vector arg0;
double arg1;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
cocos2d::Animation* ret = cocos2d::Animation::createWithSpriteFrames(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -13507,16 +13917,16 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc,
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 3) {
cocos2d::Vector arg0;
double arg1;
unsigned int arg2;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
cocos2d::Animation* ret = cocos2d::Animation::createWithSpriteFrames(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -13528,7 +13938,7 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc,
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Animation_createWithSpriteFrames : wrong number of arguments");
@@ -13537,7 +13947,7 @@ bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc,
bool js_cocos2dx_Animation_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Animation* cobj = new (std::nothrow) cocos2d::Animation();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -13551,13 +13961,16 @@ bool js_cocos2dx_Animation_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animation");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animation");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -13567,7 +13980,7 @@ void js_cocos2d_Animation_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Animation)", obj);
}
-void js_register_cocos2dx_Animation(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Animation(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Animation_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Animation_class->name = "Animation";
jsb_cocos2d_Animation_class->addProperty = JS_PropertyStub;
@@ -13581,8 +13994,8 @@ void js_register_cocos2dx_Animation(JSContext *cx, JSObject *global) {
jsb_cocos2d_Animation_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -13614,7 +14027,7 @@ void js_register_cocos2dx_Animation(JSContext *cx, JSObject *global) {
jsb_cocos2d_Animation_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_Animation_class,
js_cocos2dx_Animation_constructor, 0, // constructor
properties,
@@ -13645,7 +14058,8 @@ JSObject *jsb_cocos2d_ActionInterval_prototype;
bool js_cocos2dx_ActionInterval_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_getAmplitudeRate : Invalid Native Object");
@@ -13653,7 +14067,7 @@ bool js_cocos2dx_ActionInterval_getAmplitudeRate(JSContext *cx, uint32_t argc, j
double ret = cobj->getAmplitudeRate();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13662,20 +14076,20 @@ bool js_cocos2dx_ActionInterval_getAmplitudeRate(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_ActionInterval_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13684,18 +14098,18 @@ bool js_cocos2dx_ActionInterval_initWithDuration(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_ActionInterval_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Error processing arguments");
cobj->setAmplitudeRate(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13704,7 +14118,8 @@ bool js_cocos2dx_ActionInterval_setAmplitudeRate(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_ActionInterval_getElapsed(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_getElapsed : Invalid Native Object");
@@ -13712,7 +14127,7 @@ bool js_cocos2dx_ActionInterval_getElapsed(JSContext *cx, uint32_t argc, jsval *
double ret = cobj->getElapsed();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13726,7 +14141,7 @@ void js_cocos2d_ActionInterval_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ActionInterval)", obj);
}
-void js_register_cocos2dx_ActionInterval(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ActionInterval(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ActionInterval_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ActionInterval_class->name = "ActionInterval";
jsb_cocos2d_ActionInterval_class->addProperty = JS_PropertyStub;
@@ -13740,8 +14155,8 @@ void js_register_cocos2dx_ActionInterval(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionInterval_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -13756,7 +14171,7 @@ void js_register_cocos2dx_ActionInterval(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionInterval_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_FiniteTimeAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_FiniteTimeAction_prototype),
jsb_cocos2d_ActionInterval_class,
empty_constructor, 0,
properties,
@@ -13787,9 +14202,9 @@ JSObject *jsb_cocos2d_Sequence_prototype;
bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Sequence* cobj = (cocos2d::Sequence *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sequence_initWithTwoActions : Invalid Native Object");
@@ -13797,17 +14212,17 @@ bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval
cocos2d::FiniteTimeAction* arg0;
cocos2d::FiniteTimeAction* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -13816,7 +14231,7 @@ bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->initWithTwoActions(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13825,7 +14240,7 @@ bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_Sequence_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Sequence* cobj = new (std::nothrow) cocos2d::Sequence();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -13839,13 +14254,16 @@ bool js_cocos2dx_Sequence_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Sequence");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Sequence");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -13856,7 +14274,7 @@ void js_cocos2d_Sequence_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Sequence)", obj);
}
-void js_register_cocos2dx_Sequence(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Sequence(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Sequence_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Sequence_class->name = "Sequence";
jsb_cocos2d_Sequence_class->addProperty = JS_PropertyStub;
@@ -13870,8 +14288,8 @@ void js_register_cocos2dx_Sequence(JSContext *cx, JSObject *global) {
jsb_cocos2d_Sequence_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -13883,7 +14301,7 @@ void js_register_cocos2dx_Sequence(JSContext *cx, JSObject *global) {
jsb_cocos2d_Sequence_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_Sequence_class,
js_cocos2dx_Sequence_constructor, 0, // constructor
properties,
@@ -13914,25 +14332,25 @@ JSObject *jsb_cocos2d_Repeat_prototype;
bool js_cocos2dx_Repeat_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_setInnerAction : Invalid Native Object");
if (argc == 1) {
cocos2d::FiniteTimeAction* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_setInnerAction : Error processing arguments");
cobj->setInnerAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -13941,9 +14359,9 @@ bool js_cocos2dx_Repeat_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Repeat_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_initWithAction : Invalid Native Object");
@@ -13951,19 +14369,19 @@ bool js_cocos2dx_Repeat_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
cocos2d::FiniteTimeAction* arg0;
unsigned int arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_uint32(cx, argv[1], &arg1);
+ ok &= jsval_to_uint32(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_initWithAction : Error processing arguments");
bool ret = cobj->initWithAction(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13972,7 +14390,8 @@ bool js_cocos2dx_Repeat_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Repeat_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_getInnerAction : Invalid Native Object");
@@ -13987,7 +14406,7 @@ bool js_cocos2dx_Repeat_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -13996,20 +14415,20 @@ bool js_cocos2dx_Repeat_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Repeat_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::FiniteTimeAction* arg0;
unsigned int arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= jsval_to_uint32(cx, argv[1], &arg1);
+ ok &= jsval_to_uint32(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_create : Error processing arguments");
cocos2d::Repeat* ret = cocos2d::Repeat::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -14021,7 +14440,7 @@ bool js_cocos2dx_Repeat_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Repeat_create : wrong number of arguments");
@@ -14030,7 +14449,7 @@ bool js_cocos2dx_Repeat_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Repeat_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Repeat* cobj = new (std::nothrow) cocos2d::Repeat();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14044,13 +14463,16 @@ bool js_cocos2dx_Repeat_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Repeat");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Repeat");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14061,7 +14483,7 @@ void js_cocos2d_Repeat_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Repeat)", obj);
}
-void js_register_cocos2dx_Repeat(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Repeat(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Repeat_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Repeat_class->name = "Repeat";
jsb_cocos2d_Repeat_class->addProperty = JS_PropertyStub;
@@ -14075,8 +14497,8 @@ void js_register_cocos2dx_Repeat(JSContext *cx, JSObject *global) {
jsb_cocos2d_Repeat_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -14093,7 +14515,7 @@ void js_register_cocos2dx_Repeat(JSContext *cx, JSObject *global) {
jsb_cocos2d_Repeat_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_Repeat_class,
js_cocos2dx_Repeat_constructor, 0, // constructor
properties,
@@ -14124,25 +14546,25 @@ JSObject *jsb_cocos2d_RepeatForever_prototype;
bool js_cocos2dx_RepeatForever_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_setInnerAction : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RepeatForever_setInnerAction : Error processing arguments");
cobj->setInnerAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -14151,18 +14573,18 @@ bool js_cocos2dx_RepeatForever_setInnerAction(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_RepeatForever_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_initWithAction : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -14171,7 +14593,7 @@ bool js_cocos2dx_RepeatForever_initWithAction(JSContext *cx, uint32_t argc, jsva
bool ret = cobj->initWithAction(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -14180,7 +14602,8 @@ bool js_cocos2dx_RepeatForever_initWithAction(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_RepeatForever_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_getInnerAction : Invalid Native Object");
@@ -14195,7 +14618,7 @@ bool js_cocos2dx_RepeatForever_getInnerAction(JSContext *cx, uint32_t argc, jsva
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -14204,14 +14627,14 @@ bool js_cocos2dx_RepeatForever_getInnerAction(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_RepeatForever_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -14227,7 +14650,7 @@ bool js_cocos2dx_RepeatForever_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_RepeatForever_create : wrong number of arguments");
@@ -14236,7 +14659,7 @@ bool js_cocos2dx_RepeatForever_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_RepeatForever_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::RepeatForever* cobj = new (std::nothrow) cocos2d::RepeatForever();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14250,13 +14673,16 @@ bool js_cocos2dx_RepeatForever_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::RepeatForever");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::RepeatForever");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14267,7 +14693,7 @@ void js_cocos2d_RepeatForever_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (RepeatForever)", obj);
}
-void js_register_cocos2dx_RepeatForever(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_RepeatForever(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_RepeatForever_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_RepeatForever_class->name = "RepeatForever";
jsb_cocos2d_RepeatForever_class->addProperty = JS_PropertyStub;
@@ -14281,8 +14707,8 @@ void js_register_cocos2dx_RepeatForever(JSContext *cx, JSObject *global) {
jsb_cocos2d_RepeatForever_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -14299,7 +14725,7 @@ void js_register_cocos2dx_RepeatForever(JSContext *cx, JSObject *global) {
jsb_cocos2d_RepeatForever_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_RepeatForever_class,
js_cocos2dx_RepeatForever_constructor, 0, // constructor
properties,
@@ -14330,9 +14756,9 @@ JSObject *jsb_cocos2d_Spawn_prototype;
bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Spawn* cobj = (cocos2d::Spawn *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Spawn_initWithTwoActions : Invalid Native Object");
@@ -14340,17 +14766,17 @@ bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *v
cocos2d::FiniteTimeAction* arg0;
cocos2d::FiniteTimeAction* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -14359,7 +14785,7 @@ bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *v
bool ret = cobj->initWithTwoActions(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -14368,7 +14794,7 @@ bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Spawn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Spawn* cobj = new (std::nothrow) cocos2d::Spawn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14382,13 +14808,16 @@ bool js_cocos2dx_Spawn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Spawn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Spawn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14399,7 +14828,7 @@ void js_cocos2d_Spawn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Spawn)", obj);
}
-void js_register_cocos2dx_Spawn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Spawn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Spawn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Spawn_class->name = "Spawn";
jsb_cocos2d_Spawn_class->addProperty = JS_PropertyStub;
@@ -14413,8 +14842,8 @@ void js_register_cocos2dx_Spawn(JSContext *cx, JSObject *global) {
jsb_cocos2d_Spawn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -14426,7 +14855,7 @@ void js_register_cocos2dx_Spawn(JSContext *cx, JSObject *global) {
jsb_cocos2d_Spawn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_Spawn_class,
js_cocos2dx_Spawn_constructor, 0, // constructor
properties,
@@ -14457,27 +14886,27 @@ JSObject *jsb_cocos2d_RotateTo_prototype;
bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::RotateTo* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::RotateTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateTo_initWithDuration : Invalid Native Object");
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
cocos2d::Vec3 arg1;
- ok &= jsval_to_vector3(cx, argv[1], &arg1);
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -14485,18 +14914,18 @@ bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -14506,16 +14935,16 @@ bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -14527,7 +14956,7 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14535,13 +14964,13 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -14553,7 +14982,7 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14561,10 +14990,10 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
cocos2d::Vec3 arg1;
- ok &= jsval_to_vector3(cx, argv[1], &arg1);
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -14576,7 +15005,7 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14585,7 +15014,7 @@ bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_RotateTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::RotateTo* cobj = new (std::nothrow) cocos2d::RotateTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14599,13 +15028,16 @@ bool js_cocos2dx_RotateTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14616,7 +15048,7 @@ void js_cocos2d_RotateTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (RotateTo)", obj);
}
-void js_register_cocos2dx_RotateTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_RotateTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_RotateTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_RotateTo_class->name = "RotateTo";
jsb_cocos2d_RotateTo_class->addProperty = JS_PropertyStub;
@@ -14630,8 +15062,8 @@ void js_register_cocos2dx_RotateTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_RotateTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -14646,7 +15078,7 @@ void js_register_cocos2dx_RotateTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_RotateTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_RotateTo_class,
js_cocos2dx_RotateTo_constructor, 0, // constructor
properties,
@@ -14677,30 +15109,30 @@ JSObject *jsb_cocos2d_RotateBy_prototype;
bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::RotateBy* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::RotateBy *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateBy_initWithDuration : Invalid Native Object");
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -14708,15 +15140,15 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -14724,15 +15156,15 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
cocos2d::Vec3 arg1;
- ok &= jsval_to_vector3(cx, argv[1], &arg1);
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -14742,19 +15174,19 @@ bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -14766,7 +15198,7 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14774,10 +15206,10 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -14789,7 +15221,7 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14797,10 +15229,10 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
cocos2d::Vec3 arg1;
- ok &= jsval_to_vector3(cx, argv[1], &arg1);
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -14812,7 +15244,7 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -14821,7 +15253,7 @@ bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_RotateBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::RotateBy* cobj = new (std::nothrow) cocos2d::RotateBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14835,13 +15267,16 @@ bool js_cocos2dx_RotateBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::RotateBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14852,7 +15287,7 @@ void js_cocos2d_RotateBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (RotateBy)", obj);
}
-void js_register_cocos2dx_RotateBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_RotateBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_RotateBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_RotateBy_class->name = "RotateBy";
jsb_cocos2d_RotateBy_class->addProperty = JS_PropertyStub;
@@ -14866,8 +15301,8 @@ void js_register_cocos2dx_RotateBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_RotateBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -14882,7 +15317,7 @@ void js_register_cocos2dx_RotateBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_RotateBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_RotateBy_class,
js_cocos2dx_RotateBy_constructor, 0, // constructor
properties,
@@ -14913,58 +15348,106 @@ JSObject *jsb_cocos2d_MoveBy_prototype;
bool js_cocos2dx_MoveBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+
+ JS::RootedObject obj(cx);
+ cocos2d::MoveBy* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::MoveBy* cobj = (cocos2d::MoveBy *)(proxy ? proxy->ptr : NULL);
+ cobj = (cocos2d::MoveBy *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveBy_initWithDuration : Invalid Native Object");
- if (argc == 2) {
- double arg0;
- cocos2d::Vec2 arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MoveBy_initWithDuration : Error processing arguments");
- bool ret = cobj->initWithDuration(arg0, arg1);
- jsval jsret = JSVAL_NULL;
- jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec3 arg1;
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->initWithDuration(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
- JS_ReportError(cx, "js_cocos2dx_MoveBy_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec2 arg1;
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->initWithDuration(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_MoveBy_initWithDuration : wrong number of arguments");
return false;
}
bool js_cocos2dx_MoveBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- if (argc == 2) {
- double arg0;
- cocos2d::Vec2 arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MoveBy_create : Error processing arguments");
- cocos2d::MoveBy* ret = cocos2d::MoveBy::create(arg0, arg1);
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveBy*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
+
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec3 arg1;
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::MoveBy* ret = cocos2d::MoveBy::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveBy*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec2 arg1;
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::MoveBy* ret = cocos2d::MoveBy::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveBy*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
JS_ReportError(cx, "js_cocos2dx_MoveBy_create : wrong number of arguments");
return false;
}
-
bool js_cocos2dx_MoveBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::MoveBy* cobj = new (std::nothrow) cocos2d::MoveBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -14978,13 +15461,16 @@ bool js_cocos2dx_MoveBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -14995,7 +15481,7 @@ void js_cocos2d_MoveBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (MoveBy)", obj);
}
-void js_register_cocos2dx_MoveBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_MoveBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_MoveBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_MoveBy_class->name = "MoveBy";
jsb_cocos2d_MoveBy_class->addProperty = JS_PropertyStub;
@@ -15009,8 +15495,8 @@ void js_register_cocos2dx_MoveBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_MoveBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15025,7 +15511,7 @@ void js_register_cocos2dx_MoveBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_MoveBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_MoveBy_class,
js_cocos2dx_MoveBy_constructor, 0, // constructor
properties,
@@ -15056,58 +15542,106 @@ JSObject *jsb_cocos2d_MoveTo_prototype;
bool js_cocos2dx_MoveTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+
+ JS::RootedObject obj(cx);
+ cocos2d::MoveTo* cobj = NULL;
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::MoveTo* cobj = (cocos2d::MoveTo *)(proxy ? proxy->ptr : NULL);
+ cobj = (cocos2d::MoveTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveTo_initWithDuration : Invalid Native Object");
- if (argc == 2) {
- double arg0;
- cocos2d::Vec2 arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MoveTo_initWithDuration : Error processing arguments");
- bool ret = cobj->initWithDuration(arg0, arg1);
- jsval jsret = JSVAL_NULL;
- jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec3 arg1;
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->initWithDuration(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
- JS_ReportError(cx, "js_cocos2dx_MoveTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec2 arg1;
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ bool ret = cobj->initWithDuration(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while(0);
+
+ JS_ReportError(cx, "js_cocos2dx_MoveTo_initWithDuration : wrong number of arguments");
return false;
}
bool js_cocos2dx_MoveTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- if (argc == 2) {
- double arg0;
- cocos2d::Vec2 arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MoveTo_create : Error processing arguments");
- cocos2d::MoveTo* ret = cocos2d::MoveTo::create(arg0, arg1);
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveTo*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
+
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec3 arg1;
+ ok &= jsval_to_vector3(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::MoveTo* ret = cocos2d::MoveTo::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveTo*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Vec2 arg1;
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::MoveTo* ret = cocos2d::MoveTo::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::MoveTo*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
JS_ReportError(cx, "js_cocos2dx_MoveTo_create : wrong number of arguments");
return false;
}
-
bool js_cocos2dx_MoveTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::MoveTo* cobj = new (std::nothrow) cocos2d::MoveTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15121,13 +15655,16 @@ bool js_cocos2dx_MoveTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::MoveTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15138,7 +15675,7 @@ void js_cocos2d_MoveTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (MoveTo)", obj);
}
-void js_register_cocos2dx_MoveTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_MoveTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_MoveTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_MoveTo_class->name = "MoveTo";
jsb_cocos2d_MoveTo_class->addProperty = JS_PropertyStub;
@@ -15152,8 +15689,8 @@ void js_register_cocos2dx_MoveTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_MoveTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15168,7 +15705,7 @@ void js_register_cocos2dx_MoveTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_MoveTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_MoveBy_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_MoveBy_prototype),
jsb_cocos2d_MoveTo_class,
js_cocos2dx_MoveTo_constructor, 0, // constructor
properties,
@@ -15199,9 +15736,9 @@ JSObject *jsb_cocos2d_SkewTo_prototype;
bool js_cocos2dx_SkewTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SkewTo* cobj = (cocos2d::SkewTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewTo_initWithDuration : Invalid Native Object");
@@ -15209,14 +15746,14 @@ bool js_cocos2dx_SkewTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
double arg0;
double arg1;
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewTo_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -15225,15 +15762,15 @@ bool js_cocos2dx_SkewTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_SkewTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 3) {
double arg0;
double arg1;
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewTo_create : Error processing arguments");
cocos2d::SkewTo* ret = cocos2d::SkewTo::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -15245,7 +15782,7 @@ bool js_cocos2dx_SkewTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_SkewTo_create : wrong number of arguments");
@@ -15254,7 +15791,7 @@ bool js_cocos2dx_SkewTo_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_SkewTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::SkewTo* cobj = new (std::nothrow) cocos2d::SkewTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15268,13 +15805,16 @@ bool js_cocos2dx_SkewTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15285,7 +15825,7 @@ void js_cocos2d_SkewTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (SkewTo)", obj);
}
-void js_register_cocos2dx_SkewTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_SkewTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_SkewTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_SkewTo_class->name = "SkewTo";
jsb_cocos2d_SkewTo_class->addProperty = JS_PropertyStub;
@@ -15299,8 +15839,8 @@ void js_register_cocos2dx_SkewTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_SkewTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15315,7 +15855,7 @@ void js_register_cocos2dx_SkewTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_SkewTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_SkewTo_class,
js_cocos2dx_SkewTo_constructor, 0, // constructor
properties,
@@ -15346,9 +15886,9 @@ JSObject *jsb_cocos2d_SkewBy_prototype;
bool js_cocos2dx_SkewBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::SkewBy* cobj = (cocos2d::SkewBy *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewBy_initWithDuration : Invalid Native Object");
@@ -15356,14 +15896,14 @@ bool js_cocos2dx_SkewBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
double arg0;
double arg1;
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewBy_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -15372,15 +15912,15 @@ bool js_cocos2dx_SkewBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_SkewBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 3) {
double arg0;
double arg1;
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewBy_create : Error processing arguments");
cocos2d::SkewBy* ret = cocos2d::SkewBy::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -15392,7 +15932,7 @@ bool js_cocos2dx_SkewBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_SkewBy_create : wrong number of arguments");
@@ -15401,7 +15941,7 @@ bool js_cocos2dx_SkewBy_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_SkewBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::SkewBy* cobj = new (std::nothrow) cocos2d::SkewBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15415,13 +15955,16 @@ bool js_cocos2dx_SkewBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::SkewBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15432,7 +15975,7 @@ void js_cocos2d_SkewBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (SkewBy)", obj);
}
-void js_register_cocos2dx_SkewBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_SkewBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_SkewBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_SkewBy_class->name = "SkewBy";
jsb_cocos2d_SkewBy_class->addProperty = JS_PropertyStub;
@@ -15446,8 +15989,8 @@ void js_register_cocos2dx_SkewBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_SkewBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15462,7 +16005,7 @@ void js_register_cocos2dx_SkewBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_SkewBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_SkewTo_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_SkewTo_prototype),
jsb_cocos2d_SkewBy_class,
js_cocos2dx_SkewBy_constructor, 0, // constructor
properties,
@@ -15493,9 +16036,9 @@ JSObject *jsb_cocos2d_JumpBy_prototype;
bool js_cocos2dx_JumpBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::JumpBy* cobj = (cocos2d::JumpBy *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpBy_initWithDuration : Invalid Native Object");
@@ -15504,15 +16047,15 @@ bool js_cocos2dx_JumpBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Vec2 arg1;
double arg2;
int arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= jsval_to_int32(cx, argv[3], (int32_t *)&arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpBy_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -15521,17 +16064,17 @@ bool js_cocos2dx_JumpBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_JumpBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 4) {
double arg0;
cocos2d::Vec2 arg1;
double arg2;
int arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= jsval_to_int32(cx, argv[3], (int32_t *)&arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpBy_create : Error processing arguments");
cocos2d::JumpBy* ret = cocos2d::JumpBy::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -15543,7 +16086,7 @@ bool js_cocos2dx_JumpBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_JumpBy_create : wrong number of arguments");
@@ -15552,7 +16095,7 @@ bool js_cocos2dx_JumpBy_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_JumpBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::JumpBy* cobj = new (std::nothrow) cocos2d::JumpBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15566,13 +16109,16 @@ bool js_cocos2dx_JumpBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15583,7 +16129,7 @@ void js_cocos2d_JumpBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (JumpBy)", obj);
}
-void js_register_cocos2dx_JumpBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_JumpBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_JumpBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_JumpBy_class->name = "JumpBy";
jsb_cocos2d_JumpBy_class->addProperty = JS_PropertyStub;
@@ -15597,8 +16143,8 @@ void js_register_cocos2dx_JumpBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_JumpBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15613,7 +16159,7 @@ void js_register_cocos2dx_JumpBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_JumpBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_JumpBy_class,
js_cocos2dx_JumpBy_constructor, 0, // constructor
properties,
@@ -15642,19 +16188,47 @@ void js_register_cocos2dx_JumpBy(JSContext *cx, JSObject *global) {
JSClass *jsb_cocos2d_JumpTo_class;
JSObject *jsb_cocos2d_JumpTo_prototype;
+bool js_cocos2dx_JumpTo_initWithDuration(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::JumpTo* cobj = (cocos2d::JumpTo *)(proxy ? proxy->ptr : NULL);
+ JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTo_initWithDuration : Invalid Native Object");
+ if (argc == 4) {
+ double arg0;
+ cocos2d::Vec2 arg1;
+ double arg2;
+ int arg3;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
+ JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTo_initWithDuration : Error processing arguments");
+ bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
+ jsval jsret = JSVAL_NULL;
+ jsret = BOOLEAN_TO_JSVAL(ret);
+ args.rval().set(jsret);
+ return true;
+ }
+
+ JS_ReportError(cx, "js_cocos2dx_JumpTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
+ return false;
+}
bool js_cocos2dx_JumpTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 4) {
double arg0;
cocos2d::Vec2 arg1;
double arg2;
int arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_vector2(cx, argv[1], &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= jsval_to_int32(cx, argv[3], (int32_t *)&arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_vector2(cx, args.get(1), &arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTo_create : Error processing arguments");
cocos2d::JumpTo* ret = cocos2d::JumpTo::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -15666,7 +16240,7 @@ bool js_cocos2dx_JumpTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_JumpTo_create : wrong number of arguments");
@@ -15675,7 +16249,7 @@ bool js_cocos2dx_JumpTo_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_JumpTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::JumpTo* cobj = new (std::nothrow) cocos2d::JumpTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15689,13 +16263,16 @@ bool js_cocos2dx_JumpTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::JumpTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15706,7 +16283,7 @@ void js_cocos2d_JumpTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (JumpTo)", obj);
}
-void js_register_cocos2dx_JumpTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_JumpTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_JumpTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_JumpTo_class->name = "JumpTo";
jsb_cocos2d_JumpTo_class->addProperty = JS_PropertyStub;
@@ -15720,11 +16297,12 @@ void js_register_cocos2dx_JumpTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_JumpTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
+ JS_FN("initWithDuration", js_cocos2dx_JumpTo_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@@ -15735,7 +16313,7 @@ void js_register_cocos2dx_JumpTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_JumpTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_JumpBy_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_JumpBy_prototype),
jsb_cocos2d_JumpTo_class,
js_cocos2dx_JumpTo_constructor, 0, // constructor
properties,
@@ -15766,7 +16344,7 @@ JSObject *jsb_cocos2d_BezierBy_prototype;
bool js_cocos2dx_BezierBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::BezierBy* cobj = new (std::nothrow) cocos2d::BezierBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15780,13 +16358,16 @@ bool js_cocos2dx_BezierBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15797,7 +16378,7 @@ void js_cocos2d_BezierBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (BezierBy)", obj);
}
-void js_register_cocos2dx_BezierBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_BezierBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_BezierBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_BezierBy_class->name = "BezierBy";
jsb_cocos2d_BezierBy_class->addProperty = JS_PropertyStub;
@@ -15811,8 +16392,8 @@ void js_register_cocos2dx_BezierBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_BezierBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15823,7 +16404,7 @@ void js_register_cocos2dx_BezierBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_BezierBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_BezierBy_class,
js_cocos2dx_BezierBy_constructor, 0, // constructor
properties,
@@ -15854,7 +16435,7 @@ JSObject *jsb_cocos2d_BezierTo_prototype;
bool js_cocos2dx_BezierTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::BezierTo* cobj = new (std::nothrow) cocos2d::BezierTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -15868,13 +16449,16 @@ bool js_cocos2dx_BezierTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::BezierTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -15885,7 +16469,7 @@ void js_cocos2d_BezierTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (BezierTo)", obj);
}
-void js_register_cocos2dx_BezierTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_BezierTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_BezierTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_BezierTo_class->name = "BezierTo";
jsb_cocos2d_BezierTo_class->addProperty = JS_PropertyStub;
@@ -15899,8 +16483,8 @@ void js_register_cocos2dx_BezierTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_BezierTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -15911,7 +16495,7 @@ void js_register_cocos2dx_BezierTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_BezierTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_BezierBy_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_BezierBy_prototype),
jsb_cocos2d_BezierTo_class,
js_cocos2dx_BezierTo_constructor, 0, // constructor
properties,
@@ -15942,30 +16526,30 @@ JSObject *jsb_cocos2d_ScaleTo_prototype;
bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::ScaleTo* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::ScaleTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ScaleTo_initWithDuration : Invalid Native Object");
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -15973,15 +16557,15 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -15989,21 +16573,21 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
do {
if (argc == 4) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
if (!ok) { ok = true; break; }
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -16013,19 +16597,19 @@ bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -16037,7 +16621,7 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16045,10 +16629,10 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -16060,7 +16644,7 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16068,16 +16652,16 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 4) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
if (!ok) { ok = true; break; }
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -16089,7 +16673,7 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16098,7 +16682,7 @@ bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ScaleTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ScaleTo* cobj = new (std::nothrow) cocos2d::ScaleTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16112,13 +16696,16 @@ bool js_cocos2dx_ScaleTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16129,7 +16716,7 @@ void js_cocos2d_ScaleTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ScaleTo)", obj);
}
-void js_register_cocos2dx_ScaleTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ScaleTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ScaleTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ScaleTo_class->name = "ScaleTo";
jsb_cocos2d_ScaleTo_class->addProperty = JS_PropertyStub;
@@ -16143,8 +16730,8 @@ void js_register_cocos2dx_ScaleTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_ScaleTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16159,7 +16746,7 @@ void js_register_cocos2dx_ScaleTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_ScaleTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_ScaleTo_class,
js_cocos2dx_ScaleTo_constructor, 0, // constructor
properties,
@@ -16190,19 +16777,19 @@ JSObject *jsb_cocos2d_ScaleBy_prototype;
bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2);
jsval jsret = JSVAL_NULL;
@@ -16214,7 +16801,7 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16222,10 +16809,10 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 2) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -16237,7 +16824,7 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16245,16 +16832,16 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 4) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
if (!ok) { ok = true; break; }
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -16266,7 +16853,7 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -16275,7 +16862,7 @@ bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ScaleBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ScaleBy* cobj = new (std::nothrow) cocos2d::ScaleBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16289,13 +16876,16 @@ bool js_cocos2dx_ScaleBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ScaleBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16306,7 +16896,7 @@ void js_cocos2d_ScaleBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ScaleBy)", obj);
}
-void js_register_cocos2dx_ScaleBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ScaleBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ScaleBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ScaleBy_class->name = "ScaleBy";
jsb_cocos2d_ScaleBy_class->addProperty = JS_PropertyStub;
@@ -16320,8 +16910,8 @@ void js_register_cocos2dx_ScaleBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_ScaleBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16335,7 +16925,7 @@ void js_register_cocos2dx_ScaleBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_ScaleBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ScaleTo_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ScaleTo_prototype),
jsb_cocos2d_ScaleBy_class,
js_cocos2dx_ScaleBy_constructor, 0, // constructor
properties,
@@ -16366,22 +16956,22 @@ JSObject *jsb_cocos2d_Blink_prototype;
bool js_cocos2dx_Blink_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Blink* cobj = (cocos2d::Blink *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Blink_initWithDuration : Invalid Native Object");
if (argc == 2) {
double arg0;
int arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -16390,13 +16980,13 @@ bool js_cocos2dx_Blink_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Blink_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
double arg0;
int arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_create : Error processing arguments");
cocos2d::Blink* ret = cocos2d::Blink::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -16408,7 +16998,7 @@ bool js_cocos2dx_Blink_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Blink_create : wrong number of arguments");
@@ -16417,7 +17007,7 @@ bool js_cocos2dx_Blink_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Blink_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Blink* cobj = new (std::nothrow) cocos2d::Blink();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16431,13 +17021,16 @@ bool js_cocos2dx_Blink_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Blink");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Blink");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16448,7 +17041,7 @@ void js_cocos2d_Blink_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Blink)", obj);
}
-void js_register_cocos2dx_Blink(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Blink(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Blink_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Blink_class->name = "Blink";
jsb_cocos2d_Blink_class->addProperty = JS_PropertyStub;
@@ -16462,8 +17055,8 @@ void js_register_cocos2dx_Blink(JSContext *cx, JSObject *global) {
jsb_cocos2d_Blink_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16478,7 +17071,7 @@ void js_register_cocos2dx_Blink(JSContext *cx, JSObject *global) {
jsb_cocos2d_Blink_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_Blink_class,
js_cocos2dx_Blink_constructor, 0, // constructor
properties,
@@ -16509,22 +17102,22 @@ JSObject *jsb_cocos2d_FadeTo_prototype;
bool js_cocos2dx_FadeTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FadeTo* cobj = (cocos2d::FadeTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeTo_initWithDuration : Invalid Native Object");
if (argc == 2) {
double arg0;
uint16_t arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_uint16(cx, argv[1], &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_uint16(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeTo_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -16533,13 +17126,13 @@ bool js_cocos2dx_FadeTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_FadeTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
double arg0;
uint16_t arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_uint16(cx, argv[1], &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_uint16(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeTo_create : Error processing arguments");
cocos2d::FadeTo* ret = cocos2d::FadeTo::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -16551,7 +17144,7 @@ bool js_cocos2dx_FadeTo_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FadeTo_create : wrong number of arguments");
@@ -16560,7 +17153,7 @@ bool js_cocos2dx_FadeTo_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FadeTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FadeTo* cobj = new (std::nothrow) cocos2d::FadeTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16574,13 +17167,16 @@ bool js_cocos2dx_FadeTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16591,7 +17187,7 @@ void js_cocos2d_FadeTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FadeTo)", obj);
}
-void js_register_cocos2dx_FadeTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FadeTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FadeTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FadeTo_class->name = "FadeTo";
jsb_cocos2d_FadeTo_class->addProperty = JS_PropertyStub;
@@ -16605,8 +17201,8 @@ void js_register_cocos2dx_FadeTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16621,7 +17217,7 @@ void js_register_cocos2dx_FadeTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_FadeTo_class,
js_cocos2dx_FadeTo_constructor, 0, // constructor
properties,
@@ -16652,25 +17248,25 @@ JSObject *jsb_cocos2d_FadeIn_prototype;
bool js_cocos2dx_FadeIn_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FadeIn* cobj = (cocos2d::FadeIn *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeIn_setReverseAction : Invalid Native Object");
if (argc == 1) {
cocos2d::FadeTo* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FadeTo*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeIn_setReverseAction : Error processing arguments");
cobj->setReverseAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -16679,11 +17275,11 @@ bool js_cocos2dx_FadeIn_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_FadeIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeIn_create : Error processing arguments");
cocos2d::FadeIn* ret = cocos2d::FadeIn::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -16695,7 +17291,7 @@ bool js_cocos2dx_FadeIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FadeIn_create : wrong number of arguments");
@@ -16704,7 +17300,7 @@ bool js_cocos2dx_FadeIn_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FadeIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FadeIn* cobj = new (std::nothrow) cocos2d::FadeIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16718,13 +17314,16 @@ bool js_cocos2dx_FadeIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16735,7 +17334,7 @@ void js_cocos2d_FadeIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FadeIn)", obj);
}
-void js_register_cocos2dx_FadeIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FadeIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FadeIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FadeIn_class->name = "FadeIn";
jsb_cocos2d_FadeIn_class->addProperty = JS_PropertyStub;
@@ -16749,8 +17348,8 @@ void js_register_cocos2dx_FadeIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16765,7 +17364,7 @@ void js_register_cocos2dx_FadeIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_FadeTo_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_FadeTo_prototype),
jsb_cocos2d_FadeIn_class,
js_cocos2dx_FadeIn_constructor, 0, // constructor
properties,
@@ -16796,25 +17395,25 @@ JSObject *jsb_cocos2d_FadeOut_prototype;
bool js_cocos2dx_FadeOut_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FadeOut* cobj = (cocos2d::FadeOut *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOut_setReverseAction : Invalid Native Object");
if (argc == 1) {
cocos2d::FadeTo* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FadeTo*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOut_setReverseAction : Error processing arguments");
cobj->setReverseAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -16823,11 +17422,11 @@ bool js_cocos2dx_FadeOut_setReverseAction(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FadeOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOut_create : Error processing arguments");
cocos2d::FadeOut* ret = cocos2d::FadeOut::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -16839,7 +17438,7 @@ bool js_cocos2dx_FadeOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FadeOut_create : wrong number of arguments");
@@ -16848,7 +17447,7 @@ bool js_cocos2dx_FadeOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FadeOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FadeOut* cobj = new (std::nothrow) cocos2d::FadeOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -16862,13 +17461,16 @@ bool js_cocos2dx_FadeOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FadeOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -16879,7 +17481,7 @@ void js_cocos2d_FadeOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FadeOut)", obj);
}
-void js_register_cocos2dx_FadeOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FadeOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FadeOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FadeOut_class->name = "FadeOut";
jsb_cocos2d_FadeOut_class->addProperty = JS_PropertyStub;
@@ -16893,8 +17495,8 @@ void js_register_cocos2dx_FadeOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -16909,7 +17511,7 @@ void js_register_cocos2dx_FadeOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_FadeOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_FadeTo_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_FadeTo_prototype),
jsb_cocos2d_FadeOut_class,
js_cocos2dx_FadeOut_constructor, 0, // constructor
properties,
@@ -16940,9 +17542,9 @@ JSObject *jsb_cocos2d_TintTo_prototype;
bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::TintTo* cobj = (cocos2d::TintTo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintTo_initWithDuration : Invalid Native Object");
@@ -16951,15 +17553,15 @@ bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
uint16_t arg1;
uint16_t arg2;
uint16_t arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_uint16(cx, argv[1], &arg1);
- ok &= jsval_to_uint16(cx, argv[2], &arg2);
- ok &= jsval_to_uint16(cx, argv[3], &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_uint16(cx, args.get(1), &arg1);
+ ok &= jsval_to_uint16(cx, args.get(2), &arg2);
+ ok &= jsval_to_uint16(cx, args.get(3), &arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintTo_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -16968,38 +17570,66 @@ bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- if (argc == 4) {
- double arg0;
- uint16_t arg1;
- uint16_t arg2;
- uint16_t arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_uint16(cx, argv[1], &arg1);
- ok &= jsval_to_uint16(cx, argv[2], &arg2);
- ok &= jsval_to_uint16(cx, argv[3], &arg3);
- JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintTo_create : Error processing arguments");
- cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1, arg2, arg3);
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::TintTo*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
+
+ do {
+ if (argc == 2) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ cocos2d::Color3B arg1;
+ ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::TintTo*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
+ }
+ } while (0);
+
+ do {
+ if (argc == 4) {
+ double arg0;
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ if (!ok) { ok = true; break; }
+ uint16_t arg1;
+ ok &= jsval_to_uint16(cx, args.get(1), &arg1);
+ if (!ok) { ok = true; break; }
+ uint16_t arg2;
+ ok &= jsval_to_uint16(cx, args.get(2), &arg2);
+ if (!ok) { ok = true; break; }
+ uint16_t arg3;
+ ok &= jsval_to_uint16(cx, args.get(3), &arg3);
+ if (!ok) { ok = true; break; }
+ cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1, arg2, arg3);
+ jsval jsret = JSVAL_NULL;
+ do {
+ if (ret) {
+ js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::TintTo*)ret);
+ jsret = OBJECT_TO_JSVAL(jsProxy->obj);
+ } else {
+ jsret = JSVAL_NULL;
+ }
+ } while (0);
+ args.rval().set(jsret);
+ return true;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
JS_ReportError(cx, "js_cocos2dx_TintTo_create : wrong number of arguments");
return false;
}
-
bool js_cocos2dx_TintTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::TintTo* cobj = new (std::nothrow) cocos2d::TintTo();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17013,13 +17643,16 @@ bool js_cocos2dx_TintTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintTo");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintTo");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17030,7 +17663,7 @@ void js_cocos2d_TintTo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (TintTo)", obj);
}
-void js_register_cocos2dx_TintTo(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_TintTo(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_TintTo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_TintTo_class->name = "TintTo";
jsb_cocos2d_TintTo_class->addProperty = JS_PropertyStub;
@@ -17044,8 +17677,8 @@ void js_register_cocos2dx_TintTo(JSContext *cx, JSObject *global) {
jsb_cocos2d_TintTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17054,13 +17687,13 @@ void js_register_cocos2dx_TintTo(JSContext *cx, JSObject *global) {
};
static JSFunctionSpec st_funcs[] = {
- JS_FN("create", js_cocos2dx_TintTo_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_FN("create", js_cocos2dx_TintTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
jsb_cocos2d_TintTo_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_TintTo_class,
js_cocos2dx_TintTo_constructor, 0, // constructor
properties,
@@ -17091,9 +17724,9 @@ JSObject *jsb_cocos2d_TintBy_prototype;
bool js_cocos2dx_TintBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::TintBy* cobj = (cocos2d::TintBy *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintBy_initWithDuration : Invalid Native Object");
@@ -17102,15 +17735,15 @@ bool js_cocos2dx_TintBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
int32_t arg1;
int32_t arg2;
int32_t arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_int32(cx, argv[1], &arg1);
- ok &= jsval_to_int32(cx, argv[2], &arg2);
- ok &= jsval_to_int32(cx, argv[3], &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_int32(cx, args.get(1), &arg1);
+ ok &= jsval_to_int32(cx, args.get(2), &arg2);
+ ok &= jsval_to_int32(cx, args.get(3), &arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintBy_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -17119,17 +17752,17 @@ bool js_cocos2dx_TintBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_TintBy_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 4) {
double arg0;
int32_t arg1;
int32_t arg2;
int32_t arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_int32(cx, argv[1], &arg1);
- ok &= jsval_to_int32(cx, argv[2], &arg2);
- ok &= jsval_to_int32(cx, argv[3], &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_int32(cx, args.get(1), &arg1);
+ ok &= jsval_to_int32(cx, args.get(2), &arg2);
+ ok &= jsval_to_int32(cx, args.get(3), &arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintBy_create : Error processing arguments");
cocos2d::TintBy* ret = cocos2d::TintBy::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -17141,7 +17774,7 @@ bool js_cocos2dx_TintBy_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_TintBy_create : wrong number of arguments");
@@ -17150,7 +17783,7 @@ bool js_cocos2dx_TintBy_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_TintBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::TintBy* cobj = new (std::nothrow) cocos2d::TintBy();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17164,13 +17797,16 @@ bool js_cocos2dx_TintBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintBy");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::TintBy");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17181,7 +17817,7 @@ void js_cocos2d_TintBy_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (TintBy)", obj);
}
-void js_register_cocos2dx_TintBy(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_TintBy(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_TintBy_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_TintBy_class->name = "TintBy";
jsb_cocos2d_TintBy_class->addProperty = JS_PropertyStub;
@@ -17195,8 +17831,8 @@ void js_register_cocos2dx_TintBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_TintBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17211,7 +17847,7 @@ void js_register_cocos2dx_TintBy(JSContext *cx, JSObject *global) {
jsb_cocos2d_TintBy_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_TintBy_class,
js_cocos2dx_TintBy_constructor, 0, // constructor
properties,
@@ -17242,11 +17878,11 @@ JSObject *jsb_cocos2d_DelayTime_prototype;
bool js_cocos2dx_DelayTime_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DelayTime_create : Error processing arguments");
cocos2d::DelayTime* ret = cocos2d::DelayTime::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -17258,7 +17894,7 @@ bool js_cocos2dx_DelayTime_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_DelayTime_create : wrong number of arguments");
@@ -17267,7 +17903,7 @@ bool js_cocos2dx_DelayTime_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_DelayTime_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::DelayTime* cobj = new (std::nothrow) cocos2d::DelayTime();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17281,13 +17917,16 @@ bool js_cocos2dx_DelayTime_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::DelayTime");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::DelayTime");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17298,7 +17937,7 @@ void js_cocos2d_DelayTime_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (DelayTime)", obj);
}
-void js_register_cocos2dx_DelayTime(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_DelayTime(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_DelayTime_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_DelayTime_class->name = "DelayTime";
jsb_cocos2d_DelayTime_class->addProperty = JS_PropertyStub;
@@ -17312,8 +17951,8 @@ void js_register_cocos2dx_DelayTime(JSContext *cx, JSObject *global) {
jsb_cocos2d_DelayTime_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17327,7 +17966,7 @@ void js_register_cocos2dx_DelayTime(JSContext *cx, JSObject *global) {
jsb_cocos2d_DelayTime_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_DelayTime_class,
js_cocos2dx_DelayTime_constructor, 0, // constructor
properties,
@@ -17358,18 +17997,18 @@ JSObject *jsb_cocos2d_ReverseTime_prototype;
bool js_cocos2dx_ReverseTime_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ReverseTime* cobj = (cocos2d::ReverseTime *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReverseTime_initWithAction : Invalid Native Object");
if (argc == 1) {
cocos2d::FiniteTimeAction* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -17378,7 +18017,7 @@ bool js_cocos2dx_ReverseTime_initWithAction(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->initWithAction(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -17387,14 +18026,14 @@ bool js_cocos2dx_ReverseTime_initWithAction(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_ReverseTime_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::FiniteTimeAction* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -17410,7 +18049,7 @@ bool js_cocos2dx_ReverseTime_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ReverseTime_create : wrong number of arguments");
@@ -17419,7 +18058,7 @@ bool js_cocos2dx_ReverseTime_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_ReverseTime_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ReverseTime* cobj = new (std::nothrow) cocos2d::ReverseTime();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17433,13 +18072,16 @@ bool js_cocos2dx_ReverseTime_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ReverseTime");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ReverseTime");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17450,7 +18092,7 @@ void js_cocos2d_ReverseTime_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ReverseTime)", obj);
}
-void js_register_cocos2dx_ReverseTime(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ReverseTime(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ReverseTime_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ReverseTime_class->name = "ReverseTime";
jsb_cocos2d_ReverseTime_class->addProperty = JS_PropertyStub;
@@ -17464,8 +18106,8 @@ void js_register_cocos2dx_ReverseTime(JSContext *cx, JSObject *global) {
jsb_cocos2d_ReverseTime_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17480,7 +18122,7 @@ void js_register_cocos2dx_ReverseTime(JSContext *cx, JSObject *global) {
jsb_cocos2d_ReverseTime_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_ReverseTime_class,
js_cocos2dx_ReverseTime_constructor, 0, // constructor
properties,
@@ -17511,12 +18153,12 @@ JSObject *jsb_cocos2d_Animate_prototype;
bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::Animate* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_getAnimation : Invalid Native Object");
@@ -17532,7 +18174,7 @@ bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -17549,7 +18191,7 @@ bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -17559,18 +18201,18 @@ bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_initWithAnimation : Invalid Native Object");
if (argc == 1) {
cocos2d::Animation* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -17579,7 +18221,7 @@ bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval *
bool ret = cobj->initWithAnimation(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -17588,25 +18230,25 @@ bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Animate_setAnimation(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_setAnimation : Invalid Native Object");
if (argc == 1) {
cocos2d::Animation* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animate_setAnimation : Error processing arguments");
cobj->setAnimation(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -17615,14 +18257,14 @@ bool js_cocos2dx_Animate_setAnimation(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Animate_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Animation* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -17638,7 +18280,7 @@ bool js_cocos2dx_Animate_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Animate_create : wrong number of arguments");
@@ -17647,7 +18289,7 @@ bool js_cocos2dx_Animate_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Animate_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Animate* cobj = new (std::nothrow) cocos2d::Animate();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17661,13 +18303,16 @@ bool js_cocos2dx_Animate_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animate");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Animate");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17678,7 +18323,7 @@ void js_cocos2d_Animate_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Animate)", obj);
}
-void js_register_cocos2dx_Animate(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Animate(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Animate_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Animate_class->name = "Animate";
jsb_cocos2d_Animate_class->addProperty = JS_PropertyStub;
@@ -17692,8 +18337,8 @@ void js_register_cocos2dx_Animate(JSContext *cx, JSObject *global) {
jsb_cocos2d_Animate_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17710,7 +18355,7 @@ void js_register_cocos2dx_Animate(JSContext *cx, JSObject *global) {
jsb_cocos2d_Animate_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_Animate_class,
js_cocos2dx_Animate_constructor, 0, // constructor
properties,
@@ -17741,12 +18386,12 @@ JSObject *jsb_cocos2d_TargetedAction_prototype;
bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::TargetedAction* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_getForcedTarget : Invalid Native Object");
@@ -17762,7 +18407,7 @@ bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, js
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -17779,7 +18424,7 @@ bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, js
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while(0);
@@ -17789,9 +18434,9 @@ bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_initWithTarget : Invalid Native Object");
@@ -17799,17 +18444,17 @@ bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsv
cocos2d::Node* arg0;
cocos2d::FiniteTimeAction* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -17818,7 +18463,7 @@ bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsv
bool ret = cobj->initWithTarget(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -17827,25 +18472,25 @@ bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_TargetedAction_setForcedTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_setForcedTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TargetedAction_setForcedTarget : Error processing arguments");
cobj->setForcedTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -17854,23 +18499,23 @@ bool js_cocos2dx_TargetedAction_setForcedTarget(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_TargetedAction_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::Node* arg0;
cocos2d::FiniteTimeAction* arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -17886,7 +18531,7 @@ bool js_cocos2dx_TargetedAction_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_TargetedAction_create : wrong number of arguments");
@@ -17895,7 +18540,7 @@ bool js_cocos2dx_TargetedAction_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_TargetedAction_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::TargetedAction* cobj = new (std::nothrow) cocos2d::TargetedAction();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -17909,13 +18554,16 @@ bool js_cocos2dx_TargetedAction_constructor(JSContext *cx, uint32_t argc, jsval
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::TargetedAction");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::TargetedAction");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -17928,21 +18576,21 @@ void js_cocos2d_TargetedAction_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_TargetedAction_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::TargetedAction *nobj = new (std::nothrow) cocos2d::TargetedAction();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::TargetedAction");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::TargetedAction");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_TargetedAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_TargetedAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_TargetedAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_TargetedAction_class->name = "TargetedAction";
jsb_cocos2d_TargetedAction_class->addProperty = JS_PropertyStub;
@@ -17956,8 +18604,8 @@ void js_register_cocos2dx_TargetedAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_TargetedAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -17975,7 +18623,7 @@ void js_register_cocos2dx_TargetedAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_TargetedAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_TargetedAction_class,
js_cocos2dx_TargetedAction_constructor, 0, // constructor
properties,
@@ -18006,28 +18654,28 @@ JSObject *jsb_cocos2d_ActionCamera_prototype;
bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = NULL;
+ JS::RootedObject obj(cx);
cocos2d::ActionCamera* cobj = NULL;
- obj = JS_THIS_OBJECT(cx, vp);
+ obj = args.thisv().toObjectOrNull();
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setEye : Invalid Native Object");
do {
if (argc == 3) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
double arg2;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
if (!ok) { ok = true; break; }
cobj->setEye(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -18035,10 +18683,10 @@ bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp)
do {
if (argc == 1) {
cocos2d::Vec3 arg0;
- ok &= jsval_to_vector3(cx, argv[0], &arg0);
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cobj->setEye(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
} while(0);
@@ -18048,7 +18696,8 @@ bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_getEye(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getEye : Invalid Native Object");
@@ -18056,7 +18705,7 @@ bool js_cocos2dx_ActionCamera_getEye(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec3& ret = cobj->getEye();
jsval jsret = JSVAL_NULL;
jsret = vector3_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18065,18 +18714,18 @@ bool js_cocos2dx_ActionCamera_getEye(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_setUp(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setUp : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec3 arg0;
- ok &= jsval_to_vector3(cx, argv[0], &arg0);
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionCamera_setUp : Error processing arguments");
cobj->setUp(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18085,7 +18734,8 @@ bool js_cocos2dx_ActionCamera_setUp(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_getCenter(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getCenter : Invalid Native Object");
@@ -18093,7 +18743,7 @@ bool js_cocos2dx_ActionCamera_getCenter(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec3& ret = cobj->getCenter();
jsval jsret = JSVAL_NULL;
jsret = vector3_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18102,18 +18752,18 @@ bool js_cocos2dx_ActionCamera_getCenter(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_setCenter(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setCenter : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec3 arg0;
- ok &= jsval_to_vector3(cx, argv[0], &arg0);
+ ok &= jsval_to_vector3(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionCamera_setCenter : Error processing arguments");
cobj->setCenter(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18122,7 +18772,8 @@ bool js_cocos2dx_ActionCamera_setCenter(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_getUp(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getUp : Invalid Native Object");
@@ -18130,7 +18781,7 @@ bool js_cocos2dx_ActionCamera_getUp(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec3& ret = cobj->getUp();
jsval jsret = JSVAL_NULL;
jsret = vector3_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18139,7 +18790,7 @@ bool js_cocos2dx_ActionCamera_getUp(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ActionCamera* cobj = new (std::nothrow) cocos2d::ActionCamera();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -18153,13 +18804,16 @@ bool js_cocos2dx_ActionCamera_constructor(JSContext *cx, uint32_t argc, jsval *v
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionCamera");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionCamera");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -18172,21 +18826,21 @@ void js_cocos2d_ActionCamera_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_ActionCamera_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::ActionCamera *nobj = new (std::nothrow) cocos2d::ActionCamera();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionCamera");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionCamera");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_ActionCamera(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ActionCamera(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ActionCamera_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ActionCamera_class->name = "ActionCamera";
jsb_cocos2d_ActionCamera_class->addProperty = JS_PropertyStub;
@@ -18200,8 +18854,8 @@ void js_register_cocos2dx_ActionCamera(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionCamera_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -18219,7 +18873,7 @@ void js_register_cocos2dx_ActionCamera(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionCamera_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_ActionCamera_class,
js_cocos2dx_ActionCamera_constructor, 0, // constructor
properties,
@@ -18250,9 +18904,9 @@ JSObject *jsb_cocos2d_OrbitCamera_prototype;
bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Invalid Native Object");
@@ -18268,7 +18922,7 @@ bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval
ok = false;
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Error processing arguments");
cobj->sphericalRadius(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18277,9 +18931,9 @@ bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_initWithDuration : Invalid Native Object");
@@ -18291,18 +18945,18 @@ bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsva
double arg4;
double arg5;
double arg6;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[4]), &arg4);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[5]), &arg5);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[6]), &arg6);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4);
+ ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
+ ok &= JS::ToNumber( cx, args.get(6), &arg6) && !isnan(arg6);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18311,7 +18965,7 @@ bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 7) {
double arg0;
@@ -18321,13 +18975,13 @@ bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp)
double arg4;
double arg5;
double arg6;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[4]), &arg4);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[5]), &arg5);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[6]), &arg6);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4);
+ ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
+ ok &= JS::ToNumber( cx, args.get(6), &arg6) && !isnan(arg6);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_create : Error processing arguments");
cocos2d::OrbitCamera* ret = cocos2d::OrbitCamera::create(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
jsval jsret = JSVAL_NULL;
@@ -18339,7 +18993,7 @@ bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_OrbitCamera_create : wrong number of arguments");
@@ -18348,7 +19002,7 @@ bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::OrbitCamera* cobj = new (std::nothrow) cocos2d::OrbitCamera();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -18362,13 +19016,16 @@ bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::OrbitCamera");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::OrbitCamera");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -18379,7 +19036,7 @@ void js_cocos2d_OrbitCamera_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (OrbitCamera)", obj);
}
-void js_register_cocos2dx_OrbitCamera(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_OrbitCamera_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_OrbitCamera_class->name = "OrbitCamera";
jsb_cocos2d_OrbitCamera_class->addProperty = JS_PropertyStub;
@@ -18393,8 +19050,8 @@ void js_register_cocos2dx_OrbitCamera(JSContext *cx, JSObject *global) {
jsb_cocos2d_OrbitCamera_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -18410,7 +19067,7 @@ void js_register_cocos2dx_OrbitCamera(JSContext *cx, JSObject *global) {
jsb_cocos2d_OrbitCamera_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionCamera_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionCamera_prototype),
jsb_cocos2d_OrbitCamera_class,
js_cocos2dx_OrbitCamera_constructor, 0, // constructor
properties,
@@ -18441,20 +19098,20 @@ JSObject *jsb_cocos2d_ActionManager_prototype;
bool js_cocos2dx_ActionManager_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getActionByTag : Invalid Native Object");
if (argc == 2) {
int arg0;
const cocos2d::Node* arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (const cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
@@ -18470,7 +19127,7 @@ bool js_cocos2dx_ActionManager_getActionByTag(JSContext *cx, uint32_t argc, jsva
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18479,27 +19136,27 @@ bool js_cocos2dx_ActionManager_getActionByTag(JSContext *cx, uint32_t argc, jsva
}
bool js_cocos2dx_ActionManager_removeActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeActionByTag : Invalid Native Object");
if (argc == 2) {
int arg0;
cocos2d::Node* arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeActionByTag : Error processing arguments");
cobj->removeActionByTag(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18508,13 +19165,14 @@ bool js_cocos2dx_ActionManager_removeActionByTag(JSContext *cx, uint32_t argc, j
}
bool js_cocos2dx_ActionManager_removeAllActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActions : Invalid Native Object");
if (argc == 0) {
cobj->removeAllActions();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18523,9 +19181,9 @@ bool js_cocos2dx_ActionManager_removeAllActions(JSContext *cx, uint32_t argc, js
}
bool js_cocos2dx_ActionManager_addAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_addAction : Invalid Native Object");
@@ -18534,25 +19192,25 @@ bool js_cocos2dx_ActionManager_addAction(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Node* arg1;
bool arg2;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
- arg2 = JS::ToBoolean(JS::RootedValue(cx, argv[2]));
+ arg2 = JS::ToBoolean(args.get(2));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_addAction : Error processing arguments");
cobj->addAction(arg0, arg1, arg2);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18561,25 +19219,25 @@ bool js_cocos2dx_ActionManager_addAction(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_ActionManager_resumeTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_resumeTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_resumeTarget : Error processing arguments");
cobj->resumeTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18588,18 +19246,18 @@ bool js_cocos2dx_ActionManager_resumeTarget(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_ActionManager_update(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_update : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_update : Error processing arguments");
cobj->update(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18608,25 +19266,25 @@ bool js_cocos2dx_ActionManager_update(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_ActionManager_pauseTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_pauseTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_pauseTarget : Error processing arguments");
cobj->pauseTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18635,18 +19293,18 @@ bool js_cocos2dx_ActionManager_pauseTarget(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget : Invalid Native Object");
if (argc == 1) {
const cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (const cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -18655,7 +19313,7 @@ bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget(JSContext *cx,
ssize_t ret = cobj->getNumberOfRunningActionsInTarget(arg0);
jsval jsret = JSVAL_NULL;
jsret = ssize_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18664,25 +19322,25 @@ bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget(JSContext *cx,
}
bool js_cocos2dx_ActionManager_removeAllActionsFromTarget(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : Invalid Native Object");
if (argc == 1) {
cocos2d::Node* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : Error processing arguments");
cobj->removeAllActionsFromTarget(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18691,18 +19349,18 @@ bool js_cocos2dx_ActionManager_removeAllActionsFromTarget(JSContext *cx, uint32_
}
bool js_cocos2dx_ActionManager_resumeTargets(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_resumeTargets : Invalid Native Object");
if (argc == 1) {
cocos2d::Vector arg0;
- ok &= jsval_to_ccvector(cx, argv[0], &arg0);
+ ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_resumeTargets : Error processing arguments");
cobj->resumeTargets(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18711,25 +19369,25 @@ bool js_cocos2dx_ActionManager_resumeTargets(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_ActionManager_removeAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAction : Invalid Native Object");
if (argc == 1) {
cocos2d::Action* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAction : Error processing arguments");
cobj->removeAction(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18738,27 +19396,27 @@ bool js_cocos2dx_ActionManager_removeAction(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_ActionManager_removeAllActionsByTag(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsByTag : Invalid Native Object");
if (argc == 2) {
int arg0;
cocos2d::Node* arg1;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
do {
- if (!argv[1].isObject()) { ok = false; break; }
+ if (!args.get(1).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
+ JSObject *tmpObj = args.get(1).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAllActionsByTag : Error processing arguments");
cobj->removeAllActionsByTag(arg0, arg1);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -18767,7 +19425,8 @@ bool js_cocos2dx_ActionManager_removeAllActionsByTag(JSContext *cx, uint32_t arg
}
bool js_cocos2dx_ActionManager_pauseAllRunningActions(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_pauseAllRunningActions : Invalid Native Object");
@@ -18775,7 +19434,7 @@ bool js_cocos2dx_ActionManager_pauseAllRunningActions(JSContext *cx, uint32_t ar
cocos2d::Vector ret = cobj->pauseAllRunningActions();
jsval jsret = JSVAL_NULL;
jsret = ccvector_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18784,7 +19443,7 @@ bool js_cocos2dx_ActionManager_pauseAllRunningActions(JSContext *cx, uint32_t ar
}
bool js_cocos2dx_ActionManager_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ActionManager* cobj = new (std::nothrow) cocos2d::ActionManager();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -18798,13 +19457,16 @@ bool js_cocos2dx_ActionManager_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionManager");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionManager");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -18816,21 +19478,21 @@ void js_cocos2d_ActionManager_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_ActionManager_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::ActionManager *nobj = new (std::nothrow) cocos2d::ActionManager();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionManager");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ActionManager");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_ActionManager(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ActionManager(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ActionManager_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ActionManager_class->name = "ActionManager";
jsb_cocos2d_ActionManager_class->addProperty = JS_PropertyStub;
@@ -18844,8 +19506,8 @@ void js_register_cocos2dx_ActionManager(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionManager_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -18870,7 +19532,7 @@ void js_register_cocos2dx_ActionManager(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionManager_prototype = JS_InitClass(
cx, global,
- NULL, // parent proto
+ JS::NullPtr(), // parent proto
jsb_cocos2d_ActionManager_class,
js_cocos2dx_ActionManager_constructor, 0, // constructor
properties,
@@ -18901,18 +19563,18 @@ JSObject *jsb_cocos2d_ActionEase_prototype;
bool js_cocos2dx_ActionEase_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionEase* cobj = (cocos2d::ActionEase *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionEase_initWithAction : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -18921,7 +19583,7 @@ bool js_cocos2dx_ActionEase_initWithAction(JSContext *cx, uint32_t argc, jsval *
bool ret = cobj->initWithAction(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18930,7 +19592,8 @@ bool js_cocos2dx_ActionEase_initWithAction(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_ActionEase_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::ActionEase* cobj = (cocos2d::ActionEase *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionEase_getInnerAction : Invalid Native Object");
@@ -18945,7 +19608,7 @@ bool js_cocos2dx_ActionEase_getInnerAction(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -18959,7 +19622,7 @@ void js_cocos2d_ActionEase_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ActionEase)", obj);
}
-void js_register_cocos2dx_ActionEase(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ActionEase(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ActionEase_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ActionEase_class->name = "ActionEase";
jsb_cocos2d_ActionEase_class->addProperty = JS_PropertyStub;
@@ -18973,8 +19636,8 @@ void js_register_cocos2dx_ActionEase(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionEase_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -18987,7 +19650,7 @@ void js_register_cocos2dx_ActionEase(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionEase_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_ActionEase_class,
empty_constructor, 0,
properties,
@@ -19018,18 +19681,18 @@ JSObject *jsb_cocos2d_EaseRateAction_prototype;
bool js_cocos2dx_EaseRateAction_setRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_setRate : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_setRate : Error processing arguments");
cobj->setRate(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -19038,9 +19701,9 @@ bool js_cocos2dx_EaseRateAction_setRate(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EaseRateAction_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_initWithAction : Invalid Native Object");
@@ -19048,19 +19711,19 @@ bool js_cocos2dx_EaseRateAction_initWithAction(JSContext *cx, uint32_t argc, jsv
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_initWithAction : Error processing arguments");
bool ret = cobj->initWithAction(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -19069,7 +19732,8 @@ bool js_cocos2dx_EaseRateAction_initWithAction(JSContext *cx, uint32_t argc, jsv
}
bool js_cocos2dx_EaseRateAction_getRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_getRate : Invalid Native Object");
@@ -19077,7 +19741,7 @@ bool js_cocos2dx_EaseRateAction_getRate(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getRate();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -19091,7 +19755,7 @@ void js_cocos2d_EaseRateAction_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseRateAction)", obj);
}
-void js_register_cocos2dx_EaseRateAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseRateAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseRateAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseRateAction_class->name = "EaseRateAction";
jsb_cocos2d_EaseRateAction_class->addProperty = JS_PropertyStub;
@@ -19105,8 +19769,8 @@ void js_register_cocos2dx_EaseRateAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseRateAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19120,7 +19784,7 @@ void js_register_cocos2dx_EaseRateAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseRateAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseRateAction_class,
empty_constructor, 0,
properties,
@@ -19151,20 +19815,20 @@ JSObject *jsb_cocos2d_EaseIn_prototype;
bool js_cocos2dx_EaseIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseIn_create : Error processing arguments");
cocos2d::EaseIn* ret = cocos2d::EaseIn::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -19176,7 +19840,7 @@ bool js_cocos2dx_EaseIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseIn_create : wrong number of arguments");
@@ -19185,7 +19849,7 @@ bool js_cocos2dx_EaseIn_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseIn* cobj = new (std::nothrow) cocos2d::EaseIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19199,13 +19863,16 @@ bool js_cocos2dx_EaseIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19216,7 +19883,7 @@ void js_cocos2d_EaseIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseIn)", obj);
}
-void js_register_cocos2dx_EaseIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseIn_class->name = "EaseIn";
jsb_cocos2d_EaseIn_class->addProperty = JS_PropertyStub;
@@ -19230,8 +19897,8 @@ void js_register_cocos2dx_EaseIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19245,7 +19912,7 @@ void js_register_cocos2dx_EaseIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseRateAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseRateAction_prototype),
jsb_cocos2d_EaseIn_class,
js_cocos2dx_EaseIn_constructor, 0, // constructor
properties,
@@ -19276,20 +19943,20 @@ JSObject *jsb_cocos2d_EaseOut_prototype;
bool js_cocos2dx_EaseOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseOut_create : Error processing arguments");
cocos2d::EaseOut* ret = cocos2d::EaseOut::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -19301,7 +19968,7 @@ bool js_cocos2dx_EaseOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseOut_create : wrong number of arguments");
@@ -19310,7 +19977,7 @@ bool js_cocos2dx_EaseOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseOut* cobj = new (std::nothrow) cocos2d::EaseOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19324,13 +19991,16 @@ bool js_cocos2dx_EaseOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19341,7 +20011,7 @@ void js_cocos2d_EaseOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseOut)", obj);
}
-void js_register_cocos2dx_EaseOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseOut_class->name = "EaseOut";
jsb_cocos2d_EaseOut_class->addProperty = JS_PropertyStub;
@@ -19355,8 +20025,8 @@ void js_register_cocos2dx_EaseOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19370,7 +20040,7 @@ void js_register_cocos2dx_EaseOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseRateAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseRateAction_prototype),
jsb_cocos2d_EaseOut_class,
js_cocos2dx_EaseOut_constructor, 0, // constructor
properties,
@@ -19401,20 +20071,20 @@ JSObject *jsb_cocos2d_EaseInOut_prototype;
bool js_cocos2dx_EaseInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseInOut_create : Error processing arguments");
cocos2d::EaseInOut* ret = cocos2d::EaseInOut::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -19426,7 +20096,7 @@ bool js_cocos2dx_EaseInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseInOut_create : wrong number of arguments");
@@ -19435,7 +20105,7 @@ bool js_cocos2dx_EaseInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseInOut* cobj = new (std::nothrow) cocos2d::EaseInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19449,13 +20119,16 @@ bool js_cocos2dx_EaseInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19466,7 +20139,7 @@ void js_cocos2d_EaseInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseInOut)", obj);
}
-void js_register_cocos2dx_EaseInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseInOut_class->name = "EaseInOut";
jsb_cocos2d_EaseInOut_class->addProperty = JS_PropertyStub;
@@ -19480,8 +20153,8 @@ void js_register_cocos2dx_EaseInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19495,7 +20168,7 @@ void js_register_cocos2dx_EaseInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseRateAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseRateAction_prototype),
jsb_cocos2d_EaseInOut_class,
js_cocos2dx_EaseInOut_constructor, 0, // constructor
properties,
@@ -19526,14 +20199,14 @@ JSObject *jsb_cocos2d_EaseExponentialIn_prototype;
bool js_cocos2dx_EaseExponentialIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -19549,7 +20222,7 @@ bool js_cocos2dx_EaseExponentialIn_create(JSContext *cx, uint32_t argc, jsval *v
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseExponentialIn_create : wrong number of arguments");
@@ -19558,7 +20231,7 @@ bool js_cocos2dx_EaseExponentialIn_create(JSContext *cx, uint32_t argc, jsval *v
bool js_cocos2dx_EaseExponentialIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseExponentialIn* cobj = new (std::nothrow) cocos2d::EaseExponentialIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19572,13 +20245,16 @@ bool js_cocos2dx_EaseExponentialIn_constructor(JSContext *cx, uint32_t argc, jsv
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19589,7 +20265,7 @@ void js_cocos2d_EaseExponentialIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialIn)", obj);
}
-void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseExponentialIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseExponentialIn_class->name = "EaseExponentialIn";
jsb_cocos2d_EaseExponentialIn_class->addProperty = JS_PropertyStub;
@@ -19603,8 +20279,8 @@ void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseExponentialIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19618,7 +20294,7 @@ void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseExponentialIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseExponentialIn_class,
js_cocos2dx_EaseExponentialIn_constructor, 0, // constructor
properties,
@@ -19649,14 +20325,14 @@ JSObject *jsb_cocos2d_EaseExponentialOut_prototype;
bool js_cocos2dx_EaseExponentialOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -19672,7 +20348,7 @@ bool js_cocos2dx_EaseExponentialOut_create(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseExponentialOut_create : wrong number of arguments");
@@ -19681,7 +20357,7 @@ bool js_cocos2dx_EaseExponentialOut_create(JSContext *cx, uint32_t argc, jsval *
bool js_cocos2dx_EaseExponentialOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseExponentialOut* cobj = new (std::nothrow) cocos2d::EaseExponentialOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19695,13 +20371,16 @@ bool js_cocos2dx_EaseExponentialOut_constructor(JSContext *cx, uint32_t argc, js
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19712,7 +20391,7 @@ void js_cocos2d_EaseExponentialOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialOut)", obj);
}
-void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseExponentialOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseExponentialOut_class->name = "EaseExponentialOut";
jsb_cocos2d_EaseExponentialOut_class->addProperty = JS_PropertyStub;
@@ -19726,8 +20405,8 @@ void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseExponentialOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19741,7 +20420,7 @@ void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseExponentialOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseExponentialOut_class,
js_cocos2dx_EaseExponentialOut_constructor, 0, // constructor
properties,
@@ -19772,14 +20451,14 @@ JSObject *jsb_cocos2d_EaseExponentialInOut_prototype;
bool js_cocos2dx_EaseExponentialInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -19795,7 +20474,7 @@ bool js_cocos2dx_EaseExponentialInOut_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseExponentialInOut_create : wrong number of arguments");
@@ -19804,7 +20483,7 @@ bool js_cocos2dx_EaseExponentialInOut_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseExponentialInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseExponentialInOut* cobj = new (std::nothrow) cocos2d::EaseExponentialInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19818,13 +20497,16 @@ bool js_cocos2dx_EaseExponentialInOut_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseExponentialInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19835,7 +20517,7 @@ void js_cocos2d_EaseExponentialInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseExponentialInOut)", obj);
}
-void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseExponentialInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseExponentialInOut_class->name = "EaseExponentialInOut";
jsb_cocos2d_EaseExponentialInOut_class->addProperty = JS_PropertyStub;
@@ -19849,8 +20531,8 @@ void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseExponentialInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19864,7 +20546,7 @@ void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseExponentialInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseExponentialInOut_class,
js_cocos2dx_EaseExponentialInOut_constructor, 0, // constructor
properties,
@@ -19895,14 +20577,14 @@ JSObject *jsb_cocos2d_EaseSineIn_prototype;
bool js_cocos2dx_EaseSineIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -19918,7 +20600,7 @@ bool js_cocos2dx_EaseSineIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseSineIn_create : wrong number of arguments");
@@ -19927,7 +20609,7 @@ bool js_cocos2dx_EaseSineIn_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseSineIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseSineIn* cobj = new (std::nothrow) cocos2d::EaseSineIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -19941,13 +20623,16 @@ bool js_cocos2dx_EaseSineIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -19958,7 +20643,7 @@ void js_cocos2d_EaseSineIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineIn)", obj);
}
-void js_register_cocos2dx_EaseSineIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseSineIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseSineIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseSineIn_class->name = "EaseSineIn";
jsb_cocos2d_EaseSineIn_class->addProperty = JS_PropertyStub;
@@ -19972,8 +20657,8 @@ void js_register_cocos2dx_EaseSineIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -19987,7 +20672,7 @@ void js_register_cocos2dx_EaseSineIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseSineIn_class,
js_cocos2dx_EaseSineIn_constructor, 0, // constructor
properties,
@@ -20018,14 +20703,14 @@ JSObject *jsb_cocos2d_EaseSineOut_prototype;
bool js_cocos2dx_EaseSineOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20041,7 +20726,7 @@ bool js_cocos2dx_EaseSineOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseSineOut_create : wrong number of arguments");
@@ -20050,7 +20735,7 @@ bool js_cocos2dx_EaseSineOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseSineOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseSineOut* cobj = new (std::nothrow) cocos2d::EaseSineOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20064,13 +20749,16 @@ bool js_cocos2dx_EaseSineOut_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -20081,7 +20769,7 @@ void js_cocos2d_EaseSineOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineOut)", obj);
}
-void js_register_cocos2dx_EaseSineOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseSineOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseSineOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseSineOut_class->name = "EaseSineOut";
jsb_cocos2d_EaseSineOut_class->addProperty = JS_PropertyStub;
@@ -20095,8 +20783,8 @@ void js_register_cocos2dx_EaseSineOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20110,7 +20798,7 @@ void js_register_cocos2dx_EaseSineOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseSineOut_class,
js_cocos2dx_EaseSineOut_constructor, 0, // constructor
properties,
@@ -20141,14 +20829,14 @@ JSObject *jsb_cocos2d_EaseSineInOut_prototype;
bool js_cocos2dx_EaseSineInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20164,7 +20852,7 @@ bool js_cocos2dx_EaseSineInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseSineInOut_create : wrong number of arguments");
@@ -20173,7 +20861,7 @@ bool js_cocos2dx_EaseSineInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseSineInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseSineInOut* cobj = new (std::nothrow) cocos2d::EaseSineInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20187,13 +20875,16 @@ bool js_cocos2dx_EaseSineInOut_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseSineInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -20204,7 +20895,7 @@ void js_cocos2d_EaseSineInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseSineInOut)", obj);
}
-void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseSineInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseSineInOut_class->name = "EaseSineInOut";
jsb_cocos2d_EaseSineInOut_class->addProperty = JS_PropertyStub;
@@ -20218,8 +20909,8 @@ void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20233,7 +20924,7 @@ void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseSineInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseSineInOut_class,
js_cocos2dx_EaseSineInOut_constructor, 0, // constructor
properties,
@@ -20264,18 +20955,18 @@ JSObject *jsb_cocos2d_EaseElastic_prototype;
bool js_cocos2dx_EaseElastic_setPeriod(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Error processing arguments");
cobj->setPeriod(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -20284,18 +20975,18 @@ bool js_cocos2dx_EaseElastic_setPeriod(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Invalid Native Object");
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20304,26 +20995,26 @@ bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval
bool ret = cobj->initWithAction(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 2) {
cocos2d::ActionInterval* arg0;
double arg1;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Error processing arguments");
bool ret = cobj->initWithAction(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -20332,7 +21023,8 @@ bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval
}
bool js_cocos2dx_EaseElastic_getPeriod(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_getPeriod : Invalid Native Object");
@@ -20340,7 +21032,7 @@ bool js_cocos2dx_EaseElastic_getPeriod(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getPeriod();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -20354,7 +21046,7 @@ void js_cocos2d_EaseElastic_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseElastic)", obj);
}
-void js_register_cocos2dx_EaseElastic(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseElastic(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseElastic_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseElastic_class->name = "EaseElastic";
jsb_cocos2d_EaseElastic_class->addProperty = JS_PropertyStub;
@@ -20368,8 +21060,8 @@ void js_register_cocos2dx_EaseElastic(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElastic_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20383,7 +21075,7 @@ void js_register_cocos2dx_EaseElastic(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElastic_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseElastic_class,
empty_constructor, 0,
properties,
@@ -20414,16 +21106,16 @@ JSObject *jsb_cocos2d_EaseElasticIn_prototype;
bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20439,7 +21131,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20448,16 +21140,16 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 2) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::EaseElasticIn* ret = cocos2d::EaseElasticIn::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -20469,7 +21161,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20478,7 +21170,7 @@ bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EaseElasticIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseElasticIn* cobj = new (std::nothrow) cocos2d::EaseElasticIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20492,13 +21184,16 @@ bool js_cocos2dx_EaseElasticIn_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -20509,7 +21204,7 @@ void js_cocos2d_EaseElasticIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticIn)", obj);
}
-void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseElasticIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseElasticIn_class->name = "EaseElasticIn";
jsb_cocos2d_EaseElasticIn_class->addProperty = JS_PropertyStub;
@@ -20523,8 +21218,8 @@ void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20538,7 +21233,7 @@ void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseElastic_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseElastic_prototype),
jsb_cocos2d_EaseElasticIn_class,
js_cocos2dx_EaseElasticIn_constructor, 0, // constructor
properties,
@@ -20569,16 +21264,16 @@ JSObject *jsb_cocos2d_EaseElasticOut_prototype;
bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20594,7 +21289,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20603,16 +21298,16 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
if (argc == 2) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::EaseElasticOut* ret = cocos2d::EaseElasticOut::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -20624,7 +21319,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20633,7 +21328,7 @@ bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_EaseElasticOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseElasticOut* cobj = new (std::nothrow) cocos2d::EaseElasticOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20647,13 +21342,16 @@ bool js_cocos2dx_EaseElasticOut_constructor(JSContext *cx, uint32_t argc, jsval
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -20664,7 +21362,7 @@ void js_cocos2d_EaseElasticOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticOut)", obj);
}
-void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseElasticOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseElasticOut_class->name = "EaseElasticOut";
jsb_cocos2d_EaseElasticOut_class->addProperty = JS_PropertyStub;
@@ -20678,8 +21376,8 @@ void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20693,7 +21391,7 @@ void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseElastic_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseElastic_prototype),
jsb_cocos2d_EaseElasticOut_class,
js_cocos2dx_EaseElasticOut_constructor, 0, // constructor
properties,
@@ -20724,16 +21422,16 @@ JSObject *jsb_cocos2d_EaseElasticInOut_prototype;
bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20749,7 +21447,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20758,16 +21456,16 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp
if (argc == 2) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
if (!ok) { ok = true; break; }
double arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
if (!ok) { ok = true; break; }
cocos2d::EaseElasticInOut* ret = cocos2d::EaseElasticInOut::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
@@ -20779,7 +21477,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
} while (0);
@@ -20788,7 +21486,7 @@ bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_EaseElasticInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseElasticInOut* cobj = new (std::nothrow) cocos2d::EaseElasticInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20802,13 +21500,16 @@ bool js_cocos2dx_EaseElasticInOut_constructor(JSContext *cx, uint32_t argc, jsva
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseElasticInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -20819,7 +21520,7 @@ void js_cocos2d_EaseElasticInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseElasticInOut)", obj);
}
-void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseElasticInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseElasticInOut_class->name = "EaseElasticInOut";
jsb_cocos2d_EaseElasticInOut_class->addProperty = JS_PropertyStub;
@@ -20833,8 +21534,8 @@ void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20848,7 +21549,7 @@ void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseElasticInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseElastic_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseElastic_prototype),
jsb_cocos2d_EaseElasticInOut_class,
js_cocos2dx_EaseElasticInOut_constructor, 0, // constructor
properties,
@@ -20884,7 +21585,7 @@ void js_cocos2d_EaseBounce_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounce)", obj);
}
-void js_register_cocos2dx_EaseBounce(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBounce(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBounce_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBounce_class->name = "EaseBounce";
jsb_cocos2d_EaseBounce_class->addProperty = JS_PropertyStub;
@@ -20898,8 +21599,8 @@ void js_register_cocos2dx_EaseBounce(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounce_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -20910,7 +21611,7 @@ void js_register_cocos2dx_EaseBounce(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounce_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseBounce_class,
empty_constructor, 0,
properties,
@@ -20941,14 +21642,14 @@ JSObject *jsb_cocos2d_EaseBounceIn_prototype;
bool js_cocos2dx_EaseBounceIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -20964,7 +21665,7 @@ bool js_cocos2dx_EaseBounceIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBounceIn_create : wrong number of arguments");
@@ -20973,7 +21674,7 @@ bool js_cocos2dx_EaseBounceIn_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBounceIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBounceIn* cobj = new (std::nothrow) cocos2d::EaseBounceIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -20987,13 +21688,16 @@ bool js_cocos2dx_EaseBounceIn_constructor(JSContext *cx, uint32_t argc, jsval *v
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21004,7 +21708,7 @@ void js_cocos2d_EaseBounceIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceIn)", obj);
}
-void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBounceIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBounceIn_class->name = "EaseBounceIn";
jsb_cocos2d_EaseBounceIn_class->addProperty = JS_PropertyStub;
@@ -21018,8 +21722,8 @@ void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21033,7 +21737,7 @@ void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseBounce_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseBounce_prototype),
jsb_cocos2d_EaseBounceIn_class,
js_cocos2dx_EaseBounceIn_constructor, 0, // constructor
properties,
@@ -21064,14 +21768,14 @@ JSObject *jsb_cocos2d_EaseBounceOut_prototype;
bool js_cocos2dx_EaseBounceOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21087,7 +21791,7 @@ bool js_cocos2dx_EaseBounceOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBounceOut_create : wrong number of arguments");
@@ -21096,7 +21800,7 @@ bool js_cocos2dx_EaseBounceOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBounceOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBounceOut* cobj = new (std::nothrow) cocos2d::EaseBounceOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21110,13 +21814,16 @@ bool js_cocos2dx_EaseBounceOut_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21127,7 +21834,7 @@ void js_cocos2d_EaseBounceOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceOut)", obj);
}
-void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBounceOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBounceOut_class->name = "EaseBounceOut";
jsb_cocos2d_EaseBounceOut_class->addProperty = JS_PropertyStub;
@@ -21141,8 +21848,8 @@ void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21156,7 +21863,7 @@ void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseBounce_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseBounce_prototype),
jsb_cocos2d_EaseBounceOut_class,
js_cocos2dx_EaseBounceOut_constructor, 0, // constructor
properties,
@@ -21187,14 +21894,14 @@ JSObject *jsb_cocos2d_EaseBounceInOut_prototype;
bool js_cocos2dx_EaseBounceInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21210,7 +21917,7 @@ bool js_cocos2dx_EaseBounceInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBounceInOut_create : wrong number of arguments");
@@ -21219,7 +21926,7 @@ bool js_cocos2dx_EaseBounceInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBounceInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBounceInOut* cobj = new (std::nothrow) cocos2d::EaseBounceInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21233,13 +21940,16 @@ bool js_cocos2dx_EaseBounceInOut_constructor(JSContext *cx, uint32_t argc, jsval
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBounceInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21250,7 +21960,7 @@ void js_cocos2d_EaseBounceInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBounceInOut)", obj);
}
-void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBounceInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBounceInOut_class->name = "EaseBounceInOut";
jsb_cocos2d_EaseBounceInOut_class->addProperty = JS_PropertyStub;
@@ -21264,8 +21974,8 @@ void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21279,7 +21989,7 @@ void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBounceInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_EaseBounce_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_EaseBounce_prototype),
jsb_cocos2d_EaseBounceInOut_class,
js_cocos2dx_EaseBounceInOut_constructor, 0, // constructor
properties,
@@ -21310,14 +22020,14 @@ JSObject *jsb_cocos2d_EaseBackIn_prototype;
bool js_cocos2dx_EaseBackIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21333,7 +22043,7 @@ bool js_cocos2dx_EaseBackIn_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBackIn_create : wrong number of arguments");
@@ -21342,7 +22052,7 @@ bool js_cocos2dx_EaseBackIn_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBackIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBackIn* cobj = new (std::nothrow) cocos2d::EaseBackIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21356,13 +22066,16 @@ bool js_cocos2dx_EaseBackIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21373,7 +22086,7 @@ void js_cocos2d_EaseBackIn_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackIn)", obj);
}
-void js_register_cocos2dx_EaseBackIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBackIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBackIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBackIn_class->name = "EaseBackIn";
jsb_cocos2d_EaseBackIn_class->addProperty = JS_PropertyStub;
@@ -21387,8 +22100,8 @@ void js_register_cocos2dx_EaseBackIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21402,7 +22115,7 @@ void js_register_cocos2dx_EaseBackIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseBackIn_class,
js_cocos2dx_EaseBackIn_constructor, 0, // constructor
properties,
@@ -21433,14 +22146,14 @@ JSObject *jsb_cocos2d_EaseBackOut_prototype;
bool js_cocos2dx_EaseBackOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21456,7 +22169,7 @@ bool js_cocos2dx_EaseBackOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBackOut_create : wrong number of arguments");
@@ -21465,7 +22178,7 @@ bool js_cocos2dx_EaseBackOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBackOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBackOut* cobj = new (std::nothrow) cocos2d::EaseBackOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21479,13 +22192,16 @@ bool js_cocos2dx_EaseBackOut_constructor(JSContext *cx, uint32_t argc, jsval *vp
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21496,7 +22212,7 @@ void js_cocos2d_EaseBackOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackOut)", obj);
}
-void js_register_cocos2dx_EaseBackOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBackOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBackOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBackOut_class->name = "EaseBackOut";
jsb_cocos2d_EaseBackOut_class->addProperty = JS_PropertyStub;
@@ -21510,8 +22226,8 @@ void js_register_cocos2dx_EaseBackOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21525,7 +22241,7 @@ void js_register_cocos2dx_EaseBackOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseBackOut_class,
js_cocos2dx_EaseBackOut_constructor, 0, // constructor
properties,
@@ -21556,14 +22272,14 @@ JSObject *jsb_cocos2d_EaseBackInOut_prototype;
bool js_cocos2dx_EaseBackInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21579,7 +22295,7 @@ bool js_cocos2dx_EaseBackInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBackInOut_create : wrong number of arguments");
@@ -21588,7 +22304,7 @@ bool js_cocos2dx_EaseBackInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_EaseBackInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBackInOut* cobj = new (std::nothrow) cocos2d::EaseBackInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21602,13 +22318,16 @@ bool js_cocos2dx_EaseBackInOut_constructor(JSContext *cx, uint32_t argc, jsval *
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBackInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21619,7 +22338,7 @@ void js_cocos2d_EaseBackInOut_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (EaseBackInOut)", obj);
}
-void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBackInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBackInOut_class->name = "EaseBackInOut";
jsb_cocos2d_EaseBackInOut_class->addProperty = JS_PropertyStub;
@@ -21633,8 +22352,8 @@ void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21648,7 +22367,7 @@ void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBackInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseBackInOut_class,
js_cocos2dx_EaseBackInOut_constructor, 0, // constructor
properties,
@@ -21679,9 +22398,9 @@ JSObject *jsb_cocos2d_EaseBezierAction_prototype;
bool js_cocos2dx_EaseBezierAction_setBezierParamer(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::EaseBezierAction* cobj = (cocos2d::EaseBezierAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseBezierAction_setBezierParamer : Invalid Native Object");
@@ -21690,13 +22409,13 @@ bool js_cocos2dx_EaseBezierAction_setBezierParamer(JSContext *cx, uint32_t argc,
double arg1;
double arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
+ ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBezierAction_setBezierParamer : Error processing arguments");
cobj->setBezierParamer(arg0, arg1, arg2, arg3);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -21705,14 +22424,14 @@ bool js_cocos2dx_EaseBezierAction_setBezierParamer(JSContext *cx, uint32_t argc,
}
bool js_cocos2dx_EaseBezierAction_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21728,7 +22447,7 @@ bool js_cocos2dx_EaseBezierAction_create(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseBezierAction_create : wrong number of arguments");
@@ -21737,7 +22456,7 @@ bool js_cocos2dx_EaseBezierAction_create(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_EaseBezierAction_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseBezierAction* cobj = new (std::nothrow) cocos2d::EaseBezierAction();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21751,13 +22470,16 @@ bool js_cocos2dx_EaseBezierAction_constructor(JSContext *cx, uint32_t argc, jsva
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBezierAction");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBezierAction");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21770,21 +22492,21 @@ void js_cocos2d_EaseBezierAction_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseBezierAction_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseBezierAction *nobj = new (std::nothrow) cocos2d::EaseBezierAction();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBezierAction");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseBezierAction");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseBezierAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseBezierAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseBezierAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseBezierAction_class->name = "EaseBezierAction";
jsb_cocos2d_EaseBezierAction_class->addProperty = JS_PropertyStub;
@@ -21798,8 +22520,8 @@ void js_register_cocos2dx_EaseBezierAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBezierAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21815,7 +22537,7 @@ void js_register_cocos2dx_EaseBezierAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseBezierAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseBezierAction_class,
js_cocos2dx_EaseBezierAction_constructor, 0, // constructor
properties,
@@ -21846,14 +22568,14 @@ JSObject *jsb_cocos2d_EaseQuadraticActionIn_prototype;
bool js_cocos2dx_EaseQuadraticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -21869,7 +22591,7 @@ bool js_cocos2dx_EaseQuadraticActionIn_create(JSContext *cx, uint32_t argc, jsva
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionIn_create : wrong number of arguments");
@@ -21878,7 +22600,7 @@ bool js_cocos2dx_EaseQuadraticActionIn_create(JSContext *cx, uint32_t argc, jsva
bool js_cocos2dx_EaseQuadraticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuadraticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -21892,13 +22614,16 @@ bool js_cocos2dx_EaseQuadraticActionIn_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -21911,21 +22636,21 @@ void js_cocos2d_EaseQuadraticActionIn_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuadraticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuadraticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionIn();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionIn");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuadraticActionIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuadraticActionIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuadraticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuadraticActionIn_class->name = "EaseQuadraticActionIn";
jsb_cocos2d_EaseQuadraticActionIn_class->addProperty = JS_PropertyStub;
@@ -21939,8 +22664,8 @@ void js_register_cocos2dx_EaseQuadraticActionIn(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuadraticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -21955,7 +22680,7 @@ void js_register_cocos2dx_EaseQuadraticActionIn(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuadraticActionIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuadraticActionIn_class,
js_cocos2dx_EaseQuadraticActionIn_constructor, 0, // constructor
properties,
@@ -21986,14 +22711,14 @@ JSObject *jsb_cocos2d_EaseQuadraticActionOut_prototype;
bool js_cocos2dx_EaseQuadraticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22009,7 +22734,7 @@ bool js_cocos2dx_EaseQuadraticActionOut_create(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionOut_create : wrong number of arguments");
@@ -22018,7 +22743,7 @@ bool js_cocos2dx_EaseQuadraticActionOut_create(JSContext *cx, uint32_t argc, jsv
bool js_cocos2dx_EaseQuadraticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuadraticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22032,13 +22757,16 @@ bool js_cocos2dx_EaseQuadraticActionOut_constructor(JSContext *cx, uint32_t argc
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22051,21 +22779,21 @@ void js_cocos2d_EaseQuadraticActionOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuadraticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuadraticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuadraticActionOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuadraticActionOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuadraticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuadraticActionOut_class->name = "EaseQuadraticActionOut";
jsb_cocos2d_EaseQuadraticActionOut_class->addProperty = JS_PropertyStub;
@@ -22079,8 +22807,8 @@ void js_register_cocos2dx_EaseQuadraticActionOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuadraticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22095,7 +22823,7 @@ void js_register_cocos2dx_EaseQuadraticActionOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuadraticActionOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuadraticActionOut_class,
js_cocos2dx_EaseQuadraticActionOut_constructor, 0, // constructor
properties,
@@ -22126,14 +22854,14 @@ JSObject *jsb_cocos2d_EaseQuadraticActionInOut_prototype;
bool js_cocos2dx_EaseQuadraticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22149,7 +22877,7 @@ bool js_cocos2dx_EaseQuadraticActionInOut_create(JSContext *cx, uint32_t argc, j
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionInOut_create : wrong number of arguments");
@@ -22158,7 +22886,7 @@ bool js_cocos2dx_EaseQuadraticActionInOut_create(JSContext *cx, uint32_t argc, j
bool js_cocos2dx_EaseQuadraticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuadraticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22172,13 +22900,16 @@ bool js_cocos2dx_EaseQuadraticActionInOut_constructor(JSContext *cx, uint32_t ar
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22191,21 +22922,21 @@ void js_cocos2d_EaseQuadraticActionInOut_finalize(JSFreeOp *fop, JSObject *obj)
static bool js_cocos2d_EaseQuadraticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuadraticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionInOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuadraticActionInOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuadraticActionInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuadraticActionInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuadraticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuadraticActionInOut_class->name = "EaseQuadraticActionInOut";
jsb_cocos2d_EaseQuadraticActionInOut_class->addProperty = JS_PropertyStub;
@@ -22219,8 +22950,8 @@ void js_register_cocos2dx_EaseQuadraticActionInOut(JSContext *cx, JSObject *glob
jsb_cocos2d_EaseQuadraticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22235,7 +22966,7 @@ void js_register_cocos2dx_EaseQuadraticActionInOut(JSContext *cx, JSObject *glob
jsb_cocos2d_EaseQuadraticActionInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuadraticActionInOut_class,
js_cocos2dx_EaseQuadraticActionInOut_constructor, 0, // constructor
properties,
@@ -22266,14 +22997,14 @@ JSObject *jsb_cocos2d_EaseQuarticActionIn_prototype;
bool js_cocos2dx_EaseQuarticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22289,7 +23020,7 @@ bool js_cocos2dx_EaseQuarticActionIn_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionIn_create : wrong number of arguments");
@@ -22298,7 +23029,7 @@ bool js_cocos2dx_EaseQuarticActionIn_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseQuarticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuarticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuarticActionIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22312,13 +23043,16 @@ bool js_cocos2dx_EaseQuarticActionIn_constructor(JSContext *cx, uint32_t argc, j
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22331,21 +23065,21 @@ void js_cocos2d_EaseQuarticActionIn_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuarticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuarticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuarticActionIn();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionIn");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuarticActionIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuarticActionIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuarticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuarticActionIn_class->name = "EaseQuarticActionIn";
jsb_cocos2d_EaseQuarticActionIn_class->addProperty = JS_PropertyStub;
@@ -22359,8 +23093,8 @@ void js_register_cocos2dx_EaseQuarticActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseQuarticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22375,7 +23109,7 @@ void js_register_cocos2dx_EaseQuarticActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseQuarticActionIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuarticActionIn_class,
js_cocos2dx_EaseQuarticActionIn_constructor, 0, // constructor
properties,
@@ -22406,14 +23140,14 @@ JSObject *jsb_cocos2d_EaseQuarticActionOut_prototype;
bool js_cocos2dx_EaseQuarticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22429,7 +23163,7 @@ bool js_cocos2dx_EaseQuarticActionOut_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionOut_create : wrong number of arguments");
@@ -22438,7 +23172,7 @@ bool js_cocos2dx_EaseQuarticActionOut_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseQuarticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuarticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuarticActionOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22452,13 +23186,16 @@ bool js_cocos2dx_EaseQuarticActionOut_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22471,21 +23208,21 @@ void js_cocos2d_EaseQuarticActionOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuarticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuarticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuarticActionOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuarticActionOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuarticActionOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuarticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuarticActionOut_class->name = "EaseQuarticActionOut";
jsb_cocos2d_EaseQuarticActionOut_class->addProperty = JS_PropertyStub;
@@ -22499,8 +23236,8 @@ void js_register_cocos2dx_EaseQuarticActionOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuarticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22515,7 +23252,7 @@ void js_register_cocos2dx_EaseQuarticActionOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuarticActionOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuarticActionOut_class,
js_cocos2dx_EaseQuarticActionOut_constructor, 0, // constructor
properties,
@@ -22546,14 +23283,14 @@ JSObject *jsb_cocos2d_EaseQuarticActionInOut_prototype;
bool js_cocos2dx_EaseQuarticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22569,7 +23306,7 @@ bool js_cocos2dx_EaseQuarticActionInOut_create(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionInOut_create : wrong number of arguments");
@@ -22578,7 +23315,7 @@ bool js_cocos2dx_EaseQuarticActionInOut_create(JSContext *cx, uint32_t argc, jsv
bool js_cocos2dx_EaseQuarticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuarticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuarticActionInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22592,13 +23329,16 @@ bool js_cocos2dx_EaseQuarticActionInOut_constructor(JSContext *cx, uint32_t argc
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22611,21 +23351,21 @@ void js_cocos2d_EaseQuarticActionInOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuarticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuarticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuarticActionInOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuarticActionInOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuarticActionInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuarticActionInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuarticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuarticActionInOut_class->name = "EaseQuarticActionInOut";
jsb_cocos2d_EaseQuarticActionInOut_class->addProperty = JS_PropertyStub;
@@ -22639,8 +23379,8 @@ void js_register_cocos2dx_EaseQuarticActionInOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuarticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22655,7 +23395,7 @@ void js_register_cocos2dx_EaseQuarticActionInOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuarticActionInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuarticActionInOut_class,
js_cocos2dx_EaseQuarticActionInOut_constructor, 0, // constructor
properties,
@@ -22686,14 +23426,14 @@ JSObject *jsb_cocos2d_EaseQuinticActionIn_prototype;
bool js_cocos2dx_EaseQuinticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22709,7 +23449,7 @@ bool js_cocos2dx_EaseQuinticActionIn_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionIn_create : wrong number of arguments");
@@ -22718,7 +23458,7 @@ bool js_cocos2dx_EaseQuinticActionIn_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseQuinticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuinticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuinticActionIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22732,13 +23472,16 @@ bool js_cocos2dx_EaseQuinticActionIn_constructor(JSContext *cx, uint32_t argc, j
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22751,21 +23494,21 @@ void js_cocos2d_EaseQuinticActionIn_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuinticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuinticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuinticActionIn();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionIn");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuinticActionIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuinticActionIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuinticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuinticActionIn_class->name = "EaseQuinticActionIn";
jsb_cocos2d_EaseQuinticActionIn_class->addProperty = JS_PropertyStub;
@@ -22779,8 +23522,8 @@ void js_register_cocos2dx_EaseQuinticActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseQuinticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22795,7 +23538,7 @@ void js_register_cocos2dx_EaseQuinticActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseQuinticActionIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuinticActionIn_class,
js_cocos2dx_EaseQuinticActionIn_constructor, 0, // constructor
properties,
@@ -22826,14 +23569,14 @@ JSObject *jsb_cocos2d_EaseQuinticActionOut_prototype;
bool js_cocos2dx_EaseQuinticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22849,7 +23592,7 @@ bool js_cocos2dx_EaseQuinticActionOut_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionOut_create : wrong number of arguments");
@@ -22858,7 +23601,7 @@ bool js_cocos2dx_EaseQuinticActionOut_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseQuinticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuinticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuinticActionOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -22872,13 +23615,16 @@ bool js_cocos2dx_EaseQuinticActionOut_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -22891,21 +23637,21 @@ void js_cocos2d_EaseQuinticActionOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuinticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuinticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuinticActionOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuinticActionOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuinticActionOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuinticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuinticActionOut_class->name = "EaseQuinticActionOut";
jsb_cocos2d_EaseQuinticActionOut_class->addProperty = JS_PropertyStub;
@@ -22919,8 +23665,8 @@ void js_register_cocos2dx_EaseQuinticActionOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuinticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -22935,7 +23681,7 @@ void js_register_cocos2dx_EaseQuinticActionOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseQuinticActionOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuinticActionOut_class,
js_cocos2dx_EaseQuinticActionOut_constructor, 0, // constructor
properties,
@@ -22966,14 +23712,14 @@ JSObject *jsb_cocos2d_EaseQuinticActionInOut_prototype;
bool js_cocos2dx_EaseQuinticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -22989,7 +23735,7 @@ bool js_cocos2dx_EaseQuinticActionInOut_create(JSContext *cx, uint32_t argc, jsv
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionInOut_create : wrong number of arguments");
@@ -22998,7 +23744,7 @@ bool js_cocos2dx_EaseQuinticActionInOut_create(JSContext *cx, uint32_t argc, jsv
bool js_cocos2dx_EaseQuinticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseQuinticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuinticActionInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23012,13 +23758,16 @@ bool js_cocos2dx_EaseQuinticActionInOut_constructor(JSContext *cx, uint32_t argc
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23031,21 +23780,21 @@ void js_cocos2d_EaseQuinticActionInOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseQuinticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseQuinticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuinticActionInOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseQuinticActionInOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseQuinticActionInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseQuinticActionInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseQuinticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseQuinticActionInOut_class->name = "EaseQuinticActionInOut";
jsb_cocos2d_EaseQuinticActionInOut_class->addProperty = JS_PropertyStub;
@@ -23059,8 +23808,8 @@ void js_register_cocos2dx_EaseQuinticActionInOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuinticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23075,7 +23824,7 @@ void js_register_cocos2dx_EaseQuinticActionInOut(JSContext *cx, JSObject *global
jsb_cocos2d_EaseQuinticActionInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseQuinticActionInOut_class,
js_cocos2dx_EaseQuinticActionInOut_constructor, 0, // constructor
properties,
@@ -23106,14 +23855,14 @@ JSObject *jsb_cocos2d_EaseCircleActionIn_prototype;
bool js_cocos2dx_EaseCircleActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23129,7 +23878,7 @@ bool js_cocos2dx_EaseCircleActionIn_create(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionIn_create : wrong number of arguments");
@@ -23138,7 +23887,7 @@ bool js_cocos2dx_EaseCircleActionIn_create(JSContext *cx, uint32_t argc, jsval *
bool js_cocos2dx_EaseCircleActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCircleActionIn* cobj = new (std::nothrow) cocos2d::EaseCircleActionIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23152,13 +23901,16 @@ bool js_cocos2dx_EaseCircleActionIn_constructor(JSContext *cx, uint32_t argc, js
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23171,21 +23923,21 @@ void js_cocos2d_EaseCircleActionIn_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCircleActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCircleActionIn *nobj = new (std::nothrow) cocos2d::EaseCircleActionIn();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionIn");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCircleActionIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCircleActionIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCircleActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCircleActionIn_class->name = "EaseCircleActionIn";
jsb_cocos2d_EaseCircleActionIn_class->addProperty = JS_PropertyStub;
@@ -23199,8 +23951,8 @@ void js_register_cocos2dx_EaseCircleActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCircleActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23215,7 +23967,7 @@ void js_register_cocos2dx_EaseCircleActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCircleActionIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCircleActionIn_class,
js_cocos2dx_EaseCircleActionIn_constructor, 0, // constructor
properties,
@@ -23246,14 +23998,14 @@ JSObject *jsb_cocos2d_EaseCircleActionOut_prototype;
bool js_cocos2dx_EaseCircleActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23269,7 +24021,7 @@ bool js_cocos2dx_EaseCircleActionOut_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionOut_create : wrong number of arguments");
@@ -23278,7 +24030,7 @@ bool js_cocos2dx_EaseCircleActionOut_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseCircleActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCircleActionOut* cobj = new (std::nothrow) cocos2d::EaseCircleActionOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23292,13 +24044,16 @@ bool js_cocos2dx_EaseCircleActionOut_constructor(JSContext *cx, uint32_t argc, j
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23311,21 +24066,21 @@ void js_cocos2d_EaseCircleActionOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCircleActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCircleActionOut *nobj = new (std::nothrow) cocos2d::EaseCircleActionOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCircleActionOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCircleActionOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCircleActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCircleActionOut_class->name = "EaseCircleActionOut";
jsb_cocos2d_EaseCircleActionOut_class->addProperty = JS_PropertyStub;
@@ -23339,8 +24094,8 @@ void js_register_cocos2dx_EaseCircleActionOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCircleActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23355,7 +24110,7 @@ void js_register_cocos2dx_EaseCircleActionOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCircleActionOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCircleActionOut_class,
js_cocos2dx_EaseCircleActionOut_constructor, 0, // constructor
properties,
@@ -23386,14 +24141,14 @@ JSObject *jsb_cocos2d_EaseCircleActionInOut_prototype;
bool js_cocos2dx_EaseCircleActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23409,7 +24164,7 @@ bool js_cocos2dx_EaseCircleActionInOut_create(JSContext *cx, uint32_t argc, jsva
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionInOut_create : wrong number of arguments");
@@ -23418,7 +24173,7 @@ bool js_cocos2dx_EaseCircleActionInOut_create(JSContext *cx, uint32_t argc, jsva
bool js_cocos2dx_EaseCircleActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCircleActionInOut* cobj = new (std::nothrow) cocos2d::EaseCircleActionInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23432,13 +24187,16 @@ bool js_cocos2dx_EaseCircleActionInOut_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23451,21 +24209,21 @@ void js_cocos2d_EaseCircleActionInOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCircleActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCircleActionInOut *nobj = new (std::nothrow) cocos2d::EaseCircleActionInOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCircleActionInOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCircleActionInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCircleActionInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCircleActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCircleActionInOut_class->name = "EaseCircleActionInOut";
jsb_cocos2d_EaseCircleActionInOut_class->addProperty = JS_PropertyStub;
@@ -23479,8 +24237,8 @@ void js_register_cocos2dx_EaseCircleActionInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseCircleActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23495,7 +24253,7 @@ void js_register_cocos2dx_EaseCircleActionInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseCircleActionInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCircleActionInOut_class,
js_cocos2dx_EaseCircleActionInOut_constructor, 0, // constructor
properties,
@@ -23526,14 +24284,14 @@ JSObject *jsb_cocos2d_EaseCubicActionIn_prototype;
bool js_cocos2dx_EaseCubicActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23549,7 +24307,7 @@ bool js_cocos2dx_EaseCubicActionIn_create(JSContext *cx, uint32_t argc, jsval *v
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionIn_create : wrong number of arguments");
@@ -23558,7 +24316,7 @@ bool js_cocos2dx_EaseCubicActionIn_create(JSContext *cx, uint32_t argc, jsval *v
bool js_cocos2dx_EaseCubicActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCubicActionIn* cobj = new (std::nothrow) cocos2d::EaseCubicActionIn();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23572,13 +24330,16 @@ bool js_cocos2dx_EaseCubicActionIn_constructor(JSContext *cx, uint32_t argc, jsv
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionIn");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23591,21 +24352,21 @@ void js_cocos2d_EaseCubicActionIn_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCubicActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCubicActionIn *nobj = new (std::nothrow) cocos2d::EaseCubicActionIn();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionIn");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionIn");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCubicActionIn(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCubicActionIn(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCubicActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCubicActionIn_class->name = "EaseCubicActionIn";
jsb_cocos2d_EaseCubicActionIn_class->addProperty = JS_PropertyStub;
@@ -23619,8 +24380,8 @@ void js_register_cocos2dx_EaseCubicActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCubicActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23635,7 +24396,7 @@ void js_register_cocos2dx_EaseCubicActionIn(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCubicActionIn_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCubicActionIn_class,
js_cocos2dx_EaseCubicActionIn_constructor, 0, // constructor
properties,
@@ -23666,14 +24427,14 @@ JSObject *jsb_cocos2d_EaseCubicActionOut_prototype;
bool js_cocos2dx_EaseCubicActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23689,7 +24450,7 @@ bool js_cocos2dx_EaseCubicActionOut_create(JSContext *cx, uint32_t argc, jsval *
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionOut_create : wrong number of arguments");
@@ -23698,7 +24459,7 @@ bool js_cocos2dx_EaseCubicActionOut_create(JSContext *cx, uint32_t argc, jsval *
bool js_cocos2dx_EaseCubicActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCubicActionOut* cobj = new (std::nothrow) cocos2d::EaseCubicActionOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23712,13 +24473,16 @@ bool js_cocos2dx_EaseCubicActionOut_constructor(JSContext *cx, uint32_t argc, js
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23731,21 +24495,21 @@ void js_cocos2d_EaseCubicActionOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCubicActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCubicActionOut *nobj = new (std::nothrow) cocos2d::EaseCubicActionOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCubicActionOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCubicActionOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCubicActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCubicActionOut_class->name = "EaseCubicActionOut";
jsb_cocos2d_EaseCubicActionOut_class->addProperty = JS_PropertyStub;
@@ -23759,8 +24523,8 @@ void js_register_cocos2dx_EaseCubicActionOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCubicActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23775,7 +24539,7 @@ void js_register_cocos2dx_EaseCubicActionOut(JSContext *cx, JSObject *global) {
jsb_cocos2d_EaseCubicActionOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCubicActionOut_class,
js_cocos2dx_EaseCubicActionOut_constructor, 0, // constructor
properties,
@@ -23806,14 +24570,14 @@ JSObject *jsb_cocos2d_EaseCubicActionInOut_prototype;
bool js_cocos2dx_EaseCubicActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::ActionInterval* arg0;
do {
- if (!argv[0].isObject()) { ok = false; break; }
+ if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
- JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
+ JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
@@ -23829,7 +24593,7 @@ bool js_cocos2dx_EaseCubicActionInOut_create(JSContext *cx, uint32_t argc, jsval
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionInOut_create : wrong number of arguments");
@@ -23838,7 +24602,7 @@ bool js_cocos2dx_EaseCubicActionInOut_create(JSContext *cx, uint32_t argc, jsval
bool js_cocos2dx_EaseCubicActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::EaseCubicActionInOut* cobj = new (std::nothrow) cocos2d::EaseCubicActionInOut();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -23852,13 +24616,16 @@ bool js_cocos2dx_EaseCubicActionInOut_constructor(JSContext *cx, uint32_t argc,
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionInOut");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -23871,21 +24638,21 @@ void js_cocos2d_EaseCubicActionInOut_finalize(JSFreeOp *fop, JSObject *obj) {
static bool js_cocos2d_EaseCubicActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
cocos2d::EaseCubicActionInOut *nobj = new (std::nothrow) cocos2d::EaseCubicActionInOut();
if (nobj) {
nobj->autorelease();
}
js_proxy_t* p = jsb_new_proxy(nobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionInOut");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::EaseCubicActionInOut");
bool isFound = false;
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
+ args.rval().setUndefined();
return true;
}
-void js_register_cocos2dx_EaseCubicActionInOut(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_EaseCubicActionInOut(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_EaseCubicActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_EaseCubicActionInOut_class->name = "EaseCubicActionInOut";
jsb_cocos2d_EaseCubicActionInOut_class->addProperty = JS_PropertyStub;
@@ -23899,8 +24666,8 @@ void js_register_cocos2dx_EaseCubicActionInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseCubicActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23915,7 +24682,7 @@ void js_register_cocos2dx_EaseCubicActionInOut(JSContext *cx, JSObject *global)
jsb_cocos2d_EaseCubicActionInOut_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionEase_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionEase_prototype),
jsb_cocos2d_EaseCubicActionInOut_class,
js_cocos2dx_EaseCubicActionInOut_constructor, 0, // constructor
properties,
@@ -23951,7 +24718,7 @@ void js_cocos2d_ActionInstant_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ActionInstant)", obj);
}
-void js_register_cocos2dx_ActionInstant(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ActionInstant(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ActionInstant_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ActionInstant_class->name = "ActionInstant";
jsb_cocos2d_ActionInstant_class->addProperty = JS_PropertyStub;
@@ -23965,8 +24732,8 @@ void js_register_cocos2dx_ActionInstant(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionInstant_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -23977,7 +24744,7 @@ void js_register_cocos2dx_ActionInstant(JSContext *cx, JSObject *global) {
jsb_cocos2d_ActionInstant_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_FiniteTimeAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_FiniteTimeAction_prototype),
jsb_cocos2d_ActionInstant_class,
empty_constructor, 0,
properties,
@@ -24008,6 +24775,7 @@ JSObject *jsb_cocos2d_Show_prototype;
bool js_cocos2dx_Show_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Show* ret = cocos2d::Show::create();
jsval jsret = JSVAL_NULL;
@@ -24019,7 +24787,7 @@ bool js_cocos2dx_Show_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Show_create : wrong number of arguments");
@@ -24028,7 +24796,7 @@ bool js_cocos2dx_Show_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Show_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Show* cobj = new (std::nothrow) cocos2d::Show();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24042,13 +24810,16 @@ bool js_cocos2dx_Show_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Show");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Show");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24059,7 +24830,7 @@ void js_cocos2d_Show_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Show)", obj);
}
-void js_register_cocos2dx_Show(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Show(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Show_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Show_class->name = "Show";
jsb_cocos2d_Show_class->addProperty = JS_PropertyStub;
@@ -24073,8 +24844,8 @@ void js_register_cocos2dx_Show(JSContext *cx, JSObject *global) {
jsb_cocos2d_Show_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24088,7 +24859,7 @@ void js_register_cocos2dx_Show(JSContext *cx, JSObject *global) {
jsb_cocos2d_Show_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_Show_class,
js_cocos2dx_Show_constructor, 0, // constructor
properties,
@@ -24119,6 +24890,7 @@ JSObject *jsb_cocos2d_Hide_prototype;
bool js_cocos2dx_Hide_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::Hide* ret = cocos2d::Hide::create();
jsval jsret = JSVAL_NULL;
@@ -24130,7 +24902,7 @@ bool js_cocos2dx_Hide_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Hide_create : wrong number of arguments");
@@ -24139,7 +24911,7 @@ bool js_cocos2dx_Hide_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Hide_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Hide* cobj = new (std::nothrow) cocos2d::Hide();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24153,13 +24925,16 @@ bool js_cocos2dx_Hide_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Hide");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Hide");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24170,7 +24945,7 @@ void js_cocos2d_Hide_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Hide)", obj);
}
-void js_register_cocos2dx_Hide(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Hide(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Hide_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Hide_class->name = "Hide";
jsb_cocos2d_Hide_class->addProperty = JS_PropertyStub;
@@ -24184,8 +24959,8 @@ void js_register_cocos2dx_Hide(JSContext *cx, JSObject *global) {
jsb_cocos2d_Hide_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24199,7 +24974,7 @@ void js_register_cocos2dx_Hide(JSContext *cx, JSObject *global) {
jsb_cocos2d_Hide_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_Hide_class,
js_cocos2dx_Hide_constructor, 0, // constructor
properties,
@@ -24230,6 +25005,7 @@ JSObject *jsb_cocos2d_ToggleVisibility_prototype;
bool js_cocos2dx_ToggleVisibility_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::ToggleVisibility* ret = cocos2d::ToggleVisibility::create();
jsval jsret = JSVAL_NULL;
@@ -24241,7 +25017,7 @@ bool js_cocos2dx_ToggleVisibility_create(JSContext *cx, uint32_t argc, jsval *vp
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ToggleVisibility_create : wrong number of arguments");
@@ -24250,7 +25026,7 @@ bool js_cocos2dx_ToggleVisibility_create(JSContext *cx, uint32_t argc, jsval *vp
bool js_cocos2dx_ToggleVisibility_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ToggleVisibility* cobj = new (std::nothrow) cocos2d::ToggleVisibility();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24264,13 +25040,16 @@ bool js_cocos2dx_ToggleVisibility_constructor(JSContext *cx, uint32_t argc, jsva
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ToggleVisibility");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ToggleVisibility");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24281,7 +25060,7 @@ void js_cocos2d_ToggleVisibility_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ToggleVisibility)", obj);
}
-void js_register_cocos2dx_ToggleVisibility(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ToggleVisibility(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ToggleVisibility_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ToggleVisibility_class->name = "ToggleVisibility";
jsb_cocos2d_ToggleVisibility_class->addProperty = JS_PropertyStub;
@@ -24295,8 +25074,8 @@ void js_register_cocos2dx_ToggleVisibility(JSContext *cx, JSObject *global) {
jsb_cocos2d_ToggleVisibility_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24310,7 +25089,7 @@ void js_register_cocos2dx_ToggleVisibility(JSContext *cx, JSObject *global) {
jsb_cocos2d_ToggleVisibility_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_ToggleVisibility_class,
js_cocos2dx_ToggleVisibility_constructor, 0, // constructor
properties,
@@ -24341,20 +25120,20 @@ JSObject *jsb_cocos2d_RemoveSelf_prototype;
bool js_cocos2dx_RemoveSelf_init(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::RemoveSelf* cobj = (cocos2d::RemoveSelf *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RemoveSelf_init : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RemoveSelf_init : Error processing arguments");
bool ret = cobj->init(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -24363,7 +25142,7 @@ bool js_cocos2dx_RemoveSelf_init(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_RemoveSelf_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 0) {
cocos2d::RemoveSelf* ret = cocos2d::RemoveSelf::create();
@@ -24376,12 +25155,12 @@ bool js_cocos2dx_RemoveSelf_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RemoveSelf_create : Error processing arguments");
cocos2d::RemoveSelf* ret = cocos2d::RemoveSelf::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -24393,7 +25172,7 @@ bool js_cocos2dx_RemoveSelf_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_RemoveSelf_create : wrong number of arguments");
@@ -24402,7 +25181,7 @@ bool js_cocos2dx_RemoveSelf_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_RemoveSelf_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::RemoveSelf* cobj = new (std::nothrow) cocos2d::RemoveSelf();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24416,13 +25195,16 @@ bool js_cocos2dx_RemoveSelf_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::RemoveSelf");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::RemoveSelf");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24433,7 +25215,7 @@ void js_cocos2d_RemoveSelf_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (RemoveSelf)", obj);
}
-void js_register_cocos2dx_RemoveSelf(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_RemoveSelf(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_RemoveSelf_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_RemoveSelf_class->name = "RemoveSelf";
jsb_cocos2d_RemoveSelf_class->addProperty = JS_PropertyStub;
@@ -24447,8 +25229,8 @@ void js_register_cocos2dx_RemoveSelf(JSContext *cx, JSObject *global) {
jsb_cocos2d_RemoveSelf_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24463,7 +25245,7 @@ void js_register_cocos2dx_RemoveSelf(JSContext *cx, JSObject *global) {
jsb_cocos2d_RemoveSelf_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_RemoveSelf_class,
js_cocos2dx_RemoveSelf_constructor, 0, // constructor
properties,
@@ -24494,20 +25276,20 @@ JSObject *jsb_cocos2d_FlipX_prototype;
bool js_cocos2dx_FlipX_initWithFlipX(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FlipX* cobj = (cocos2d::FlipX *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX_initWithFlipX : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX_initWithFlipX : Error processing arguments");
bool ret = cobj->initWithFlipX(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -24516,11 +25298,11 @@ bool js_cocos2dx_FlipX_initWithFlipX(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX_create : Error processing arguments");
cocos2d::FlipX* ret = cocos2d::FlipX::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -24532,7 +25314,7 @@ bool js_cocos2dx_FlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FlipX_create : wrong number of arguments");
@@ -24541,7 +25323,7 @@ bool js_cocos2dx_FlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FlipX* cobj = new (std::nothrow) cocos2d::FlipX();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24555,13 +25337,16 @@ bool js_cocos2dx_FlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24572,7 +25357,7 @@ void js_cocos2d_FlipX_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FlipX)", obj);
}
-void js_register_cocos2dx_FlipX(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FlipX(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FlipX_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FlipX_class->name = "FlipX";
jsb_cocos2d_FlipX_class->addProperty = JS_PropertyStub;
@@ -24586,8 +25371,8 @@ void js_register_cocos2dx_FlipX(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipX_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24602,7 +25387,7 @@ void js_register_cocos2dx_FlipX(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipX_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_FlipX_class,
js_cocos2dx_FlipX_constructor, 0, // constructor
properties,
@@ -24633,20 +25418,20 @@ JSObject *jsb_cocos2d_FlipY_prototype;
bool js_cocos2dx_FlipY_initWithFlipY(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FlipY* cobj = (cocos2d::FlipY *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipY_initWithFlipY : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY_initWithFlipY : Error processing arguments");
bool ret = cobj->initWithFlipY(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -24655,11 +25440,11 @@ bool js_cocos2dx_FlipY_initWithFlipY(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY_create : Error processing arguments");
cocos2d::FlipY* ret = cocos2d::FlipY::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -24671,7 +25456,7 @@ bool js_cocos2dx_FlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FlipY_create : wrong number of arguments");
@@ -24680,7 +25465,7 @@ bool js_cocos2dx_FlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FlipY* cobj = new (std::nothrow) cocos2d::FlipY();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24694,13 +25479,16 @@ bool js_cocos2dx_FlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24711,7 +25499,7 @@ void js_cocos2d_FlipY_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FlipY)", obj);
}
-void js_register_cocos2dx_FlipY(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FlipY(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FlipY_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FlipY_class->name = "FlipY";
jsb_cocos2d_FlipY_class->addProperty = JS_PropertyStub;
@@ -24725,8 +25513,8 @@ void js_register_cocos2dx_FlipY(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipY_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24741,7 +25529,7 @@ void js_register_cocos2dx_FlipY(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipY_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_FlipY_class,
js_cocos2dx_FlipY_constructor, 0, // constructor
properties,
@@ -24772,20 +25560,20 @@ JSObject *jsb_cocos2d_Place_prototype;
bool js_cocos2dx_Place_initWithPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Place* cobj = (cocos2d::Place *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Place_initWithPosition : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Place_initWithPosition : Error processing arguments");
bool ret = cobj->initWithPosition(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -24794,11 +25582,11 @@ bool js_cocos2dx_Place_initWithPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Place_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Place_create : Error processing arguments");
cocos2d::Place* ret = cocos2d::Place::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -24810,7 +25598,7 @@ bool js_cocos2dx_Place_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Place_create : wrong number of arguments");
@@ -24819,7 +25607,7 @@ bool js_cocos2dx_Place_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Place_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Place* cobj = new (std::nothrow) cocos2d::Place();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24833,13 +25621,16 @@ bool js_cocos2dx_Place_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Place");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Place");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24850,7 +25641,7 @@ void js_cocos2d_Place_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Place)", obj);
}
-void js_register_cocos2dx_Place(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Place(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Place_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Place_class->name = "Place";
jsb_cocos2d_Place_class->addProperty = JS_PropertyStub;
@@ -24864,8 +25655,8 @@ void js_register_cocos2dx_Place(JSContext *cx, JSObject *global) {
jsb_cocos2d_Place_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24880,7 +25671,7 @@ void js_register_cocos2dx_Place(JSContext *cx, JSObject *global) {
jsb_cocos2d_Place_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_Place_class,
js_cocos2dx_Place_constructor, 0, // constructor
properties,
@@ -24911,13 +25702,14 @@ JSObject *jsb_cocos2d_CallFunc_prototype;
bool js_cocos2dx_CallFunc_execute(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::CallFunc* cobj = (cocos2d::CallFunc *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CallFunc_execute : Invalid Native Object");
if (argc == 0) {
cobj->execute();
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -24926,7 +25718,7 @@ bool js_cocos2dx_CallFunc_execute(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_CallFunc_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::CallFunc* cobj = new (std::nothrow) cocos2d::CallFunc();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -24940,13 +25732,16 @@ bool js_cocos2dx_CallFunc_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFunc");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFunc");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -24957,7 +25752,7 @@ void js_cocos2d_CallFunc_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (CallFunc)", obj);
}
-void js_register_cocos2dx_CallFunc(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_CallFunc(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_CallFunc_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_CallFunc_class->name = "_CallFunc";
jsb_cocos2d_CallFunc_class->addProperty = JS_PropertyStub;
@@ -24971,8 +25766,8 @@ void js_register_cocos2dx_CallFunc(JSContext *cx, JSObject *global) {
jsb_cocos2d_CallFunc_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -24984,7 +25779,7 @@ void js_register_cocos2dx_CallFunc(JSContext *cx, JSObject *global) {
jsb_cocos2d_CallFunc_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_CallFunc_class,
js_cocos2dx_CallFunc_constructor, 0, // constructor
properties,
@@ -25015,7 +25810,7 @@ JSObject *jsb_cocos2d_CallFuncN_prototype;
bool js_cocos2dx_CallFuncN_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::CallFuncN* cobj = new (std::nothrow) cocos2d::CallFuncN();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -25029,13 +25824,16 @@ bool js_cocos2dx_CallFuncN_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFuncN");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::CallFuncN");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -25046,7 +25844,7 @@ void js_cocos2d_CallFuncN_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (CallFuncN)", obj);
}
-void js_register_cocos2dx_CallFuncN(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_CallFuncN(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_CallFuncN_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_CallFuncN_class->name = "CallFunc";
jsb_cocos2d_CallFuncN_class->addProperty = JS_PropertyStub;
@@ -25060,8 +25858,8 @@ void js_register_cocos2dx_CallFuncN(JSContext *cx, JSObject *global) {
jsb_cocos2d_CallFuncN_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -25072,7 +25870,7 @@ void js_register_cocos2dx_CallFuncN(JSContext *cx, JSObject *global) {
jsb_cocos2d_CallFuncN_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_CallFunc_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_CallFunc_prototype),
jsb_cocos2d_CallFuncN_class,
js_cocos2dx_CallFuncN_constructor, 0, // constructor
properties,
@@ -25103,7 +25901,8 @@ JSObject *jsb_cocos2d_GridAction_prototype;
bool js_cocos2dx_GridAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::GridAction* cobj = (cocos2d::GridAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridAction_getGrid : Invalid Native Object");
@@ -25118,7 +25917,7 @@ bool js_cocos2dx_GridAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25127,22 +25926,22 @@ bool js_cocos2dx_GridAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_GridAction_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::GridAction* cobj = (cocos2d::GridAction *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridAction_initWithDuration : Invalid Native Object");
if (argc == 2) {
double arg0;
cocos2d::Size arg1;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridAction_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25156,7 +25955,7 @@ void js_cocos2d_GridAction_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (GridAction)", obj);
}
-void js_register_cocos2dx_GridAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_GridAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_GridAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_GridAction_class->name = "GridAction";
jsb_cocos2d_GridAction_class->addProperty = JS_PropertyStub;
@@ -25170,8 +25969,8 @@ void js_register_cocos2dx_GridAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_GridAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -25184,7 +25983,7 @@ void js_register_cocos2dx_GridAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_GridAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInterval_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInterval_prototype),
jsb_cocos2d_GridAction_class,
empty_constructor, 0,
properties,
@@ -25213,30 +26012,6 @@ void js_register_cocos2dx_GridAction(JSContext *cx, JSObject *global) {
JSClass *jsb_cocos2d_Grid3DAction_class;
JSObject *jsb_cocos2d_Grid3DAction_prototype;
-bool js_cocos2dx_Grid3DAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
-{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
- js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::Grid3DAction* cobj = (cocos2d::Grid3DAction *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Grid3DAction_getGrid : Invalid Native Object");
- if (argc == 0) {
- cocos2d::GridBase* ret = cobj->getGrid();
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::GridBase*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
- }
- } while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
-
- JS_ReportError(cx, "js_cocos2dx_Grid3DAction_getGrid : wrong number of arguments: %d, was expecting %d", argc, 0);
- return false;
-}
extern JSObject *jsb_cocos2d_GridAction_prototype;
@@ -25244,7 +26019,7 @@ void js_cocos2d_Grid3DAction_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Grid3DAction)", obj);
}
-void js_register_cocos2dx_Grid3DAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Grid3DAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Grid3DAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Grid3DAction_class->name = "Grid3DAction";
jsb_cocos2d_Grid3DAction_class->addProperty = JS_PropertyStub;
@@ -25258,12 +26033,11 @@ void js_register_cocos2dx_Grid3DAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_Grid3DAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
- JS_FN("getGrid", js_cocos2dx_Grid3DAction_getGrid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@@ -25271,7 +26045,7 @@ void js_register_cocos2dx_Grid3DAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_Grid3DAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_GridAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_GridAction_prototype),
jsb_cocos2d_Grid3DAction_class,
empty_constructor, 0,
properties,
@@ -25300,30 +26074,6 @@ void js_register_cocos2dx_Grid3DAction(JSContext *cx, JSObject *global) {
JSClass *jsb_cocos2d_TiledGrid3DAction_class;
JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
-bool js_cocos2dx_TiledGrid3DAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
-{
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
- js_proxy_t *proxy = jsb_get_js_proxy(obj);
- cocos2d::TiledGrid3DAction* cobj = (cocos2d::TiledGrid3DAction *)(proxy ? proxy->ptr : NULL);
- JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TiledGrid3DAction_getGrid : Invalid Native Object");
- if (argc == 0) {
- cocos2d::GridBase* ret = cobj->getGrid();
- jsval jsret = JSVAL_NULL;
- do {
- if (ret) {
- js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::GridBase*)ret);
- jsret = OBJECT_TO_JSVAL(jsProxy->obj);
- } else {
- jsret = JSVAL_NULL;
- }
- } while (0);
- JS_SET_RVAL(cx, vp, jsret);
- return true;
- }
-
- JS_ReportError(cx, "js_cocos2dx_TiledGrid3DAction_getGrid : wrong number of arguments: %d, was expecting %d", argc, 0);
- return false;
-}
extern JSObject *jsb_cocos2d_GridAction_prototype;
@@ -25331,7 +26081,7 @@ void js_cocos2d_TiledGrid3DAction_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (TiledGrid3DAction)", obj);
}
-void js_register_cocos2dx_TiledGrid3DAction(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_TiledGrid3DAction(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_TiledGrid3DAction_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_TiledGrid3DAction_class->name = "TiledGrid3DAction";
jsb_cocos2d_TiledGrid3DAction_class->addProperty = JS_PropertyStub;
@@ -25345,12 +26095,11 @@ void js_register_cocos2dx_TiledGrid3DAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_TiledGrid3DAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
- JS_FN("getGrid", js_cocos2dx_TiledGrid3DAction_getGrid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@@ -25358,7 +26107,7 @@ void js_register_cocos2dx_TiledGrid3DAction(JSContext *cx, JSObject *global) {
jsb_cocos2d_TiledGrid3DAction_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_GridAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_GridAction_prototype),
jsb_cocos2d_TiledGrid3DAction_class,
empty_constructor, 0,
properties,
@@ -25389,6 +26138,7 @@ JSObject *jsb_cocos2d_StopGrid_prototype;
bool js_cocos2dx_StopGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
{
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 0) {
cocos2d::StopGrid* ret = cocos2d::StopGrid::create();
jsval jsret = JSVAL_NULL;
@@ -25400,7 +26150,7 @@ bool js_cocos2dx_StopGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_StopGrid_create : wrong number of arguments");
@@ -25409,7 +26159,7 @@ bool js_cocos2dx_StopGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_StopGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::StopGrid* cobj = new (std::nothrow) cocos2d::StopGrid();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -25423,13 +26173,16 @@ bool js_cocos2dx_StopGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::StopGrid");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::StopGrid");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -25440,7 +26193,7 @@ void js_cocos2d_StopGrid_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (StopGrid)", obj);
}
-void js_register_cocos2dx_StopGrid(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_StopGrid(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_StopGrid_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_StopGrid_class->name = "StopGrid";
jsb_cocos2d_StopGrid_class->addProperty = JS_PropertyStub;
@@ -25454,8 +26207,8 @@ void js_register_cocos2dx_StopGrid(JSContext *cx, JSObject *global) {
jsb_cocos2d_StopGrid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -25469,7 +26222,7 @@ void js_register_cocos2dx_StopGrid(JSContext *cx, JSObject *global) {
jsb_cocos2d_StopGrid_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_StopGrid_class,
js_cocos2dx_StopGrid_constructor, 0, // constructor
properties,
@@ -25500,20 +26253,20 @@ JSObject *jsb_cocos2d_ReuseGrid_prototype;
bool js_cocos2dx_ReuseGrid_initWithTimes(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ReuseGrid* cobj = (cocos2d::ReuseGrid *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Invalid Native Object");
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Error processing arguments");
bool ret = cobj->initWithTimes(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25522,11 +26275,11 @@ bool js_cocos2dx_ReuseGrid_initWithTimes(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_ReuseGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
int arg0;
- ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
+ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_create : Error processing arguments");
cocos2d::ReuseGrid* ret = cocos2d::ReuseGrid::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -25538,7 +26291,7 @@ bool js_cocos2dx_ReuseGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_ReuseGrid_create : wrong number of arguments");
@@ -25547,7 +26300,7 @@ bool js_cocos2dx_ReuseGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_ReuseGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::ReuseGrid* cobj = new (std::nothrow) cocos2d::ReuseGrid();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -25561,13 +26314,16 @@ bool js_cocos2dx_ReuseGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::ReuseGrid");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::ReuseGrid");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -25578,7 +26334,7 @@ void js_cocos2d_ReuseGrid_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (ReuseGrid)", obj);
}
-void js_register_cocos2dx_ReuseGrid(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_ReuseGrid(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_ReuseGrid_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_ReuseGrid_class->name = "ReuseGrid";
jsb_cocos2d_ReuseGrid_class->addProperty = JS_PropertyStub;
@@ -25592,8 +26348,8 @@ void js_register_cocos2dx_ReuseGrid(JSContext *cx, JSObject *global) {
jsb_cocos2d_ReuseGrid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -25608,7 +26364,7 @@ void js_register_cocos2dx_ReuseGrid(JSContext *cx, JSObject *global) {
jsb_cocos2d_ReuseGrid_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_ActionInstant_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_ActionInstant_prototype),
jsb_cocos2d_ReuseGrid_class,
js_cocos2dx_ReuseGrid_constructor, 0, // constructor
properties,
@@ -25639,18 +26395,18 @@ JSObject *jsb_cocos2d_Waves3D_prototype;
bool js_cocos2dx_Waves3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Error processing arguments");
cobj->setAmplitudeRate(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -25659,9 +26415,9 @@ bool js_cocos2dx_Waves3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Waves3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_initWithDuration : Invalid Native Object");
@@ -25670,15 +26426,15 @@ bool js_cocos2dx_Waves3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
cocos2d::Size arg1;
unsigned int arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25687,7 +26443,8 @@ bool js_cocos2dx_Waves3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Waves3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_getAmplitude : Invalid Native Object");
@@ -25695,7 +26452,7 @@ bool js_cocos2dx_Waves3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getAmplitude();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25704,7 +26461,8 @@ bool js_cocos2dx_Waves3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Waves3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_getAmplitudeRate : Invalid Native Object");
@@ -25712,7 +26470,7 @@ bool js_cocos2dx_Waves3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *v
double ret = cobj->getAmplitudeRate();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25721,18 +26479,18 @@ bool js_cocos2dx_Waves3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_Waves3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Error processing arguments");
cobj->setAmplitude(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -25741,17 +26499,17 @@ bool js_cocos2dx_Waves3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Waves3D_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 4) {
double arg0;
cocos2d::Size arg1;
unsigned int arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_uint32(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_uint32(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_create : Error processing arguments");
cocos2d::Waves3D* ret = cocos2d::Waves3D::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -25763,7 +26521,7 @@ bool js_cocos2dx_Waves3D_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Waves3D_create : wrong number of arguments");
@@ -25772,7 +26530,7 @@ bool js_cocos2dx_Waves3D_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Waves3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Waves3D* cobj = new (std::nothrow) cocos2d::Waves3D();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -25786,13 +26544,16 @@ bool js_cocos2dx_Waves3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Waves3D");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Waves3D");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -25803,7 +26564,7 @@ void js_cocos2d_Waves3D_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Waves3D)", obj);
}
-void js_register_cocos2dx_Waves3D(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Waves3D(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Waves3D_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Waves3D_class->name = "Waves3D";
jsb_cocos2d_Waves3D_class->addProperty = JS_PropertyStub;
@@ -25817,8 +26578,8 @@ void js_register_cocos2dx_Waves3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Waves3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -25837,7 +26598,7 @@ void js_register_cocos2dx_Waves3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Waves3D_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Grid3DAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Grid3DAction_prototype),
jsb_cocos2d_Waves3D_class,
js_cocos2dx_Waves3D_constructor, 0, // constructor
properties,
@@ -25868,22 +26629,22 @@ JSObject *jsb_cocos2d_FlipX3D_prototype;
bool js_cocos2dx_FlipX3D_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FlipX3D* cobj = (cocos2d::FlipX3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Invalid Native Object");
if (argc == 2) {
cocos2d::Size arg0;
double arg1;
- ok &= jsval_to_ccsize(cx, argv[0], &arg0);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &arg1);
+ ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
+ ok &= JS::ToNumber( cx, args.get(1), &arg1) && !isnan(arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Error processing arguments");
bool ret = cobj->initWithSize(arg0, arg1);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25892,20 +26653,20 @@ bool js_cocos2dx_FlipX3D_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_FlipX3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::FlipX3D* cobj = (cocos2d::FlipX3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -25914,11 +26675,11 @@ bool js_cocos2dx_FlipX3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *v
}
bool js_cocos2dx_FlipX3D_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_create : Error processing arguments");
cocos2d::FlipX3D* ret = cocos2d::FlipX3D::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -25930,7 +26691,7 @@ bool js_cocos2dx_FlipX3D_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FlipX3D_create : wrong number of arguments");
@@ -25939,7 +26700,7 @@ bool js_cocos2dx_FlipX3D_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FlipX3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FlipX3D* cobj = new (std::nothrow) cocos2d::FlipX3D();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -25953,13 +26714,16 @@ bool js_cocos2dx_FlipX3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX3D");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipX3D");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -25970,7 +26734,7 @@ void js_cocos2d_FlipX3D_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FlipX3D)", obj);
}
-void js_register_cocos2dx_FlipX3D(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FlipX3D(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FlipX3D_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FlipX3D_class->name = "FlipX3D";
jsb_cocos2d_FlipX3D_class->addProperty = JS_PropertyStub;
@@ -25984,8 +26748,8 @@ void js_register_cocos2dx_FlipX3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipX3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -26001,7 +26765,7 @@ void js_register_cocos2dx_FlipX3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipX3D_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Grid3DAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Grid3DAction_prototype),
jsb_cocos2d_FlipX3D_class,
js_cocos2dx_FlipX3D_constructor, 0, // constructor
properties,
@@ -26032,11 +26796,11 @@ JSObject *jsb_cocos2d_FlipY3D_prototype;
bool js_cocos2dx_FlipY3D_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY3D_create : Error processing arguments");
cocos2d::FlipY3D* ret = cocos2d::FlipY3D::create(arg0);
jsval jsret = JSVAL_NULL;
@@ -26048,7 +26812,7 @@ bool js_cocos2dx_FlipY3D_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_FlipY3D_create : wrong number of arguments");
@@ -26057,7 +26821,7 @@ bool js_cocos2dx_FlipY3D_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_FlipY3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::FlipY3D* cobj = new (std::nothrow) cocos2d::FlipY3D();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -26071,13 +26835,16 @@ bool js_cocos2dx_FlipY3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY3D");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::FlipY3D");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -26088,7 +26855,7 @@ void js_cocos2d_FlipY3D_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (FlipY3D)", obj);
}
-void js_register_cocos2dx_FlipY3D(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_FlipY3D(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_FlipY3D_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_FlipY3D_class->name = "FlipY3D";
jsb_cocos2d_FlipY3D_class->addProperty = JS_PropertyStub;
@@ -26102,8 +26869,8 @@ void js_register_cocos2dx_FlipY3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipY3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -26117,7 +26884,7 @@ void js_register_cocos2dx_FlipY3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_FlipY3D_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_FlipX3D_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_FlipX3D_prototype),
jsb_cocos2d_FlipY3D_class,
js_cocos2dx_FlipY3D_constructor, 0, // constructor
properties,
@@ -26148,18 +26915,18 @@ JSObject *jsb_cocos2d_Lens3D_prototype;
bool js_cocos2dx_Lens3D_setConcave(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setConcave : Invalid Native Object");
if (argc == 1) {
bool arg0;
- arg0 = JS::ToBoolean(JS::RootedValue(cx, argv[0]));
+ arg0 = JS::ToBoolean(args.get(0));
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setConcave : Error processing arguments");
cobj->setConcave(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26168,9 +26935,9 @@ bool js_cocos2dx_Lens3D_setConcave(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Lens3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_initWithDuration : Invalid Native Object");
@@ -26179,15 +26946,15 @@ bool js_cocos2dx_Lens3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
cocos2d::Size arg1;
cocos2d::Vec2 arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_vector2(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_vector2(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26196,18 +26963,18 @@ bool js_cocos2dx_Lens3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp
}
bool js_cocos2dx_Lens3D_setLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Error processing arguments");
cobj->setLensEffect(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26216,7 +26983,8 @@ bool js_cocos2dx_Lens3D_setLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Lens3D_getLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_getLensEffect : Invalid Native Object");
@@ -26224,7 +26992,7 @@ bool js_cocos2dx_Lens3D_getLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getLensEffect();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26233,18 +27001,18 @@ bool js_cocos2dx_Lens3D_getLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Lens3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setPosition : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setPosition : Error processing arguments");
cobj->setPosition(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26253,7 +27021,8 @@ bool js_cocos2dx_Lens3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Lens3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_getPosition : Invalid Native Object");
@@ -26261,7 +27030,7 @@ bool js_cocos2dx_Lens3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec2& ret = cobj->getPosition();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26270,17 +27039,17 @@ bool js_cocos2dx_Lens3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Lens3D_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 4) {
double arg0;
cocos2d::Size arg1;
cocos2d::Vec2 arg2;
double arg3;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_vector2(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_vector2(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_create : Error processing arguments");
cocos2d::Lens3D* ret = cocos2d::Lens3D::create(arg0, arg1, arg2, arg3);
jsval jsret = JSVAL_NULL;
@@ -26292,7 +27061,7 @@ bool js_cocos2dx_Lens3D_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Lens3D_create : wrong number of arguments");
@@ -26301,7 +27070,7 @@ bool js_cocos2dx_Lens3D_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Lens3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Lens3D* cobj = new (std::nothrow) cocos2d::Lens3D();
cocos2d::Ref *_ccobj = dynamic_cast(cobj);
@@ -26315,13 +27084,16 @@ bool js_cocos2dx_Lens3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
- JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
+ // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
+ JS::RootedObject proto(cx, typeClass->proto.get());
+ JS::RootedObject parent(cx, typeClass->parentProto.get());
+ JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
+ args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t* p = jsb_new_proxy(cobj, obj);
- JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::Lens3D");
+ AddNamedObjectRoot(cx, &p->obj, "cocos2d::Lens3D");
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
- ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", argc, argv);
+ ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
@@ -26332,7 +27104,7 @@ void js_cocos2d_Lens3D_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (Lens3D)", obj);
}
-void js_register_cocos2dx_Lens3D(JSContext *cx, JSObject *global) {
+void js_register_cocos2dx_Lens3D(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_Lens3D_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_Lens3D_class->name = "Lens3D";
jsb_cocos2d_Lens3D_class->addProperty = JS_PropertyStub;
@@ -26346,8 +27118,8 @@ void js_register_cocos2dx_Lens3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Lens3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
- {"__nativeObj", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT, JSOP_WRAPPER(js_is_native_obj), JSOP_NULLWRAPPER},
- {0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER}
+ JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
+ JS_PS_END
};
static JSFunctionSpec funcs[] = {
@@ -26367,7 +27139,7 @@ void js_register_cocos2dx_Lens3D(JSContext *cx, JSObject *global) {
jsb_cocos2d_Lens3D_prototype = JS_InitClass(
cx, global,
- jsb_cocos2d_Grid3DAction_prototype,
+ JS::RootedObject(cx, jsb_cocos2d_Grid3DAction_prototype),
jsb_cocos2d_Lens3D_class,
js_cocos2dx_Lens3D_constructor, 0, // constructor
properties,
@@ -26398,18 +27170,18 @@ JSObject *jsb_cocos2d_Ripple3D_prototype;
bool js_cocos2dx_Ripple3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Error processing arguments");
cobj->setAmplitudeRate(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26418,9 +27190,9 @@ bool js_cocos2dx_Ripple3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Ripple3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_initWithDuration : Invalid Native Object");
@@ -26431,17 +27203,17 @@ bool js_cocos2dx_Ripple3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *
double arg3;
unsigned int arg4;
double arg5;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_vector2(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
- ok &= jsval_to_uint32(cx, argv[4], &arg4);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[5]), &arg5);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_vector2(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ ok &= jsval_to_uint32(cx, args.get(4), &arg4);
+ ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4, arg5);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26450,7 +27222,8 @@ bool js_cocos2dx_Ripple3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Ripple3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getAmplitudeRate : Invalid Native Object");
@@ -26458,7 +27231,7 @@ bool js_cocos2dx_Ripple3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *
double ret = cobj->getAmplitudeRate();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26467,18 +27240,18 @@ bool js_cocos2dx_Ripple3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *
}
bool js_cocos2dx_Ripple3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Invalid Native Object");
if (argc == 1) {
double arg0;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Error processing arguments");
cobj->setAmplitude(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26487,7 +27260,8 @@ bool js_cocos2dx_Ripple3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Ripple3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getAmplitude : Invalid Native Object");
@@ -26495,7 +27269,7 @@ bool js_cocos2dx_Ripple3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
double ret = cobj->getAmplitude();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26504,18 +27278,18 @@ bool js_cocos2dx_Ripple3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Ripple3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
- JSObject *obj = JS_THIS_OBJECT(cx, vp);
+ JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setPosition : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
- ok &= jsval_to_vector2(cx, argv[0], &arg0);
+ ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setPosition : Error processing arguments");
cobj->setPosition(arg0);
- JS_SET_RVAL(cx, vp, JSVAL_VOID);
+ args.rval().setUndefined();
return true;
}
@@ -26524,7 +27298,8 @@ bool js_cocos2dx_Ripple3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Ripple3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
{
- JSObject *obj = JS_THIS_OBJECT(cx, 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::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getPosition : Invalid Native Object");
@@ -26532,7 +27307,7 @@ bool js_cocos2dx_Ripple3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
const cocos2d::Vec2& ret = cobj->getPosition();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
@@ -26541,7 +27316,7 @@ bool js_cocos2dx_Ripple3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
}
bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 6) {
double arg0;
@@ -26550,12 +27325,12 @@ bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp)
double arg3;
unsigned int arg4;
double arg5;
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &arg0);
- ok &= jsval_to_ccsize(cx, argv[1], &arg1);
- ok &= jsval_to_vector2(cx, argv[2], &arg2);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &arg3);
- ok &= jsval_to_uint32(cx, argv[4], &arg4);
- ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[5]), &arg5);
+ ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0);
+ ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
+ ok &= jsval_to_vector2(cx, args.get(2), &arg2);
+ ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
+ ok &= jsval_to_uint32(cx, args.get(4), &arg4);
+ ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_create : Error processing arguments");
cocos2d::Ripple3D* ret = cocos2d::Ripple3D::create(arg0, arg1, arg2, arg3, arg4, arg5);
jsval jsret = JSVAL_NULL;
@@ -26567,7 +27342,7 @@ bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp)
jsret = JSVAL_NULL;
}
} while (0);
- JS_SET_RVAL(cx, vp, jsret);
+ args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Ripple3D_create : wrong number of arguments");
@@ -26576,7 +27351,7 @@ bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Ripple3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
- jsval *argv = JS_ARGV(cx, vp);
+ JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::Ripple3D* cobj = new (std::nothrow) cocos2d::Ripple3D();
cocos2d::Ref *_ccobj = dynamic_cast