private static void ProcessRawInput(ref RawInput rawInput) { if (RawInput != null) { int size = rawInput.Data.Hid.Count * rawInput.Data.Hid.SizeHid; if (size > 0) { if (m_memoryStream.Capacity < size) { m_memoryStream.Capacity = size; } var buffer = m_memoryStream.GetBuffer(); unsafe { fixed(void *to = buffer) { fixed(void *from = &rawInput.Data.Hid.RawData) { SharpDX.Utilities.CopyMemory((IntPtr)to, (IntPtr)from, size * sizeof(byte)); } } } } RawInput(ref rawInput.Header, rawInput.Data.Hid.Count, rawInput.Data.Hid.SizeHid, m_reader); } }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpDX.RawInput.KeyboardInputEventArgs"/> class. /// /// </summary> /// <param name="rawInput">The raw input.</param> internal MyKeyboardInputArgs(ref RawInput rawInput) { Device = rawInput.Header.Device; Key = (Keys)rawInput.Data.Keyboard.VKey; MakeCode = (int)rawInput.Data.Keyboard.MakeCode; ScanCodeFlags = rawInput.Data.Keyboard.Flags; State = rawInput.Data.Keyboard.Message; ExtraInformation = rawInput.Data.Keyboard.ExtraInformation; }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpDX.RawInput.MouseInputEventArgs"/> class. /// /// </summary> /// <param name="rawInput">The raw input.</param> internal MyMouseInputArgs(ref RawInput rawInput) { Device = rawInput.Header.Device; Mode = (MouseMode)rawInput.Data.Mouse.Flags; ButtonFlags = (MouseButtonFlags)rawInput.Data.Mouse.ButtonsData.ButtonFlags; WheelDelta = (int)rawInput.Data.Mouse.ButtonsData.ButtonData; Buttons = rawInput.Data.Mouse.RawButtons; X = rawInput.Data.Mouse.LastX; Y = rawInput.Data.Mouse.LastY; ExtraInformation = rawInput.Data.Mouse.ExtraInformation; }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpDX.RawInput.HidInputEventArgs"/> class. /// /// </summary> /// <param name="rawInput">The raw input.</param> internal MyHidInputArgs(ref RawInput rawInput) { Device = rawInput.Header.Device; Count = rawInput.Data.Hid.Count; DataSize = rawInput.Data.Hid.SizeHid; RawData = new byte[this.Count * this.DataSize]; if (this.RawData.Length <= 0) return; unsafe { fixed (byte* numPtr1 = this.RawData) fixed (int* numPtr2 = &rawInput.Data.Hid.RawData) Utilities.CopyMemory((IntPtr)((void*)numPtr1), (IntPtr)((void*)numPtr2), this.RawData.Length); } }
/// <summary> /// Initializes a new instance of the <see cref="T:SharpDX.RawInput.HidInputEventArgs"/> class. /// /// </summary> /// <param name="rawInput">The raw input.</param> internal MyHidInputArgs(ref RawInput rawInput) { Device = rawInput.Header.Device; Count = rawInput.Data.Hid.Count; DataSize = rawInput.Data.Hid.SizeHid; RawData = new byte[this.Count * this.DataSize]; if (this.RawData.Length <= 0) { return; } unsafe { fixed(byte *numPtr1 = this.RawData) fixed(int *numPtr2 = &rawInput.Data.Hid.RawData) Utilities.CopyMemory((IntPtr)((void *)numPtr1), (IntPtr)((void *)numPtr2), this.RawData.Length); } }
private static void ProcessRawInput(ref RawInput rawInput) { if (RawInput != null) { int size = rawInput.Data.Hid.Count * rawInput.Data.Hid.SizeHid; if (size > 0) { if (m_memoryStream.Capacity < size) m_memoryStream.Capacity = size; var buffer = m_memoryStream.GetBuffer(); unsafe { fixed (void* to = buffer) { fixed (void* from = &rawInput.Data.Hid.RawData) { SharpDX.Utilities.CopyMemory((IntPtr)to, (IntPtr)from, size * sizeof(byte)); } } } } RawInput(ref rawInput.Header, rawInput.Data.Hid.Count, rawInput.Data.Hid.SizeHid, m_reader); } }