Bottom bar UI fixes

This commit is contained in:
Gordon Weeks 2026-01-31 18:10:16 -08:00
parent 7686391ff9
commit c279644612

View File

@ -873,13 +873,14 @@ public:
for (int lane = 0; lane < LANE_COUNT; lane++) for (int lane = 0; lane < LANE_COUNT; lane++)
{ {
float cx = lane_center_x(lane); float cx = lane_center_x(lane);
DrawLineEx(Vector2{cx, 0}, Vector2{cx, screen_height}, 2.0f, Color{70, 70, 90, 255}); DrawLineEx(Vector2{cx, 0}, Vector2{cx, upper_bar_y}, 2.0f, Color{70, 70, 90, 255});
} }
float hit_zone_height = hit_line_y - upper_bar_y;
DrawRectangle(0, DrawRectangle(0,
static_cast<int>(upper_bar_y), static_cast<int>(upper_bar_y),
static_cast<int>(screen_width), static_cast<int>(screen_width),
static_cast<int>(RECEPTOR_HEIGHT), static_cast<int>(hit_zone_height),
Color{60, 60, 100, 255}); Color{60, 60, 100, 255});
for (int lane = 0; lane < LANE_COUNT; lane++) for (int lane = 0; lane < LANE_COUNT; lane++)
{ {
@ -889,7 +890,7 @@ public:
DrawRectangle(static_cast<int>(lane * lane_width), DrawRectangle(static_cast<int>(lane * lane_width),
static_cast<int>(upper_bar_y), static_cast<int>(upper_bar_y),
static_cast<int>(lane_width), static_cast<int>(lane_width),
static_cast<int>(RECEPTOR_HEIGHT), static_cast<int>(hit_zone_height),
Color{80, 255, 120, static_cast<unsigned char>(alpha)}); Color{80, 255, 120, static_cast<unsigned char>(alpha)});
} }
else if (press_flash_timer[lane] > 0.0f) else if (press_flash_timer[lane] > 0.0f)
@ -898,25 +899,13 @@ public:
DrawRectangle(static_cast<int>(lane * lane_width), DrawRectangle(static_cast<int>(lane * lane_width),
static_cast<int>(upper_bar_y), static_cast<int>(upper_bar_y),
static_cast<int>(lane_width), static_cast<int>(lane_width),
static_cast<int>(RECEPTOR_HEIGHT), static_cast<int>(hit_zone_height),
Color{255, 255, 255, static_cast<unsigned char>(alpha)}); Color{255, 255, 255, static_cast<unsigned char>(alpha)});
} }
} }
DrawLineEx(Vector2{0, upper_bar_y}, Vector2{screen_width, upper_bar_y}, 3.0f, WHITE); DrawLineEx(Vector2{0, upper_bar_y}, Vector2{screen_width, upper_bar_y}, 3.0f, WHITE);
DrawLineEx(Vector2{0, hit_line_y}, Vector2{screen_width, hit_line_y}, 3.0f, WHITE); DrawLineEx(Vector2{0, hit_line_y}, Vector2{screen_width, hit_line_y}, 3.0f, WHITE);
const float button_label_font_size = 28.0f;
const float button_label_y = hit_line_y + 18.0f;
for (int lane = 0; lane < LANE_COUNT; lane++)
{
const char* label = GAMEPAD_BUTTON_LABELS[lane];
float label_w = MeasureTextEx(font, label, button_label_font_size, 1).x;
float cx = lane_center_x(lane);
DrawTextEx(font, label,
{cx - label_w / 2.0f, button_label_y},
button_label_font_size, 1, Color{220, 220, 240, 255});
}
const Color MISSED_GLYPH_COLOR = {140, 140, 140, 255}; const Color MISSED_GLYPH_COLOR = {140, 140, 140, 255};
std::vector<std::vector<Glyph*>> by_lane(static_cast<size_t>(LANE_COUNT)); std::vector<std::vector<Glyph*>> by_lane(static_cast<size_t>(LANE_COUNT));
for (Glyph* n : spawned) for (Glyph* n : spawned)
@ -995,6 +984,19 @@ public:
} }
} }
const float button_label_font_size = 28.0f;
float label_height = MeasureTextEx(font, "X", button_label_font_size, 1).y;
float button_label_y = (upper_bar_y + hit_line_y) / 2.0f - label_height / 2.0f;
for (int lane = 0; lane < LANE_COUNT; lane++)
{
const char* label = GAMEPAD_BUTTON_LABELS[lane];
float label_w = MeasureTextEx(font, label, button_label_font_size, 1).x;
float cx = lane_center_x(lane);
DrawTextEx(font, label,
{cx - label_w / 2.0f, button_label_y},
button_label_font_size, 1, Color{220, 220, 240, 255});
}
std::string score_text = "Score: " + std::to_string(score); std::string score_text = "Score: " + std::to_string(score);
DrawTextEx(font, score_text.c_str(), {20, 16}, 28, 1, WHITE); DrawTextEx(font, score_text.c_str(), {20, 16}, 28, 1, WHITE);