private static WindowsMouse GetMouse()
 {
     var resolver = new MockResolver();
     var window = resolver.Window;
     var positionTranslater = new CursorPositionTranslater(window);
     return new WindowsMouse(positionTranslater);
 }
        public void CreateTouchCollection()
        {
            emptyTouchCollection = new TouchCollection(null);
            var positionTranslator = new CursorPositionTranslater(Resolve <Window>());

            touchCollection = new TouchCollection(positionTranslator);
        }
		public void ConvertPixelFromScreenPositionAndBack()
		{
			var positionTranslator = new CursorPositionTranslater(Resolve<Window>());
			var topLeftPixel = Vector2D.Zero;
			var outside = positionTranslator.FromScreenPositionToScreenSpace(topLeftPixel);
			Assert.AreEqual(topLeftPixel, positionTranslator.ToScreenPositionFromScreenSpace(outside));
		}
		private NativeTouchInput GetTestTouchInput()
		{
			var positionTranslater = new CursorPositionTranslater(Resolve<Window>());
			var screenSpacePosition = ScreenSpace.Current.FromPixelSpace(new Vector2D(400, 300));
			var screenPos = positionTranslater.ToScreenPositionFromScreenSpace(screenSpacePosition);
			return new NativeTouchInput(NativeTouchInput.FlagTouchDown, 15, (int)screenPos.X * 100,
				(int)screenPos.Y * 100);
		}
Beispiel #5
0
        public void ConvertPixelFromScreenPositionAndBack()
        {
            var positionTranslator = new CursorPositionTranslater(Resolve <Window>());
            var topLeftPixel       = Vector2D.Zero;
            var outside            = positionTranslator.FromScreenPositionToScreenSpace(topLeftPixel);

            Assert.AreEqual(topLeftPixel, positionTranslator.ToScreenPositionFromScreenSpace(outside));
        }
 private static WindowsMouse GetMouse()
 {
     var resolver = new TestResolver();
     var window = resolver.Resolve<Window>();
     var screen = new QuadraticScreenSpace(window);
     var positionTranslater = new CursorPositionTranslater(window, screen);
     return new WindowsMouse(positionTranslater);
 }
        private NativeTouchInput GetTestTouchInput()
        {
            var positionTranslater  = new CursorPositionTranslater(Resolve <Window>());
            var screenSpacePosition = ScreenSpace.Current.FromPixelSpace(new Vector2D(400, 300));
            var screenPos           = positionTranslater.ToScreenPositionFromScreenSpace(screenSpacePosition);

            return(new NativeTouchInput(NativeTouchInput.FlagTouchDown, 15, (int)screenPos.X * 100,
                                        (int)screenPos.Y * 100));
        }
		[Test, CloseAfterFirstFrame, Ignore] // This moves the mouse every time NCrunch runs!
		public void GetReturnsWhatWasSet()
		{
			var positionTranslator = new CursorPositionTranslater(Resolve<Window>());
			var setPoint = new Vector2D(0.1f, 0.2f);
			positionTranslator.SetCursorPosition(setPoint);
			var getPoint = positionTranslator.GetCursorPosition();
			Assert.AreEqual(setPoint.X, getPoint.X, 0.1f);
			Assert.AreEqual(setPoint.Y, getPoint.Y, 0.1f);
		}
		public void GetClientPositionOnScreen()
		{
			var window = Resolve<Window>();
			var translator = new CursorPositionTranslater(window);
			var outsidePosition = Resolve<ScreenSpace>().FromPixelSpace(new Vector2D(-10, -10));
			var screenPos = translator.ToScreenPositionFromScreenSpace(outsidePosition);
			Assert.IsTrue(screenPos.X < window.PixelPosition.X || screenPos.Y < window.PixelPosition.Y);
			Assert.AreEqual(outsidePosition, translator.FromScreenPositionToScreenSpace(screenPos));
		}
Beispiel #10
0
 public SharpDXMouse(Window window)
 {
     positionTranslater = new CursorPositionTranslater(window);
     mouseCounter       = new MouseDeviceCounter();
     directInput        = new DInput.DirectInput();
     mouse = new DInput.Mouse(directInput);
     mouse.Properties.AxisMode = DInput.DeviceAxisMode.Absolute;
     mouse.Acquire();
     currentState = new DInput.MouseState();
 }
Beispiel #11
0
        public void GetClientPositionOnScreen()
        {
            var window          = Resolve <Window>();
            var translator      = new CursorPositionTranslater(window);
            var outsidePosition = Resolve <ScreenSpace>().FromPixelSpace(new Vector2D(-10, -10));
            var screenPos       = translator.ToScreenPositionFromScreenSpace(outsidePosition);

            Assert.IsTrue(screenPos.X < window.PixelPosition.X || screenPos.Y < window.PixelPosition.Y);
            Assert.AreEqual(outsidePosition, translator.FromScreenPositionToScreenSpace(screenPos));
        }
Beispiel #12
0
        [Test, CloseAfterFirstFrame, Ignore]         // This moves the mouse every time NCrunch runs!
        public void GetReturnsWhatWasSet()
        {
            var positionTranslator = new CursorPositionTranslater(Resolve <Window>());
            var setPoint           = new Vector2D(0.1f, 0.2f);

            positionTranslator.SetCursorPosition(setPoint);
            var getPoint = positionTranslator.GetCursorPosition();

            Assert.AreEqual(setPoint.X, getPoint.X, 0.1f);
            Assert.AreEqual(setPoint.Y, getPoint.Y, 0.1f);
        }
		public void CreateTouchCollection()
		{
			emptyTouchCollection = new TouchCollection(null);
			var positionTranslator = new CursorPositionTranslater(Resolve<Window>());
			touchCollection = new TouchCollection(positionTranslator);
		}
 private TouchCollection CreateCollection()
 {
     var window = resolver.Resolve<Window>();
     var screen = new PixelScreenSpace(window);
     var positionTranslator = new CursorPositionTranslater(window, screen);
     return new TouchCollection(positionTranslator);
 }