コード例 #1
0
        protected override void OnKeyDown(KeyboardKeyEventArgs e)
        {
            if (e.IsRepeat)
            {
                KeyRepeatEvent.Call(e.Key);
            }
            else
            {
                KeyDownEvent.Call(e.Key);
            }

            base.OnKeyDown(e);
        }
コード例 #2
0
ファイル: InputSystem.cs プロジェクト: xposure/zSprite_Old
        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);
        }