src/joystick/android/SDL_sysjoystick.c
changeset 11778 db38a635e2c6
parent 11671 3dc400fafd76
child 11811 5d94cb6b24d3
equal deleted inserted replaced
11777:5b29597e48b6 11778:db38a635e2c6
    76  * FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS
    76  * FIXME: This is only suited for the case where we use a fixed number of buttons determined by ANDROID_MAX_NBUTTONS
    77  */
    77  */
    78 static int
    78 static int
    79 keycode_to_SDL(int keycode)
    79 keycode_to_SDL(int keycode)
    80 {
    80 {
    81     /* FIXME: If this function gets too unwiedly in the future, replace with a lookup table */
    81     /* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */
    82     int button = 0;
    82     int button = 0;
    83     switch(keycode) 
    83     switch(keycode) 
    84     {
    84     {
    85         /* Some gamepad buttons (API 9) */
    85         /* Some gamepad buttons (API 9) */
    86         case AKEYCODE_BUTTON_A:
    86         case AKEYCODE_BUTTON_A:
   108             button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
   108             button = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
   109             break;
   109             break;
   110         case AKEYCODE_BUTTON_START:
   110         case AKEYCODE_BUTTON_START:
   111             button = SDL_CONTROLLER_BUTTON_START;
   111             button = SDL_CONTROLLER_BUTTON_START;
   112             break;
   112             break;
       
   113         case AKEYCODE_BACK:
   113         case AKEYCODE_BUTTON_SELECT:
   114         case AKEYCODE_BUTTON_SELECT:
   114             button = SDL_CONTROLLER_BUTTON_BACK;
   115             button = SDL_CONTROLLER_BUTTON_BACK;
   115             break;
   116             break;
   116         case AKEYCODE_BUTTON_MODE:
   117         case AKEYCODE_BUTTON_MODE:
   117             button = SDL_CONTROLLER_BUTTON_GUIDE;
   118             button = SDL_CONTROLLER_BUTTON_GUIDE;
   144             break;
   145             break;
   145         case AKEYCODE_DPAD_CENTER:
   146         case AKEYCODE_DPAD_CENTER:
   146             /* This is handled better by applications as the A button */
   147             /* This is handled better by applications as the A button */
   147             /*button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */
   148             /*button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */
   148             button = SDL_CONTROLLER_BUTTON_A;
   149             button = SDL_CONTROLLER_BUTTON_A;
   149             break;
       
   150 
       
   151         case AKEYCODE_BACK:
       
   152             button = SDL_CONTROLLER_BUTTON_B;
       
   153             break;
   150             break;
   154 
   151 
   155         /* More gamepad buttons (API 12), these get mapped to 20...35*/
   152         /* More gamepad buttons (API 12), these get mapped to 20...35*/
   156         case AKEYCODE_BUTTON_1:
   153         case AKEYCODE_BUTTON_1:
   157         case AKEYCODE_BUTTON_2:
   154         case AKEYCODE_BUTTON_2: