bar styling, state color
This commit is contained in:
parent
10d243055d
commit
b2a5ede334
4 changed files with 14 additions and 3 deletions
|
|
@ -19,7 +19,8 @@
|
||||||
#include "kubo_bar.h"
|
#include "kubo_bar.h"
|
||||||
|
|
||||||
static inline int push_text(int x, int y, const char *text) {
|
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);
|
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;
|
const int bar_y = GetScreenHeight() - KUBO_BAR_HEIGHT;
|
||||||
int bar_text_x = 10;
|
int bar_text_x = 10;
|
||||||
|
|
||||||
DrawRectangle(0, bar_y, GetScreenWidth(), KUBO_BAR_HEIGHT, BLACK);
|
DrawRectangle(0, bar_y, GetScreenWidth(), KUBO_BAR_HEIGHT,
|
||||||
bar_text_x = push_text(bar_text_x, bar_y, kubo_context_get_label(context->state));
|
kubo_context_get_color(context->state));
|
||||||
|
bar_text_x =
|
||||||
|
push_text(bar_text_x, bar_y, kubo_context_get_label(context->state));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#define KUBO_BAR_H
|
#define KUBO_BAR_H
|
||||||
|
|
||||||
#define KUBO_BAR_HEIGHT 32
|
#define KUBO_BAR_HEIGHT 32
|
||||||
|
#define KUBO_BAR_PADDING 12
|
||||||
|
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,10 @@ const char *kubo_context_get_label(enum kubo_context_state state) {
|
||||||
return kubo_context_labels[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) {
|
struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context) {
|
||||||
|
|
||||||
if (context->state != KUBO_CONTEXT_WALL_NEW) {
|
if (context->state != KUBO_CONTEXT_WALL_NEW) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ enum kubo_context_state {
|
||||||
|
|
||||||
static const char *kubo_context_labels[] = {"Wall New", "Wall Select"};
|
static const char *kubo_context_labels[] = {"Wall New", "Wall Select"};
|
||||||
|
|
||||||
|
static const Color kubo_context_colors[] = {BLACK, BLUE};
|
||||||
|
|
||||||
struct kubo_context {
|
struct kubo_context {
|
||||||
bool exit_pending;
|
bool exit_pending;
|
||||||
struct kubo_wall_arr walls;
|
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,
|
void kubo_context_set_state(struct kubo_context *context,
|
||||||
enum kubo_context_state state);
|
enum kubo_context_state state);
|
||||||
const char *kubo_context_get_label(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);
|
struct kubo_wall *kubo_context_get_pending_wall(struct kubo_context *context);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue