mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Improve OSK look on XMB
This commit is contained in:
parent
810ff5605d
commit
f72bf26eac
@ -122,6 +122,8 @@ enum
|
||||
XMB_TEXTURE_CLOCK,
|
||||
XMB_TEXTURE_POINTER,
|
||||
XMB_TEXTURE_ADD,
|
||||
XMB_TEXTURE_KEY,
|
||||
XMB_TEXTURE_KEY_HOVER,
|
||||
XMB_TEXTURE_LAST
|
||||
};
|
||||
|
||||
@ -694,17 +696,17 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, 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);
|
||||
@ -713,23 +715,31 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, 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 = xmb->textures.list[XMB_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 - xmb->font->size / 4,
|
||||
ptr_width, ptr_width,
|
||||
width, height,
|
||||
&light[0]);
|
||||
texture = xmb->textures.list[XMB_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);
|
||||
|
||||
menu_display_blend_end();
|
||||
|
||||
xmb_draw_text(xmb, grid[i],
|
||||
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 + xmb->font->size/4.0 + line_y,
|
||||
1, 1, TEXT_ALIGN_CENTER, width, height, xmb->font);
|
||||
}
|
||||
}
|
||||
@ -745,12 +755,12 @@ static int xmb_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 - xmb->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)
|
||||
@ -3072,6 +3082,10 @@ static const char *xmb_texture_path(unsigned id)
|
||||
return "off.png";
|
||||
case XMB_TEXTURE_ADD:
|
||||
return "add.png";
|
||||
case XMB_TEXTURE_KEY:
|
||||
return "key.png";
|
||||
case XMB_TEXTURE_KEY_HOVER:
|
||||
return "key-hover.png";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -576,6 +576,39 @@ void menu_display_draw_quad(
|
||||
menu_display_blend_end();
|
||||
}
|
||||
|
||||
void menu_display_draw_texture(
|
||||
int x, int y, unsigned w, unsigned h,
|
||||
unsigned width, unsigned height,
|
||||
float *color, uintptr_t texture)
|
||||
{
|
||||
menu_display_ctx_draw_t draw;
|
||||
menu_display_ctx_rotate_draw_t rotate_draw;
|
||||
struct video_coords coords;
|
||||
math_matrix_4x4 mymat;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0;
|
||||
rotate_draw.scale_x = 1.0;
|
||||
rotate_draw.scale_y = 1.0;
|
||||
rotate_draw.scale_z = 1;
|
||||
rotate_draw.scale_enable = true;
|
||||
coords.vertices = 4;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = NULL;
|
||||
coords.lut_tex_coord = NULL;
|
||||
draw.width = w;
|
||||
draw.height = h;
|
||||
draw.coords = &coords;
|
||||
draw.matrix_data = &mymat;
|
||||
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||
draw.pipeline.id = 0;
|
||||
coords.color = (const float*)color;
|
||||
menu_display_rotate_z(&rotate_draw);
|
||||
draw.texture = texture;
|
||||
draw.x = x;
|
||||
draw.y = height - y;
|
||||
menu_display_draw(&draw);
|
||||
}
|
||||
|
||||
void menu_display_rotate_z(menu_display_ctx_rotate_draw_t *draw)
|
||||
{
|
||||
#if !defined(VITA)
|
||||
|
@ -233,6 +233,9 @@ void menu_display_draw_gradient(menu_display_ctx_draw_t *draw);
|
||||
void menu_display_draw_quad(int x, int y, unsigned w, unsigned h,
|
||||
unsigned width, unsigned height,
|
||||
float *color);
|
||||
void menu_display_draw_texture(int x, int y, unsigned w, unsigned h,
|
||||
unsigned width, unsigned height,
|
||||
float *color, uintptr_t texture);
|
||||
void menu_display_rotate_z(menu_display_ctx_rotate_draw_t *draw);
|
||||
bool menu_display_get_tex_coords(menu_display_ctx_coord_draw_t *draw);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user