/// <summary> /// Get joystick's status. /// </summary> /// /// <returns>Returns current status of initialized joystick, which provides information /// about current state of all axes, buttons and point of view.</returns> /// /// <remarks><para><note>Before using this method the joystick object needs to be initialized /// using <see cref="Init"/> method or <see cref="Joystick(int)"/> constructor.</note></para></remarks> /// /// <exception cref="NotConnectedException">The requested joystick is not connected to the system.</exception> /// <exception cref="ApplicationException">Joystick was not initialized.</exception> /// public Status GetCurrentStatus( ) { JoystickAPI.JOYINFOEX ji = new JoystickAPI.JOYINFOEX( ); ji.size = System.Runtime.InteropServices.Marshal.SizeOf(ji); ji.flags = (Info.capabilities.axesNumber > 5) ? JoystickAPI.JoyPosFlags.ReturnAll : requestFlags[Info.capabilities.axesNumber]; if (JoystickAPI.joyGetPosEx(Info.ID, ji) != JoystickAPI.ResultCode.NoError) { throw new NotConnectedException("The requested joystick is not connected to the system."); } return(new Status(ji, Info.capabilities)); }
internal Status( JoystickAPI.JOYINFOEX status, JoystickAPI.JOYCAPS capabilities ) { this.status = status; this.capabilities = capabilities; }
/// <summary> /// Get joystick's status. /// </summary> /// /// <returns>Returns current status of initialized joystick, which provides information /// about current state of all axes, buttons and point of view.</returns> /// /// <remarks><para><note>Before using this method the joystick object needs to be initialized /// using <see cref="Init"/> method or <see cref="Joystick(int)"/> constructor.</note></para></remarks> /// /// <exception cref="NotConnectedException">The requested joystick is not connected to the system.</exception> /// <exception cref="ApplicationException">Joystick was not initialized.</exception> /// public Status GetCurrentStatus( ) { JoystickAPI.JOYINFOEX ji = new JoystickAPI.JOYINFOEX( ); ji.size = System.Runtime.InteropServices.Marshal.SizeOf( ji ); ji.flags = ( Info.capabilities.axesNumber > 5 ) ? JoystickAPI.JoyPosFlags.ReturnAll : requestFlags[Info.capabilities.axesNumber]; if ( JoystickAPI.joyGetPosEx( Info.ID, ji ) != JoystickAPI.ResultCode.NoError ) { throw new NotConnectedException( "The requested joystick is not connected to the system." ); } return new Status( ji, Info.capabilities ); }
internal Status(JoystickAPI.JOYINFOEX status, JoystickAPI.JOYCAPS capabilities) { this.status = status; this.capabilities = capabilities; }