kallaspriit / HTML5-JavaScript-Gamepad-Controller-Library

Library for accessing gamepads in modern browsers.
http://kallaspriit.github.com/HTML5-JavaScript-Gamepad-Controller-Library/
129 stars 35 forks source link

Linux & xbox controller #17

Open daedeloth opened 10 years ago

daedeloth commented 10 years ago

Hi,

Awesome project! Saves me a lot of time. I've got it working on windows, but the mapping in chrome / linux with my xbox 360 controller is wrong.

I've been looking at the code for a way to override the mapping for linux, but am I right in saying that currently there is no filter for platform? mac / windows / linux?

Many thanks, Thijs

JakeChampion commented 10 years ago

You are correct in that assumption, this library is OS agnostic in nature

On Sun, Dec 22, 2013 at 9:08 PM, daedeloth notifications@github.com wrote:

Hi,

Awesome project! Saves me a lot of time. I've got it working on windows, but the mapping in chrome / linux with my xbox 360 controller is wrong.

I've been looking at the code for a way to override the mapping for linux, but am I right in saying that currently there is no filter for platform? mac / windows / linux?

Many thanks, Thijs

— Reply to this email directly or view it on GitHubhttps://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library/issues/17 .

dertseha commented 10 years ago

Currently the OS is not taken into account. But the code to determine the gamepad mapping could easily support it: Gamepad.prototype._resolveMapping() uses an env object which could have an additional os member for example (resolving the value would be a dedicated topic). A gamepad mapping could then also specify an os member, which acts as an additional filter matching only if its value is also found in that reference env.

But I so far have not found out whether the unification of button layouts for the same controller across OS and browsers must happen in JS-user land, in the browser or possibly in the OS.

daedeloth commented 10 years ago

From what I understand, it is meant to be somewhat generalized. But any implementation of the gamepad api I've seen had my mapping mixed up.

I also don't think I have a way to fix it in ubuntu.

It's also hard to find people with similar issues, since not that many people have ubuntu & an xbox controller laying around.

I think I'll have a go at that added os member.