-
Notifications
You must be signed in to change notification settings - Fork 36
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
Analog button values from 0.0 to 1.0 #133
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
void (*_wpe_reserved1)(void); | ||
void (*analog_button_changed)(void*, enum wpe_gamepad_button, double); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: [email protected] 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.