normal mode, command mode
This commit is contained in:
parent
d41e801aeb
commit
ecc8a1df95
10 changed files with 133 additions and 14 deletions
27
kubo_bar.c
27
kubo_bar.c
|
|
@ -18,19 +18,30 @@
|
|||
|
||||
#include "kubo_bar.h"
|
||||
|
||||
static inline int push_text(int x, int y, const char *text) {
|
||||
DrawText(text, x, y + (KUBO_BAR_PADDING / 2),
|
||||
KUBO_BAR_HEIGHT - KUBO_BAR_PADDING, WHITE);
|
||||
return x + MeasureText(text, KUBO_BAR_HEIGHT);
|
||||
static inline int push_text(int x, int y, const char *text, Color bg_color) {
|
||||
|
||||
int font_size = KUBO_BAR_HEIGHT - KUBO_BAR_PADDING;
|
||||
int text_width = MeasureText(text, font_size);
|
||||
|
||||
DrawRectangle(x - KUBO_BAR_PADDING, y, text_width + (2 * KUBO_BAR_PADDING),
|
||||
KUBO_BAR_HEIGHT, bg_color);
|
||||
DrawText(text, x, y + (KUBO_BAR_PADDING / 2), font_size, WHITE);
|
||||
return x + text_width;
|
||||
}
|
||||
|
||||
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,
|
||||
kubo_context_get_color(context->state));
|
||||
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));
|
||||
push_text(bar_text_x, bar_y, kubo_context_get_label(context->state),
|
||||
kubo_context_get_color(context->state));
|
||||
|
||||
bar_text_x += 2 * KUBO_BAR_PADDING;
|
||||
|
||||
if (context->state == KUBO_CONTEXT_COMMAND) {
|
||||
kubo_command_render(context, bar_text_x, bar_y + (KUBO_BAR_PADDING / 2),
|
||||
KUBO_BAR_HEIGHT - KUBO_BAR_PADDING);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue