예제 #1
0
 void game_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     if (game.Active == this && !pickDiff && !Game.pbox.expanded)
     {
         if ((int)e.KeyChar == 8)
         { //backspace
             if (resetSearch)
             {
                 resetSearch = false;
             }
             try
             {
                 searchLabel.Text = searchLabel.Text.Remove(searchLabel.Text.Length - 1);
             }
             catch { }
         }
         else
         {
             if (!char.IsControl(e.KeyChar))
             {
                 if (resetSearch)
                 {
                     resetSearch = false;
                 }
                 searchLabel.Text += e.KeyChar;
             }
         }
         searchCountdown = 500;
     }
 }
예제 #2
0
 private void window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     // Drop any keypresses if the control, alt, or windows/command key are being held.
     // This is a workaround for an issue on macOS where OpenTK will fire KeyPress events even
     // if modifier keys are held.  This can be reverted when it is fixed on OpenTK's side.
     if (RuntimeInfo.OS == RuntimeInfo.Platform.MacOsx)
     {
         var state = OpenTK.Input.Keyboard.GetState();
         if (state.IsKeyDown(OpenTK.Input.Key.LControl) ||
             state.IsKeyDown(OpenTK.Input.Key.RControl) ||
             state.IsKeyDown(OpenTK.Input.Key.LAlt) ||
             state.IsKeyDown(OpenTK.Input.Key.RAlt) ||
             state.IsKeyDown(OpenTK.Input.Key.LWin) ||
             state.IsKeyDown(OpenTK.Input.Key.RWin))
         {
             return;
         }
         // arbitrary choice here, but it caters for any non-printable keys on an A1243 Apple Keyboard
         if (e.KeyChar > 63000)
         {
             return;
         }
     }
     pending += e.KeyChar;
 }
예제 #3
0
        public void ClientKeyPress(object sender, OpenTK.KeyPressEventArgs e)
        {
            var code = e.KeyChar.ToString().ToUpper();

            //left or right
            if (this._forwardDirection == Direction.N || this._forwardDirection == Direction.S)
            {
                if (code == Keys.Left.ToString() || code == Keys.D.ToString())
                {
                    this._quarriedDirection = Direction.O;
                }

                if (code == Keys.Right.ToString() || code == Keys.A.ToString())
                {
                    this._quarriedDirection = Direction.W;
                }
            }
            //up or down
            else
            {
                if (code == Keys.Up.ToString() || code == Keys.W.ToString())
                {
                    this._quarriedDirection = Direction.N;
                }

                if (code == Keys.Down.ToString() || code == Keys.S.ToString())
                {
                    this._quarriedDirection = Direction.S;
                }
            }
        }
예제 #4
0
 private void Window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     if (currently_editing)
     {
         //AppendText(e.KeyChar.ToString());
         InsertText(cursor_index, e.KeyChar.ToString());
     }
 }
예제 #5
0
 private void TextBox_KeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (Text.Length >= MaxLength)
     {
         return;
     }
     Text = Text.Insert(CaretPosition, e.KeyChar.ToString());
     CaretPosition++;
 }
예제 #6
0
 private void DateBox_KeyPress(OpenTK.KeyPressEventArgs e)
 {
     if (Text.Length >= MaxLength || !validChars.Contains(e.KeyChar))
     {
         return;
     }
     Text = Text.Insert(CaretPosition, e.KeyChar.ToString());
     CaretPosition++;
 }
예제 #7
0
 private static void Window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     if (_acceptInput)
     {
         if (e.KeyChar != '\t')
         {
             _inputStream.WriteByte((byte)e.KeyChar);
         }
     }
 }
예제 #8
0
        protected override void OnKeyPress(TkKeyPressArgs args)
        {
            if (TopScreen == null)
            {
                return;
            }
            char keyChar = (char)args.KeyChar;

            if (keyChar == '.' || keyChar == ',')
            {
                TopScreen.KeyDown(new KeyboardEventArgs(keyChar));
            }
            if (char.IsLetter(keyChar))
            {
                TopScreen.KeyDown(new KeyboardEventArgs(char.ToUpper((char)args.KeyChar), _keyModifier));
            }
        }
예제 #9
0
 private void Parent_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     Parent.CurrentMenu?.PerformKeyPress(e);
 }
예제 #10
0
 private void window_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     pending += e.KeyChar;
 }
예제 #11
0
 internal KeyboardPressEventArgs(OpenTK.KeyPressEventArgs e)
 {
     KeyChar = e.KeyChar;
 }
예제 #12
0
 public void Event_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
 }
예제 #13
0
 public virtual void KeyPress(OpenTK.KeyPressEventArgs e)
 {
 }
예제 #14
0
 private void Game_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
 {
     activeInterface.Game_KeyPress(sender, e);
 }
예제 #15
0
 private void InputBridge_OnKeyPressed(OpenTK.KeyPressEventArgs e)
 {
 }