mirror of
https://github.com/libretro/RetroArch
synced 2025-04-11 00:44:20 +00:00
(menu_display.c) Refactor draw functions
This commit is contained in:
parent
2dba1aaef4
commit
2b86b9dbe6
@ -185,6 +185,7 @@ static void mui_draw_icon(mui_handle_t *mui,
|
|||||||
float rotation, float scale_factor,
|
float rotation, float scale_factor,
|
||||||
float *color)
|
float *color)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
math_matrix_4x4 mymat;
|
math_matrix_4x4 mymat;
|
||||||
|
|
||||||
@ -199,13 +200,16 @@ static void mui_draw_icon(mui_handle_t *mui,
|
|||||||
coords.lut_tex_coord = NULL;
|
coords.lut_tex_coord = NULL;
|
||||||
coords.color = (const float*)color;
|
coords.color = (const float*)color;
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x;
|
||||||
x,
|
draw.y = height - y - mui->icon_size;
|
||||||
height - y - mui->icon_size,
|
draw.width = mui->icon_size;
|
||||||
mui->icon_size,
|
draw.height = mui->icon_size;
|
||||||
mui->icon_size,
|
draw.coords = &coords;
|
||||||
&coords, &mymat, texture,
|
draw.matrix_data = &mymat;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = texture;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||||
}
|
}
|
||||||
@ -271,6 +275,7 @@ static void mui_render_quad(mui_handle_t *mui,
|
|||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
float *coord_color)
|
float *coord_color)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
|
|
||||||
coords.vertices = 4;
|
coords.vertices = 4;
|
||||||
@ -281,13 +286,16 @@ static void mui_render_quad(mui_handle_t *mui,
|
|||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x;
|
||||||
x,
|
draw.y = (int)height - y - (int)h;
|
||||||
(int)height - y - (int)h,
|
draw.width = w;
|
||||||
w,
|
draw.height = h;
|
||||||
h,
|
draw.coords = &coords;
|
||||||
&coords, NULL, mui->textures.white,
|
draw.matrix_data = NULL;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = mui->textures.white;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||||
}
|
}
|
||||||
@ -630,6 +638,7 @@ static void mui_draw_cursor(mui_handle_t *mui,
|
|||||||
float *color,
|
float *color,
|
||||||
float x, float y, unsigned width, unsigned height)
|
float x, float y, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
|
|
||||||
coords.vertices = 4;
|
coords.vertices = 4;
|
||||||
@ -640,14 +649,16 @@ static void mui_draw_cursor(mui_handle_t *mui,
|
|||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x - 32;
|
||||||
x - 32,
|
draw.y = (int)height - y - 32;
|
||||||
height - y - 32,
|
draw.width = 64;
|
||||||
64,
|
draw.height = 64;
|
||||||
64,
|
draw.coords = &coords;
|
||||||
&coords, NULL,
|
draw.matrix_data = NULL;
|
||||||
mui->textures.list[MUI_TEXTURE_POINTER].id,
|
draw.texture = mui->textures.list[MUI_TEXTURE_POINTER].id;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||||
}
|
}
|
||||||
@ -774,6 +785,7 @@ static void mui_frame(void *data)
|
|||||||
size_t selection;
|
size_t selection;
|
||||||
size_t title_margin;
|
size_t title_margin;
|
||||||
uint64_t *frame_count;
|
uint64_t *frame_count;
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
mui_handle_t *mui = (mui_handle_t*)data;
|
mui_handle_t *mui = (mui_handle_t*)data;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
const uint32_t normal_color = 0x212121ff;
|
const uint32_t normal_color = 0x212121ff;
|
||||||
@ -800,12 +812,21 @@ static void mui_frame(void *data)
|
|||||||
|
|
||||||
if (libretro_running)
|
if (libretro_running)
|
||||||
{
|
{
|
||||||
menu_display_draw_bg(
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
||||||
width, height,
|
|
||||||
mui->textures.white, 0.75f, false,
|
draw.width = width;
|
||||||
&white_transp_bg[0], &white_bg[0],
|
draw.height = height;
|
||||||
NULL, NULL, 4,
|
draw.texture = mui->textures.white;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.handle_alpha = 0.75f;
|
||||||
|
draw.force_transparency = false;
|
||||||
|
draw.color = &white_transp_bg[0];
|
||||||
|
draw.color2 = &white_bg[0];
|
||||||
|
draw.vertex = NULL;
|
||||||
|
draw.tex_coord = NULL;
|
||||||
|
draw.vertex_count = 4;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -825,12 +846,21 @@ static void mui_frame(void *data)
|
|||||||
/* Set new opacity for transposed white background */
|
/* Set new opacity for transposed white background */
|
||||||
bgcolor_setalpha(white_transp_bg, 0.30);
|
bgcolor_setalpha(white_transp_bg, 0.30);
|
||||||
|
|
||||||
menu_display_draw_bg(
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
||||||
width, height,
|
|
||||||
mui->textures.bg.id, 0.75f, true,
|
draw.width = width;
|
||||||
&white_transp_bg[0], &white_bg[0],
|
draw.height = height;
|
||||||
NULL, NULL, 4,
|
draw.texture = mui->textures.bg.id;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.handle_alpha = 0.75f;
|
||||||
|
draw.force_transparency = true;
|
||||||
|
draw.color = &white_transp_bg[0];
|
||||||
|
draw.color2 = &white_bg[0];
|
||||||
|
draw.vertex = NULL;
|
||||||
|
draw.tex_coord = NULL;
|
||||||
|
draw.vertex_count = 4;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||||
|
|
||||||
/* Restore opacity of transposed white background */
|
/* Restore opacity of transposed white background */
|
||||||
bgcolor_setalpha(white_transp_bg, 0.90);
|
bgcolor_setalpha(white_transp_bg, 0.90);
|
||||||
|
@ -341,6 +341,7 @@ static void xmb_draw_icon(xmb_handle_t *xmb,
|
|||||||
float rotation, float scale_factor,
|
float rotation, float scale_factor,
|
||||||
float *color)
|
float *color)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
math_matrix_4x4 mymat;
|
math_matrix_4x4 mymat;
|
||||||
|
|
||||||
@ -360,13 +361,16 @@ static void xmb_draw_icon(xmb_handle_t *xmb,
|
|||||||
coords.lut_tex_coord = NULL;
|
coords.lut_tex_coord = NULL;
|
||||||
coords.color = (const float*)color;
|
coords.color = (const float*)color;
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x;
|
||||||
x,
|
draw.y = height - y;
|
||||||
height - y,
|
draw.width = xmb->icon.size;
|
||||||
xmb->icon.size,
|
draw.height = xmb->icon.size;
|
||||||
xmb->icon.size,
|
draw.coords = &coords;
|
||||||
&coords, &mymat, texture,
|
draw.matrix_data = &mymat;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = texture;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_draw_icon_predone(xmb_handle_t *xmb,
|
static void xmb_draw_icon_predone(xmb_handle_t *xmb,
|
||||||
@ -377,6 +381,8 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
|
|||||||
float alpha, float rotation, float scale_factor,
|
float alpha, float rotation, float scale_factor,
|
||||||
float *color)
|
float *color)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
|
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -392,18 +398,22 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
|
|||||||
coords.lut_tex_coord = NULL;
|
coords.lut_tex_coord = NULL;
|
||||||
coords.color = color;
|
coords.color = color;
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x;
|
||||||
x,
|
draw.y = height - y;
|
||||||
height - y,
|
draw.width = xmb->icon.size;
|
||||||
xmb->icon.size,
|
draw.height = xmb->icon.size;
|
||||||
xmb->icon.size,
|
draw.coords = &coords;
|
||||||
&coords, mymat, texture,
|
draw.matrix_data = &mymat;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = texture;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_draw_boxart(xmb_handle_t *xmb, float *color,
|
static void xmb_draw_boxart(xmb_handle_t *xmb, float *color,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
math_matrix_4x4 mymat;
|
math_matrix_4x4 mymat;
|
||||||
float y = xmb->margins.screen.top + xmb->icon.size + xmb->boxart_height;
|
float y = xmb->margins.screen.top + xmb->icon.size + xmb->boxart_height;
|
||||||
@ -418,13 +428,16 @@ static void xmb_draw_boxart(xmb_handle_t *xmb, float *color,
|
|||||||
coords.lut_tex_coord = NULL;
|
coords.lut_tex_coord = NULL;
|
||||||
coords.color = (const float*)color;
|
coords.color = (const float*)color;
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x;
|
||||||
x,
|
draw.y = height - y;
|
||||||
height - y,
|
draw.width = xmb->boxart_width;
|
||||||
xmb->boxart_width,
|
draw.height = xmb->boxart_height;
|
||||||
xmb->boxart_height,
|
draw.coords = &coords;
|
||||||
&coords, &mymat, xmb->boxart,
|
draw.matrix_data = &mymat;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = xmb->boxart;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_draw_text(xmb_handle_t *xmb,
|
static void xmb_draw_text(xmb_handle_t *xmb,
|
||||||
@ -1575,6 +1588,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
|
|||||||
float *color,
|
float *color,
|
||||||
float x, float y, unsigned width, unsigned height)
|
float x, float y, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
|
|
||||||
coords.vertices = 4;
|
coords.vertices = 4;
|
||||||
@ -1585,13 +1599,16 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
|
|||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||||
|
|
||||||
menu_display_draw(
|
draw.x = x - (xmb->cursor.size / 2);
|
||||||
x - (xmb->cursor.size/2),
|
draw.y = height - y - (xmb->cursor.size / 2);
|
||||||
height - y - (xmb->cursor.size/2),
|
draw.width = xmb->cursor.size;
|
||||||
xmb->cursor.size,
|
draw.height = xmb->cursor.size;
|
||||||
xmb->cursor.size,
|
draw.coords = &coords;
|
||||||
&coords, NULL, xmb->textures.list[XMB_TEXTURE_POINTER].id,
|
draw.matrix_data = NULL;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.texture = xmb->textures.list[XMB_TEXTURE_POINTER].id;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||||
}
|
}
|
||||||
@ -1701,6 +1718,7 @@ static void xmb_frame(void *data)
|
|||||||
float item_color[16];
|
float item_color[16];
|
||||||
float coord_color[16];
|
float coord_color[16];
|
||||||
float coord_color2[16];
|
float coord_color2[16];
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
bool display_kb;
|
bool display_kb;
|
||||||
bool render_background = false;
|
bool render_background = false;
|
||||||
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
||||||
@ -1739,10 +1757,21 @@ static void xmb_frame(void *data)
|
|||||||
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] =
|
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] =
|
||||||
xmb->alpha;
|
xmb->alpha;
|
||||||
|
|
||||||
menu_display_draw_bg(
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
||||||
width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0],
|
|
||||||
&coord_color2[0], NULL, NULL, 4,
|
draw.width = width;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.height = height;
|
||||||
|
draw.texture = xmb->textures.bg.id;
|
||||||
|
draw.handle_alpha = xmb->alpha;
|
||||||
|
draw.force_transparency = false;
|
||||||
|
draw.color = &coord_color[0];
|
||||||
|
draw.color2 = &coord_color2[0];
|
||||||
|
draw.vertex = NULL;
|
||||||
|
draw.tex_coord = NULL;
|
||||||
|
draw.vertex_count = 4;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||||
|
|
||||||
xmb_draw_text(xmb,
|
xmb_draw_text(xmb,
|
||||||
xmb->title_name, xmb->margins.title.left,
|
xmb->title_name, xmb->margins.title.left,
|
||||||
@ -1844,12 +1873,22 @@ static void xmb_frame(void *data)
|
|||||||
|
|
||||||
if (render_background)
|
if (render_background)
|
||||||
{
|
{
|
||||||
menu_display_draw_bg(
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
||||||
width, height,
|
|
||||||
xmb->textures.bg.id, xmb->alpha, true,
|
draw.width = width;
|
||||||
&coord_color[0], &coord_color2[0],
|
draw.height = height;
|
||||||
NULL, NULL, 4,
|
draw.texture = xmb->textures.bg.id;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.handle_alpha = xmb->alpha;
|
||||||
|
draw.force_transparency = true;
|
||||||
|
draw.color = &coord_color[0];
|
||||||
|
draw.color2 = &coord_color2[0];
|
||||||
|
draw.vertex = NULL;
|
||||||
|
draw.tex_coord = NULL;
|
||||||
|
draw.vertex_count = 4;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||||
|
|
||||||
xmb_render_messagebox_internal(xmb, msg);
|
xmb_render_messagebox_internal(xmb, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,6 +959,7 @@ static void zarch_frame(void *data)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
float coord_color[16];
|
float coord_color[16];
|
||||||
float coord_color2[16];
|
float coord_color2[16];
|
||||||
|
menu_display_ctx_draw_t draw;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
zui_t *zui = (zui_t*)data;
|
zui_t *zui = (zui_t*)data;
|
||||||
|
|
||||||
@ -1019,7 +1020,9 @@ static void zarch_frame(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settings->menu.mouse.enable)
|
if (settings->menu.mouse.enable)
|
||||||
zarch_zui_draw_cursor(zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_X), zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_Y));
|
zarch_zui_draw_cursor(
|
||||||
|
zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_X),
|
||||||
|
zarch_zui_input_state(zui, MENU_ZARCH_MOUSE_Y));
|
||||||
|
|
||||||
|
|
||||||
if (!zarch_zui_input_state(zui, MENU_ZARCH_PRESSED))
|
if (!zarch_zui_input_state(zui, MENU_ZARCH_PRESSED))
|
||||||
@ -1028,24 +1031,35 @@ static void zarch_frame(void *data)
|
|||||||
zui->item.active = -1;
|
zui->item.active = -1;
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
|
||||||
|
|
||||||
|
draw.x = 0;
|
||||||
|
draw.y = 0;
|
||||||
|
draw.width = zui->width;
|
||||||
|
draw.height = zui->height;
|
||||||
|
draw.coords = (struct gfx_coords*)&zui->ca;
|
||||||
|
draw.matrix_data = &zui->mvp;
|
||||||
|
draw.texture = zui->textures.white;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLES;
|
||||||
|
|
||||||
menu_display_draw(
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW, &draw);
|
||||||
0,
|
|
||||||
0,
|
|
||||||
zui->width,
|
|
||||||
zui->height,
|
|
||||||
(struct gfx_coords*)&zui->ca,
|
|
||||||
&zui->mvp, zui->textures.white,
|
|
||||||
MENU_DISPLAY_PRIM_TRIANGLES);
|
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
|
||||||
|
|
||||||
menu_display_draw_bg(
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
||||||
zui->width, zui->height,
|
|
||||||
zui->textures.bg.id, 0.75f, false,
|
draw.width = zui->width;
|
||||||
&coord_color[0], &coord_color2[0],
|
draw.height = zui->height;
|
||||||
NULL, menu_display_get_tex_coords(), 4,
|
draw.texture = zui->textures.bg.id;
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
draw.handle_alpha = 0.75f;
|
||||||
|
draw.force_transparency = false;
|
||||||
|
draw.color = &coord_color[0];
|
||||||
|
draw.color2 = &coord_color2[0];
|
||||||
|
draw.vertex = NULL;
|
||||||
|
draw.tex_coord = menu_display_get_tex_coords();
|
||||||
|
draw.vertex_count = 4;
|
||||||
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
|
|
||||||
|
menu_display_ctl(MENU_DISPLAY_CTL_DRAW_BG, &draw);
|
||||||
|
|
||||||
zui->rendering = false;
|
zui->rendering = false;
|
||||||
|
|
||||||
|
@ -456,6 +456,28 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
|||||||
clearcolor->g, clearcolor->b, clearcolor->a);
|
clearcolor->g, clearcolor->b, clearcolor->a);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MENU_DISPLAY_CTL_DRAW:
|
||||||
|
{
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
if (!menu_disp || !menu_disp->draw || !data)
|
||||||
|
return false;
|
||||||
|
menu_disp->draw(draw->x, draw->y, draw->width, draw->height,
|
||||||
|
draw->coords, draw->matrix_data, draw->texture, draw->prim_type);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MENU_DISPLAY_CTL_DRAW_BG:
|
||||||
|
{
|
||||||
|
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||||
|
if (!menu_disp || !menu_disp->draw_bg || !data)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
menu_disp->draw_bg(draw->width, draw->height,
|
||||||
|
draw->texture, draw->handle_alpha,
|
||||||
|
draw->force_transparency, draw->color,
|
||||||
|
draw->color2, draw->vertex, draw->tex_coord,
|
||||||
|
draw->vertex_count, draw->prim_type);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case MENU_DISPLAY_CTL_NONE:
|
case MENU_DISPLAY_CTL_NONE:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -512,46 +534,6 @@ void menu_display_matrix_4x4_rotate_z(
|
|||||||
matrix_4x4_multiply(matrix, &matrix_scaled, matrix);
|
matrix_4x4_multiply(matrix, &matrix_scaled, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_draw(float x, float y,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
struct gfx_coords *coords,
|
|
||||||
void *matrix_data,
|
|
||||||
uintptr_t texture,
|
|
||||||
enum menu_display_prim_type prim_type
|
|
||||||
)
|
|
||||||
{
|
|
||||||
menu_display_ctx_driver_t *menu_disp =
|
|
||||||
menu_display_context_get_ptr();
|
|
||||||
if (!menu_disp || !menu_disp->draw)
|
|
||||||
return;
|
|
||||||
|
|
||||||
menu_disp->draw(x, y, width, height,
|
|
||||||
coords, matrix_data, texture, prim_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
void menu_display_draw_bg(
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
uintptr_t texture,
|
|
||||||
float handle_alpha,
|
|
||||||
bool force_transparency,
|
|
||||||
float *color,
|
|
||||||
float *color2,
|
|
||||||
const float *vertex,
|
|
||||||
const float *tex_coord,
|
|
||||||
size_t vertex_count,
|
|
||||||
enum menu_display_prim_type prim_type
|
|
||||||
)
|
|
||||||
{
|
|
||||||
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
|
|
||||||
if (!menu_disp || !menu_disp->draw_bg)
|
|
||||||
return;
|
|
||||||
|
|
||||||
menu_disp->draw_bg(width, height, texture, handle_alpha,
|
|
||||||
force_transparency, color,
|
|
||||||
color2, vertex, tex_coord, vertex_count, prim_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const float *menu_display_get_tex_coords(void)
|
const float *menu_display_get_tex_coords(void)
|
||||||
{
|
{
|
||||||
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
|
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
|
||||||
|
@ -74,7 +74,9 @@ enum menu_display_ctl_state
|
|||||||
MENU_DISPLAY_CTL_BLEND_BEGIN,
|
MENU_DISPLAY_CTL_BLEND_BEGIN,
|
||||||
MENU_DISPLAY_CTL_BLEND_END,
|
MENU_DISPLAY_CTL_BLEND_END,
|
||||||
MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR,
|
MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR,
|
||||||
MENU_DISPLAY_CTL_CLEAR_COLOR
|
MENU_DISPLAY_CTL_CLEAR_COLOR,
|
||||||
|
MENU_DISPLAY_CTL_DRAW,
|
||||||
|
MENU_DISPLAY_CTL_DRAW_BG
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_display_prim_type
|
enum menu_display_prim_type
|
||||||
@ -177,27 +179,6 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data);
|
|||||||
|
|
||||||
void menu_display_timedate(char *s, size_t len, unsigned time_mode);
|
void menu_display_timedate(char *s, size_t len, unsigned time_mode);
|
||||||
|
|
||||||
void menu_display_draw(float x, float y,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
struct gfx_coords *coords,
|
|
||||||
void *matrix_data,
|
|
||||||
uintptr_t texture,
|
|
||||||
enum menu_display_prim_type prim_type
|
|
||||||
);
|
|
||||||
|
|
||||||
void menu_display_draw_bg(
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
uintptr_t texture,
|
|
||||||
float handle_alpha,
|
|
||||||
bool force_transparency,
|
|
||||||
float *color,
|
|
||||||
float *color2,
|
|
||||||
const float *vertex,
|
|
||||||
const float *tex_coord,
|
|
||||||
size_t vertex_count,
|
|
||||||
enum menu_display_prim_type prim_type
|
|
||||||
);
|
|
||||||
|
|
||||||
void menu_display_matrix_4x4_rotate_z(
|
void menu_display_matrix_4x4_rotate_z(
|
||||||
math_matrix_4x4 *matrix, float rotation,
|
math_matrix_4x4 *matrix, float rotation,
|
||||||
float scale_x, float scale_y, float scale_z,
|
float scale_x, float scale_y, float scale_z,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user