Ejemplo n.º 1
0
    private QRect TargetRect()
    {
        QRect result = new QRect(0, 0, 20, 10);

        result.MoveCenter(new QPoint(target.X(), Height() - 1 - target.Y()));
        return(result);
    }
Ejemplo n.º 2
0
    private void moveShot()
    {
        QRegion region = new QRegion(shotRect());

        timerCount++;

        QRect shotR = shotRect();

        if (shotR.Intersects(targetRect()))
        {
            autoShootTimer.Stop();
            Emit.hit();
            Emit.canShoot(true);
        }
        else if (shotR.X() > Width() || shotR.Y() > Height())
        {
            autoShootTimer.Stop();
            Emit.missed();
            Emit.canShoot(true);
        }
        else
        {
            region = region.Unite(new QRegion(shotR));
        }

        Update(region);
    }
        public override void OnStart(QGetContent content)
        {
            Frames = Scene.MegaTexture["cavern_biome"].Split(16, 16);
            Tile   = Frames[0];

            Sprite          = new QSprite(this, Tile);
            Sprite.Color    = QColor.DarkKhaki;
            Sprite.Layer    = 100f;
            Transform.Scale = new QVec(4);

            int random = QRandom.Range(1, 10);

            if (random == 1)
            {
                Mushroom = Frames[2];
            }
            else if (random == 2)
            {
                Mushroom = Frames[3];
            }
            else if (random == 3)
            {
                Mushroom = Frames[4];
            }
            else
            {
                Mushroom = QRect.Empty;
            }

            body          = World.CreateRectangle(this, 14 * 4, 14 * 4, 1f, Transform.Position, 0, QBodyType.Static);
            body.Friction = 6f;
        }
Ejemplo n.º 4
0
    private void MoveShot()
    {
        QRegion region = new QRegion(ShotRect());

        timerCount++;

        QRect shotR = ShotRect();

        if (shotR.Intersects(TargetRect()))
        {
            autoShootTimer.Stop();
            Emit.Hit();
            Emit.CanShoot(true);
        }
        else if (shotR.X() > Width() || shotR.Y() > Height() ||
                 shotR.Intersects(BarrierRect()))
        {
            autoShootTimer.Stop();
            Emit.Missed();
            Emit.CanShoot(true);
        }
        else
        {
            region = region.Unite(shotR);
        }

        Update(region);
    }
Ejemplo n.º 5
0
        public void OnStart(QGetContent content)
        {
            Sprite          = new QSprite(this, "cavern_wall");
            Sprite.Origin   = new QVec(8);
            Sprite.Layer    = 1f;
            Sprite.Color   *= 0.4f;
            Transform.Scale = new QVec(4);

            QRect wall = Scene.MegaTexture["cavern_biome"].Split(16, 16)[1];

            using (var layer2 = content.Texture("map1_3").GetPartialTexture(new QRect(0, 0, 128, 128)))
            {
                OutsideTiles = QMapTools.CreateSpriteLayer(layer2, Transform.Position, new QVec(16, 16) * Transform.Scale, color =>
                {
                    if (color == new QColor(60, 45, 30))
                    {
                        return(wall);
                    }
                    return(QRect.Empty);
                });

                InsideTiles = QMapTools.CreateSpriteLayer(layer2, Transform.Position, new QVec(16, 16) * Transform.Scale, color =>
                {
                    if (color == new QColor(134, 97, 61))
                    {
                        return(wall);
                    }
                    return(QRect.Empty);
                });
            }
        }
Ejemplo n.º 6
0
    private QRect CannonRect()
    {
        QRect result = new QRect(0, 0, 50, 50);

        result.MoveBottomLeft(Rect.BottomLeft());
        return(result);
    }
Ejemplo n.º 7
0
        public void TestIntegerConstructor()
        {
            var s = new QRect(50, 100, 200, 150);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Ejemplo n.º 8
0
        void DrawShapes(QPainter painter)
        {
            painter.SetRenderHint(QPainter.RenderHint.Antialiasing);
            painter.Pen   = new QPen(new QBrush(new QColor("Gray")), 1);
            painter.Brush = new QColor("Gray");

            var path = new QPainterPath();

            path.MoveTo(5, 5);
            path.CubicTo(40, 5, 50, 50, 99, 99);
            path.CubicTo(5, 99, 50, 50, 5, 5);
            painter.DrawPath(path);

            painter.DrawPie(130, 20, 90, 60, 30 * 16, 120 * 16);
            painter.DrawChord(240, 30, 90, 60, 0, 16 * 180);
            var rectangle = new QRect(new QPoint(20, 120), new QSize(80, 50));

            painter.DrawRoundedRect(rect: rectangle, xRadius: 10, yRadius: 10);

            // to be implemented
            //var points = new List<QPoint>();
            //points.Add ( new QPoint ( 130, 140 ) );
            //points.Add ( new QPoint ( 180, 170 ) );
            //points.Add ( new QPoint ( 180, 140 ) );
            //points.Add ( new QPoint ( 220, 110 ) );
            //points.Add ( new QPoint ( 140, 100 ) );

            //// http://doc.qt.io/qt-5/qpolygon.html#QPolygon-2 , we should be able to pase point list
            //var polygon = new QPolygon(points);
            //painter.DrawPolygon ( polygon );

            // this is workaround for DrawPolygon
            unsafe
            {
                var polygon = new QPolygon();
                var points  = new int[] { 130, 140, 180, 170, 180, 140, 220, 110, 140, 100 };
                fixed(int *point = points)
                {
                    polygon.SetPoints(points.Length / 2, ref *point);
                }

                painter.DrawPolygon(polygon);
            }

            painter.DrawRect(250, 110, 60, 60);

            var baseline  = new QPointF(20, 250);
            var font      = new QFont("Georgia", 55);
            var forntPath = new QPainterPath();

            forntPath.AddText(baseline, font, "Q");
            painter.DrawPath(forntPath);

            painter.DrawEllipse(140, 200, 60, 60);
            painter.DrawEllipse(240, 200, 90, 60);
        }
Ejemplo n.º 9
0
 public void OnStart(QGetContent get)
 {
     Heart               = get.TextureSource("BryanStuff1").Split(32, 32)[21];
     EmptyHeart          = get.TextureSource("BryanStuff1").Split(32, 32)[22];
     p                   = GetBehavior <Player>();
     GuiHeart            = new QImage(this, Heart);
     GuiEmptyHeart       = new QImage(this, EmptyHeart);
     GuiHeart.Scale      = new QVec(4);
     GuiEmptyHeart.Scale = new QVec(4);
 }
Ejemplo n.º 10
0
        public void TestY()
        {
            var s = new QRect();

            s.X      = 200;
            s.Y      = 300;
            s.Width  = 500;
            s.Height = 600;

            Assert.AreEqual(300, s.Y);
        }
Ejemplo n.º 11
0
        public void TestLeft()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            Assert.AreEqual(50, s.Left);
        }
Ejemplo n.º 12
0
        public void TestWidth()
        {
            var s = new QRect();

            s.X      = 0;
            s.Y      = 0;
            s.Width  = 500;
            s.Height = 600;

            Assert.AreEqual(500, s.Width);
        }
Ejemplo n.º 13
0
        public void TestPointSizeConstructor()
        {
            var p1 = new QPoint(50, 100);
            var p2 = new QSize(200, 150);

            var s = new QRect(p1, p2);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Ejemplo n.º 14
0
        public void TestIsEmpty()
        {
            var s1 = new QRect();

            s1.Left   = 500;
            s1.Right  = 400;
            s1.Top    = 700;
            s1.Bottom = 600;

            var inter = s1.IsEmpty;

            Assert.IsTrue(inter);
        }
Ejemplo n.º 15
0
        public void TestIsNull()
        {
            var s1 = new QRect();

            s1.X      = 0;
            s1.Y      = 0;
            s1.Width  = 0;
            s1.Height = 0;

            var inter = s1.IsNull;

            Assert.IsTrue(inter);
        }
Ejemplo n.º 16
0
        public void TestIsValid()
        {
            var s1 = new QRect();

            s1.Left   = 500;
            s1.Right  = 400;
            s1.Top    = 700;
            s1.Bottom = 600;

            var inter = s1.IsValid;

            Assert.IsFalse(inter);
        }
Ejemplo n.º 17
0
        public void TestBottomRight()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var n = s.BottomRight;

            Assert.AreEqual(new QPoint(s.Left + s.Width - 1, s.Top + s.Height - 1), n);
        }
Ejemplo n.º 18
0
        public void TestContainsWithIntegerValues()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var n = s.Contains(275, 375);

            Assert.IsTrue(n);
        }
Ejemplo n.º 19
0
        public void TestTop()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;

            var size = s.Top;

            Assert.AreEqual(s.Y, size);
        }
Ejemplo n.º 20
0
        public void TestBottom()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var n = s.Bottom;

            Assert.AreEqual(s.Top + s.Height - 1, n);
        }
Ejemplo n.º 21
0
        public void TestMoveBottom()
        {
            var s = new QRect();

            s.Left   = 50;
            s.Top    = 150;
            s.Right  = 600;
            s.Bottom = 500;

            s.MoveBottom(50);

            Assert.AreEqual(50, s.Bottom);
        }
Ejemplo n.º 22
0
        public void TestSize()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;

            var size = s.Size;

            Assert.AreEqual(500, size.Width);
            Assert.AreEqual(600, size.Height);
        }
Ejemplo n.º 23
0
        public void TestTopRight()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;

            var size = s.TopRight;

            Assert.AreEqual(s.Y, size.Y);
            Assert.AreEqual(s.X + s.Width - 1, size.X);
        }
Ejemplo n.º 24
0
        public void TestTranslateInteger()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;

            s.Translate(50, 20);

            Assert.AreEqual(100, s.X);
            Assert.AreEqual(100, s.Y);
        }
Ejemplo n.º 25
0
        public void TestContainsWithQRect()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var p = new QRect(275, 375, 50, 50);
            var n = s.Contains(p, true);

            Assert.IsTrue(n);
        }
Ejemplo n.º 26
0
        public void TestTranslatedQPoint()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;

            var n = s.Translated(new QPoint(50, 20));

            Assert.AreEqual(100, n.X);
            Assert.AreEqual(100, n.Y);
        }
Ejemplo n.º 27
0
        public void TestCenter()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var n = s.Center;

            Assert.AreEqual(299, n.X);
            Assert.AreEqual(449, n.Y);
        }
Ejemplo n.º 28
0
        public void TestRight()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 80;
            s.Width  = 500;
            s.Height = 600;


            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(s.Left + s.Width - 1, s.Right);
            Assert.AreEqual(80, s.Y);
        }
Ejemplo n.º 29
0
        public void TestAdjusted()
        {
            var s = new QRect();

            s.X      = 50;
            s.Y      = 150;
            s.Width  = 500;
            s.Height = 600;

            var n = s.Adjusted(50, 100, 150, 200);

            Assert.AreEqual(100, n.X);
            Assert.AreEqual(250, n.Y);
            Assert.AreEqual(600, n.Width);
            Assert.AreEqual(700, n.Height);
        }
Ejemplo n.º 30
0
        public void TestNormalized()
        {
            var s = new QRect();

            s.X      = 0;
            s.Y      = 0;
            s.Width  = -1;
            s.Height = -1;

            var n = s.Normalized;

            Assert.IsTrue(n.Width > 0);
            Assert.IsTrue(n.Height > 0);
            Assert.AreEqual(-2, n.X);
            Assert.AreEqual(-2, n.Y);
        }
Ejemplo n.º 31
0
        public void TestAddMarginToNewRectOperator2()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QMargins(100, 100, 100, 100);

            var n = s2 + s1;

            Assert.AreEqual(-100, n.X);
            Assert.AreEqual(-100, n.Y);
            Assert.AreEqual(700, n.Width);
            Assert.AreEqual(800, n.Height);
        }
Ejemplo n.º 32
0
        public void TestAddMarginOperator()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QMargins(100, 100, 100, 100);

            s1 += s2;

            Assert.AreEqual(-100, s1.X);
            Assert.AreEqual(-100, s1.Y);
            Assert.AreEqual(700, s1.Width);
            Assert.AreEqual(800, s1.Height);
        }
Ejemplo n.º 33
0
        public void TestNormalized()
        {
            var s = new QRect();
            s.X = 0;
            s.Y = 0;
            s.Width = -1;
            s.Height = -1;

            var n = s.Normalized;

            Assert.IsTrue(n.Width > 0);
            Assert.IsTrue(n.Height > 0);
            Assert.AreEqual(-2, n.X);
            Assert.AreEqual(-2, n.Y);
        }
Ejemplo n.º 34
0
        public void TestPipeOperator()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QRect();
            s2.X = 100;
            s2.Y = 100;
            s2.Width = 500;
            s2.Height = 600;

            var n = s1 | s2;

            Assert.AreEqual(0, n.X);
            Assert.AreEqual(0, n.Y);
            Assert.AreEqual(600, n.Width);
            Assert.AreEqual(700, n.Height);
        }
Ejemplo n.º 35
0
        public void TestNotEqualOperator()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QRect();
            s2.X = 100;
            s2.Y = 100;
            s2.Width = 500;
            s2.Height = 600;

            Assert.AreNotEqual(s1, s2);
        }
Ejemplo n.º 36
0
        public void TestMarginsRemoved()
        {
            var s = new QRect();
            s.Left = 50;
            s.Top = 150;
            s.Right = 600;
            s.Bottom = 500;

            var mar = new QMargins(50, 100, 150, 200);

            var newR = s.MarginsRemoved(mar);

            Assert.AreEqual(100, newR.Left);
            Assert.AreEqual(250, newR.Top);
            Assert.AreEqual(450, newR.Right);
            Assert.AreEqual(300, newR.Bottom);
        }
Ejemplo n.º 37
0
        public void TestPointSizeConstructor()
        {
            var p1 = new QPoint(50, 100);
            var p2 = new QSize(200, 150);

            var s = new QRect(p1, p2);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Ejemplo n.º 38
0
        public void TestMoveCenter()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 100;
            s.Width = 500;
            s.Height = 600;

            s.MoveCenter(new QPoint(600, 600));

            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(600 - 250 + 1, s.X);
            Assert.AreEqual(600 - 300 + 1, s.Y);
        }
Ejemplo n.º 39
0
        public void TestMoveBottom()
        {
            var s = new QRect();
            s.Left = 50;
            s.Top = 150;
            s.Right = 600;
            s.Bottom = 500;

            s.MoveBottom(50);

            Assert.AreEqual(50, s.Bottom);
        }
Ejemplo n.º 40
0
        public void TestSubMarginToNewRectOperator()
        {
            var s1 = new QRect();
            s1.X = 100;
            s1.Y = 100;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QMargins(100, 100, 100, 100);

            var n = s1 - s2;

            Assert.AreEqual(200, n.X);
            Assert.AreEqual(200, n.Y);
            Assert.AreEqual(300, n.Width);
            Assert.AreEqual(400, n.Height);
        }
Ejemplo n.º 41
0
        public void TestIntersects()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QRect();
            s2.X = 400;
            s2.Y = 500;
            s2.Width = 500;
            s2.Height = 600;

            var inter = s1.Intersects(s2);

            Assert.IsTrue(inter);
        }
Ejemplo n.º 42
0
        public void TestTop()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            var size = s.Top;

            Assert.AreEqual(s.Y, size);
        }
Ejemplo n.º 43
0
        public void TestAdjust()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 150;
            s.Width = 500;
            s.Height = 600;

            s.Adjust(50, 100, 150, 200);

            Assert.AreEqual(100, s.X);
            Assert.AreEqual(250, s.Y);
            Assert.AreEqual(600, s.Width);
            Assert.AreEqual(700, s.Height);
        }
Ejemplo n.º 44
0
        public void TestTopRight()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            var size = s.TopRight;

            Assert.AreEqual(s.Y, size.Y);
            Assert.AreEqual(s.X + s.Width - 1, size.X);
        }
Ejemplo n.º 45
0
        public void TestTranslatedInteger()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            var n = s.Translated(50, 20);

            Assert.AreEqual(100, n.X);
            Assert.AreEqual(100, n.Y);
        }
Ejemplo n.º 46
0
        public void TestIsEmpty()
        {
            var s1 = new QRect();
            s1.Left = 500;
            s1.Right = 400;
            s1.Top = 700;
            s1.Bottom = 600;

            var inter = s1.IsEmpty;

            Assert.IsTrue(inter);
        }
Ejemplo n.º 47
0
        public void TestMoveToQPoint()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            s.MoveTo(new QPoint(100, 100));

            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(100, s.X);
            Assert.AreEqual(100, s.Y);
        }
Ejemplo n.º 48
0
        public void TestSize()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            var size = s.Size;

            Assert.AreEqual(500, size.Width);
            Assert.AreEqual(600, size.Height);
        }
Ejemplo n.º 49
0
        public void TestMoveRight()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 100;
            s.Width = 500;
            s.Height = 600;

            s.MoveRight(50);

            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(-449, s.X);
            Assert.AreEqual(100, s.Y);
        }
Ejemplo n.º 50
0
        public void TestSetRect()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 150;
            s.Width = 500;
            s.Height = 600;

            s.SetRect(100, 100, 500, 500);

            Assert.AreEqual(100, s.X);
            Assert.AreEqual(100, s.Y);
            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(500, s.Height);
        }
Ejemplo n.º 51
0
        public void TestMoveBottomRight()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 100;
            s.Width = 500;
            s.Height = 600;

            s.MoveBottomRight(new QPoint(600, 600));

            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(101, s.X);
            Assert.AreEqual(1, s.Y);
        }
Ejemplo n.º 52
0
        public void TestRight()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            Assert.AreEqual(500, s.Width);
            Assert.AreEqual(600, s.Height);
            Assert.AreEqual(s.Left + s.Width - 1, s.Right);
            Assert.AreEqual(80, s.Y);
        }
Ejemplo n.º 53
0
        public void TestIsValid()
        {
            var s1 = new QRect();
            s1.Left = 500;
            s1.Right = 400;
            s1.Top = 700;
            s1.Bottom = 600;

            var inter = s1.IsValid;

            Assert.IsFalse(inter);
        }
Ejemplo n.º 54
0
        public void TestIntersected()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QRect();
            s2.X = 400;
            s2.Y = 500;
            s2.Width = 500;
            s2.Height = 600;

            var inter = s1.Intersected(s2);

            Assert.AreEqual(400, inter.X);
            Assert.AreEqual(500, inter.Y);
            Assert.AreEqual(100, inter.Width);
            Assert.AreEqual(100, inter.Height);
        }
Ejemplo n.º 55
0
        public void TestIsNull()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 0;
            s1.Height = 0;

            var inter = s1.IsNull;

            Assert.IsTrue(inter);
        }
Ejemplo n.º 56
0
        public void TestLeft()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 150;
            s.Width = 500;
            s.Height = 600;

            Assert.AreEqual(50, s.Left);
        }
Ejemplo n.º 57
0
        public unsafe void TestGetRect()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 150;
            s.Width = 500;
            s.Height = 600;

            int x1 = 0;
            int y1 = 0;
            int width = 0;
            int height = 0;

            s.GetRect(ref x1, ref y1, ref width, ref height);

            Assert.AreEqual(50, x1);
            Assert.AreEqual(150, y1);
            Assert.AreEqual(500, width);
            Assert.AreEqual(600, height);
        }
Ejemplo n.º 58
0
        public void TestIntegerConstructor()
        {
            var s = new QRect(50, 100, 200, 150);

            Assert.AreEqual(50, s.Left);
            Assert.AreEqual(100, s.Top);
            Assert.AreEqual(200, s.Width);
            Assert.AreEqual(150, s.Height);
        }
Ejemplo n.º 59
0
        public void TestTranslateQPoint()
        {
            var s = new QRect();
            s.X = 50;
            s.Y = 80;
            s.Width = 500;
            s.Height = 600;

            s.Translate(new QPoint(50, 20));

            Assert.AreEqual(100, s.X);
            Assert.AreEqual(100, s.Y);
        }
Ejemplo n.º 60
0
        public void TestUnited()
        {
            var s1 = new QRect();
            s1.X = 0;
            s1.Y = 0;
            s1.Width = 500;
            s1.Height = 600;

            var s2 = new QRect();
            s2.X = 100;
            s2.Y = 100;
            s2.Width = 500;
            s2.Height = 600;

            var n = s1.United(s2);

            Assert.AreEqual(0, n.X);
            Assert.AreEqual(0, n.Y);
            Assert.AreEqual(600, n.Width);
            Assert.AreEqual(700, n.Height);
        }