Refactored instrument select to remove confusing concept of player color.

This commit is contained in:
Gordon Weeks 2026-01-31 14:16:57 -08:00
parent 566c814162
commit e1c6f4d2f9

View File

@ -29,7 +29,6 @@ public:
}; };
static const Color BORDER_COLOR; static const Color BORDER_COLOR;
static const Color SECTION_BG_COLOR;
static constexpr const char* INSTRUMENT_IMAGE_PATHS[MAX_INSTRUMENT_TYPES] = { static constexpr const char* INSTRUMENT_IMAGE_PATHS[MAX_INSTRUMENT_TYPES] = {
"assets/instrument_0.png", "assets/instrument_0.png",
@ -140,9 +139,7 @@ public:
Vector2 right_tri[3] = {{cx, cy}, {w, h}, {w, 0}}; Vector2 right_tri[3] = {{cx, cy}, {w, h}, {w, 0}};
auto draw_wedge = [this](const Vector2* v, int slot) { auto draw_wedge = [this](const Vector2* v, int slot) {
Color fill = (instrument_owner[slot] >= 0) ? INSTRUMENT_COLORS[instrument_owner[slot]] DrawTriangle(v[0], v[1], v[2], INSTRUMENT_COLORS[slot]);
: SECTION_BG_COLOR;
DrawTriangle(v[0], v[1], v[2], fill);
}; };
draw_wedge(top_tri, SLOT_TOP); draw_wedge(top_tri, SLOT_TOP);
@ -176,10 +173,32 @@ public:
} }
}; };
draw_center_icon(cx, h / 6.0f, SLOT_TOP); const float icon_y_top = h / 6.0f;
draw_center_icon(cx, h * 5.0f / 6.0f, SLOT_BOTTOM); const float icon_y_bottom = h * 5.0f / 6.0f;
draw_center_icon(w / 6.0f, cy, SLOT_LEFT); const float icon_x_left = w / 6.0f;
draw_center_icon(w * 5.0f / 6.0f, cy, SLOT_RIGHT); const float icon_x_right = w * 5.0f / 6.0f;
draw_center_icon(cx, icon_y_top, SLOT_TOP);
draw_center_icon(cx, icon_y_bottom, SLOT_BOTTOM);
draw_center_icon(icon_x_left, cy, SLOT_LEFT);
draw_center_icon(icon_x_right, cy, SLOT_RIGHT);
const char* player_labels[4] = {"P1", "P2", "P3", "P4"};
const float label_font_size = 60.0f;
const float label_offset = 50.0f;
const float label_offset_bottom = 110.0f;
auto draw_player_label = [this, &player_labels, label_font_size, label_offset,
label_offset_bottom](float ix, float iy, int slot) {
if (instrument_owner[slot] < 0)
return;
const char* label = player_labels[instrument_owner[slot]];
float lw = MeasureTextEx(font, label, label_font_size, 1.0f).x;
float ly = (slot == SLOT_BOTTOM) ? iy - label_offset_bottom : iy + label_offset;
DrawTextEx(font, label, Vector2{ix - lw * 0.5f, ly}, label_font_size, 1.0f, WHITE);
};
draw_player_label(cx, icon_y_top, SLOT_TOP);
draw_player_label(cx, icon_y_bottom, SLOT_BOTTOM);
draw_player_label(icon_x_left, cy, SLOT_LEFT);
draw_player_label(icon_x_right, cy, SLOT_RIGHT);
bool all_selected = true; bool all_selected = true;
for (int s = 0; s < MAX_INSTRUMENT_TYPES; s++) for (int s = 0; s < MAX_INSTRUMENT_TYPES; s++)
@ -201,4 +220,3 @@ public:
}; };
inline const Color InstrumentSelectScreen::BORDER_COLOR = {45, 55, 72, 255}; inline const Color InstrumentSelectScreen::BORDER_COLOR = {45, 55, 72, 255};
inline const Color InstrumentSelectScreen::SECTION_BG_COLOR = {95, 115, 140, 255};