Ejemplo n.º 1
0
int lua_cocos2dx_DrawNode3D_drawLine(lua_State* L)
{
    int argc = 0;
    cocos2d::DrawNode3D* cobj = nullptr;
    bool ok  = true;
    
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
#endif
    
    
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(L,1,"cc.DrawNode3D",0,&tolua_err)) goto tolua_lerror;
#endif
    
    cobj = (cocos2d::DrawNode3D*)tolua_tousertype(L,1,0);
    
#if COCOS2D_DEBUG >= 1
    if (!cobj)
    {
        tolua_error(L,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_drawLine'", nullptr);
        return 0;
    }
#endif
    
    argc = lua_gettop(L)-1;
    if (argc == 3)
    {
        cocos2d::Vec3 arg0;
        cocos2d::Vec3 arg1;
        cocos2d::Color4F arg2;
        
        ok &= luaval_to_vec3(L, 2, &arg0, "cc.DrawNode3D:drawLine");
        
        ok &= luaval_to_vec3(L, 3, &arg1, "cc.DrawNode3D:drawLine");
        
        ok &=luaval_to_color4f(L, 4, &arg2, "cc.DrawNode3D:drawLine");
        if(!ok)
            return 0;
        cobj->drawLine(arg0, arg1, arg2);
        return 0;
    }
    CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode3D:drawLine",argc, 3);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(L,"#ferror in function 'lua_cocos2dx_DrawNode3D_drawLine'.",&tolua_err);
#endif
    
    return 0;
}
int tolua_cocos2dx_NVGDrawNode_drawPoints(lua_State* tolua_S)
{
    int argc = 0;
    cocos2d::extension::NVGDrawNode* self = nullptr;
    bool ok  = true;

    tolua_Error tolua_err;

#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(tolua_S,1,"cc.NVGDrawNode",0,&tolua_err)) goto tolua_lerror;
#endif

    self = (cocos2d::extension::NVGDrawNode*)tolua_tousertype(tolua_S,1,0);

#if COCOS2D_DEBUG >= 1
    if (!self)
    {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_NVGDrawNode_drawPoints'", nullptr);
        return 0;
    }
#endif

    argc = lua_gettop(tolua_S)-1;
    if (argc == 3)
    {
        unsigned int size;
        luaval_to_uint32(tolua_S, 3, &size, "cc.NVGDrawNode:drawPoints");
        if ( size > 0 )
        {
            cocos2d::Vec2* points = new cocos2d::Vec2[size];
            if (NULL == points)
                return 0;

            for (int i = 0; i < size; i++)
            {
                lua_pushnumber(tolua_S,i + 1);
                lua_gettable(tolua_S,2);
                if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
                {
                    CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
                    goto tolua_lerror;
#endif
                }

                if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.NVGDrawNode:drawPoints"))
                {
                    lua_pop(tolua_S, 1);
                    CC_SAFE_DELETE_ARRAY(points);
                    return 0;
                }
                lua_pop(tolua_S, 1);
            }

            cocos2d::Color4F arg2;

            ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.NVGDrawNode:drawPoints");
            if(!ok)
                return 0;
            self->drawPoints(points, size, arg2);
            return 0;
        }
    }

    CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.NVGDrawNode:drawPoints",argc, 3);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_NVGDrawNode_drawPoints'.",&tolua_err);
#endif

    return 0;
}
static int tolua_cocos2dx_NVGDrawNode_drawSolidPolygon(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;

    int argc = 0;
    cocos2d::extension::NVGDrawNode* self = nullptr;

    tolua_Error tolua_err;
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(tolua_S,1,"cc.NVGDrawNode",0,&tolua_err)) goto tolua_lerror;
#endif

    self = static_cast<cocos2d::extension::NVGDrawNode*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_NVGDrawNode_drawSolidPolygon'\n", NULL);
        return 0;
    }
#endif

    argc = lua_gettop(tolua_S) - 1;
    if (3 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if(
            !tolua_istable(tolua_S, 2, 0, &tolua_err)  ||
            !tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
            !tolua_istable(tolua_S, 4, 0,&tolua_err) )
        {
            goto tolua_lerror;
        }
#endif
        size_t size = lua_tonumber(tolua_S, 3);
        if ( size > 0 )
        {
            cocos2d::Vec2* points = new cocos2d::Vec2[size];
            if (NULL == points)
                return 0;

            for (int i = 0; i < size; i++)
            {
                lua_pushnumber(tolua_S,i + 1);
                lua_gettable(tolua_S,2);
                if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
                {
                    CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
                    goto tolua_lerror;
#endif
                }

                if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.NVGDrawNode:drawSolidPolygon"))
                {
                    lua_pop(tolua_S, 1);
                    CC_SAFE_DELETE_ARRAY(points);
                    return 0;
                }
                lua_pop(tolua_S, 1);
            }

            Color4F fillColor;
            if (!luaval_to_color4f(tolua_S, 4, &fillColor, "cc.NVGDrawNode:drawPolygon"))
            {
                CC_SAFE_DELETE_ARRAY(points);
                return 0;
            }

            self->drawSolidPolygon(points, (int)size, fillColor);
            CC_SAFE_DELETE_ARRAY(points);
            return 0;
        }
    }

    CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.NVGDrawNode:drawSolidPolygon", argc, 3);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_DrawNode_drawSolidPolygon'.",&tolua_err);
    return 0;
#endif
}
int tolua_cocos2dx_AttackArea_drawPolygon(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;
    
    int argc = 0;
    AttackArea* self = nullptr;
    bool ok  = true;
    
    tolua_Error tolua_err;
    
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(tolua_S,1,"AttackArea",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<AttackArea*>(tolua_tousertype(tolua_S,1,0));
    
#if COCOS2D_DEBUG >= 1
    if (!self)
    {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_AttackArea_drawPolygon'", NULL);
        return 0;
    }
#endif
    
    argc = lua_gettop(tolua_S)-1;
    if (argc == 4)
    {
        unsigned int size;
        luaval_to_uint32(tolua_S, 3, &size, "AttackArea:drawPolygon");
        if ( size > 0 )
        {
            cocos2d::Vec2* points = new cocos2d::Vec2[size];
            if (NULL == points)
                return 0;
            
            for (int i = 0; i < size; i++)
            {
                lua_pushnumber(tolua_S,i + 1);
                lua_gettable(tolua_S,2);
                if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
                {
                    CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
                    goto tolua_lerror;
#endif
                }
                
                if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "AttackArea:drawPolygon"))
                {
                    lua_pop(tolua_S, 1);
                    CC_SAFE_DELETE_ARRAY(points);
                    return 0;
                }
                lua_pop(tolua_S, 1);
            }
            
            bool arg2;
            cocos2d::Color4F arg3;
            
            ok &= luaval_to_boolean(tolua_S, 4,&arg2, "AttackArea:drawPolygon");
            
            ok &= luaval_to_color4f(tolua_S, 5, &arg3, "AttackArea:drawPolygon");
            if(!ok)
                return 0;
            
            self->drawPolygon(points, size, arg2, arg3);
            CC_SAFE_DELETE_ARRAY(points);
            return 0;
        }
    }
    
    CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "AttackArea:drawPolygon",argc, 4);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_AttackArea_drawPolygon'.",&tolua_err);
#endif
    
    return 0;
}
Ejemplo n.º 5
0
int lua_cocos2dx_DrawNode3D_drawCube(lua_State* L)
{
    int argc = 0;
    cocos2d::DrawNode3D* cobj = nullptr;
    bool ok  = true;
    
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
#endif
    
    
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(L,1,"cc.DrawNode3D",0,&tolua_err)) goto tolua_lerror;
#endif
    
    cobj = (cocos2d::DrawNode3D*)tolua_tousertype(L,1,0);
    
#if COCOS2D_DEBUG >= 1
    if (!cobj)
    {
        tolua_error(L,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_drawCube'", nullptr);
        return 0;
    }
#endif
    
    argc = lua_gettop(L)-1;
    if (argc == 2)
    {
        std::vector<cocos2d::Vec3> arg0;
        cocos2d::Color4F arg1;
        Vec3 vec3;
#if COCOS2D_DEBUG >= 1
        if (!tolua_istable(L, 2, 0, &tolua_err))
            goto tolua_lerror;
#endif
        size_t size = lua_objlen(L, 2);
        for (int i = 0; i < size; i++)
        {
            lua_pushnumber(L, i + 1);
            lua_gettable(L, 2);
#if COCOS2D_DEBUG >= 1
            if (!tolua_istable(L, -1, 0, &tolua_err))
            {
                lua_pop(L, 1);
                goto tolua_lerror;
            }
#endif
            ok &= luaval_to_vec3(L, lua_gettop(L), &vec3);
            
#if COCOS2D_DEBUG >= 1
            if (!ok)
            {
                lua_pop(L, 1);
                goto tolua_lerror;
            }
#endif
            //arg0[i] = vec3;
            arg0.push_back(vec3);
            lua_pop(L, 1);
        }
        
        ok &=luaval_to_color4f(L, 3, &arg1, "cc.DrawNode3D:drawCube");
        if(!ok)
            return 0;
        cobj->drawCube(&arg0[0], arg1);
        return 0;
    }
    CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode3D:drawCube",argc, 2);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(L,"#ferror in function 'lua_cocos2dx_DrawNode3D_drawCube'.",&tolua_err);
#endif
    
    return 0;
}