Ejemplo n.º 1
0
        public void GetsHigherPriorityObjectUnderMouse()
        {
            var Input = new TestInputProvider();
            var World = GetTestWorld(Input);

            // push another layer with higher priority
            Scene Stack2 = new Scene("s2")
            {
                Enabled = true, DrawOrder = 5
            };

            var o2 = new Entity("o2");

            o2.Add <HotspotRectangle>().SetRectangle(5, 5, 5, 5);

            Stack2.Push(o2);

            World.Push(Stack2);
            World.UpdatePriority();

            Input.MouseMove(6, 6);
            Input.Dispatch();

            Assert.AreEqual(World.GetGameObject("o2"), World.Get <Mouse>().ObjectUnderMouse);
        }
Ejemplo n.º 2
0
        public void NoneUnderMouse()
        {
            var Input = new TestInputProvider();
            var World = GetTestWorld(Input);

            Input.MouseMove(4, 4);
            Input.Dispatch();

            Assert.AreEqual(null, World.Get <Mouse>().ObjectUnderMouse);
        }
Ejemplo n.º 3
0
        public void GetsObjectUnderMouse()
        {
            var Input = new TestInputProvider();
            var World = GetTestWorld(Input);

            Input.MouseMove(6, 6);
            Input.Dispatch();

            Assert.AreEqual(World.GetGameObject("o1"), World.Get <Mouse>().ObjectUnderMouse);
        }
Ejemplo n.º 4
0
        public void InteractiveMouseClick()
        {
            var Input = new TestInputProvider();
            var World = GetTestWorld(Input);

            World.Push(new ClickScene());
            Input.MouseMove(52, 52);
            Input.Dispatch();

            World.Interactive = false;
            Input.MouseClick();
            Input.Dispatch();
        }
Ejemplo n.º 5
0
        public void InteractiveMousePosition()
        {
            var Input = new TestInputProvider();
            var World = GetTestWorld(Input);

            Input.MouseMove(5, 5);
            Input.Dispatch();
            Assert.AreEqual(new Vector2(5, 5), World.Get <Mouse>().Position);
            World.Interactive = false;
            Input.MouseMove(2, 7);
            Input.Dispatch();
            World.Interactive = true;
            Assert.AreEqual(new Vector2(2, 7), World.Get <Mouse>().Position);
        }
Ejemplo n.º 6
0
 public SessionSevenTestEngine(StackGame game, IServiceProvider services, TestInputProvider input, GameSettings settings = null)
     : base(game, services, input, settings)
 {
 }