src/joystick/darwin/SDL_sysjoystick.c
changeset 2295 dbc6d1893869
parent 2287 15a242fca6c4
child 2632 9e7f58b1b255
child 2698 e1da92da346c
child 2713 0906692aa6a4
equal deleted inserted replaced
2294:386ebf50dd91 2295:dbc6d1893869
   818     while (element) {
   818     while (element) {
   819         Uint8 pos = 0;
   819         Uint8 pos = 0;
   820 
   820 
   821         range = (element->max - element->min + 1);
   821         range = (element->max - element->min + 1);
   822         value = HIDGetElementValue(device, element) - element->min;
   822         value = HIDGetElementValue(device, element) - element->min;
   823         if (range == 4)  /* 4 position hatswitch - scale up value */
   823         if (range == 4)         /* 4 position hatswitch - scale up value */
   824             value *= 2;
   824             value *= 2;
   825         else if (range != 8)     /* Neither a 4 nor 8 positions - fall back to default position (centered) */
   825         else if (range != 8)    /* Neither a 4 nor 8 positions - fall back to default position (centered) */
   826             value = -1;
   826             value = -1;
   827         switch (value) {
   827         switch (value) {
   828         case 0:
   828         case 0:
   829             pos = SDL_HAT_UP;
   829             pos = SDL_HAT_UP;
   830             break;
   830             break;