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

Send analog button values based on W3C GamePad #1410

Closed

Conversation

mbhatt627
Copy link

@mbhatt627 mbhatt627 commented Oct 4, 2024

No description provided.

@mbhatt627 mbhatt627 requested a review from zdobersek as a code owner October 4, 2024 16:25
@mbhatt627
Copy link
Author

mbhatt627 commented Oct 4, 2024

This PR dependent on lib WPE changes for getting Gamepad button values from 00 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.

@modeveci modeveci removed the request for review from zdobersek October 16, 2024 12:40
void WPEGamepad::analogButtonChanged(unsigned button, double value)
{
m_lastUpdateTime = MonotonicTime::now();
m_buttonValues[button].setValue(value);
Copy link

Choose a reason for hiding this comment

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

can we assure that the lower layers will send values between 0 and 1?

would it make sense to clamp or even assert those received values?

ganeshprasads pushed a commit to ganeshprasads/WPEWebKit that referenced this pull request Dec 12, 2024
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
@ceyusa
Copy link

ceyusa commented Dec 17, 2024

this issue should be closed in favor of #1442

@pgorszkowski-igalia
Copy link

#1442 is the newest implementation of this PR. I close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants