コード例 #1
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static void lakka_switch_items(void)
{
   int j;
   menu_category_t *active_category = (menu_category_t*)
      &categories[menu_active_category];

   for (j = 0; j < active_category->num_items; j++)
   {
      float iy;
      float ia = 0.5;
      float iz = i_passive_zoom;
      menu_item_t *active_item = (menu_item_t*)&active_category->items[j];

      if (!active_item)
         continue;

      iy = (j  < active_category->active_item) ? vspacing *
         (j - active_category->active_item + above_item_offset) :
         vspacing * (j - active_category->active_item + under_item_offset);

      if (j == active_category->active_item)
      {
         ia = 1.0;
         iz = i_active_zoom;
         iy = vspacing * active_item_factor;
      }

      add_tween(LAKKA_DELAY, ia, &active_item->alpha, &inOutQuad, NULL);
      add_tween(LAKKA_DELAY, iz, &active_item->zoom,  &inOutQuad, NULL);
      add_tween(LAKKA_DELAY, iy, &active_item->y,     &inOutQuad, NULL);
   }
}
コード例 #2
0
// Move the categories left or right depending on the menu_active_category variable
static void lakka_switch_categories(void)
{
   int i, j;

   // translation
   add_tween(DELAY, -menu_active_category * HSPACING, &all_categories_x, &inOutQuad, NULL);

   // alpha tweening
   for (i = 0; i < num_categories; i++)
   {
      float ca, cz;
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      ca = (i == menu_active_category) ? 1.0 : 0.5;
      cz = (i == menu_active_category) ? C_ACTIVE_ZOOM : C_PASSIVE_ZOOM;
      add_tween(DELAY, ca, &category->alpha, &inOutQuad, NULL);
      add_tween(DELAY, cz, &category->zoom,  &inOutQuad, NULL);

      for (j = 0; j < category->num_items; j++)
      {
         float ia = (i != menu_active_category     ) ? 0   : 
            (j == category->active_item) ? 1.0 : 0.5;

         add_tween(DELAY, ia, &category->items[j].alpha, &inOutQuad, NULL);
      }
   }
}
コード例 #3
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static void lakka_open_submenu(void)
{
   int i, j, k;
    
   add_tween(LAKKA_DELAY, -hspacing * (menu_active_category+1),
         &all_categories_x, &inOutQuad, NULL);
   add_tween(LAKKA_DELAY, 1.0, &arrow_alpha, &inOutQuad, NULL);

   /* Reset contextual menu style */
   lakka_reset_submenu();
   
   for (i = 0; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      if (i != menu_active_category)
         add_tween(LAKKA_DELAY, 0,
               &category->alpha, &inOutQuad, NULL);
      else
      {
         add_tween(LAKKA_DELAY, 1.0,
               &category->alpha, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
         {
            if (j == category->active_item)
            {
               for (k = 0; k < category->items[j].num_subitems; k++)
               {
                  menu_subitem_t *subitem = (menu_subitem_t*)
                     &category->items[j].subitems[k];

                  if (k == category->items[j].active_subitem)
                  {
                     add_tween(LAKKA_DELAY, 1.0,
                           &subitem->alpha, &inOutQuad, NULL);
                     add_tween(LAKKA_DELAY, i_active_zoom,
                           &subitem->zoom, &inOutQuad, NULL);
                  }
                  else
                  {
                     add_tween(LAKKA_DELAY, 0.5,
                           &subitem->alpha, &inOutQuad, NULL);
                     add_tween(LAKKA_DELAY, i_passive_zoom,
                           &subitem->zoom, &inOutQuad, NULL);
                  }
               }
            }
            else
               add_tween(LAKKA_DELAY, 0,
                     &category->items[j].alpha, &inOutQuad, NULL);
         }
      }
   }
}
コード例 #4
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static void lakka_close_submenu(void)
{
   int i, j, k;
    
   add_tween(LAKKA_DELAY, -hspacing * menu_active_category,
         &all_categories_x, &inOutQuad, NULL);
   add_tween(LAKKA_DELAY, 0.0, &arrow_alpha, &inOutQuad, NULL);
   
   for (i = 0; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      if (i == menu_active_category)
      {
         add_tween(LAKKA_DELAY, 1.0, &category->alpha, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, c_active_zoom,
               &category->zoom, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
         {
            if (j == category->active_item)
            {
               add_tween(LAKKA_DELAY, 1.0,
                     &category->items[j].alpha, &inOutQuad, NULL);

               for (k = 0; k < category->items[j].num_subitems; k++)
                  add_tween(LAKKA_DELAY, 0,
                        &category->items[j].subitems[k].alpha,
                        &inOutQuad, NULL);
            }
            else
               add_tween(LAKKA_DELAY, 0.5,
                     &category->items[j].alpha, &inOutQuad, NULL);
         }
      }
      else
      {
         add_tween(LAKKA_DELAY, 0.5,
               &category->alpha, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, c_passive_zoom,
               &category->zoom, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
            add_tween(LAKKA_DELAY, 0,
                  &category->items[j].alpha, &inOutQuad, NULL);
      }
   }
}
コード例 #5
0
ファイル: lakka.c プロジェクト: mprobinson/RetroArch
static int lakka_input_postprocess(retro_input_t state,
      retro_input_t old_state)
{
   lakka_handle_t *lakka = NULL;
   if (!driver.menu)
      return 0;

   lakka = (lakka_handle_t*)driver.menu->userdata;

   if (!lakka)
      return 0;

   if (lakka->global_alpha == 0.0f)
      add_tween(LAKKA_DELAY, 1.0f, &lakka->global_alpha, &inOutQuad, NULL);

   if (lakka->global_scale == 2.0f)
      add_tween(LAKKA_DELAY, 1.0f, &lakka->global_scale, &inQuad, NULL);

   return 0;
}
コード例 #6
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static void lakka_switch_subitems(void)
{
   int k;
   menu_category_t *active_category = (menu_category_t*)
      &categories[menu_active_category];
   menu_item_t *item = (menu_item_t*)
      &active_category->items[active_category->active_item];

   for (k = 0; k < item->num_subitems; k++)
   {
      menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];

      if (!subitem)
         continue;

      if (k < item->active_subitem)
      {
         /* Above items */
         add_tween(LAKKA_DELAY, 0.5,
               &subitem->alpha, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, vspacing*(k - item->active_subitem + 
                  above_subitem_offset), &subitem->y, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, i_passive_zoom,
               &subitem->zoom, &inOutQuad, NULL);
      }
      else if (k == item->active_subitem)
      {
         /* Active item */
         add_tween(LAKKA_DELAY, 1.0, &subitem->alpha, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, vspacing*active_item_factor,
               &subitem->y, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, i_active_zoom,
               &subitem->zoom, &inOutQuad, NULL);
      }
      else if (k > item->active_subitem)
      {
         /* Under items */
         add_tween(LAKKA_DELAY, 0.5, &subitem->alpha, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, vspacing*(k - item->active_subitem + 
                  under_item_offset), &subitem->y, &inOutQuad, NULL);
         add_tween(LAKKA_DELAY, i_passive_zoom,
               &subitem->zoom, &inOutQuad, NULL);
      }
   }
}
コード例 #7
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static void lakka_switch_categories(void)
{
   int i, j;

   /* Translation */
   add_tween(LAKKA_DELAY,
         -menu_active_category * hspacing,
         &all_categories_x, &inOutQuad, NULL);

   /* Alpha tweening */
   for (i = 0; i < num_categories; i++)
   {
      float ca, cz;
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      ca = (i == menu_active_category) ? 1.0 : 0.5;
      cz = (i == menu_active_category) ? c_active_zoom : c_passive_zoom;
      add_tween(LAKKA_DELAY, ca, &category->alpha, &inOutQuad, NULL);
      add_tween(LAKKA_DELAY, cz, &category->zoom,  &inOutQuad, NULL);

      for (j = 0; j < category->num_items; j++)
      {
         float ia = 0;

         if (i == menu_active_category)
         {
            ia = 0.5;
            if (j == category->active_item)
               ia = 1.0;
         }

         add_tween(LAKKA_DELAY, ia,
               &category->items[j].alpha,&inOutQuad, NULL);
      }
   }
}
コード例 #8
0
ファイル: xmb.c プロジェクト: mprobinson/RetroArch
static void xmb_selection_pointer_changed(void)
{
   int i, current, end;
   xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;

   if (!xmb)
      return;

   current = driver.menu->selection_ptr;
   end = file_list_get_size(driver.menu->selection_buf);

   for (i = 0; i < end; i++)
   {
      float iy;
      float ia = 0.5;
      float iz = 0.5;
      xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
            driver.menu->selection_buf, i);

      if (!node)
         continue;

      iy = (i < current) ? xmb->vspacing *
         (i - current + xmb->above_item_offset) :
         xmb->vspacing * (i - current + xmb->under_item_offset);

      if (i == current)
      {
         ia = 1.0;
         iz = 1.0;
         iy = xmb->vspacing * xmb->active_item_factor;
      }

      add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
      add_tween(XMB_DELAY, iz, &node->zoom,  &inOutQuad, NULL);
      add_tween(XMB_DELAY, iy, &node->y,     &inOutQuad, NULL);
   }
}
コード例 #9
0
static void lakka_open_submenu(void)
{
   int i, j, k;
   add_tween(DELAY, -HSPACING * (menu_active_category+1), &all_categories_x, &inOutQuad, NULL);

   // Reset contextual menu style
   lakka_reset_submenu();
   
   for (i = 0; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      if (i != menu_active_category)
         add_tween(DELAY, 0, &category->alpha, &inOutQuad, NULL);
      else
      {
         add_tween(DELAY, 1.0, &category->alpha, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
         {
            if (j == category->active_item)
            {
               for (k = 0; k < category->items[j].num_subitems; k++)
               {
                  menu_subitem_t *subitem = (menu_subitem_t*)&category->items[j].subitems[k];

                  if (k == category->items[j].active_subitem)
                  {
                     add_tween(DELAY, 1.0, &subitem->alpha, &inOutQuad, NULL);
                     add_tween(DELAY, I_ACTIVE_ZOOM, &subitem->zoom, &inOutQuad, NULL);
                  }
                  else
                  {
                     add_tween(DELAY, 0.5, &subitem->alpha, &inOutQuad, NULL);
                     add_tween(DELAY, I_PASSIVE_ZOOM, &subitem->zoom, &inOutQuad, NULL);
                  }
               }
            }
            else
               add_tween(DELAY, 0, &category->items[j].alpha, &inOutQuad, NULL);
         }
      }
   }
}
コード例 #10
0
static void lakka_switch_items(void)
{
   int j;
   menu_category_t *active_category = (menu_category_t*)&categories[menu_active_category];

   for (j = 0; j < active_category->num_items; j++)
   {
      float ia, iz, iy;
      menu_item_t *active_item = (menu_item_t*)&active_category->items[j];

      if (!active_item)
         continue;

      ia = (j == active_category->active_item) ? 1.0 : 0.5;
      iz = (j == active_category->active_item) ? I_ACTIVE_ZOOM : I_PASSIVE_ZOOM;
      iy = (j == active_category->active_item) ? VSPACING*2.4 :
         (j  < active_category->active_item) ? VSPACING*(j - active_category->active_item - 1) :
         VSPACING*(j - active_category->active_item + 3);

      add_tween(DELAY, ia, &active_item->alpha, &inOutQuad, NULL);
      add_tween(DELAY, iz, &active_item->zoom,  &inOutQuad, NULL);
      add_tween(DELAY, iy, &active_item->y,     &inOutQuad, NULL);
   }
}
コード例 #11
0
ファイル: lakka.c プロジェクト: Mbcpro/RetroArch
static int lakka_input_postprocess(uint64_t old_state)
{
   if ((driver.menu && driver.menu->trigger_state & (1ULL << RARCH_MENU_TOGGLE)) &&
         g_extern.main_is_init &&
         !g_extern.libretro_dummy)
   {
      global_alpha = 0;
      g_extern.lifecycle_state |= (1ULL << MODE_GAME);
      return -1;
   }

   if (! global_alpha)
      add_tween(DELAY, 1.0, &global_alpha, &inOutQuad, NULL);

   return 0;
}
コード例 #12
0
static void lakka_close_submenu(void)
{
   int i, j, k;
   add_tween(DELAY, -HSPACING * menu_active_category, &all_categories_x, &inOutQuad, NULL);
   
   for (i = 0; i < num_categories; i++)
   {
      menu_category_t *category = (menu_category_t*)&categories[i];

      if (!category)
         continue;

      if (i == menu_active_category)
      {
         add_tween(DELAY, 1.0, &category->alpha, &inOutQuad, NULL);
         add_tween(DELAY, C_ACTIVE_ZOOM, &category->zoom, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
         {
            if (j == category->active_item)
            {
               add_tween(DELAY, 1.0, &category->items[j].alpha, &inOutQuad, NULL);

               for (k = 0; k < category->items[j].num_subitems; k++)
                  add_tween(DELAY, 0, &category->items[j].subitems[k].alpha, &inOutQuad, NULL);
            }
            else
               add_tween(DELAY, 0.5, &category->items[j].alpha, &inOutQuad, NULL);
         }
      }
      else
      {
         add_tween(DELAY, 0.5, &category->alpha, &inOutQuad, NULL);
         add_tween(DELAY, C_PASSIVE_ZOOM, &category->zoom, &inOutQuad, NULL);

         for (j = 0; j < category->num_items; j++)
            add_tween(DELAY, 0, &category->items[j].alpha, &inOutQuad, NULL);
      }
   }
}
コード例 #13
0
static void lakka_switch_subitems(void)
{
   int k;
   menu_category_t *active_category = (menu_category_t*)&categories[menu_active_category];
   menu_item_t *item = (menu_item_t*)&active_category->items[active_category->active_item];

   for (k = 0; k < item->num_subitems; k++)
   {
      menu_subitem_t *subitem = (menu_subitem_t*)&item->subitems[k];

      if (!subitem)
         continue;

      if (k < item->active_subitem)
      {
         // Above items
         add_tween(DELAY, 0.5, &subitem->alpha, &inOutQuad, NULL);
         add_tween(DELAY, VSPACING*(k - item->active_subitem + 2), &subitem->y, &inOutQuad, NULL);
         add_tween(DELAY, I_PASSIVE_ZOOM, &subitem->zoom, &inOutQuad, NULL);
      }
      else if (k == item->active_subitem)
      {
         // Active item
         add_tween(DELAY, 1.0, &subitem->alpha, &inOutQuad, NULL);
         add_tween(DELAY, VSPACING*2.4, &subitem->y, &inOutQuad, NULL);
         add_tween(DELAY, I_ACTIVE_ZOOM, &subitem->zoom, &inOutQuad, NULL);
      }
      else if (k > item->active_subitem)
      {
         // Under items
         add_tween(DELAY, 0.5, &subitem->alpha, &inOutQuad, NULL);
         add_tween(DELAY, VSPACING*(k - item->active_subitem + 3), &subitem->y, &inOutQuad, NULL);
         add_tween(DELAY, I_PASSIVE_ZOOM, &subitem->zoom, &inOutQuad, NULL);
      }
   }
}
コード例 #14
0
ファイル: menu_lakka_backend.c プロジェクト: QWEmct/RetroArch
static int menu_lakka_iterate(unsigned action)
{
   menu_category_t *active_category = NULL;
   menu_item_t *active_item         = NULL;
   menu_subitem_t * active_subitem  = NULL;

   if (!driver.menu)
   {
      RARCH_ERR("Cannot iterate menu, menu handle is not initialized.\n");
      return 0;
   }

   if (action == MENU_ACTION_TOGGLE &&
         g_extern.main_is_init && !g_extern.libretro_dummy)
   {
      rarch_main_command(RARCH_CMD_RESUME);
      return -1;
   }

   active_category = (menu_category_t*)&categories[menu_active_category];

   if (active_category)
      active_item = (menu_item_t*)
         &active_category->items[active_category->active_item];

   if (active_item)
      active_subitem = (menu_subitem_t*)
         &active_item->subitems[active_item->active_subitem];

   if (!active_category || !active_item)
      return 0;

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
      driver.menu_ctx->set_texture(driver.menu);

   if (action && depth == 1 && menu_active_category == 0 
      && active_subitem->setting)
   {
      rarch_setting_t *setting = (rarch_setting_t*)
         active_subitem->setting;

      switch (action)
      {
         case MENU_ACTION_OK:
            if (setting->cmd_trigger.idx != RARCH_CMD_NONE)
               setting->cmd_trigger.triggered = true;
            /* fall-through */
         case MENU_ACTION_LEFT:
         case MENU_ACTION_RIGHT:
         case MENU_ACTION_START:
            if (setting->type == ST_BOOL)
               menu_action_setting_boolean(setting, action);
            else if (setting->type == ST_UINT)
               menu_action_setting_unsigned_integer(setting, 0, action);
            else if (setting->type == ST_FLOAT)
               menu_action_setting_fraction(setting, action);
            else if (setting->type == ST_STRING)
               menu_action_setting_driver(setting, action);
            break;
         default:
            break;
      }
   }

   switch (action)
   {
      case MENU_ACTION_LEFT:
         if (depth == 0 && menu_active_category > 0)
         {
            menu_active_category--;
            lakka_switch_categories();
         }
         else if (depth == 1 && menu_active_category > 0 
            && (active_item->active_subitem == 1 
            || active_item->active_subitem == 2)
            && g_settings.state_slot > -1)
         {
            g_settings.state_slot--;
         }
         break;

      case MENU_ACTION_RIGHT:
         if (depth == 0 && menu_active_category < num_categories-1)
         {
            menu_active_category++;
            lakka_switch_categories();
         }
         else if (depth == 1 && menu_active_category > 0 
            && (active_item->active_subitem == 1
            || active_item->active_subitem == 2)
            && g_settings.state_slot < 255)
         {
            g_settings.state_slot++;
         }
         break;

      case MENU_ACTION_DOWN:
         if (depth == 0 
               && (active_category->active_item < 
                  (active_category->num_items - 1)))
         {
            active_category->active_item++;
            lakka_switch_items();
         }

         /* If we are on subitems level, and we do not
          * exceed the number of subitems, and we
          * are in settings or content is launched. */
         if (depth == 1
               && (active_item->active_subitem < 
                  (active_item->num_subitems -1))
               && (menu_active_category == 0 
                  || ((active_item->active_subitem < 
                        (active_item->num_subitems - 1))
                     &&
                     (g_extern.main_is_init && !g_extern.libretro_dummy)
                     && (!strcmp(g_extern.fullpath, active_item->rom)))))
         {
            active_item->active_subitem++;
            lakka_switch_subitems();
         }
         break;

      case MENU_ACTION_UP:
         if (depth == 0 && active_category->active_item > 0)
         {
            active_category->active_item--;
            lakka_switch_items();
         }
         if (depth == 1 && active_item->active_subitem > 0)
         {
            active_item->active_subitem--;
            lakka_switch_subitems();
         }
         break;

      case MENU_ACTION_OK:
         if (depth == 1 && menu_active_category > 0)
         {
            switch (active_item->active_subitem)
            {
               case 0:
                  global_alpha = 0.0;
                  if (g_extern.main_is_init && !g_extern.libretro_dummy
                        && (!strcmp(g_extern.fullpath, active_item->rom)))
                  {
                     rarch_main_command(RARCH_CMD_RESUME);
                  }
                  else
                  {
                     strlcpy(g_extern.fullpath,
                           active_item->rom, sizeof(g_extern.fullpath));
                     strlcpy(g_settings.libretro,
                           active_category->libretro,
                           sizeof(g_settings.libretro));

#ifdef HAVE_DYNAMIC
                     rarch_main_command(RARCH_CMD_LOAD_CORE);
                     rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
#endif
                  }
                  return -1;
                  break;
               case 1:
                  global_alpha = 0.0;
                  rarch_main_command(RARCH_CMD_SAVE_STATE);
                  return -1;
                  break;
               case 2:
                  global_alpha = 0.0;
                  rarch_main_command(RARCH_CMD_LOAD_STATE);
                  return -1;
                  break;
               case 3:
                  rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);
                  break;
               case 4:
                  global_alpha = 0.0;
                  rarch_main_command(RARCH_CMD_RESET);
                  return -1;
                  break;
            }
         }
         else if (depth == 0 && active_item->num_subitems)
         {
            lakka_open_submenu();
            depth = 1;
         }
         else if (depth == 0 && 
               (menu_active_category == 0 &&
                (active_category->active_item == 
                 (active_category->num_items - 1))))
         {
            add_tween(LAKKA_DELAY, 1.0, &global_alpha, &inOutQuad, NULL);
            rarch_main_command(RARCH_CMD_QUIT_RETROARCH);
            return -1;
         }
         break;

      case MENU_ACTION_CANCEL:
         if (depth == 1)
         {
            lakka_close_submenu();
            depth = 0;
         }
         break;
      default:
         break;
   }

   if (driver.menu_ctx && driver.menu_ctx->iterate)
      driver.menu_ctx->iterate(driver.menu, action);

   if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render)
      driver.menu_ctx->render();

   return 0;
}