Commit Graph

53 Commits

Author SHA1 Message Date
James Chen e3615e2fb1 fixed #1586: Invoking removeAllRoots in ScriptingCore destructor to avoid crash when app exits. 2012-12-01 11:41:50 +08:00
James Chen 36bc0ab0bb Invoking JS_SetGCZeal only when the macros DEBUG and JS_GC_ZEAL is defined. 2012-12-01 11:41:50 +08:00
James Chen 07661a1e21 issue #1581: Added jsb_set_reserved_slot and jsb_get_reserved_slot, 2012-11-30 22:00:30 +08:00
James Chen 15d02e4db8 Merge branch 'iss1581-fix-jsbinding-bugs' of https://github.com/dumganhar/cocos2d-x into iss1583-js-tests
Conflicts:
	scripting/javascript/bindings/cocos2d_specifics.cpp
2012-11-30 21:43:44 +08:00
James Chen 96e2707f39 issue #1583: Added jsvals_variadic_to_ccarray function. 2012-11-30 21:12:14 +08:00
James Chen a814066601 issue #1581: JSBinding bug fixes.
Some fixes of JSBinding codes:
[1] Check whether the proxy was already added in JS_NEW_PROXY
[2] In struct schedFunc_proxy_t, JSScheduleWrapper* --> CCArray*
Reason: One js function may correspond to many targets. To debug this, you could refer to JSScheduleWrapper::dump function. It will prove that i'm right. :)
[3] In ScriptingCore::cleanupSchedulesAndActions function, we must invoke unschedule for all targets and remove the proxy both in _schedFunc_target_ht and _schedTarget_native_ht, otherwise the hash tables will grow bigger and bigger, so I added a new function JSScheduleWrapper::removeAllTargetsForNatiaveNode to make this things easier.
[4] To easily find out the bugs of binding codes, I add JS_SetGCZeal in ScriptingCore::createGlobalContext, it only works in DEBUG mode.
[5] In js_cocos2dx_CCNode_getChildren, we should add the generated array to root to avoid gc happen when invoking JS_SetElement.
[6] The JSCallFuncWrapper isn't needed since an action will be run by a cc.Node and it will be released at the CCNode::cleanup.
[7] Some improvements of JSScheduleWrapper class.
[8] Added a new function JSScheduleWrapper::setTarget, it's for js_CCNode_unschedule to find out which target need to be unscheduled.
[9] Commented JS_SetReservedSlot in js_CCNode_scheduleOnce and js_CCNode_schedule.
Reason:
For js_CCNode_scheduleOnce: Don't add the callback function to the reserved slot of this js object.Since the class of js object may be inherited from cocos class(e.g. cc.Sprite). The subclass will not contain reserved slots. It will crash if invoking this.
For js_CCNode_schedule: Don't add js callback function to the reserved slot of scheduler js object. Since the scheduler is an object always rooted.
So the callback function might not be released when gc comes.I looked inside the implementation of cc.Node.schedule, and it doesn't use JS_SetReservedSlot there.
2012-11-28 22:04:55 +08:00
James Chen 7c1e860d78 issue #1573: Added CocosDragonJS. Made it compiled ok on iOS,android and win32. 2012-11-23 15:09:03 +08:00
James Chen 692d16f296 Minor fix in ScriptingCore::log. 2012-11-22 17:34:58 +08:00
James Chen 89a51433b8 issue #1564: Make TestJavascript works on windows. 2012-11-22 10:24:26 +08:00
Rolando Abarca d9baa8a24d fixes merge conflict 2012-11-19 11:23:08 -08:00
Rolando Abarca ac539667f4 Merge remote-tracking branch 'origin/gles20' into gles20
Conflicts:
	scripting/javascript/bindings/ScriptingCore.cpp
	scripting/javascript/bindings/js_bindings_chipmunk_manual.cpp
2012-11-16 09:44:34 -08:00
James Chen 34f359384c issue #1530: Minor fixes in ScriptingCore.cpp, js_bindings_chipmunk_auto_classes.cpp and js_bindings_chipmunk_funcitons.cpp. 2012-11-16 15:58:20 +08:00
Rohan Kuruvilla 6d59009953 Adding executeAccelerometerEvent for to CCScriptSupport and ScriptingCore 2012-11-16 15:56:29 +08:00
Rohan Kuruvilla 66f85468e5 Adding JS conversion of CCDictionary objects, also modified CCArray conversion 2012-11-16 15:56:27 +08:00
Rohan Kuruvilla 672bed3ed0 Updating bindings for ONE_BY_ONE touch handling 2012-11-16 15:56:27 +08:00
Rolando Abarca 6e9d2e808c improved debugger 2012-11-15 11:14:57 -08:00
Rolando Abarca c9df076378 new JSStringWrapper 2012-11-15 11:14:37 -08:00
Rolando Abarca b894524ed0 removing some warnings 2012-11-15 11:13:21 -08:00
James Chen 449c719d96 issue #1549: Added "ccdictionary_to_jsval" function, now TMXOrthoObjectsTest and TMXIsoObjectsTest don't crash. 2012-11-06 16:11:45 +08:00
James Chen 21e4f80fbd Added "executeAccelerometerEvent" for CCScriptEngineProtocol class. Exported Accelerometer event to JS. 2012-11-06 14:18:13 +08:00
Rohan Kuruvilla b3c6f1a2e1 Adding bindings for CCBReader and other improvements.
1. Added additional CCBReader bindings, including callback support for animationCompleted
2. Improved design for JS CallbackWrappers
3. Added bindings for pDistance
4. Updating cocos2dx.ini
2012-11-01 15:34:23 +08:00
James Chen bdbb70bea5 Merge branch 'gles20' of https://github.com/funkaster/cocos2d-x into js-surith-gnu 2012-10-31 10:04:35 +08:00
James Chen 1ede7b6434 Modifying action/schedules cleanup, ignoring libjs_static.a of debugging version. 2012-10-29 15:10:13 +08:00
Rohan Kuruvilla c24acd4733 Changing ScriptingCore flow of execution of targetted Touch events 2012-10-29 15:06:34 +08:00
Rohan Kuruvilla 7ede1373f7 Adding function to cleanup actions and schedule to ScriptingCore 2012-10-29 15:06:10 +08:00
Rolando Abarca 463ae31180 upgrades to new spidermonkey API
FF beta - this fixes the auto-compartment issue
2012-10-24 11:14:15 -07:00
Rolando Abarca 003f6e4cf3 fixes ScriptingCore for FF 16 API 2012-10-19 09:54:21 -07:00
James Chen 871541ac6b Updated one comment. 2012-10-19 15:03:10 +08:00
James Chen e5096ce091 Made TestJavascript and MoonWarriors work ok on android after merging Rolando's commit. 2012-10-19 15:01:05 +08:00
James Chen 1a373f70ff issue #1517: Upgrading js engine to FF 16.0.1 for IOS. 2012-10-19 13:41:03 +08:00
James Chen de3376b43f issue #1517:[Win32]Upgrading SpiderMonkey js engine to FF 16.0.1 2012-10-19 11:15:23 +08:00
Rolando Abarca b0f02a0773 updates on the js front 2012-10-18 17:44:41 -07:00
Rohan Kuruvilla eafd6ebf08 Fixing restart of context to not leak memory 2012-10-11 18:48:37 -07:00
Rohan Kuruvilla 0c1c5a432d Adding support to pass array of CCPoints from JS 2012-10-11 18:44:46 -07:00
James Chen 9f93b609e8 issue #1469: Added cc.config for js-bindings. 2012-10-10 15:24:20 +08:00
Rohan Kuruvilla 12292afee6 Adding CCSchedule bindings. Also adding CCOrbitCamera bindings and modifying cocos2dx.ini 2012-10-09 15:03:14 -07:00
James Chen 426915dd4a fixed some compilation error for win32 platform. 2012-09-24 11:05:15 +08:00
minggo 29fad4d570 Merge branch 'gles20-android-refactoring' of https://github.com/nicolasgramlich/cocos2d-x into merge_nicolas 2012-09-21 11:05:31 +08:00
Rohan Kuruvilla 9e1e64509b Copying changes previously made into cxx-generator/targets/spidermonkey/common
1. Fixed memory leak while removing proxy objects
2. Fixed JS Context restart
3. Added JS conversion for CCArray
4. Updated generated bindings with some more classes
2012-09-20 18:02:17 -07:00
Rohan Kuruvilla dde8d50d15 Adding member function executeFunctionWithOwner to ScriptingCore 2012-09-20 14:45:35 -07:00
Nicolas Gramlich c2a62875cf Added ANDROID_SCRIPTINGCORE_LOAD_SCRIPTS_FROM_EXTERNAL_ASSET_DIRECTORY flag, that allows to load from external assets directory instead of from internal apk assets directory. 2012-09-13 11:13:02 -07:00
James Chen 7d8b261ced fixed #1477: Abstracts Lua and JS binding protocol, some bugs fixes in lua-binding, adding custom menu on win32 and mac for switching resolutions. 2012-09-11 14:02:33 +08:00
James Chen 708be4e474 Remove 'readFileInMemory' to make it compile ok on win32, initialized the member variables for ScriptingCore class. 2012-08-29 14:49:03 -07:00
folecr 3c11684bf7 Remove commented code 2012-08-28 17:56:01 -07:00
folecr 6c604f02d3 Fix typo and add logs 2012-08-28 17:44:01 -07:00
James Chen 71b147ce2f Use CCFileUtils and CCString to load file contents 2012-08-28 17:43:59 -07:00
James Chen 60dae250f2 Use CCLOG to implement js_log 2012-08-28 17:43:59 -07:00
Rohan Kuruvilla 6c8d2ea75b Fixing GC crash issue. Forcing the GC from Javascript at any time, doesn't crash the app
Fixing GC crash issue. Bug in bind_menu_item. There is no more problem with GC, including force_GC

Updating generated bindings to remove std::string scoping bug
2012-08-28 17:29:25 -07:00
Rohan Kuruvilla 8d7516a0ef Test project for cocos2d-x js. 2012-08-27 10:07:31 -07:00
Rohan Kuruvilla ccd5e0a066 Adding cxx-generator/target/common/* files and generated bindings for cocos2d-x. 2012-08-27 10:02:19 -07:00