Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonRawInput"/> class.
        /// </summary>
        /// <param name="windowHandle">The handle to the main application window.</param>
        /// <param name="log">[Optional] The logger used for debugging.</param>
        /// <exception cref="ArgumentNullException">thrown when the <paramref name="windowHandle"/> is set to <see cref="IntPtr.Zero"/>.</exception>
        /// <remarks>
        /// <para>
        /// This constructor will allow any window handle to use a <see cref="GorgonRawInput"/> object. This allows WPF and other windowing systems to work with raw input.
        /// </para>
        /// <para>
        /// The <paramref name="windowHandle"/> parameter is required in order to set up the application to receive <c>WM_INPUT</c> messages. Ideally, this window should be the primary application window.
        /// </para>
        /// </remarks>
        public GorgonRawInput(GorgonReadOnlyPointer windowHandle, IGorgonLog log = null)
        {
            if (windowHandle.IsNull)
            {
                throw new ArgumentNullException(nameof(windowHandle));
            }

            _log = log ?? GorgonLog.NullLog;
            unsafe
            {
                _applicationWindow = new IntPtr((void *)windowHandle);
            }
            _devices       = new Dictionary <DeviceKey, IGorgonRawInputDevice>();
            _useNativeHook = true;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonHIDEventArgs"/> class.
 /// </summary>
 /// <param name="data">The HID data.</param>
 /// <param name="size">The size of an individual HID input.</param>
 /// <param name="count">The number of HID inputs.</param>
 public GorgonHIDEventArgs(GorgonReadOnlyPointer data, int size, int count)
 {
     Data    = data;
     HIDSize = size;
     Count   = count;
 }