Exemplo n.º 1
0
static int16_t dinput_input_state(void *data,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned index, unsigned id)
{
   struct dinput_input *di = (struct dinput_input*)data;
   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         return dinput_is_pressed(di, binds[port], port, id);

      case RETRO_DEVICE_KEYBOARD:
         return dinput_keyboard_pressed(di, id);

      case RETRO_DEVICE_ANALOG:
         return input_joypad_analog(di->joypad, port, index, id, g_settings.input.binds[port]);

      case RETRO_DEVICE_MOUSE:
         return dinput_mouse_state(di, id);

      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return dinput_pointer_state(di, index, id, device == RARCH_DEVICE_POINTER_SCREEN);

      case RETRO_DEVICE_LIGHTGUN:
         return dinput_lightgun_state(di, id);

      default:
         return 0;
   }
}
Exemplo n.º 2
0
static int16_t dinput_mouse_state_screen(struct dinput_input *di, unsigned id)
{
   switch (id)
   {
      case RETRO_DEVICE_ID_MOUSE_X:
         return di->mouse_x;
      case RETRO_DEVICE_ID_MOUSE_Y:
         return di->mouse_y;
      default:
         break;
   }

   return dinput_mouse_state(di, id);
}
Exemplo n.º 3
0
static int16_t dinput_input_state(void *data,
      const struct retro_keybind **binds, unsigned port,
      unsigned device, unsigned idx, unsigned id)
{
   int16_t ret;
   struct dinput_input *di = (struct dinput_input*)data;
   settings_t *settings    = config_get_ptr();

   switch (device)
   {
      case RETRO_DEVICE_JOYPAD:
         if (binds[port])
            return dinput_is_pressed(di, binds[port], port, id);
         break;
      case RETRO_DEVICE_KEYBOARD:
         return dinput_keyboard_pressed(di, id);

      case RETRO_DEVICE_ANALOG:
         if (binds[port])
            ret = dinput_pressed_analog(di, binds[port], idx, id);
         if (!ret && binds[port])
            ret = input_joypad_analog(di->joypad, port,
                  idx, id, settings->input.binds[port]);
         return ret;

      case RETRO_DEVICE_MOUSE:
         return dinput_mouse_state(di, id);

      case RARCH_DEVICE_MOUSE_SCREEN:
         return dinput_mouse_state_screen(di, id);

      case RETRO_DEVICE_POINTER:
      case RARCH_DEVICE_POINTER_SCREEN:
         return dinput_pointer_state(di, idx, id,
               device == RARCH_DEVICE_POINTER_SCREEN);

      case RETRO_DEVICE_LIGHTGUN:
         return dinput_lightgun_state(di, id);
   }

   return 0;
}