mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
commit
9500301a95
@ -46,6 +46,14 @@ enum
|
||||
GLUI_TEXTURE_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GLUI_SYSTEM_TAB_MAIN = 0,
|
||||
GLUI_SYSTEM_TAB_PLAYLISTS
|
||||
};
|
||||
|
||||
#define GLUI_SYSTEM_TAB_END GLUI_SYSTEM_TAB_PLAYLISTS
|
||||
|
||||
struct glui_texture_item
|
||||
{
|
||||
GRuint id;
|
||||
@ -53,6 +61,7 @@ struct glui_texture_item
|
||||
|
||||
typedef struct glui_handle
|
||||
{
|
||||
unsigned tabs_height;
|
||||
unsigned line_height;
|
||||
unsigned icon_size;
|
||||
unsigned margin;
|
||||
@ -71,6 +80,19 @@ typedef struct glui_handle
|
||||
GRuint white;
|
||||
} textures;
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned idx;
|
||||
unsigned idx_old;
|
||||
} active;
|
||||
|
||||
float x_pos;
|
||||
size_t selection_ptr_old;
|
||||
size_t selection_ptr;
|
||||
} categories;
|
||||
|
||||
gfx_font_raster_block_t list_block;
|
||||
} glui_handle_t;
|
||||
|
||||
@ -233,7 +255,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
content_height = menu_entries_get_end() * glui->line_height;
|
||||
total_height = height - header_height;
|
||||
total_height = height - header_height - glui->tabs_height;
|
||||
scrollbar_height = total_height / (content_height / total_height) - (header_height / 6);
|
||||
y = total_height * menu->scroll_y / content_height;
|
||||
|
||||
@ -245,7 +267,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo
|
||||
|
||||
glui_render_quad(gl,
|
||||
width - scrollbar_width - (header_height / 12),
|
||||
header_height + y + (header_height / 12),
|
||||
header_height + glui->tabs_height + y + (header_height / 12),
|
||||
scrollbar_width,
|
||||
scrollbar_height,
|
||||
width, height,
|
||||
@ -370,12 +392,12 @@ static void glui_render(void)
|
||||
menu->scroll_y = 0;
|
||||
|
||||
bottom = menu_entries_get_end() * glui->line_height
|
||||
- height + header_height;
|
||||
- height + header_height + glui->tabs_height;
|
||||
if (menu->scroll_y > bottom)
|
||||
menu->scroll_y = bottom;
|
||||
|
||||
if (menu_entries_get_end() * glui->line_height
|
||||
< height - header_height)
|
||||
< height - header_height - glui->tabs_height)
|
||||
menu->scroll_y = 0;
|
||||
|
||||
if (menu_entries_get_end() < height / glui->line_height)
|
||||
@ -511,7 +533,7 @@ static void glui_render_menu_list(glui_handle_t *glui, gl_t *gl,
|
||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
||||
continue;
|
||||
|
||||
y = header_height - menu->scroll_y + (glui->line_height * i);
|
||||
y = header_height + glui->tabs_height - menu->scroll_y + (glui->line_height * i);
|
||||
|
||||
if (y > (int)height || ((y + (int)glui->line_height) < 0))
|
||||
continue;
|
||||
@ -603,7 +625,7 @@ static void glui_frame(void)
|
||||
0, 0, 0, 0.2,
|
||||
0, 0, 0, 0.2,
|
||||
};
|
||||
unsigned width, height, ticker_limit;
|
||||
unsigned width, height, ticker_limit, i, tab_width;
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char title[PATH_MAX_LENGTH];
|
||||
char title_buf[PATH_MAX_LENGTH];
|
||||
@ -619,6 +641,8 @@ static void glui_frame(void)
|
||||
const uint32_t normal_color = 0x212121ff;
|
||||
const uint32_t hover_color = 0x212121ff;
|
||||
const uint32_t title_color = 0xffffffff;
|
||||
const uint32_t activetab_color = 0xffffffff;
|
||||
const uint32_t passivetab_color = 0xffffff88;
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
return;
|
||||
@ -655,7 +679,7 @@ static void glui_frame(void)
|
||||
|
||||
/* highlighted entry */
|
||||
glui_render_quad(gl, 0,
|
||||
header_height - menu->scroll_y + glui->line_height *
|
||||
header_height + glui->tabs_height - menu->scroll_y + glui->line_height *
|
||||
selection, width, glui->line_height,
|
||||
width, height,
|
||||
&lightblue_bg[0]);
|
||||
@ -676,6 +700,30 @@ static void glui_frame(void)
|
||||
|
||||
/* shadow underneath header */
|
||||
glui_render_quad(gl, 0, header_height, width,
|
||||
glui->tabs_height,
|
||||
width, height,
|
||||
&blue_bg[0]);
|
||||
|
||||
for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++)
|
||||
{
|
||||
uint32_t tab_color = passivetab_color;
|
||||
if (i == glui->categories.selection_ptr)
|
||||
tab_color = activetab_color;
|
||||
|
||||
glui_blit_line(width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5),
|
||||
header_height - header_height/8,
|
||||
width, height, "TAB", tab_color, TEXT_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
tab_width = width / (GLUI_SYSTEM_TAB_END+1);
|
||||
glui_render_quad(gl, glui->categories.selection_ptr * tab_width,
|
||||
header_height + glui->tabs_height - (header_height/16),
|
||||
tab_width,
|
||||
header_height/16,
|
||||
width, height,
|
||||
&pure_white[0]);
|
||||
|
||||
glui_render_quad(gl, 0, header_height + glui->tabs_height, width,
|
||||
header_height/12,
|
||||
width, height,
|
||||
&shadow_bg[0]);
|
||||
@ -780,6 +828,7 @@ static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
|
||||
new_header_height = scale_factor / 3;
|
||||
new_font_size = scale_factor / 9;
|
||||
|
||||
glui->tabs_height = scale_factor / 4;
|
||||
glui->line_height = scale_factor / 3;
|
||||
glui->margin = scale_factor / 9;
|
||||
glui->icon_size = scale_factor / 3;
|
||||
@ -1032,6 +1081,94 @@ static int glui_environ(menu_environ_cb_t type, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void glui_list_cache(menu_list_type_t type, unsigned action)
|
||||
{
|
||||
size_t stack_size, list_size;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
|
||||
if (!glui)
|
||||
return;
|
||||
|
||||
list_size = GLUI_SYSTEM_TAB_END;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MENU_LIST_PLAIN:
|
||||
break;
|
||||
case MENU_LIST_HORIZONTAL:
|
||||
glui->categories.selection_ptr_old = glui->categories.selection_ptr;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_LEFT:
|
||||
if (glui->categories.selection_ptr == 0)
|
||||
{
|
||||
glui->categories.selection_ptr = list_size;
|
||||
glui->categories.active.idx = list_size - 1;
|
||||
}
|
||||
else
|
||||
glui->categories.selection_ptr--;
|
||||
break;
|
||||
default:
|
||||
if (glui->categories.selection_ptr == list_size)
|
||||
{
|
||||
glui->categories.selection_ptr = 0;
|
||||
glui->categories.active.idx = 1;
|
||||
}
|
||||
else
|
||||
glui->categories.selection_ptr++;
|
||||
break;
|
||||
}
|
||||
|
||||
stack_size = menu_stack->size;
|
||||
|
||||
if (menu_stack->list[stack_size - 1].label)
|
||||
free(menu_stack->list[stack_size - 1].label);
|
||||
menu_stack->list[stack_size - 1].label = NULL;
|
||||
|
||||
switch (glui->categories.selection_ptr)
|
||||
{
|
||||
case GLUI_SYSTEM_TAB_MAIN:
|
||||
menu_stack->list[stack_size - 1].label =
|
||||
strdup(menu_hash_to_str(MENU_VALUE_MAIN_MENU));
|
||||
menu_stack->list[stack_size - 1].type =
|
||||
MENU_SETTINGS;
|
||||
break;
|
||||
case GLUI_SYSTEM_TAB_PLAYLISTS:
|
||||
menu_stack->list[stack_size - 1].label =
|
||||
strdup(menu_hash_to_str(MENU_VALUE_PLAYLISTS_TAB));
|
||||
menu_stack->list[stack_size - 1].type =
|
||||
MENU_PLAYLISTS_TAB;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t glui_list_get_size(void *data, menu_list_type_t type)
|
||||
{
|
||||
size_t list_size = 0;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL;
|
||||
|
||||
/*switch (type)
|
||||
{
|
||||
case MENU_LIST_PLAIN:*/
|
||||
list_size = menu_entries_get_stack_size(0);
|
||||
/*break;
|
||||
}*/
|
||||
|
||||
return list_size;
|
||||
}
|
||||
|
||||
menu_ctx_driver_t menu_ctx_glui = {
|
||||
NULL,
|
||||
glui_get_message,
|
||||
@ -1055,10 +1192,10 @@ menu_ctx_driver_t menu_ctx_glui = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
glui_list_cache,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
glui_list_get_size,
|
||||
NULL,
|
||||
glui_list_set_selection,
|
||||
NULL,
|
||||
|
@ -780,6 +780,8 @@ const char *menu_hash_to_str_us(uint32_t hash)
|
||||
return "History tab";
|
||||
case MENU_VALUE_ADD_TAB:
|
||||
return "Add tab";
|
||||
case MENU_VALUE_PLAYLISTS_TAB:
|
||||
return "Playlists tab";
|
||||
case MENU_LABEL_VALUE_NO_SETTINGS_FOUND:
|
||||
return "No settings found.";
|
||||
case MENU_LABEL_VALUE_NO_PERFORMANCE_COUNTERS:
|
||||
|
@ -104,6 +104,7 @@ typedef enum
|
||||
MENU_SETTINGS_TAB,
|
||||
MENU_HISTORY_TAB,
|
||||
MENU_ADD_TAB,
|
||||
MENU_PLAYLISTS_TAB,
|
||||
MENU_SETTING_DRIVER,
|
||||
MENU_SETTING_ACTION,
|
||||
MENU_SETTING_ACTION_RUN,
|
||||
|
@ -3110,6 +3110,11 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
return -1;
|
||||
menu_displaylist_push_list_process(&info);
|
||||
return 0;
|
||||
case MENU_VALUE_PLAYLISTS_TAB:
|
||||
if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS) != 0)
|
||||
return -1;
|
||||
menu_displaylist_push_list_process(&info);
|
||||
return 0;
|
||||
case MENU_VALUE_HORIZONTAL_MENU:
|
||||
if (menu_displaylist_push_list(&info, DISPLAYLIST_HORIZONTAL) != 0)
|
||||
return -1;
|
||||
|
@ -572,6 +572,7 @@ extern "C" {
|
||||
#define MENU_VALUE_SETTINGS_TAB 0x6548d16dU
|
||||
#define MENU_VALUE_HISTORY_TAB 0xea9b0ceeU
|
||||
#define MENU_VALUE_ADD_TAB 0x7fb20225U
|
||||
#define MENU_VALUE_PLAYLISTS_TAB 0x092d3161U
|
||||
#define MENU_VALUE_MAIN_MENU 0x1625971fU
|
||||
#define MENU_LABEL_VALUE_SETTINGS 0x8aca3ff6U
|
||||
#define MENU_VALUE_INPUT_SETTINGS 0xddd30846U
|
||||
|
Loading…
x
Reference in New Issue
Block a user