Example #1
0
 public void FillRectangle(DrawLineParams param)
 {
     this.drawImplementation.FillRectangle(param);
 }
Example #2
0
 public void DrawLine(DrawLineParams param)
 {
     this.drawImplementation.DrawLine(param);
 }
        public void FillRectangle(DrawLineParams param)
        {
            var rect = GameFramework.Rectangle.FromBound((int)param.VectorFrom.X, (int)param.VectorFrom.Y, (int)param.VectorTo.X, (int)param.VectorTo.Y);

            this.spriteBatch.Draw(this.blank, rect.ToXnaRect(), param.Color.ToXnaColor());
        }
        public void DrawLine(DrawLineParams param)
        {
            var angle = (float)Math.Atan2(param.VectorTo.Y - param.VectorFrom.Y, param.VectorTo.X - param.VectorFrom.X);
            var length = Vector2.Distance(param.VectorFrom.ToVector2(), param.VectorTo.ToVector2());

            this.spriteBatch.Draw(this.blank, param.VectorFrom.ToVector2(), null, param.Color.ToXnaColor(), angle, Vector2.Zero,
                new Vector2(length, param.Width), SpriteEffects.None, 0);
        }
        public void DrawRectangle(DrawLineParams param)
        {
            var bottomLeft = new Vector(param.VectorFrom.X, param.VectorTo.Y);
            var topRight = new Vector(param.VectorTo.X, param.VectorFrom.Y);

            this.DrawLine(new DrawLineParams { VectorFrom = param.VectorFrom, VectorTo = topRight, Color = param.Color, Width = param.Width });
            this.DrawLine(new DrawLineParams { VectorFrom = topRight, VectorTo = param.VectorTo, Color = param.Color, Width = param.Width });
            this.DrawLine(new DrawLineParams { VectorFrom = param.VectorTo, VectorTo = bottomLeft, Color = param.Color, Width = param.Width });
            this.DrawLine(new DrawLineParams { VectorFrom = bottomLeft, VectorTo = param.VectorFrom, Color = param.Color, Width = param.Width });
        }