Пример #1
0
		public void DrawSegment(cpVect from, cpVect to, float radius, cpColor color)
		{
			base.DrawSegment(from.ToCCPoint(), to.ToCCPoint(), radius, color.ToCCColor4F());
		}
Пример #2
0
		public void Draw(cpBB bb, cpColor color)
		{
			DrawPolygon(new cpVect[] { 
 
						new cpVect(bb.r, bb.b),
					new cpVect(bb.r, bb.t),
					new cpVect(bb.l, bb.t),
					new cpVect(bb.l, bb.b)
				
				}, 4, TRANSPARENT_COLOR, 1, color);

		}
Пример #3
0
		public void DrawCircle(cpVect center, float radius, float angle, int segments, cpColor color)
		{
			base.DrawCircle(center.ToCCPoint(), radius, angle, segments, color.ToCCColor4B());
		}
Пример #4
0
		public void DrawPolygon(cpVect[] verts, int count, cpColor fillColor, float borderWidth, cpColor borderColor)
		{
			base.DrawPolygon(cpVertArray2ccpArrayN(verts, verts.Length), count, fillColor.ToCCColor4F(), borderWidth, borderColor.ToCCColor4F());
		}
Пример #5
0
 public cpColor(cpColor color)
 {
     r = color.r; g = color.g; b = color.b; a = color.a;
 }
Пример #6
0
		public void DrawCircle(cpVect center, float radius, cpColor color)
		{
			var centerPoint = center.ToCCPoint();
			var colorOutline = color.ToCCColor4B();
			var colorFill = colorOutline * 0.5f;
			base.DrawCircle(centerPoint, radius, colorOutline);
			base.DrawSolidCircle(centerPoint, radius, colorFill);
		}
Пример #7
0
 private void Draw(cpSegmentShape seg, cpColor color)
 {
     DrawFatSegment(seg.ta, seg.tb, seg.r, color);
 }
Пример #8
0
 public void DrawSolidCircle(cpVect center, float radius, cpColor color)
 {
     base.DrawCircle(center.ToCCPoint(), radius, color.ToCCColor4B());
 }
Пример #9
0
 public void DrawRect(CCRect rect, cpColor color)
 {
     base.DrawRect(rect, color.ToCCColor4B());
 }
Пример #10
0
 public void DrawSegment(cpVect from, cpVect to, float radius, cpColor color)
 {
     base.DrawSegment(from.ToCCPoint(), to.ToCCPoint(), radius, color.ToCCColor4F());
 }
Пример #11
0
 public void DrawPolygon(cpVect[] verts, int count, cpColor fillColor, float borderWidth, cpColor borderColor)
 {
     base.DrawPolygon(cpVertArray2ccpArrayN(verts, verts.Length), count, fillColor.ToCCColor4F(), borderWidth, borderColor.ToCCColor4F());
 }
Пример #12
0
 public void DrawDot(cpVect pos, float radius, cpColor color)
 {
     //base.DrawDot(pos.ToCCPoint(), radius, color.ToCCColor4F());
     base.DrawSolidCircle(pos.ToCCPoint(), radius, color.ToCCColor4B());
 }
Пример #13
0
 public void DrawCircle(cpVect center, float radius, float angle, int segments, cpColor color)
 {
     base.DrawCircle(center.ToCCPoint(), radius, angle, segments, color.ToCCColor4B());
 }
Пример #14
0
		private void Draw(cpSegmentShape seg, cpColor color)
		{
			DrawFatSegment(seg.ta, seg.tb, seg.r, color);
		}
Пример #15
0
 public void Draw(cpVect point, cpColor color)
 {
     Draw(point, 0.5f, color);
 }
Пример #16
0
		public void Draw(cpVect point, cpColor color)
		{
			Draw(point, 0.5f, color);
		}
Пример #17
0
 public void Draw(cpVect point, float radius, cpColor color)
 {
     DrawDot(point, radius, color);
 }
Пример #18
0
 public void Set(cpColor color)
 {
     Set(color.r, color.g, color.b, color.a);
 }
Пример #19
0
        public void DrawShape(cpShape shape)
        {
            cpBody  body  = shape.body;
            cpColor color = cp.GetShapeColor(shape);;             // ColorForBody(body);


            switch (shape.shapeType)
            {
            case cpShapeType.Circle:
            {
                cpCircleShape circle = (cpCircleShape)shape;

                if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(circle.bb);
                }

                if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(circle, color);
                }
            }
            break;

            case cpShapeType.Segment:
            {
                cpSegmentShape seg = (cpSegmentShape)shape;

                if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(seg.bb);
                }

                if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(seg, color);
                }
            }
            break;

            case cpShapeType.Polygon:
            {
                cpPolyShape poly = (cpPolyShape)shape;


                if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(poly.bb);
                }

                if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All))
                {
                    Draw(poly, color);
                }
            }
            break;

            default:
                cp.AssertHard(false, "Bad assertion in DrawShape()");
                break;
            }
        }
Пример #20
0
		public void DrawSpring(cpVect a, cpVect b, cpColor cpColor)
		{

			DrawDot(a, 5, CONSTRAINT_COLOR);
			DrawDot(b, 5, CONSTRAINT_COLOR);

			cpVect delta = cpVect.cpvsub(b, a);
			float cos = delta.x;
			float sin = delta.y;
			float s = 1.0f / cpVect.cpvlength(delta);

			cpVect r1 = cpVect.cpv(cos, -sin * s);
			cpVect r2 = cpVect.cpv(sin, cos * s);

			cpVect[] verts = new cpVect[springPoints.Length];
			for (int i = 0; i < springPoints.Length; i++)
			{
				cpVect v = springPoints[i];
				verts[i] = new cpVect(cpVect.cpvdot(v, r1) + a.x, cpVect.cpvdot(v, r2) + a.y);
			}

			for (int i = 0; i < springPoints.Length - 1; i++)
			{
				DrawSegment(verts[i], verts[i + 1], 1, cpColor.Grey);
			}

		}
Пример #21
0
 public abstract void DrawBB(cpBB bb, cpColor color);
Пример #22
0
		public void DrawSolidCircle(cpVect center, float radius, cpColor color)
		{
			base.DrawCircle(center.ToCCPoint(), radius, color.ToCCColor4B());
		}
Пример #23
0
 public abstract void DrawPoint(cpVect p, float size, cpColor color);
Пример #24
0
		public void DrawDot(cpVect pos, float radius, cpColor color)
		{
			//base.DrawDot(pos.ToCCPoint(), radius, color.ToCCColor4F());
			base.DrawSolidCircle(pos.ToCCPoint(), radius, color.ToCCColor4B());
		}
Пример #25
0
 /// Draw a line segment.
 public abstract void DrawSegment(cpVect p1, cpVect p2, cpColor color);
Пример #26
0
		public void DrawRect(CCRect rect, cpColor color)
		{
			base.DrawRect(rect, color.ToCCColor4B());
		}
Пример #27
0
 /// Draw a line segment with a strokeWidth.
 public abstract void DrawSegment(cpVect p1, cpVect p2, float lineWidth, cpColor color);
Пример #28
0
		public void Draw(cpPolyShape poly, cpColor color)
		{
			cpColor fill = new cpColor(color);
			fill.a = cp.cpflerp(color.a, 1.0f, 0.5f);
			DrawPolygon(poly.GetVertices(), poly.Count, fill, 0.5f, color);
		}
Пример #29
0
 /// Draw a solid circle.
 public abstract void DrawSolidCircle(cpVect center, float radius, cpVect axis, cpColor color);
Пример #30
0
		public void Draw(cpCircleShape circle, cpColor color)
		{
			cpVect center = circle.tc;
			float radius = circle.r;
			cpVect To = cpVect.cpvadd(cpVect.cpvmult(circle.body.GetRotation(), circle.r), (circle.tc));
			DrawCircle(center, cp.cpfmax(radius, 1.0f), color);
			DrawSegment(center, To, 0.5f, cpColor.Grey);
		}
Пример #31
0
 /// Draw a solid closed polygon provided in CCW order.
 public abstract void DrawSolidPolygon(cpVect[] vertices, int vertexCount, cpColor color);
Пример #32
0
		private void DrawFatSegment(cpVect ta, cpVect tb, float r, cpColor color)
		{
			cpColor fill = new cpColor(color);
			fill.a = cp.cpflerp(color.a, 1.0f, 0.5f);

			DrawSegment(ta, tb, Math.Max(0.05f, r), fill);
		}
Пример #33
0
 public abstract void DrawSpring(cpVect a, cpVect b, cpColor cpColor);
Пример #34
0
		public void Draw(cpVect point, float radius, cpColor color)
		{
			DrawDot(point, radius, color);
		}
Пример #35
0
 public static CCColor4B ToCCColor4B(this cpColor color)
 {
     return(new CCColor4B(color.r / 255, color.g / 255, color.b / 255, color.a / 255));
 }