예제 #1
0
        public void Camera2D_ContainsRectangle_Test()
        {
            var graphicsDevice = TestHelper.CreateGraphicsDevice();
            var camera = new Camera2D(graphicsDevice);

            Assert.AreEqual(ContainmentType.Intersects, camera.Contains(new Rectangle(-50, -50, 100, 100)));
            Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Rectangle(50, 50, 100, 100)));
            Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Rectangle(850, 500, 100, 100)));
        }
예제 #2
0
        public void Camera2D_ContainsPoint_Test()
        {
            var graphicsDevice = TestHelper.CreateGraphicsDevice();
            var camera = new Camera2D(graphicsDevice);

            Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Point(1, 1)));
            Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Point(800, 480)));
            Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Point(0, 0)));
            Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Point(801, 481)));
        }
예제 #3
0
 public void Camera2D_ContainsVector2_Test()
 {
     var graphicsDevice = TestHelper.CreateGraphicsDevice();
     var camera = new Camera2D(graphicsDevice);
     
     // the edge cases fall on the half pixel boundary
     Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(0.45f, 0.45f)));
     Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(800.45f, 480.45f)));
     Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(0.55f, 0.55f)));
     Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(800.55f, 480.55f)));
 }