diff --git a/src/samples/ghhb_game.h b/src/samples/ghhb_game.h index d775bac..efb7519 100644 --- a/src/samples/ghhb_game.h +++ b/src/samples/ghhb_game.h @@ -873,13 +873,14 @@ public: for (int lane = 0; lane < LANE_COUNT; 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, static_cast(upper_bar_y), static_cast(screen_width), - static_cast(RECEPTOR_HEIGHT), + static_cast(hit_zone_height), Color{60, 60, 100, 255}); for (int lane = 0; lane < LANE_COUNT; lane++) { @@ -889,7 +890,7 @@ public: DrawRectangle(static_cast(lane * lane_width), static_cast(upper_bar_y), static_cast(lane_width), - static_cast(RECEPTOR_HEIGHT), + static_cast(hit_zone_height), Color{80, 255, 120, static_cast(alpha)}); } else if (press_flash_timer[lane] > 0.0f) @@ -898,25 +899,13 @@ public: DrawRectangle(static_cast(lane * lane_width), static_cast(upper_bar_y), static_cast(lane_width), - static_cast(RECEPTOR_HEIGHT), + static_cast(hit_zone_height), Color{255, 255, 255, static_cast(alpha)}); } } 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); - 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}; std::vector> by_lane(static_cast(LANE_COUNT)); 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); DrawTextEx(font, score_text.c_str(), {20, 16}, 28, 1, WHITE);