/// <summary> /// Initializes a new instance of the <see cref="WindowsSpaceMouseInputDeviceImp" /> class. /// </summary> /// <param name="gameWindow">The game window to hook on to receive /// <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh454904(v=vs.85).aspx">WM_POINTER</a> messages.</param> public WindowsSpaceMouseInputDeviceImp(GameWindow gameWindow) { _gameWindow = gameWindow; _handle = new HandleRef(_gameWindow, _gameWindow.WindowInfo.Handle); try { _current3DConnexionDevice = new _3DconnexionDevice(_handle.ToString()); _current3DConnexionDevice.InitDevice((IntPtr)_handle); _current3DConnexionDevice.Motion += HandleMotion; ConnectWindowsEvents(); } catch (Exception ex) { Diagnostics.Warn("Trouble initializing the SpaceMouse. Probably due to missing driver.\n" + ex); _current3DConnexionDevice = null; } _TX = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation X", Id = (int)SixDOFAxis.TX, Direction = AxisDirection.X, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _TY = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation Y", Id = (int)SixDOFAxis.TY, Direction = AxisDirection.Y, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _TZ = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation Z", Id = (int)SixDOFAxis.TZ, Direction = AxisDirection.Z, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RX = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation Y", Id = (int)SixDOFAxis.RX, Direction = AxisDirection.Y, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RY = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation X", Id = (int)SixDOFAxis.RY, Direction = AxisDirection.X, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RZ = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation Z", Id = (int)SixDOFAxis.RZ, Direction = AxisDirection.Z, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; }