private void Event_KeyDown(object sender, Keys key) { if (_subscriber != null) { if (key == Keys.Back) { _subscriber.RecieveCommandInput('\b'); } if (key == Keys.Enter) { _subscriber.RecieveCommandInput('\r'); } if (key == Keys.Tab) { _subscriber.RecieveCommandInput('\t'); } _subscriber.RecieveSpecialInput(key); } }
public void Poll() { if (_enteredText != null) { if (_subscriber != null && !ShouldSuppress()) { _subscriber.RecieveTextInput(_enteredText); } _enteredText = null; } if (_charsEntered.Count > 0) { if (_subscriber != null && !ShouldSuppress()) { foreach (char key3 in _charsEntered) { _subscriber.RecieveTextInput(key3); } } _charsEntered.Clear(); } if (_commandInputs.Count > 0) { if (_subscriber != null && !ShouldSuppress()) { foreach (char key2 in _commandInputs) { _subscriber.RecieveCommandInput(key2); } } _commandInputs.Clear(); } if (_keysDown.Count <= 0) { return; } if (_subscriber != null && !ShouldSuppress()) { foreach (Keys key in _keysDown) { _subscriber.RecieveSpecialInput(key); } } _keysDown.Clear(); }
private void EventInput_CharEntered(object sender, CharacterEventArgs e) { char ch = e.Character; IKeyboardSubscriber subscriber = Game1.keyboardDispatcher.Subscriber; if (subscriber != null) { if (!char.IsControl(ch)) { subscriber.RecieveTextInput(ch); } else if (ch == '\u0016')//paste { if (System.Windows.Forms.Clipboard.ContainsText()) { subscriber.RecieveTextInput(System.Windows.Forms.Clipboard.GetText()); } } else { subscriber.RecieveCommandInput(ch); } } }