mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-05 09:11:38 -05:00
Merge remote-tracking branch 'skyborgff/Relative_Windows_Ink' into master
This commit is contained in:
commit
64a8dae65f
1 changed files with 28 additions and 2 deletions
|
@ -4,6 +4,7 @@ using HidSharp;
|
||||||
using OpenTabletDriver.Plugin;
|
using OpenTabletDriver.Plugin;
|
||||||
using OpenTabletDriver.Plugin.Attributes;
|
using OpenTabletDriver.Plugin.Attributes;
|
||||||
using OpenTabletDriver.Plugin.Output;
|
using OpenTabletDriver.Plugin.Output;
|
||||||
|
using OpenTabletDriver.Plugin.Platform.Display;
|
||||||
using OpenTabletDriver.Plugin.Platform.Pointer;
|
using OpenTabletDriver.Plugin.Platform.Pointer;
|
||||||
using static WindowsInk.VMulti;
|
using static WindowsInk.VMulti;
|
||||||
|
|
||||||
|
@ -16,11 +17,28 @@ namespace WindowsInk
|
||||||
public override IVirtualTablet VirtualTablet => InkHandler;
|
public override IVirtualTablet VirtualTablet => InkHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InkHandler : IVirtualTablet, IPressureHandler
|
[PluginName("Relative Artist Mode (Windows Ink)"), SupportedPlatform(PluginPlatform.Windows)]
|
||||||
|
public class WindowsInkRelative : RelativeOutputMode
|
||||||
|
{
|
||||||
|
private Area Output = new Area
|
||||||
|
{
|
||||||
|
Width = Info.Driver.VirtualScreen.Width,
|
||||||
|
Height = Info.Driver.VirtualScreen.Height,
|
||||||
|
Position = new Vector2
|
||||||
|
{
|
||||||
|
X = Info.Driver.VirtualScreen.Position.X,
|
||||||
|
Y = Info.Driver.VirtualScreen.Position.Y
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public override IVirtualMouse VirtualMouse => (WindowsInkState.InkHandler ?? new InkHandler(Output));
|
||||||
|
}
|
||||||
|
|
||||||
|
public class InkHandler : IVirtualTablet, IPressureHandler, IVirtualMouse
|
||||||
{
|
{
|
||||||
private InkReport InkReport;
|
private InkReport InkReport;
|
||||||
private readonly HidStream VMultiDev;
|
private readonly HidStream VMultiDev;
|
||||||
private bool EraserState;
|
private bool EraserState;
|
||||||
|
private Vector2 LastPos;
|
||||||
|
|
||||||
public InkHandler()
|
public InkHandler()
|
||||||
{
|
{
|
||||||
|
@ -99,6 +117,14 @@ namespace WindowsInk
|
||||||
InkReport.Y = (ushort)(pos.Y / Info.Driver.VirtualScreen.Height * 32767);
|
InkReport.Y = (ushort)(pos.Y / Info.Driver.VirtualScreen.Height * 32767);
|
||||||
VMultiDev.Write(InkReport);
|
VMultiDev.Write(InkReport);
|
||||||
}
|
}
|
||||||
|
public void Move(float dX, float dY)
|
||||||
|
{
|
||||||
|
LastPos.X += dX;
|
||||||
|
LastPos.Y += dY;
|
||||||
|
InkReport.X = (ushort)(LastPos.X / ScreenArea.Width * 32767);
|
||||||
|
InkReport.Y = (ushort)(LastPos.Y / ScreenArea.Height * 32767);
|
||||||
|
VMultiDev.Write(InkReport);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPressure(float percentage)
|
public void SetPressure(float percentage)
|
||||||
{
|
{
|
||||||
|
@ -128,4 +154,4 @@ namespace WindowsInk
|
||||||
InkReport.Pressure = prevPressure;
|
InkReport.Pressure = prevPressure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue