Ejemplo n.º 1
0
        public void BoundingBoxTest()
        {
            System.Console.Out.WriteLine("Running bounding box Test");
            SFML.Graphics.RenderTexture MyTexture = new SFML.Graphics.RenderTexture(100, 100);

            MyTexture.Clear(SFML.Graphics.Color.White);

            SFML.Graphics.Sprite TestSprite1 = new SFML.Graphics.Sprite();
            TestSprite1.Texture = MyTexture.Texture;

            TestSprite1.Position = new SFML.Window.Vector2f(0, 0);

            SFML.Graphics.Sprite TestSprite2 = new SFML.Graphics.Sprite();
            TestSprite2.Texture  = MyTexture.Texture;
            TestSprite2.Position = new SFML.Window.Vector2f(10, 10);


            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(0, 200);
            Assert.IsFalse(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(0, 100);
            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(-50, -50);
            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));
        }