Example #1
0
        public static void GetEx(this ObjectTranslator t, RealStatePtr L, int index, out Core.Math.Rect val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathRect_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Rect");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for Core.Math.Rect");
                }
            }
            else if (type == LuaTypes.LUA_TTABLE)
            {
                PackUnpack.UnPack(t, L, index, out val);
            }
            else
            {
                val = (Core.Math.Rect)t.objectCasters.GetCaster(typeof(Core.Math.Rect))(L, index, null);
            }
        }
Example #2
0
        public static void PushCoreMathRect(this ObjectTranslator t, RealStatePtr L, Core.Math.Rect val)
        {
            if (CoreMathRect_TypeID == -1)
            {
                bool is_first;
                CoreMathRect_TypeID = t.getTypeId(L, typeof(Core.Math.Rect), out is_first);
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 0, CoreMathRect_TypeID);

            if (!PackUnpack.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for Core.Math.Rect ,value=" + val);
            }
        }
Example #3
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    float x      = (float)LuaAPI.lua_tonumber(L, 2);
                    float y      = (float)LuaAPI.lua_tonumber(L, 3);
                    float width  = (float)LuaAPI.lua_tonumber(L, 4);
                    float height = (float)LuaAPI.lua_tonumber(L, 5);

                    Core.Math.Rect __cl_gen_ret = new Core.Math.Rect(x, y, width, height);
                    translator.PushCoreMathRect(L, __cl_gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <Core.Math.Vec2>(L, 2) && translator.Assignable <Core.Math.Vec2>(L, 3))
                {
                    Core.Math.Vec2 position; translator.Get(L, 2, out position);
                    Core.Math.Vec2 size; translator.Get(L, 3, out size);

                    Core.Math.Rect __cl_gen_ret = new Core.Math.Rect(position, size);
                    translator.PushCoreMathRect(L, __cl_gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <Core.Math.Rect>(L, 2))
                {
                    Core.Math.Rect source; translator.Get(L, 2, out source);

                    Core.Math.Rect __cl_gen_ret = new Core.Math.Rect(source);
                    translator.PushCoreMathRect(L, __cl_gen_ret);

                    return(1);
                }

                if (LuaAPI.lua_gettop(L) == 1)
                {
                    translator.PushCoreMathRect(L, default(Core.Math.Rect));
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to Core.Math.Rect constructor!"));
        }
Example #4
0
        static int _m_MinMaxRect_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    float xmin = (float)LuaAPI.lua_tonumber(L, 1);
                    float ymin = (float)LuaAPI.lua_tonumber(L, 2);
                    float xmax = (float)LuaAPI.lua_tonumber(L, 3);
                    float ymax = (float)LuaAPI.lua_tonumber(L, 4);

                    Core.Math.Rect __cl_gen_ret = Core.Math.Rect.MinMaxRect(xmin, ymin, xmax, ymax);
                    translator.PushCoreMathRect(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #5
0
        public static bool UnPack(IntPtr buff, int offset, out Core.Math.Rect field)
        {
            field = default(Core.Math.Rect);

            return(true);
        }
Example #6
0
 public static bool Pack(IntPtr buff, int offset, Core.Math.Rect field)
 {
     return(true);
 }
Example #7
0
 public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Core.Math.Rect val)
 {
     val = new Core.Math.Rect();
     int top = LuaAPI.lua_gettop(L);
 }
Example #8
0
        public static void UpdateCoreMathRect(this ObjectTranslator t, RealStatePtr L, int index, Core.Math.Rect val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathRect_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Rect");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.Pack(buff, 0, val))
                {
                    throw new Exception("pack fail for Core.Math.Rect ,value=" + val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }