Skip to content

Commit

Permalink
EA to Public, file replacement.
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperH2O committed Jan 12, 2024
1 parent 0293646 commit c9d091d
Show file tree
Hide file tree
Showing 54 changed files with 15,836 additions and 16,249 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ labels: bug
- [ ] GPD
- [ ] ONEXPLAYER
- [ ] VALVE
- [ ] LENOVO

**Device model**
Your device model
Expand Down
116 changes: 58 additions & 58 deletions HandheldCompanion/Actions/AxisActions.cs
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;
}
}
}
118 changes: 59 additions & 59 deletions HandheldCompanion/Actions/ButtonActions.cs
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;
}
}
}
Loading

0 comments on commit c9d091d

Please sign in to comment.