コード例 #1
0
        void GameWindow_KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            var key = KeyMapper.GetMap(e.Key);

            if (key == VirtualKeyCode.NoKey)
            {
                return; // If there is no corresponding key mapping, we can't do anything about it.
            }
            KeyPress?.Invoke(this, new KeyboardEventArgs(key));
        }
コード例 #2
0
        public bool CheckKeyPressed(VirtualKeyCode keyCode)
        {
            var realKeyCode = KeyMapper.GetMap(keyCode);

            if (realKeyCode == 0)
            {
                return(false);
            }

            return(GameWindow.Keyboard[realKeyCode]);
        }