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);
 }
Пример #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;
 }
Пример #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);
        }