Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EA to Public, file replacement. #938

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading