static bool glui_load_image(void *data, menu_image_type_t type) { glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); if (!menu || !menu->userdata) return false; glui = (glui_handle_t*)menu->userdata; switch (type) { case MENU_IMAGE_NONE: break; case MENU_IMAGE_WALLPAPER: glui_context_bg_destroy(glui); glui->textures.bg.id = video_texture_load(data, TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR); glui_allocate_white_texture(glui); break; case MENU_IMAGE_BOXART: break; } return true; }
static void *glui_init(void) { glui_handle_t *glui = NULL; const video_driver_t *video_driver = NULL; menu_handle_t *menu = NULL; gl_t *gl = (gl_t*) video_driver_get_ptr(&video_driver); if (video_driver != &video_gl || !gl) { RARCH_ERR("Cannot initialize GLUI menu driver: gl video driver is not active.\n"); return NULL; } menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; menu->userdata = (glui_handle_t*)calloc(1, sizeof(glui_handle_t)); if (!menu->userdata) goto error; glui = (glui_handle_t*)menu->userdata; glui_layout(menu, glui); glui_allocate_white_texture(glui); return menu; error: if (menu) free(menu); return NULL; }
static void *glui_init(void) { float dpi; glui_handle_t *glui = NULL; const video_driver_t *video_driver = NULL; menu_handle_t *menu = NULL; settings_t *settings = config_get_ptr(); gl_t *gl = (gl_t*) video_driver_get_ptr(&video_driver); if (video_driver != &video_gl || !gl) { RARCH_ERR("Cannot initialize GLUI menu driver: gl video driver is not active.\n"); return NULL; } menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; menu->userdata = (glui_handle_t*)calloc(1, sizeof(glui_handle_t)); if (!menu->userdata) goto error; glui = (glui_handle_t*)menu->userdata; dpi = menu_display_get_dpi(); glui->line_height = dpi / 3; glui->margin = dpi / 6; glui->ticker_limit = dpi / 3; menu->display.header_height = dpi / 3; menu->display.font.size = dpi / 8; glui->textures.bg.id = 0; glui_allocate_white_texture(glui); if (settings->menu.wallpaper[0] != '\0') rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true); return menu; error: if (menu) free(menu); return NULL; }
static void glui_context_reset(void) { glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); if (!menu || !menu->userdata || !settings) return; glui = (glui_handle_t*)menu->userdata; glui_layout(menu, glui); glui_context_bg_destroy(glui); glui_allocate_white_texture(glui); rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true); }
static void *glui_init(void) { glui_handle_t *glui = NULL; const video_driver_t *video_driver = NULL; menu_handle_t *menu = NULL; settings_t *settings = config_get_ptr(); gl_t *gl = (gl_t*) video_driver_get_ptr(&video_driver); if (video_driver != &video_gl || !gl) { RARCH_ERR("Cannot initialize GLUI menu driver: gl video driver is not active.\n"); return NULL; } menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) goto error; menu->userdata = (glui_handle_t*)calloc(1, sizeof(glui_handle_t)); if (!menu->userdata) goto error; glui = (glui_handle_t*)menu->userdata; glui_layout(menu, glui); glui_allocate_white_texture(glui); if (settings->menu.wallpaper[0] != '\0') rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true); return menu; error: if (menu) free(menu); return NULL; }
static void glui_context_reset(void) { glui_handle_t *glui = NULL; menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); const char *font_path = NULL; if (!menu || !menu->userdata || !settings) return; glui = (glui_handle_t*)menu->userdata; font_path = settings->video.font_enable ? settings->video.font_path : NULL; if (!menu_display_init_main_font(menu, font_path, menu->display.font.size)) RARCH_WARN("Failed to load font."); glui_context_bg_destroy(glui); glui_allocate_white_texture(glui); rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE, settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true); }