mirror of https://github.com/encounter/SDL.git
switch: add game controller support
This commit is contained in:
parent
9a0008af63
commit
abf3a5b7ed
|
@ -846,6 +846,10 @@ static const char *s_ControllerMappings [] =
|
|||
#if defined(SDL_JOYSTICK_EMSCRIPTEN)
|
||||
"default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
#endif
|
||||
#if defined(SDL_JOYSTICK_SWITCH)
|
||||
"53776974636820436F6E74726F6C6C65,Switch Controller,a:b1,b:b0,back:b11,dpdown:b15,dpleft:b12,dpright:b14,dpup:b13,leftshoulder:b6,leftstick:b4,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b5,righttrigger:b9,rightx:a2,righty:a3,start:b10,x:b3,y:b2,",
|
||||
#endif
|
||||
"hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -91,24 +91,7 @@ SDL_SYS_JoystickDetect(void)
|
|||
const char *
|
||||
SDL_SYS_JoystickNameForDeviceIndex(int device_index)
|
||||
{
|
||||
if (device_index == 1)
|
||||
return "Switch Controller #1";
|
||||
if (device_index == 2)
|
||||
return "Switch Controller #2";
|
||||
if (device_index == 3)
|
||||
return "Switch Controller #3";
|
||||
if (device_index == 4)
|
||||
return "Switch Controller #4";
|
||||
if (device_index == 5)
|
||||
return "Switch Controller #5";
|
||||
if (device_index == 6)
|
||||
return "Switch Controller #6";
|
||||
if (device_index == 7)
|
||||
return "Switch Controller #7";
|
||||
if (device_index == 8)
|
||||
return "Switch Controller #8";
|
||||
|
||||
return "Switch Controller #0";
|
||||
return "Switch Controller";
|
||||
}
|
||||
|
||||
/* Function to perform the mapping from device index to the instance id for this index */
|
||||
|
|
Loading…
Reference in New Issue