axmol/scripting/javascript/bindings
James Chen e8c0844dd5 fixed #1617: Some improvements for JS Bindings.
1) Changed cc.REPEAT_FOREVER = - 1 to cc.REPEAT_FOREVER = 0xffffffff
[Reason]: If cc.REPEAT_FOREVER = -1, it will be a very big double value after converting it to double by JS_ValueToNumber on android.
Then cast it to unsigned int, the value will be 0. The schedule will not be able to work.
I don't know why this occurs only on android.
[Solution]: Instead of passing -1 to it, I assign it with max value of unsigned int in c++.

2) Added two helper function, cc.ArrayGetIndexOfObject and cc.ArrayContainsObject.

3) Added JSScheduleWrapper::removeTargetForNativeNode to avoid memory leaks.

4) Improvments for JSTouchDelegate. Added four functions as follows:
// Set the touch delegate to map by using the key (pJSObj).
static void setDelegateForJSObject(JSObject* pJSObj, JSTouchDelegate* pDelegate);

// Get the touch delegate by the key (pJSObj).
static JSTouchDelegate* getDelegateForJSObject(JSObject* pJSObj);

// Remove the delegate by the key (pJSObj).
static void removeDelegateForJSObject(JSObject* pJSObj);

void unregisterTouchDelegate();
And exported cc.unregisterTouchDelegate(); to js.
Fix a memory leak for JSTouchDelegate by making it as an autorelease object.

5) Don't add js callback function to the reserved slot of object.
[Reason]: The target object may execute more than one schedule.
Therefore, previous js callback function will be replaced
by the current one. For example:

this.scheduleOnce(function() { temporary function 1 }, 0.5);
this.scheduleOnce(function() { temporary function 2 }, 0.5);

In this case, the temporary function 1 will be removed from reserved slot 0.
And temporary function 2 will be set to reserved slot 0 of this object.
If gc is triggered before the JSScheduleWrapper::scheduleFunc is invoked,
crash will happen. You could simply reproduce it by adding jsc.garbageCollect(); after scheduleOnce.
[Solution] Because one schedule corresponds to one JSScheduleWrapper, we root
the js callback function in JSScheduleWrapper::setJSCallbackFunc and unroot it
at the destructor of JSScheduleWrapper.
2012-12-18 11:56:44 +08:00
..
generated@4b8684dfb4 cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated bindings 2012-12-17 15:26:28 +08:00
js fixed #1617: Some improvements for JS Bindings. 2012-12-18 11:56:44 +08:00
Android.mk issue #1573: Added CocosDragonJS. Made it compiled ok on iOS,android and win32. 2012-11-23 15:09:03 +08:00
ScriptingCore.cpp fixed #1617: Some improvements for JS Bindings. 2012-12-18 11:56:44 +08:00
ScriptingCore.h rename CCNode:scheduleUpdateScriptHandlerWithPriority() to CCNode::scheduleUpdateWhitPriorityLua() 2012-12-10 16:09:23 +08:00
cocos2d_specifics.cpp fixed #1617: Some improvements for JS Bindings. 2012-12-18 11:56:44 +08:00
cocos2d_specifics.hpp fixed #1617: Some improvements for JS Bindings. 2012-12-18 11:56:44 +08:00
cocosjs_manual_conversions.cpp Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
cocosjs_manual_conversions.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_ccbreader.cpp Updated MoonWarriors/Classes/AppDelegate.cpp. 2012-12-04 11:36:45 +08:00
js_bindings_ccbreader.h fixed #1576: Sync CCBReader to latest version, CCString* --> std::string, CocosBuilderTest crash fixes. 2012-11-26 21:51:05 +08:00
js_bindings_chipmunk_auto_classes.cpp.REMOVED.git-id 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
js_bindings_chipmunk_auto_classes.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_chipmunk_auto_classes_registration.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_chipmunk_functions.cpp.REMOVED.git-id 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
js_bindings_chipmunk_functions.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_chipmunk_functions_registration.h issue #1564: Made ChipmunkTest of TestJavascript works 2012-11-22 15:19:16 +08:00
js_bindings_chipmunk_manual.cpp fixed #1586: Native object need to be an autorelease object. 2012-12-01 11:41:51 +08:00
js_bindings_chipmunk_manual.h issue #1564: Made ChipmunkTest of TestJavascript works 2012-11-22 15:19:16 +08:00
js_bindings_chipmunk_registration.cpp issue #1564: Made ChipmunkTest of TestJavascript works 2012-11-22 15:19:16 +08:00
js_bindings_chipmunk_registration.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_config.h issue #1564: Made ChipmunkTest of TestJavascript works 2012-11-22 15:19:16 +08:00
js_bindings_core.cpp Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_bindings_core.h issue #1581: Added jsb_set_reserved_slot and jsb_get_reserved_slot, 2012-11-30 22:00:30 +08:00
js_manual_conversions.cpp Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
js_manual_conversions.h Adding Object Oriented Chipmunk JS bindings 2012-11-16 15:56:29 +08:00
spidermonkey_specifics.h issue #1581: JSBinding bug fixes. 2012-11-28 22:04:55 +08:00
uthash.h Adding cxx-generator/target/common/* files and generated bindings for cocos2d-x. 2012-08-27 10:02:19 -07:00