コード例 #1
0
        private static DebugColor SpaceDebugDrawColorForShapeCallback(cpShape handleShape, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);
            var        shape     = Shape.FromHandle(handleShape);

            return(debugDraw.ColorForShape(shape));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        private static void SpaceDebugDrawDotCallback(double size, Vect pos, DebugColor color, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawDot(size, pos, color);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        private static void SpaceDebugDrawSegmentCallback(Vect a, Vect b, DebugColor color, voidptr_t data)
        {
            IDebugDraw debugDraw = NativeInterop.FromIntPtr <IDebugDraw>(data);

            debugDraw.DrawSegment(a, b, color);
        }
コード例 #8
0
        /// <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));
        }
コード例 #9
0
ファイル: Shape.cs プロジェクト: mistajuliax/ChipmunkBinding
        /// <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));
        }
コード例 #10
0
        /// <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));
        }
コード例 #11
0
ファイル: Space.cs プロジェクト: mistajuliax/ChipmunkBinding
        /// <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));
        }