Merge pull request #4483 from samuele3hu/developConversion

Fix:Add more lua binding functions of ScriptHandlerMgr and some constants define
This commit is contained in:
James Chen 2013-12-13 00:23:28 -08:00
commit a52eafc3b8
4 changed files with 138 additions and 4 deletions

View File

@ -1 +1 @@
4604aa76ce1cd72165190c09b5eba4faf2efca40 9104cc5ff14c7548ea6924a2785400db7526c1e1

View File

@ -219,6 +219,7 @@ static void tolua_reg_script_handler_mgr_type(lua_State* tolua_S)
tolua_usertype(tolua_S, "ScheduleHandlerDelegate"); tolua_usertype(tolua_S, "ScheduleHandlerDelegate");
tolua_usertype(tolua_S, "ScriptHandlerMgr"); tolua_usertype(tolua_S, "ScriptHandlerMgr");
} }
/* method: getInstance of class ScriptHandlerMgr */ /* method: getInstance of class ScriptHandlerMgr */
#ifndef TOLUA_DISABLE_tolua_Cocos2d_ScriptHandlerMgr_getInstance00 #ifndef TOLUA_DISABLE_tolua_Cocos2d_ScriptHandlerMgr_getInstance00
static int tolua_Cocos2d_ScriptHandlerMgr_getInstance00(lua_State* tolua_S) static int tolua_Cocos2d_ScriptHandlerMgr_getInstance00(lua_State* tolua_S)
@ -243,6 +244,101 @@ tolua_lerror:
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: registerScriptHandler of class ScriptHandlerMgr */
static int tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
!toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err) ||
!tolua_isnumber(tolua_S, 4, 0, &tolua_err) ||
!tolua_isnoobj(tolua_S,5,&tolua_err) )
goto tolua_lerror;
else
#endif
{
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
#ifndef TOLUA_RELEASE
if (nullptr == scriptHanlderMgr)
{
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00'\n", NULL);
return 0;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,3,0);
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 4, 0);
scriptHanlderMgr->addObjectHandler(tolua_tousertype(tolua_S, 2, 0), handler,handlerType);
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
return 0;
#endif
}
/* method: unregisterScriptHandler of class ScriptHandlerMgr */
static int tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
!tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
!tolua_isnoobj(tolua_S,4,&tolua_err) )
goto tolua_lerror;
else
#endif
{
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
#ifndef TOLUA_RELEASE
if (nullptr == scriptHanlderMgr)
{
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00'\n", NULL);
return 0;
}
#endif
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 3, 0);
scriptHanlderMgr->removeObjectHandler(tolua_tousertype(tolua_S, 2, 0), handlerType);
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'unregisterScriptHandler'.",&tolua_err);
return 0;
#endif
}
/* method: removeObjectAllHandlers of class ScriptHandlerMgr */
static int tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err) )
goto tolua_lerror;
else
#endif
{
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
#ifndef TOLUA_RELEASE
if (nullptr == scriptHanlderMgr)
{
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00'\n", NULL);
return 0;
}
#endif
scriptHanlderMgr->removeObjectAllHandlers(tolua_tousertype(tolua_S, 2, 0));
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'removeObjectAllHandlers'.",&tolua_err);
return 0;
#endif
}
TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S) TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S)
{ {
@ -253,6 +349,9 @@ TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S)
tolua_cclass(tolua_S,"ScriptHandlerMgr","ScriptHandlerMgr","",NULL); tolua_cclass(tolua_S,"ScriptHandlerMgr","ScriptHandlerMgr","",NULL);
tolua_beginmodule(tolua_S, "ScriptHandlerMgr"); tolua_beginmodule(tolua_S, "ScriptHandlerMgr");
tolua_function(tolua_S, "getInstance", tolua_Cocos2d_ScriptHandlerMgr_getInstance00); tolua_function(tolua_S, "getInstance", tolua_Cocos2d_ScriptHandlerMgr_getInstance00);
tolua_function(tolua_S, "registerScriptHandler", tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00);
tolua_function(tolua_S, "unregisterScriptHandler", tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00);
tolua_function(tolua_S, "removeObjectAllHandlers", tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
return 1; return 1;

View File

@ -134,9 +134,6 @@ private:
NS_CC_END NS_CC_END
TOLUA_API int tolua_Cocos2d_GLNode_registerScriptDrawHandler00(lua_State* tolua_S);
TOLUA_API int tolua_Cocos2d_GLNode_unregisterScriptDrawHandler00(lua_State* tolua_S);
TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S); TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S);
#endif //__LUA_SCRIPT_HANDLER_MGR_H__ #endif //__LUA_SCRIPT_HANDLER_MGR_H__

View File

@ -288,4 +288,42 @@ cc.ASSETSMANAGER_UNCOMPRESS = 3
cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0 cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0
cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1 cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1
cc.ASSETSMANAGER_PROTOCOL_ERROR = 2 cc.ASSETSMANAGER_PROTOCOL_ERROR = 2
cc.HANDLERTYPE_NODE = 0
cc.HANDLERTYPE_MENU_CLICKED = 1
cc.HANDLERTYPE_NOTIFICATION = 2
cc.HANDLERTYPE_CALLFUNC = 3
cc.HANDLERTYPE_SCHEDULE = 4
cc.HANDLERTYPE_TOUCHES = 5
cc.HANDLERTYPE_KEYPAD = 6
cc.HANDLERTYPE_ACCELEROMETER = 7
cc.HANDLERTYPE_CONTROL_TOUCH_DOWN = 8
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_INSIDE = 9
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_OUTSIDE = 10
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_ENTER = 11
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_EXIT = 12
cc.HANDLERTYPE_CONTROL_TOUCH_UP_INSIDE = 13
cc.HANDLERTYPE_CONTROL_TOUCH_UP_OUTSIDE = 14
cc.HANDLERTYPE_CONTROL_TOUCH_UP_CANCEL = 15
cc.HANDLERTYPE_CONTROL_VALUE_CHANGED = 16
cc.HANDLERTYPE_WEBSOCKET_OPEN = 17
cc.HANDLERTYPE_WEBSOCKET_MESSAGE = 18
cc.HANDLERTYPE_WEBSOCKET_CLOSE = 19
cc.HANDLERTYPE_WEBSOCKET_ERROR = 20
cc.HANDLERTYPE_GL_NODE_DRAW = 21
cc.HANDLERTYPE_SCROLLVIEW_SCROLL = 22
cc.HANDLERTYPE_SCROLLVIEW_ZOOM = 23
cc.HANDLERTYPE_TABLECELL_TOUCHED = 24
cc.HANDLERTYPE_TABLECELL_HIGHLIGHT = 25
cc.HANDLERTYPE_TABLECELL_UNHIGHLIGHT = 26
cc.HANDLERTYPE_TABLECELL_WILL_RECYCLE = 27
cc.HANDLERTYPE_TABLECELL_SIZE_FOR_INDEX = 28
cc.HANDLERTYPE_TABLECELL_AT_INDEX = 29
cc.HANDLERTYPE_TABLEVIEW_NUMS_OF_CELLS = 30
cc.HANDLERTYPE_XMLHTTPREQUEST_READY_STATE_CHANGE = 31
cc.HANDLERTYPE_ASSETSMANAGER_PROGRESS = 32
cc.HANDLERTYPE_ASSETSMANAGER_SUCCESS = 33
cc.HANDLERTYPE_ASSETSMANAGER_ERROR = 34
cc.HANDLERTYPE_EVENT_LISTENER = 35
cc.HANDLERTYPE_ARMATURE_EVENT = 36