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(); }
static void glui_frame(void) { unsigned x, y; size_t i; char title[PATH_MAX], title_buf[PATH_MAX], title_msg[PATH_MAX]; const char *dir = NULL; const char *label = NULL; unsigned menu_type = 0; size_t end; gl_t *gl = (gl_t*)driver_video_resolve(NULL); glui_handle_t *glui = NULL; if (!driver.menu || !gl) return; glui = (glui_handle_t*)driver.menu->userdata; if (!glui) return; if (driver.menu->need_refresh && g_extern.is_menu && !driver.menu->msg_force) return; glui->line_height = g_settings.video.font_size * 4 / 3; glui->glyph_width = glui->line_height / 2; glui->margin = gl->win_width / 20 ; glui->term_width = (gl->win_width - glui->margin * 2) / glui->glyph_width; glui->term_height = (gl->win_height - glui->margin * 2) / glui->line_height - 2; driver.menu->mouse.ptr = (driver.menu->mouse.y - glui->margin) / glui->line_height - 2 + driver.menu->begin; glViewport(0, 0, gl->win_width, gl->win_height); if (driver.menu->mouse.wheeldown && driver.menu->begin < menu_list_get_size(driver.menu->menu_list) - glui->term_height) driver.menu->begin++; if (driver.menu->mouse.wheelup && driver.menu->begin > 0) driver.menu->begin--; /* Do not scroll if all items are visible. */ if (menu_list_get_size(driver.menu->menu_list) <= glui->term_height) driver.menu->begin = 0; end = (driver.menu->begin + glui->term_height <= menu_list_get_size(driver.menu->menu_list)) ? driver.menu->begin + glui->term_height : menu_list_get_size(driver.menu->menu_list); glui_render_background(false); menu_list_get_last_stack(driver.menu->menu_list, &dir, &label, &menu_type); get_title(label, dir, menu_type, title, sizeof(title)); menu_ticker_line(title_buf, glui->term_width - 3, g_extern.frame_count / glui->margin, title, true); glui_blit_line(glui->margin * 2, glui->margin + glui->line_height, title_buf, true); const char *core_name = g_extern.menu.info.library_name; if (!core_name) core_name = g_extern.system.info.library_name; if (!core_name) core_name = "No Core"; const char *core_version = g_extern.menu.info.library_version; if (!core_version) core_version = g_extern.system.info.library_version; if (!core_version) core_version = ""; snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION, core_name, core_version); glui_blit_line( glui->margin * 2, glui->margin + glui->term_height * glui->line_height + glui->line_height * 2, title_msg, true); x = glui->margin; y = glui->margin + glui->line_height * 2; for (i = driver.menu->begin; i < end; i++, y += glui->line_height) { char message[PATH_MAX], type_str[PATH_MAX], entry_title_buf[PATH_MAX], type_str_buf[PATH_MAX], path_buf[PATH_MAX]; const char *path = NULL, *entry_label = NULL; unsigned type = 0, w = 0; bool selected = false; menu_list_get_at_offset(driver.menu->menu_list->selection_buf, i, &path, &entry_label, &type); rarch_setting_t *setting = (rarch_setting_t*)setting_data_find_setting( driver.menu->list_settings, driver.menu->menu_list->selection_buf->list[i].label); (void)setting; disp_set_label(driver.menu->menu_list->selection_buf, &w, type, i, label, type_str, sizeof(type_str), entry_label, path, path_buf, sizeof(path_buf)); selected = (i == driver.menu->selection_ptr); menu_ticker_line(entry_title_buf, glui->term_width - (w + 1 + 2), g_extern.frame_count / glui->margin, path_buf, selected); menu_ticker_line(type_str_buf, w, g_extern.frame_count / glui->margin, type_str, selected); strlcpy(message, entry_title_buf, sizeof(message)); glui_blit_line(x, y, message, selected); glui_blit_line(gl->win_width - glui->glyph_width * w - glui->margin , y, type_str_buf, selected); } #ifdef GEKKO const char *message_queue; if (driver.menu->msg_force) { message_queue = msg_queue_pull(g_extern.msg_queue); driver.menu->msg_force = false; } else message_queue = driver.current_msg; glui_render_messagebox(message_queue); #endif if (driver.menu->keyboard.display) { char msg[PATH_MAX]; const char *str = *driver.menu->keyboard.buffer; if (!str) str = ""; glui_render_background(true); snprintf(msg, sizeof(msg), "%s\n%s", driver.menu->keyboard.label, str); glui_render_messagebox(msg); } if (glui->box_message[0] != '\0') { glui_render_background(true); glui_render_messagebox(glui->box_message); glui->box_message[0] = '\0'; } if (driver.menu->mouse.enable) glui_draw_cursor(driver.menu->mouse.x, driver.menu->mouse.y); gl_set_viewport(gl, gl->win_width, gl->win_height, false, false); }