Share the drawing of the wide push button between the dialogs

Transfer market, pitch, lineup, bank, offer editor, advertising, manager, player card,
player detail, club info, league pairings, other games, top scorers, stadium,
training, game end and the contract tabs drew the same button frame with their own
copies. They now call draw_wide_button_frame (ui/button_frame.hpp), which a test
compares pixel for pixel with the former drawing. Buttons whose drawing differs by a
pixel (statistics rankings, team statistics, opportunities, analytics) are left alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-08 19:04:28 +01:00
1 parent 23201fa637
commit 5b845fbab3
16 files changed
+156 -150

No files matched your search

+3 -19
View File
@@ -2,6 +2,7 @@
// Implementation of TopScorersScreen (top_scorers.hpp): list and podium drawing, footer button handling including drag-off cancel, and request construction.
#include "formats/executable_layout.hpp"
#include "ui/top_scorers.hpp"
#include "ui/button_frame.hpp"
#include <algorithm>
#include <sstream>
@@ -109,25 +110,8 @@ void TopScorersScreen::draw_text(Image& out, int x, int baseline, std::string_vi
void TopScorersScreen::draw_button(Image& out, int x, int y, int width,
std::string_view original_label, bool pressed) const {
const int dx = x + (pressed ? 2 : 0), dy = y + (pressed ? 2 : 0);
if (pressed) {
const auto background = out.at(x, y + 10);
fill(out, x, y, width + 1, 2, background);
fill(out, x, y, 2, 11, background);
} else {
fill(out, x + 2, y + 10, width, 2, 0x40);
fill(out, x + width, y + 2, 2, 10, 0x40);
}
const int source_y = pressed ? 44 : 74;
copy(out, button_art_, 24, source_y, dx, dy, 31, 10);
int used = 31;
while (width - used > 20) {
const int count = std::min(8, width - used - 20);
copy(out, button_art_, 24, source_y + 10, dx + used, dy, count, 10);
used += count;
}
const int tail = width - used;
copy(out, button_art_, 45 - tail, source_y + 20, dx + used, dy, tail, 10);
const int shift = draw_wide_button_frame(out, button_art_, x, y, width, pressed);
const int dx = x + shift, dy = y + shift;
const auto label = original_to_utf8(std::string(original_label));
sprite_.draw(out, dx + width / 2 - sprite_.text_width(label) / 2, dy + 7, label,
exe_.u8(::bmh::layout::Advertising_Button_RuntimeField + uint32_t(pressed)));