From c12f88d63c05d0509478f370186d2254e99800ad Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 15 Oct 2014 17:33:58 +0800 Subject: [PATCH] =?UTF-8?q?lua=20compiles=20ok=EF=BC=8Dneed=20to=20make=20?= =?UTF-8?q?it=20works=20later?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auto/lua_cocos2dx_spine_auto.cpp | 1344 ++++++++++++++--- .../auto/lua_cocos2dx_spine_auto.hpp | 16 + .../manual/spine/LuaSkeletonAnimation.cpp | 74 +- .../spine/lua_cocos2dx_spine_manual.cpp | 180 +-- tools/tolua/cocos2dx_spine.ini | 7 +- 5 files changed, 1263 insertions(+), 358 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp index 8d94bee826..46b1b7dd97 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp @@ -5,10 +5,10 @@ -int lua_cocos2dx_spine_Skeleton_setToSetupPose(lua_State* tolua_S) +int lua_cocos2dx_spine_SkeletonRenderer_setTimeScale(lua_State* tolua_S) { int argc = 0; - spine::Skeleton* cobj = nullptr; + spine::SkeletonRenderer* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 @@ -17,58 +17,15 @@ int lua_cocos2dx_spine_Skeleton_setToSetupPose(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setToSetupPose'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - cobj->setToSetupPose(); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:setToSetupPose",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_setToSetupPose'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_spine_Skeleton_setBlendFunc(lua_State* tolua_S) -{ - int argc = 0; - spine::Skeleton* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBlendFunc'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setTimeScale'", nullptr); return 0; } #endif @@ -76,29 +33,28 @@ int lua_cocos2dx_spine_Skeleton_setBlendFunc(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - cocos2d::BlendFunc arg0; + double arg0; - #pragma warning NO CONVERSION TO NATIVE FOR BlendFunc - ok = false; + ok &= luaval_to_number(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setTimeScale"); if(!ok) return 0; - cobj->setBlendFunc(arg0); + cobj->setTimeScale(arg0); return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:setBlendFunc",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setTimeScale",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_setBlendFunc'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setTimeScale'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_spine_Skeleton_onDraw(lua_State* tolua_S) +int lua_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB(lua_State* tolua_S) { int argc = 0; - spine::Skeleton* cobj = nullptr; + spine::SkeletonRenderer* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 @@ -107,64 +63,15 @@ int lua_cocos2dx_spine_Skeleton_onDraw(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_onDraw'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - cocos2d::Mat4 arg0; - unsigned int arg1; - - ok &= luaval_to_mat4(tolua_S, 2, &arg0, "sp.Skeleton:onDraw"); - - ok &= luaval_to_uint32(tolua_S, 3,&arg1, "sp.Skeleton:onDraw"); - if(!ok) - return 0; - cobj->onDraw(arg0, arg1); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:onDraw",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_onDraw'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose(lua_State* tolua_S) -{ - int argc = 0; - spine::Skeleton* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB'", nullptr); return 0; } #endif @@ -174,114 +81,24 @@ int lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose(lua_State* tolua_S) { if(!ok) return 0; - cobj->setSlotsToSetupPose(); - return 0; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:setSlotsToSetupPose",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_spine_Skeleton_getBlendFunc(lua_State* tolua_S) -{ - int argc = 0; - spine::Skeleton* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_getBlendFunc'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); - blendfunc_to_luaval(tolua_S, ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:getBlendFunc",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_getBlendFunc'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_spine_Skeleton_setSkin(lua_State* tolua_S) -{ - int argc = 0; - spine::Skeleton* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setSkin'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - const char* arg0; - - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "sp.Skeleton:setSkin"); arg0 = arg0_tmp.c_str(); - if(!ok) - return 0; - bool ret = cobj->setSkin(arg0); + bool ret = cobj->isOpacityModifyRGB(); tolua_pushboolean(tolua_S,(bool)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:setSkin",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:isOpacityModifyRGB",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_setSkin'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_spine_Skeleton_setBonesToSetupPose(lua_State* tolua_S) +int lua_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(lua_State* tolua_S) { int argc = 0; - spine::Skeleton* cobj = nullptr; + spine::SkeletonRenderer* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 @@ -290,15 +107,105 @@ int lua_cocos2dx_spine_Skeleton_setBonesToSetupPose(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_setBonesToSetupPose'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setDebugSlotsEnabled"); + if(!ok) + return 0; + cobj->setDebugSlotsEnabled(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setDebugSlotsEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + bool ret = cobj->getDebugSlotsEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:getDebugSlotsEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose'", nullptr); return 0; } #endif @@ -311,42 +218,866 @@ int lua_cocos2dx_spine_Skeleton_setBonesToSetupPose(lua_State* tolua_S) cobj->setBonesToSetupPose(); return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:setBonesToSetupPose",argc, 0); + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setBonesToSetupPose",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_setBonesToSetupPose'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose'.",&tolua_err); #endif return 0; } -static int lua_cocos2dx_spine_Skeleton_finalize(lua_State* tolua_S) +int lua_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose(lua_State* tolua_S) { - printf("luabindings: finalizing LUA object (Skeleton)"); + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->setSlotsToSetupPose(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setSlotsToSetupPose",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_setSkin(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setSkin'", 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, "sp.SkeletonRenderer:setSkin"); + if(!ok) + return 0; + bool ret = cobj->setSkin(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setSkin",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setSkin'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_setToSetupPose(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setToSetupPose'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + cobj->setToSetupPose(); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setToSetupPose",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setToSetupPose'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setOpacityModifyRGB"); + if(!ok) + return 0; + cobj->setOpacityModifyRGB(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setOpacityModifyRGB",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setDebugBonesEnabled"); + if(!ok) + return 0; + cobj->setDebugBonesEnabled(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setDebugBonesEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_getSkeleton(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_getSkeleton'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + spSkeleton* ret = cobj->getSkeleton(); + #pragma warning NO CONVERSION FROM NATIVE FOR spSkeleton*; + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:getSkeleton",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_getSkeleton'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + bool ret = cobj->getDebugBonesEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:getDebugBonesEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_getTimeScale(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonRenderer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonRenderer_getTimeScale'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getTimeScale(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:getTimeScale",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_getTimeScale'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonRenderer_createWithFile(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,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 2) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1); + object_to_luaval(tolua_S, "sp.SkeletonRenderer",(spine::SkeletonRenderer*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); + object_to_luaval(tolua_S, "sp.SkeletonRenderer",(spine::SkeletonRenderer*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 2) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + spAtlas* arg1; + #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* + ok = false; + if (!ok) { break; } + spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1); + object_to_luaval(tolua_S, "sp.SkeletonRenderer",(spine::SkeletonRenderer*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + spAtlas* arg1; + #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* + ok = false; + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonRenderer:createWithFile"); + if (!ok) { break; } + spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2); + object_to_luaval(tolua_S, "sp.SkeletonRenderer",(spine::SkeletonRenderer*)ret); + return 1; + } + } while (0); + ok = true; + CCLOG("%s has wrong number of arguments: %d, was expecting %d", "sp.SkeletonRenderer:createWithFile",argc, 2); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonRenderer_createWithFile'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_spine_SkeletonRenderer_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (SkeletonRenderer)"); return 0; } -int lua_register_cocos2dx_spine_Skeleton(lua_State* tolua_S) +int lua_register_cocos2dx_spine_SkeletonRenderer(lua_State* tolua_S) { - tolua_usertype(tolua_S,"sp.Skeleton"); - tolua_cclass(tolua_S,"Skeleton","sp.Skeleton","cc.Node",nullptr); + tolua_usertype(tolua_S,"sp.SkeletonRenderer"); + tolua_cclass(tolua_S,"SkeletonRenderer","sp.SkeletonRenderer","cc.Node",nullptr); - tolua_beginmodule(tolua_S,"Skeleton"); - tolua_function(tolua_S,"setToSetupPose",lua_cocos2dx_spine_Skeleton_setToSetupPose); - tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_spine_Skeleton_setBlendFunc); - tolua_function(tolua_S,"onDraw",lua_cocos2dx_spine_Skeleton_onDraw); - tolua_function(tolua_S,"setSlotsToSetupPose",lua_cocos2dx_spine_Skeleton_setSlotsToSetupPose); - tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_spine_Skeleton_getBlendFunc); - tolua_function(tolua_S,"setSkin",lua_cocos2dx_spine_Skeleton_setSkin); - tolua_function(tolua_S,"setBonesToSetupPose",lua_cocos2dx_spine_Skeleton_setBonesToSetupPose); + tolua_beginmodule(tolua_S,"SkeletonRenderer"); + tolua_function(tolua_S,"setTimeScale",lua_cocos2dx_spine_SkeletonRenderer_setTimeScale); + tolua_function(tolua_S,"isOpacityModifyRGB",lua_cocos2dx_spine_SkeletonRenderer_isOpacityModifyRGB); + tolua_function(tolua_S,"setDebugSlotsEnabled",lua_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled); + tolua_function(tolua_S,"getDebugSlotsEnabled",lua_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled); + tolua_function(tolua_S,"setBonesToSetupPose",lua_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose); + tolua_function(tolua_S,"setSlotsToSetupPose",lua_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose); + tolua_function(tolua_S,"setSkin",lua_cocos2dx_spine_SkeletonRenderer_setSkin); + tolua_function(tolua_S,"setToSetupPose",lua_cocos2dx_spine_SkeletonRenderer_setToSetupPose); + tolua_function(tolua_S,"setOpacityModifyRGB",lua_cocos2dx_spine_SkeletonRenderer_setOpacityModifyRGB); + tolua_function(tolua_S,"setDebugBonesEnabled",lua_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled); + tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_spine_SkeletonRenderer_getSkeleton); + tolua_function(tolua_S,"getDebugBonesEnabled",lua_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled); + tolua_function(tolua_S,"getTimeScale",lua_cocos2dx_spine_SkeletonRenderer_getTimeScale); + tolua_function(tolua_S,"createWithFile", lua_cocos2dx_spine_SkeletonRenderer_createWithFile); tolua_endmodule(tolua_S); - std::string typeName = typeid(spine::Skeleton).name(); - g_luaType[typeName] = "sp.Skeleton"; - g_typeCast["Skeleton"] = "sp.Skeleton"; + std::string typeName = typeid(spine::SkeletonRenderer).name(); + g_luaType[typeName] = "sp.SkeletonRenderer"; + g_typeCast["SkeletonRenderer"] = "sp.SkeletonRenderer"; return 1; } +int lua_cocos2dx_spine_SkeletonAnimation_setStartListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setStartListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::function arg0; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setStartListener(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setStartListener",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setStartListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setTrackEventListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackEventListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + spTrackEntry* arg0; + std::function arg1; + + #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* + ok = false; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setTrackEventListener(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setTrackEventListener",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackEventListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + spTrackEntry* arg0; + std::function arg1; + + #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* + ok = false; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setTrackCompleteListener(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setTrackCompleteListener",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackStartListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + spTrackEntry* arg0; + std::function arg1; + + #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* + ok = false; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setTrackStartListener(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setTrackStartListener",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackStartListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setCompleteListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setCompleteListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::function arg0; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setCompleteListener(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setCompleteListener",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setCompleteListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackEndListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + spTrackEntry* arg0; + std::function arg1; + + #pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry* + ok = false; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setTrackEndListener(arg0, arg1); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setTrackEndListener",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setTrackEndListener'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_spine_SkeletonAnimation_setEventListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setEventListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::function arg0; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setEventListener(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setEventListener",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setEventListener'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_spine_SkeletonAnimation_setMix(lua_State* tolua_S) { int argc = 0; @@ -375,13 +1106,13 @@ int lua_cocos2dx_spine_SkeletonAnimation_setMix(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 3) { - const char* arg0; - const char* arg1; + std::string arg0; + std::string arg1; double arg2; - std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp, "sp.SkeletonAnimation:setMix"); arg0 = arg0_tmp.c_str(); + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:setMix"); - std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "sp.SkeletonAnimation:setMix"); arg1 = arg1_tmp.c_str(); + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonAnimation:setMix"); ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonAnimation:setMix"); if(!ok) @@ -399,6 +1130,56 @@ int lua_cocos2dx_spine_SkeletonAnimation_setMix(lua_State* tolua_S) return 0; } +int lua_cocos2dx_spine_SkeletonAnimation_setEndListener(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_setEndListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::function arg0; + + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + if(!ok) + return 0; + cobj->setEndListener(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonAnimation:setEndListener",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_setEndListener'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_spine_SkeletonAnimation_clearTracks(lua_State* tolua_S) { int argc = 0; @@ -495,6 +1276,100 @@ int lua_cocos2dx_spine_SkeletonAnimation_clearTrack(lua_State* tolua_S) return 0; } +int lua_cocos2dx_spine_SkeletonAnimation_createWithFile(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,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 2) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); + object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); + object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 2) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + spAtlas* arg1; + #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* + ok = false; + if (!ok) { break; } + spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1); + object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 3) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + spAtlas* arg1; + #pragma warning NO CONVERSION TO NATIVE FOR spAtlas* + ok = false; + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "sp.SkeletonAnimation:createWithFile"); + if (!ok) { break; } + spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2); + object_to_luaval(tolua_S, "sp.SkeletonAnimation",(spine::SkeletonAnimation*)ret); + return 1; + } + } while (0); + ok = true; + CCLOG("%s has wrong number of arguments: %d, was expecting %d", "sp.SkeletonAnimation:createWithFile",argc, 2); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_createWithFile'.",&tolua_err); +#endif + return 0; +} static int lua_cocos2dx_spine_SkeletonAnimation_finalize(lua_State* tolua_S) { printf("luabindings: finalizing LUA object (SkeletonAnimation)"); @@ -504,12 +1379,21 @@ static int lua_cocos2dx_spine_SkeletonAnimation_finalize(lua_State* tolua_S) int lua_register_cocos2dx_spine_SkeletonAnimation(lua_State* tolua_S) { tolua_usertype(tolua_S,"sp.SkeletonAnimation"); - tolua_cclass(tolua_S,"SkeletonAnimation","sp.SkeletonAnimation","sp.Skeleton",nullptr); + tolua_cclass(tolua_S,"SkeletonAnimation","sp.SkeletonAnimation","sp.SkeletonRenderer",nullptr); tolua_beginmodule(tolua_S,"SkeletonAnimation"); + tolua_function(tolua_S,"setStartListener",lua_cocos2dx_spine_SkeletonAnimation_setStartListener); + tolua_function(tolua_S,"setTrackEventListener",lua_cocos2dx_spine_SkeletonAnimation_setTrackEventListener); + tolua_function(tolua_S,"setTrackCompleteListener",lua_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener); + tolua_function(tolua_S,"setTrackStartListener",lua_cocos2dx_spine_SkeletonAnimation_setTrackStartListener); + tolua_function(tolua_S,"setCompleteListener",lua_cocos2dx_spine_SkeletonAnimation_setCompleteListener); + tolua_function(tolua_S,"setTrackEndListener",lua_cocos2dx_spine_SkeletonAnimation_setTrackEndListener); + tolua_function(tolua_S,"setEventListener",lua_cocos2dx_spine_SkeletonAnimation_setEventListener); tolua_function(tolua_S,"setMix",lua_cocos2dx_spine_SkeletonAnimation_setMix); + tolua_function(tolua_S,"setEndListener",lua_cocos2dx_spine_SkeletonAnimation_setEndListener); tolua_function(tolua_S,"clearTracks",lua_cocos2dx_spine_SkeletonAnimation_clearTracks); tolua_function(tolua_S,"clearTrack",lua_cocos2dx_spine_SkeletonAnimation_clearTrack); + tolua_function(tolua_S,"createWithFile", lua_cocos2dx_spine_SkeletonAnimation_createWithFile); tolua_endmodule(tolua_S); std::string typeName = typeid(spine::SkeletonAnimation).name(); g_luaType[typeName] = "sp.SkeletonAnimation"; @@ -523,7 +1407,7 @@ TOLUA_API int register_all_cocos2dx_spine(lua_State* tolua_S) tolua_module(tolua_S,"sp",0); tolua_beginmodule(tolua_S,"sp"); - lua_register_cocos2dx_spine_Skeleton(tolua_S); + lua_register_cocos2dx_spine_SkeletonRenderer(tolua_S); lua_register_cocos2dx_spine_SkeletonAnimation(tolua_S); tolua_endmodule(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp index aedd24b3f5..eacf39fb30 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp @@ -19,6 +19,22 @@ int register_all_cocos2dx_spine(lua_State* tolua_S); + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp b/cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp index 5620f3f892..ff215fa202 100644 --- a/cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp +++ b/cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp @@ -54,43 +54,43 @@ static int SendSpineEventToLua(int nHandler, spine::SkeletonAnimation* node, int int nRet = 0; - spTrackEntry* entry = spAnimationState_getCurrent(node->state, trackIndex); - std::string animationName = (entry && entry->animation) ? entry->animation->name : ""; - std::string eventType = ""; +// spTrackEntry* entry = spAnimationState_getCurrent(node->state, trackIndex); +// std::string animationName = (entry && entry->animation) ? entry->animation->name : ""; +// std::string eventType = ""; +// +// switch (type) { +// case ANIMATION_START: +// eventType = "start"; +// break; +// case ANIMATION_END: +// eventType = "end"; +// break; +// case ANIMATION_COMPLETE: +// eventType = "complete"; +// break; +// case ANIMATION_EVENT: +// eventType = "event"; +// break; +// } - switch (type) { - case ANIMATION_START: - eventType = "start"; - break; - case ANIMATION_END: - eventType = "end"; - break; - case ANIMATION_COMPLETE: - eventType = "complete"; - break; - case ANIMATION_EVENT: - eventType = "event"; - break; - } - - LuaValueDict spineEvent; - spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventType))); - spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex))); - spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("animation", LuaValue::stringValue(animationName))); - spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("loopCount", LuaValue::intValue(loopCount))); - - if (NULL != event) { - LuaValueDict eventData; - eventData.insert(eventData.end(), LuaValueDict::value_type("name", LuaValue::stringValue(event->data->name))); - eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->intValue))); - eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->floatValue))); - eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->stringValue))); - spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("eventData", LuaValue::dictValue(eventData))); - } - - pStack->pushLuaValueDict(spineEvent); - nRet = pStack->executeFunctionByHandler(nHandler, 1); - pStack->clean(); +// LuaValueDict spineEvent; +// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("type", LuaValue::stringValue(eventType))); +// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("trackIndex", LuaValue::intValue(trackIndex))); +// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("animation", LuaValue::stringValue(animationName))); +// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("loopCount", LuaValue::intValue(loopCount))); +// +// if (NULL != event) { +// LuaValueDict eventData; +// eventData.insert(eventData.end(), LuaValueDict::value_type("name", LuaValue::stringValue(event->data->name))); +// eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->intValue))); +// eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->floatValue))); +// eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->stringValue))); +// spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("eventData", LuaValue::dictValue(eventData))); +// } +// +// pStack->pushLuaValueDict(spineEvent); +// nRet = pStack->executeFunctionByHandler(nHandler, 1); +// pStack->clean(); return nRet; } @@ -98,7 +98,7 @@ static int SendSpineEventToLua(int nHandler, spine::SkeletonAnimation* node, int LuaSkeletonAnimation::LuaSkeletonAnimation (const char* skeletonDataFile, const char* atlasFile, float scale) : spine::SkeletonAnimation(skeletonDataFile, atlasFile, scale) { - this->setAnimationListener(this, animationStateEvent_selector(LuaSkeletonAnimation::animationStateEvent)); + //this->setAnimationListener(this, animationStateEvent_selector(LuaSkeletonAnimation::animationStateEvent)); } diff --git a/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp b/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp index 3c504fd3d6..8e8ad56a28 100644 --- a/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp @@ -196,110 +196,114 @@ tolua_lerror: static int tolua_Cocos2d_CCSkeletonAnimation_setTimeScale00(lua_State* tolua_S) { -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); - if (NULL != self ) { - LUA_NUMBER scale = tolua_tonumber(tolua_S, 2, 1); - self->timeScale = scale; - } - } return 0; -#ifndef TOLUA_RELEASE -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'setTimeScale'.",&tolua_err); - return 0; -#endif +//#ifndef TOLUA_RELEASE +// tolua_Error tolua_err; +// if ( +// !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || +// !tolua_isnumber(tolua_S,2,0,&tolua_err) || +// !tolua_isnoobj(tolua_S,3,&tolua_err) +// ) +// goto tolua_lerror; +// else +//#endif +// { +// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); +// if (NULL != self ) { +// LUA_NUMBER scale = tolua_tonumber(tolua_S, 2, 1); +// self->timeScale = scale; +// } +// } +// return 0; +//#ifndef TOLUA_RELEASE +//tolua_lerror: +// tolua_error(tolua_S,"#ferror in function 'setTimeScale'.",&tolua_err); +// return 0; +//#endif } static int tolua_Cocos2d_CCSkeletonAnimation_setDebugSlots00(lua_State* tolua_S) { -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); - if (NULL != self ) { - bool debugSlots = tolua_toboolean(tolua_S, 2, 1); - self->debugSlots = debugSlots; - } - } return 0; -#ifndef TOLUA_RELEASE -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'setDebugSlots'.",&tolua_err); - return 0; -#endif +//#ifndef TOLUA_RELEASE +// tolua_Error tolua_err; +// if ( +// !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || +// !tolua_isboolean(tolua_S,2,0,&tolua_err) || +// !tolua_isnoobj(tolua_S,3,&tolua_err) +// ) +// goto tolua_lerror; +// else +//#endif +// { +// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); +// if (NULL != self ) { +// bool debugSlots = tolua_toboolean(tolua_S, 2, 1); +// self->debugSlots = debugSlots; +// } +// } +// return 0; +//#ifndef TOLUA_RELEASE +//tolua_lerror: +// tolua_error(tolua_S,"#ferror in function 'setDebugSlots'.",&tolua_err); +// return 0; +//#endif } static int tolua_Cocos2d_CCSkeletonAnimation_setDebugBones00(lua_State* tolua_S) { -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); - if (NULL != self ) { - bool debugBones = tolua_toboolean(tolua_S, 2, 1); - self->debugBones = debugBones; - } - } return 0; -#ifndef TOLUA_RELEASE -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'setDebugBones'.",&tolua_err); - return 0; -#endif +//#ifndef TOLUA_RELEASE +// tolua_Error tolua_err; +// if ( +// !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || +// !tolua_isboolean(tolua_S,2,0,&tolua_err) || +// !tolua_isnoobj(tolua_S,3,&tolua_err) +// ) +// goto tolua_lerror; +// else +//#endif +// { +// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); +// if (NULL != self ) { +// bool debugBones = tolua_toboolean(tolua_S, 2, 1); +// self->debugBones = debugBones; +// } +// } +// return 0; +//#ifndef TOLUA_RELEASE +//tolua_lerror: +// tolua_error(tolua_S,"#ferror in function 'setDebugBones'.",&tolua_err); +// return 0; +//#endif } static int tolua_Cocos2d_CCSkeletonAnimation_setPremultipliedAlpha00(lua_State* tolua_S) { -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); - if (NULL != self ) { - bool premultipliedAlpha = tolua_toboolean(tolua_S, 2, 1); - self->premultipliedAlpha = premultipliedAlpha; - } - } return 0; -#ifndef TOLUA_RELEASE -tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'setPremultipliedAlpha'.",&tolua_err); - return 0; -#endif +//#ifndef TOLUA_RELEASE +// tolua_Error tolua_err; +// if ( +// !tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err) || +// !tolua_isboolean(tolua_S,2,0,&tolua_err) || +// !tolua_isnoobj(tolua_S,3,&tolua_err) +// ) +// goto tolua_lerror; +// else +//#endif +// { +// LuaSkeletonAnimation* self = (LuaSkeletonAnimation*) tolua_tousertype(tolua_S,1,0); +// if (NULL != self ) { +// bool premultipliedAlpha = tolua_toboolean(tolua_S, 2, 1); +// self->premultipliedAlpha = premultipliedAlpha; +// } +// } +// return 0; +//#ifndef TOLUA_RELEASE +//tolua_lerror: +// tolua_error(tolua_S,"#ferror in function 'setPremultipliedAlpha'.",&tolua_err); +// return 0; +//#endif } diff --git a/tools/tolua/cocos2dx_spine.ini b/tools/tolua/cocos2dx_spine.ini index b43c0ca4e3..8911bb9cff 100644 --- a/tools/tolua/cocos2dx_spine.ini +++ b/tools/tolua/cocos2dx_spine.ini @@ -27,7 +27,7 @@ headers = %(cocosdir)s/cocos/editor-support/spine/spine-cocos2dx.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Skeleton SkeletonAnimation +classes = SkeletonRenderer SkeletonAnimation # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -36,8 +36,9 @@ classes = Skeleton SkeletonAnimation # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = Skeleton::[findBone findSlot getAttachment setAttachment update draw createWith.*], - SkeletonAnimation::[addAnimationState setAnimationStateData update createWith.* (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent] +skip = SkeletonRenderer::[findBone findSlot getAttachment setAttachment update draw createWithData (s|g)etBlendFunc], + *::[update draw drawSkeleton], + SkeletonAnimation::[setAnimationStateData createWithData (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent onTrackEntryEvent getState] rename_functions =