mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-09 05:03:25 +01:00
Really merged DS4Windows Alpha2 this time
This commit is contained in:
parent
669c850b39
commit
41b9976a20
@ -16,11 +16,18 @@ namespace DS4Control
|
|||||||
|
|
||||||
// Keep track of remainders when performing moves or we lose fractional parts.
|
// Keep track of remainders when performing moves or we lose fractional parts.
|
||||||
private double horizontalRemainder = 0.0, verticalRemainder = 0.0;
|
private double horizontalRemainder = 0.0, verticalRemainder = 0.0;
|
||||||
|
/** Indicate x/y direction for doing jitter compensation, etc. */
|
||||||
|
public enum Direction { Negative, Neutral, Positive }
|
||||||
|
// Track direction vector separately and very trivially for now.
|
||||||
|
private Direction horizontalDirection = Direction.Neutral, verticalDirection = Direction.Neutral;
|
||||||
|
|
||||||
public void touchesBegan(TouchpadEventArgs arg)
|
public void touchesBegan(TouchpadEventArgs arg)
|
||||||
{
|
{
|
||||||
if (arg.touches.Length == 1)
|
if (arg.touches.Length == 1)
|
||||||
|
{
|
||||||
horizontalRemainder = verticalRemainder = 0.0;
|
horizontalRemainder = verticalRemainder = 0.0;
|
||||||
|
horizontalDirection = verticalDirection = Direction.Neutral;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte lastTouchID;
|
private byte lastTouchID;
|
||||||
@ -33,6 +40,7 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
deltaX = deltaY = 0;
|
deltaX = deltaY = 0;
|
||||||
horizontalRemainder = verticalRemainder = 0.0;
|
horizontalRemainder = verticalRemainder = 0.0;
|
||||||
|
horizontalDirection = verticalDirection = Direction.Neutral;
|
||||||
lastTouchID = arg.touches[0].touchID;
|
lastTouchID = arg.touches[0].touchID;
|
||||||
}
|
}
|
||||||
else if (Global.getTouchpadJitterCompensation(deviceNumber))
|
else if (Global.getTouchpadJitterCompensation(deviceNumber))
|
||||||
@ -43,7 +51,7 @@ namespace DS4Control
|
|||||||
// allow only very fine, slow motions, when changing direction
|
// allow only very fine, slow motions, when changing direction
|
||||||
if (deltaX < -1)
|
if (deltaX < -1)
|
||||||
{
|
{
|
||||||
if (horizontalRemainder >= 0.0)
|
if (horizontalDirection == Direction.Positive)
|
||||||
{
|
{
|
||||||
deltaX = -1;
|
deltaX = -1;
|
||||||
horizontalRemainder = 0.0;
|
horizontalRemainder = 0.0;
|
||||||
@ -51,7 +59,7 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
else if (deltaX > 1)
|
else if (deltaX > 1)
|
||||||
{
|
{
|
||||||
if (horizontalRemainder <= 0.0)
|
if (horizontalDirection == Direction.Negative)
|
||||||
{
|
{
|
||||||
deltaX = 1;
|
deltaX = 1;
|
||||||
horizontalRemainder = 0.0;
|
horizontalRemainder = 0.0;
|
||||||
@ -60,7 +68,7 @@ namespace DS4Control
|
|||||||
|
|
||||||
if (deltaY < -1)
|
if (deltaY < -1)
|
||||||
{
|
{
|
||||||
if (verticalRemainder >= 0.0)
|
if (verticalDirection == Direction.Positive)
|
||||||
{
|
{
|
||||||
deltaY = -1;
|
deltaY = -1;
|
||||||
verticalRemainder = 0.0;
|
verticalRemainder = 0.0;
|
||||||
@ -68,7 +76,7 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
else if (deltaY > 1)
|
else if (deltaY > 1)
|
||||||
{
|
{
|
||||||
if (verticalRemainder <= 0.0)
|
if (verticalDirection == Direction.Negative)
|
||||||
{
|
{
|
||||||
deltaY = 1;
|
deltaY = 1;
|
||||||
verticalRemainder = 0.0;
|
verticalRemainder = 0.0;
|
||||||
@ -113,6 +121,9 @@ namespace DS4Control
|
|||||||
|
|
||||||
if (yAction != 0 || xAction != 0)
|
if (yAction != 0 || xAction != 0)
|
||||||
InputMethods.MoveCursorBy(xAction, yAction);
|
InputMethods.MoveCursorBy(xAction, yAction);
|
||||||
|
|
||||||
|
horizontalDirection = xAction > 0.0 ? Direction.Positive : xAction < 0.0 ? Direction.Negative : Direction.Neutral;
|
||||||
|
verticalDirection = yAction > 0.0 ? Direction.Positive : yAction < 0.0 ? Direction.Negative : Direction.Neutral;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
DS4Tool/ScpForm.Designer.cs
generated
2
DS4Tool/ScpForm.Designer.cs
generated
@ -327,7 +327,7 @@
|
|||||||
this.Controls.Add(this.pnlStatus);
|
this.Controls.Add(this.pnlStatus);
|
||||||
this.MinimumSize = new System.Drawing.Size(750, 192);
|
this.MinimumSize = new System.Drawing.Size(750, 192);
|
||||||
this.Name = "ScpForm";
|
this.Name = "ScpForm";
|
||||||
this.Text = "DS4Windows 1.0 (2014-03-27.0)";
|
this.Text = "DS4Windows 1.0 Alpha 2 (2014-03-30.0)";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
|
||||||
this.Load += new System.EventHandler(this.Form_Load);
|
this.Load += new System.EventHandler(this.Form_Load);
|
||||||
this.Resize += new System.EventHandler(this.Form_Resize);
|
this.Resize += new System.EventHandler(this.Form_Resize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user