Implements the IInputSimulator interface to simulate Keyboard and Mouse input and provide the state of those input devices.
상속: IInputSimulator
예제 #1
0
        private static void Click(Func<Point, Point> coordinatesProvider) {
            var originalPosition = Cursor.Position;
            var screen = Screen.FromPoint(originalPosition);

            var screenWidth = screen.Bounds.Width;
            var screenHeight = screen.Bounds.Height;
            var coordinates = coordinatesProvider(new Point(screenWidth, screenHeight));

            var inputSimulator = new InputSimulator();

            inputSimulator.Mouse.MoveMouseTo(65536d * coordinates.X / screenWidth, 65536d * coordinates.Y / screenHeight);
            inputSimulator.Mouse.LeftButtonClick();
            inputSimulator.Mouse.MoveMouseTo(65536d * originalPosition.X / screenWidth, 65536d * originalPosition.Y / screenHeight);
        }
예제 #2
0
 public ClassicShooter() {
     _inputSimulator = new InputSimulator();
 }