Exemple #1
0
        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);
        }