public void Draw()

        {
            for (int i = 0; i < figure.dotlist.Count - 1; i++)
            {
                brush.DrawLine(figure.dotlist[i].X, figure.dotlist[i].Y, figure.dotlist[i + 1].X, figure.dotlist[i + 1].Y);
            }
            brush.DrawLine(figure.dotlist[figure.dotlist.Count - 1].X, figure.dotlist[figure.dotlist.Count - 1].Y, figure.dotlist[0].X, figure.dotlist[0].Y);
        }
Example #2
0
 public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
 {
     if (shadowBrush != null)
     {
         shadowBrush.StrokeWidth = brush.StrokeWidth + 1;
         shadowBrush.DrawLine(x + (float)Math.Cos(45 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(45 * Math.PI / 180.0f) * radius, x + (float)Math.Cos(225 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(225 * Math.PI / 180.0f) * radius);
         shadowBrush.DrawLine(x + (float)Math.Cos(135 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(135 * Math.PI / 180.0f) * radius, x + (float)Math.Cos(315 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(315 * Math.PI / 180.0f) * radius);
     }
     brush.DrawLine(x + (float)Math.Cos(45 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(45 * Math.PI / 180.0f) * radius, x + (float)Math.Cos(225 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(225 * Math.PI / 180.0f) * radius);
     brush.DrawLine(x + (float)Math.Cos(135 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(135 * Math.PI / 180.0f) * radius, x + (float)Math.Cos(315 * Math.PI / 180.0f) * radius, y + (float)Math.Sin(315 * Math.PI / 180.0f) * radius);
 }
Example #3
0
 public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
 {
     if (shadowBrush != null)
     {
         shadowBrush.StrokeWidth = brush.StrokeWidth + 1;
         shadowBrush.DrawLine(x - radius, y, x + radius, y);
         shadowBrush.DrawLine(x, y - radius, x, y + radius);
     }
     brush.DrawLine(x - radius, y, x + radius, y);
     brush.DrawLine(x, y - radius, x, y + radius);
 }
Example #4
0
        public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
        {
            var angle = 30.0f;

            if (shadowBrush != null)
            {
                shadowBrush.StrokeWidth = brush.StrokeWidth + 1;
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((0.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((0.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((120.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + angle) * Math.PI / 180.0f));
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((120.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((240.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + angle) * Math.PI / 180.0f));
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((240.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((360.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((360.0f + angle) * Math.PI / 180.0f));
            }
            brush.DrawLine(x + radius * (float)Math.Cos((0.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((0.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((120.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + angle) * Math.PI / 180.0f));
            brush.DrawLine(x + radius * (float)Math.Cos((120.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((240.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + angle) * Math.PI / 180.0f));
            brush.DrawLine(x + radius * (float)Math.Cos((240.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + angle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((360.0f + angle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((360.0f + angle) * Math.PI / 180.0f));
        }
        public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
        {
            var tickRotationAngle = ((Hud.Game.CurrentRealTimeMilliseconds / 2) % 360);

            if (shadowBrush != null)
            {
                shadowBrush.StrokeWidth = brush.StrokeWidth + 1;
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((0.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((0.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((120.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + tickRotationAngle) * Math.PI / 180.0f));
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((120.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((240.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + tickRotationAngle) * Math.PI / 180.0f));
                shadowBrush.DrawLine(x + radius * (float)Math.Cos((240.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((360.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((360.0f + tickRotationAngle) * Math.PI / 180.0f));
            }
            brush.DrawLine(x + radius * (float)Math.Cos((0.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((0.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((120.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + tickRotationAngle) * Math.PI / 180.0f));
            brush.DrawLine(x + radius * (float)Math.Cos((120.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((120.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((240.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + tickRotationAngle) * Math.PI / 180.0f));
            brush.DrawLine(x + radius * (float)Math.Cos((240.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((240.0f + tickRotationAngle) * Math.PI / 180.0f), x + radius * (float)Math.Cos((360.0f + tickRotationAngle) * Math.PI / 180.0f), y + radius * (float)Math.Sin((360.0f + tickRotationAngle) * Math.PI / 180.0f));
        }
        public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
        {
            Hud.Render.GetMinimapCoordinates(Hud.Game.Me.FloorCoordinate.X, Hud.Game.Me.FloorCoordinate.Y, out float meOnMapX, out float meOnMapY);

            // looks best with triangle-capped ('arrow') brushes:
            // Hud.Render.CreateBrush(255, 255, 255, 255, 3, SharpDX.Direct2D1.DashStyle.Dash, SharpDX.Direct2D1.CapStyle.Flat, SharpDX.Direct2D1.CapStyle.Triangle);

            brush.DrawLine(x, y, meOnMapX, meOnMapY);
        }
Example #7
0
 public void Paint(float x, float y, float radius, IBrush brush, IBrush shadowBrush)
 {
     if (shadowBrush != null)
     {
         shadowBrush.StrokeWidth = brush.StrokeWidth + 1;
         shadowBrush.DrawRectangle(x - radius / 2.0f, y - radius, radius, radius * 2.0f);
     }
     brush.DrawRectangle(x - radius / 2.0f, y - radius, radius, radius * 2.0f);
     brush.DrawLine(x, y - radius / 2.0f, x, y + radius / 2.0f);
 }
Example #8
0
 public void MouseMove(PictureBox sheet, IBrush brush, MouseEventArgs e)
 {
     if (cursorActive == true)
     {
         x2 = e.X;
         y2 = e.Y;
         brush.DrawLine(x1, y1, x2, y2, false);
         x1 = x2;
         y1 = y2;
         Canva.GetCanva.WriteToPictureBox(sheet);
     }
 }
        private void Draw(IWorldCoordinate coord, float startAngle, float endAngle, int sectionsCount,
                          float missingPercent, IBrush bgBrush, IBrush brush)
        {
            var fullAngleRange = endAngle - startAngle;
            var halfRange      = fullAngleRange / 2f;
            var angleStep      = fullAngleRange / sectionsCount;
            var halfStroke     = Stroke / 2f;

            var start = Math.Max(startAngle, startAngle + halfRange * missingPercent);
            var end   = Math.Min(endAngle, endAngle - halfRange * missingPercent);

            if (start > end || start < 0 || end < 0 || start > 360)
            {
                return;
            }

            IScreenCoordinate previousCoord = default(IScreenCoordinate);

            for (var angle = start; angle <= end; angle += angleStep)
            {
                if (angle + angleStep > end) //if it's the last step
                {
                    angle = end;
                }

                //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                var radians = (angle - 135f) * Math.PI / 180.0f;
                var cos     = (float)Math.Cos(radians);
                var sin     = (float)Math.Sin(radians);

                var mx = (Radius + halfStroke) * cos;
                var my = (Radius + halfStroke) * sin;

                if (previousCoord == default(IScreenCoordinate))
                {
                    previousCoord = coord.Offset(mx, my, 0).ToScreenCoordinate();
                    continue;
                }

                var currentCoord = coord.Offset(mx, my, 0).ToScreenCoordinate();

                brush.DrawLine(previousCoord.X, previousCoord.Y, currentCoord.X, currentCoord.Y);

                previousCoord = currentCoord;
            }

            return;

            using (var pg = Hud.Render.CreateGeometry())
            {
                using (var gs = pg.Open())
                {
                    var outerVectors    = new List <Vector2>();
                    var innerVectors    = new List <Vector2>();
                    var capsCoordinates = new List <IWorldCoordinate>();

                    for (var angle = start; angle <= end; angle += angleStep)
                    {
                        if (angle + angleStep > end) //if it's the last step
                        {
                            angle = end;
                        }

                        //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                        var radians = (angle - 135f) * Math.PI / 180.0f;
                        var cos     = (float)Math.Cos(radians);
                        var sin     = (float)Math.Sin(radians);

                        if (angle == start || angle == end)
                        {
                            capsCoordinates.Add(coord.Offset(Radius * cos, Radius * sin, 0));
                        }

                        //outer point
                        var mx = (Radius + halfStroke) * cos;
                        var my = (Radius + halfStroke) * sin;

                        var vector = coord.ToVector2(mx, my, 0);
                        outerVectors.Add(vector);

                        //inner point
                        var mx2 = (Radius - halfStroke) * cos;
                        var my2 = (Radius - halfStroke) * sin;

                        vector = coord.ToVector2(mx2, my2, 0);
                        innerVectors.Add(vector);
                    }

                    gs.BeginFigure(outerVectors.First(), FigureBegin.Filled);
                    foreach (var v in outerVectors.Skip(1))
                    {
                        gs.AddLine(v);
                    }

                    ////TODO: if rounded cap, add half circle
                    //var capCoord = capsCoordinates.Last();
                    //for (var angle = 135f; angle < 315f; angle += 1f)
                    //{
                    //    if (angle + angleStep > end) //if it's the last step
                    //        angle = end;

                    //    //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                    //    var radians = angle * Math.PI / 180.0f;
                    //    var cos = (float)Math.Cos(radians);
                    //    var sin = (float)Math.Sin(radians);

                    //    var mx = halfStroke * cos;
                    //    var my = halfStroke * sin;

                    //    var vector = capCoord.ToVector2(mx - 3, my - 3, 0);
                    //    gs.AddLine(vector);
                    //}

                    innerVectors.Reverse();
                    foreach (var v in innerVectors)
                    {
                        gs.AddLine(v);
                    }

                    //TODO: if rounded cap, add half circle

                    gs.EndFigure(FigureEnd.Closed);

                    //gs.BeginFigure(capsCoordinates.Last().ToVector2(), FigureBegin.Filled);
                    //var capCoord = capsCoordinates.Last();
                    //for (var angle = 90f; angle < 270f; angle += 9f)
                    //{
                    //    if (angle + angleStep > end) //if it's the last step
                    //        angle = end;

                    //    //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                    //    var radians = angle * Math.PI / 180.0f;
                    //    var cos = (float)Math.Cos(radians);
                    //    var sin = (float)Math.Sin(radians);

                    //    var mx = halfStroke * cos;
                    //    var my = halfStroke * sin;

                    //    var vector = capCoord.ToVector2(mx, my, 0);
                    //    gs.AddLine(vector);
                    //}
                    //gs.EndFigure(FigureEnd.Closed);

                    //
                    gs.Close();

                    if (bgBrush != null)
                    {
                        bgBrush.DrawGeometry(pg);
                    }

                    brush.DrawGeometry(pg);
                }
            }
        }