Exemplo n.º 1
0
static bool zarch_zui_list_item(zui_t *zui, zui_tabbed_t *tab, int x1, int y1,
      const char *label, unsigned item_id, const char *entry)
{
   char title_buf[PATH_MAX_LENGTH];
   unsigned ticker_size;
   bool set_active_id    = false;
   unsigned           id = zarch_zui_hash(zui, label);
   int                x2 = x1 + zui->width - 290 - 40;
   int                y2 = y1 + 50;
   bool           active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
   const float       *bg = ZUI_BG_PANEL;
   uint64_t *frame_count = video_driver_get_frame_count();

   if (tab->active_id != tab->prev_id)
   {
      set_active_id = true;
      tab->prev_id         = tab->active_id;
   }

   if (zui->pending_selection == -1)
   {
      if (item_id < zui->active_id)
         zui->prev_id = item_id;
      if (item_id > zui->active_id && !zui->next_selection_set)
      {
         zui->next_id            = item_id;
         zui->next_selection_set = true;
      }
   }
   else
   {
      if (zui->active_id != item_id && zui->pending_selection == item_id)
         set_active_id = true;
   }

   if (set_active_id)
      zui->active_id         = item_id;

   if (zui->item.active == id || zui->item.hot == id)
      bg = ZUI_BG_HILITE;
   else if (zui->active_id == item_id)
      bg = ZUI_BG_PAD_HILITE;

   ticker_size = x2 / 14;

   menu_animation_ticker_str(title_buf,
         ticker_size,
         *frame_count / 50,
         label,
         (bg == ZUI_BG_HILITE || bg == ZUI_BG_PAD_HILITE));

   zarch_zui_push_quad(zui->width, zui->height, bg, &zui->ca, x1, y1, x2, y2);
   zarch_zui_draw_text(zui, ZUI_FG_NORMAL, 12, y1 + 35, title_buf);

   if (entry)
      zarch_zui_draw_text(zui, ZUI_FG_NORMAL, x2 - 200, y1 + 35, entry);

   return active;
}
Exemplo n.º 2
0
static bool zarch_zui_tab(zui_t *zui, struct zui_tabbed *tab,
      const char *label, unsigned tab_id)
{
   bool active;
   int x1, y1, x2, y2;
   unsigned       id = zarch_zui_hash(zui, label);
   int         width = tab->tab_width;
   const float   *bg = zui_bg_panel;
   bool selected     = tab->tab_selection == tab_id; /* TODO/FIXME */

   if (!zui || !tab )
      return false;

   if (!width)
   {
      if (!zui->fb_buf)
         return false;
      width          = zarch_zui_strwidth(zui->fb_buf, label, 1.0) + 24;
   }

   x1                = tab->x;
   y1                = tab->y;
   x2                = x1 + width;
   y2                = y1 + 60;
   active            = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);

   tab->prev_id      = tab->active_id;

   if (zui->item.active == id || tab->active_id == ~0U || !tab->inited)
      tab->active_id    = id;
   else if (id > tab->active_id)
   {
      tab->next_id            = id;
   }

   if (!tab->inited)
      tab->inited = true;

   if (tab->active_id == id || zui->item.active == id || zui->item.hot == id)
      bg             = zui_bg_hilite;
   else if (selected)
      bg             = zui_bg_pad_hilite;

   zarch_zui_push_quad(zui->width, zui->height,  bg, &zui->ca, x1+0, y1+0, x2, y2);
   zarch_zui_draw_text(zui, ZUI_FG_NORMAL, x1+12, y1 + 41, label);

   if (tab->vertical)
      tab->y        += y2 - y1;
   else
      tab->x         = x2;

   return active || (tab->active_id == id);
}
Exemplo n.º 3
0
static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int y1,
      const char *label, unsigned item_id, const char *entry, bool selected)
{
   menu_animation_ctx_ticker_t ticker;
   char title_buf[PATH_MAX_LENGTH];
   unsigned ticker_size;
   uint64_t *frame_count = NULL;
   unsigned           id = zarch_zui_hash(zui, label);
   int                x2 = x1 + zui->width - 290 - 40;
   int                y2 = y1 + 50;
   bool           active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
   const float       *bg = zui_bg_panel;

   video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);

   if (tab->active_id != tab->prev_id)
   {
      tab->prev_id         = tab->active_id;
   }

   if (selected)
   {
      zui->next_id            = item_id;
      zui->next_selection_set = true;
   }

   /* Set background color */
   if (zui->item.active == id || zui->item.hot == id)
      bg = zui_bg_hilite;
   else if (selected)
      bg = zui_bg_pad_hilite;

   ticker_size = x2 / 14;

   ticker.s        = title_buf;
   ticker.len      = ticker_size;
   ticker.idx      = *frame_count / 50;
   ticker.str      = label;
   ticker.selected = (bg == zui_bg_hilite || bg == zui_bg_pad_hilite);

   menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);

   zarch_zui_push_quad(zui->width, zui->height, bg, &zui->ca, x1, y1, x2, y2);
   zarch_zui_draw_text(zui, ZUI_FG_NORMAL, 12, y1 + 35, title_buf);

   if (entry)
      zarch_zui_draw_text(zui, ZUI_FG_NORMAL, x2 - 200, y1 + 35, entry);

   return active;
}
Exemplo n.º 4
0
static bool zarch_zui_button_full(zui_t *zui, int x1, int y1, int x2, int y2, const char *label)
{
   unsigned       id = zarch_zui_hash(zui, label);
   bool       active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
   const float *bg = ZUI_BG_PANEL;

   if (zui->item.active == id || zui->item.hot == id)
      bg = ZUI_BG_HILITE;

   zarch_zui_push_quad(zui->width, zui->height,  bg, &zui->ca,  x1, y1, x2, y2);
   zarch_zui_draw_text(zui, ZUI_FG_NORMAL, x1+12, y1 + 41, label);

   return active;
}
Exemplo n.º 5
0
static bool zarch_zui_button_full(zui_t *zui,
      int x1, int y1, int x2, int y2, const char *label)
{
   unsigned       id = zarch_zui_hash(zui, label);
   bool       active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
   const float *bg   = zui_bg_panel;

   if (zui->item.active == id || zui->item.hot == id)
      bg = zui_bg_hilite;

   menu_display_push_quad(zui->width, zui->height,  bg, x1, y1, x2, y2);
   zarch_zui_draw_text(zui, ZUI_FG_NORMAL, x1+12, y1 + 41, label);

   return active;
}