allow text color

This commit is contained in:
jacob 2025-05-24 09:09:53 -05:00
parent f6b4e3ed35
commit 716a26e42c
3 changed files with 4 additions and 2 deletions

View File

@ -496,7 +496,7 @@ struct rect draw_text(struct gpu_cmd_buffer *cmdbuff, struct draw_text_params pa
f32 x = draw_pos.x + tg->off_x;
f32 y = draw_pos.y + tg->off_y;
struct quad quad = quad_from_rect(RECT(x, y, tg->width, tg->height));
draw_quad_texture(cmdbuff, DRAW_TEXTURE_PARAMS(.texture = params.font->texture, .clip = tg->clip, .quad = quad));
draw_quad_texture(cmdbuff, DRAW_TEXTURE_PARAMS(.texture = params.font->texture, .tint0_srgb = params.color, .tint1_srgb = params.color, .clip = tg->clip, .quad = quad));
draw_pos.x += tg->advance;
}

View File

@ -84,6 +84,7 @@ void draw_grid(struct gpu_cmd_buffer *cmdbuff, struct rect rect, u32 bg0_srgb, u
.alignment = DRAW_TEXT_ALIGNMENT_LEFT, \
.offset_x = DRAW_TEXT_OFFSET_X_LEFT, \
.offset_y = DRAW_TEXT_OFFSET_Y_TOP, \
.color = COLOR_WHITE, \
__VA_ARGS__ \
})
@ -91,6 +92,7 @@ struct draw_text_params {
struct font *font;
struct v2 pos;
f32 scale;
u32 color;
enum draw_text_alignment alignment;
enum draw_text_offset_x offset_x;
enum draw_text_offset_x offset_y;

View File

@ -1877,7 +1877,7 @@ INTERNAL void user_update(void)
//draw_text(G.ui_cmd_buffer, font, pos, string_format(temp.arena, LIT("blended world entities: %F/%F"), FMT_UINT(G.ss_blended->num_ents_allocated), FMT_UINT(G.ss_blended->num_ents_reserved)));
//draw_text(G.ui_cmd_buffer, font, pos, text);
draw_text(G.ui_cmd_buffer, DRAW_TEXT_PARAMS(.font = font, .pos = pos, .str = text, .offset_y = DRAW_TEXT_OFFSET_Y_BOTTOM));
draw_text(G.ui_cmd_buffer, DRAW_TEXT_PARAMS(.font = font, .pos = pos, .str = text, .offset_y = DRAW_TEXT_OFFSET_Y_BOTTOM, .color = COLOR_WHITE));
arena_temp_end(temp);
}