Пример #1
0
/* task_data = overlay_task_data_t* */
void input_overlay_loaded(void *task_data, void *user_data, const char *err)
{
   size_t i;
   overlay_task_data_t              *data = (overlay_task_data_t*)task_data;
   settings_t                   *settings = config_get_ptr();
   input_overlay_t                    *ol = NULL;
   const video_overlay_interface_t *iface = NULL;

   if (err)
      return;

#ifdef HAVE_MENU
   /* We can't display when the menu is up */
   if (settings->input.overlay_hide_in_menu && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
   {
      if (!input_driver_is_onscreen_keyboard_enabled() && settings->input.overlay_enable)
         goto abort_load;
   }
#endif

   if (!settings->input.overlay_enable)
      goto abort_load;

   if (!video_driver_overlay_interface(&iface) || !iface)
   {
      RARCH_ERR("Overlay interface is not present in video driver.\n");
      goto abort_load;
   }

   ol             = (input_overlay_t*)calloc(1, sizeof(*ol));
   ol->overlays   = data->overlays;
   ol->size       = data->size;
   ol->active     = data->active;
   ol->iface      = iface;
   ol->iface_data = video_driver_get_ptr(true);

   input_overlay_load_active(ol, settings->input.overlay_opacity);

   if (input_driver_is_onscreen_keyboard_enabled())
      input_overlay_enable(ol, settings->osk.enable);
   else
      input_overlay_enable(ol, settings->input.overlay_enable);
   input_overlay_set_scale_factor(ol, settings->input.overlay_scale);

   ol->next_index = (ol->index + 1) % ol->size;
   ol->state      = OVERLAY_STATUS_NONE;
   ol->alive      = true;
   overlay_ptr    = ol;

   free(data);
   return;

abort_load:
   for (i = 0; i < data->size; i++)
      input_overlay_free_overlay(&data->overlays[i]);

   free(data->overlays);
   free(data);
}
Пример #2
0
void input_overlay_next(input_overlay_t *ol)
{
   ol->index = ol->next_index;
   ol->active = &ol->overlays[ol->index];

   input_overlay_load_active(ol);

   ol->blocked = true;
   ol->next_index = (ol->index + 1) % ol->size;
}
Пример #3
0
/**
 * input_overlay_next:
 * @ol                    : Overlay handle.
 *
 * Switch to the next available overlay
 * screen.
 **/
void input_overlay_next(input_overlay_t *ol, float opacity)
{
   if (!ol)
      return;

   ol->index = ol->next_index;
   ol->active = &ol->overlays[ol->index];

   input_overlay_load_active(ol, opacity);

   ol->blocked = true;
   ol->next_index = (ol->index + 1) % ol->size;
}
Пример #4
0
input_overlay_t *input_overlay_new(const char *overlay)
{
   input_overlay_t *ol = (input_overlay_t*)calloc(1, sizeof(*ol));

   if (!ol)
      goto error;

   ol->overlay_path = strdup(overlay);
   if (!ol->overlay_path)
   {
      free(ol);
      return NULL;
   }

   if (!driver.video->overlay_interface)
   {
      RARCH_ERR("Overlay interface is not present in video driver.\n");
      goto error;
   }

   video_overlay_interface_func(&ol->iface);
   ol->iface_data = driver.video_data;

   if (!ol->iface)
      goto error;

   if (!input_overlay_load_overlays(ol, overlay))
      goto error;

   ol->active = &ol->overlays[0];

   input_overlay_load_active(ol);
   ol->iface->enable(ol->iface_data, true);
   ol->enable = true;

   input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
   input_overlay_set_scale_factor(ol, g_settings.input.overlay_scale);
   ol->next_index = (ol->index + 1) % ol->size;

   return ol;

error:
   input_overlay_free(ol);
   return NULL;
}
Пример #5
0
bool input_overlay_load_overlays_resolve_iterate(input_overlay_t *ol)
{
   bool not_done = true;

   if (!ol)
      return false;

   not_done = ol->resolve_pos < ol->size;

   if (!not_done)
   {
      ol->state = OVERLAY_STATUS_DEFERRED_DONE;
      return true;
   }

   if (!input_overlay_resolve_targets(ol->overlays, ol->resolve_pos, ol->size))
   {
      RARCH_ERR("[Overlay]: Failed to resolve next targets.\n");
      goto error;
   }

   if (ol->resolve_pos == 0)
   {
      ol->active = &ol->overlays[0];

      input_overlay_load_active(ol, ol->deferred.opacity);
      input_overlay_enable(ol, ol->deferred.enable);
   }

   ol->resolve_pos += 1;

   return true;
error:
   ol->state = OVERLAY_STATUS_DEFERRED_ERROR;

   return false;
}