示例#1
0
        public void SmoothDraw(Graphics graphics, FloatVector2 scale)
        {
            Brush brush        = new SolidBrush(Color);
            var   systemPoints = Points.Select(point => (PointF)(point * scale));

            graphics.FillPolygon(brush, systemPoints.ToArray());
        }
 public void SmoothDraw(Graphics graphics, FloatVector2 scale)
 {
     graphics.Clear(Color.Black);
     foreach (var polygon in Polygons)
     {
         polygon.SmoothDraw(graphics, scale);
     }
 }
示例#3
0
 public void SmoothDraw(Graphics graphics, FloatVector2 scale)
 {
     graphics.Clear(Color.Black);
     foreach (var polygon in Polygons)
     {
         polygon.SmoothDraw(graphics, scale);
     }
 }
示例#4
0
        public void FieldStruct()
        {
            var xs = new FloatVector2(100.4f, 200.5f);

            var huga = ZeroFormatterSerializer.Convert(xs);

            huga.x.Is(100.4f);
            huga.y.Is(200.5f);
        }
示例#5
0
        void DrawVectorPicture(PaintEventArgs e, VectorPicture lastAttempt, CanvasBox canvasBox)
        {
            var buffer         = new Bitmap(canvasBox.CanvasSize.Width, canvasBox.CanvasSize.Height, PixelFormat.Format24bppRgb);
            var bufferGraphics = Graphics.FromImage(buffer);

            bufferGraphics.SmoothingMode = SmoothingMode.HighQuality;

            var scale = new FloatVector2((float)canvasBox.CanvasSize.Width / TargetSize.X,
                                         (float)canvasBox.CanvasSize.Height / TargetSize.Y);

            lock (lastAttempt)
                lastAttempt.SmoothDraw(bufferGraphics, scale);
            e.Graphics.DrawImage(buffer, 0, 0);
        }
示例#6
0
        public override string ToString()
        {
            var result = string.Join(",", FightShips.Select(ship => ship.Hp));

            for (var y = 0; y < Height; y++)
            {
                result += "\n";
                for (var x = 0; x < Width; x++)
                {
                    var foundShip = FightShips.Find(ship => FloatVector2.Distance(ship.Position, new FloatVector2(x, y)) < FightShip.ShipRadius / 2);
                    // var foundShip = FightShips.Find(ship => (int) MathF.Round(ship.Position.X) == x && (int) MathF.Round(ship.Position.Y) == y);
                    if (foundShip != null)
                    {
                        // result += Math.Abs(foundShip.RotateAngle) < 90 ? "↑" : "↓";
                        result += ((int)foundShip.Ship.Hull.Name).ToString();
                    }
                    else
                    {
                        result += ".";
                    }
                }
            }
            return(result);
        }
示例#7
0
 public GridSettings(FloatVector3 startPos, FloatVector2 cellSpacing)
 {
     this.startPos    = startPos;
     this.cellSpacing = cellSpacing;
 }
 public void SmoothDraw(Graphics graphics, FloatVector2 scale)
 {
     GetVectorPicture().SmoothDraw(graphics, scale);
 }
示例#9
0
        void DrawVectorPicture(PaintEventArgs e, VectorPicture lastAttempt, CanvasBox canvasBox)
        {
            var buffer = new Bitmap(canvasBox.CanvasSize.Width, canvasBox.CanvasSize.Height, PixelFormat.Format24bppRgb);
            var bufferGraphics = Graphics.FromImage(buffer);
            bufferGraphics.SmoothingMode = SmoothingMode.HighQuality;

            var scale = new FloatVector2((float)canvasBox.CanvasSize.Width / TargetSize.X,
                (float)canvasBox.CanvasSize.Height / TargetSize.Y);
            lock (lastAttempt)
                lastAttempt.SmoothDraw(bufferGraphics, scale);
            e.Graphics.DrawImage(buffer, 0, 0);
        }
 public void SmoothDraw(Graphics graphics, FloatVector2 scale)
 {
     GetVectorPicture().SmoothDraw(graphics, scale);
 }