gamepads icon indicating copy to clipboard operation
gamepads copied to clipboard

feat: Support for Web

Open zhuhaichao518 opened this issue 1 year ago • 4 comments

I am developing an app requiring web support for gamepads. I would like to contribute to this project. Please help review this pull request. Thanks!

zhuhaichao518 avatar Oct 23 '24 14:10 zhuhaichao518

@spydon @erickzanardo Any more suggestions?

zhuhaichao518 avatar Dec 08 '24 04:12 zhuhaichao518

Also this:

Because every version of gamepads_web from path depends on web >=0.1.0-beta which requires SDK version >=3.1.0-49.0.dev <4.0.0, gamepads_web from path is forbidden.

So the SDK has to be bumped to 3.4 everywhere, and then you can use web ^1.1.0 (And flutter has to be bumped accordingly).

spydon avatar Dec 10 '24 11:12 spydon

Popping in to mention that there is a Github issue in this project associated with web support. I made a proof of concept for a web implementation earlier this year and I wouldn't consider web to be a stable platform for the purposes of this package, see comments on the issue.

https://github.com/flame-engine/gamepads/issues/32

markvideon avatar Dec 18 '24 06:12 markvideon

Popping in to mention that there is a Github issue in this project associated with web support. I made a proof of concept for a web implementation earlier this year and I wouldn't consider web to be a stable platform for the purposes of this package, see comments on the issue.

I just ran a test on my Mac with 4 different USB Gamepads (Logitech Gamepad F310, cheap Nintendo NES like, Competition Pro USB, Hama Black Force).

  • gamepads plugin v 0.1.4 detected: 2 / 4
  • The Mac itself detected as Game Controller in Settings: 3 / 4
  • https://hardwaretester.com/gamepad (Gamepad API) detected: 4 / 4

It also reported the events from the devices. Plug and Play in the Browser. Surprisingly, it just works.

I would also argue that all relevant features that game developers need are well established in the GamePad API, as shown here: https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API#browser_compatibility.

Therefore it would be really cool to see GamePad support for Flame moving forward on both Windows and on Web.

crcdng avatar Jan 21 '25 05:01 crcdng

@zhuhaichao518 do you have any plans of finishing this up? :)

spydon avatar Sep 08 '25 15:09 spydon

Oh, sure. I will work on this on this weekend. I am also investigating vibration and I wonder if anyone is working on it. :)

Lukas Klingsbo @.***>于2025年9月8日 周一23:18写道:

spydon left a comment (flame-engine/gamepads#48) https://github.com/flame-engine/gamepads/pull/48#issuecomment-3266809497

@zhuhaichao518 https://github.com/zhuhaichao518 do you have any plans of finishing this up? :)

— Reply to this email directly, view it on GitHub https://github.com/flame-engine/gamepads/pull/48#issuecomment-3266809497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM4EALHNHNKXA45TAV7BJLT3RWM6BAVCNFSM6AAAAACF5ZP5JOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENRWHAYDSNBZG4 . You are receiving this because you were mentioned.Message ID: @.***>

zhuhaichao518 avatar Sep 15 '25 03:09 zhuhaichao518

Oh, sure. I will work on this on this weekend. I am also investigating vibration and I wonder if anyone is working on it. :)

Great to hear! Nobody is working on vibration as far as I know.

spydon avatar Sep 15 '25 05:09 spydon

@spydon Hi, I'm not sure if any action is required to move to the next step. I see Because gamepads depends on gamepads_web any which doesn't exist (could not find package gamepads_web at https://pub.dev),/ version solving failed. in CI but I'm quite not familiar with this. :)

zhuhaichao518 avatar Sep 23 '25 08:09 zhuhaichao518

@zhuhaichao518 I pushed a commit to add it to the root pubspec, so you'll have to pull locally to get the latest.

spydon avatar Oct 01 '25 09:10 spydon

@spydon Hi, there is still a format-check error from melos. I don't know what is the difference from formatting with melos and locally dart format.

zhuhaichao518 avatar Oct 05 '25 01:10 zhuhaichao518

@zhuhaichao518 it does the same thing, but you can run melos format locally if you want to be sure. Also make sure you're on Flutter ^3.35.

spydon avatar Oct 05 '25 07:10 spydon

@zhuhaichao518 it does the same thing, but you can run melos format locally if you want to be sure. Also make sure you're on Flutter ^3.35.

Hi, I run dart format . on Flutter 3.35.5 && Dart 3.9.2 • DevTools 2.48.0 but no format happened, which is different from CI: [gamepads_web]: Formatted lib/gamepads_web.dart. Would you please try format this file for me?

zhuhaichao518 avatar Oct 21 '25 09:10 zhuhaichao518

Hi, I run dart format . on Flutter 3.35.5 && Dart 3.9.2 • DevTools 2.48.0 but no format happened, which is different from CI: [gamepads_web]: Formatted lib/gamepads_web.dart. Would you please try format this file for me?

That's weird, I had no problems running dart format in it, pushed it as https://github.com/flame-engine/gamepads/pull/48/commits/3c0e9455b5a0e985d48c9cef9acf37b627696fd9

spydon avatar Oct 21 '25 09:10 spydon

@markvideon @luanpotter could you give this a review too?

spydon avatar Oct 25 '25 06:10 spydon