DrawLine() public method

public DrawLine ( IEnumerable points, float width, Color color, bool connectSegments = false ) : void
points IEnumerable
width float
color Color
connectSegments bool
return void
コード例 #1
0
ファイル: Capsule.cs プロジェクト: CH4Code/OpenRA
        public void DrawCombatOverlay(WorldRenderer wr, RgbaColorRenderer wcr, Actor actor)
        {
            var a = actor.CenterPosition + new WVec(PointA.X, PointA.Y, 0).Rotate(actor.Orientation);
            var b = actor.CenterPosition + new WVec(PointB.X, PointB.Y, 0).Rotate(actor.Orientation);

            var offset = new WVec(a.Y - b.Y, b.X - a.X, 0);
            offset = offset * Radius.Length / offset.Length;

            var c = Color.Yellow;
            RangeCircleRenderable.DrawRangeCircle(wr, a, Radius, 1, c, 0, c);
            RangeCircleRenderable.DrawRangeCircle(wr, b, Radius, 1, c, 0, c);
            wcr.DrawLine(new[] { wr.ScreenPosition(a - offset), wr.ScreenPosition(b - offset) }, 1, c);
            wcr.DrawLine(new[] { wr.ScreenPosition(a + offset), wr.ScreenPosition(b + offset) }, 1, c);
        }
コード例 #2
0
ファイル: Capsule.cs プロジェクト: pchote/OpenRA
        public void DrawCombatOverlay(WorldRenderer wr, RgbaColorRenderer wcr, Actor actor)
        {
            var actorPos = actor.CenterPosition;

            var a = actorPos + new WVec(PointA.X, PointA.Y, VerticalTopOffset).Rotate(actor.Orientation);
            var b = actorPos + new WVec(PointB.X, PointB.Y, VerticalTopOffset).Rotate(actor.Orientation);
            var aa = actorPos + new WVec(PointA.X, PointA.Y, VerticalBottomOffset).Rotate(actor.Orientation);
            var bb = actorPos + new WVec(PointB.X, PointB.Y, VerticalBottomOffset).Rotate(actor.Orientation);

            var offset1 = new WVec(a.Y - b.Y, b.X - a.X, 0);
            offset1 = offset1 * Radius.Length / offset1.Length;
            var offset2 = new WVec(aa.Y - bb.Y, bb.X - aa.X, 0);
            offset2 = offset2 * Radius.Length / offset2.Length;

            var c = Color.Yellow;
            RangeCircleRenderable.DrawRangeCircle(wr, a, Radius, 1, c, 0, c);
            RangeCircleRenderable.DrawRangeCircle(wr, b, Radius, 1, c, 0, c);
            wcr.DrawLine(new[] { wr.Screen3DPosition(a - offset1), wr.Screen3DPosition(b - offset1) }, 1, c);
            wcr.DrawLine(new[] { wr.Screen3DPosition(a + offset1), wr.Screen3DPosition(b + offset1) }, 1, c);

            RangeCircleRenderable.DrawRangeCircle(wr, aa, Radius, 1, c, 0, c);
            RangeCircleRenderable.DrawRangeCircle(wr, bb, Radius, 1, c, 0, c);
            wcr.DrawLine(new[] { wr.Screen3DPosition(aa - offset2), wr.Screen3DPosition(bb - offset2) }, 1, c);
            wcr.DrawLine(new[] { wr.Screen3DPosition(aa + offset2), wr.Screen3DPosition(bb + offset2) }, 1, c);
        }
コード例 #3
0
ファイル: CombatDebugOverlay.cs プロジェクト: CH4Code/OpenRA
        void DrawArmaments(Actor self, AttackBase attack, WorldRenderer wr, RgbaColorRenderer wcr, float iz)
        {
            var c = Color.White;

            // Fire ports on garrisonable structures
            var garrison = attack as AttackGarrisoned;
            if (garrison != null)
            {
                var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
                foreach (var p in garrison.Info.Ports)
                {
                    var pos = self.CenterPosition + coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
                    var da = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw + p.Cone)).Rotate(bodyOrientation));
                    var db = coords.Value.LocalToWorld(new WVec(224, 0, 0).Rotate(WRot.FromYaw(p.Yaw - p.Cone)).Rotate(bodyOrientation));

                    var o = wr.ScreenPosition(pos);
                    var a = wr.ScreenPosition(pos + da * 224 / da.Length);
                    var b = wr.ScreenPosition(pos + db * 224 / db.Length);
                    wcr.DrawLine(o, a, iz, c);
                    wcr.DrawLine(o, b, iz, c);
                }

                return;
            }

            foreach (var a in attack.Armaments)
            {
                foreach (var b in a.Barrels)
                {
                    var muzzle = self.CenterPosition + a.MuzzleOffset(self, b);
                    var dirOffset = new WVec(0, -224, 0).Rotate(a.MuzzleOrientation(self, b));

                    var sm = wr.ScreenPosition(muzzle);
                    var sd = wr.ScreenPosition(muzzle + dirOffset);
                    wcr.DrawLine(sm, sd, iz, c);
                    TargetLineRenderable.DrawTargetMarker(wr, c, sm);
                }
            }
        }