diff --git a/test/controllermap.c b/test/controllermap.c index a70764ab9..3c915e19c 100644 --- a/test/controllermap.c +++ b/test/controllermap.c @@ -119,7 +119,7 @@ static int s_arrBindingOrder[] = { SDL_CONTROLLER_BUTTON_PADDLE2, SDL_CONTROLLER_BUTTON_PADDLE3, SDL_CONTROLLER_BUTTON_PADDLE4, - -1, + SDL_CONTROLLER_BUTTON_TOUCHPAD, }; SDL_COMPILE_TIME_ASSERT(s_arrBindingOrder, SDL_arraysize(s_arrBindingOrder) == BINDING_COUNT); @@ -167,6 +167,7 @@ static SDL_bool s_bBindingComplete; static SDL_Window *window; static SDL_Renderer *screen; static SDL_bool done = SDL_FALSE; +static SDL_bool bind_touchpad = SDL_FALSE; SDL_Texture * LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) @@ -234,6 +235,13 @@ SetCurrentBinding(int iBinding) return; } + if (s_arrBindingOrder[iBinding] == SDL_CONTROLLER_BUTTON_TOUCHPAD && + !bind_touchpad) + { + SetCurrentBinding(iBinding + 1); + return; + } + s_iCurrentBinding = iBinding; pBinding = &s_arrBindings[s_arrBindingOrder[s_iCurrentBinding]]; @@ -731,6 +739,10 @@ main(int argc, char *argv[]) exit(1); } + if (argv[1] && SDL_strcmp(argv[1], "--bind-touchpad") == 0) { + bind_touchpad = SDL_TRUE; + } + /* Create a window to display joystick axis position */ window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,