Exemplo n.º 1
0
        private void InitInputContextOnLoad()
        {
            InputContext = NativeWindow.CreateInput();

            foreach (IKeyboard keyboard in InputContext.Keyboards)
            {
                keyboard.KeyDown += OnKeyPressed;
                keyboard.KeyUp   += OnKeyReleased;
                keyboard.KeyChar += OnKeyChar;
                KeyboardState.AddKeyboard(keyboard);
            }

            foreach (IMouse mouse in InputContext.Mice)
            {
                mouse.MouseDown += OnMousePressed;
                mouse.MouseUp   += OnMouseReleased;
                mouse.MouseMove += OnMouseMove;
                mouse.Scroll    += OnMouseScroll;
                MouseState.AddMouse(mouse);
            }
        }