public void Handler_OnKeyDown(object sender, KeyEventArgs e) { if (lastClickedButton != null && lastClickedButton.Tag != null) { foreach (Keyboard.Key key in Enum.GetValues(typeof(Keyboard.Key)).Cast <Keyboard.Key>()) { if (Keyboard.IsKeyPressed(key)) { if (key != Keyboard.Key.Escape) { VirtualKey vk = (VirtualKey)lastClickedButton.Tag; PhysicalKey valueOld = UserSettings.GetInstance().KeyboardMappings[vk]; PhysicalKey valueNew = new PhysicalKey(); valueNew.KeyboardValue = key; UserSettings.SetMapping(vk, valueOld, valueNew); } lastClickedButton = null; ((MainViewModel)DataContext).RefreshData(); WaitingForKeyPress_Hide(); } } } }
/// <summary> /// Updates this instance. /// </summary> public void Update() { if (Keyboard.IsKeyPressed(Keyboard.Key.F4)) { currentLocal = 1; } if (Keyboard.IsKeyPressed(Keyboard.Key.F5)) { currentLocal = 0; } EntityManager.ForceUpdateText(); }
private void OnKeyDown(object sender, KeyEventArgs e) { if (lastClickedButton != null) { while (true) { foreach (var key in Enum.GetValues(typeof(Keyboard.Key)).Cast <Keyboard.Key>()) { if (Keyboard.IsKeyPressed(key) && key != Keyboard.Key.P) { vm.SetMapping((VirtualKey)lastClickedButton.Tag, key); lastClickedButton = null; hidePressKey(); return; } } } } }
public void OnKeyDown_Super(object sender, KeyEventArgs e) { if (lastClickedButton != null && lastClickedButton.Tag != null) { foreach (var key in Enum.GetValues(typeof(Keyboard.Key)).Cast <Keyboard.Key>()) { if (Keyboard.IsKeyPressed(key)) { if (key != Keyboard.Key.Escape) { vm.SetMapping((VirtualKey)lastClickedButton.Tag, key); } lastClickedButton = null; WaitingForKeyPress_Hide(); } } } }
public static bool IsKeyDown(KeyCode keyCode) => SfmlKeyboard.IsKeyPressed((SfmlKeyboard.Key)keyCode);
public static bool IsKeyPressed(Key key) => SKeyboard.IsKeyPressed(key.Convert());