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

Implement joystick input #1494

Merged
merged 36 commits into from May 12, 2018
Merged

Implement joystick input #1494

merged 36 commits into from May 12, 2018

Conversation

smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Apr 3, 2018

Axes + buttons are implemented.

IJoystickState provices:

  • Buttons: All the pressed buttons. These include axes as buttons, which is what mania/taiko/catch(?)/osu are all going to use.
  • Axes: The raw values of all axes.
  • AxisDelta(): To get the delta for one axis.

Currently supports 20 buttons + 10 axes. We can increase this later if needed but it's already a very extreme use-case.

Hats not implemented (I don't have a controller to test these with anyway).

Tested on my FP7 EMP controller.

Supports keybindings (see changes in InputKey).

@smoogipoo smoogipoo added this to the April 2018 milestone Apr 3, 2018
@smoogipoo smoogipoo mentioned this pull request Apr 3, 2018
1 task
@peppy
Copy link
Member

peppy commented Apr 10, 2018

  • Hats should probably be mapped to axes. Implementation should be simple.
  • We need a deadzone for axes by default. Even with multiple calibrations, it's impossible to get 0.00 on most any analog sticks.

@peppy
Copy link
Member

peppy commented Apr 10, 2018

Axis to button mapping is currently also very wrong. No matter which axis I trigger, it is always in Axis 1

xAxis = -1;
else if (hatState.IsRight)
xAxis = 1;
if (hatState.IsDown)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@peppy
Copy link
Member

peppy commented Apr 15, 2018

I think we may need to have all axes calibrate on startup (on first input frame) to find their zero points. Some controllers (XBOne in this case) have -1 as the default "zero" point for triggers.

{
public IEnumerable<JoystickButton> Buttons { get; set; } = new List<JoystickButton>();

public IReadOnlyList<float> Axes { get; set; } = new List<float>();

This comment was marked as off-topic.

@peppy peppy modified the milestones: April 2018, May 2018 May 2, 2018
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for now!

@peppy peppy merged commit fac6886 into ppy:master May 12, 2018
@smoogipoo smoogipoo deleted the joystick branch November 26, 2018 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants