diff --git a/frontend/menu/backend/menu_lakka_backend.c b/frontend/menu/backend/menu_lakka_backend.c index 908397f99b..9547a9720b 100644 --- a/frontend/menu/backend/menu_lakka_backend.c +++ b/frontend/menu/backend/menu_lakka_backend.c @@ -173,6 +173,7 @@ static void lakka_open_submenu(void) { int i, j, k; add_tween(DELAY, -HSPACING * (menu_active_category+1), &all_categories_x, &inOutQuad, NULL); + add_tween(DELAY, 1.0, &arrow_alpha, &inOutQuad, NULL); // Reset contextual menu style lakka_reset_submenu(); @@ -221,6 +222,7 @@ static void lakka_close_submenu(void) { int i, j, k; add_tween(DELAY, -HSPACING * menu_active_category, &all_categories_x, &inOutQuad, NULL); + add_tween(DELAY, 0.0, &arrow_alpha, &inOutQuad, NULL); for (i = 0; i < num_categories; i++) { diff --git a/frontend/menu/disp/lakka.c b/frontend/menu/disp/lakka.c index a9048b2130..99ec60ce35 100644 --- a/frontend/menu/disp/lakka.c +++ b/frontend/menu/disp/lakka.c @@ -49,6 +49,7 @@ int num_categories = 0; int menu_active_category = 0; float all_categories_x = 0; float global_alpha = 0; +float arrow_alpha = 0; float HSPACING; float VSPACING; float C_ACTIVE_ZOOM; @@ -302,22 +303,24 @@ static void update_tweens(float dt) static void lakka_draw_text(const char *str, float x, float y, float scale, float alpha) { + if (alpha > global_alpha) + alpha = global_alpha; + if (alpha == 0) + return; + gl_t *gl = (gl_t*)driver.video_data; if (!gl) return; + if (x < -ICON_SIZE || x > gl->win_width + ICON_SIZE || y < -ICON_SIZE || y > gl->win_height + ICON_SIZE) + return; + gl_set_viewport(gl, gl->win_width, gl->win_height, false, false); struct font_params params = {0}; params.x = x / gl->win_width; params.y = 1.0f - y / gl->win_height; - if (alpha > global_alpha) - alpha = global_alpha; - // Workaround https://github.com/libretro/RetroArch/blob/master/gfx/fonts/gl_raster_font.c#L216 - if (alpha < 0.05) - alpha = 0.05; - params.scale = scale; params.color = FONT_COLOR_RGBA(255, 255, 255, (uint8_t)(255 * alpha)); params.full_screen = true; @@ -365,6 +368,17 @@ void lakka_draw_icon(GLuint texture, float x, float y, float alpha, float rotati if (alpha > global_alpha) alpha = global_alpha; + if (alpha == 0) + return; + + gl_t *gl = (gl_t*)driver.video_data; + + if (!gl) + return; + + if (x < -ICON_SIZE || x > gl->win_width + ICON_SIZE || y < -ICON_SIZE || y > gl->win_height + ICON_SIZE) + return; + GLfloat color[] = { 1.0f, 1.0f, 1.0f, alpha, 1.0f, 1.0f, 1.0f, alpha, @@ -372,11 +386,6 @@ void lakka_draw_icon(GLuint texture, float x, float y, float alpha, float rotati 1.0f, 1.0f, 1.0f, alpha, }; - gl_t *gl = (gl_t*)driver.video_data; - - if (!gl) - return; - glViewport(x, gl->win_height - y, ICON_SIZE, ICON_SIZE); glEnable(GL_BLEND); @@ -477,9 +486,8 @@ static void lakka_draw_items(int i) if (!item) continue; - if (i == menu_active_category && - j > active_category->active_item - 5 && - j < active_category->active_item + 10) // performance improvement + if (i >= menu_active_category - 1 && + i <= menu_active_category + 1) // performance improvement { lakka_draw_icon(category->item_icon, MARGIN_LEFT + HSPACING*(i+1) + all_categories_x - ICON_SIZE/2.0, @@ -545,20 +553,14 @@ static void lakka_frame(void) lakka_draw_categories(); - if (depth == 0) - { - if (active_category) - lakka_draw_text(active_category->name, TITLE_MARGIN_LEFT, TITLE_MARGIN_TOP, 1, 1.0); - } - else - { - if (active_item) - lakka_draw_text(active_item->name, TITLE_MARGIN_LEFT, TITLE_MARGIN_TOP, 1, 1.0); + if (depth == 0 && active_category) + lakka_draw_text(active_category->name, TITLE_MARGIN_LEFT, TITLE_MARGIN_TOP, 1, 1.0); + else if (active_item) + lakka_draw_text(active_item->name, TITLE_MARGIN_LEFT, TITLE_MARGIN_TOP, 1, 1.0); - lakka_draw_icon(textures[TEXTURE_ARROW].id, - MARGIN_LEFT + HSPACING*(menu_active_category+1) + all_categories_x + ICON_SIZE/2.0, - MARGIN_TOP + VSPACING*ACTIVE_ITEM_FACTOR + ICON_SIZE/2.0, 1, 0, I_ACTIVE_ZOOM); - } + lakka_draw_icon(textures[TEXTURE_ARROW].id, + MARGIN_LEFT + HSPACING*(menu_active_category+1) + all_categories_x + ICON_SIZE/2.0, + MARGIN_TOP + VSPACING*ACTIVE_ITEM_FACTOR + ICON_SIZE/2.0, arrow_alpha, 0, I_ACTIVE_ZOOM); gl_set_viewport(gl, gl->win_width, gl->win_height, false, false); } diff --git a/frontend/menu/disp/lakka.h b/frontend/menu/disp/lakka.h index d901a6ac67..ec8c21601b 100644 --- a/frontend/menu/disp/lakka.h +++ b/frontend/menu/disp/lakka.h @@ -29,6 +29,7 @@ extern int num_categories; extern float all_categories_x; extern int menu_active_category; extern float global_alpha; +extern float arrow_alpha; extern float HSPACING; extern float VSPACING; extern float C_ACTIVE_ZOOM;