예제 #1
0
static void mui_frame(void *data)
{
   unsigned header_height;
   bool display_kb;
   float black_bg[16] = {
      0, 0, 0, 0.75,
      0, 0, 0, 0.75,
      0, 0, 0, 0.75,
      0, 0, 0, 0.75,
   };
   float blue_bg[16] = {
      0.13, 0.59, 0.95, 1,
      0.13, 0.59, 0.95, 1,
      0.13, 0.59, 0.95, 1,
      0.13, 0.59, 0.95, 1,
   };
   float lightblue_bg[16] = {
      0.89, 0.95, 0.99, 1.00,
      0.89, 0.95, 0.99, 1.00,
      0.89, 0.95, 0.99, 1.00,
      0.89, 0.95, 0.99, 1.00,
   };
   float pure_white[16]=  {
      1, 1, 1, 1,
      1, 1, 1, 1,
      1, 1, 1, 1,
      1, 1, 1, 1,
   };
   float white_bg[16]=  {
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
   };
   float white_transp_bg[16]=  {
      0.98, 0.98, 0.98, 0.90,
      0.98, 0.98, 0.98, 0.90,
      0.98, 0.98, 0.98, 0.90,
      0.98, 0.98, 0.98, 0.90,
   };
   float grey_bg[16]=  {
      0.78, 0.78, 0.78, 1,
      0.78, 0.78, 0.78, 1,
      0.78, 0.78, 0.78, 1,
      0.78, 0.78, 0.78, 1,
   };
   float shadow_bg[16]=  {
      0, 0, 0, 0,
      0, 0, 0, 0,
      0, 0, 0, 0.2,
      0, 0, 0, 0.2,
   };
   unsigned width, height, ticker_limit, i;
   char msg[256];
   char title[256];
   char title_buf[256];
   char title_msg[256];
   size_t selection;
   size_t title_margin;
   uint64_t *frame_count;
   mui_handle_t *mui               = (mui_handle_t*)data;
   settings_t *settings            = config_get_ptr();
   const uint32_t normal_color     = 0x212121ff;
   const uint32_t hover_color      = 0x212121ff;
   const uint32_t title_color      = 0xffffffff;
   const uint32_t activetab_color  = 0x0096f2ff;
   const uint32_t passivetab_color = 0x9e9e9eff;
   bool background_rendered        = false;
   bool libretro_running           = menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);

   video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
   (void)passivetab_color;
   (void)activetab_color;

   if (!mui)
      return;

   msg[0]       = '\0';
   title[0]     = '\0';
   title_buf[0] = '\0';
   title_msg[0] = '\0';

   video_driver_get_size(&width, &height);

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
   menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);

   if (libretro_running)
   {
      menu_display_draw_bg(
            width, height,
            mui->textures.white, 0.75f, false,
            &white_transp_bg[0],   &white_bg[0],
            NULL, NULL, 4,
            MENU_DISPLAY_PRIM_TRIANGLESTRIP);
   }
   else
   {
      menu_display_clear_color(1.0f, 1.0f, 1.0f, 0.75f);

      if (mui->textures.bg.id)
      {
         background_rendered = true;

         /* Set new opacity for transposed white background */
         bgcolor_setalpha(white_transp_bg, 0.30);

         menu_display_draw_bg(
               width, height,
               mui->textures.bg.id, 0.75f, true,
               &white_transp_bg[0],   &white_bg[0],
               NULL, NULL, 4,
               MENU_DISPLAY_PRIM_TRIANGLESTRIP);

         /* Restore opacity of transposed white background */
         bgcolor_setalpha(white_transp_bg, 0.90);
      }
   }

   menu_entries_get_title(title, sizeof(title));

   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;

   if (background_rendered || libretro_running)
      bgcolor_setalpha(lightblue_bg, 0.75);
   else
      bgcolor_setalpha(lightblue_bg, 1.0);

   /* highlighted entry */
   mui_render_quad(mui, 0,
         header_height -   mui->scroll_y + mui->line_height *
         selection, width, mui->line_height,
         width, height,
         &lightblue_bg[0]);

   menu_display_font_bind_block(&mui->list_block);

   mui_render_menu_list(mui, width, height, normal_color, hover_color, &pure_white[0]);

   menu_display_ctl(MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, NULL);
   menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);

   /* header */
   mui_render_quad(mui, 0, 0, width, header_height, width, height, &blue_bg[0]);

   mui->tabs_height = 0;

   /* display tabs if depth equal one, if not hide them */
   if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
   {
      mui_draw_tab_begin(mui, width, height, &white_bg[0], &grey_bg[0]);

      for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
         mui_draw_tab(mui, i, width, height, &pure_white[0]);

      mui_draw_tab_end(mui, width, height, header_height, &blue_bg[0]);
   }

   mui_render_quad(mui, 0, header_height, width,
         mui->shadow_height,
         width, height,
         &shadow_bg[0]);

   title_margin = mui->margin;

   if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
   {
      title_margin = mui->icon_size;
      mui_draw_icon(mui, mui->textures.list[MUI_TEXTURE_BACK].id,
         0, 0, width, height, 0, 1, &pure_white[0]);
   }

   ticker_limit = (width - mui->margin*2) / mui->glyph_width;
   menu_animation_ticker_str(title_buf, ticker_limit,
         *frame_count / 100, title, true);

   /* Title */
   if (mui_get_core_title(title_msg, sizeof(title_msg)) == 0)
   {
      char title_buf_msg_tmp[256];
      char title_buf_msg[256];
      size_t usable_width = width - (mui->margin * 2);
      int ticker_limit, value_len;
      
      snprintf(title_buf_msg, sizeof(title_buf), "%s (%s)", title_buf, title_msg);
      value_len = strlen(title_buf);
      ticker_limit = (usable_width / mui->glyph_width) - (value_len + 2);

      menu_animation_ticker_str(title_buf_msg_tmp, ticker_limit, *frame_count / 20, title_buf_msg, true);

      strlcpy(title_buf, title_buf_msg_tmp, sizeof(title_buf));
   }

   mui_blit_line(title_margin, header_height / 2, width, height,
         title_buf, title_color, TEXT_ALIGN_LEFT);

   mui_draw_scrollbar(mui, width, height, &grey_bg[0]);

   menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);

   if (display_kb)
   {
      const char *str = NULL, *label = NULL;
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL,    &label);

      if (!str)
         str = "";
      mui_render_quad(mui, 0, 0, width, height, width, height, &black_bg[0]);
      snprintf(msg, sizeof(msg), "%s\n%s", label, str);
      mui_render_messagebox(msg);
   }

   if (!string_is_empty(mui->box_message))
   {
      mui_render_quad(mui, 0, 0, width, height, width, height, &black_bg[0]);
      mui_render_messagebox(mui->box_message);
      mui->box_message[0] = '\0';
   }

   if (settings->menu.mouse.enable && (settings->video.fullscreen || !video_driver_ctl(RARCH_DISPLAY_CTL_HAS_WINDOWED, NULL)))
   {
      int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
      int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);

      mui_draw_cursor(mui, &white_bg[0], mouse_x, mouse_y, width, height);
   }

   menu_display_restore_clear_color();
   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
예제 #2
0
static void glui_frame(void)
{
   unsigned width, height;
   char title[PATH_MAX_LENGTH];
   char title_buf[PATH_MAX_LENGTH];
   char title_msg[PATH_MAX_LENGTH];
   char timedate[PATH_MAX_LENGTH];
   gl_t *gl                                = NULL;
   glui_handle_t *glui                     = NULL;
   const struct font_renderer *font_driver = NULL;
   driver_t *driver                        = driver_get_ptr();
   menu_handle_t *menu                     = menu_driver_get_ptr();
   menu_animation_t *anim                  = menu_animation_get_ptr();
   menu_navigation_t *nav                  = menu_navigation_get_ptr();
   menu_display_t *disp                    = menu_display_get_ptr();
   settings_t *settings                    = config_get_ptr();
   menu_input_t *menu_input                = menu_input_get_ptr();
   uint64_t frame_count                    = video_driver_get_frame_count();
   const uint32_t normal_color             = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_normal_color);
   const uint32_t hover_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_hover_color);
   const uint32_t title_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.title_color);

   if (!menu || !menu->userdata)
      return;

   gl = (gl_t*)video_driver_get_ptr(NULL);

   if (!gl)
      return;

   glui = (glui_handle_t*)menu->userdata;

   if (
         menu_entries_needs_refresh()
         && menu_driver_alive() 
         && !disp->msg_force
         && !glui->box_message[0]
      )
      return;

   title[0]     = '\0';
   title_buf[0] = '\0';
   title_msg[0] = '\0';
   timedate[0]  = '\0';

   video_driver_get_size(&width, &height);

   menu_display_set_viewport();

   gl_menu_frame_background(menu, settings,
         gl, glui->textures.bg.id, 0.75f, 0.75f, false);

   menu_entries_get_title(title, sizeof(title));

   font_driver = driver->font_osd_driver;

   menu_display_font_bind_block(menu, font_driver, &glui->list_block);

   glui_render_menu_list(glui, menu, normal_color, hover_color);

   menu_display_font_flush_block(menu, font_driver);

   glui_render_quad(gl, 0,
         disp->header_height - menu->scroll_y + glui->line_height *
         nav->selection_ptr, width, glui->line_height, 1, 1, 1, 0.1);

   anim->is_active           = true;
   anim->label.is_updated    = false;

   glui_render_quad(gl, 0, 0, width,
         disp->header_height, 0.2, 0.2, 0.2, 1);

   menu_animation_ticker_line(title_buf, glui->ticker_limit,
         frame_count / 100, title, true);
   glui_blit_line(width / 2, 0, title_buf,
         title_color, TEXT_ALIGN_CENTER);

   if (menu_entries_show_back())
      glui_blit_line(glui->margin, 0, menu_hash_to_str(MENU_VALUE_BACK),
            title_color, TEXT_ALIGN_LEFT);

   glui_render_quad(gl,
         0,
         height - disp->header_height,
         width,
         disp->header_height,
         0.2, 0.2, 0.2, 1);

   glui_draw_scrollbar(gl);

   if (settings->menu.core_enable)
   {
      menu_entries_get_core_title(title_msg, sizeof(title_msg));

      glui_blit_line(glui->margin,
            height - glui->line_height, title_msg,
            title_color, TEXT_ALIGN_LEFT);
   }

   if (settings->menu.timedate_enable)
   {
      menu_display_timedate(timedate, sizeof(timedate), 0);
      glui_blit_line(width - glui->margin,
            height - glui->line_height, timedate, hover_color,
            TEXT_ALIGN_RIGHT);
   }

   if (menu_input->keyboard.display)
   {
      char msg[PATH_MAX_LENGTH];
      const char           *str = *menu_input->keyboard.buffer;
      msg[0] = '\0';

      if (!str)
         str = "";
      glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);
      snprintf(msg, sizeof(msg), "%s\n%s", menu_input->keyboard.label, str);
      glui_render_messagebox(msg);
   }

   if (glui->box_message[0] != '\0')
   {
      glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);
      glui_render_messagebox(glui->box_message);
      glui->box_message[0] = '\0';
   }

   if (settings->menu.mouse.enable)
      glui_draw_cursor(gl, menu_input->mouse.x, menu_input->mouse.y);

   gl->shader->use(gl, GL_SHADER_STOCK_BLEND);

   menu_display_unset_viewport();
}
예제 #3
0
파일: rmenu.c 프로젝트: ssangkong/RetroArch
static void rmenu_render(void)
{
   bool msg_force;
   size_t begin, end, i, j, selection;
   struct font_params font_parms = {0};
   char title[256]               = {0};
   char title_buf[256]           = {0};
   char title_msg[64]            = {0};
   menu_handle_t *menu           = menu_driver_get_ptr();
   file_list_t *selection_buf    = menu_entries_get_selection_buf_ptr();
   uint64_t *frame_count         = video_driver_get_frame_count();
   size_t  entries_end           = menu_entries_get_end();

   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;

   if (!menu)
      return;

   if (!render_normal)
   {
      render_normal = true;
      return;
   }

   menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);

   if (menu_entries_needs_refresh() && menu_driver_alive() 
         && !msg_force)
      return;

   menu_display_fb_unset_dirty();
   menu_animation_clear_active();

   if (!selection_buf)
      return;

   begin = (selection >= (ENTRIES_HEIGHT / 2)) ? 
      (selection - (ENTRIES_HEIGHT / 2)) : 0;
   end   = ((selection + ENTRIES_HEIGHT) <= entries_end)
      ? selection + ENTRIES_HEIGHT : entries_end;

   if (entries_end <= ENTRIES_HEIGHT)
      begin = 0;

   if (end - begin > ENTRIES_HEIGHT)
      end = begin + ENTRIES_HEIGHT;
   
   menu_entries_get_title(title, sizeof(title));

   menu_animation_ticker_str(title_buf, RMENU_TERM_WIDTH,
         *frame_count / 15, title, true);

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
      - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   video_driver_set_osd_msg(title_buf, &font_parms, NULL);

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MAX - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   menu_entries_get_core_title(title_msg, sizeof(title_msg));

   video_driver_set_osd_msg(title_msg, &font_parms, NULL);

   j = 0;

   for (i = begin; i < end; i++, j++)
   {
      char entry_path[PATH_MAX_LENGTH]      = {0};
      char entry_value[PATH_MAX_LENGTH]     = {0};
      char message[PATH_MAX_LENGTH]         = {0};
      char entry_title_buf[PATH_MAX_LENGTH] = {0};
      char type_str_buf[PATH_MAX_LENGTH]    = {0};
      unsigned entry_spacing                = menu_entry_get_spacing(i);
      bool entry_selected                   = menu_entry_is_currently_selected(i);

      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      menu_animation_ticker_str(entry_title_buf, RMENU_TERM_WIDTH - (entry_spacing + 1 + 2),
            *frame_count / 15, entry_path, entry_selected);
      menu_animation_ticker_str(type_str_buf, entry_spacing,
            *frame_count / 15, entry_value, entry_selected);

      snprintf(message, sizeof(message), "%c %s",
            entry_selected ? '>' : ' ', entry_title_buf);

      font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
      font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
         + (POSITION_OFFSET * j);
      font_parms.scale = FONT_SIZE_NORMAL;
      font_parms.color = WHITE;

      video_driver_set_osd_msg(message, &font_parms, NULL);

      font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET;

      video_driver_set_osd_msg(type_str_buf, &font_parms, NULL);
   }
}
예제 #4
0
파일: glui.c 프로젝트: jwdehart/RetroArch
static void glui_frame(void)
{
   unsigned i;
   GRfloat coord_color[16];
   GRfloat coord_color2[16];
   GRfloat black_bg[16];
   GRfloat bar_bg[16];
   GRfloat highlight_bg[16];
   GRfloat white_bg[16];
   unsigned width, height, ticker_limit;
   char title[PATH_MAX_LENGTH];
   char title_buf[PATH_MAX_LENGTH];
   char title_msg[PATH_MAX_LENGTH];
   char timedate[PATH_MAX_LENGTH];
   gl_t *gl                                = NULL;
   glui_handle_t *glui                     = NULL;
   const struct font_renderer *font_driver = NULL;
   driver_t *driver                        = driver_get_ptr();
   menu_handle_t *menu                     = menu_driver_get_ptr();
   menu_animation_t *anim                  = menu_animation_get_ptr();
   menu_navigation_t *nav                  = menu_navigation_get_ptr();
   menu_display_t *disp                    = menu_display_get_ptr();
   settings_t *settings                    = config_get_ptr();
   menu_input_t *menu_input                = menu_input_get_ptr();
   uint64_t *frame_count                   = video_driver_get_frame_count();
   const uint32_t normal_color             = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_normal_color);
   const uint32_t hover_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_hover_color);
   const uint32_t title_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.title_color);

   if (!menu || !menu->userdata)
      return;

   gl = (gl_t*)video_driver_get_ptr(NULL);

   if (!gl)
      return;

   glui = (glui_handle_t*)menu->userdata;

   title[0]     = '\0';
   title_buf[0] = '\0';
   title_msg[0] = '\0';
   timedate[0]  = '\0';

   video_driver_get_size(&width, &height);

   menu_display_set_viewport();

   for (i = 0; i < 16; i++)
   {
      coord_color[i]  = 0;
      coord_color2[i] = 1.0f;
      black_bg[i]     = 0;
      bar_bg[i]       = 0.2;
      highlight_bg[i] = 1;
      white_bg[i]     = 1;

      if (i == 3 || i == 7 || i == 11 || i == 15)
      {
         black_bg[i]     = 0.75f;
         coord_color[i]  = 0.75f;
         coord_color2[i] = 0.75f;
         bar_bg[i]       = 1.00f;
         highlight_bg[i] = 0.1f;
      }
   }
   menu_video_frame_background(menu, settings,
         gl, glui->textures.bg.id, 0.75f, false,
         &coord_color[0],   &coord_color2[0],
         &glui_vertexes[0], &glui_tex_coords[0]);

   menu_entries_get_title(title, sizeof(title));

   font_driver = driver->font_osd_driver;

   menu_display_font_bind_block(menu, font_driver, &glui->list_block);

   glui_render_menu_list(glui, width, height, menu, normal_color, hover_color);

   menu_display_font_flush_block(menu, font_driver);

   glui_render_quad(gl, 0,
         disp->header_height - menu->scroll_y + glui->line_height *
         menu_navigation_get_selection(nav), width, glui->line_height,
         width, height,
         &highlight_bg[0]);

   menu_animation_set_active(anim);

   glui_render_quad(gl, 0, 0, width,
         disp->header_height,
         width, height,
         &bar_bg[0]);

   ticker_limit = (width - glui->margin*2) / glui->glyph_width -
         strlen(menu_hash_to_str(MENU_VALUE_BACK)) * 2;
   menu_animation_ticker_str(title_buf, ticker_limit,
         *frame_count / 100, title, true);
   glui_blit_line(width / 2, 0, width, height, title_buf,
         title_color, TEXT_ALIGN_CENTER);

   if (menu_entries_show_back())
      glui_blit_line(glui->margin, 0, width, height, menu_hash_to_str(MENU_VALUE_BACK),
            title_color, TEXT_ALIGN_LEFT);

   glui_render_quad(gl,
         0,
         height - disp->header_height,
         width,
         disp->header_height,
         width, height,
         &bar_bg[0]);

   glui_draw_scrollbar(gl, width, height, &white_bg[0]);

   if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
      glui_blit_line(
            glui->margin,
            height - glui->line_height,
            width, height,
            title_msg,
            title_color, TEXT_ALIGN_LEFT);

   if (settings->menu.timedate_enable)
   {
      menu_display_timedate(timedate, sizeof(timedate), 0);
      glui_blit_line(
            width - glui->margin,
            height - glui->line_height,
            width, height,
            timedate, hover_color,
            TEXT_ALIGN_RIGHT);
   }

   if (menu_input->keyboard.display)
   {
      char msg[PATH_MAX_LENGTH];
      const char           *str = *menu_input->keyboard.buffer;
      msg[0] = '\0';

      if (!str)
         str = "";
      glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
      snprintf(msg, sizeof(msg), "%s\n%s", menu_input->keyboard.label, str);
      glui_render_messagebox(msg);
   }

   if (glui->box_message[0] != '\0')
   {
      glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
      glui_render_messagebox(glui->box_message);
      glui->box_message[0] = '\0';
   }

   if (settings->menu.mouse.enable)
      glui_render_quad(gl, menu_input->mouse.x - 5, menu_input->mouse.y - 5, 10, 10, width, height, &white_bg[0]);

   gl->shader->use(gl, GL_SHADER_STOCK_BLEND);

   menu_display_unset_viewport();
}
예제 #5
0
static void xui_render(void *data, bool is_idle)
{
   size_t end, i, selection, fb_pitch;
   unsigned fb_width, fb_height;
   char title[PATH_MAX_LENGTH] = {0};
   const char *dir             = NULL;
   const char *label           = NULL;
   unsigned menu_type          = 0;
   uint64_t frame_count        = xui_frame_count;
   bool              msg_force = menu_display_get_msg_force();

   menu_display_get_fb_size(&fb_width, &fb_height,
         &fb_pitch);

   if (
         menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) 
         && menu_driver_is_alive()
         && !msg_force
      )
      return;

   menu_display_unset_framebuffer_dirty_flag();
   menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);

   xui_render_background();

   if (XuiHandleIsValid(m_menutitle))
   {
      menu_animation_ctx_ticker_t ticker;
      menu_entries_get_title(title, sizeof(title));
      mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
      XuiTextElementSetText(m_menutitle, strw_buffer);

	  ticker.s        = title;
	  ticker.len      = RXUI_TERM_WIDTH(fb_width) - 3;
	  ticker.idx      = (unsigned int)frame_count / 15;
	  ticker.str      = title;
	  ticker.selected = true;

      menu_animation_ticker(&ticker);
   }

   if (XuiHandleIsValid(m_menutitle))
   {
      if (
            menu_entries_get_core_title(title, sizeof(title)) == 0)
      {
         mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
         XuiTextElementSetText(m_menutitlebottom, strw_buffer);
      }
   }

   end = menu_entries_get_size();
   for (i = 0; i < end; i++)
   {
      menu_entry_t entry;
      char *entry_path                     = NULL;
      char entry_value[PATH_MAX_LENGTH]    = {0};
      wchar_t msg_right[PATH_MAX_LENGTH]   = {0};
      wchar_t msg_left[PATH_MAX_LENGTH]    = {0};

      menu_entry_init(&entry);
      menu_entry_get(&entry, 0, i, NULL, true);

      menu_entry_get_value(&entry, entry_value, sizeof(entry_value));
      entry_path = menu_entry_get_path(&entry);

      mbstowcs(msg_left,  entry_path,  sizeof(msg_left)  / sizeof(wchar_t));
      mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
      xui_set_list_text(i, msg_left, msg_right);

      menu_entry_free(&entry);
      if (!string_is_empty(entry_path))
         free(entry_path);
   }

   selection = menu_navigation_get_selection();

   XuiListSetCurSelVisible(m_menulist, selection);

   if (menu_input_dialog_get_display_kb())
   {
      char msg[1024]    = {0};
      const char *str   = menu_input_dialog_get_buffer();
      const char *label = menu_input_dialog_get_label_buffer();

      snprintf(msg, sizeof(msg), "%s\n%s", label, str);
      xui_render_messagebox(NULL, msg);			
   }
}
예제 #6
0
파일: rmenu.c 프로젝트: neil4/RetroArch
static void rmenu_render(void)
{
   size_t begin, end, i, j;
   struct font_params font_parms = {0};
   char title[256]               = {0};
   char title_buf[256]           = {0};
   char title_msg[64]            = {0};
   menu_handle_t *menu           = menu_driver_get_ptr();
   menu_display_t *disp          = menu_display_get_ptr();
   menu_animation_t *anim        = menu_animation_get_ptr();
   menu_list_t *menu_list        = menu_list_get_ptr();
   menu_navigation_t *nav        = menu_navigation_get_ptr();
   global_t    *global           = global_get_ptr();
   uint64_t frame_count          = video_driver_get_frame_count();
   size_t  entries_end           = menu_entries_get_end();

   if (!menu)
      return;

   if (!render_normal)
   {
      render_normal = true;
      return;
   }

   if (menu_entries_needs_refresh() && menu_driver_alive() 
         && !disp->msg_force)
      return;

   menu_display_fb_unset_dirty();
   anim->is_active           = false;
   anim->label.is_updated    = false;

   if (!menu_list->selection_buf)
      return;

   begin = (nav->selection_ptr >= (ENTRIES_HEIGHT / 2)) ? 
      (nav->selection_ptr - (ENTRIES_HEIGHT / 2)) : 0;
   end   = ((nav->selection_ptr + ENTRIES_HEIGHT) <= entries_end)
      ? nav->selection_ptr + ENTRIES_HEIGHT : entries_end;

   if (entries_end <= ENTRIES_HEIGHT)
      begin = 0;

   if (end - begin > ENTRIES_HEIGHT)
      end = begin + ENTRIES_HEIGHT;
   
   rmenu_render_background();

   menu_entries_get_title(title, sizeof(title));

   menu_animation_ticker_line(title_buf, RMENU_TERM_WIDTH,
         frame_count / 15, title, true);

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
      - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   video_driver_set_osd_msg(title_buf, &font_parms, NULL);

   font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
   font_parms.y = POSITION_EDGE_MAX - (POSITION_OFFSET*2);
   font_parms.scale = FONT_SIZE_NORMAL;
   font_parms.color = WHITE;

   menu_entries_get_core_title(title_msg, sizeof(title_msg));

   video_driver_set_osd_msg(title_msg, &font_parms, NULL);

   j = 0;

   for (i = begin; i < end; i++, j++)
   {
      char entry_path[PATH_MAX_LENGTH]      = {0};
      char entry_value[PATH_MAX_LENGTH]     = {0};
      char message[PATH_MAX_LENGTH]         = {0};
      char entry_title_buf[PATH_MAX_LENGTH] = {0};
      char type_str_buf[PATH_MAX_LENGTH]    = {0};
      unsigned entry_spacing                = menu_entry_get_spacing(i);
      bool entry_selected                   = menu_entry_is_currently_selected(i);

      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      menu_animation_ticker_line(entry_title_buf, RMENU_TERM_WIDTH - (entry_spacing + 1 + 2),
            frame_count / 15, entry_path, entry_selected);
      menu_animation_ticker_line(type_str_buf, entry_spacing,
            frame_count / 15, entry_value, entry_selected);

      snprintf(message, sizeof(message), "%c %s",
            entry_selected ? '>' : ' ', entry_title_buf);

      font_parms.x = POSITION_EDGE_MIN + POSITION_OFFSET;
      font_parms.y = POSITION_EDGE_MIN + POSITION_RENDER_OFFSET
         + (POSITION_OFFSET * j);
      font_parms.scale = FONT_SIZE_NORMAL;
      font_parms.color = WHITE;

      video_driver_set_osd_msg(message, &font_parms, NULL);

      font_parms.x = POSITION_EDGE_CENTER + POSITION_OFFSET;

      video_driver_set_osd_msg(type_str_buf, &font_parms, NULL);
   }
}
예제 #7
0
static void rmenu_xui_render(void)
{
	size_t end, i;
	char title[PATH_MAX_LENGTH] = {0};
	const char *dir             = NULL;
   const char *label           = NULL;
	unsigned menu_type          = 0;
   menu_handle_t *menu         = menu_driver_get_ptr();
   menu_animation_t *anim      = menu_animation_get_ptr();
   menu_display_t *disp        = menu_display_get_ptr();
   menu_framebuf_t *frame_buf  = menu_display_fb_get_ptr();
   menu_navigation_t *nav      = menu_navigation_get_ptr();
   uint64_t frame_count        = video_driver_get_frame_count();

   if (!menu)
      return;
   if (
         menu_entries_needs_refresh() && 
         menu_driver_alive() &&
         !disp->msg_force
      )
		return;

   menu_display_fb_unset_dirty();
   anim->is_active = false;
   anim->label.is_updated    = false;

	rmenu_xui_render_background();

	if (XuiHandleIsValid(m_menutitle))
	{
      menu_entries_get_title(title, sizeof(title));
		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitle, strw_buffer);
		menu_animation_ticker_line(title, RXUI_TERM_WIDTH - 3, (unsigned int)frame_count / 15, title, true);
	}

	if (XuiHandleIsValid(m_menutitle))
	{
      menu_entries_get_core_title(title, sizeof(title));

		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitlebottom, strw_buffer);
	}

	end = menu_entries_get_end();
	for (i = 0; i < end; i++)
   {
      char entry_path[PATH_MAX_LENGTH]  = {0};
      char entry_value[PATH_MAX_LENGTH] = {0};
      char msg_right[PATH_MAX_LENGTH]   = {0};
      wchar_t msg_left[PATH_MAX_LENGTH] = {0};

      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      mbstowcs(msg_left,  entry_path,  sizeof(msg_left)  / sizeof(wchar_t));
      mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
      rmenu_xui_set_list_text(i, msg_left, msg_right);
   }
	XuiListSetCurSelVisible(m_menulist, nav->selection_ptr);

	if (menu->keyboard.display)
	{
		char msg[1024]  = {0};
		const char *str = *menu->keyboard.buffer;

		if (!str)
			str = "";
		snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
		rmenu_xui_render_messagebox(msg);			
	}
}
예제 #8
0
파일: glui.c 프로젝트: dalter/RetroArch
static void glui_frame(void)
{
   unsigned i, header_height;
   bool display_kb;
   GRfloat coord_color[16];
   GRfloat coord_color2[16];
   GRfloat black_bg[16];
   GRfloat bar_bg[16];
   GRfloat highlight_bg[16];
   GRfloat white_bg[16];
   unsigned width, height, ticker_limit;
   char msg[PATH_MAX_LENGTH];
   char title[PATH_MAX_LENGTH];
   char title_buf[PATH_MAX_LENGTH];
   char title_msg[PATH_MAX_LENGTH];
   char timedate[PATH_MAX_LENGTH];
   size_t selection;
   gl_t *gl                                = NULL;
   glui_handle_t *glui                     = NULL;
   const struct font_renderer *font_driver = NULL;
   driver_t *driver                        = driver_get_ptr();
   menu_handle_t *menu                     = menu_driver_get_ptr();
   settings_t *settings                    = config_get_ptr();
   uint64_t *frame_count                   = video_driver_get_frame_count();
   const uint32_t normal_color             = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_normal_color);
   const uint32_t hover_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.entry_hover_color);
   const uint32_t title_color              = FONT_COLOR_ARGB_TO_RGBA(
         settings->menu.title_color);

   if (!menu || !menu->userdata)
      return;

   gl = (gl_t*)video_driver_get_ptr(NULL);

   if (!gl)
      return;

   glui = (glui_handle_t*)menu->userdata;

   msg[0]       = '\0';
   title[0]     = '\0';
   title_buf[0] = '\0';
   title_msg[0] = '\0';
   timedate[0]  = '\0';

   video_driver_get_size(&width, &height);

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
   menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);

   for (i = 0; i < 16; i++)
   {
      coord_color[i]  = 0;
      coord_color2[i] = 1.0f;
      black_bg[i]     = 0;
      bar_bg[i]       = 0.2;
      highlight_bg[i] = 1;
      white_bg[i]     = 1;

      if (i == 3 || i == 7 || i == 11 || i == 15)
      {
         black_bg[i]     = 0.75f;
         coord_color[i]  = 0.75f;
         coord_color2[i] = 0.75f;
         bar_bg[i]       = 1.00f;
         highlight_bg[i] = 0.1f;
      }
   }
   menu_video_frame_background(menu, settings,
         gl, width, height,
         glui->textures.bg.id, 0.75f, false,
         &coord_color[0],   &coord_color2[0],
         &glui_vertexes[0], &glui_tex_coords[0]);

   menu_entries_get_title(title, sizeof(title));

   font_driver = driver->font_osd_driver;

   menu_display_font_bind_block(menu, font_driver, &glui->list_block);

   glui_render_menu_list(glui, width, height, menu, normal_color, hover_color);

   menu_display_font_flush_block(menu, font_driver);

   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;

   glui_render_quad(gl, 0,
         header_height - menu->scroll_y + glui->line_height *
         selection, width, glui->line_height,
         width, height,
         &highlight_bg[0]);

   menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);

   glui_render_quad(gl, 0, 0, width,
         header_height,
         width, height,
         &bar_bg[0]);

   ticker_limit = (width - glui->margin*2) / glui->glyph_width -
         strlen(menu_hash_to_str(MENU_VALUE_BACK)) * 2;
   menu_animation_ticker_str(title_buf, ticker_limit,
         *frame_count / 100, title, true);
   glui_blit_line(width / 2, 0, width, height, title_buf,
         title_color, TEXT_ALIGN_CENTER);

   if (menu_entries_show_back())
      glui_blit_line(glui->margin, 0, width, height, menu_hash_to_str(MENU_VALUE_BACK),
            title_color, TEXT_ALIGN_LEFT);

   glui_render_quad(gl,
         0,
         height - header_height,
         width,
         header_height,
         width, height,
         &bar_bg[0]);

   glui_draw_scrollbar(gl, width, height, &white_bg[0]);

   if (menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
      glui_blit_line(
            glui->margin,
            height - glui->line_height,
            width, height,
            title_msg,
            title_color, TEXT_ALIGN_LEFT);

   if (settings->menu.timedate_enable)
   {
      menu_display_timedate(timedate, sizeof(timedate), 0);
      glui_blit_line(
            width - glui->margin,
            height - glui->line_height,
            width, height,
            timedate, hover_color,
            TEXT_ALIGN_RIGHT);
   }

   menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);

   if (display_kb)
   {
      const char *str = NULL, *label = NULL;
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL,    &label);

      if (!str)
         str = "";
      glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
      snprintf(msg, sizeof(msg), "%s\n%s", label, str);
      glui_render_messagebox(msg);
   }

   if (glui->box_message[0] != '\0')
   {
      glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
      glui_render_messagebox(glui->box_message);
      glui->box_message[0] = '\0';
   }

   if (settings->menu.mouse.enable)
   {
      int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
      int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
      glui_render_quad(gl, mouse_x - 5, mouse_y - 5, 10, 10, width, height, &white_bg[0]);
   }

   gl->shader->use(gl, GL_SHADER_STOCK_BLEND);

   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
예제 #9
0
static void xui_render(void *data)
{
   uint64_t *frame_count;
   bool display_kb, msg_force;
   unsigned fb_width;
	size_t end, i, selection;
	char title[PATH_MAX_LENGTH] = {0};
	const char *dir             = NULL;
   const char *label           = NULL;
	unsigned menu_type          = 0;

   video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);

   menu_display_ctl(MENU_DISPLAY_CTL_WIDTH,     &fb_width);
   menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);

   if (
         menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL) 
         && menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)
         && !msg_force
      )
		return;

   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG, NULL);
   menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);

	xui_render_background();

	if (XuiHandleIsValid(m_menutitle))
	{
      menu_entries_get_title(title, sizeof(title));
		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitle, strw_buffer);
		menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3,
            (unsigned int)*frame_count / 15, title, true);
	}

	if (XuiHandleIsValid(m_menutitle))
	{
      if (menu_entries_get_core_title(title, sizeof(title)) == 0)
      {
         mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
         XuiTextElementSetText(m_menutitlebottom, strw_buffer);
      }
	}

	end = menu_entries_get_end();
	for (i = 0; i < end; i++)
   {
      char entry_path[PATH_MAX_LENGTH]     = {0};
      char entry_value[PATH_MAX_LENGTH]    = {0};
      wchar_t msg_right[PATH_MAX_LENGTH]   = {0};
      wchar_t msg_left[PATH_MAX_LENGTH]    = {0};

      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      mbstowcs(msg_left,  entry_path,  sizeof(msg_left)  / sizeof(wchar_t));
      mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
      xui_set_list_text(i, msg_left, msg_right);
   }
   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;
	XuiListSetCurSelVisible(m_menulist, selection);

   menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);

   if (display_kb)
	{
		char msg[1024]  = {0};
      const char *str = NULL, *label = NULL;
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL,    &label);

		if (!str)
			str = "";
      snprintf(msg, sizeof(msg), "%s\n%s", label, str);
		xui_render_messagebox(msg);			
	}
}
예제 #10
0
static void rmenu_xui_render(void)
{
   bool display_kb, msg_force;
   unsigned fb_width;
	size_t end, i, selection;
	char title[PATH_MAX_LENGTH] = {0};
	const char *dir             = NULL;
   const char *label           = NULL;
	unsigned menu_type          = 0;
   menu_handle_t *menu         = menu_driver_get_ptr();
   uint64_t frame_count        = video_driver_get_frame_count();

   menu_display_ctl(MENU_DISPLAY_CTL_WIDTH,     &fb_width);
   menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);

   if (!menu)
      return;
   if (
         menu_entries_needs_refresh() && 
         menu_driver_alive() &&
         !msg_force
      )
		return;

   menu_display_fb_unset_dirty();
   menu_animation_clear_active();

	rmenu_xui_render_background();

	if (XuiHandleIsValid(m_menutitle))
	{
      menu_entries_get_title(title, sizeof(title));
		mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
		XuiTextElementSetText(m_menutitle, strw_buffer);
		menu_animation_ticker_str(title, RXUI_TERM_WIDTH(fb_width) - 3, (unsigned int)frame_count / 15, title, true);
	}

	if (XuiHandleIsValid(m_menutitle))
	{
      if (menu_entries_get_core_title(title, sizeof(title)) == 0)
      {
         mbstowcs(strw_buffer, title, sizeof(strw_buffer) / sizeof(wchar_t));
         XuiTextElementSetText(m_menutitlebottom, strw_buffer);
      }
	}

	end = menu_entries_get_end();
	for (i = 0; i < end; i++)
   {
      char entry_path[PATH_MAX_LENGTH]  = {0};
      char entry_value[PATH_MAX_LENGTH] = {0};
      char msg_right[PATH_MAX_LENGTH]   = {0};
      wchar_t msg_left[PATH_MAX_LENGTH] = {0};

      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      mbstowcs(msg_left,  entry_path,  sizeof(msg_left)  / sizeof(wchar_t));
      mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t));
      rmenu_xui_set_list_text(i, msg_left, msg_right);
   }
   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
      return;
	XuiListSetCurSelVisible(m_menulist, selection);

   menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);

   if (display_kb)
	{
		char msg[1024]  = {0};
      const char *str = NULL, *label = NULL;
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
      menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL,    &label);

		if (!str)
			str = "";
		snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
		rmenu_xui_render_messagebox(msg);			
	}
}