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

Some fixes #9

Merged
merged 3 commits into from
Apr 16, 2016
Merged

Some fixes #9

merged 3 commits into from
Apr 16, 2016

Conversation

pevzi
Copy link
Contributor

@pevzi pevzi commented Apr 15, 2016

  1. pressed and released with a dir argument now check the previous value so that they work as intended. Hope I understand the intended behavior correctly though.
  2. pressed, released and isDown now return false instead of a result of the non-dir check when dir is provided and the condition is false.
  3. gamepadButtons and gamepadAxis now ensure that a joystick with the given number exists before doing anything with it to avoid a blue screen when the joystick is not available.

@tesselode
Copy link
Owner

For 1 and 2, can you create a quick demo that shows the difference in behavior between the current version and your changes? I think I know what's going on with 2 (and good catch, btw), but I'm not sure what you meant by 1.

As for 3, yeahhh I need to get better about checking things for nil. Hoo boy.

@pevzi
Copy link
Contributor Author

pevzi commented Apr 16, 2016

Just add the following lines to the demo and try pressing left and right:

  if Control.Horizontal:pressed(-1) then
    print("left pressed")
  end

  if Control.Horizontal:released(-1) then
    print("left released")
  end

Expected behavior: "left pressed" is printed once when I press left, "left released" is printed once when I release left.
Observed behavior: (1) both "left pressed" and "left released" are printed every frame while left is down, (2) "left pressed" is printed once when I press right, "left released" is printed once when I release right.

@tesselode
Copy link
Owner

Oh dear. That is....not correct. :P

Alright, well, all of your changes make perfect sense now! Thank you so much!

@tesselode tesselode merged commit dcf1342 into tesselode:master Apr 16, 2016
@pevzi pevzi deleted the fixes branch April 16, 2016 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants