Giter Club home page Giter Club logo

Comments (4)

AntTheAlchemist avatar AntTheAlchemist commented on September 13, 2024

Hi @lassade ,

That mapping looks right. The mapping string you generated with the Gamepad Tool looks the same as the default one, which is why it didn't change anything.

When you pressed the left shoulder in the Gamepad Tool, it produced the correct scancode and mapped it as expected. Something seems to be changing the behaviour of your app? I suspect that if you used your controller someone else's SDL app/game, it would be mapped ok? Try my Game Controller Tester app on itch.io to give you some more insights.

from sdl.

lassade avatar lassade commented on September 13, 2024

It work as expected, I also played Hades from Supergiant Games without any problems with it.

I have a very cursed workaround that uses SDL_GameControllerGetBindForButton that I use undo (or do) the binding like so:

// I think this is a valid c code, I'm acctually using zig :P
// reset binds
for(int i = 0; i < SDL_CONTROLLER_BUTTON_MAX) {
    binds[i] = i;
}
// de-map binds
for(int i = 0; i < SDL_CONTROLLER_BUTTON_MAX) {
    bind = SDL_GameControllerGetBindForButton(i);
    if (bind.bindType) binds[bind.value.button] = i;
}

from sdl.

slouken avatar slouken commented on September 13, 2024

Oh, yeah, SDL_GameControllerGetBindForButton(gamepad, SDL_CONTROLLER_BUTTON_LEFTSHOULDER) will give you a button index, not another gamepad button. You generally shouldn't be using the functions to look up bindings, they won't provide you with anything useful unless you're building a gamepad binding application.

Take a look at https://github.com/libsdl-org/SDL/blob/main/test/testcontroller.c for a complete example of using the SDL gamepad API.

from sdl.

slouken avatar slouken commented on September 13, 2024

If you need more help, try asking on the SDL forums:
https://discourse.libsdl.org/c/sdl-development/6

from sdl.

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.