Ejemplo n.º 1
0
 public void GetBodies(out Body bodyA, out Body bodyB)
 {
     IntPtr a, b;
     __cpArbiterGetBodies (Handle.Handle, out a, out b);
     bodyA = new Body (a);
     bodyB = new Body (b);
 }
Ejemplo n.º 2
0
 public void GetBodies(out Body bodyA, out Body bodyB)
 {
     IntPtr a, b;
     __cpArbiterGetBodies (Handle.Handle, out a, out b);
     bodyA = Body.FromIntPtr (a);
     bodyB = Body.FromIntPtr (b);
 }
Ejemplo n.º 3
0
 public PolygonShape(Body body, float width, float height)
     : base(cpBoxShapeNew (body.Handle.Handle, width, height))
 {
 }
Ejemplo n.º 4
0
 public CircleShape(Body body, float radius, PointF offset)
     : base(cpCircleShapeNew (body.Handle.Handle, radius, offset))
 {
 }
Ejemplo n.º 5
0
 public void SleepWithGroup(Body group)
 {
     cpBodySleepWithGroup (Handle.Handle, group.Handle.Handle);
 }
Ejemplo n.º 6
0
 public DampedSpring(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2, float restLength, float stiffness, float damping)
     : base(cpDampedSpringNew (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2, restLength, stiffness, damping))
 {
 }
Ejemplo n.º 7
0
 public RotaryLimitJoint(Body bodyA, Body bodyB, float min, float max)
     : base(cpRotaryLimitJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, min, max))
 {
 }
Ejemplo n.º 8
0
 public void Activate(Body body)
 {
     ActivateBody(body.Handle.Handle);
 }
Ejemplo n.º 9
0
 public PivotJoint(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2)
     : base(cpPivotJointNew2 (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2))
 {
 }
Ejemplo n.º 10
0
 public RatchetJoint(Body bodyA, Body bodyB, float phase, float ratchet)
     : base(cpRatchetJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, phase, ratchet))
 {
 }
Ejemplo n.º 11
0
 public PivotJoint(Body bodyA, Body bodyB, PointF pivot)
     : base(cpPivotJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, pivot))
 {
 }
Ejemplo n.º 12
0
 public GrooveJoint(Body bodyA, Body bodyB, PointF grooveA, PointF grooveB, PointF anchr2)
     : base(cpGrooveJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, grooveA, grooveB, anchr2))
 {
 }
Ejemplo n.º 13
0
 public GearJoint(Body bodyA, Body bodyB, float phase, float ratio)
     : base(cpGearJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, phase, ratio))
 {
 }
Ejemplo n.º 14
0
 public PolygonShape(Body body, PointF[] vertices, PointF offset)
     : base(cpPolyShapeNew (body.Handle.Handle, vertices.Length, vertices, offset))
 {
 }
Ejemplo n.º 15
0
 public SimpleMotor(Body bodyA, Body bodyB, float rate)
     : base(cpSimpleMotorNew (bodyA.Handle.Handle, bodyB.Handle.Handle, rate))
 {
 }
Ejemplo n.º 16
0
 public SegmentShape(Body body, PointF a, PointF b, float radius)
     : base(cpSegmentShapeNew (body.Handle.Handle, a, b, radius))
 {
 }
Ejemplo n.º 17
0
 public SlideJoint(Body bodyA, Body bodyB, PointF anchr1, PointF anchr2, float min, float max)
     : base(cpSlideJointNew (bodyA.Handle.Handle, bodyB.Handle.Handle, anchr1, anchr2, min, max))
 {
 }
Ejemplo n.º 18
0
        void AddNewSpriteAt(PointF pos)
        {
            int posx, posy;

            var parent = GetChild(parentnode) as CCSpriteBatchNode;

            posx = (int)(rnd.NextDouble() * 200.0f);
            posy = (int)(rnd.NextDouble() * 200.0f);

            posx = (posx % 4) * 85;
            posy = (posy % 3) * 121;

            var sprite = new CCPhysicsSprite (parent.Texture, new RectangleF (posx, posy, 85, 121));
            //this used to work, but crashes now, as it sets the Body's position and the Body isn't set yet :/
            //sprite.Position = pos;

            parent.Add(sprite);

            PointF[] verts = {
                new PointF(-24,-54),
                new PointF(-24, 54),
                new PointF( 24, 54),
                new PointF( 24,-54),
            };

            var body = new Body(1, Helper.MomentForPolygon(1f, verts, PointF.Empty)) {Position=pos};
            space.Add(body);

            var shape = new PolygonShape(body, verts, PointF.Empty) {
                Elasticity = .5f,
                Friction =.5f
            };

            space.Add(shape);
            sprite.Body = body;
        }
Ejemplo n.º 19
0
 public DampedRotarySpring(Body bodyA, Body bodyB, float restAngle, float stiffness, float damping)
     : base(cpDampedRotarySpringNew (bodyA.Handle.Handle, bodyB.Handle.Handle, restAngle, stiffness, damping))
 {
 }