Beispiel #1
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();
 }
Beispiel #2
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); */
        }
Beispiel #5
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)\"");
            }
        }
Beispiel #6
0
        public void End()
        {
            _line.End();

            AGT_SystemImages.Begin();
            foreach (AGT_Waypoint point in _waypoints)
            {
                AGT_SystemImages.Draw(AGT_SystemImages.Waypoint, point.X, point.Y, point.Z, point.Diffuse);
            }
            AGT_SystemImages.End();
        }
        // 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();
        }
Beispiel #8
0
        /// <summary>
        /// Ends the Line.
        /// </summary>
        /// <returns>true if successful, false otherwise.</returns>
        public bool LineEnd()
        {
            if (line == null)
            {
                return(false);
            }

            try
            {
                line.End();
            }
            catch (Exception)
            {
                DialogResult r = MessageBox.Show("Failed to end line scene.", "ManagedDirect3D::Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            return(true);
        }
        // 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); */
        }
Beispiel #10
0
 public void End()
 {
     _line.End();
 }