From: John Tsiombikas Date: Mon, 3 Jul 2023 21:14:38 +0000 (+0300) Subject: UI text X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=e864733fc2cdf40881c02af09ff42538a5f8842d;p=retroray UI text --- diff --git a/src/app.c b/src/app.c index d62ef60..a79777f 100644 --- a/src/app.c +++ b/src/app.c @@ -326,11 +326,21 @@ static void gui_blit(int x, int y, rtk_icon *icon) static void gui_drawtext(int x, int y, const char *str) { + use_font(uifont); + dtx_position(x, y); + dtx_color(0, 0, 0, 1); + dtx_string(str); } static void gui_textrect(const char *str, rtk_rect *rect) { - rect->x = rect->y = 0; - rect->width = 20; - rect->height = 10;/* TODO */ + struct dtx_box dbox; + + use_font(uifont); + dtx_string_box(str, &dbox); + + rect->x = dbox.x; + rect->y = dbox.y; + rect->width = dbox.width; + rect->height = dbox.height; } diff --git a/src/rtk.c b/src/rtk.c index 4049f88..fe1c649 100644 --- a/src/rtk.c +++ b/src/rtk.c @@ -687,6 +687,8 @@ static void draw_window(rtk_widget *w) tbrect.width -= 2; tbrect.height -= 2; gfx.fill(&tbrect, COL_WINFRM); + + gfx.drawtext(tbrect.x, tbrect.y + tbrect.height - 1, w->any.text); } gfx.fill(&rect, COL_BG);