From e51ab673c5457c4b1e4ab9c4cf2d1889aeff12f2 Mon Sep 17 00:00:00 2001 From: Luka Jankovic Date: Tue, 24 Jun 2025 21:59:33 +0200 Subject: [PATCH] bar text private function --- kubo_bar.c | 9 +++++++-- kubo_bar.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kubo_bar.c b/kubo_bar.c index a1d1399..df5ad0f 100644 --- a/kubo_bar.c +++ b/kubo_bar.c @@ -18,11 +18,16 @@ #include "kubo_bar.h" +static inline int push_text(int x, int y, const char *text) { + DrawText(text, x, y, KUBO_BAR_HEIGHT, WHITE); + return x + MeasureText(text, KUBO_BAR_HEIGHT); +} + void kubo_bar_render(struct kubo_context *context) { const int bar_y = GetScreenHeight() - KUBO_BAR_HEIGHT; + int bar_text_x = 10; DrawRectangle(0, bar_y, GetScreenWidth(), KUBO_BAR_HEIGHT, BLACK); - - DrawText(kubo_context_get_label(context->state), 0, bar_y, KUBO_BAR_HEIGHT, WHITE); + bar_text_x = push_text(bar_text_x, bar_y, kubo_context_get_label(context->state)); } diff --git a/kubo_bar.h b/kubo_bar.h index 0579d2a..d2eb3b4 100644 --- a/kubo_bar.h +++ b/kubo_bar.h @@ -19,7 +19,7 @@ #ifndef KUBO_BAR_H #define KUBO_BAR_H -#define KUBO_BAR_HEIGHT 40 +#define KUBO_BAR_HEIGHT 32 #include @@ -27,4 +27,6 @@ void kubo_bar_render(struct kubo_context *context); +static inline int push_text(int x, int y, const char *text); + #endif