From 5bdd9533e7abfb60ce1f1d4ee0caaab6ccfd0bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Thu, 3 Nov 2016 09:12:37 +0100 Subject: [PATCH] Improve OSK look in GLUI --- menu/drivers/materialui.c | 64 +++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index df4f7b5030..c7b5a9e4a8 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -68,6 +68,8 @@ enum MUI_TEXTURE_TAB_MAIN, MUI_TEXTURE_TAB_PLAYLISTS, MUI_TEXTURE_TAB_SETTINGS, + MUI_TEXTURE_KEY, + MUI_TEXTURE_KEY_HOVER, MUI_TEXTURE_LAST }; @@ -151,6 +153,10 @@ static const char *mui_texture_path(unsigned id) return "playlists_tab_passive.png"; case MUI_TEXTURE_TAB_SETTINGS: return "settings_tab_passive.png"; + case MUI_TEXTURE_KEY: + return "key.png"; + case MUI_TEXTURE_KEY_HOVER: + return "key-hover.png"; } return NULL; @@ -275,17 +281,17 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned { unsigned i, width, height; float dark[16]= { - 0.00, 0.00, 0.00, 0.75, - 0.00, 0.00, 0.00, 0.75, - 0.00, 0.00, 0.00, 0.75, - 0.00, 0.00, 0.00, 0.75, + 0.00, 0.00, 0.00, 0.85, + 0.00, 0.00, 0.00, 0.85, + 0.00, 0.00, 0.00, 0.85, + 0.00, 0.00, 0.00, 0.85, }; - float light[16]= { - 1.00, 1.00, 1.00, 0.5, - 1.00, 1.00, 1.00, 0.5, - 1.00, 1.00, 1.00, 0.5, - 1.00, 1.00, 1.00, 0.5, + float white[16]= { + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, }; video_driver_get_size(&width, &height); @@ -294,23 +300,29 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned width, height, &dark[0]); - for (i = 0; i <= 44; i++) - { - int line_y; - int ptr_width = height / 13; - line_y = (i / 11)*height/10.0; + int ptr_width = height / 10; + for (i = 0; i < 44; i++) + { + int line_y = (i / 11)*height/10.0; + + uintptr_t texture = mui->textures.list[MUI_TEXTURE_KEY]; if (i == id) - menu_display_draw_quad( - width/12.0 + (i % 11) * width/12.0 - ptr_width/2, - height*2.5/4.0 + line_y - ptr_width/2 - mui->font->size / 4, - ptr_width, ptr_width, - width, height, - &light[0]); + texture = mui->textures.list[MUI_TEXTURE_KEY_HOVER]; + + menu_display_blend_begin(); + + menu_display_draw_texture( + width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width, + height/2.0 + ptr_width*1.5 + line_y, + ptr_width, ptr_width, + width, height, + &white[0], + texture); mui_draw_text(mui->font, - width/12.0 + (i % 11) * width/12.0, - height*2.5/4.0 + line_y, + width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0, + height/2.0 + ptr_width + line_y, width, height, grid[i], 0xffffffff, TEXT_ALIGN_CENTER); } } @@ -326,12 +338,12 @@ static int mui_osk_ptr_at_pos(void *data, int x, int y) video_driver_get_size(&width, &height); - for (i = 0; i <= 44; i++) + for (i = 0; i < 44; i++) { - int ptr_width = height / 13; + int ptr_width = height / 10; int line_y = (i / 11)*height/10.0; - int ptr_x = width/12.0 + (i % 11) * width/12.0 - ptr_width/2; - int ptr_y = height*2.5/4.0 + line_y - ptr_width/2 - mui->font->size / 4; + int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width; + int ptr_y = height/2.0 + ptr_width*1.5 + line_y - ptr_width; if (x > ptr_x && x < ptr_x + ptr_width && y > ptr_y && y < ptr_y + ptr_width)