Exemple #1
0
    }                                    // hide default constructor

    // create a new T object and
    // push onto the Lua stack a userdata containing a pointer to T object
    private static int new_T(Lua.lua_State L)
    {
        Lua.lua_remove(L, 1);                                         // use classname:new(), instead of classname.new()
        LWF.BitmapClip obj = LunaTraits_LWF_BitmapClip._bind_ctor(L); // call constructor for T objects
        push(L, obj, true);
        return(1);                                                    // userdata containing pointer to T object
    }
Exemple #2
0
    public static void Destroy(Lua.lua_State L, LWF.BitmapClip obj)
    {
        int objectId = -1;

        if (objectIdentifiers[L].TryGetValue(obj, out objectId))
        {
            objectIdentifiers[L].Remove(obj);
            objects[L].Remove(objectId);
        }
    }
Exemple #3
0
        public BitmapClip GetAttachedBitmap(int depth)
        {
            if (m_bitmapClips == null)
            {
                return(null);
            }
            BitmapClip bitmap = null;

            m_bitmapClips.TryGetValue(depth, out bitmap);
            return(bitmap);
        }
Exemple #4
0
 public static int _bind_getLWF(Lua.lua_State L)
 {
     if (Lua.lua_gettop(L) != 1 || Luna.get_uniqueid(L, 1) !=
         LunaTraits_LWF_BitmapClip.uniqueID)
     {
         Luna.printStack(L);
         Lua.luaL_error(L, "luna typecheck failed: LWF.BitmapClip.lwf");
     }
     LWF.BitmapClip a =
         Luna_LWF_BitmapClip.check(L, 1);
     Luna_LWF_LWF.push(L, a.lwf, false);
     return(1);
 }
Exemple #5
0
 public static int _bind_getName(Lua.lua_State L)
 {
     if (Lua.lua_gettop(L) != 1 ||
         Luna.get_uniqueid(L, 1) != 55459900)
     {
         Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:getName(LWF.BitmapClip self ...)");
     }
     LWF.BitmapClip o = Luna_LWF_BitmapClip.check(L, 1);
     try {
         string ret = getName(o);
         Lua.lua_pushstring(L, ret);
     } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
     return(1);
 }
Exemple #6
0
    public static int _bind_detachFromParent(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 1 ||
            Luna.get_uniqueid(L, 1) != 55459900)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:detachFromParent(LWF.BitmapClip self)");
        }

        LWF.BitmapClip self = Luna_LWF_BitmapClip.check(L, 1);
        try {
            self.DetachFromParent();
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemple #7
0
        public void DetachBitmap(int depth)
        {
            if (m_bitmapClips == null)
            {
                return;
            }
            BitmapClip bitmapClip = null;

            if (!m_bitmapClips.TryGetValue(depth, out bitmapClip))
            {
                return;
            }
            bitmapClip.Destroy();
            m_bitmapClips.Remove(depth);
        }
Exemple #8
0
    public static int _bind__property_get_originalHeight(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 1 ||
            Luna.get_uniqueid(L, 1) != 55459900)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:_property_get_originalHeight(LWF.BitmapClip a)");
        }

        LWF.BitmapClip a = Luna_LWF_BitmapClip.check(L, 1);
        try {
            float ret = _property_get_originalHeight(a);
            Lua.lua_pushnumber(L, ret);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(1);
    }
Exemple #9
0
    public static int _bind__property_get_visible(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 1 ||
            Luna.get_uniqueid(L, 1) != 55459900)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:_property_get_visible(LWF.BitmapClip a)");
        }

        LWF.BitmapClip a = Luna_LWF_BitmapClip.check(L, 1);
        try {
            bool ret = _property_get_visible(a);
            Lua.lua_pushboolean(L, ret?1:0);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(1);
    }
Exemple #10
0
    public static int _bind__property_set_visible(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 2 ||
            Luna.get_uniqueid(L, 1) != 55459900 ||
            !Lua.lua_isboolean(L, 2))
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:_property_set_visible(LWF.BitmapClip a, bool b)");
        }

        LWF.BitmapClip a = Luna_LWF_BitmapClip.check(L, 1);
        bool           b = (bool)(Lua.lua_toboolean(L, 2) != 0);

        try {
            _property_set_visible(a, b);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemple #11
0
    public static int _bind__property_set_originalHeight(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 2 ||
            Luna.get_uniqueid(L, 1) != 55459900 ||
            Lua.lua_isnumber(L, 2) == 0)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:_property_set_originalHeight(LWF.BitmapClip a, float b)");
        }

        LWF.BitmapClip a = Luna_LWF_BitmapClip.check(L, 1);
        float          b = (float)(float)Lua.lua_tonumber(L, 2);

        try {
            _property_set_originalHeight(a, b);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemple #12
0
    private static int tostring_T(Lua.lua_State L)
    {
        byte[] d = (byte[])Lua.lua_touserdata(L, 1);
        if (d == null)
        {
            Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, 1, LunaTraits_LWF_BitmapClip.className);
        }
        Luna.userdataType ud  = new Luna.userdataType(d);
        LWF.BitmapClip    obj = null;
        if (!objects[L].TryGetValue(ud.ObjectId, out obj))
        {
            return(0);
        }

        char[] buff = obj.ToString().ToCharArray(0, 32);
        Lua.lua_pushfstring(L, "%s (%s)", new object[] { LunaTraits_LWF_BitmapClip.className, buff });
        return(1);
    }
Exemple #13
0
 static public LWF.BitmapClip check(Lua.lua_State L, int narg)
 {
     byte[] d = (byte[])Lua.lua_touserdata(L, narg);
     if (d == null)
     {
         Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, narg, LunaTraits_LWF_BitmapClip.className);
     }
     Luna.userdataType ud = new Luna.userdataType(d);
     if (ud.TypeId != LunaTraits_LWF_BitmapClip.uniqueID)       // type checking with almost no overhead
     {
         Luna.print(String.Format("ud.uid: {0} != interface::uid : {1}\n", ud.TypeId, LunaTraits_LWF_BitmapClip.uniqueID));
         Lua.luaL_typerror(L, narg, LunaTraits_LWF_BitmapClip.className);
     }
     LWF.BitmapClip obj = null;
     if (!objects[L].TryGetValue(ud.ObjectId, out obj))
     {
         return(null);
     }
     return(obj);
 }
Exemple #14
0
    // use lunaStack::push if possible.
    public static void push(Lua.lua_State L, LWF.BitmapClip obj, bool gc, Lua.CharPtr metatable = null)
    {
        if (obj == null)
        {
            Lua.lua_pushnil(L);
            return;
        }

        int objectId = -1;

        if (!objectIdentifiers[L].TryGetValue(obj, out objectId))
        {
            objectId = idOffset++;
            objectIdentifiers[L].Add(obj, objectId);
            objects[L].Add(objectId, obj);
        }

        if (metatable == null)
        {
            metatable = LunaTraits_LWF_BitmapClip.className;
        }
        Lua.lua_pushstring(L, "__luna");
        Lua.lua_gettable(L, Lua.LUA_GLOBALSINDEX);
        int __luna = Lua.lua_gettop(L);

        Luna.userdataType ud = new Luna.userdataType(
            objectId: objectId,  // store object in userdata
            gc: gc,              // collect garbage
            has_env: false,      // does this userdata has a table attached to it?
            typeId: LunaTraits_LWF_BitmapClip.uniqueID
            );

        ud.ToBytes((byte[])Lua.lua_newuserdata(L, Luna.userdataType.Size));

        Lua.lua_pushstring(L, metatable);
        Lua.lua_gettable(L, __luna);
        Lua.lua_setmetatable(L, -2);
        //Luna.printStack(L);
        Lua.lua_insert(L, -2);          // swap __luna and userdata
        Lua.lua_pop(L, 1);
    }
Exemple #15
0
        public BitmapClip AttachBitmap(string linkageName, int depth)
        {
            int bitmapId;

            if (!m_lwf.data.bitmapMap.TryGetValue(linkageName, out bitmapId))
            {
                return(null);
            }
            var bitmap = new BitmapClip(m_lwf, this, bitmapId);

            if (m_bitmapClips != null)
            {
                DetachBitmap(depth);
            }
            else
            {
                m_bitmapClips = new BitmapClips();
            }
            m_bitmapClips[depth] = bitmap;
            bitmap.depth         = depth;
            bitmap.name          = linkageName;
            return(bitmap);
        }
Exemple #16
0
    // garbage collection metamethod
    private static int gc_T(Lua.lua_State L)
    {
        byte[] d = (byte[])Lua.lua_touserdata(L, 1);
        if (d == null)
        {
            Luna.print("checkRaw: ud==nil\n"); Lua.luaL_typerror(L, 1, LunaTraits_LWF_BitmapClip.className);
        }
        Luna.userdataType ud = new Luna.userdataType(d);

        LWF.BitmapClip obj = null;
        if (!objects[L].TryGetValue(ud.ObjectId, out obj))
        {
            return(0);
        }

        if (ud.Gc)
        {
            LunaTraits_LWF_BitmapClip._bind_dtor(obj);              // call constructor for T objects
            Destroy(L, obj);
        }

        return(0);
    }
Exemple #17
0
 public static void _property_set_originalHeight(LWF.BitmapClip a, float b)
 {
     a.originalHeight = b;
 }
Exemple #18
0
 static string getName(LWF.BitmapClip o)
 {
     return(o.name);
 }
Exemple #19
0
 public static void _property_set_rotation(LWF.BitmapClip a, float b)
 {
     a.rotation = b;
 }
Exemple #20
0
 public static float _property_get_alpha(LWF.BitmapClip a)
 {
     return(a.alpha);
 }
Exemple #21
0
 public static float _property_get_scaleY(LWF.BitmapClip a)
 {
     return(a.scaleY);
 }
Exemple #22
0
 public static void _bind_dtor(LWF.BitmapClip obj)
 {
 }
Exemple #23
0
 public static void _property_set_alpha(LWF.BitmapClip a, float b)
 {
     a.alpha = b;
 }
Exemple #24
0
 public static float _property_get_offsetY(LWF.BitmapClip a)
 {
     return(a.offsetY);
 }
Exemple #25
0
 public static float _property_get_rotation(LWF.BitmapClip a)
 {
     return(a.rotation);
 }
Exemple #26
0
 public static void _property_set_offsetY(LWF.BitmapClip a, float b)
 {
     a.offsetY = b;
 }
Exemple #27
0
 public static float _property_get_originalHeight(LWF.BitmapClip a)
 {
     return(a.originalHeight);
 }
Exemple #28
0
 public static float _property_get_originalWidth(LWF.BitmapClip a)
 {
     return(a.originalWidth);
 }
Exemple #29
0
 public static void _property_set_originalWidth(LWF.BitmapClip a, float b)
 {
     a.originalWidth = b;
 }
Exemple #30
0
 public static void _property_set_scaleY(LWF.BitmapClip a, float b)
 {
     a.scaleY = b;
 }