static void AddRef(ChipmunkObject obj, IntPtr ptr)
 {
     List<ChipmunkObject> list;
     if (!references.TryGetValue (ptr, out list)){
     list = new List<ChipmunkObject> ();
     references.Add (ptr, list);
     }
     list.Add (obj);
 }
Exemplo n.º 2
0
        static void AddRef(ChipmunkObject obj, IntPtr ptr)
        {
            List <ChipmunkObject> list;

            if (!references.TryGetValue(ptr, out list))
            {
                list = new List <ChipmunkObject> ();
                references.Add(ptr, list);
            }
            list.Add(obj);
        }
 static bool RemoveRef(ChipmunkObject obj, IntPtr ptr)
 {
     List<ChipmunkObject> list;
     if (references.TryGetValue (ptr, out list)) {
     list.Remove (obj);
     if (list.Count == 0) {
     references.Remove (ptr);
     return true;
     }
     return false;
     }
     #if DEBUG
     throw new InvalidOperationException ();
     #endif
     return false;
 }
Exemplo n.º 4
0
        static bool RemoveRef(ChipmunkObject obj, IntPtr ptr)
        {
            List <ChipmunkObject> list;

            if (references.TryGetValue(ptr, out list))
            {
                list.Remove(obj);
                if (list.Count == 0)
                {
                    references.Remove(ptr);
                    return(true);
                }
                return(false);
            }
#if DEBUG
            throw new InvalidOperationException();
#endif
            return(false);
        }