예제 #1
0
        void Keyboard_KeyPressed(KeyboardButtonCode keyCode, uint keyChar)
        {
            KeyIdentifier key = InputMap.GetKey(keyCode);

            repeatTimeout = REPEAT_INTERVAL_START;
            context.ProcessKeyDown(key, buildModifier());
            if (key == KeyIdentifier.KI_BACK || key == KeyIdentifier.KI_DELETE)
            {
                holdChar = 0;
                holdKey  = key;
            }
            else if (keyChar >= 32)
            {
                holdKey  = key;
                holdChar = (ushort)keyChar;
                context.ProcessTextInput(holdChar);
            }
            else if (key == KeyIdentifier.KI_RETURN)
            {
                holdKey  = key;
                holdChar = (ushort)'\n';
                context.ProcessTextInput(holdChar);
            }
            else if (key == KeyIdentifier.KI_LEFT || key == KeyIdentifier.KI_RIGHT || key == KeyIdentifier.KI_UP || key == KeyIdentifier.KI_DOWN)
            {
                holdKey  = key;
                holdChar = 0;
            }
            else
            {
                holdChar = 0;
                holdKey  = KeyIdentifier.KI_UNKNOWN;
            }
        }
예제 #2
0
        void Keyboard_KeyReleased(KeyboardButtonCode keyCode)
        {
            KeyIdentifier key = InputMap.GetKey(keyCode);

            context.ProcessKeyUp(key, buildModifier());
            if (holdKey == key)
            {
                holdKey = KeyIdentifier.KI_UNKNOWN;
            }
        }