-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
15,836 additions
and
16,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ labels: bug | |
- [ ] GPD | ||
- [ ] ONEXPLAYER | ||
- [ ] VALVE | ||
- [ ] LENOVO | ||
|
||
**Device model** | ||
Your device model | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
using HandheldCompanion.Inputs; | ||
using HandheldCompanion.Utils; | ||
using System; | ||
using System.Numerics; | ||
using System.Windows.Forms; | ||
|
||
namespace HandheldCompanion.Actions | ||
{ | ||
[Serializable] | ||
public class AxisActions : GyroActions | ||
{ | ||
public AxisLayoutFlags Axis; | ||
|
||
// Axis to axis | ||
public bool ImproveCircularity = false; | ||
public int AxisAntiDeadZone = 0; | ||
public int AxisDeadZoneInner = 0; | ||
public int AxisDeadZoneOuter = 0; | ||
public bool AxisRotated = false; | ||
public bool AxisInverted = false; | ||
|
||
public AxisActions() | ||
{ | ||
this.actionType = ActionType.Joystick; | ||
this.Value = new Vector2(); | ||
} | ||
|
||
public AxisActions(AxisLayoutFlags axis) : this() | ||
{ | ||
this.Axis = axis; | ||
} | ||
|
||
public void Execute(AxisLayout layout) | ||
{ | ||
layout.vector = InputUtils.ThumbScaledRadialInnerOuterDeadzone(layout.vector, AxisDeadZoneInner, AxisDeadZoneOuter); | ||
layout.vector = InputUtils.ApplyAntiDeadzone(layout.vector, AxisAntiDeadZone); | ||
|
||
if (ImproveCircularity) | ||
layout.vector = InputUtils.ImproveCircularity(layout.vector); | ||
|
||
if (AutoRotate) | ||
layout.vector = ((Orientation & ScreenOrientation.Angle90) == ScreenOrientation.Angle90 | ||
? new Vector2(layout.vector.Y, -layout.vector.X) | ||
: layout.vector) | ||
* ((Orientation & ScreenOrientation.Angle180) == ScreenOrientation.Angle180 ? -1.0f : 1.0f); | ||
else | ||
layout.vector = (AxisRotated ? new Vector2(layout.vector.Y, -layout.vector.X) : layout.vector) | ||
* (AxisInverted ? -1.0f : 1.0f); | ||
|
||
this.Value = (AxisRotated ? new(layout.vector.Y, -layout.vector.X) : layout.vector) * (AxisInverted ? -1.0f : 1.0f); | ||
} | ||
|
||
public Vector2 GetValue() | ||
{ | ||
return (Vector2)this.Value; | ||
} | ||
} | ||
} | ||
using HandheldCompanion.Inputs; | ||
using HandheldCompanion.Utils; | ||
using System; | ||
using System.Numerics; | ||
using System.Windows.Forms; | ||
|
||
namespace HandheldCompanion.Actions | ||
{ | ||
[Serializable] | ||
public class AxisActions : GyroActions | ||
{ | ||
public AxisLayoutFlags Axis; | ||
|
||
// Axis to axis | ||
public bool ImproveCircularity = false; | ||
public int AxisAntiDeadZone = 0; | ||
public int AxisDeadZoneInner = 0; | ||
public int AxisDeadZoneOuter = 0; | ||
public bool AxisRotated = false; | ||
public bool AxisInverted = false; | ||
|
||
public AxisActions() | ||
{ | ||
this.actionType = ActionType.Joystick; | ||
this.Value = new Vector2(); | ||
} | ||
|
||
public AxisActions(AxisLayoutFlags axis) : this() | ||
{ | ||
this.Axis = axis; | ||
} | ||
|
||
public void Execute(AxisLayout layout) | ||
{ | ||
layout.vector = InputUtils.ThumbScaledRadialInnerOuterDeadzone(layout.vector, AxisDeadZoneInner, AxisDeadZoneOuter); | ||
layout.vector = InputUtils.ApplyAntiDeadzone(layout.vector, AxisAntiDeadZone); | ||
|
||
if (ImproveCircularity) | ||
layout.vector = InputUtils.ImproveCircularity(layout.vector); | ||
|
||
if (AutoRotate) | ||
layout.vector = ((Orientation & ScreenOrientation.Angle90) == ScreenOrientation.Angle90 | ||
? new Vector2(layout.vector.Y, -layout.vector.X) | ||
: layout.vector) | ||
* ((Orientation & ScreenOrientation.Angle180) == ScreenOrientation.Angle180 ? -1.0f : 1.0f); | ||
else | ||
layout.vector = (AxisRotated ? new Vector2(layout.vector.Y, -layout.vector.X) : layout.vector) | ||
* (AxisInverted ? -1.0f : 1.0f); | ||
|
||
this.Value = (AxisRotated ? new(layout.vector.Y, -layout.vector.X) : layout.vector) * (AxisInverted ? -1.0f : 1.0f); | ||
} | ||
|
||
public Vector2 GetValue() | ||
{ | ||
return (Vector2)this.Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
using HandheldCompanion.Inputs; | ||
using System; | ||
|
||
namespace HandheldCompanion.Actions | ||
{ | ||
[Serializable] | ||
public class ButtonActions : IActions | ||
{ | ||
public ButtonFlags Button; | ||
|
||
// runtime variables | ||
private bool IsKeyDown = false; | ||
|
||
public ButtonActions() | ||
{ | ||
this.actionType = ActionType.Button; | ||
|
||
this.Value = false; | ||
this.prevValue = false; | ||
} | ||
|
||
public ButtonActions(ButtonFlags button) : this() | ||
{ | ||
this.Button = button; | ||
} | ||
|
||
public override void Execute(ButtonFlags button, bool value) | ||
{ | ||
base.Execute(button, value); | ||
|
||
switch (this.Value) | ||
{ | ||
case true: | ||
{ | ||
if (IsKeyDown) | ||
return; | ||
|
||
IsKeyDown = true; | ||
SetHaptic(button, false); | ||
} | ||
break; | ||
case false: | ||
{ | ||
if (!IsKeyDown) | ||
return; | ||
|
||
IsKeyDown = false; | ||
SetHaptic(button, true); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
public bool GetValue() | ||
{ | ||
return (bool)this.Value; | ||
} | ||
} | ||
} | ||
using HandheldCompanion.Inputs; | ||
using System; | ||
|
||
namespace HandheldCompanion.Actions | ||
{ | ||
[Serializable] | ||
public class ButtonActions : IActions | ||
{ | ||
public ButtonFlags Button; | ||
|
||
// runtime variables | ||
private bool IsKeyDown = false; | ||
|
||
public ButtonActions() | ||
{ | ||
this.actionType = ActionType.Button; | ||
|
||
this.Value = false; | ||
this.prevValue = false; | ||
} | ||
|
||
public ButtonActions(ButtonFlags button) : this() | ||
{ | ||
this.Button = button; | ||
} | ||
|
||
public override void Execute(ButtonFlags button, bool value) | ||
{ | ||
base.Execute(button, value); | ||
|
||
switch (this.Value) | ||
{ | ||
case true: | ||
{ | ||
if (IsKeyDown) | ||
return; | ||
|
||
IsKeyDown = true; | ||
SetHaptic(button, false); | ||
} | ||
break; | ||
case false: | ||
{ | ||
if (!IsKeyDown) | ||
return; | ||
|
||
IsKeyDown = false; | ||
SetHaptic(button, true); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
public bool GetValue() | ||
{ | ||
return (bool)this.Value; | ||
} | ||
} | ||
} |
Oops, something went wrong.