Port statistics and the news tablet to the Modern UI (by Codex)
This commit is contained in:
1 parent
349c416f3a
commit
a45217c362
32 files changed
+2493
-23
No files matched your search
@@ -80,6 +80,15 @@ void centered_text(Rml::Element &text_root, Rml::Element &control,
|
||||
text_centers(text_root, p.x + s.x / 2, p.y + s.y / 2, horizontal, lines);
|
||||
require(lines == 1, "A control label disappeared or wrapped");
|
||||
}
|
||||
size_t visible_text_lines(Rml::Element &node) {
|
||||
size_t count = 0;
|
||||
if (auto *text = dynamic_cast<Rml::ElementText *>(&node))
|
||||
for (const auto &line : text->GetLines())
|
||||
if (!line.text.empty() && line.width > 0) ++count;
|
||||
for (int i = 0; i < node.GetNumChildren(); ++i)
|
||||
count += visible_text_lines(*node.GetChild(i));
|
||||
return count;
|
||||
}
|
||||
} // namespace
|
||||
int main(int argc, char **argv) try {
|
||||
require(argc == 2, "Pass the Modern asset directory");
|
||||
@@ -97,10 +106,14 @@ int main(int argc, char **argv) try {
|
||||
Rml::Style::FontStyle::Normal,
|
||||
Rml::Style::FontWeight::Bold),
|
||||
"Bold font missing");
|
||||
require(Rml::LoadFontFace((root / "LatoLatin-BoldItalic.ttf").string(), "Modern",
|
||||
Rml::Style::FontStyle::Italic,
|
||||
Rml::Style::FontWeight::Bold),
|
||||
"Bold italic font missing");
|
||||
std::ostringstream css;
|
||||
for (const auto *name : {"theme.rcss", "ticket.rcss", "sports.rcss",
|
||||
"calendar.rcss", "reports.rcss", "report_details.rcss",
|
||||
"report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss"}) {
|
||||
"report_pickers.rcss", "indoor.rcss", "planning.rcss", "almanac.rcss", "finance.rcss", "bank.rcss", "contracts.rcss", "amount.rcss", "environment.rcss", "advertising.rcss", "toto.rcss", "lineup.rcss", "transfer.rcss", "career_reports.rcss", "rankings.rcss", "stadium.rcss", "statistics.rcss", "news.rcss"}) {
|
||||
std::ifstream input(root / name);
|
||||
require(bool(input), "Production stylesheet missing");
|
||||
css << input.rdbuf() << '\n';
|
||||
@@ -138,6 +151,24 @@ int main(int argc, char **argv) try {
|
||||
"id='rich' "
|
||||
"style='position:absolute;left:700dp;top:40dp;width:250dp;height:"
|
||||
"260dp;' ");
|
||||
content +=
|
||||
"<div style='position:absolute;left:1200dp;top:40dp;width:1294dp;height:94dp;'>" +
|
||||
button_markup("statistics-absolute", "<span id='stats-scale-label' class='statistics-cell-text'>REL.</span>",
|
||||
"statistics-action statistics-absolute", "style='left:0;top:0;width:100%;height:94dp;'") + "</div>" +
|
||||
"<div class='statistics-cell statistics-col-0' style='position:absolute;left:1200dp;top:160dp;width:1000dp;height:80dp;'>" +
|
||||
button_markup("player-detail", "<span id='stats-player-label' class='statistics-cell-text'>Synthetic player</span>",
|
||||
"statistics-player-link") + "</div>" +
|
||||
"<div class='statistics-cell statistics-col-0' style='position:absolute;left:1200dp;top:260dp;width:1000dp;height:80dp;'>" +
|
||||
button_markup("statistics-trophy", "<span class='statistics-world-trophy-art'></span><span id='stats-world-label' class='statistics-cell-text'>WM 2098</span>",
|
||||
"statistics-world-trophy") + "</div>" +
|
||||
"<div style='position:absolute;left:2300dp;top:160dp;width:1000dp;height:80dp;'>" +
|
||||
button_markup("club-detail", "<span id='stats-from-label' class='report-club-name'>Synthetic source club</span><span style='width:42dp;height:42dp;'></span>",
|
||||
"report-club-button statistics-club name-first") + "</div>" +
|
||||
"<span id='news-brand-test' class='news-wordmark' style='position:absolute;left:2700dp;top:280dp;'>kicker</span>" +
|
||||
"<div class='statistics-trophy-winner' style='left:2700dp;top:430dp;width:900dp;height:100dp;font-size:70dp;'>" +
|
||||
"<div class='image-frame' style='width:100dp;height:100dp;'></div><span id='stats-winner-label'>Sample winner</span></div>" +
|
||||
button_markup("statistics-curve", "<span class='statistics-series-dot'></span><span id='stats-legend-label' class='statistics-series-label'>Mannschaftsstärke</span>",
|
||||
"statistics-action statistics-series-button", "style='left:2700dp;top:580dp;width:836dp;height:82dp;'");
|
||||
content +=
|
||||
"<div "
|
||||
"style='position:absolute;left:40dp;top:400dp;width:2608dp;height:"
|
||||
@@ -165,6 +196,11 @@ int main(int argc, char **argv) try {
|
||||
context->Render();
|
||||
}
|
||||
require(!center_selects(*doc), "Control centering does not settle");
|
||||
for (const auto *id : {"stats-scale-label", "stats-legend-label", "stats-player-label", "stats-world-label", "stats-from-label", "stats-winner-label", "news-brand-test"}) {
|
||||
auto *label = doc->GetElementById(id);
|
||||
require(label && label->GetBox().GetSize(Rml::BoxArea::Content).x > 0 && visible_text_lines(*label) > 0,
|
||||
"A production statistics/news label has collapsed or lost its font face");
|
||||
}
|
||||
for (const auto *id : {"step", "region", "footer"}) {
|
||||
auto *button = doc->GetElementById(id);
|
||||
require(button, "Button missing");
|
||||
|
||||
Reference in new issue
Block a user