mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Adapt OSK rendering to vertical screens like phones
This commit is contained in:
parent
5bdd9533e7
commit
745da4d66b
@ -300,7 +300,11 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned
|
|||||||
width, height,
|
width, height,
|
||||||
&dark[0]);
|
&dark[0]);
|
||||||
|
|
||||||
int ptr_width = height / 10;
|
int ptr_width = width / 11;
|
||||||
|
int ptr_height = height / 10;
|
||||||
|
|
||||||
|
if (ptr_width >= ptr_height)
|
||||||
|
ptr_width = ptr_height;
|
||||||
|
|
||||||
for (i = 0; i < 44; i++)
|
for (i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
@ -314,15 +318,15 @@ static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned
|
|||||||
|
|
||||||
menu_display_draw_texture(
|
menu_display_draw_texture(
|
||||||
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
|
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
|
||||||
height/2.0 + ptr_width*1.5 + line_y,
|
height/2.0 + ptr_height*1.5 + line_y,
|
||||||
ptr_width, ptr_width,
|
ptr_width, ptr_height,
|
||||||
width, height,
|
width, height,
|
||||||
&white[0],
|
&white[0],
|
||||||
texture);
|
texture);
|
||||||
|
|
||||||
mui_draw_text(mui->font,
|
mui_draw_text(mui->font,
|
||||||
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0,
|
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0,
|
||||||
height/2.0 + ptr_width + line_y,
|
height/2.0 + ptr_height + line_y,
|
||||||
width, height, grid[i], 0xffffffff, TEXT_ALIGN_CENTER);
|
width, height, grid[i], 0xffffffff, TEXT_ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,15 +342,20 @@ static int mui_osk_ptr_at_pos(void *data, int x, int y)
|
|||||||
|
|
||||||
video_driver_get_size(&width, &height);
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
|
int ptr_width = width / 11;
|
||||||
|
int ptr_height = height / 10;
|
||||||
|
|
||||||
|
if (ptr_width >= ptr_height)
|
||||||
|
ptr_width = ptr_height;
|
||||||
|
|
||||||
for (i = 0; i < 44; i++)
|
for (i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
int ptr_width = height / 10;
|
|
||||||
int line_y = (i / 11)*height/10.0;
|
int line_y = (i / 11)*height/10.0;
|
||||||
int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width;
|
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;
|
int ptr_y = height/2.0 + ptr_height*1.5 + line_y - ptr_height;
|
||||||
|
|
||||||
if (x > ptr_x && x < ptr_x + ptr_width
|
if (x > ptr_x && x < ptr_x + ptr_width
|
||||||
&& y > ptr_y && y < ptr_y + ptr_width)
|
&& y > ptr_y && y < ptr_y + ptr_height)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +715,11 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
|
|||||||
width, height,
|
width, height,
|
||||||
&dark[0]);
|
&dark[0]);
|
||||||
|
|
||||||
int ptr_width = height / 10;
|
int ptr_width = width / 11;
|
||||||
|
int ptr_height = height / 10;
|
||||||
|
|
||||||
|
if (ptr_width >= ptr_height)
|
||||||
|
ptr_width = ptr_height;
|
||||||
|
|
||||||
for (i = 0; i < 44; i++)
|
for (i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
@ -729,8 +733,8 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
|
|||||||
|
|
||||||
menu_display_draw_texture(
|
menu_display_draw_texture(
|
||||||
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
|
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width,
|
||||||
height/2.0 + ptr_width*1.5 + line_y,
|
height/2.0 + ptr_height*1.5 + line_y,
|
||||||
ptr_width, ptr_width,
|
ptr_width, ptr_height,
|
||||||
width, height,
|
width, height,
|
||||||
&white[0],
|
&white[0],
|
||||||
texture);
|
texture);
|
||||||
@ -739,7 +743,7 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
|
|||||||
|
|
||||||
xmb_draw_text(xmb, grid[i],
|
xmb_draw_text(xmb, grid[i],
|
||||||
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0,
|
width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0,
|
||||||
height/2.0 + ptr_width + xmb->font->size/4.0 + line_y,
|
height/2.0 + ptr_height + xmb->font->size/4.0 + line_y,
|
||||||
1, 1, TEXT_ALIGN_CENTER, width, height, xmb->font);
|
1, 1, TEXT_ALIGN_CENTER, width, height, xmb->font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -755,15 +759,20 @@ static int xmb_osk_ptr_at_pos(void *data, int x, int y)
|
|||||||
|
|
||||||
video_driver_get_size(&width, &height);
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
|
int ptr_width = width / 11;
|
||||||
|
int ptr_height = height / 10;
|
||||||
|
|
||||||
|
if (ptr_width >= ptr_height)
|
||||||
|
ptr_width = ptr_height;
|
||||||
|
|
||||||
for (i = 0; i < 44; i++)
|
for (i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
int ptr_width = height / 10;
|
|
||||||
int line_y = (i / 11)*height/10.0;
|
int line_y = (i / 11)*height/10.0;
|
||||||
int ptr_x = width/2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width;
|
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;
|
int ptr_y = height/2.0 + ptr_height*1.5 + line_y - ptr_height;
|
||||||
|
|
||||||
if (x > ptr_x && x < ptr_x + ptr_width
|
if (x > ptr_x && x < ptr_x + ptr_width
|
||||||
&& y > ptr_y && y < ptr_y + ptr_width)
|
&& y > ptr_y && y < ptr_y + ptr_height)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user