mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-06 09:41:38 -05:00
38 lines
No EOL
1.3 KiB
C#
38 lines
No EOL
1.3 KiB
C#
using System.Numerics;
|
|
|
|
namespace VoiDPlugins.Library.VMulti.Device
|
|
{
|
|
public class DigitizerInputReport : Report
|
|
{
|
|
public ushort X; // X position of the pen from 0 to 32767
|
|
public ushort Y; // Y position of the pen from 0 to 32767
|
|
public ushort Pressure; // Pressure level from 0 to 8191
|
|
public byte XTilt; // X tilt of the pen from -127 to 127
|
|
public byte YTilt; // Y tilt of the pen from -127 to 127
|
|
public override byte[] ToBytes()
|
|
{
|
|
var bytes = new byte[Size];
|
|
bytes[0] = VMultiID;
|
|
bytes[1] = ReportLength;
|
|
bytes[2] = ReportID;
|
|
bytes[3] = Buttons;
|
|
bytes[4] = (byte)(X & 0xFF);
|
|
bytes[5] = (byte)((X & 0xFF00) >> 8);
|
|
bytes[6] = (byte)(Y & 0xFF);
|
|
bytes[7] = (byte)((Y & 0xFF00) >> 8);
|
|
bytes[8] = (byte)(Pressure & 0xFF);
|
|
bytes[9] = (byte)((Pressure & 0xFF00) >> 8);
|
|
bytes[10] = XTilt;
|
|
bytes[11] = YTilt;
|
|
return bytes;
|
|
}
|
|
|
|
public override void SetCoordinates(Vector2 coordinates)
|
|
{
|
|
X = (ushort)coordinates.X;
|
|
Y = (ushort)coordinates.Y;
|
|
}
|
|
|
|
public override byte Size => 12;
|
|
}
|
|
} |