Пример #1
0
 public MouseMovement(MouseMoveType type, int Motion_X, int Motion_Y, int Window_X, int Window_Y)
 {
     Type               = type;
     MotionStartX       = Motion_X;
     MotionStartY       = Motion_Y;
     WindowOriginPointX = Window_X;
     WindowOriginPointY = Window_Y;
 }
Пример #2
0
        public void MoveMouse(MouseMoveType type)
        {
            POINT currentpoint;

            if (GetCursorPos(out currentpoint))
            {
                switch (type)
                {
                case MouseMoveType.Left: Move(currentpoint.X - NextValue, currentpoint.Y); return;

                case MouseMoveType.Right: Move(currentpoint.X + NextValue, currentpoint.Y); return;

                case MouseMoveType.Up: Move(currentpoint.X, currentpoint.Y - NextValue); return;

                case MouseMoveType.Down: Move(currentpoint.X, currentpoint.Y + NextValue); return;
                }
            }
        }
        /// <summary>
        /// <para>absolute mode - dx,dy range is : 0..1 , and mapped to the main display coords</para>
        /// <para>virtual desktop mode - dx,dy range is : 0..1 , and mapped to the entire desktop coords</para>
        /// <para>relative mode - dx,dy are in pixels, relative to the previous mouse position</para>
        /// </summary>
        /// <param name="moveType"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        public InputSequencer mouseMove(MouseMoveType moveType, float dx, float dy)
        {
            var input = new INPUT();

            input.type = InputType.MOUSE;

            input.U.mi.dwFlags = MOUSEEVENTF.MOVE;

            switch (moveType)
            {
            case MouseMoveType.RELATIVE:
                input.U.mi.dwFlags |= 0;
                input.U.mi.dx       = (int)(Math.Round(dx));
                input.U.mi.dy       = (int)(Math.Round(dy));

                break;

            case MouseMoveType.ABSOLUTE:
                //map x,y from 0..1 to 0..65535:
                input.U.mi.dx       = (int)(ushort.MaxValue * Math.Min(1f, Math.Max(0f, dx)));
                input.U.mi.dy       = (int)(ushort.MaxValue * Math.Min(1f, Math.Max(0f, dy)));
                input.U.mi.dwFlags |= MOUSEEVENTF.ABSOLUTE;
                break;

            case MouseMoveType.VIRTUAL_DESKTOP:
                //map x,y from 0..1 to 0..65535:
                input.U.mi.dx       = (int)(ushort.MaxValue * Math.Min(1f, Math.Max(0f, dx)));
                input.U.mi.dy       = (int)(ushort.MaxValue * Math.Min(1f, Math.Max(0f, dy)));
                input.U.mi.dwFlags |= MOUSEEVENTF.VIRTUALDESK;
                break;
            }

            inputs.Add(input);

            return(this);
        }
Пример #4
0
 private void AddStickCursorMoveBinding(ControllerStick stick, Microsoft.Xna.Framework.Vector2 comparisonVector, StickState comparisonState, StickState oldComparisonState, MouseMoveType moveType, UIntVector moveScale, CommandTarget commandTarget, InputMode bindingMode = InputMode.All)
 {
     bindings.Add(ControllerInputBinding.createStickCursorMoveBinding(stick, comparisonVector, comparisonState, oldComparisonState, moveType, moveScale, commandTarget, bindingMode));
 }
Пример #5
0
        internal static ControllerInputBinding createStickCursorMoveBinding(ControllerStick stick, Microsoft.Xna.Framework.Vector2 comparisonVector, StickState comparisonState, StickState oldState, MouseMoveType moveType, Types.UIntVector moveScale, CommandTarget commandTarget, InputMode applicableMode)
        {
            ControllerInputBinding newBinding = new ControllerInputBinding();

            newBinding.stick = new ControllerStickBinding(stick, comparisonVector, comparisonState, oldState);

            CursorMoveCommand newCommand = new CursorMoveCommand();

            newCommand.mouseMove = new MouseMove();
            newCommand.mouseMove.commandTarget = commandTarget;
            newCommand.mouseMove.moveType      = moveType;
            newCommand.mouseMove.moveScale     = moveScale;

            newCommand.applicableMode = applicableMode;
            newBinding.commands.Add(newCommand);
            //bindings.Add(newBinding);

            return(newBinding);
        }