示例#1
0
        static void ShapeIterator(IntPtr shape, IntPtr data)
        {
            var handle = GCHandle.FromIntPtr(data);
            var action = (Action <Shape>)handle.Target;

            action(Shape.FromIntPtr(shape));
        }
示例#2
0
        static void PostStepForShape(IntPtr space, IntPtr obj, IntPtr data)
        {
            var handle = GCHandle.FromIntPtr(data);
            var action = (Action <Shape>)handle.Target;

            handle.Free();
            action(obj == IntPtr.Zero ? null :  Shape.FromIntPtr(obj));
        }
        public void GetShapes(out Shape shapeA, out Shape shapeB)
        {
            IntPtr a, b;

            __cpArbiterGetShapes(Handle.Handle, out a, out b);
            shapeA = Shape.FromIntPtr(a);
            shapeB = Shape.FromIntPtr(b);
        }
示例#4
0
        public void EachShape(Action <Body, Shape> action)
        {
            ShapeIterator iterator = (body, shape, data) => {
                action(Body.FromIntPtr(body),
                       Shape.FromIntPtr(shape));
            };

            cpBodyEachShape(Handle.Handle, iterator, IntPtr.Zero);
        }