private void Form1_Load(object sender, EventArgs e) { mus = new MyUserSettings(); numericX.Value = mus.secondX; numericY.Value = mus.secondY; keyboardHookManager.Start(); keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, 0x60, () => { Debug.WriteLine("Alt+NumPad0 detected"); //click screen SimMouse.Click(MouseButtons.Left, (int)numericX.Value, (int)numericY.Value); //right minus Thread.Sleep(100); //get active app handle IntPtr handle1 = GetForegroundWindow(); //move app ShowWindow(handle1, 1); MoveWindow(handle1, 200, 200, 500, 500, true); //------------------------------------- //click screen SimMouse.Click(MouseButtons.Left, 1780, 0); //left minus Thread.Sleep(100); //get active app handle IntPtr handle2 = GetForegroundWindow(); //move app ShowWindow(handle2, 1); MoveWindow(handle2, 2120, 363, 500, 500, true); ShowWindowAsync(handle1, 3); ShowWindowAsync(handle2, 3); /* * // left to right * SimMouse.Click(MouseButtons.Left, 1780, 0); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 1780, 0); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 1780, 200); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 1780, 200); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 2780, 200); * Thread.Sleep(1000); * SimMouse.Click(MouseButtons.Left, 3057, 163); * Thread.Sleep(1000); * * //right to left * SimMouse.Act(SimMouse.Action.LeftButtonDown, 3057, 163); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 3057, 363); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 3057, 363); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 1780, 363); */ }); notifyIcon1.Visible = true; timer1.Stop(); this.Hide(); }
private void MoveCursor3_Click(object sender, RoutedEventArgs e) { SimMouse.Act(SimMouse.Action.MoveOnly, 1893, 1061); }
private void Update() { if (Input.GetKeyDown(KeyCode.M)) { _active = !_active; } _left.Position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch); _right.Position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch); _left.AngularVelocity = OVRInput.GetLocalControllerVelocity(OVRInput.Controller.LTouch); _right.LinearVelocity = OVRInput.GetLocalControllerVelocity(OVRInput.Controller.RTouch); _left.LinearAccelleration = OVRInput.GetLocalControllerAcceleration(OVRInput.Controller.LTouch); _right.AngularAccelleration = OVRInput.GetLocalControllerAcceleration(OVRInput.Controller.RTouch); _left.Rotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch); _right.Rotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch); _left.AngularVelocity = OVRInput.GetLocalControllerAngularVelocity(OVRInput.Controller.LTouch); _right.AngularVelocity = OVRInput.GetLocalControllerAngularVelocity(OVRInput.Controller.RTouch); _left.AngularAccelleration = OVRInput.GetLocalControllerAngularAcceleration(OVRInput.Controller.LTouch); _right.AngularAccelleration = OVRInput.GetLocalControllerAngularAcceleration(OVRInput.Controller.RTouch); var indexL = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, OVRInput.Controller.LTouch); var indexR = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, OVRInput.Controller.RTouch); float x = 0f; float y = 0f; // Shift look up and down by linearly moving controller // Todo: linear, but seen from which perspective? Hands and arms trace arcs. Use that. x += _right.LinearVelocity.x * (0.5f + 0.5f * indexR) * 100f; y += _right.LinearVelocity.y * (0.5f + 0.5f * indexR) * -100f; // Shift look by rotating x += _right.AngularVelocity.y * (0.5f + 0.5f * indexR) * 13f; y += _right.AngularVelocity.x * (0.5f + 0.5f * indexR) * 13f; // Push look by rotating float angleX = AngleAroundAxis(_right.Rotation * Vector3.forward, Vector3.forward, Vector3.up); float angleY = AngleAroundAxis(_right.Rotation * Vector3.forward, Vector3.forward, Vector3.right); x += (Mathf.Sign(angleX) * Mathf.Pow(Mathf.Min(Mathf.Abs(angleX) / 75f, 1f), 2f)) * -120f; y += (Mathf.Sign(angleY) * Mathf.Pow(Mathf.Min(Mathf.Abs(angleY) / 75f, 1f), 2f)) * -120f; if (_active) { // Look SimMouse.ActRaw(SimMouse.Action.MoveOnly, Mathf.RoundToInt(x), Mathf.RoundToInt(y)); //Vector2 moveAnalog = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, OVRInput.Controller.LTouch); // Shoot HandleKey(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTouch, DirectInput.ScanCode.H); // Move HandleKey(OVRInput.Button.Up, OVRInput.Controller.LTouch, DirectInput.ScanCode.W); HandleKey(OVRInput.Button.Down, OVRInput.Controller.LTouch, DirectInput.ScanCode.S); HandleKey(OVRInput.Button.Left, OVRInput.Controller.LTouch, DirectInput.ScanCode.A); HandleKey(OVRInput.Button.Right, OVRInput.Controller.LTouch, DirectInput.ScanCode.D); HandleKey(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch, DirectInput.ScanCode.Space); HandleKey(OVRInput.Button.PrimaryHandTrigger, OVRInput.Controller.LTouch, DirectInput.ScanCode.LControl); // Switch weapons HandleKey(OVRInput.Button.Left, OVRInput.Controller.RTouch, DirectInput.ScanCode.Q); HandleKey(OVRInput.Button.Right, OVRInput.Controller.RTouch, DirectInput.ScanCode.E); HandleKey(OVRInput.Button.One, OVRInput.Controller.RTouch, DirectInput.ScanCode.R); HandleKey(OVRInput.Button.Up, OVRInput.Controller.RTouch, DirectInput.ScanCode.Two); HandleKey(OVRInput.Button.Down, OVRInput.Controller.RTouch, DirectInput.ScanCode.Three); HandleKey(OVRInput.Button.PrimaryThumbstick, OVRInput.Controller.RTouch, DirectInput.ScanCode.One); // Zoom HandleKey(OVRInput.Button.PrimaryHandTrigger, OVRInput.Controller.RTouch, DirectInput.ScanCode.J); } }
private void MoveCursorNearCornerButton_Click(object sender, RoutedEventArgs e) { SimMouse.Act(SimMouse.Action.MoveOnly, 1, 1); }
public void LeftClick(int x, int y, int delay) { SimMouse.Click(MouseButtons.Left, x, y); System.Threading.Thread.Sleep(delay); }