Beispiel #1
0
static void glui_frame(void)
{
   unsigned width, height;
   char title[PATH_MAX_LENGTH]             = {0};
   char title_buf[PATH_MAX_LENGTH]         = {0}; 
   char title_msg[PATH_MAX_LENGTH]         = {0};
   char timedate[PATH_MAX_LENGTH]          = {0};
   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_needs_refresh()
         && menu_driver_alive() 
         && !disp->msg_force
         && !glui->box_message[0]
      )
      return;

   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, "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] = {0};
      const char           *str = *menu_input->keyboard.buffer;

      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();
}
Beispiel #2
0
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();
}
Beispiel #3
0
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);
}
Beispiel #4
0
static void zarch_frame(void)
{
   unsigned i;
   float coord_color[16];
   float coord_color2[16];
   zui_t *zui           = NULL;
   const struct font_renderer *font_driver = NULL;
   driver_t *driver     = driver_get_ptr();
   settings_t *settings = config_get_ptr();
   menu_handle_t *menu  = menu_driver_get_ptr();
   
   if (!menu)
      return;

   (void)driver;
   
   zui      = (zui_t*)menu->userdata;
   zui->menu = menu;

   video_driver_get_size(&zui->width, &zui->height);

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
   menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &zui->fb_buf);

   for (i = 0; i < 16; i++)
   {
      coord_color[i]  = 0;
      coord_color2[i] = 2.0f;

      if (i == 3 || i == 7 || i == 11 || i == 15)
      {
         coord_color[i]  = 0.10f;
         coord_color2[i] = 0.10f;
      }
   }

   zui->rendering = true;
   zui->hash      = 0;
   zui->item.hot  = 0;

   /* why do i need this? */
   zui->mouse.wheel = menu_input_mouse_state(MENU_MOUSE_WHEEL_DOWN) - 
      menu_input_mouse_state(MENU_MOUSE_WHEEL_UP);

   zui->ca.coords.vertices = 0;

   zui->tmp_block.carr.coords.vertices = 0;

   font_driver = driver->font_osd_driver;

   menu_display_font_bind_block(zui->menu, font_driver, &zui->tmp_block);

   zarch_zui_push_quad(zui->width, zui->height, ZUI_BG_SCREEN, &zui->ca, 0, 0, zui->width, zui->height);
   zarch_zui_snow(zui, &zui->ca, zui->width, zui->height);

   switch (layout)
   {
      case LAY_HOME:
         if (zarch_zui_render_sidebar(zui))
            return;
         if (zarch_zui_render_lay_root(zui))
            return;
         break;
      case LAY_SETTINGS:
         zarch_zui_render_lay_settings(zui);
         break;
      case LAY_PICK_CORE:
         if (zarch_zui_render_sidebar(zui))
            return;
         if (zarch_zui_render_pick_core(zui))
            return;
         break;
   }

   if (settings->menu.mouse.enable)
      zarch_zui_draw_cursor(zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_X), zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_Y));
         

   if (!zarch_zui_input_state(zui, MENU_ZARCH_PRESSED))
      zui->item.active = 0;
   else if (zui->item.active == 0)
      zui->item.active = -1;

   menu_display_blend_begin();

   menu_display_draw(
         0,
         0,
         zui->width,
         zui->height,
         (struct gfx_coords*)&zui->ca,
         &zui->mvp, zui->textures.white,
         MENU_DISPLAY_PRIM_TRIANGLES);

   menu_display_blend_end();

   menu_display_draw_bg(
         zui->width, zui->height,
         zui->textures.bg.id, 0.75f, false,
         &coord_color[0],   &coord_color2[0],
         NULL, menu_display_get_tex_coords(), 4,
         MENU_DISPLAY_PRIM_TRIANGLESTRIP);

   menu_display_font_flush_block(zui->menu, driver->font_osd_driver);

   zui->rendering = false;

   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
Beispiel #5
0
static void zarch_frame(void *data)
{
   unsigned i;
   float coord_color[16];
   float coord_color2[16];
   menu_display_ctx_draw_t draw;
   menu_display_ctx_coord_draw_t coord_draw;
   settings_t *settings    = config_get_ptr();
   zui_t *zui              = (zui_t*)data;
   video_coord_array_t *ca = menu_display_get_coords_array();
   
   if (!zui)
      return;

   video_driver_get_size(&zui->width, &zui->height);

   menu_display_set_viewport();
   zui->fb_buf = menu_display_get_font_buffer();

   for (i = 0; i < 16; i++)
   {
      coord_color[i]  = 0;
      coord_color2[i] = 2.0f;

      if (i == 3 || i == 7 || i == 11 || i == 15)
      {
         coord_color[i]  = 0.10f;
         coord_color2[i] = 0.10f;
      }
   }

   zui->rendering = true;
   zui->hash      = 0;
   zui->item.hot  = 0;

   /* why do i need this? */
   zui->mouse.wheel = menu_input_mouse_state(MENU_MOUSE_WHEEL_DOWN) - 
      menu_input_mouse_state(MENU_MOUSE_WHEEL_UP);

   menu_display_coords_array_reset();

   zui->tmp_block.carr.coords.vertices = 0;

   menu_display_font_bind_block(&zui->tmp_block);

   menu_display_push_quad(zui->width, zui->height, zui_bg_screen,
         0, 0, zui->width, zui->height);
   menu_display_snow(zui->width, zui->height);

   switch (zarch_layout)
   {
      case LAY_HOME:
         if (zarch_zui_render_sidebar(zui))
            return;
         if (zarch_zui_render_lay_root(zui))
            return;
         break;
      case LAY_SETTINGS:
         zarch_zui_render_lay_settings(zui);
         break;
      case LAY_PICK_CORE:
         if (zarch_zui_render_sidebar(zui))
            return;
         if (zarch_zui_render_pick_core(zui))
            return;
         break;
   }

   if (settings->menu.mouse.enable)
      zarch_zui_draw_cursor(
            zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_X),
            zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_Y));
         

   if (!zarch_zui_input_state(zui, MENU_ZARCH_PRESSED))
      zui->item.active = 0;
   else if (zui->item.active == 0)
      zui->item.active = -1;

   menu_display_blend_begin();
   
   draw.x           = 0;
   draw.y           = 0;
   draw.width       = zui->width;
   draw.height      = zui->height;
   draw.coords      = (struct video_coords*)ca;
   draw.matrix_data = &zui->mvp;
   draw.texture     = menu_display_white_texture;
   draw.prim_type   = MENU_DISPLAY_PRIM_TRIANGLES;
   draw.pipeline.id = 0;

   menu_display_draw(&draw);
   menu_display_blend_end();

   memset(&draw, 0, sizeof(menu_display_ctx_draw_t));

   coord_draw.ptr       = NULL;

   menu_display_get_tex_coords(&coord_draw);

   draw.width              = zui->width;
   draw.height             = zui->height;
   draw.texture            = zui->textures.bg;
   draw.color              = &coord_color[0];
   draw.vertex             = NULL;
   draw.tex_coord          = coord_draw.ptr;
   draw.vertex_count       = 4;
   draw.prim_type          = MENU_DISPLAY_PRIM_TRIANGLESTRIP;

   if (!menu_display_libretro_running() && draw.texture)
      draw.color             = &coord_color2[0];

   menu_display_blend_begin();
   draw.x              = 0;
   draw.y              = 0;
   menu_display_draw_bg(&draw);
   menu_display_draw(&draw);
   menu_display_blend_end();

   zui->rendering = false;

   menu_display_font_flush_block();
   menu_display_unset_viewport();
}