mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 08:56:25 +00:00
Added mappings for popular controllers on Chromebooks
This commit is contained in:
@@ -470,6 +470,10 @@ static int SDLCALL SDL_GameControllerEventWatcher(void *userdata, SDL_Event * ev
|
||||
*/
|
||||
static ControllerMapping_t *SDL_CreateMappingForAndroidController(SDL_JoystickGUID guid)
|
||||
{
|
||||
const int face_button_mask = ((1 << SDL_CONTROLLER_BUTTON_A) |
|
||||
(1 << SDL_CONTROLLER_BUTTON_B) |
|
||||
(1 << SDL_CONTROLLER_BUTTON_X) |
|
||||
(1 << SDL_CONTROLLER_BUTTON_Y));
|
||||
SDL_bool existing;
|
||||
char mapping_string[1024];
|
||||
int button_mask;
|
||||
@@ -481,6 +485,10 @@ static ControllerMapping_t *SDL_CreateMappingForAndroidController(SDL_JoystickGU
|
||||
/* Accelerometer, shouldn't have a game controller mapping */
|
||||
return NULL;
|
||||
}
|
||||
if (!(button_mask & face_button_mask) || !axis_mask) {
|
||||
/* We don't know what buttons or axes are supported, don't make up a mapping */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string));
|
||||
|
||||
|
Reference in New Issue
Block a user