From 28b277fbd8a8a9e1e0e190e608ff193118f5fd1f Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Mon, 29 Jun 2026 16:45:02 +0300 Subject: Add text to demo --- main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 5e54b1d..75bc451 100644 --- a/main.c +++ b/main.c @@ -18,6 +18,7 @@ int main(void) { const float k_x = 0.1; const float k_t = 0.1; size_t t = 0; + long text_x = 0, text_y = 0; while(1) { fb_fill(fb, P_RED); @@ -25,17 +26,27 @@ int main(void) { for (size_t x = 0; x < term_width; x++) { size_t y = ((sin(k_x * x + k_t * t) + 1.0) / 2 * term_height / 2) + (size_t)(term_height / 4); fb_vert_line(fb, x, y, term_height - 1, P_GREEN); - //fb.fb[y][x] = P_CYAN; } + fb_text_no_bg(fb, text_x, text_y, "testing", C_BLACK); + fb_print(fb); - if (get_input(c) != 0 && c == 'q') { break; }; + /* Handle input */ + if (get_input(c) != 0) { + switch(c) { + case 'q': goto quit; break; + case 'h': text_x -= 1; break; + case 'l': text_x += 1; break; + case 'k': text_y -= 1; break; + case 'j': text_y += 1; break; + } + }; t++; } - +quit: fb_free(&fb); term_cleanup(); } -- cgit v1.2.3