コード例 #1
0
        /// <summary>
        /// Fire a key released event.
        /// </summary>
        internal void fireKeyReleased(KeyboardButtonCode keyCode)
        {
            if (keysDown[(int)keyCode])
            {
                keysDown[(int)keyCode] = false;
                switch (keyCode)
                {
                case KeyboardButtonCode.KC_LSHIFT:
                    shiftDown = false;
                    break;

                case KeyboardButtonCode.KC_LMENU:
                    altDown = false;
                    break;

                case KeyboardButtonCode.KC_LCONTROL:
                    ctrlDown = false;
                    break;
                }

                if (KeyReleased != null)
                {
                    KeyReleased.Invoke(keyCode);
                }
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
0
        /// <summary>
        /// Fire a key pressed event.
        /// </summary>
        internal void fireKeyPressed(KeyboardButtonCode keyCode, uint keyChar)
        {
            if (!keysDown[(int)keyCode])
            {
                keysDown[(int)keyCode] = true;
                switch (keyCode)
                {
                case KeyboardButtonCode.KC_LSHIFT:
                    shiftDown = true;
                    break;

                case KeyboardButtonCode.KC_LMENU:
                    altDown = true;
                    break;

                case KeyboardButtonCode.KC_LCONTROL:
                    ctrlDown = true;
                    break;
                }

                if (KeyPressed != null)
                {
                    KeyPressed.Invoke(keyCode, keyChar);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Get the nice name of a key
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static String PrettyKeyName(KeyboardButtonCode code)
        {
            switch (code)
            {
            case KeyboardButtonCode.KC_RMENU:
            case KeyboardButtonCode.KC_LMENU:
                return("Alt");

            case KeyboardButtonCode.KC_RSHIFT:
            case KeyboardButtonCode.KC_LSHIFT:
                return("Shift");

            case KeyboardButtonCode.KC_RCONTROL:
            case KeyboardButtonCode.KC_LCONTROL:
                return("Ctrl");

            default:
                try
                {
                    return(code.ToString().Substring(3));
                }
                catch (Exception)
                {
                    return(code.ToString());
                }
            }
        }
コード例 #5
0
 private void nativeEvent(IntPtr widget, KeyboardButtonCode key, char _char)
 {
     //Fill out the KeyEventArgs
     eventArgs.Key  = key;
     eventArgs.Char = _char;
     fireEvent(eventArgs);
 }
コード例 #6
0
        void Keyboard_KeyReleased(KeyboardButtonCode keyCode)
        {
            KeyIdentifier key = InputMap.GetKey(keyCode);

            context.ProcessKeyUp(key, buildModifier());
            if (holdKey == key)
            {
                holdKey = KeyIdentifier.KI_UNKNOWN;
            }
        }
コード例 #7
0
 void keyboard_KeyPressed(KeyboardButtonCode keyCode, uint keyChar)
 {
     if (eventLayer.EventProcessingAllowed)
     {
         gui.HandledKeyboardButtons = inputManager.injectKeyPress(keyCode, keyChar);
         if (gui.HandledKeyboardButtons || inputManager.isModalAny())
         {
             eventLayer.alertEventsHandled();
         }
     }
 }
コード例 #8
0
 public bool injectKeyRelease(KeyboardButtonCode key)
 {
     return(InputManager_injectKeyRelease(inputManager, key));
 }
コード例 #9
0
 /// <summary>
 /// Fire a key pressed event.
 /// </summary>
 protected void fireKeyPressed(KeyboardButtonCode keyCode, uint keyChar)
 {
     keyboard.fireKeyPressed(keyCode, keyChar);
 }
コード例 #10
0
            private static void fireKeyPressed(KeyboardButtonCode keyCode, uint character, IntPtr instanceHandle)
            {
                GCHandle handle = GCHandle.FromIntPtr(instanceHandle);

                (handle.Target as NativeKeyboard).fireKeyPressed(keyCode, character);
            }
コード例 #11
0
 internal void injectKeyPressed(KeyboardButtonCode keyCode, uint keyChar)
 {
     fireKeyPressed(keyCode, keyChar);
 }
コード例 #12
0
 /// <summary>
 /// Remove a keyboard button binding from the event.
 /// </summary>
 /// <param name="button">The button to remove.</param>
 public void removeButton(KeyboardButtonCode button)
 {
     keyboardButtons.Remove(button);
 }
コード例 #13
0
 /// <summary>
 /// Checks to see if the given key is pressed.
 /// </summary>
 /// <param name="keyCode">The KeyboardButtonCode to check.</param>
 /// <returns>True if the key is pressed.  False if it is not.</returns>
 public bool isKeyDown(KeyboardButtonCode keyCode)
 {
     return(keysDown[(int)keyCode]);
 }
コード例 #14
0
ファイル: InputMap.cs プロジェクト: AnomalousMedical/Engine
 public static KeyIdentifier GetKey(KeyboardButtonCode buttonCode)
 {
     return(keyMap[buttonCode]);
 }
コード例 #15
0
 private static extern bool InputManager_injectKeyRelease(IntPtr inputManager, KeyboardButtonCode key);
コード例 #16
0
 private static extern bool InputManager_injectKeyPress(IntPtr inputManager, KeyboardButtonCode key, uint text);
コード例 #17
0
 /// <summary>
 /// Add a keyboard button binding to the event.
 /// </summary>
 /// <param name="button">The button to add.</param>
 public void addButton(KeyboardButtonCode button)
 {
     keyboardButtons.Add(button);
 }
コード例 #18
0
 /// <summary>
 /// Inject a key pressed event. This allows us to inject keyboard info from managed code on platforms
 /// where input is handled in managed code.
 /// </summary>
 public abstract void injectKeyPressed(KeyboardButtonCode keyCode, uint keyChar);
コード例 #19
0
            private static void nativeEvent(IntPtr widget, KeyboardButtonCode key, IntPtr instanceHandle)
            {
                GCHandle handle = GCHandle.FromIntPtr(instanceHandle);

                (handle.Target as EventKeyButtonReleasedTranslator).nativeEvent(widget, key);
            }
コード例 #20
0
 /// <summary>
 /// Inject a key released event. This allows us to inject keyboard info from managed code on platforms
 /// where input is handled in managed code.
 /// </summary>
 public abstract void injectKeyReleased(KeyboardButtonCode keyCode);
コード例 #21
0
 internal void injectKeyReleased(KeyboardButtonCode keyCode)
 {
     fireKeyReleased(keyCode);
 }
コード例 #22
0
 /// <summary>
 /// Inject a key released event. This allows us to inject keyboard info from managed code on platforms
 /// where input is handled in managed code.
 /// </summary>
 public override void injectKeyReleased(KeyboardButtonCode keyCode)
 {
     createdKeyboard.injectKeyReleased(keyCode);
 }
コード例 #23
0
            private static void fireKeyReleased(KeyboardButtonCode keyCode, IntPtr instanceHandle)
            {
                GCHandle handle = GCHandle.FromIntPtr(instanceHandle);

                (handle.Target as NativeKeyboard).fireKeyReleased(keyCode);
            }
コード例 #24
0
 /// <summary>
 /// Inject a key pressed event. This allows us to inject keyboard info from managed code on platforms
 /// where input is handled in managed code.
 /// </summary>
 public override void injectKeyPressed(KeyboardButtonCode keyCode, uint keyChar)
 {
     createdKeyboard.injectKeyPressed(keyCode, keyChar);
 }
コード例 #25
0
 /// <summary>
 /// Fire a key released event.
 /// </summary>
 protected void fireKeyReleased(KeyboardButtonCode keyCode)
 {
     keyboard.fireKeyReleased(keyCode);
 }
コード例 #26
0
 public bool injectKeyPress(KeyboardButtonCode key, uint text)
 {
     return(InputManager_injectKeyPress(inputManager, key, text));
 }