Пример #1
0
    private void handleKeyUp(object sender, KeyEventArgs e)
    {
        p_CurrentKeys = Keys.None;
        if (p_LogicDisabled)
        {
            return;
        }

        if (p_EventHijacker != null)
        {
            p_EventHijacker.OnKeyUp(this, e);
            return;
        }

        /*adjust arrow key flags if we have an arrow key released*/
        switch (e.KeyCode)
        {
        case Keys.Left:
        case Keys.A:
            p_ArrowKeyDown -= ArrowKey.LEFT;
            break;

        case Keys.Right:
        case Keys.D:
            p_ArrowKeyDown -= ArrowKey.RIGHT;
            break;

        case Keys.Up:
        case Keys.W:
            p_ArrowKeyDown -= ArrowKey.UP;
            break;

        case Keys.Down:
        case Keys.S:
            p_ArrowKeyDown -= ArrowKey.DOWN;
            break;
        }

        /*send to all UI elements*/
        int l = p_UIElements.Length;

        for (int c = 0; c < l; c++)
        {
            p_UIElements[c].OnKeyUp(this, e);
        }
    }