GDevelop-extensions icon indicating copy to clipboard operation
GDevelop-extensions copied to clipboard

Bug Fix and Enhancement

Open krunkster opened this issue 2 years ago • 5 comments

Bug Fix: The onScenePostEvents was not resetting the pressed state to false for unpressed buttons which made the C_button_released call return true always after releasing a button once.

Enhancement: Updated the onSceneFirstLoaded and onScenePostEvents to keep track of the last activated controller id. Also added a condition to get the last activated controller id.

This makes it possible to dynamically switch between gamepads and just use whichever controller the user picks up instead of having to designate a static controller/player id. Sorry for the whitespace differences.

I'm not a big github user.

krunkster avatar Oct 21 '22 04:10 krunkster

@Bouh I wasn't sure this was the correct way to share changes with you, but I hope you will consider them.

krunkster avatar Oct 21 '22 04:10 krunkster

This look good! That mean the C_button_released condition return true only once when the button has been released. And it doesn't stay on false. This is a breaking change in a good way because this mimic how it's done with the key released condition. Thanks for this fix :+1:

Bouh avatar Oct 21 '22 08:10 Bouh

Also if you can edit the version from 0.3.0 to 1.0.0.

Bouh avatar Oct 21 '22 08:10 Bouh

I think there still might be a lingering bug where calling "Any Gamepad button was released" or "Any gamepad button was pressed" before called "Was button X released?" will prevent getting an accurate response. There are also rare times where button presses are not detected. I have not done problem isolation or debugging on either of these, so just letting you know for now.

krunkster avatar Oct 21 '22 16:10 krunkster

Indeed I found an issue with "Any Gamepad button was released". I fixed it by adding a case in C_any_button_released where if the button is released or not I save the appropriate value in the previousFrameStateButtons of the button.

You can try it with this example. Let me know if you see something else. gamepad 1.0.0 - example.zip

Bouh avatar Oct 24 '22 11:10 Bouh

This seems like something that should get merged.

@krunkster were you able to test @Bouh latest update of the example game?

tristanbob avatar Nov 20 '22 18:11 tristanbob

The merge will be made into a cleaner branch here: https://github.com/GDevelopApp/GDevelop-extensions/pull/692

Bouh avatar Dec 11 '22 20:12 Bouh