Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 public void DrawLine(float x1, float y1, float x2, float y2)
 {
     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, color.PackedValue);
     XNALine line = (XNALine)CollectionUtils.Get(lineLazy, hashCode);
     SubmitDraw();
     if (line == null)
     {
         line = new XNALine();
         line.StrokeWidth = lineWidth;
         line.Stroke = color;
         line.Start = new Vector2(x1, y1);
         line.End = new Vector2(x2, y2);
         CollectionUtils.Put(lineLazy, hashCode, line);
     }
     line.Draw(batch);
     idx++;
 }
Exemplo n.º 3
0
        public void Load()
        {
            this.LineWidth = 1;
            this.pDevice = GLEx.device;
            this.pCamera = GLEx.cemera;

            effect = new BasicEffect(pDevice);
            effect.VertexColorEnabled = true;

            xnaLine = new XNALine();
            xnaRect = new XNARectangle(pDevice);
            xnaPolygon = new XNAPolygon(pDevice);

            maxPrimitiveCount = pDevice.GraphicsProfile == GraphicsProfile.Reach ? 65535 : 1048575;

            vertsPos = new VertexPositionColor[maxPrimitiveCount];

            effect.Projection = Microsoft.Xna.Framework.Matrix.CreateOrthographicOffCenter(0f, LSystem.screenRect.width, LSystem.screenRect.height, 0f, -1.0f, 1.0f);
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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;
 }