dart-lang/sdk

[next] expose the `buttons` attribute on the Gamepad interface

Closed this issue · 7 comments

This issue was originally filed by rms...@rossis.red


Dart SDK 1.10.0-dev.1.10
Windows 7x64

Currently in dart:html the Gamepad interface appears to be missing the buttons attribute.

https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:html.Gamepad
https://w3c.github.io/gamepad/#gamepad-interface

All of the other attributes are exposed, so if the buttons could be exposed I'd be able to use dart:html instead of js interop.

thanks

This is explicitly suppressed with a FIXME that says to enable it once we support a HeapVector on the Dart side of the bindings. I suspect this will become a non-issue with upcoming changes to the bindings, and it might be already.


cc @terrylucas.
Added this to the 1.11 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium, Accepted labels.
Changed the title to: "[next] expose the buttons attribute on the Gamepad interface".

@alan-knight, is this being worked on in 1.13? If not, we should remove the milestone value.

Removing milestone as no one appears to be working on this.

Fox32 commented

This seems to be resolved starting with Dart 1.16.0-dev.5.4 (at least in dart2js)

Yeah!

But there is still an outstanding issue: window.navigator.getGamepads() does return an array, but for non connected controllers the array doesn't contain null values but undefined values.
This results in the condition gamepad == null || !pad.connected crashing with a NullError.
My current workaround is to use dart:js to convert them from undefiend into null.

Fox32 commented

Just came across my workaround here again. I removed it and it seems that neither DDC nor dart2js still requires my workaround 👍 Not sure when this was fixed, but I guess we should close this issue? @kevmoo or @vsmenon can you do that?

Closing out! Glad to hear things are better!