Example #1
0
        public virtual void Update()
        {
            plines.Clear();
            for (int c = 0; c < ppoints.Count - 1; c++)
            {
                Vector2 currentPoint = ppoints[c];

                XNALine line = new XNALine
                {
                    Start = currentPoint,
                    End = ppoints[c + 1],
                    Stroke = Stroke,
                    StrokeWidth = StrokeWidth
                };
                plines.Add(line);
            }
            pendPointTexture = XNACircle.CreateTexture(pdevice, (int)MathUtils.Floor(pstrokeWidth));
            pchanged = false;
        }
Example #2
0
 public override void Update()
 {
     plines.Clear();
     for (int c = 0; c < ppoints.Count; c++)
     {
         XNALine line = new XNALine
         {
             Start = ppoints[c],
             End = (c == ppoints.Count - 1 ? ppoints[0] : ppoints[c + 1]),
             Stroke = Stroke,
             StrokeWidth = StrokeWidth
         };
         plines.Add(line);
     }
     GetFillTexture();
     if (StrokeWidth > 0) pendPointTexture = XNACircle.CreateTexture(pdevice, (int)MathUtils.Floor(StrokeWidth));
     pchanged = false;
 }
Example #3
0
 public void DrawLine(float x1, float y1, float x2, float y2)
 {
     if (isClose)
     {
         return;
     }
     if (lineWidth <= 1)
     {
         _DrawLine(x1, y1, x2, y2, true);
     }
     else
     {
         int hashCode = 1;
         hashCode = LSystem.Unite(hashCode, x1);
         hashCode = LSystem.Unite(hashCode, y1);
         hashCode = LSystem.Unite(hashCode, x2);
         hashCode = LSystem.Unite(hashCode, y2);
         hashCode = LSystem.Unite(hashCode, lineWidth);
         XNALine xnaLine = (XNALine)CollectionUtils.Get(lazyXnaLine, hashCode);
         if (xnaLine == null)
         {
             xnaLine = new XNALine();
             xnaLine.Start = new Vector2(x1, y1);
             xnaLine.End = new Vector2(x2, y2);
             xnaLine.StrokeWidth = lineWidth;
             CollectionUtils.Put(lazyXnaLine, hashCode, xnaLine);
         }
         xnaLine.Stroke = color;
         XnaBatchBegin(color);
         xnaLine.Draw(xnaBatch);
         XnaBatchEnd();
     }
 }