From b2a5ede3349da382d3f973ccecbca277d43c98e7 Mon Sep 17 00:00:00 2001 From: Luka Jankovic Date: Tue, 24 Jun 2025 23:26:14 +0200 Subject: [PATCH] bar styling, state color --- kubo_bar.c | 9 ++++++--- kubo_bar.h | 1 + kubo_context.c | 4 ++++ kubo_context.h | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/kubo_bar.c b/kubo_bar.c index df5ad0f..0606e8b 100644 --- a/kubo_bar.c +++ b/kubo_bar.c @@ -19,7 +19,8 @@ #include "kubo_bar.h" static inline int push_text(int x, int y, const char *text) { - DrawText(text, x, y, KUBO_BAR_HEIGHT, WHITE); + DrawText(text, x, y + (KUBO_BAR_PADDING / 2), + KUBO_BAR_HEIGHT - KUBO_BAR_PADDING, WHITE); return x + MeasureText(text, KUBO_BAR_HEIGHT); } @@ -28,6 +29,8 @@ 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); - bar_text_x = push_text(bar_text_x, bar_y, kubo_context_get_label(context->state)); + DrawRectangle(0, bar_y, GetScreenWidth(), KUBO_BAR_HEIGHT, + kubo_context_get_color(context->state)); + 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 d2eb3b4..1a29d7d 100644 --- a/kubo_bar.h +++ b/kubo_bar.h @@ -20,6 +20,7 @@ #define KUBO_BAR_H #define KUBO_BAR_HEIGHT 32 +#define KUBO_BAR_PADDING 12 #include diff --git a/kubo_context.c b/kubo_context.c index d5050d3..aaebc8c 100644 --- a/kubo_context.c +++ b/kubo_context.c @@ -57,6 +57,10 @@ const char *kubo_context_get_label(enum kubo_context_state state) { return kubo_context_labels[state]; } +Color kubo_context_get_color(enum kubo_context_state state) { + return kubo_context_colors[state]; +} + struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context) { if (context->state != KUBO_CONTEXT_WALL_NEW) { diff --git a/kubo_context.h b/kubo_context.h index 4d15a07..e8826d0 100644 --- a/kubo_context.h +++ b/kubo_context.h @@ -35,6 +35,8 @@ enum kubo_context_state { static const char *kubo_context_labels[] = {"Wall New", "Wall Select"}; +static const Color kubo_context_colors[] = {BLACK, BLUE}; + struct kubo_context { bool exit_pending; struct kubo_wall_arr walls; @@ -50,6 +52,7 @@ void kubo_context_cleanup(struct kubo_context *context); void kubo_context_set_state(struct kubo_context *context, enum kubo_context_state state); const char *kubo_context_get_label(enum kubo_context_state state); +Color kubo_context_get_color(enum kubo_context_state state); struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context);