예제 #1
0
 private void gameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == Key.NumLock) numLock = !numLock;
     else if (e.Key == Key.CapsLock) capsLock = !capsLock;
     else if (e.Key == Key.ScrollLock) scrollLock = !scrollLock;
     KeyPress newKeyPress = new KeyPress(e.Key, e.Alt, e.Shift, e.Control, e.IsRepeat, numLock, capsLock, scrollLock);
     if (keyPress != newKeyPress) keyPress = newKeyPress;
 }
예제 #2
0
        private void gameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            if (e.Key == Key.NumLock)
            {
                numLock = !numLock;
            }
            else if (e.Key == Key.CapsLock)
            {
                capsLock = !capsLock;
            }
            else if (e.Key == Key.ScrollLock)
            {
                scrollLock = !scrollLock;
            }
            KeyPress newKeyPress = new KeyPress(e.Key, e.Alt, e.Shift, e.Control, e.IsRepeat, numLock, capsLock, scrollLock);

            if (keyPress != newKeyPress)
            {
                keyPress = newKeyPress;
            }
        }
예제 #3
0
 /// <summary>
 /// Checks to see if a key was pressed.
 /// </summary>
 /// <returns>Key Press, null if nothing was pressed.</returns>
 public KeyPress GetKeyPress()
 {
     KeyPress kp = keyPress;
     keyPress = null;
     return kp;
 }