(Menu) Cleanups

This commit is contained in:
twinaphex 2020-03-09 01:26:43 +01:00
parent c3be8f45fc
commit e08689ed98
6 changed files with 55 additions and 32 deletions

View File

@ -929,7 +929,9 @@ void gfx_display_draw_polygon(
}
void gfx_display_draw_texture(
video_frame_info_t *video_info,
void *userdata,
unsigned video_width,
unsigned video_height,
int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color, uintptr_t texture)
@ -938,9 +940,6 @@ void gfx_display_draw_texture(
gfx_display_ctx_rotate_draw_t rotate_draw;
struct video_coords coords;
math_matrix_4x4 mymat;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = 0.0;
@ -1608,17 +1607,16 @@ void gfx_display_unset_framebuffer_dirty_flag(void)
}
void gfx_display_draw_keyboard(
void *userdata,
unsigned video_width,
unsigned video_height,
uintptr_t hover_texture,
const font_data_t *font,
video_frame_info_t *video_info,
char *grid[], unsigned id,
unsigned text_color)
{
unsigned i;
int ptr_width, ptr_height;
void *userdata = video_info->userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
float white[16]= {
1.00, 1.00, 1.00, 1.00,
@ -1629,20 +1627,25 @@ void gfx_display_draw_keyboard(
gfx_display_draw_quad(
userdata,
width, height,
0, height/2.0, width, height/2.0,
width, height,
video_width,
video_height,
0,
video_height / 2.0,
video_width,
video_height / 2.0,
video_width,
video_height,
&osk_dark[0]);
ptr_width = width / 11;
ptr_height = height / 10;
ptr_width = video_width / 11;
ptr_height = video_height / 10;
if (ptr_width >= ptr_height)
ptr_width = ptr_height;
for (i = 0; i < 44; i++)
{
int line_y = (i / 11) * height / 10.0;
int line_y = (i / 11) * video_height / 10.0;
unsigned color = 0xffffffff;
if (i == id)
@ -1650,11 +1653,15 @@ void gfx_display_draw_keyboard(
gfx_display_blend_begin(userdata);
gfx_display_draw_texture(
video_info,
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
height/2.0 + ptr_height*1.5 + line_y,
userdata,
video_width,
video_height,
video_width / 2.0 - (11 * ptr_width) / 2.0 + (i % 11)
* ptr_width,
video_height / 2.0 + ptr_height * 1.5 + line_y,
ptr_width, ptr_height,
width, height,
video_width,
video_height,
&white[0],
hover_texture);
@ -1664,10 +1671,14 @@ void gfx_display_draw_keyboard(
}
gfx_display_draw_text(font, grid[i],
width/2.0 - (11*ptr_width)/2.0 + (i % 11)
video_width/2.0 - (11*ptr_width)/2.0 + (i % 11)
* ptr_width + ptr_width/2.0,
height/2.0 + ptr_height + line_y + font->size / 3,
width, height, color, TEXT_ALIGN_CENTER, 1.0f,
video_height / 2.0 + ptr_height + line_y + font->size / 3,
video_width,
video_height,
color,
TEXT_ALIGN_CENTER,
1.0f,
false, 0, false);
}
}

View File

@ -278,9 +278,11 @@ void gfx_display_draw_blend(
unsigned video_height);
void gfx_display_draw_keyboard(
void *userdata,
unsigned video_width,
unsigned video_height,
uintptr_t hover_texture,
const font_data_t *font,
video_frame_info_t *video_info,
char *grid[], unsigned id,
unsigned text_color);
@ -323,7 +325,9 @@ void gfx_display_draw_polygon(
float *color);
void gfx_display_draw_texture(
video_frame_info_t *video_info,
void *userdata,
unsigned video_width,
unsigned video_height,
int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color, uintptr_t texture);

View File

@ -5097,9 +5097,11 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
/* Draw onscreen keyboard */
gfx_display_draw_keyboard(
userdata,
video_width,
video_height,
mui->textures.list[MUI_TEXTURE_KEY_HOVER],
mui->font_data.list.font,
video_info,
input_event_get_osk_grid(),
input_event_get_osk_ptr(),
0xFFFFFFFF);

View File

@ -473,12 +473,14 @@ void ozone_draw_osk(ozone_handle_t *ozone,
/* Keyboard */
gfx_display_draw_keyboard(
ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_STATIC],
ozone->fonts.entries_label,
video_info,
input_event_get_osk_grid(),
input_event_get_osk_ptr(),
ozone->theme->text_rgba);
userdata,
video_width,
video_height,
ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_STATIC],
ozone->fonts.entries_label,
input_event_get_osk_grid(),
input_event_get_osk_ptr(),
ozone->theme->text_rgba);
string_list_free(list);
}

View File

@ -733,7 +733,9 @@ static void stripes_render_keyboard(
gfx_display_blend_begin(userdata);
gfx_display_draw_texture(
video_info,
userdata,
video_width,
video_height,
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
height/2.0 + ptr_height*1.5 + line_y,
ptr_width, ptr_height,

View File

@ -949,9 +949,11 @@ static void xmb_render_messagebox_internal(
if (menu_input_dialog_get_display_kb())
gfx_display_draw_keyboard(
userdata,
video_width,
video_height,
xmb->textures.list[XMB_TEXTURE_KEY_HOVER],
xmb->font,
video_info,
input_event_get_osk_grid(),
input_event_get_osk_ptr(),
0xffffffff);