public override void Draw(SpriteBatch g) { try { //g.SmoothingMode = SmoothingMode.AntiAlias; //var pen = new Pen(Stroke, StrokeWidth); //TODO change DrawLine to include thickness XnaDrawing.DrawLine(2.0f, Stroke, new Vector2(_startPoint.X, _startPoint.Y), new Vector2(_endPoint.X, _endPoint.Y)); //pen.Dispose(); } catch (Exception ex) { ErrH.Log("DrawLine", "Draw", ex.ToString(), ErrH._LogPriority.Info); } }
public override void Draw(SpriteBatch g) { float x1 = 0, y1 = 0; // previous point try { //g.SmoothingMode = SmoothingMode.AntiAlias; if (Fill.ToColor() != Color.Transparent) { var arr = new Vector2[_pointArray.Count]; for (int i = 0; i < _pointArray.Count; i++) { arr[i] = (Vector2)_pointArray[i]; } //Brush brush = new SolidBrush(Fill); XnaDrawing.DrawPolyline(arr, Fill.ToColor()); } //var pen = new Pen(Stroke, StrokeWidth); IEnumerator enumerator = _pointArray.GetEnumerator(); if (enumerator.MoveNext()) { x1 = ((Point)enumerator.Current).X; y1 = ((Point)enumerator.Current).Y; } while (enumerator.MoveNext()) { float x2 = ((Point)enumerator.Current).X; // current point float y2 = ((Point)enumerator.Current).Y; // current point XnaDrawing.DrawLine(2.0f, Stroke, new Vector2(x1, y1), new Vector2(x2, y2)); x1 = x2; y1 = y2; } //pen.Dispose(); } catch (Exception ex) { ErrH.Log("DrawPolygon", "Draw", ex.ToString(), ErrH._LogPriority.Info); } }