mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Start using menu_entries_get_end
This commit is contained in:
parent
4d98dc90fd
commit
3426dbca7f
@ -139,8 +139,7 @@ static void glui_draw_scrollbar(gl_t *gl)
|
||||
return;
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
content_height = menu_list_get_size(menu->menu_list)
|
||||
* glui->line_height;
|
||||
content_height = menu_entries_get_end() * glui->line_height;
|
||||
total_height = global->video_data.height - menu->header_height * 2;
|
||||
height = total_height / (content_height / total_height);
|
||||
y = total_height * menu->scroll_y / content_height;
|
||||
@ -254,12 +253,12 @@ static void glui_render(void)
|
||||
if (menu->scroll_y < 0)
|
||||
menu->scroll_y = 0;
|
||||
|
||||
bottom = menu_list_get_size(menu->menu_list) * glui->line_height
|
||||
bottom = menu_entries_get_end() * glui->line_height
|
||||
- global->video_data.height + menu->header_height * 2;
|
||||
if (menu->scroll_y > bottom)
|
||||
menu->scroll_y = bottom;
|
||||
|
||||
if (menu_list_get_size(menu->menu_list) * glui->line_height
|
||||
if (menu_entries_get_end() * glui->line_height
|
||||
< global->video_data.height - menu->header_height*2)
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
@ -272,13 +271,14 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
size_t i = 0;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
global_t *global = global_get_ptr();
|
||||
size_t end = menu_entries_get_end();
|
||||
|
||||
if (!menu_display_update_pending())
|
||||
return;
|
||||
|
||||
glui->list_block.carr.coords.vertices = 0;
|
||||
|
||||
for (i = 0; i < menu_list_get_size(menu->menu_list); i++)
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
unsigned y;
|
||||
menu_entry_t entry;
|
||||
|
@ -376,7 +376,7 @@ static void rgui_render(void)
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
if (menu->mouse.scrolldown && menu->begin
|
||||
< menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT)
|
||||
< menu_entries_get_end() - RGUI_TERM_HEIGHT)
|
||||
menu->begin++;
|
||||
|
||||
if (menu->mouse.scrollup && menu->begin > 0)
|
||||
@ -386,17 +386,15 @@ static void rgui_render(void)
|
||||
}
|
||||
|
||||
/* Do not scroll if all items are visible. */
|
||||
if (menu_list_get_size(menu->menu_list) <= RGUI_TERM_HEIGHT)
|
||||
if (menu_entries_get_end() <= RGUI_TERM_HEIGHT)
|
||||
menu->begin = 0;
|
||||
|
||||
bottom = menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT;
|
||||
bottom = menu_entries_get_end() - RGUI_TERM_HEIGHT;
|
||||
if (menu->begin > bottom)
|
||||
menu->begin = bottom;
|
||||
|
||||
end = (menu->begin + RGUI_TERM_HEIGHT <=
|
||||
menu_list_get_size(menu->menu_list)) ?
|
||||
menu->begin + RGUI_TERM_HEIGHT :
|
||||
menu_list_get_size(menu->menu_list);
|
||||
end = (menu->begin + RGUI_TERM_HEIGHT <= menu_entries_get_end()) ?
|
||||
menu->begin + RGUI_TERM_HEIGHT : menu_entries_get_end();
|
||||
|
||||
rgui_render_background();
|
||||
|
||||
@ -445,8 +443,9 @@ static void rgui_render(void)
|
||||
|
||||
x = RGUI_TERM_START_X;
|
||||
y = RGUI_TERM_START_Y;
|
||||
i = 0;
|
||||
|
||||
for (i = menu->begin; i < end; i++, y += FONT_HEIGHT_STRIDE)
|
||||
for (i = menu_entries_get_start(); i < end; i++, y += FONT_HEIGHT_STRIDE)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
char message[PATH_MAX_LENGTH],
|
||||
@ -595,6 +594,7 @@ static void rgui_navigation_set(bool scroll)
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return;
|
||||
size_t end = menu_entries_get_end();
|
||||
|
||||
if (!scroll)
|
||||
return;
|
||||
@ -602,13 +602,10 @@ static void rgui_navigation_set(bool scroll)
|
||||
if (menu->navigation.selection_ptr < RGUI_TERM_HEIGHT/2)
|
||||
menu->begin = 0;
|
||||
else if (menu->navigation.selection_ptr >= RGUI_TERM_HEIGHT/2
|
||||
&& menu->navigation.selection_ptr <
|
||||
menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT/2)
|
||||
&& menu->navigation.selection_ptr < (end - RGUI_TERM_HEIGHT/2))
|
||||
menu->begin = menu->navigation.selection_ptr - RGUI_TERM_HEIGHT/2;
|
||||
else if (menu->navigation.selection_ptr >=
|
||||
menu_list_get_size(menu->menu_list) - RGUI_TERM_HEIGHT/2)
|
||||
menu->begin = menu_list_get_size(menu->menu_list)
|
||||
- RGUI_TERM_HEIGHT;
|
||||
else if (menu->navigation.selection_ptr >= (end - RGUI_TERM_HEIGHT/2))
|
||||
menu->begin = end - RGUI_TERM_HEIGHT;
|
||||
}
|
||||
|
||||
static void rgui_navigation_set_last(void)
|
||||
|
@ -132,6 +132,7 @@ static void rmenu_render(void)
|
||||
global_t *global = global_get_ptr();
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
size_t entries_end = menu_entries_get_end():
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -155,12 +156,10 @@ static void rmenu_render(void)
|
||||
|
||||
begin = (menu->navigation.selection_ptr >= (ENTRIES_HEIGHT / 2)) ?
|
||||
(menu->navigation.selection_ptr - (ENTRIES_HEIGHT / 2)) : 0;
|
||||
end = ((menu->navigation.selection_ptr + ENTRIES_HEIGHT) <=
|
||||
menu_list_get_size(menu->menu_list)) ?
|
||||
menu->navigation.selection_ptr + ENTRIES_HEIGHT :
|
||||
menu_list_get_size(menu->menu_list);
|
||||
end = ((menu->navigation.selection_ptr + ENTRIES_HEIGHT) <= entries_end)
|
||||
? menu->navigation.selection_ptr + ENTRIES_HEIGHT : entries_end;
|
||||
|
||||
if (menu_list_get_size(menu->menu_list) <= ENTRIES_HEIGHT)
|
||||
if (entries_end <= ENTRIES_HEIGHT)
|
||||
begin = 0;
|
||||
|
||||
if (end - begin > ENTRIES_HEIGHT)
|
||||
|
@ -566,7 +566,7 @@ static void rmenu_xui_render(void)
|
||||
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
|
||||
}
|
||||
|
||||
end = menu_list_get_size(menu->menu_list);
|
||||
end = menu_entries_get_end();
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
@ -456,7 +456,7 @@ static void xmb_selection_pointer_changed(void)
|
||||
return;
|
||||
|
||||
current = menu->navigation.selection_ptr;
|
||||
end = menu_list_get_size(menu->menu_list);
|
||||
end = menu_entries_get_end();
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user