Пример #1
0
        public static void LineAngle(Vector2 start, float angle, float length, Color color, float thickness)
        {
            FDrawingSprite _draw=new FDrawingSprite("Draw_Pixel_White");
            SpriteBatch.AddChild(_draw);

            _draw.SetLineThickness(thickness);
            //_draw.SetLineColor(new Color(1,0,1,0.5f));
            _draw.SetLineCapStyle(FTDrawingCapStyle.NONE);
            _draw.SetLineJointStyle(FTDrawingJointStyle.MITER);

            _draw.MoveTo(start.x, start.y);
            Vector2 dest = new Vector2(start.x + length * Mathf.Cos(angle) - length * Mathf.Sin(angle), start.y + length * Mathf.Sin(angle) + length * Mathf.Cos(angle));
            _draw.LineTo(dest.x, dest.y);
            _draw.Flush(); // Stop the line, add caps
            //SpriteBatch.Draw(Pixel, start, Pixel.sourceRect, color, angle, new Vector2(0, .5f), new Vector2(length, thickness), SpriteEffects.None, 0);
        }
Пример #2
0
        public static void Line(Vector2 start, Vector2 end, Color color, float thickness)
        {
            FDrawingSprite _draw=new FDrawingSprite("Draw_Pixel_White");
            SpriteBatch.AddChild(_draw);

            _draw.SetLineThickness(1);
            //_draw.SetLineColor(new Color(1,0,1,0.5f));
            _draw.SetLineCapStyle(FTDrawingCapStyle.NONE);
            _draw.SetLineJointStyle(FTDrawingJointStyle.MITER);

            //_draw.MoveTo(start.x + Mathf.Cos(angle) - Mathf.Sin(angle), start.y + Mathf.Sin(angle) + Mathf.Cos(angle));
            //Vector2 dest = new Vector2(start.x + length * Mathf.Cos(angle) - length * Mathf.Sin(angle), start.y + length * Mathf.Sin(angle) + length * Mathf.Cos(angle));
            //_draw.LineTo(dest.x, dest.y);
            _draw.MoveTo(start.x, start.y);
            _draw.LineTo(end.x, end.y);
            _draw.Flush(); // Stop the line, add caps

            //LineAngle(start, Vector2.Angle(start, end), Vector2.Distance(start, end), color, thickness);
        }