bar text private function

This commit is contained in:
Luka Jankovic 2025-06-24 21:59:33 +02:00
parent 7160e10228
commit e51ab673c5
2 changed files with 10 additions and 3 deletions

View file

@ -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));
}

View file

@ -19,7 +19,7 @@
#ifndef KUBO_BAR_H
#define KUBO_BAR_H
#define KUBO_BAR_HEIGHT 40
#define KUBO_BAR_HEIGHT 32
#include <raylib.h>
@ -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