private static DebugColor SpaceDebugDrawColorForShapeCallback(cpShape handleShape, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); var shape = Shape.FromHandle(handleShape); return(debugDraw.ColorForShape(shape)); }
private static void SpaceDebugDrawPolygonCallback(int count, cpVertPointer verts, double radius, DebugColor outlineColor, DebugColor fillColor, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); Vect[] vectors = NativeInterop.PtrToStructureArray <Vect>(verts, count); debugDraw.DrawPolygon(vectors, radius, outlineColor, fillColor); }
internal static CollisionHandler <T> GetOrCreate(cpCollisionHandlerPointer collisionHandle) { Debug.Assert(collisionHandle != IntPtr.Zero, "CollisionHandle cannot be zero"); var handler = cpCollisionHandler.FromHandle(collisionHandle); if (handler.userData != IntPtr.Zero) { return(NativeInterop.FromIntPtr <CollisionHandler <T> >(handler.userData)); } return(new CollisionHandler <T>(collisionHandle, ref handler)); }
private static void SpaceDebugDrawCircleCallback(Vect pos, double angle, double radius, DebugColor outlineColor, DebugColor fillColor, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); debugDraw.DrawCircle(pos, angle, radius, outlineColor, fillColor); }
private static void SpaceDebugDrawDotCallback(double size, Vect pos, DebugColor color, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); debugDraw.DrawDot(size, pos, color); }
private static void SpaceDebugDrawFatSegmentCallback(Vect a, Vect b, double radius, DebugColor outlineColor, DebugColor fillColor, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); debugDraw.DrawFatSegment(a, b, radius, outlineColor, fillColor); }
private static void SpaceDebugDrawSegmentCallback(Vect a, Vect b, DebugColor color, voidptr_t data) { IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data); debugDraw.DrawSegment(a, b, color); }
/// <summary> /// Get a Constraint object from a native handle. /// </summary> public static Constraint FromHandle(cpConstraint constraint) { cpDataPointer handle = NativeMethods.cpConstraintGetUserData(constraint); return(NativeInterop.FromIntPtr <Constraint>(handle)); }
/// <summary> /// Get a managed Shape from a native handle. /// </summary> public static Shape FromHandle(cpShape shape) { cpDataPointer handle = NativeMethods.cpShapeGetUserData(shape); return(NativeInterop.FromIntPtr <Shape>(handle)); }
/// <summary> /// Get a <see cref="Body"/> object from a native cpBody handle. /// </summary> public static Body FromHandle(cpBody body) { cpDataPointer handle = NativeMethods.cpBodyGetUserData(body); return(NativeInterop.FromIntPtr <Body>(handle)); }
/// <summary> /// Get a Space object from native cpSpace handle. /// </summary> public static Space FromHandle(cpSpace space) { cpDataPointer handle = NativeMethods.cpSpaceGetUserData(space); return(NativeInterop.FromIntPtr <Space>(handle)); }