示例#1
0
        public override void DrawLine(Point a, Point b, Color color)
        {
            mDevice.DrawBuffer.Flush();

            Vector2[] pts = new Vector2[2];

            pts[0] = new Vector2(a.X, a.Y);
            pts[1] = new Vector2(b.X, b.Y);


            mLine.Begin();
            mLine.Draw(pts, color.ToArgb());
            mLine.End();
        }
        // Method for drawing Perfect Circle
        private void DrawCircle(int X, int Y, int radius, int numSides, Color color)
        {
            Vector2[] Line = new Vector2[100];

            float Step  = (float)(Math.PI * 2.0 / numSides);
            int   Count = 0;

            for (float a = 0; a < Math.PI * 2.0; a += Step)
            {
                float X1 = (float)(radius * Math.Cos(a) + X);
                float Y1 = (float)(radius * Math.Sin(a) + Y);
                float X2 = (float)(radius * Math.Cos(a + Step) + X);
                float Y2 = (float)(radius * Math.Sin(a + Step) + Y);

                Line[Count].X     = X1;
                Line[Count].Y     = Y1;
                Line[Count + 1].X = X2;
                Line[Count + 1].Y = Y2;
                Count            += 2;
            }
            drawCircleLine.Begin();
            drawCircleLine.Draw(Line, color);
            drawCircleLine.End();

            /*                    Example                         */
            /* DrawCircle(x Axis, y Axis, radius, numOfSides, color); */
        }
        // Method for drawing 2D Boxes
        public static void DrawBox(float x, float y, float w, float h, Color color)
        {
            Vector2[] vertices =
            {
                new Vector2(x,     y),
                new Vector2(x + w, y),
                new Vector2(x + w, y + h),
                new Vector2(x,     y + h),
                new Vector2(x,     y)
            };
            drawBoxLine.Begin();
            drawBoxLine.Draw(vertices, color);
            drawBoxLine.End();

            /*              Example             */
            /* DrawBox(x , y, w, h, color); */
        }
示例#4
0
        protected void DrawLine(float x1, float y1, float x2, float y2, Color color)
        {
            if (_Line_ != null)
            {
                _line_pts[0].X = x1;
                _line_pts[1].Y = y1;
                _line_pts[0].X = x2;
                _line_pts[1].Y = y2;

                _Line_.Begin();
                _Line_.Draw(_line_pts, color);
                _Line_.End();
            }
            else
            {
                throw new NullReferenceException("Line resource must be initialized with call to \"InitializeLine(Device d)\"");
            }
        }
示例#5
0
        public void Draw(Color color, Color border_color, AGT_Text label)
        {
            _line_points[0].X = (label.X);
            _line_points[0].Y = (float)(label.Y - 1);
            _line_points[1].X = (float)(_line_points[0].X + label.Width);
            _line_points[1].Y = (float)(_line_points[0].Y);

            _line.Draw(_line_points, border_color);

            _line_points[0].X = (float)(label.X);
            _line_points[0].Y = (float)(label.Y + 1);
            _line_points[1].X = (float)(_line_points[0].X + label.Width);
            _line_points[1].Y = (float)(_line_points[0].Y);

            _line.Draw(_line_points, border_color);


            _line_points[0].X = (float)(label.X + 1);
            _line_points[0].Y = (float)(label.Y);
            _line_points[1].X = (float)(label.X + label.Width - 1);
            _line_points[1].Y = (float)(label.Y);

            _line.Draw(_line_points, label.Background);


            label.DrawMessage(color);
        }
示例#6
0
        public void Draw()
        {
            _line.Draw(_line_points, _foreground_color);

            if (Style == HeadingStyle.Aptima)
            {
                _sprites.SetPosition(EndpointId, _line_points[1].X, _line_points[1].Y, 0);

                _sprites.Begin(SpriteFlags.AlphaBlend);
                _sprites.Draw(EndpointId, Color.White);
                _sprites.End();
            }
        }
示例#7
0
        public void Draw()
        {
            LinkedListNode <AGT_Waypoint> node = _waypoints.First;

            while (node.Next != null)
            {
                _line_points[0].X = node.Value.X;
                _line_points[0].Y = node.Value.Y;
                _line_points[1].X = node.Next.Value.X;
                _line_points[1].Y = node.Next.Value.Y;
                _line.Draw(_line_points, Color.Black);
                node = node.Next;
            }
        }
        // Method for Drawing Lines
        public static void DrawLine(float x1, float y1, float x2, float y2, float w, Color Color)
        {
            drawLine.Width     = w;
            drawLine.Antialias = false;
            drawLine.GlLines   = true;

            Vector2[] vertices =
            {
                new Vector2(x1, y1),
                new Vector2(x2, y2)
            };

            drawLine.Begin();
            drawLine.Draw(vertices, Color.ToArgb());
            drawLine.End();
        }
示例#9
0
 public static void DrawLine(float x1, float y1, float x2, float y2, float w, Color Color)
 {
     Vector2[] vLine = new Vector2[2] {
         new Vector2(x1, y1), new Vector2(x2, y2)
     };
     line.GlLines   = true;
     line.Antialias = false;
     line.Width     = w;
     line.Begin();
     line.Draw(vLine, Color.ToArgb());
     line.End();
 }
示例#10
0
        /// <summary>
        /// Draws a colored line to the screen.
        /// </summary>
        /// <param name="x1">Starting X position.</param>
        /// <param name="y1">Starting Y position.</param>
        /// <param name="x2">Ending X position.</param>
        /// <param name="y2">Ending Y position.</param>
        /// <param name="red">Red component of the color (0-255).</param>
        /// <param name="green">Green component of the color (0-255).</param>
        /// <param name="blue">Blue component of the color (0-255).</param>
        /// <returns>true if successful, false otherwise.</returns>
        public bool DrawLine(int x1, int y1, int x2, int y2, Int32 red, Int32 green, Int32 blue)
        {
            if (line == null)
            {
                return(false);
            }

            Vector2[] verts = new Vector2[2];

            verts[0].X = x1;
            verts[0].Y = y1;

            verts[1].X = x2;
            verts[1].Y = y2;

            line.Draw(verts, System.Drawing.Color.FromArgb(red, green, blue));

            return(true);
        }
示例#11
0
        // Method for drawing Filled Boxes
        public static void DrawFilledBox(float x, float y, float w, float h, Color Color)
        {
            Vector2[] vLine = new Vector2[2];

            drawFilledBoxLine.Width     = w;
            drawFilledBoxLine.GlLines   = true;
            drawFilledBoxLine.Antialias = false;

            vLine[0].X = x + w / 2;
            vLine[0].Y = y;
            vLine[1].X = x + w / 2;
            vLine[1].Y = y + h;

            drawFilledBoxLine.Begin();
            drawFilledBoxLine.Draw(vLine, Color.ToArgb());
            drawFilledBoxLine.End();

            /*              Example             */
            /* DrawFilledBox(x , y, w, h, color); */
        }