Comments (4)
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.
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.
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.
If you need more help, try asking on the SDL forums:
https://discourse.libsdl.org/c/sdl-development/6
from sdl.
Related Issues (20)
- 10,000th issue 🥳 HOT 1
- [Camera] CoreMedia: Incorrect pixel format used for USB HDMI Video grabber (YUYV 4:2:2) HOT 3
- SDL2 SDL_Keycode returns characters in current keyboard layout HOT 2
- SDL3 doesn't statically link without SDL_STATIC_PIC flag on Ubuntu 24.04
- SDL3 static link fail when making a shared object without SDL_STATIC_PIC HOT 4
- Destroying child window with mouse captured by parent causes assertion failure on X11
- Creating popup windows always sets error
- [SDL2/3] [Emscripten] `SDL_CreateRendererWithProperties` throws an error when setting VSync
- SDL2: SDL_ShowCursor(SDL_DISABLE) doesn't disable mouse under WSL HOT 2
- SDL_JOYSTICK_DISABLED breaks Android build with a linker error HOT 3
- Server side decorations broken on SDL2 Wayland HOT 2
- macOS 10.14 SDK Compatibility HOT 12
- [Camera]: SDL_GetCameraPermissionState returns 0 if pipewire backend is being used HOT 2
- [SDL3] Is SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER not implemented? HOT 1
- Linux - Installing SDL2 .so file using CMake HOT 1
- Source engine toGL games crash when not using x11 HOT 2
- Crash with SDL_EVENT_GAMEPAD_REMOVED [[repro inside]] HOT 17
- Unnecessary CMake re-configures triggered by git history changes HOT 3
- SDL3 Linux Wayland - SDL_SetWindowFullscreen incorrect size HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdl.