static void ShapeIterator(IntPtr shape, IntPtr data) { var handle = GCHandle.FromIntPtr(data); var action = (Action <Shape>)handle.Target; action(Shape.FromIntPtr(shape)); }
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); }
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); }