This commit is contained in:
leelyn
2020-02-04 21:16:43 +08:00
parent 3a0bc88f6e
commit 41297ecdc3

View File

@@ -2745,6 +2745,105 @@ static int lua_cocos2dx_Texture2D_finalize(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Texture2D_setName(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Texture2D* 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.Texture2D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_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.Texture2D:setName");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Texture2D_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.Texture2D:setName",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_setName'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Texture2D_getName(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Texture2D* 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.Texture2D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_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_Texture2D_getName'", nullptr);
return 0;
}
const std::string& ret = cobj->getName();
lua_pushlstring(tolua_S,ret.c_str(),ret.length());
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Texture2D:getName",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_getName'.",&tolua_err);
#endif
return 0;
}
int lua_register_cocos2dx_Texture2D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Texture2D");
@@ -2756,6 +2855,8 @@ int lua_register_cocos2dx_Texture2D(lua_State* tolua_S)
tolua_function(tolua_S,"setAlphaTexture",lua_cocos2dx_Texture2D_setAlphaTexture);
tolua_function(tolua_S,"getStringForFormat",lua_cocos2dx_Texture2D_getStringForFormat);
tolua_function(tolua_S,"initWithImage",lua_cocos2dx_Texture2D_initWithImage);
tolua_function(tolua_S,"getName",lua_cocos2dx_Texture2D_getName);
tolua_function(tolua_S,"setName",lua_cocos2dx_Texture2D_setName);
tolua_function(tolua_S,"getMaxS",lua_cocos2dx_Texture2D_getMaxS);
tolua_function(tolua_S,"hasPremultipliedAlpha",lua_cocos2dx_Texture2D_hasPremultipliedAlpha);
tolua_function(tolua_S,"getPixelsHigh",lua_cocos2dx_Texture2D_getPixelsHigh);