public void Evaluate(int spreadMax) { // Evaluate our split plugin if (DeviceOut.SliceCount > 0) { FDeviceStatesSplitNode.Evaluate(spreadMax); } else { FDeviceStatesSplitNode.Evaluate(0); } }
protected override void Evaluate(int spreadMax, bool enabled) { if (enabled) { FMouseOut[0] = FMouseState; FMouseSplitNode.Evaluate(spreadMax); } }
protected override void Evaluate(int spreadMax, bool enabled) { if (enabled) { if (FKeyboardOut[0] != FKeyboardState) { FKeyboardOut[0] = FKeyboardState; FLegacyKeyStringOut.AssignFrom(FKeyboardState.KeyCodes.Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k))); FKeyboardSplitNode.Evaluate(spreadMax); } } }
protected override void Evaluate(int spreadMax, bool enabled) { var cycleMode = FCycleModeIn.SliceCount > 0 ? FCycleModeIn[0] : CycleMode.NoCycle; var doCycle = cycleMode != CycleMode.NoCycle; if (enabled) { FDeltaMouse.EnableCycles = doCycle; if (doCycle != FLastFrameCycle) { FDeltaMouse.Initialize(Control.MousePosition); } else { FDeltaMouse.Update(); } double x, y; switch (cycleMode) { case CycleMode.Cycle: x = FDeltaMouse.EndlessFloatX - Math.Floor((FDeltaMouse.EndlessFloatY + 1) / 2) * 2; y = FDeltaMouse.EndlessFloatY - Math.Floor((FDeltaMouse.EndlessFloatY + 1) / 2) * 2; break; default: x = FDeltaMouse.EndlessFloatX; y = FDeltaMouse.EndlessFloatY; break; } var buttons = Control.MouseButtons; FMouseOut[0] = new MouseState(x, y, buttons, 0); FMouseSplitNode.Evaluate(spreadMax); } FLastFrameCycle = doCycle; }
protected override void Evaluate(int spreadMax, bool enabled) { var cycleMode = FCycleModeIn.SliceCount > 0 ? FCycleModeIn[0] : CycleMode.NoCycle; var doCycle = cycleMode != CycleMode.NoCycle; if (enabled) { FDeltaMouse.EnableCycles = doCycle; if (doCycle != FLastFrameCycle) { FDeltaMouse.Initialize(Control.MousePosition); } else { FDeltaMouse.Update(); } double x, y; switch (cycleMode) { case CycleMode.Cycle: x = FDeltaMouse.EndlessFloatX - Math.Floor((FDeltaMouse.EndlessFloatY + 1) / 2) * 2; y = FDeltaMouse.EndlessFloatY - Math.Floor((FDeltaMouse.EndlessFloatY + 1) / 2) * 2; break; default: x = FDeltaMouse.EndlessFloatX; y = FDeltaMouse.EndlessFloatY; break; } var buttons = Control.MouseButtons; var mouseState = new MouseState(x, y, buttons, 0); if (mouseState != FLastMouseState) { var virtualScreenSize = SystemInformation.VirtualScreen.Size; var v = new Vector2D(x, y); var vInScreenCoordinates = VMath.Map( v, new Vector2D(-1, -1), new Vector2D(1, 1), new Vector2D(0, virtualScreenSize.Height - 1), new Vector2D(virtualScreenSize.Width - 1, 0), TMapMode.Float); var position = new Point((int)vInScreenCoordinates.x, (int)vInScreenCoordinates.y); if (mouseState.X != FLastMouseState.X || mouseState.Y != FLastMouseState.Y) { FMouseNotificationSubject.OnNext(new MouseMoveNotification(position, virtualScreenSize)); } if (mouseState.IsLeft && !FLastMouseState.IsLeft) { FMouseNotificationSubject.OnNext(new MouseDownNotification(position, virtualScreenSize, MouseButtons.Left)); } else if (!mouseState.IsLeft && FLastMouseState.IsLeft) { FMouseNotificationSubject.OnNext(new MouseUpNotification(position, virtualScreenSize, MouseButtons.Left)); } if (mouseState.IsMiddle && !FLastMouseState.IsMiddle) { FMouseNotificationSubject.OnNext(new MouseDownNotification(position, virtualScreenSize, MouseButtons.Middle)); } else if (!mouseState.IsMiddle && FLastMouseState.IsMiddle) { FMouseNotificationSubject.OnNext(new MouseUpNotification(position, virtualScreenSize, MouseButtons.Middle)); } if (mouseState.IsRight && !FLastMouseState.IsRight) { FMouseNotificationSubject.OnNext(new MouseDownNotification(position, virtualScreenSize, MouseButtons.Right)); } else if (!mouseState.IsRight && FLastMouseState.IsRight) { FMouseNotificationSubject.OnNext(new MouseUpNotification(position, virtualScreenSize, MouseButtons.Right)); } if (mouseState.IsXButton1 && !FLastMouseState.IsXButton1) { FMouseNotificationSubject.OnNext(new MouseDownNotification(position, virtualScreenSize, MouseButtons.XButton1)); } else if (!mouseState.IsXButton1 && FLastMouseState.IsXButton1) { FMouseNotificationSubject.OnNext(new MouseUpNotification(position, virtualScreenSize, MouseButtons.XButton1)); } if (mouseState.IsXButton2 && !FLastMouseState.IsXButton2) { FMouseNotificationSubject.OnNext(new MouseDownNotification(position, virtualScreenSize, MouseButtons.XButton2)); } else if (!mouseState.IsXButton2 && FLastMouseState.IsXButton2) { FMouseNotificationSubject.OnNext(new MouseUpNotification(position, virtualScreenSize, MouseButtons.XButton2)); } if (mouseState.MouseWheel != FLastMouseState.MouseWheel) { var delta = mouseState.MouseWheel - FLastMouseState.MouseWheel; FMouseNotificationSubject.OnNext(new MouseWheelNotification(position, virtualScreenSize, delta * Const.WHEEL_DELTA)); } FLastMouseState = mouseState; } FMouseSplitNode.Evaluate(spreadMax); } FLastFrameCycle = doCycle; }
public void Evaluate(int spreadMax) { // Evaluate our split plugin FMouseSplitNode.Evaluate(spreadMax); }
public void Evaluate(int spreadMax) { KeyboardOut[0].CapsLock = Control.IsKeyLocked(Keys.CapsLock); // Evaluate our split plugin FKeyboardStatesSplitNode.Evaluate(spreadMax); }
public void Evaluate(int spreadMax) { // Evaluate our split plugin FTouchStatesSplitNode.Evaluate(spreadMax); }
protected override void Evaluate(int spreadMax, bool enabled) { if (enabled) { // To support old keyboard node if (FLegacyKeyStringIn.SliceCount > 0) { var keys = FLegacyKeyStringIn.Select(keyAsString => LegacyKeyboardHelper.StringToVirtualKeycode(keyAsString)); FKeyboardIn.SliceCount = 1; FKeyboardIn[0] = new KeyboardState(keys); } if (FKeyboardIn.SliceCount > 0) { var currentKeyboardIn = FKeyboardIn[0] ?? KeyboardState.Empty; if (currentKeyboardIn != FLastKeyboardIn) { var modifierKeys = currentKeyboardIn.ModifierKeys.Select(k => (VirtualKeyCode)k); var keys = currentKeyboardIn.KeyCodes.Select(k => (VirtualKeyCode)k).Except(modifierKeys); InputSimulator.SimulateModifiedKeyStroke(modifierKeys, keys); } FLastKeyboardIn = currentKeyboardIn; } // Works when we call GetKeyState before calling GetKeyboardState ?! //if (FHost.IsRunningInBackground) // FKeysOut[0] = KeyboardState.CurrentAsync; //else var keyboard = KeyboardState.Current; if (keyboard != KeyboardState.Empty && keyboard == FLastKeyboard) { // Keyboard stayed the same if (FStopwatch.ElapsedMilliseconds > 500) { // Simulate key repeat by generating a new keyboard with different time code var time = FStopwatch.ElapsedMilliseconds / 50; var isNewKeyDown = time != FKeyboardOut[0].Time; FKeyboardOut[0] = new KeyboardState(keyboard.KeyCodes, keyboard.CapsLock, (int)time); // Simulate legacy output if (isNewKeyDown) { FLegacyKeyBufferOut.AssignFrom(FKeyDowns); } else { FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } // Evaluate our split plugin FKeyboardSplitNode.Evaluate(spreadMax); } else { // Simulate legacy output FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } } else { FStopwatch.Restart(); FKeyboardOut[0] = keyboard; // Simulate legacy output FLegacyKeyStringOut.AssignFrom(keyboard.KeyCodes.Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k))); FKeyDowns = keyboard.KeyCodes .Except(FLastKeyboard.KeyCodes) .Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k)) .ToList(); if (FKeyDowns.Count > 0) { FLegacyKeyBufferOut.AssignFrom(FKeyDowns); } else { FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } // Evaluate our split plugin FKeyboardSplitNode.Evaluate(spreadMax); } FLastKeyboard = keyboard; } }
protected override void Evaluate(int spreadMax, bool enabled) { if (enabled) { Keyboard inputKeyboard; if (FKeyboardIn.SliceCount > 0 && FKeyboardIn[0] != null) { inputKeyboard = FKeyboardIn[0]; } else { // To support old keyboard node var keys = FLegacyKeyStringIn.Select(keyAsString => LegacyKeyboardHelper.StringToVirtualKeycode(keyAsString)) .ToList(); var keyDowns = keys.Except(FLastLegacyInputKeys); foreach (var keyDown in keyDowns) { FLegacyInputKeyboardSubject.OnNext(new KeyDownNotification(keyDown)); } var keyUps = FLastLegacyInputKeys.Except(keys); foreach (var keyUp in keyUps) { FLegacyInputKeyboardSubject.OnNext(new KeyUpNotification(keyUp)); } FLastLegacyInputKeys = keys; inputKeyboard = FLegacyInputKeyboard; } FInputKeyboardSubscription.Update(inputKeyboard); // Works when we call GetKeyState before calling GetKeyboardState ?! //if (FHost.IsRunningInBackground) // FKeysOut[0] = KeyboardState.CurrentAsync; //else var keyboardState = KeyboardState.Current; if (keyboardState != KeyboardState.Empty && keyboardState == FLastKeyboardState) { // Keyboard stayed the same if (FStopwatch.ElapsedMilliseconds > 500) { // Simulate key repeat by generating a new keyboard with different time code var time = FStopwatch.ElapsedMilliseconds / 50; var isNewKeyDown = time != FLastTime; // Simulate legacy output if (isNewKeyDown) { foreach (var keyDown in FKeyDowns) { FKeyNotificationSubject.OnNext(new KeyDownNotification(keyDown)); } FLegacyKeyBufferOut.AssignFrom(FKeyDowns.Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k))); } else { FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } FLastTime = time; // Evaluate our split plugin FKeyboardSplitNode.Evaluate(spreadMax); } else { // Simulate legacy output FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } } else { FStopwatch.Restart(); var keyDowns = keyboardState.KeyCodes.Except(FLastKeyboardState.KeyCodes); foreach (var keyDown in keyDowns) { FKeyNotificationSubject.OnNext(new KeyDownNotification(keyDown)); } var keyUps = FLastKeyboardState.KeyCodes.Except(keyboardState.KeyCodes); foreach (var keyUp in keyUps) { FKeyNotificationSubject.OnNext(new KeyUpNotification(keyUp)); } FKeyboardOut[0].CapsLock = Control.IsKeyLocked(Keys.CapsLock); // Simulate legacy output FLegacyKeyStringOut.AssignFrom(keyboardState.KeyCodes.Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k))); FKeyDowns = keyboardState.KeyCodes .Except(FLastKeyboardState.KeyCodes) .ToList(); if (FKeyDowns.Count > 0) { FLegacyKeyBufferOut.AssignFrom(FKeyDowns.Select(k => LegacyKeyboardHelper.VirtualKeycodeToString(k))); } else { FLegacyKeyBufferOut.SliceCount = 1; FLegacyKeyBufferOut[0] = string.Empty; } // Evaluate our split plugin FKeyboardSplitNode.Evaluate(spreadMax); } FLastKeyboardState = keyboardState; } }
public void Evaluate(int spreadMax) { FKeyboardOut[0].CapsLock = Control.IsKeyLocked(Keys.CapsLock); FKeyboardSplitNode.Evaluate(spreadMax); }