private void UpdateImGuiInput() { ImGuiIOPtr io = ImGuiNET.ImGui.GetIO(); MouseState mouseState = _input.Mice[0].CaptureState(); var keyboardState = _input.Keyboards[0]; io.MouseDown[0] = mouseState.IsButtonPressed(MouseButton.Left); io.MouseDown[1] = mouseState.IsButtonPressed(MouseButton.Right); io.MouseDown[2] = mouseState.IsButtonPressed(MouseButton.Middle); var point = new System.Drawing.Point((int)mouseState.Position.X, (int)mouseState.Position.Y); //var screenPoint = new System.Drawing.Point((int) MouseState.Position.X, (int) MouseState.Position.Y); //var point = _view.PointToClient(screenPoint); io.MousePos = new System.Numerics.Vector2(point.X, point.Y); //var wheel = MouseState.GetScrollWheels()[0]; //var prevWheel = PrevMouseState?.GetScrollWheels()[0] ?? default; //io.MouseWheel = wheel.Y - prevWheel.Y; //io.MouseWheelH = wheel.X - prevWheel.X; var wheel = mouseState.GetScrollWheels()[0]; io.MouseWheel = wheel.Y; io.MouseWheelH = wheel.X; foreach (Key key in Enum.GetValues(typeof(Key))) { if (key == Key.Unknown) { continue; } io.KeysDown[(int)key] = keyboardState.IsKeyPressed(key); } foreach (var c in _pressedChars) { io.AddInputCharacter(c); } _pressedChars.Clear(); io.KeyCtrl = keyboardState.IsKeyPressed(Key.ControlLeft) || keyboardState.IsKeyPressed(Key.ControlRight); io.KeyAlt = keyboardState.IsKeyPressed(Key.AltLeft) || keyboardState.IsKeyPressed(Key.AltRight); io.KeyShift = keyboardState.IsKeyPressed(Key.ShiftLeft) || keyboardState.IsKeyPressed(Key.ShiftRight); io.KeySuper = keyboardState.IsKeyPressed(Key.SuperLeft) || keyboardState.IsKeyPressed(Key.SuperRight); _prevMouseState = mouseState; }