示例#1
0
        void iKeyboardHandler.keyEvent(eKey key, eKeyValue what, ushort unicodeChar, eKeyboardState ks)
        {
            // Console.WriteLine( "iKeyboardHandler.keyEvent: {0} {1} {2:x} {3}", key, what, unicodeChar, ks );

            if (what != eKeyValue.Pressed)
            {
                return;
            }
            if (context.renderContext is iDiligentWindow window)
            {
                if (handleWindowedModeHotkey(window, key, ks))
                {
                    return;
                }
            }

            if (key == eKey.P)
            {
                screenshot();
                return;
            }

            if (context.scene is iKeyPressedHandler hh)
            {
                hh.keyPressed(key, ks);
            }
        }
示例#2
0
        protected override void handleKey(eKey key, eKeyValue keyValue)
        {
            layout.updateState(key, keyValue);
            char c = layout.keyChar(key);

            handler.keyEvent(key, keyValue, c, layout.state);
        }
示例#3
0
        void updateState(eKeyboardState bit, eKeyValue keyValue)
        {
            switch (keyValue)
            {
            case eKeyValue.Pressed:
                state |= bit;
                return;

            case eKeyValue.Released:
                state &= ~bit;
                return;
            }
        }
示例#4
0
 void iKeyboardHandler.keyEvent(eKey key, eKeyValue what, ushort unicodeChar, eKeyboardState ks)
 {
     if (0 == unicodeChar)
     {
         Console.WriteLine("keyEvent: {0} {1} {2}", key, what, ks);
     }
     else if (key == 0)
     {
         Console.WriteLine("keyEvent: {0} {1} {2}", printKey((char)unicodeChar), what, ks);
     }
     else
     {
         Console.WriteLine("keyEvent: {0} ({1}) {2} {3}", printKey((char)unicodeChar), key, what, ks);
     }
 }
示例#5
0
        protected override void handleKey(eKey key, eKeyValue keyValue)
        {
            layout.updateState(key, keyValue);

            char c = layout.keyChar(key);

            if (0 != c)
            {
                Console.WriteLine("KeyChar: {0} {1} {2} {3}", charString(c), key, keyValue, time);
            }
            else
            {
                Console.WriteLine("Key: {0} {1} {2}", key, keyValue, time);
            }
        }
示例#6
0
        protected override void handleButton(eButton button, eKeyValue keyValue)
        {
            if (buttonsMap.TryGetValue(button, out var res))
            {
                switch (keyValue)
                {
                case eKeyValue.Pressed:
                    setStateBit(res);
                    handler.buttonDown(position.x, position.y, res, buttonsState);
                    break;

                case eKeyValue.Released:
                    clearStateBit(res);
                    handler.buttonUp(position.x, position.y, res, buttonsState);
                    break;
                }
            }
        }
示例#7
0
        bool handleKeyOrButton(ushort code, int value)
        {
            if (value < 0 || value > 0xFF)
            {
                return(true);
            }
            eKeyValue keyValue = (eKeyValue)(byte)value;

            if (Enum.IsDefined(typeof(eKey), code))
            {
                handleKey((eKey)code, keyValue);
            }
            else if (Enum.IsDefined(typeof(eButton), code))
            {
                handleButton((eButton)code, keyValue);
            }
            return(true);
        }
示例#8
0
        void iKeyboardLayout.updateState(eKey key, eKeyValue val)
        {
            switch (key)
            {
            case eKey.LeftShift:
            case eKey.RightShift:
                updateState(eKeyboardState.ShiftDown, val);
                return;

            case eKey.LeftCtrl:
            case eKey.RightCtrl:
                updateState(eKeyboardState.ControlDown, val);
                return;

            case eKey.LeftAlt:
            case eKey.RightAlt:
                updateState(eKeyboardState.AltDown, val);
                return;
            }
        }
示例#9
0
 protected override void handleButton(eButton button, eKeyValue keyValue)
 {
     Console.WriteLine("Button: {0} {1} {2}", button, keyValue, time);
 }
示例#10
0
 protected override void handleKey(eKey key, eKeyValue keyValue)
 {
     Console.WriteLine("Key: {0} {1} {2}", key, keyValue, time);
 }
示例#11
0
 /// <summary>Handle EV_KEY events where the key symbolic name starts with "BTN_"</summary>
 protected virtual void handleButton(eButton button, eKeyValue keyValue)
 {
 }
示例#12
0
 /// <summary>Handle EV_KEY events where the key symbolic name starts with "KEY_"</summary>
 protected virtual void handleKey(eKey key, eKeyValue keyValue)
 {
 }