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