From e864733fc2cdf40881c02af09ff42538a5f8842d Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Tue, 4 Jul 2023 00:14:38 +0300 Subject: [PATCH] UI text --- src/app.c | 16 +++++++++++++--- src/rtk.c | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) 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); -- 1.7.10.4