LuaCocoStudioEventListener* LuaCocoStudioEventListener::create() { LuaCocoStudioEventListener* listener = new LuaCocoStudioEventListener(); if (nullptr == listener) return nullptr; listener->autorelease(); return listener; }
LuaCocoStudioEventListener* LuaCocoStudioEventListener::create() { LuaCocoStudioEventListener* listener = new LuaCocoStudioEventListener(); if (NULL == listener) return NULL; listener->autorelease(); return listener; }
static int tolua_Cocos2dx_Widget_addTouchEventListener00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"Widget",0,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else #endif { Widget* self = (Widget*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'addTouchEventListener'", NULL); #endif LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create(); if (NULL == listener) { tolua_error(tolua_S,"LuaCocoStudioEventListener create fail\n", NULL); return 0; } LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0)); listener->setHandler(handler); CCDictionary* dict = static_cast<CCDictionary*>(self->getScriptObjectDict()); if (NULL == dict) { dict = CCDictionary::create(); self->setScriptObjectDict(dict); } dict->setObject(listener, "widgetTouchEvent"); self->addTouchEventListener(listener, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc)); } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'addTouchEventListener'.",&tolua_err); return 0; #endif }