Esempio n. 1
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;
}
Esempio n. 2
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;

   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];
   ol->iface->load(ol->iface_data, ol->active->image, ol->active->width, ol->active->height);
   ol->iface->vertex_geom(ol->iface_data,
         ol->active->mod_x, ol->active->mod_y, ol->active->mod_w, ol->active->mod_h);
   ol->iface->full_screen(ol->iface_data, ol->active->full_screen);

   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, 1.0f);
   ol->next_index = (ol->index + 1) % ol->size;

   return ol;

error:
   input_overlay_free(ol);
   return NULL;
}