Add icons instead of text for input key hint bar

This commit is contained in:
Gordon Weeks 2026-01-31 23:04:56 -08:00
parent 773b6e3bf5
commit 86f32df3ae
13 changed files with 31 additions and 35 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

View File

@ -31,16 +31,16 @@ constexpr float MIN_SUSTAIN_FALLBACK_SEC = 0.05f;
constexpr float MIN_GLYPH_DURATION_SEC = 0.1f;
const int GAMEPAD_BUTTONS[LANE_COUNT] = {
GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Left
GAMEPAD_BUTTON_LEFT_FACE_UP, // Up
GAMEPAD_BUTTON_LEFT_FACE_RIGHT, // Right
GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Down
GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // X
GAMEPAD_BUTTON_RIGHT_FACE_UP, // Y
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // B
GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // A
GAMEPAD_BUTTON_LEFT_TRIGGER_2, // LT
GAMEPAD_BUTTON_LEFT_TRIGGER_1, // LB
GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Left
GAMEPAD_BUTTON_LEFT_FACE_UP, // Up
GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Down
GAMEPAD_BUTTON_LEFT_FACE_RIGHT, // Right
GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // X
GAMEPAD_BUTTON_RIGHT_FACE_UP, // Y
GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // A
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // B
GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // RB
GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // RT
};
@ -49,6 +49,21 @@ const char* const GAMEPAD_BUTTON_LABELS[LANE_COUNT] = {
"<", "^", ">", "v", "X", "Y", "B", "A", "LT", "LB", "RB", "RT",
};
const char* const GAMEPAD_BUTTON_ICONS[LANE_COUNT] = {
"assets/ui/switch_button_zl.png",
"assets/ui/switch_button_l.png",
"assets/ui/switch_dpad_left.png",
"assets/ui/switch_dpad_up.png",
"assets/ui/switch_dpad_down.png",
"assets/ui/switch_dpad_right.png",
"assets/ui/switch_button_x.png",
"assets/ui/switch_button_y.png",
"assets/ui/switch_button_a.png",
"assets/ui/switch_button_b.png",
"assets/ui/switch_button_r.png",
"assets/ui/switch_button_zr.png",
};
constexpr int COMBO_TIER_COUNT = 20;
constexpr int COMBO_DISPLAY_THRESHOLD = 5;
constexpr int COMBO_NOTES_PER_TIER = 10;
@ -59,21 +74,6 @@ const char* const COMBO_TIER_LABELS[COMBO_TIER_COUNT] = {
"Stellar!", "Legendary!", "Epic!", "Divine!", "Godlike!",
};
const int KEY_KEYS[LANE_COUNT] = {
KEY_Q,
KEY_W,
KEY_E,
KEY_R,
KEY_A,
KEY_S,
KEY_D,
KEY_F,
KEY_Z,
KEY_X,
KEY_C,
KEY_V,
};
/* One color per track (track index % MAX_INSTRUMENT_TYPES). */
const Color INSTRUMENT_COLORS[MAX_INSTRUMENT_TYPES] = {
{220, 100, 100, 255}, // red
@ -472,10 +472,6 @@ public:
bool is_lane_pressed(int lane) const
{
if (IsKeyPressed(KEY_KEYS[lane]))
{
return true;
}
for (int i = 0; i < MAX_GAMEPADS; i++)
{
if (IsGamepadAvailable(i) && IsGamepadButtonPressed(i, GAMEPAD_BUTTONS[lane]))
@ -989,17 +985,17 @@ 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;
const float button_icon_height = 50.0f;
float button_icon_y = (upper_bar_y + hit_line_y) / 2.0f - button_icon_height / 2.0f;
auto* tex_svc = get_service<TextureService>();
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;
Texture2D& tex = tex_svc->get_texture(GAMEPAD_BUTTON_ICONS[lane]);
float scale = button_icon_height / static_cast<float>(tex.height);
float w = static_cast<float>(tex.width) * scale;
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});
DrawTextureEx(tex, {cx - w / 2.0f, button_icon_y}, 0.0f, scale,
Color{220, 220, 240, 255});
}
std::string score_text = "Score: " + std::to_string(score);