Exemplo n.º 1
0
 static unsafe void move_rect_1(rect* r, int dx, int dy)
 {
   Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
   r->ll.x = unchecked(r->ll.x + dx);
   r->ll.y = unchecked(r->ll.y + dy);
   r->ur.x = unchecked(r->ur.x + dx);
   r->ur.y = unchecked(r->ur.y + dy);
 }
Exemplo n.º 2
0
    void query(node _node, rect _rect)
    {
        if (null == _node)
        {
            return;
        }

        /*
        if (_rect.contains(_node.x, _node.y))
        {
            _node.t.gameObject.renderer.material.color = Color.red;
        }
        else
        {
            _node.t.gameObject.renderer.material.color = Color.white;
        }
        */

        if (_rect.xMax >= _node.x && _rect.yMax >= _node.y)
        {
            query(_node.ne, _rect);
        }

        if (_rect.xMax >= _node.x && _rect.yMin <= _node.y)
        {
            query(_node.se, _rect);
        }

        if (_rect.xMin <= _node.x && _rect.yMin <= _node.y)
        {
            query(_node.sw, _rect);
        }

        if (_rect.xMin <= _node.x && _rect.yMax >= _node.y)
        {
            query(_node.nw, _rect);
        }
    }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.Title = "Костников Иван ИУ5Ц-53Б";
            Console.WriteLine("\t\t\tРабота с коллекциями");

            rectangle rangle = new rectangle(10, 5);
            rect      rect   = new rect(3);
            circle    c      = new circle(8);

            ///////////////////////////////////////////////////////////////////////
            //                            ArrayList                              //
            ///////////////////////////////////////////////////////////////////////
            ArrayList arr = new ArrayList();

            arr.Add(rangle);
            arr.Add(rect);
            arr.Add(c);

            Console.WriteLine("\n{0,70}", "Неотсортированная коллекция ArrayList");
            foreach (figure f in arr)
            {
                Console.WriteLine(f);
            }

            arr.Sort();

            Console.WriteLine("\n{0,70}", "Отсортированная коллекция ArrayList");
            foreach (figure f in arr)
            {
                Console.WriteLine(f);
            }

            ///////////////////////////////////////////////////////////////////////
            //                           List<figure>                            //
            ///////////////////////////////////////////////////////////////////////
            List <figure> list = new List <figure>();

            list.Add(rangle);
            list.Add(rect);
            list.Add(c);

            Console.WriteLine("\n{0,70}", "Неотсортированная коллекция List<figure>");
            foreach (figure f in list)
            {
                Console.WriteLine(f);
            }

            list.Sort();

            Console.WriteLine("\n{0,70}", "Отсортированная коллекция List<figure>");
            foreach (figure f in list)
            {
                Console.WriteLine(f);
            }

            ///////////////////////////////////////////////////////////////////////
            //                           myList<figure>                          //
            ///////////////////////////////////////////////////////////////////////
            myList <figure> myL = new myList <figure>();

            myL.Add(rangle);
            myL.Add(rect);
            myL.Add(c);

            Console.WriteLine("\n{0,70}", "Моя неотсортированная коллекция myList<figure>");

            foreach (figure f in myL)
            {
                Console.WriteLine(f);
            }

            myL.Sort();

            Console.WriteLine("\n{0,70}", "Моя отсортированная коллекция myList<figure>");

            foreach (figure f in myL)
            {
                Console.WriteLine(f);
            }

            ///////////////////////////////////////////////////////////////////////
            //                          myStack<figure>                          //
            ///////////////////////////////////////////////////////////////////////
            myStack <figure> mstack = new myStack <figure>();

            mstack.Push(rangle);
            mstack.Push(rect);
            mstack.Push(c);

            Console.WriteLine("\n{0,70}", "Стек myStack<figure> метод Push()");

            foreach (figure f in mstack)
            {
                Console.WriteLine(f);
            }


            Console.WriteLine("\n{0,70}", "Стек myStack<figure> метод Pop()");

            mstack.Pop();

            foreach (figure f in mstack)
            {
                Console.WriteLine(f);
            }

            ///////////////////////////////////////////////////////////////////////
            //                       SparseMatrix<figure>                        //
            ///////////////////////////////////////////////////////////////////////
            SparseMatrix <figure> matrix = new SparseMatrix <figure>(3, 3);

            matrix[0, 0] = rangle;
            matrix[1, 1] = rect;
            matrix[2, 2] = c;

            Console.WriteLine("\n{0,70}", "Демонстрация SparseMatrix<figure> без вывода площади фигуры");

            Console.WriteLine(matrix);


            Console.WriteLine("\n{0,70}", "Демонстрация SparseMatrix<figure> с выводом площади фигуры");

            Console.WriteLine(matrix.ToStringSquare());

            Console.ReadKey();
        }
Exemplo n.º 4
0
        int GetFirstCreepAttackTime(Replay rp, rect top, rect mid, rect bot)
        {
            List<string> dcCreeps = new List<string>();

            // Sentinel creeps:
            //
            // esen - Treant
            // edry - Druid of the Talon

            dcCreeps.Add("esen");
            dcCreeps.Add("edry");

            // Scourge creeps:
            //
            // unec - Necromancer
            // ugho - Ghoul

            dcCreeps.Add("unec");
            dcCreeps.Add("ugho");

            int minCreepAttackTime = int.MaxValue;

            foreach (Player p in rp.Players)
                foreach (PlayerAction pa in p.Actions)
                    if (pa.IsValidObjects)
                    {
                        string codeID1;
                        rp.dcObjectsCodeIDs.TryGetValue(pa.Object1, out codeID1);

                        if (codeID1 == null || dcCreeps.Contains(codeID1))
                        {
                            if (top.ContainsXY(pa.X, pa.Y) || mid.ContainsXY(pa.X, pa.Y) || bot.ContainsXY(pa.X, pa.Y))
                            {
                                minCreepAttackTime = Math.Min(minCreepAttackTime, pa.Time);
                                break; // go to next player
                            }
                        }
                    }

            return (minCreepAttackTime != int.MaxValue) ? minCreepAttackTime : 180000; // 180000 = 3 minutes (will be used in case of errors)
        }
Exemplo n.º 5
0
        protected void ParseLineups(Replay rp)
        {
            if (Current.map == null) return;

            player sentinel = player.players[0];
            player scourge = player.players[6];

            unit sentinelTopTower = null;
            unit sentinelMidTower = null;
            unit sentinelBotTower = null;

            unit scourgeTopTower = null;
            unit scourgeMidTower = null;
            unit scourgeBotTower = null;

            // Sentinel Towers (Treant Protectors):
            //
            // e00R - level1
            // e011 - level2
            // e00S - level3
            // e019 - level4

            List<unit> sentinelLevel1Towers = new List<unit>(3);
            List<unit> sentinelLevel3Towers = new List<unit>(3);
            foreach (unit u in sentinel.units.Values)
                switch (u.codeID.Text)
                {
                    case "e00R": sentinelLevel1Towers.Add(u);
                        break;

                    case "e00S": sentinelLevel3Towers.Add(u);
                        break;
                }

            sentinelTopTower = GetTowerForLineUp(sentinelLevel1Towers, LineUp.Top, true);
            sentinelMidTower = GetTowerForLineUp(sentinelLevel1Towers, LineUp.Middle, true);
            sentinelBotTower = GetTowerForLineUp(sentinelLevel1Towers, LineUp.Bottom, true);

            // Scourge Towers (Spirit Towers):
            //
            // u00M - level1
            // u00D - level2
            // u00N - level3
            // u00T - level4

            List<unit> scourgeLevel1Towers = new List<unit>(3);
            List<unit> scourgeLevel3Towers = new List<unit>(3);
            foreach (unit u in scourge.units.Values)
                switch (u.codeID.Text)
                {
                    case "u00M": scourgeLevel1Towers.Add(u);
                        break;

                    case "u00N": scourgeLevel3Towers.Add(u);
                        break;
                }

            scourgeTopTower = GetTowerForLineUp(scourgeLevel1Towers, LineUp.Top, false);
            scourgeMidTower = GetTowerForLineUp(scourgeLevel1Towers, LineUp.Middle, false);
            scourgeBotTower = GetTowerForLineUp(scourgeLevel1Towers, LineUp.Bottom, false);

            // create rectangles that will be used to determine the player's lineup

            rect bottomRect = new rect(
                Math.Min(sentinelBotTower.x, scourgeBotTower.x), sentinelBotTower.y,
                Jass.Native.Constants.map.maxX, scourgeBotTower.y);

            // middle rectange will be calculated
            // as the rectange with Width = distance between middle towers
            // and Height = 990 (approximate value that should work fine for middle rectangle)
            // 990 ~== square_root(700^2 + 700^2), so X offset = 700 and Y offset = 700
            rect middleRect = new rect(
                sentinelMidTower.x - 700, sentinelMidTower.y,
                scourgeMidTower.x, scourgeMidTower.y + 700);

            rect topRect = new rect(
                Jass.Native.Constants.map.minX, sentinelTopTower.y,
                Math.Max(scourgeTopTower.x, sentinelTopTower.x), scourgeTopTower.y);

            // create rectangles that will be used to determine the base area for each team
            // rectangle's vertices calculation will be based on coordinates of level3 towers

            rect sentinelBase = GetBaseRectFromTowers(sentinelLevel3Towers, true);
            rect scourgeBase = GetBaseRectFromTowers(scourgeLevel3Towers, false);

            setLineUpsForPlayers(rp, topRect, middleRect, bottomRect, sentinelBase, scourgeBase);
        }
Exemplo n.º 6
0
 protected override DHJassValue Run()
 {
     rect r = new rect(-500, -500, 500, 500);// 1000x1000
     return new DHJassHandle(null, r.handle);
 }
Exemplo n.º 7
0
 ccp(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height),
 public static extern int SendMessage(IntPtr hWnd, int messageID, int wParam, ref rect lParam);
Exemplo n.º 9
0
 public void query(rect _rect)
 {
     query(root, _rect);
 }
        internal static g CmdCreateIconMinusOrPlus(bool ParMinusOrPlus)
        {
            g g1 = new g
            {
                onclick = BoolOptionsEnum.Yes
            };

            rect rectangle1 = new rect
            {
                height = LocalData.TreeIconBoxSize50,
                width  = LocalData.TreeIconBoxSize50,

                stroke_width = LocalData.VisualParams.MinusOrPlusBorderStrokeThickness,
                stroke       = LocalData.VisualParams.MinusOrPlusBorderColor.Name,
                fill         = "transparent",


                rx = LocalData.VisualParams.TreeIconBoxSize * 0.1,
                ry = LocalData.VisualParams.TreeIconBoxSize * 0.1,

                x = LocalData.TreeIconBoxSize25,
                y = LocalData.TreeIconBoxSize25
            };

            g1.Children.Add(rectangle1);

            if (!ParMinusOrPlus)
            {
                line line2 = new line
                {
                    x1 = LocalData.TreeIconBoxSize50,
                    y1 = LocalData.TreeIconBoxSize37,
                    x2 = LocalData.TreeIconBoxSize50,
                    y2 = LocalData.TreeIconBoxSize62,

                    stroke_width = LocalData.VisualParams.MinusOrPlusStrokeThickness,
                    stroke       = LocalData.VisualParams.MinusOrPlusColor.Name
                };


                g1.Children.Add(line2);
            }

            line line1 = new line
            {
                x1 = LocalData.TreeIconBoxSize37,
                y1 = LocalData.TreeIconBoxSize50,
                x2 = LocalData.TreeIconBoxSize62,
                y2 = LocalData.TreeIconBoxSize50,


                stroke_width = LocalData.VisualParams.MinusOrPlusStrokeThickness,
                stroke       = LocalData.VisualParams.MinusOrPlusColor.Name
            };

            g1.Children.Add(line1);


            line line3 = new line
            {
                x1 = LocalData.TreeIconBoxSize75,
                y1 = LocalData.TreeIconBoxSize50,
                x2 = LocalData.VisualParams.TreeIconBoxSize,
                y2 = LocalData.TreeIconBoxSize50,



                stroke_width = LocalData.VisualParams.LineStrokeThickness,
                stroke       = Color.Red.Name
            };

            if (LocalData.VisualParams.IsLineDashed)
            {
                line3.stroke_dasharray = LocalData.VisualParams.DashArrayValue + " " + LocalData.VisualParams.DashArrayValue;
            }

            g1.Children.Add(line3);

            return(g1);
        }
Exemplo n.º 11
0
 private static extern bool GetClientRect(HandleRef hwnd, ref rect rect);
Exemplo n.º 12
0
        public static folderInfo getFolderUserInfo(ref byte[] rawInfo)
        {
            folderInfo info = new folderInfo();

            rect windowBounds = new rect();
            point location = new point();

            windowBounds.top = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 0));
            windowBounds.left = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 2));
            windowBounds.bottom = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 4));
            windowBounds.right = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 6));

            info.windowBounds = windowBounds;

            ushort ff = dataOperations.convToLE(BitConverter.ToUInt16(rawInfo, 8));
            info.isOnDesk=(finderFlags.kIsOnDesk & (finderFlags)ff) == finderFlags.kIsOnDesk;
            info.color = (finderFlags.kColor & (finderFlags)ff)==finderFlags.kColor;
            info.isShared=(finderFlags.kIsShared & (finderFlags)ff)==finderFlags.kIsShared;
            info.hasNoINITs=(finderFlags.kHasNoINITs & (finderFlags)ff)==finderFlags.kHasNoINITs;
            info.hasBeenInited=(finderFlags.kHasBeenInited & (finderFlags)ff)==finderFlags.kHasBeenInited;
            info.hasCustomIcon=(finderFlags.kHasCustomIcon & (finderFlags)ff)==finderFlags.kHasCustomIcon;
            info.isStationery=(finderFlags.kIsStationery & (finderFlags)ff)==finderFlags.kIsStationery;
            info.nameLocked=(finderFlags.kNameLocked & (finderFlags)ff)==finderFlags.kNameLocked;
            info.hasBundle=(finderFlags.kHasBundle & (finderFlags)ff)==finderFlags.kHasBundle;
            info.isInvisible=(finderFlags.kIsInvisible & (finderFlags)ff)==finderFlags.kIsInvisible;
            info.isAlias=(finderFlags.kIsAlias & (finderFlags)ff)==finderFlags.kIsAlias;

            location.v = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 10));
            location.h = dataOperations.convToLE(BitConverter.ToInt16(rawInfo, 12));
            info.location = location;
            info.reserved = dataOperations.convToLE(BitConverter.ToUInt16(rawInfo, 14));

            return info;
        }
        internal static g CmdCreateIconMinusOrPlus(bool ParMinusOrPlus)
        {
            g g1 = new g
            {
                //height = LocalData.IconWithAndHeigth * 2,
                //width = LocalData.IconWithAndHeigth * 2
            };


            rect rectangle1 = new rect();

            rectangle1.onclick = "sas";
            rectangle1.height  = LocalData.IconWithAndHeigth;
            rectangle1.width   = LocalData.IconWithAndHeigth;



            rectangle1.stroke_width = LocalData.MinusOrPlusBorderStrokeThickness;
            rectangle1.stroke       = LocalData.MinusOrPlusBorderColor.Name;
            rectangle1.fill         = "white";


            rectangle1.rx = 4;
            rectangle1.ry = 4;

            rectangle1.x = 14;
            rectangle1.y = 12;

            g1.Children.Add(rectangle1);

            if (!ParMinusOrPlus)
            {
                line line2 = new line();
                //line2.onclick = "sas";
                //line2.id = "p"+DateTime.Now.Ticks;
                line2.x1 = 27;
                line2.y1 = 19;
                line2.x2 = 27;
                line2.y2 = 31;

                line2.stroke_width = LocalData.MinusOrPlusStrokeThickness;


                line2.stroke = LocalData.MinusOrPlusColor.Name;


                g1.Children.Add(line2);
            }

            line line1 = new line();

            //line1.onclick = "sas";
            //line1.id = "plus2";
            line1.x1 = 21;
            line1.y1 = 25;
            line1.x2 = 33;
            line1.y2 = 25;


            line1.stroke_width = LocalData.MinusOrPlusStrokeThickness;
            line1.stroke       = LocalData.MinusOrPlusColor.Name;

            g1.Children.Add(line1);


            line line3 = new line();

            line3.x1 = 40;
            line3.y1 = 25;
            line3.x2 = 52;
            line3.y2 = 25;



            line3.stroke_width = LocalData.LineStrokeThickness;
            line3.stroke       = Color.Red.Name;

            if (LocalData.IsLineDashed)
            {
                line3.stroke_dasharray = LocalData.DashArrayValue + ", " + LocalData.DashArrayValue;
            }

            g1.Children.Add(line3);

            return(g1);
        }
Exemplo n.º 14
0
this = RoundedRect(rect, radiusX, radiusY);
        public void Generate_SVG()
        {
            _Svg = new svg
            {
                id     = "svgPaint",
                width  = par_width,
                height = par_height,
                xmlns  = "http://www.w3.org/2000/svg",
                //style = "background-color: rgba(0, 0, 0, 0.0);",
            };

            _Svg.Children.Add(new rect
            {
                width        = par_width,
                height       = par_height,
                fill         = "none",
                stroke       = "magenta",
                stroke_width = 1,
            });

            CompBlazorPaint currParent = (Parent as CompBlazorPaint);



            #region drawing all the Selection rectangles

            if (currParent.bpSelectionRectangle != null)
            {
                rect bpSelectionRectangleSVGrect = new rect
                {
                    x                = Math.Min((double)currParent.bpSelectionRectangle.Position.x, (double)currParent.bpSelectionRectangle.end.x),
                    y                = Math.Min((double)currParent.bpSelectionRectangle.Position.y, (double)currParent.bpSelectionRectangle.end.y),
                    width            = Math.Abs((double)currParent.bpSelectionRectangle.end.x - currParent.bpSelectionRectangle.Position.x),
                    height           = Math.Abs((double)currParent.bpSelectionRectangle.end.y - currParent.bpSelectionRectangle.Position.y),
                    fill             = "#FAFAFA",
                    stroke           = currParent.bpSelectionRectangle.Color,
                    stroke_width     = currParent.bpSelectionRectangle.LineWidth,
                    stroke_dasharray = "4",
                    style            = "opacity:0.8",
                };
                _Svg.Children.Add(bpSelectionRectangleSVGrect);
            }

            #endregion



            #region drawing all the lines
            foreach (BPaintLine currLine in currParent.ObjectsList.Where(x => x.ObjectType == BPaintOpbjectType.Line))
            {
                line l = new line()
                {
                    x1           = currLine.Position.PtD.X,
                    y1           = currLine.Position.PtD.Y,
                    x2           = currLine.end.PtD.X,
                    y2           = currLine.end.PtD.Y,
                    stroke       = currLine.Color,
                    stroke_width = currLine.LineWidth,
                };
                _Svg.Children.Add(l);

                if (currLine.Selected)
                {
                    RectD p_rect = (currLine as BPaintLine).BoundingRectD();

                    _Svg.Children.Add(new rect
                    {
                        x            = p_rect.x,
                        y            = p_rect.y,
                        width        = p_rect.width,
                        height       = p_rect.height,
                        fill         = "none",
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7",
                    });
                }
            }
            #endregion



            #region drawing all the circles

            foreach (BPaintCircle currCircle in currParent.ObjectsList.Where(x => x.ObjectType == BPaintOpbjectType.Circle))
            {
                circle currSVGCircle = new circle()
                {
                    cx           = currCircle.Position.x,
                    cy           = currCircle.Position.y,
                    r            = currCircle.Position.PtD.DistanceTo(currCircle.end.PtD),
                    fill         = "none",
                    stroke       = currCircle.Color,
                    stroke_width = 2,
                };
                //line circleAuxiliaryLine = new line()
                //{
                //    x1 = currCircle.Position.x,
                //    y1 = currCircle.Position.y,
                //    x2 = currCircle.end.x,
                //    y2 = currCircle.end.y,
                //    stroke = "magenta",
                //    stroke_width = 1,
                //    style = "opacity:0.7"
                //};
                _Svg.Children.Add(currSVGCircle);
                //_Svg.Children.Add(circleAuxiliaryLine);

                if (currCircle.Selected)
                {
                    RectD p_rect = BPaintFunctions.Get_Border_Points(currCircle);

                    _Svg.Children.Add(new rect
                    {
                        x            = p_rect.x,
                        y            = p_rect.y,
                        width        = p_rect.width,
                        height       = p_rect.height,
                        fill         = "none",
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7",
                    });
                }
            }

            #endregion



            #region drawing all the ellipses

            foreach (BPaintEllipse currEllipse in currParent.ObjectsList.Where(x => x.ObjectType == BPaintOpbjectType.Ellipse))
            {
                if (currEllipse.IsValid())
                {
                    ellipse currSVGCircle = currEllipse.SvgEllipseDescription();
                    _Svg.Children.Add(currSVGCircle);

                    if (currEllipse.Selected)
                    {
                        RectD bRect = BPaintFunctions.Get_Border_Points(currEllipse);

                        _Svg.Children.Add(new rect
                        {
                            x            = bRect.x,
                            y            = bRect.y,
                            width        = bRect.width,
                            height       = bRect.height,
                            fill         = "none",
                            stroke       = "magenta",
                            stroke_width = 1,
                            style        = "opacity:0.7",
                        });
                    }

                    line ellipseAuxiliaryLine1 = new line()
                    {
                        x1           = currEllipse.Position.x,
                        y1           = currEllipse.Position.y,
                        x2           = currEllipse.pt2.x,
                        y2           = currEllipse.pt2.y,
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7"
                    };
                    line ellipseAuxiliaryLine2 = new line()
                    {
                        x1           = currEllipse.pt2.x,
                        y1           = currEllipse.pt2.y,
                        x2           = currEllipse.pt3.x,
                        y2           = currEllipse.pt3.y,
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7"
                    };
                    line ellipseAuxiliaryLine3 = new line()
                    {
                        x1           = currEllipse.Position.x,
                        y1           = currEllipse.Position.y,
                        x2           = currEllipse.pt3.x,
                        y2           = currEllipse.pt3.y,
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7"
                    };
                    _Svg.Children.Add(ellipseAuxiliaryLine1);
                    _Svg.Children.Add(ellipseAuxiliaryLine2);
                    _Svg.Children.Add(ellipseAuxiliaryLine3);
                }
            }

            #endregion



            #region Drawing all the Selection region vertices
            foreach (BPaintVertex vertex in currParent.SelectionVerticesList)
            {
                circle currVertexCircle = new circle()
                {
                    cx           = vertex.PtD.X,
                    cy           = vertex.PtD.Y,
                    r            = 5,
                    fill         = "none",
                    stroke       = vertex.Color,
                    stroke_width = 2,
                };
                _Svg.Children.Add(currVertexCircle);

                if (vertex.Selected)
                {
                    RectD p_rect = BPaintFunctions.Get_Border_Points(vertex as BPaintVertex);

                    rect currVertexBoundingRect = new rect
                    {
                        x            = p_rect.x,
                        y            = p_rect.y,
                        width        = p_rect.width,
                        height       = p_rect.height,
                        fill         = "none",
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7",
                    };
                    _Svg.Children.Add(currVertexBoundingRect);
                }
            }
            #endregion



            #region Drawing all the vertices
            foreach (BPaintVertex vertex in currParent.VerticesList)
            {
                circle currVertexCircle = new circle()
                {
                    cx           = vertex.PtD.X,
                    cy           = vertex.PtD.Y,
                    r            = 5,
                    fill         = "wheat",
                    stroke       = vertex.Color,
                    stroke_width = 2,
                };
                _Svg.Children.Add(currVertexCircle);

                if (vertex.Selected)
                {
                    RectD p_rect = BPaintFunctions.Get_Border_Points(vertex as BPaintVertex);

                    rect currVertexBoundingRect = new rect
                    {
                        x            = p_rect.x,
                        y            = p_rect.y,
                        width        = p_rect.width,
                        height       = p_rect.height,
                        fill         = "none",
                        stroke       = "magenta",
                        stroke_width = 1,
                        style        = "opacity:0.7",
                    };
                    _Svg.Children.Add(currVertexBoundingRect);
                }
            }
            #endregion
        }
Exemplo n.º 16
0
        protected override DHJassValue Run()
        {
            rect r = new rect(
                args["minx"].RealValue,
                args["miny"].RealValue,
                args["maxx"].RealValue,
                args["maxy"].RealValue);

            return new DHJassHandle(null, r.handle);
        }
Exemplo n.º 17
0
        private void canvas_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (e.GetCurrentPoint(canvas).Properties.IsLeftButtonPressed)
            {
                #region LINE
                if (drawLine == true)
                {
                    if (drawingLine == false)
                    {
                        tempCursorPOSSTART = new Point(aCursorPOS.X, aCursorPOS.Y);

                        tLine       = new line();
                        tLine.x1    = (float)aCursorPOS.X;
                        tLine.y1    = (float)aCursorPOS.Y;
                        drawingLine = true;
                    }
                    else
                    {
                        drawingLine = true; // true = desenho contínuo

                        Lines.Add(new line
                        {
                            x1 = tLine.x1,
                            y1 = tLine.y1,
                            x2 = tLine.x2,
                            y2 = tLine.y2
                        });

                        // extremidades
                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tLine.x1 + near, tLine.y1 + near), new Point(tLine.x1 - near, tLine.y1 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tLine.x2 + near, tLine.y2 + near), new Point(tLine.x2 - near, tLine.y2 - near)),
                            isVisible = false
                        });

                        // meio
                        Snaps.Add(new snap
                        {
                            type = 2,
                            rect = new Rect(new Point(tLine.x1 + (tLine.x2 - tLine.x1) / 2 + near, tLine.y1 + (tLine.y2 - tLine.y1) / 2 + near),
                                            new Point(tLine.x1 + (tLine.x2 - tLine.x1) / 2 - near, tLine.y1 + (tLine.y2 - tLine.y1) / 2 - near)),
                            isVisible = false
                        });

                        tLine.x1 = tLine.x2; //desenho sequencial
                        tLine.y1 = tLine.y2; //desenho sequencial

                        tempCursorPOSSTART = new Point(tLine.x2, tLine.y2);

                        canvas.Invalidate();
                    }
                }
                #endregion

                #region RECT
                if (drawRect == true)
                {
                    if (drawingRect == false)
                    {
                        tempCursorPOSSTART = new Point(aCursorPOS.X, aCursorPOS.Y);

                        tRect    = new rect();
                        tRect.x1 = (float)aCursorPOS.X;
                        tRect.y1 = (float)aCursorPOS.Y;

                        drawingRect = true;
                    }
                    else
                    {
                        drawingRect = false;

                        Rects.Add(new rect
                        {
                            x1 = tRect.x1,
                            y1 = tRect.y1,
                            x2 = tRect.x2,
                            y2 = tRect.y2
                        });

                        //extremidades
                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tRect.x1 + near, tRect.y1 + near), new Point(tRect.x1 - near, tRect.y1 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tRect.x2 + near, tRect.y1 + near), new Point(tRect.x2 - near, tRect.y1 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tRect.x2 + near, tRect.y2 + near), new Point(tRect.x2 - near, tRect.y2 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type      = 1,
                            rect      = new Rect(new Point(tRect.x1 + near, tRect.y2 + near), new Point(tRect.x1 - near, tRect.y2 - near)),
                            isVisible = false
                        });

                        //meios
                        Snaps.Add(new snap
                        {
                            type = 2,
                            rect = new Rect(new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 + near, tRect.y1 + near),
                                            new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 - near, tRect.y1 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type = 2,
                            rect = new Rect(new Point(tRect.x1 + near, tRect.y1 + (tRect.y2 - tRect.y1) / 2 + near),
                                            new Point(tRect.x1 - near, tRect.y2 - (tRect.y2 - tRect.y1) / 2 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type = 2,
                            rect = new Rect(new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 + near, tRect.y2 + near),
                                            new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 - near, tRect.y2 - near)),
                            isVisible = false
                        });

                        Snaps.Add(new snap
                        {
                            type = 2,
                            rect = new Rect(new Point(tRect.x2 + near, tRect.y1 + (tRect.y2 - tRect.y1) / 2 + near),
                                            new Point(tRect.x2 - near, tRect.y2 - (tRect.y2 - tRect.y1) / 2 - near)),
                            isVisible = false
                        });

                        // centro geometrico
                        Snaps.Add(new snap
                        {
                            type = 3,
                            rect = new Rect(new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 + near, tRect.y1 + (tRect.y2 - tRect.y1) / 2 + near),
                                            new Point(tRect.x1 + (tRect.x2 - tRect.x1) / 2 - near, tRect.y2 - (tRect.y2 - tRect.y1) / 2 - near)),
                            isVisible = false
                        });

                        drawRect  = false; //true = desenho continuo
                        isDrawing = false;
                        canvas.Invalidate();
                    }
                }
                #endregion

                #region CIRCLE
                if (drawCircle == true)
                {
                    if (drawingCircle == false)
                    {
                        tempCursorPOSSTART = new Point(aCursorPOS.X, aCursorPOS.Y);

                        tCircle     = new circle();
                        tCircle.cx1 = (float)aCursorPOS.X;
                        tCircle.cy1 = (float)aCursorPOS.Y;

                        drawingCircle = true;
                    }
                    else
                    {
                        drawingCircle = false;

                        float radius = Vector2.Distance(new Vector2(tCircle.cx1, tCircle.cy1), new Vector2((float)aCursorPOS.X, (float)aCursorPOS.Y));

                        Circles.Add(new circle
                        {
                            cx1    = tCircle.cx1,
                            cy1    = tCircle.cy1,
                            radius = radius
                        });

                        // centro geométrico
                        Snaps.Add(new snap
                        {
                            type      = 3,
                            rect      = new Rect(new Point(tCircle.cx1 + near, tCircle.cy1 + near), new Point(tCircle.cx1 - near, tCircle.cy1 - near)),
                            isVisible = false
                        });

                        drawCircle = false; //true = desenho continuo
                        isDrawing  = false;
                        canvas.Invalidate();
                    }
                }
                #endregion

                #region RULER
                if (measure == true)
                {
                    if (measuring == false)
                    {
                        tempCursorPOSSTART = new Point(aCursorPOS.X, aCursorPOS.Y);

                        tRuler    = new line();
                        tRuler.x1 = (float)aCursorPOS.X;
                        tRuler.y1 = (float)aCursorPOS.Y;

                        measuring = true;
                    }
                    else
                    {
                        measuring = false;
                    }
                }
                #endregion
            }

            #region CAMERAMOVE
            if (e.GetCurrentPoint(canvas).Properties.IsMiddleButtonPressed)
            {
                if (movingScreen == false)
                {
                    cursorMode = 1;
                    canvas.Invalidate();

                    Window.Current.CoreWindow.PointerCursor = new CoreCursor(cursorHand, 0);

                    pointerOffset    = new line();
                    movingScreen     = true;
                    pointerOffset.x1 = (float)aCursorPOS.X;
                    pointerOffset.y1 = (float)aCursorPOS.Y;
                }
            }
            #endregion
        }
Exemplo n.º 18
0
 private static extern bool GetWindowRect(HandleRef hwnd, ref rect rect);
Exemplo n.º 19
0
 public bool intersect(rect other)
 {
     return(x1 <= other.getX2() && x2 >= other.getX1() && y1 <= other.getY2() && y2 >= other.getY1());
 }
Exemplo n.º 20
0
        //protected override void TouchMoveMessage(object sender, point e, ref bool handled)
        //{
        //    if (!_canScroll)
        //        return;

        //    bool doInvalidate = false;

        //    _bMoving = true;

        //    int dest = _scrollY - (e.Y - LastTouch.Y);
        //    if (dest < 0)
        //        dest = 0;
        //    else if (dest > _bmp.Height - _h)
        //        dest = _bmp.Height - _h;
        //    if (_scrollY != dest)
        //    {
        //        _scrollY = dest;
        //        doInvalidate = true;
        //    }

        //    dest = _scrollX - (e.X - LastTouch.X);
        //    if (dest < 0)
        //        dest = 0;
        //    else if (dest > _bmp.Width - _w)
        //        dest = _bmp.Width - _w;
        //    if (_scrollX != dest)
        //    {
        //        _scrollX = dest;
        //        doInvalidate = true;
        //    }


        //    LastTouch = e;
        //    if (doInvalidate)
        //        Invalidate();
        //}

        //protected override void TouchUpMessage(object sender, point e, ref bool handled)
        //{
        //    if (_canScroll)
        //    {
        //        _bMoving = false;
        //        Invalidate();
        //    }
        //}

        #endregion

        #region GUI

        protected override void OnRender(int x, int y, int width, int height)
        {
            // Get Border offset
            int bOffset = 0;

            switch (_border)
            {
            case BorderStyle.Border3D:
                bOffset = 2;
                break;

            case BorderStyle.BorderFlat:
                bOffset = 1;
                break;
            }

            // Check auto-size first
            if (_autosize && _bmp != null)
            {
                _w = _bmp.Width + bOffset + bOffset;
                _h = _bmp.Height + bOffset + bOffset;
            }

            // Render border & background
            ushort fillVal = 256;

            if (_transBkg)
            {
                fillVal = 0;
            }

            switch (_border)
            {
            case BorderStyle.Border3D:
                Core.Screen.DrawRectangle(Colors.White, 1, Left, Top, _w, _h, 0, 0, _bkg, 0, 0, _bkg, 0, 0, fillVal);
                Core.Screen.DrawRectangle(Colors.Gray, 0, Left + 1, Top + 1, _w - 2, _h - 2, 0, 0, _bkg, 0, 0, _bkg, 0, 0, fillVal);
                break;

            case BorderStyle.BorderFlat:
                Core.Screen.DrawRectangle(Colors.Black, 1, Left, Top, _w, _h, 0, 0, _bkg, 0, 0, _bkg, 0, 0, fillVal);
                break;

            case BorderStyle.BorderNone:
                Core.Screen.DrawRectangle(_bkg, 0, Left, Top, _w, _h, 0, 0, _bkg, 0, 0, _bkg, 0, 0, fillVal);
                break;
            }

            // Render Image
            if (_bmp != null)
            {
                rect region = rect.Intersect(new rect(Parent.Left, Parent.Top, Parent.Width, Parent.Height), new rect(Left + bOffset, Top + bOffset, _w - bOffset - bOffset, _h - bOffset - bOffset));
                Core.ClipForControl(this, region.X, region.Y, region.Width, region.Height);
                int dY;
                int dX;
                switch (_scale)
                {
                case ScaleMode.Normal:
                    Core.Screen.DrawImage(Left + bOffset - ScrollX, Top + bOffset - ScrollY, _bmp, 0, 0, _bmp.Width, _bmp.Height);
                    break;

                case ScaleMode.Stretch:
                    Core.Screen.StretchImage(Left + bOffset, Top + bOffset, _bmp, _w - bOffset - bOffset, _h - bOffset - bOffset, 256);
                    break;

                case ScaleMode.Scale:
                    float multiplier;
                    int   dH = _h - bOffset - bOffset;
                    int   dW = _w - bOffset - bOffset;


                    if (_bmp.Height > _bmp.Width)
                    {
                        // Portrait
                        if (dH > dW)
                        {
                            multiplier = dW / (float)_bmp.Width;
                        }
                        else
                        {
                            multiplier = dH / (float)_bmp.Height;
                        }
                    }
                    else
                    {
                        // Landscape
                        if (dH > dW)
                        {
                            multiplier = dW / (float)_bmp.Width;
                        }
                        else
                        {
                            multiplier = dH / (float)_bmp.Height;
                        }
                    }

                    int dsW = (int)(_bmp.Width * multiplier);
                    int dsH = (int)(_bmp.Height * multiplier);
                    dX = Left + bOffset + (int)(dW / 2.0f - dsW / 2.0f);
                    dY = Top + bOffset + (int)(dH / 2.0f - dsH / 2.0f);

                    Core.Screen.StretchImage(dX, dY, _bmp, dsW, dsH, 256);
                    break;

                case ScaleMode.Center:
                    dX = Left + (_w / 2 - _bmp.Width / 2);
                    dY = Top + (_h / 2 - _bmp.Height / 2);
                    Core.Screen.DrawImage(dX, dY, _bmp, 0, 0, _bmp.Width, _bmp.Height);
                    break;

                case ScaleMode.Tile:
                    for (dX = 0; dX < _w; dX += _bmp.Width)
                    {
                        for (dY = 0; dY < _h; dY += _bmp.Height)
                        {
                            Core.Screen.DrawImage(Left + dX, Top + dY, _bmp, 0, 0, _bmp.Width, _bmp.Height);
                        }
                    }
                    break;
                }
            }
            base.OnRender(x, y, width, height);
        }
Exemplo n.º 21
0
 StartCoroutine(ShowImporter(bitmap, rect, resultSize, confirm, cancel));
Exemplo n.º 22
0
 ccp(rect.origin.x,rect.origin.y),
Exemplo n.º 23
0
 static unsafe bool inv_rect(rect* r)
 {
   Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
   Contract.Requires(Contract.WritableBytes(r->ll) >= (uint)sizeof(point));
   Contract.Requires(Contract.WritableBytes(r->ur) >= (uint)sizeof(point));
   return
       r->ll->x <= r->ur->x &&
       r->ll->y <= r->ur->y;
 }
Exemplo n.º 24
0
        protected override void TouchMoveMessage(object sender, point point, ref bool handled)
        {
            try
            {
                if (ActiveChild == null)
                {
                    base.TouchUpMessage(sender, point, ref handled);
                    return;
                }

                if (!_bMove)
                {
                    int diff = System.Math.Abs(point.X - _ptTapHold.X) + System.Math.Abs(point.Y - _ptTapHold.Y);

                    // Let's not just go moving if the users finger slides a bit
                    if (diff < 32)
                    {
                        return;
                    }
                }

                if (_buffer == null)
                {
                    _bMove  = true;
                    _buffer = new Bitmap(_iW - 8, _iH - 8);
                    _buffer.DrawRectangle(0, 0, 0, 0, _iW - 8, _iH - 8, 0, 0, Colors.LightBlue, 0, 0, Colors.LightBlue, 0, 0,
                                          256);
                    ((Shortcut)ActiveChild).RenderToBuffer(_buffer);
                    _mY = ActiveChild.Y;
                    _mX = ActiveChild.X;
                }

                // Invalidate last location, silently
                lock (Core.Screen)
                {
                    Core.Screen.SetClippingRectangle(_mX, _mY, _iW - 8, _iH - 8);
                    Core.Screen.DrawRectangle(0, 0, _mX, _mY, _iW - 8, _iH - 8, 0, 0, _bkgColor, 0, 0, _bkgColor, 0, 0, 256);
                    if (_bkg != null)
                    {
                        Core.Screen.DrawImage(0, 0, _bkg, 0, 0, _bkg.Width, _bkg.Height);
                    }
                    var r = new rect(_mX, _mY, _iW - 8, _iH - 8);
                    for (int i = 0; i < Children.Length; i++)
                    {
                        if (Children[i] != ActiveChild && Children[i].ScreenBounds.Intersects(r))
                        {
                            Children[i].Render();
                        }
                    }

                    // Update Location
                    int tmpX = _mX;
                    int tmpY = _mY;

                    _mY += point.Y - _ptTapHold.Y;
                    _mX += point.X - _ptTapHold.X;
                    if (_mX < 0)
                    {
                        _mX = 0;
                    }
                    else if (_mX + _iW - 8 > Width)
                    {
                        _mX = Width - _iW - 8;
                    }
                    if (_mY < 0)
                    {
                        _mY = 0;
                    }
                    else if (_mY + _iH - 8 > Height)
                    {
                        _mY = Height - _iH - 8;
                    }
                    _ptTapHold = new point(_mX, _mY);

                    // Draw NEW location
                    Core.Screen.SetClippingRectangle(Top, Left, Width, Height);
                    Core.Screen.DrawImage(_mX, _mY, _buffer, 0, 0, 100, 750);

                    // Flush
                    int x = (tmpX < _mX) ? tmpX : _mX;
                    int y = (tmpY < _mY) ? tmpY : _mY;

                    int w = System.Math.Abs(_mX - tmpX) + _iW - 8;
                    int h = System.Math.Abs(_mY - tmpY) + _iH - 8;
                    Core.Screen.Flush(x, y, w, h);
                }
            }
            finally
            {
                base.TouchMoveMessage(sender, point, ref handled);
            }
        }
Exemplo n.º 25
0
        private void ShowHideDock()
        {
            _selIndex = -1;
            _expanded = !_expanded;

            if (!_expanded)
            {
                UpdateDock();
                Parent.Invalidate();
                return;
            }

            int i, d;

            Parent.BringControlToFront(this);

            // Calculate size required to display all menus
            _requiredDisplaySize = (_font.Height + 4) * _menus.Length;

            switch (_dock)
            {
            case DockLocation.Bottom:

                // Calculate new height
                i = _dH + _requiredDisplaySize;

                // Restrict height to 1/2 parent height
                if (_dH + i > Parent.Height / 2)
                {
                    i = Parent.Height / 2 - _dH;
                }

                // Update Y & Height
                _h += i;
                _y -= i;

                // Define Scrollable Area
                _scrollArea = new rect(Left + 8, Top + _dH + 8, _w - 8, _h - _dH - 8);

                // Calculate Scroll Value Range
                _scrollValueRange = _requiredDisplaySize - _scrollArea.Height;

                // Calculate Grip Size
                if (_scrollValueRange > 0)
                {
                    _gripSize = _scrollArea.Height / (_requiredDisplaySize / _scrollArea.Height);
                }
                else
                {
                    _gripSize = 8;
                }

                // Enforce minimum grip size
                if (_gripSize < 8)
                {
                    _gripSize = 8;
                }

                // Update Ellipsis Rect
                _elliRect = new rect(Left, Top, 64, 64);
                break;

            case DockLocation.Left:

                // Calculate new width
                d = 0;
                for (i = 0; i < _menus.Length; i++)
                {
                    _gripSize = FontManager.ComputeExtentEx(_font, _menus[i].Text).Width;
                    if (_gripSize > d)
                    {
                        d = _gripSize;
                    }
                }
                i = _dW + d;

                // Restrict width to 1/2 parent width
                if (_dW + i > Parent.Width / 2)
                {
                    i = Parent.Width / 2 - _dW;
                }

                // Update Width
                _w += i;

                // Define Scrollable Area
                _scrollArea = new rect(Left + 8, Top + 8, _w - _dW - 8, _h - 16);

                // Calculate Scroll Value Range
                if (_scrollValueRange > 0)
                {
                    _scrollValueRange = _requiredDisplaySize - _scrollArea.Height;
                }
                else
                {
                    _gripSize = 8;
                }

                // Calculate Grip Size
                _gripSize = _scrollArea.Height / (_requiredDisplaySize / _scrollArea.Height);

                // Enforce minimum grip size
                if (_gripSize < 8)
                {
                    _gripSize = 8;
                }

                // Update Ellipsis Rect
                _elliRect = new rect(Left + _w - _dW, Top, 64, 64);

                break;

            case DockLocation.Right:
                // Calculate new width
                d = 0;
                for (i = 0; i < _menus.Length; i++)
                {
                    _gripSize = FontManager.ComputeExtentEx(_font, _menus[i].Text).Width;
                    if (_gripSize > d)
                    {
                        d = _gripSize;
                    }
                }
                i = _dW + d;

                // Restrict width to 1/2 parent width
                if (_dW + i > Parent.Width / 2)
                {
                    i = Parent.Width / 2 - _dW;
                }

                // Update X & Width
                _x -= i;
                _w += i;

                // Define Scrollable Area
                _scrollArea = new rect(Left + 8 + _dW, Top + 8, _w - _dW - 8, _h - 16);

                // Calculate Scroll Value Range
                _scrollValueRange = _requiredDisplaySize - _scrollArea.Height;

                // Calculate Grip Size
                if (_scrollValueRange > 0)
                {
                    _gripSize = _scrollArea.Height / (_requiredDisplaySize / _scrollArea.Height);
                }
                else
                {
                    _gripSize = 8;
                }

                // Enforce minimum grip size
                if (_gripSize < 8)
                {
                    _gripSize = 8;
                }

                // Update Ellipsis Rect
                _elliRect = new rect(Left, Top, 64, 64);
                break;

            default:

                // Calculate new height
                i = _dH + _requiredDisplaySize;

                // Restrict height to 1/2 parent height
                if (_dH + i > Parent.Height / 2)
                {
                    i = Parent.Height / 2 - _dH;
                }

                // Update Height
                _h += i;

                // Define Scrollable Area
                _scrollArea = new rect(Left + 8, Top + 8, _w - 8, _h - _dH - 8);

                // Calculate Scroll Value Range
                _scrollValueRange = _requiredDisplaySize - _scrollArea.Height;

                // Calculate Grip Size
                if (_scrollValueRange > 0)
                {
                    _gripSize = _scrollArea.Height / (_requiredDisplaySize / _scrollArea.Height);
                }
                else
                {
                    _gripSize = 8;
                }

                // Enforce minimum grip size
                if (_gripSize < 8)
                {
                    _gripSize = 8;
                }

                // Update Ellipsis Rect
                _elliRect = new rect(Left, Top + _h - 64, 64, 64);
                break;
            }

            _scrollValue = 0;
            Invalidate();
        }
Exemplo n.º 26
0
 static unsafe region fp_rect(rect* r)
 {
   Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
   return union(new region(r, sizeof(rect)), union(new region(r->ll, sizeof(point)), new region(r->ur, sizeof(point))));
 }
Exemplo n.º 27
0
 ccp(rect.origin.x+rect.size.width,rect.origin.y),
Exemplo n.º 28
0
 static unsafe void M(rect* r)
 {
   Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
   r->ll.x = 12;
 }
Exemplo n.º 29
0
 ccp(rect.origin.x,rect.origin.y+rect.size.height),
Exemplo n.º 30
0
 static unsafe bool inv_rect(rect* r)
 {
   Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
   return r->ll.x <= r->ur.x && r->ll.y <= r->ur.y;
 }
Exemplo n.º 31
0
        void setLineUpsForPlayers(Replay rp, rect top, rect mid, rect bot, rect sentinelBase, rect scourgeBase)
        {
            // approximate creep spawn time
            int creepSpawnTime = GetFirstCreepAttackTime(rp, top, mid, bot);

            foreach (Team team in rp.Teams)
                switch (team.Type)
                {
                    case TeamType.Sentinel:
                    case TeamType.Scourge:
                        List<int> alliedHeroes = GetListOfAlliedHeroes(team);
                        foreach (Player p in team.Players)
                        {
                            location l = GetAverageLocation(p, (team.Type == TeamType.Sentinel ? sentinelBase : scourgeBase), alliedHeroes, creepSpawnTime);

                            p.LineUpLocation = l;

                            if (top.ContainsXY(l.x, l.y))
                                p.LineUp = LineUp.Top;
                            else
                                if (mid.ContainsXY(l.x, l.y))
                                    p.LineUp = LineUp.Middle;
                                else
                                    if (bot.ContainsXY(l.x, l.y))
                                        p.LineUp = LineUp.Bottom;
                                    else
                                        p.LineUp = LineUp.JungleOrRoaming;
                        }
                        break;
                }
        }
Exemplo n.º 32
0
  static unsafe void move_rect_2(rect* r, int dx, int dy)
  {
    Contract.Requires(Contract.WritableBytes(r) >= (uint)sizeof(rect));
    Contract.Requires(Contract.WritableBytes(&(r->ll)) >= (uint)sizeof(point));
    Contract.Requires(Contract.WritableBytes(&(r->ur)) >= (uint)sizeof(point));
    move_point(&(r->ll), dx, dy);
    move_point(&(r->ur), dx, dy);

  }
Exemplo n.º 33
0
        location GetAverageLocation(Player player, rect baseArea, List<int> alliedHeroes, int creepSpawnTime)
        {
            double x = 0;
            double y = 0;
            int count = 0;

            foreach (PlayerAction pa in player.Actions)
            {
                // if creeps were not spawned yet, then skip this action
                if (pa.Time < creepSpawnTime) continue;

                // if it's > than 3 minutes since creep spawn then stop
                if (pa.Time > creepSpawnTime + 180000)
                    break;

                if (pa.IsValidObjects && !alliedHeroes.Contains(pa.Object1))
                {
                    // skip this action if it was performed on the base area
                    if (baseArea.ContainsXY(pa.X, pa.Y, 800))
                        continue;

                    if (x == 0 && y == 0)
                    {
                        x = pa.X;
                        y = pa.Y;
                    }
                    else
                    {
                        x += pa.X;
                        y += pa.Y;
                    }

                    count++;
                    if (count > 50) break;
                }
            }

            x /= count;
            y /= count;

            return new location(x, y);
        }
Exemplo n.º 34
0
 => SliceTop(ref rect, line, applySpacing);