Giter Club home page Giter Club logo

Comments (8)

Perksey avatar Perksey commented on May 22, 2024 1

Yeah we use Xbox's button names, and the indices of all standard buttons match up with the ButtonName enum in order to be a conformant implementation of our Input API. An input backend may define more non-standard buttons if they're available, though.

from silk.net.

Perksey avatar Perksey commented on May 22, 2024

I can definitely see the appeal of this, but I don't think we can implement it as properties. We'd probably have to do Gamepads[0].Buttons.GetA(). Is this still desirable?

from silk.net.

mikart143 avatar mikart143 commented on May 22, 2024

It would be great :D I am looking forward to see this in library

from silk.net.

copygirl avatar copygirl commented on May 22, 2024

Is there a standard for naming gamepad buttons?

from silk.net.

Perksey avatar Perksey commented on May 22, 2024

If you mean an industry-global standard, no. But for Silk.NET, the agreed-upon proposal for Silk.NET's button names are available here: https://github.com/Ultz/Silk.NET/blob/master/documentation/proposals/Proposal%20-%20Input.md#buttonname

from silk.net.

copygirl avatar copygirl commented on May 22, 2024

So the same ButtonName may refer to buttons in different physical locations, depending on the brand of the controller?

And since said enum exists, what about Gamepads[0].Buttons[ButtonName.A]?

from silk.net.

Perksey avatar Perksey commented on May 22, 2024

Ah right. The ButtonName enum is mapped to its GLFW index, so it's mapped to whatever physical button GLFW maps it to :D

The only reason it's Gamepads[0].Buttons[(int) ButtonName.A] and not Gamepads[0].Buttons[ButtonName.A] is because the IReadOnlyList<Button> interface requires an int indexer, and I'm not sure if we want to create our own interfaces for each IReadOnlyList usage just so we can have these indexers.

When extension everything is added, we will consider adding strong-typed indexes. See also: dotnet/csharplang#192

from silk.net.

copygirl avatar copygirl commented on May 22, 2024

Oh, I was assuming Buttons[int] would be accessing a button by the index it's exposed as through the.. driver, I assume? And Buttons[ButtonName] would instead change depending on layout. Such that, for example, 0 => ButtonName.A on XBox-style controllers, but ButtonName.B on Nintendo or ButtonName.X on PlayStation controllers. (Though, then there's Triangle and Square, ...)

from silk.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.