protected virtual void OnKeyUp(KeyInputEventArgs e) { if (KeyUp != null) { KeyUp(this, e); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.C) { if (_fixture2 == null) { var shape = new CircleShape(); shape.Radius = 3.0f; shape.Position.Set(0.5f, -4.0f); _fixture2 = _body.CreateFixture(shape, 10.0f); _body.IsAwake = true; } } if (keyInput.Key == KeyCodes.D) { if (_fixture2 != null) { _body.DestroyFixture(_fixture2); _fixture2 = null; _body.IsAwake = true; } } if (keyInput.Key == KeyCodes.S) { if (_fixture2 != null) { _sensor = !_sensor; _fixture2.IsSensor = _sensor; } } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.A) { _positionB.X -= 0.1f; } if (keyInput.Key == KeyCodes.D) { _positionB.X += 0.1f; } if (keyInput.Key == KeyCodes.S) { _positionB.Y -= 0.1f; } if (keyInput.Key == KeyCodes.W) { _positionB.Y += 0.1f; } if (keyInput.Key == KeyCodes.Q) { _angleB += 0.1f * Settings.Pi; } if (keyInput.Key == KeyCodes.E) { _angleB -= 0.1f * Settings.Pi; } }
private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0) { int vk = Marshal.ReadInt32(lParam); var kiea = new KeyInputEventArgs(vk); if (wParam == (IntPtr)WM_KEYUP) { if (KeysDown.Contains(vk)) { KeysDown.Remove(vk); } OnKeyUp(kiea); } else if (wParam == (IntPtr)WM_KEYDOWN && (!DropHeldDownKeys || !KeysDown.Contains(vk))) { KeysDown.Add(vk); OnKeyDown(kiea); } } return(CallNextHookEx(hookId, nCode, wParam, lParam)); // next hook in the chain, pass it on }
/// <inheritdoc /> public override void OnKeyUp(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.A) { _button = false; } }
private void OnKeyInputEnd(object sender, KeyInputEventArgs args) { System.Console.WriteLine("cyc add listener---"); return; IVimBuffer vb = (IVimBuffer)sender; if (vb == null) { return; } var status = CommandMarginUtil.GetStatus(vb, vb.Mode, forModeSwitch: false); int frozen; if (_vsStatusbar != null) { _vsStatusbar.IsFrozen(out frozen); if (frozen != 0) { _vsStatusbar.FreezeOutput(0); } _vsStatusbar.SetText(status); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { switch (keyInput.Key) { case KeyCodes.B: for (var i = 0; i < 4; ++i) { if (m_bodies[i] != null) { World.DestroyBody(m_bodies[i]); m_bodies[i] = null; break; } } break; case KeyCodes.J: for (var i = 0; i < 8; ++i) { if (m_joints[i] != null) { World.DestroyJoint(m_joints[i]); m_joints[i] = null; break; } } break; } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.A) { _button = true; } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.S) { _go = !_go; } }
private IRecorderItem GetPrviousKeyDownItem(KeyInputEventArgs e) { List <IRecorderItem> keyDownItems = this.ESRRecorder.Items.FindAll(p => p.Recorder == RecorderType.KeyUpDown && p.Dir == Dir.Down); foreach (var item in keyDownItems) { if (IsCtrlAltShift(item)) { continue; } IKeyRecorderItem keyItem = item as IKeyRecorderItem; if (keyItem.VkCode != e.KeyData.VkCode) { continue; } if ((DateTime.Now - item.GetVeryLastTime()).TotalSeconds < this.KeyPressIntervalTimeSec) { if (!IsCtrlAltShift(keyItem.ModifierKeys)) { return(item); } } } return(null); }
/// <inheritdoc /> /// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.F) { if (_bullet != null) { World.DestroyBody(_bullet); _bullet = null; } { var shape = new CircleShape { Radius = 0.25f }; var fd = new FixtureDef { Shape = shape, Density = 20.0f, Restitution = 0.05f }; var bd = new BodyDef { BodyType = BodyType.DynamicBody, Bullet = true, Position = new Vector2(-31.0f, 5.0f) }; _bullet = World.CreateBody(bd); _bullet.CreateFixture(fd); _bullet.SetLinearVelocity(new Vector2(400.0f, 0.0f)); } } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.H) { ToggleHeavy(); } }
protected virtual void OnKeyDown(KeyInputEventArgs e) { if (KeyDown != null) { KeyDown(this, e); } }
public void Add(KeyInputEventArgs e) { if (this.State != ESRState.Recording) { return; } this.KeyRecorder.Add(e); }
private void KeyboardWatcher_OnKeyInput(object sender, KeyInputEventArgs e) { KeyToXboxButton button = keyboardToController.ListButtons.FirstOrDefault(x => x.Key == e.KeyData.Keyname); if (button != null) //We do have a bind for this key { controller.Buttons ^= button.x360Buttons; _scpBus.Report((int)1, controller.GetReport(), _outputReport); } }
private IRecorderItem CreateKeyPressRecorderItem(KeyInputEventArgs e) { return(new KeyPressRecorderItem() { Dir = Dir.Press, VkCode = e.KeyData.VkCode, Keyname = e.KeyData.Keyname, UnicodeCharacter = e.KeyData.UnicodeCharacter, ModifierKeys = Control.ModifierKeys }); }
private bool IsSameKeyCodeAndWithInIntervalTime(IRecorderItem item, KeyInputEventArgs e) { IKeyRecorderItem keyItem = item as IKeyRecorderItem; if (keyItem.VkCode == e.KeyData.VkCode && (DateTime.Now - item.Time).TotalSeconds < this.KeyPressIntervalTimeSec) { return(true); } return(false); }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.C) { CreateCircle(); } if (keyInput.Key == KeyCodes.A) { _autoCreate = !_autoCreate; } }
private void GlobalKeyEvents(object sender, KeyInputEventArgs e) { LastKeyPressEvent = DateTime.Now; Debug.Print("Keypress: " + e.KeyData.Keyname); Enum.TryParse <VirtualKeyCode>(e.KeyData.Keyname, out VirtualKeyCode acc); if (this.KeyToPress == acc) { this.OverallKeypresses++; this.KeypressedInRun++; } }
/// <inheritdoc /> /// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.L) { m_joint.EnableLimit(!m_joint.IsLimitEnabled()); } if (keyInput.Key == KeyCodes.M) { m_joint.EnableMotor(!m_joint.IsMotorEnabled()); } }
private void OnKeyInputEnd(object sender, KeyInputEventArgs args) { // Ignore our own virtual key input events. if (_processingVirtualKeyInputs) { return; } Debug.Assert(_vimBufferKeyEventState.InEvent); var updateCommandLine = true; try { if (!string.IsNullOrEmpty(_vimBufferKeyEventState.Message)) { UpdateCommandLine(_vimBufferKeyEventState.Message); updateCommandLine = false; } else if (_vimBufferKeyEventState.SwitchModeEventArgs != null) { var switchArgs = _vimBufferKeyEventState.SwitchModeEventArgs; UpdateForSwitchMode(switchArgs.CurrentMode); } else { UpdateCommandLineForNoEvent(); } UpdateStatusLineVisibility(); } finally { _vimBufferKeyEventState.KeyInputEventCount--; _vimBufferKeyEventState.Clear(); } // On entering command mode or forward/backward search, the EditKind state is only // updated at KeyInputEnd (and not KeyInputStart), so we need to check again here var editKind = CalculateCommandLineEditKind(); if (editKind != _editKind) { ChangeEditKind(editKind, updateCommandLine); if (editKind != EditKind.None) { _margin.UpdateCaretPosition(EditPosition.End); } } UpdateShowCommandText(); }
public void KeyEventHandler(object sender, KeyInputEventArgs e) { if (e.statut == KeyStatut.DOWN) { this.remoteOperation.press_key_down(e.key); this.keysPress.Add(e.key); } else { this.remoteOperation.press_key_up(e.key); this.keysPress.Remove(e.key); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { Console.WriteLine(keyInput.Key); if (keyInput.Key == KeyCodes.A) { _auto = !_auto; } if (keyInput.Key == KeyCodes.G) { Generate(); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { var k = -1; if (keyInput.Key == KeyCodes.D1) { k = 0; } if (keyInput.Key == KeyCodes.D2) { k = 1; } if (keyInput.Key == KeyCodes.D3) { k = 2; } if (keyInput.Key == KeyCodes.D4) { k = 3; } if (keyInput.Key == KeyCodes.D5) { k = 4; } if (k > -1) { Create(k); } if (keyInput.Key == KeyCodes.A) { for (var i = 0; i < MaxBodies; i += 2) { if (_bodies[i] != null) { var isEnabled = _bodies[i].IsEnabled; _bodies[i].IsEnabled = !isEnabled; } } } if (keyInput.Key == KeyCodes.D) { DestroyBody(); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.A) { Body1.ApplyForceToCenter(new Vector2(-10.0f, 0.0f), true); Body2.ApplyForceToCenter(new Vector2(-10.0f, 0.0f), true); } if (keyInput.Key == KeyCodes.D) { Body1.ApplyForceToCenter(new Vector2(10.0f, 0.0f), true); Body2.ApplyForceToCenter(new Vector2(10.0f, 0.0f), true); } }
/// <inheritdoc /> /// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.F) { _joint2.EnableMotor(!_joint2.IsMotorEnabled()); _joint2.BodyB.IsAwake = true; } if (keyInput.Key == KeyCodes.M) { _joint1.EnableMotor(!_joint1.IsMotorEnabled()); _joint1.BodyB.IsAwake = true; } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { switch (keyInput.Key) { case KeyCodes.C: FixedCamera = !FixedCamera; if (FixedCamera) { Global.Camera.Center = new Vector2(PlatformWidth / 2.0f, 0.0f); } break; } }
/// <inheritdoc /> /// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.J) { if (_rope != null) { World.DestroyJoint(_rope); _rope = null; } else { _rope = World.CreateJoint(_ropeDef); } } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { if (keyInput.Key == KeyCodes.L) { Joint.EnableLimit(!Joint.IsLimitEnabled()); } if (keyInput.Key == KeyCodes.L) { Joint.EnableMotor(!Joint.IsMotorEnabled()); } if (keyInput.Key == KeyCodes.L) { Joint.SetMotorSpeed(-Joint.GetMotorSpeed()); } }
/// <inheritdoc /> public override void OnKeyDown(KeyInputEventArgs keyInput) { switch (keyInput.Key) { case KeyCodes.A: _spring1.SetMotorSpeed(_speed); break; case KeyCodes.S: _spring1.SetMotorSpeed(0.0f); break; case KeyCodes.D: _spring1.SetMotorSpeed(-_speed); break; } }
private void OnKeyInputBuffered(object sender, KeyInputEventArgs args) { try { var globalSettings = _vimBuffer.GlobalSettings; // If 'timeout' is not enabled then ensure the timer is disabled and return. Ensuring // it's disabled is necessary because the 'timeout' could be disabled in the middle // of processing a key mapping if (!globalSettings.Timeout) { _timer.Stop(); } if (_timer.IsEnabled) { _timer.Stop(); } _timer.Interval = TimeSpan.FromMilliseconds(globalSettings.TimeoutLength); _timer.Start(); } catch (Exception ex) { // Several DispatcherTimer operations including setting the Interval can throw // so catch them all here _protectedOperations.Report(ex); } }
private void OnKeyInputEnd(object sender, KeyInputEventArgs args) { KeyInputEventComplete(); }
private void OnKeyInputStart(object sender, KeyInputEventArgs args) { _inKeyInputEvent = true; }