Commit Graph

21 Commits

Author SHA1 Message Date
James Chen ad555e70fb issue #1944: Removing commented codes in cc.associateWithNative. 2013-04-03 10:39:15 +08:00
James Chen ec7a2f4c5c fixed #1944: The subclass of cc.Sprite,cc.Layer... doesn't need cc.associateWithNative anymore. 2013-04-02 11:35:55 +08:00
James Chen 54edf8cafd Don't require 'jsb_opengl_constants.js' in 'jsb_opengl.js'. It will break js obscure 2013-03-28 16:58:02 +08:00
Rohan Kuruvilla 57fd3cdb9c Modifying JS files to load OpenGL bindings. Also modify AppDelegate and Project files and generator template 2013-03-27 23:59:29 -07:00
walzer 67cda2bfd4 issue #1841, TestJavascript is obfuscated successfully 2013-03-21 16:55:55 +08:00
James Chen 6a98553633 Synchronizing the submodule reference of cocos2d-js-test to the latest one. 2013-03-18 18:24:37 +08:00
James Chen 3e33868a63 fixed #1824: Exposed cc.EditBox to js. 2013-03-14 18:14:16 +08:00
minggo 85f39cee24 Merge pull request #2114 from linshun/master
Added compatible function for multi secene resouces preloading.
2013-03-12 19:38:09 -07:00
James Chen 69b2b13325 fixed #1748: Generating jsb_cocos2dx_extension_auto.hpp/.cpp. It was separated from original `cocos2dx.hpp/cpp`.
Developer could remove redundant jsbinding codes now.
2013-03-11 16:39:28 +08:00
linshun d60ba89b36 Added compatible functions for HTML5 multi resources preloading. 2013-03-07 15:49:05 +08:00
James Chen cf33a4538d fixed #1730: Binds CCScrollView and CCTableView to js. 2013-02-21 10:06:22 +08:00
Rolando Abarca a265120f4c cc namespace 2013-01-16 14:07:51 -08:00
Rolando Abarca 320068930e more debug stuff 2013-01-11 14:29:40 -08:00
Rolando Abarca 5df4b4d997 adding debug support for js 2013-01-11 14:01:36 -08:00
James Chen 4bd15af2a2 issue #1640: Updated js files for jsbindings 2013-01-05 13:58:56 +08:00
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
Nicolas Gramlich 9537389949 Added cc.DrawNode.extend. 2012-12-12 21:49:29 +08:00
James Chen 478791a472 Added CCBReader::setCCBRootPath. 2012-12-03 18:27:50 +08:00
James Chen 26790eb17a issue #1583: Added some Macros as follows:
cc.MENU_STATE_WAITING = 0;
cc.MENU_STATE_TRACKING_TOUCH = 1;
cc.MENU_HANDLER_PRIORITY = -128;
cc.DEFAULT_PADDING = 5;
2012-11-30 21:15:54 +08:00
James Chen a37cc8a098 Updated jsb_constants_chipmunk.js and jsb_constants_cocosbuilder.js. 2012-11-29 15:29:58 +08:00
James Chen 208132895e issue #1583: Moved the common js codes to scripting/javascript/bindings/js folder. Deleted the old js sample resources. 2012-11-29 11:27:39 +08:00