Пример #1
0
        /// <summary>
        /// Function to create a keyboard interface.
        /// </summary>
        /// <param name="keyboardInfo">Name of the keyboard device to create.</param>
        /// <param name="window">Window to bind with.</param>
        /// <returns>A new keyboard interface.</returns>
        /// <remarks>Passing NULL for <paramref name="keyboardInfo"/> will use the system keyboard.
        /// <para>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</para></remarks>
        protected override GorgonKeyboard CreateKeyboardImpl(Control window, GorgonInputDeviceInfo keyboardInfo)
        {
            HookWindowProc(window.Handle);

            RawKeyboard keyboard = keyboardInfo == null
                                               ? new RawKeyboard(this, "System Keyboard", IntPtr.Zero)
                                               : new RawKeyboard(this, keyboardInfo.Name, ((GorgonRawInputDeviceInfo)keyboardInfo).Handle);

            return(keyboard);
        }
Пример #2
0
        /// <summary>
        /// Function to create a joystick interface.
        /// </summary>
        /// <param name="joystickInfo">A <see cref="GorgonLibrary.Input.GorgonInputDeviceInfo">GorgonDeviceName</see> object containing the joystick information.</param>
        /// <param name="window">Window to bind with.</param>
        /// <returns>A new joystick interface.</returns>
        /// <remarks>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</remarks>
        /// <exception cref="System.ArgumentNullException">The <paramRef name="joystickInfo"/> is NULL.</exception>
        protected override GorgonJoystick CreateJoystickImpl(Control window, GorgonInputDeviceInfo joystickInfo)
        {
            var mmJoystick = joystickInfo as GorgonMultimediaDeviceInfo;

            if (mmJoystick == null)
            {
                throw new InvalidCastException(Resources.GORINP_RAW_NOT_MM_JOYSTICK);
            }

            return(new MultimediaJoystick(this, mmJoystick.JoystickID, joystickInfo.Name));
        }
Пример #3
0
        /// <summary>
        /// Function to create a joystick interface.
        /// </summary>
        /// <param name="window">Window to bind with.</param>
        /// <param name="joystickName">A <see cref="GorgonLibrary.Input.GorgonInputDeviceInfo">GorgonInputDeviceInfo</see> object containing the joystick information.</param>
        /// <returns>A new joystick interface.</returns>
        /// <remarks>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application form</see>.</remarks>
        protected override GorgonJoystick CreateJoystickImpl(Control window, GorgonInputDeviceInfo joystickName)
        {
            var deviceName = joystickName as GorgonXInputDeviceInfo;

            if (deviceName == null)
            {
                throw new InvalidCastException(Resources.GORINP_XINP_NOT_XINPUT_JOYSTICK);
            }

            return(new XInputController(this, deviceName.Index, joystickName.Name, deviceName.Controller));
        }
Пример #4
0
        /// <summary>
        /// Function to create a custom HID interface.
        /// </summary>
        /// <param name="hidInfo">A <see cref="GorgonLibrary.Input.GorgonInputDeviceInfo">GorgonDeviceName</see> object containing the HID information.</param>
        /// <param name="window">Window to bind with.</param>
        /// <returns>
        /// A new custom HID interface.
        /// </returns>
        protected override GorgonCustomHID CreateCustomHIDImpl(Control window, GorgonInputDeviceInfo hidInfo)
        {
            HookWindowProc(window.Handle);

            var rawInfo = hidInfo as GorgonRawInputDeviceInfo;

            if (rawInfo == null)
            {
                throw new InvalidCastException(Resources.GORINP_RAW_HIDINFO_NOT_RAW);
            }

            return(new RawHIDDevice(this, rawInfo));
        }
Пример #5
0
 /// <summary>
 /// Function to create a custom HID interface.
 /// </summary>
 /// <param name="window">Window to bind with.</param>
 /// <param name="hidInfo">A <see cref="GorgonLibrary.Input.GorgonInputDeviceInfo">GorgonDeviceName</see> object containing the HID information.</param>
 /// <returns>
 /// A new custom HID interface.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">The <paramRef name="hidInfo"/> is NULL.</exception>
 protected override GorgonCustomHID CreateCustomHIDImpl(Control window, GorgonInputDeviceInfo hidInfo)
 {
     throw new NotSupportedException(Resources.GORINP_WIN_KEYBOARD_MOUSE_ONLY);
 }
Пример #6
0
 /// <summary>
 /// Function to create a joystick interface.
 /// </summary>
 /// <param name="joystickInfo">A <see cref="GorgonLibrary.Input.GorgonInputDeviceInfo">GorgonDeviceName</see> object containing the joystick information.</param>
 /// <param name="window">Window to bind with.</param>
 /// <returns>A new joystick interface.</returns>
 /// <remarks>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</remarks>
 /// <exception cref="System.ArgumentNullException">The <paramRef name="joystickInfo"/> is NULL.</exception>
 protected override GorgonJoystick CreateJoystickImpl(Control window, GorgonInputDeviceInfo joystickInfo)
 {
     throw new NotSupportedException(Resources.GORINP_WIN_KEYBOARD_MOUSE_ONLY);
 }
Пример #7
0
 /// <summary>
 /// Function to create a pointing device interface.
 /// </summary>
 /// <param name="pointingDeviceInfo">Name of the pointing device device to create.</param>
 /// <param name="window">Window to bind with.</param>
 /// <returns>A new pointing device interface.</returns>
 /// <remarks>Passing NULL for <paramref name="pointingDeviceInfo"/> will use the system pointing device.
 /// <para>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</para>
 /// </remarks>
 protected override GorgonPointingDevice CreatePointingDeviceImpl(Control window, GorgonInputDeviceInfo pointingDeviceInfo)
 {
     return(new WinFormsPointingDevice(this));
 }
Пример #8
0
 /// <summary>
 /// Function to create a keyboard interface.
 /// </summary>
 /// <param name="keyboardInfo">Name of the keyboard device to create.</param>
 /// <param name="window">Window to bind with.</param>
 /// <returns>A new keyboard interface.</returns>
 /// <remarks>Passing NULL for <paramref name="keyboardInfo"/> will use the system keyboard.
 /// <para>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</para></remarks>
 protected override GorgonKeyboard CreateKeyboardImpl(Control window, GorgonInputDeviceInfo keyboardInfo)
 {
     return(new WinFormsKeyboard(this));
 }
Пример #9
0
        /// <summary>
        /// Function to create a pointing device interface.
        /// </summary>
        /// <param name="pointingDeviceInfo">Name of the pointing device device to create.</param>
        /// <param name="window">Window to bind with.</param>
        /// <returns>A new pointing device interface.</returns>
        /// <remarks>Passing NULL for <paramref name="pointingDeviceInfo"/> will use the system pointing device.
        /// <para>Pass NULL to the <paramref name="window"/> parameter to use the <see cref="P:GorgonLibrary.Gorgon.ApplicationForm">Gorgon application window</see>.</para>
        /// </remarks>
        protected override GorgonPointingDevice CreatePointingDeviceImpl(Control window, GorgonInputDeviceInfo pointingDeviceInfo)
        {
            HookWindowProc(window.Handle);

            RawPointingDevice mouse = pointingDeviceInfo == null
                                                  ? new RawPointingDevice(this, "System Mouse", IntPtr.Zero)
                                                  : new RawPointingDevice(this, pointingDeviceInfo.Name,
                                                                          ((GorgonRawInputDeviceInfo)pointingDeviceInfo).Handle);

            return(mouse);
        }
Пример #10
0
 /// <summary>
 /// Creates the custom HID impl.
 /// </summary>
 /// <param name="window">The window.</param>
 /// <param name="hidName">Name of the hid.</param>
 /// <returns></returns>
 protected override GorgonCustomHID CreateCustomHIDImpl(Control window, GorgonInputDeviceInfo hidName)
 {
     throw new NotSupportedException(Resources.GORINP_XINP_ONLY_360_CONTROLLERS);
 }
Пример #11
0
 /// <summary>
 /// Creates the pointing device impl.
 /// </summary>
 /// <param name="window">The window.</param>
 /// <param name="pointingDeviceName">Name of the pointing device.</param>
 /// <returns></returns>
 protected override GorgonPointingDevice CreatePointingDeviceImpl(Control window, GorgonInputDeviceInfo pointingDeviceName)
 {
     throw new NotSupportedException(Resources.GORINP_XINP_ONLY_360_CONTROLLERS);
 }
Пример #12
0
 /// <summary>
 /// Creates the keyboard impl.
 /// </summary>
 /// <param name="window">The window.</param>
 /// <param name="keyboardName">Name of the keyboard.</param>
 /// <returns></returns>
 protected override GorgonKeyboard CreateKeyboardImpl(Control window, GorgonInputDeviceInfo keyboardName)
 {
     throw new NotSupportedException(Resources.GORINP_XINP_ONLY_360_CONTROLLERS);
 }