Analog button values from 0.0 to 1.0#133
Analog button values from 0.0 to 1.0#133mbhatt627 wants to merge 1 commit intoWebPlatformForEmbedded:masterfrom
Conversation
aperezdc
left a comment
There was a problem hiding this comment.
Patch looks good and does the correct thing of adding a new function pointer to the interface to avoid breaking the ABI. I have only a couple of very minor comments and after addressing those we would be happy to merge these changes. Thanks!
|
|
||
| /*< private >*/ | ||
| void (*_wpe_reserved1)(void); | ||
| void (*analog_button_changed)(void*, enum wpe_gamepad_button, double); |
There was a problem hiding this comment.
Move analog_button_changed to line 143, right below axis_changed, and renumber the _wpe_reservedX so they start with 1.
There was a problem hiding this comment.
I wonder if it would be possible to reuse button_changed for both kinds of buttons value, using double instead of boolean, without breaking the back compatibility.
There was a problem hiding this comment.
No, we cannot change the types of parameters or the number of parameters, because that would break both the ABI and the API. Adding a new function is fine, as done in this patch.
| * Method called by application (gamepad implementator). It reports to | ||
| * WPEWebkit a change in the value of analog @button. | ||
| * | ||
| * Since: 1.15 |
There was a problem hiding this comment.
Version 1.15 will be a development one, the first stable version to include this will be 1.16.0 so it's better to write 1.16 here.
|
@mbhatt627 Could you update the PR taking into account the suggestions? Thanks in advance 🙇🏼 |
This PR dependent on libWPE changes for getting Gamepad button values from 0.0 to 1.0. WebPlatformForEmbedded/libwpe#133 https://www.w3.org/TR/gamepad/#dom-gamepadbutton-value value attribute: For buttons that have an analog sensor, this property MUST represent the amount which the button has been pressed. All button values MUST be linearly normalized to the range [0.0 .. 1.0]. 0.0 MUST mean fully unpressed, and 1.0 MUST mean fully pressed. For buttons without an analog sensor, only the values 0.0 and 1.0 for fully unpressed and fully pressed respectively, MUST be provided. Original Author: manoj_bhatta@comcast.com See: WebPlatformForEmbedded#1410
Analog button should have values from 0.0 to 1.0 instead of only digital value.
https://www.w3.org/TR/gamepad/#dom-gamepadbutton-value
value attribute
For buttons that have an analog sensor, this property MUST represent the amount which the button has been pressed. All button values MUST be linearly normalized to the range [0.0 .. 1.0]. 0.0 MUST mean fully unpressed, and 1.0 MUST mean fully pressed. For buttons without an analog sensor, only the values 0.0 and 1.0 for fully unpressed and fully pressed respectively, MUST be provided.