From 643bdd8d6e6f04fd082faec4120433058ab155c0 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Mon, 14 Sep 2015 03:29:24 +0000 Subject: [PATCH] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../auto/api/jsb_cocos2dx_auto_api.js | 192 +-- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 566 ++++----- .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 34 +- .../auto/api/lua_cocos2dx_auto_api.lua | 10 +- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 1092 ++++++++--------- 5 files changed, 947 insertions(+), 947 deletions(-) diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index ba2818540d..c933784539 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -592,6 +592,102 @@ str }; +/** + * @class Component + */ +cc.Component = { + +/** + * @method setEnabled + * @param {bool} arg0 + */ +setEnabled : function ( +bool +) +{ +}, + +/** + * @method setName + * @param {String} arg0 + */ +setName : function ( +str +) +{ +}, + +/** + * @method isEnabled + * @return {bool} + */ +isEnabled : function ( +) +{ + return false; +}, + +/** + * @method getOwner + * @return {cc.Node} + */ +getOwner : function ( +) +{ + return cc.Node; +}, + +/** + * @method init + * @return {bool} + */ +init : function ( +) +{ + return false; +}, + +/** + * @method getName + * @return {String} + */ +getName : function ( +) +{ + return ; +}, + +/** + * @method setOwner + * @param {cc.Node} arg0 + */ +setOwner : function ( +node +) +{ +}, + +/** + * @method create + * @return {cc.Component} + */ +create : function ( +) +{ + return cc.Component; +}, + +/** + * @method Component + * @constructor + */ +Component : function ( +) +{ +}, + +}; + /** * @class Node */ @@ -20695,102 +20791,6 @@ TextureCache : function ( }; -/** - * @class Component - */ -cc.Component = { - -/** - * @method setEnabled - * @param {bool} arg0 - */ -setEnabled : function ( -bool -) -{ -}, - -/** - * @method setName - * @param {String} arg0 - */ -setName : function ( -str -) -{ -}, - -/** - * @method isEnabled - * @return {bool} - */ -isEnabled : function ( -) -{ - return false; -}, - -/** - * @method getOwner - * @return {cc.Node} - */ -getOwner : function ( -) -{ - return cc.Node; -}, - -/** - * @method init - * @return {bool} - */ -init : function ( -) -{ - return false; -}, - -/** - * @method getName - * @return {String} - */ -getName : function ( -) -{ - return ; -}, - -/** - * @method setOwner - * @param {cc.Node} arg0 - */ -setOwner : function ( -node -) -{ -}, - -/** - * @method create - * @return {cc.Component} - */ -create : function ( -) -{ - return cc.Component; -}, - -/** - * @method Component - * @constructor - */ -Component : function ( -) -{ -}, - -}; - /** * @class Device */ diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index e701ed0155..728c5ffb75 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -1645,6 +1645,289 @@ void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject glo } } +JSClass *jsb_cocos2d_Component_class; +JSObject *jsb_cocos2d_Component_prototype; + +bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setEnabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setEnabled : Error processing arguments"); + cobj->setEnabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_setName : Error processing arguments"); + cobj->setName(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setName : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_getOwner(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getOwner : Invalid Native Object"); + if (argc == 0) { + cocos2d::Node* ret = cobj->getOwner(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Node*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_getOwner : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_init(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_init : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->init(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_setOwner(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setOwner : Invalid Native Object"); + if (argc == 1) { + cocos2d::Node* arg0; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + 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::Node*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setOwner : Error processing arguments"); + cobj->setOwner(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (argc == 0) { + cocos2d::Component* ret = cocos2d::Component::create(); + jsval jsret = JSVAL_NULL; + do { + if (ret) { + js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); + jsret = OBJECT_TO_JSVAL(jsProxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + args.rval().set(jsret); + return true; + } + JS_ReportError(cx, "js_cocos2dx_Component_create : wrong number of arguments"); + return false; +} + +bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + cocos2d::Component* cobj = new (std::nothrow) cocos2d::Component(); + 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::Component"); + if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + return true; +}static bool js_cocos2dx_Component_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Component *nobj = new (std::nothrow) cocos2d::Component(); + if (nobj) { + nobj->autorelease(); + } + js_proxy_t* p = jsb_new_proxy(nobj, obj); + AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); + 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_cocos2d_Component_finalize(JSFreeOp *fop, JSObject *obj) { + CCLOGINFO("jsbindings: finalizing JS object %p (Component)", obj); +} + +void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { + jsb_cocos2d_Component_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_cocos2d_Component_class->name = "Component"; + jsb_cocos2d_Component_class->addProperty = JS_PropertyStub; + jsb_cocos2d_Component_class->delProperty = JS_DeletePropertyStub; + jsb_cocos2d_Component_class->getProperty = JS_PropertyStub; + jsb_cocos2d_Component_class->setProperty = JS_StrictPropertyStub; + jsb_cocos2d_Component_class->enumerate = JS_EnumerateStub; + jsb_cocos2d_Component_class->resolve = JS_ResolveStub; + jsb_cocos2d_Component_class->convert = JS_ConvertStub; + jsb_cocos2d_Component_class->finalize = js_cocos2d_Component_finalize; + jsb_cocos2d_Component_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("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("ctor", js_cocos2dx_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + static JSFunctionSpec st_funcs[] = { + JS_FN("create", js_cocos2dx_Component_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + jsb_cocos2d_Component_prototype = JS_InitClass( + cx, global, + JS::NullPtr(), // parent proto + jsb_cocos2d_Component_class, + js_cocos2dx_Component_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, "Component", 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_Component_class; + p->proto = jsb_cocos2d_Component_prototype; + p->parentProto = NULL; + _js_global_type_map.insert(std::make_pair(typeName, p)); + } + anonEvaluate(cx, global, "(function () { cc.Component.extend = cc.Class.extend; })()"); +} + JSClass *jsb_cocos2d_Node_class; JSObject *jsb_cocos2d_Node_prototype; @@ -65064,289 +65347,6 @@ void js_register_cocos2dx_TextureCache(JSContext *cx, JS::HandleObject global) { } } -JSClass *jsb_cocos2d_Component_class; -JSObject *jsb_cocos2d_Component_prototype; - -bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setEnabled : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setEnabled : Error processing arguments"); - cobj->setEnabled(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_setName : Error processing arguments"); - cobj->setName(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setName : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_getOwner(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getOwner : Invalid Native Object"); - if (argc == 0) { - cocos2d::Node* ret = cobj->getOwner(); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Node*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_getOwner : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_init(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_init : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->init(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_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_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_setOwner(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::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setOwner : Invalid Native Object"); - if (argc == 1) { - cocos2d::Node* arg0; - do { - if (args.get(0).isNull()) { arg0 = nullptr; break; } - 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::Node*)(jsProxy ? jsProxy->ptr : NULL); - JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); - } while (0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setOwner : Error processing arguments"); - cobj->setOwner(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} -bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - if (argc == 0) { - cocos2d::Component* ret = cocos2d::Component::create(); - jsval jsret = JSVAL_NULL; - do { - if (ret) { - js_proxy_t *jsProxy = js_get_or_create_proxy(cx, (cocos2d::Component*)ret); - jsret = OBJECT_TO_JSVAL(jsProxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); - return true; - } - JS_ReportError(cx, "js_cocos2dx_Component_create : wrong number of arguments"); - return false; -} - -bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - cocos2d::Component* cobj = new (std::nothrow) cocos2d::Component(); - 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::Component"); - if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); - return true; -}static bool js_cocos2dx_Component_ctor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - cocos2d::Component *nobj = new (std::nothrow) cocos2d::Component(); - if (nobj) { - nobj->autorelease(); - } - js_proxy_t* p = jsb_new_proxy(nobj, obj); - AddNamedObjectRoot(cx, &p->obj, "cocos2d::Component"); - 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_cocos2d_Component_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (Component)", obj); -} - -void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { - jsb_cocos2d_Component_class = (JSClass *)calloc(1, sizeof(JSClass)); - jsb_cocos2d_Component_class->name = "Component"; - jsb_cocos2d_Component_class->addProperty = JS_PropertyStub; - jsb_cocos2d_Component_class->delProperty = JS_DeletePropertyStub; - jsb_cocos2d_Component_class->getProperty = JS_PropertyStub; - jsb_cocos2d_Component_class->setProperty = JS_StrictPropertyStub; - jsb_cocos2d_Component_class->enumerate = JS_EnumerateStub; - jsb_cocos2d_Component_class->resolve = JS_ResolveStub; - jsb_cocos2d_Component_class->convert = JS_ConvertStub; - jsb_cocos2d_Component_class->finalize = js_cocos2d_Component_finalize; - jsb_cocos2d_Component_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("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("ctor", js_cocos2dx_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; - - static JSFunctionSpec st_funcs[] = { - JS_FN("create", js_cocos2dx_Component_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; - - jsb_cocos2d_Component_prototype = JS_InitClass( - cx, global, - JS::NullPtr(), // parent proto - jsb_cocos2d_Component_class, - js_cocos2dx_Component_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, "Component", 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_Component_class; - p->proto = jsb_cocos2d_Component_prototype; - p->parentProto = NULL; - _js_global_type_map.insert(std::make_pair(typeName, p)); - } - anonEvaluate(cx, global, "(function () { cc.Component.extend = cc.Class.extend; })()"); -} - JSClass *jsb_cocos2d_Device_class; JSObject *jsb_cocos2d_Device_prototype; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 96a69c725e..93e0facc8e 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -98,6 +98,23 @@ bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp); +extern JSClass *jsb_cocos2d_Component_class; +extern JSObject *jsb_cocos2d_Component_prototype; + +bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_Component_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_Component(JSContext *cx, uint32_t argc, jsval *vp); + extern JSClass *jsb_cocos2d_Node_class; extern JSObject *jsb_cocos2d_Node_prototype; @@ -3702,23 +3719,6 @@ bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_TextureCache_waitForQuit(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_TextureCache(JSContext *cx, uint32_t argc, jsval *vp); -extern JSClass *jsb_cocos2d_Component_class; -extern JSObject *jsb_cocos2d_Component_prototype; - -bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp); -void js_cocos2dx_Component_finalize(JSContext *cx, JSObject *obj); -void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global); -void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_Component(JSContext *cx, uint32_t argc, jsval *vp); - extern JSClass *jsb_cocos2d_Device_class; extern JSObject *jsb_cocos2d_Device_prototype; diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 4eb148fb12..340cf0c853 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -36,6 +36,11 @@ -- @field [parent=#cc] EventKeyboard#EventKeyboard EventKeyboard preloaded module +-------------------------------------------------------- +-- the cc Component +-- @field [parent=#cc] Component#Component Component preloaded module + + -------------------------------------------------------- -- the cc Node -- @field [parent=#cc] Node#Node Node preloaded module @@ -1236,11 +1241,6 @@ -- @field [parent=#cc] TextureCache#TextureCache TextureCache preloaded module --------------------------------------------------------- --- the cc Component --- @field [parent=#cc] Component#Component Component preloaded module - - -------------------------------------------------------- -- the cc Device -- @field [parent=#cc] Device#Device Device preloaded module diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 35b964559a..a1698a2af2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -2873,6 +2873,552 @@ int lua_register_cocos2dx_EventKeyboard(lua_State* tolua_S) return 1; } +int lua_cocos2dx_Component_setEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Component:setEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setEnabled'", nullptr); + return 0; + } + cobj->setEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_setName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Component:setName"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setName'", nullptr); + return 0; + } + cobj->setName(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setName",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_isEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_isEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_isEnabled'", nullptr); + return 0; + } + bool ret = cobj->isEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:isEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_isEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_onRemove(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onRemove'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onRemove'", nullptr); + return 0; + } + cobj->onRemove(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onRemove",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onRemove'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_update(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_update'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Component:update"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_update'", nullptr); + return 0; + } + cobj->update(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:update",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_update'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_getOwner(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getOwner'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_getOwner'", nullptr); + return 0; + } + cocos2d::Node* ret = cobj->getOwner(); + object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getOwner",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getOwner'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_init(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_init'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_init'", nullptr); + return 0; + } + bool ret = cobj->init(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:init",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_init'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_onAdd(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onAdd'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onAdd'", nullptr); + return 0; + } + cobj->onAdd(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onAdd",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onAdd'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_getName(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getName'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_getName'", nullptr); + return 0; + } + const std::string& ret = cobj->getName(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getName",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getName'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Node* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } + cobj->setOwner(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Component_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_create'", nullptr); + return 0; + } + cocos2d::Component* ret = cocos2d::Component::create(); + object_to_luaval(tolua_S, "cc.Component",(cocos2d::Component*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Component:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_Component_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Component)"); + return 0; +} + +int lua_register_cocos2dx_Component(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Component"); + tolua_cclass(tolua_S,"Component","cc.Component","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"Component"); + tolua_function(tolua_S,"setEnabled",lua_cocos2dx_Component_setEnabled); + tolua_function(tolua_S,"setName",lua_cocos2dx_Component_setName); + tolua_function(tolua_S,"isEnabled",lua_cocos2dx_Component_isEnabled); + tolua_function(tolua_S,"onRemove",lua_cocos2dx_Component_onRemove); + tolua_function(tolua_S,"update",lua_cocos2dx_Component_update); + tolua_function(tolua_S,"getOwner",lua_cocos2dx_Component_getOwner); + tolua_function(tolua_S,"init",lua_cocos2dx_Component_init); + tolua_function(tolua_S,"onAdd",lua_cocos2dx_Component_onAdd); + tolua_function(tolua_S,"getName",lua_cocos2dx_Component_getName); + tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); + tolua_function(tolua_S,"create", lua_cocos2dx_Component_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::Component).name(); + g_luaType[typeName] = "cc.Component"; + g_typeCast["Component"] = "cc.Component"; + return 1; +} + int lua_cocos2dx_Node_addChild(lua_State* tolua_S) { int argc = 0; @@ -85783,552 +86329,6 @@ int lua_register_cocos2dx_TextureCache(lua_State* tolua_S) return 1; } -int lua_cocos2dx_Component_setEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setEnabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Component:setEnabled"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setEnabled'", nullptr); - return 0; - } - cobj->setEnabled(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setEnabled",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_setName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setName'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Component:setName"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setName'", nullptr); - return 0; - } - cobj->setName(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setName",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_isEnabled(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_isEnabled'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_isEnabled'", nullptr); - return 0; - } - bool ret = cobj->isEnabled(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:isEnabled",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_isEnabled'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_onRemove(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onRemove'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onRemove'", nullptr); - return 0; - } - cobj->onRemove(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onRemove",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onRemove'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_update(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_update'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - double arg0; - - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Component:update"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_update'", nullptr); - return 0; - } - cobj->update(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:update",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_update'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_getOwner(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getOwner'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_getOwner'", nullptr); - return 0; - } - cocos2d::Node* ret = cobj->getOwner(); - object_to_luaval(tolua_S, "cc.Node",(cocos2d::Node*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getOwner",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getOwner'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_init(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_init'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_init'", nullptr); - return 0; - } - bool ret = cobj->init(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:init",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_init'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_onAdd(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onAdd'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onAdd'", nullptr); - return 0; - } - cobj->onAdd(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onAdd",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onAdd'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_getName(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_getName'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_getName'", nullptr); - return 0; - } - const std::string& ret = cobj->getName(); - tolua_pushcppstring(tolua_S,ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:getName",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_getName'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Component* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Node* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); - return 0; - } - cobj->setOwner(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_Component_create(lua_State* tolua_S) -{ - int argc = 0; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertable(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; -#endif - - argc = lua_gettop(tolua_S) - 1; - - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_create'", nullptr); - return 0; - } - cocos2d::Component* ret = cocos2d::Component::create(); - object_to_luaval(tolua_S, "cc.Component",(cocos2d::Component*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Component:create",argc, 0); - return 0; -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_create'.",&tolua_err); -#endif - return 0; -} -static int lua_cocos2dx_Component_finalize(lua_State* tolua_S) -{ - printf("luabindings: finalizing LUA object (Component)"); - return 0; -} - -int lua_register_cocos2dx_Component(lua_State* tolua_S) -{ - tolua_usertype(tolua_S,"cc.Component"); - tolua_cclass(tolua_S,"Component","cc.Component","cc.Ref",nullptr); - - tolua_beginmodule(tolua_S,"Component"); - tolua_function(tolua_S,"setEnabled",lua_cocos2dx_Component_setEnabled); - tolua_function(tolua_S,"setName",lua_cocos2dx_Component_setName); - tolua_function(tolua_S,"isEnabled",lua_cocos2dx_Component_isEnabled); - tolua_function(tolua_S,"onRemove",lua_cocos2dx_Component_onRemove); - tolua_function(tolua_S,"update",lua_cocos2dx_Component_update); - tolua_function(tolua_S,"getOwner",lua_cocos2dx_Component_getOwner); - tolua_function(tolua_S,"init",lua_cocos2dx_Component_init); - tolua_function(tolua_S,"onAdd",lua_cocos2dx_Component_onAdd); - tolua_function(tolua_S,"getName",lua_cocos2dx_Component_getName); - tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); - tolua_function(tolua_S,"create", lua_cocos2dx_Component_create); - tolua_endmodule(tolua_S); - std::string typeName = typeid(cocos2d::Component).name(); - g_luaType[typeName] = "cc.Component"; - g_typeCast["Component"] = "cc.Component"; - return 1; -} - int lua_cocos2dx_Device_setAccelerometerEnabled(lua_State* tolua_S) { int argc = 0;