protected override void OnKeyDown(KeyboardKeyEventArgs e) { if (e.IsRepeat) { KeyRepeatEvent.Call(e.Key); } else { KeyDownEvent.Call(e.Key); } base.OnKeyDown(e); }
private bool sendKeyEvent(Input key, char keyChar, ButtonState state, float delta) { KeyEvent @event; switch (state) { case UP: @event = KeyUpEvent.create(key, keyChar, delta); break; case DOWN: @event = KeyDownEvent.create(key, keyChar, delta); break; case REPEAT: @event = KeyRepeatEvent.create(key, keyChar, delta); break; default: return(false); } setupTarget(@event); for (EntityRef entity : getInputEntities()) { entity.send(@event); if (@event.isConsumed()) { break; } } bool consumed = @event.isConsumed(); @event.reset(); return(consumed); }