The career as a notebook: a book on a table instead of a desk with windows
After the design mock-up: a leather-bound book with a seam, a stack of sheets, markers at the left edge for nine categories and at the top edge for their pages, a paper clip, a pencil in its loop, and the whistle that kicks off. Wood, leather and paper are computed from noise and tinted by the skin. The home pages carry the cards on a grid of 8 x 5: up to five pages that can be named, cards moved by dragging, menus with the right mouse button for sizes, adding and removing. The cards are drawn anew from one model that the demo and the engine both fill. The career menus are sheets of the book for now, in their old format; the picture of a page's subject lies very faintly on the paper of every page. The status line at the foot is gone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
b2500eb7b6
commit
0d8e7b4dd4
10 files changed
+1300
-73
No files matched your search
@@ -0,0 +1,265 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// The career's notebook: a book on a wooden table instead of a desk with windows. Markers
|
||||
// at the left edge choose a category, markers at the top edge one of its pages, the whistle
|
||||
// beside the book kicks off. The open page is still `menu_`; the category follows from it.
|
||||
// Wood, leather and paper are computed once from noise and tinted by the skin.
|
||||
namespace {
|
||||
struct NotebookSection {
|
||||
const char *id, *label;
|
||||
std::vector<const char *> routes;
|
||||
};
|
||||
// Every menu of the career belongs to exactly one category (kick-off is the whistle).
|
||||
const std::vector<NotebookSection> ¬ebook_sections() {
|
||||
static const std::vector<NotebookSection> value = {
|
||||
{"home", "Hauptseite", {}},
|
||||
{"team", "Mannschaft", {"lineup", "tactics", "training", "camp", "strengths", "scorers"}},
|
||||
{"transfers", "Transfers", {"transfer", "contracts"}},
|
||||
{"club", "Verein", {"stadium", "environment", "advertising"}},
|
||||
{"finance", "Finanzen", {"balance", "bank", "toto"}},
|
||||
{"fixtures", "Spielplan", {"calendar", "league", "tables", "other", "friendlies", "postpone", "indoor"}},
|
||||
{"records", "Statistik", {"statistics", "achievements", "almanac", "fairplay", "highscore"}},
|
||||
{"inbox", "Posteingang", {"news"}},
|
||||
{"options", "Optionen", {"settings", "save", "load", "newplayer"}}};
|
||||
return value;
|
||||
}
|
||||
std::string notebook_page_label(const std::string &route) {
|
||||
static const std::map<std::string, std::string> labels = {
|
||||
{"lineup", "Aufstellung"}, {"tactics", "Taktik"}, {"training", "Training"}, {"camp", "Trainingslager"}, {"strengths", "Stärken"},
|
||||
{"scorers", "Spielerstatistik"}, {"transfer", "Transfermarkt"}, {"contracts", "Verträge"}, {"stadium", "Stadion"}, {"environment", "Umfeld"},
|
||||
{"advertising", "Werbung"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"},
|
||||
{"tables", "Tabellen"}, {"other", "Übrige Spiele"}, {"friendlies", "Testspiele"}, {"postpone", "Verlegen"}, {"indoor", "Halle"},
|
||||
{"statistics", "Statistiken"}, {"achievements", "Erfolge"}, {"almanac", "Almanach"}, {"fairplay", "Fairplay"}, {"highscore", "Highscore"},
|
||||
{"news", "Nachrichten"}, {"settings", "Einstellungen"}, {"save", "Speichern"}, {"load", "Laden"}, {"newplayer", "Manager"}};
|
||||
const auto found = labels.find(route);
|
||||
return found == labels.end() ? route : found->second;
|
||||
}
|
||||
// Value noise in [0,1] with a period, so that a texture can repeat.
|
||||
double notebook_noise(double x, double y, uint32_t seed) {
|
||||
const auto corner = [seed](int64_t ix, int64_t iy) {
|
||||
uint32_t h = uint32_t(ix) * 374761393u + uint32_t(iy) * 668265263u + seed * 2246822519u;
|
||||
h = (h ^ (h >> 13)) * 1274126177u;
|
||||
return double((h ^ (h >> 16)) & 0xffffu) / 65535.0;
|
||||
};
|
||||
const double fx = std::floor(x), fy = std::floor(y);
|
||||
const double tx = x - fx, ty = y - fy, sx = tx * tx * (3 - 2 * tx), sy = ty * ty * (3 - 2 * ty);
|
||||
const auto ix = int64_t(fx), iy = int64_t(fy);
|
||||
const double top = corner(ix, iy) + (corner(ix + 1, iy) - corner(ix, iy)) * sx, bottom = corner(ix, iy + 1) + (corner(ix + 1, iy + 1) - corner(ix, iy + 1)) * sx;
|
||||
return top + (bottom - top) * sy;
|
||||
}
|
||||
double notebook_fractal(double x, double y, uint32_t seed, int octaves) {
|
||||
double sum = 0, weight = 0, scale = 1;
|
||||
for (int o = 0; o < octaves; ++o, scale *= 2) {
|
||||
sum += notebook_noise(x * scale, y * scale, seed + uint32_t(o) * 17u) / scale;
|
||||
weight += 1 / scale;
|
||||
}
|
||||
return sum / weight;
|
||||
}
|
||||
// Capitals for a title line, German umlauts included (the style sheet's own does not know them).
|
||||
std::string notebook_upper(std::string text) {
|
||||
std::string out;
|
||||
for (size_t i = 0; i < text.size(); ++i) {
|
||||
const unsigned char c = static_cast<unsigned char>(text[i]);
|
||||
if (c == 0xc3 && i + 1 < text.size()) {
|
||||
const unsigned char d = static_cast<unsigned char>(text[i + 1]);
|
||||
out += char(c);
|
||||
out += char(d == 0xa4 || d == 0xb6 || d == 0xbc ? d - 0x20 : d);
|
||||
++i;
|
||||
} else out += char(std::toupper(c));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
struct NotebookTone { double r, g, b; };
|
||||
NotebookTone notebook_tone(const std::string &hex) {
|
||||
return {double(std::stoi(hex.substr(1, 2), nullptr, 16)), double(std::stoi(hex.substr(3, 2), nullptr, 16)), double(std::stoi(hex.substr(5, 2), nullptr, 16))};
|
||||
}
|
||||
// kind: 0 wood (boards with a long grain), 1 leather (a fine pebbled grain), 2 paper (fibres and a faint cloud)
|
||||
editor::images::Raster notebook_texture(int kind, int width, int height, const std::string &dark, const std::string &light) {
|
||||
editor::images::Raster raster;
|
||||
raster.width = width;
|
||||
raster.height = height;
|
||||
raster.pixels.resize(size_t(width) * size_t(height) * 4);
|
||||
const auto a = notebook_tone(dark), b = notebook_tone(light);
|
||||
for (int y = 0; y < height; ++y)
|
||||
for (int x = 0; x < width; ++x) {
|
||||
double t = 0.5;
|
||||
if (kind == 0) {
|
||||
const int board = y * 9 / height; // nine boards across the table
|
||||
const double within = double(y * 9 % height) / height;
|
||||
const double grain = notebook_fractal(x / 420.0 + board * 7.3, y / 5.0, 7u + uint32_t(board), 4);
|
||||
const double streak = notebook_fractal(x / 900.0, y / 60.0 + board * 3.1, 31u, 3);
|
||||
t = 0.18 + 0.5 * grain + 0.3 * streak + (board % 2 ? 0.05 : -0.04);
|
||||
if (within < 0.012 || within > 0.988) t *= 0.35; // the joint between two boards
|
||||
} else if (kind == 1) {
|
||||
const double pebble = notebook_fractal(x / 5.0, y / 5.0, 5u, 2), cloud = notebook_fractal(x / 160.0, y / 160.0, 9u, 3);
|
||||
t = 0.25 + 0.4 * pebble + 0.4 * cloud;
|
||||
} else {
|
||||
const double fibre = notebook_fractal(x / 2.2, y / 2.2, 11u, 2), cloud = notebook_fractal(x / 260.0, y / 260.0, 21u, 3);
|
||||
t = 0.55 + 0.25 * fibre + 0.3 * cloud;
|
||||
}
|
||||
t = std::clamp(t, 0.0, 1.0);
|
||||
const size_t at = (size_t(y) * size_t(width) + size_t(x)) * 4;
|
||||
raster.pixels[at] = uint8_t(a.r + (b.r - a.r) * t);
|
||||
raster.pixels[at + 1] = uint8_t(a.g + (b.g - a.g) * t);
|
||||
raster.pixels[at + 2] = uint8_t(a.b + (b.b - a.b) * t);
|
||||
raster.pixels[at + 3] = 255;
|
||||
}
|
||||
return raster;
|
||||
}
|
||||
// The colours of the three materials for a skin: {wood dark, wood light, leather dark, leather light, paper dark, paper light}
|
||||
std::array<const char *, 6> notebook_materials(const std::string &theme) {
|
||||
if (theme == "midnight") return {"#0b1016", "#1d2833", "#131b24", "#2a3a4a", "#232d38", "#2f3b48"};
|
||||
if (theme == "matchday") return {"#120c0e", "#2b1a1d", "#2a1216", "#5a262c", "#2a2326", "#383033"};
|
||||
return {"#3a1f0e", "#7a4a26", "#4a2710", "#93531f", "#ecdfc8", "#f9f1e2"};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// Where the 2160 high book lies on a stage that may be taller than that.
|
||||
double App::notebook_top() const { return std::max(0.0, (desktop_height() - 2160) / 2.0); }
|
||||
|
||||
// The category a page belongs to; the home section when no page is open.
|
||||
std::string App::notebook_section_of(const std::string &route) const {
|
||||
for (const auto §ion : notebook_sections())
|
||||
for (const char *r : section.routes)
|
||||
if (route == r) return section.id;
|
||||
return "home";
|
||||
}
|
||||
|
||||
// The book with its markers, after the design's proportions: 1 design unit = 2.25 dp, the
|
||||
// book 1406 x 866 units at (150, 62). `enabled` tells which pages can be opened now; `head`
|
||||
// is the markup at the right of the page's head (day, next match, cash).
|
||||
std::string App::notebook_shell(const std::function<bool(const std::string &)> &enabled, const std::string &head) {
|
||||
const auto materials = notebook_materials(theme_);
|
||||
const auto wood = renderer_.texture("nb-wood", theme_, [&] { return notebook_texture(0, 1280, 720, materials[0], materials[1]); });
|
||||
const auto leather = renderer_.texture("nb-leather", theme_, [&] { return notebook_texture(1, 1100, 680, materials[2], materials[3]); });
|
||||
const auto paper = renderer_.texture("nb-paper", theme_, [&] { return notebook_texture(2, 1054, 650, materials[4], materials[5]); });
|
||||
const bool light = theme_ == "silver";
|
||||
const double stage = desktop_height(), top = notebook_top();
|
||||
const auto active = notebook_section_of(menu_);
|
||||
const auto open = [&](const std::string &route, const std::string &label, const std::string &css, const std::string &attrs, bool on) {
|
||||
return btn(engine_mode_ ? std::string("engine-open") : "open:" + route, label, css, attrs + " data-id=\"" + route + "\"" + (on ? "" : " disabled=\"disabled\""));
|
||||
};
|
||||
const auto svg = [&](const std::string &slot, double w, double h, const std::string &body, int pixels) {
|
||||
return picture(renderer_.diagram(slot + "-" + theme_, "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 " + scalar(w) + " " + scalar(h) + "\">" + body + "</svg>", pixels), w * 2.25, h * 2.25);
|
||||
};
|
||||
// the skin's inks (the light skin carries the design's terracotta and sage)
|
||||
const std::string stitch = light ? "#f6a06b" : theme_ == "matchday" ? "#c9584f" : "#7fa3bd", rule = light ? "#e1eecc" : "#ffffff", margin = light ? "#ffc6a5" : theme_ == "matchday" ? "#c9584f" : "#7fa3bd",
|
||||
ring = light ? "#8c491a" : "#ffffff", ribbon_a = light ? "#b2622d" : stitch, ribbon_b = light ? "#d67f48" : stitch;
|
||||
std::string out = "<div class=\"nb-table\" style=\"height:" + scalar(stage) + "dp;\">" + picture(wood, 3840, stage, true) + "<div class=\"nb-table-light\" style=\"height:" + scalar(stage) + "dp;\"></div></div><div class=\"nb-book" + std::string(menu_.empty() ? "" : " legacy") + "\" id=\"notebook\" style=\"top:" + scalar(top) + "dp;\">";
|
||||
// the leather cover with its seam, the ribbon, the stack of sheets
|
||||
out += "<div class=\"nb-cover-shadow\"></div><div class=\"nb-cover\">" + picture(leather, 3281, 2070, true) + "<div class=\"nb-cover-tone\"></div><div class=\"nb-seam\">" +
|
||||
svg("nb-seam", 1440, 902, "<rect x=\"3\" y=\"3\" width=\"1434\" height=\"896\" rx=\"26\" fill=\"none\" stroke=\"" + stitch + "\" stroke-opacity=\".6\" stroke-width=\"2\" stroke-dasharray=\"9 7\"/>", 2400) + "</div></div>";
|
||||
out += "<div class=\"nb-ribbon\">" + svg("nb-ribbon", 20, 96, "<defs><linearGradient id=\"r\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\"><stop offset=\"0\" stop-color=\"" + ribbon_a + "\"/><stop offset=\".5\" stop-color=\"" + ribbon_b +
|
||||
"\"/><stop offset=\"1\" stop-color=\"" + ribbon_a + "\"/></linearGradient></defs><path d=\"M0 0H20V96L10 83L0 96Z\" fill=\"url(#r)\"/>", 200) + "</div>";
|
||||
for (int sheet = 4; sheet >= 0; --sheet) out += "<div class=\"nb-stack s" + std::to_string(sheet) + "\"></div>";
|
||||
// the categories: markers that stick out at the left edge
|
||||
static constexpr std::array<const char *, 9> tones{"a3", "s3", "a2", "s4", "a4", "n3", "s2", "a5", "s5"};
|
||||
static constexpr std::array<double, 9> turns{-1.5, 1, -0.5, 2, -2, 0.5, 1.5, -1, 0};
|
||||
static constexpr std::array<int, 9> rest{11, 18, 9, 16, 20, 10, 15, 19, 9};
|
||||
size_t index = 0;
|
||||
for (const auto §ion : notebook_sections()) {
|
||||
const bool here = active == section.id;
|
||||
std::string first;
|
||||
for (const char *r : section.routes)
|
||||
if (first.empty() && enabled(r)) first = r;
|
||||
const std::string label = "<span class=\"nb-tab-face tone-" + std::string(tones[index % tones.size()]) + "\"></span><span class=\"nb-tab-label\">" + std::string(section.label) + "</span>";
|
||||
const std::string css = std::string("nb-tab") + (here ? " active" : "");
|
||||
const std::string attrs = "id=\"tab-" + std::string(section.id) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"top:" + scalar(265.5 + index * 186.0) + "dp;transform:translateX(" +
|
||||
(here ? std::string("-27") : std::to_string(rest[index % rest.size()])) + "dp) rotate(" + scalar(turns[index % turns.size()]) + "deg);\"";
|
||||
if (section.routes.empty()) out += btn("close", label, css, attrs);
|
||||
else if (here) out += open(menu_, label, css, attrs, true);
|
||||
else out += open(first, label, css, attrs, !first.empty());
|
||||
++index;
|
||||
}
|
||||
// the pages of the open category: markers along the top edge
|
||||
std::string kicker = "Hauptseite · 1 / 1", heading = "Übersicht";
|
||||
out += "<div class=\"nb-subs\">";
|
||||
static constexpr std::array<const char *, 7> sub_tones{"s3", "a2", "s2", "a3", "n3", "s4", "a4"};
|
||||
static constexpr std::array<double, 7> sub_turns{-1, 1.5, -0.5, 1, -1.5, 0.5, -1};
|
||||
static constexpr std::array<int, 7> sub_rest{10, 14, 6, 12, 8, 13, 7};
|
||||
for (const auto §ion : notebook_sections()) {
|
||||
if (active != section.id) continue;
|
||||
if (section.routes.empty()) {
|
||||
// the home pages: the player's own, and a marker to add one
|
||||
const auto &pages = notebook_pages().at("pages");
|
||||
for (size_t p = 0; p < pages.size(); ++p) {
|
||||
const bool here = int(p) == home_page_;
|
||||
const auto name = pages[p].at("name").get<std::string>();
|
||||
if (here) {
|
||||
kicker = "Hauptseite · " + std::to_string(p + 1) + " / " + std::to_string(pages.size());
|
||||
heading = name;
|
||||
}
|
||||
out += btn("home-do", "<span class=\"nb-sub-face tone-" + std::string(sub_tones[p % sub_tones.size()]) + "\"></span><span class=\"nb-sub-number\">" + std::to_string(p + 1) + "</span><span class=\"nb-sub-label\">" + esc(name) + "</span>",
|
||||
std::string("nb-sub") + (here ? " active" : ""),
|
||||
"id=\"page-home-" + std::to_string(p) + "\" data-id=\"page:" + std::to_string(p) + "\" data-index=\"" + std::to_string(p) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"transform:translateY(" +
|
||||
(here ? std::string("-13") : std::to_string(sub_rest[p % sub_rest.size()])) + "dp) rotate(" + scalar(sub_turns[p % sub_turns.size()]) + "deg);\"");
|
||||
}
|
||||
if (pages.size() < 5)
|
||||
out += btn("home-do", "<span class=\"nb-sub-face tone-n3\"></span><span class=\"nb-sub-number\">+</span>", "nb-sub add", "id=\"page-home-add\" data-id=\"new\" aria-label=\"Neue Seite\" style=\"transform:translateY(16dp) rotate(1deg);\"");
|
||||
}
|
||||
size_t n = 0;
|
||||
for (const char *r : section.routes) {
|
||||
const bool here = menu_ == r;
|
||||
if (here) {
|
||||
kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size());
|
||||
heading = notebook_page_label(r);
|
||||
}
|
||||
out += open(r, "<span class=\"nb-sub-face tone-" + std::string(sub_tones[n % sub_tones.size()]) + "\"></span><span class=\"nb-sub-number\">" + std::to_string(n + 1) + "</span><span class=\"nb-sub-label\">" + notebook_page_label(r) + "</span>",
|
||||
std::string("nb-sub") + (here ? " active" : ""),
|
||||
"id=\"page-" + std::string(r) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"transform:translateY(" + (here ? std::string("-13") : std::to_string(sub_rest[n % sub_rest.size()])) + "dp) rotate(" +
|
||||
scalar(sub_turns[n % sub_turns.size()]) + "deg);\"",
|
||||
enabled(r));
|
||||
++n;
|
||||
}
|
||||
}
|
||||
out += "</div>";
|
||||
// the page: paper, the picture of its subject, ruled lines with a margin, two rings left by a cup, a turned corner
|
||||
std::string lines;
|
||||
for (double y = 44; y < 850; y += 32) lines += "<path d=\"M10 " + scalar(y) + "H1396\" stroke=\"" + rule + "\" stroke-opacity=\"" + (light ? "1" : ".08") + "\" stroke-width=\"1.2\"/>";
|
||||
lines += "<path d=\"M66 8V858\" stroke=\"" + margin + "\" stroke-opacity=\"" + (light ? "1" : ".4") + "\" stroke-width=\"2\"/>";
|
||||
lines += "<g fill=\"none\" stroke=\"" + ring + "\"><path d=\"M1183 800A61 61 0 1 1 1257 786\" stroke-width=\"6\" stroke-opacity=\".13\" stroke-linecap=\"round\"/><path d=\"M1200 720A58 58 0 1 0 1290 716\" stroke-width=\"2\" stroke-opacity=\".1\"/></g>";
|
||||
out += "<div class=\"nb-paper\">" + picture(paper, 3163.5, 1948.5, true) + "<div class=\"nb-paper-edge\"></div>";
|
||||
if (const auto art = notebook_art(); !art.token.empty()) out += "<div class=\"nb-paper-art\">" + picture(art, 3163.5, 1948.5, true) + "</div>";
|
||||
out += "<div class=\"nb-paper-lines\">" + svg("nb-lines", 1406, 866, lines, 2800) + "</div><div class=\"nb-corner\">" +
|
||||
svg("nb-corner", 62, 62, "<defs><linearGradient id=\"c\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\"><stop offset=\"0\" stop-color=\"" + std::string(light ? "#f9f4ed" : "#3a4654") + "\"/><stop offset=\".46\" stop-color=\"" +
|
||||
std::string(light ? "#eee7db" : "#313c49") + "\"/><stop offset=\".5\" stop-color=\"" + std::string(light ? "#a19786" : "#10151b") + "\"/><stop offset=\".62\" stop-color=\"" + std::string(light ? "#dcd3c4" : "#27313c") +
|
||||
"\"/><stop offset=\"1\" stop-color=\"" + std::string(light ? "#eee7db" : "#2c3743") + "\"/></linearGradient></defs><path d=\"M4 0H62V34A28 28 0 0 1 34 62H0V4A4 4 0 0 1 4 0Z\" fill=\"url(#c)\"/>", 200) + "</div></div>";
|
||||
out += "<div class=\"nb-heading\"><small>" + esc(notebook_upper(kicker)) + "</small><strong>" + esc(heading) + "</strong></div><div class=\"nb-head\">" + head + "</div>";
|
||||
// a paper clip at the top edge, a pencil in its loop at the right edge
|
||||
out += "<div class=\"nb-clip\">" + svg("nb-clip", 30, 72, "<g fill=\"none\" stroke-linecap=\"round\"><rect x=\"4\" y=\"4\" width=\"22\" height=\"64\" rx=\"11\" stroke=\"#a19786\" stroke-width=\"3\"/><rect x=\"9\" y=\"18\" width=\"12\" height=\"42\" rx=\"6\" stroke=\"#c0b6a5\" stroke-width=\"3\"/></g>", 240) + "</div>";
|
||||
out += "<div class=\"nb-pencil\">" + svg("nb-pencil", 16, 430,
|
||||
"<defs><linearGradient id=\"e\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\"><stop offset=\"0\" stop-color=\"#f6a06b\"/><stop offset=\".45\" stop-color=\"#ffc6a5\"/><stop offset=\"1\" stop-color=\"#d67f48\"/></linearGradient>"
|
||||
"<linearGradient id=\"m\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\"><stop offset=\"0\" stop-color=\"#a19786\"/><stop offset=\".45\" stop-color=\"#eee7db\"/><stop offset=\"1\" stop-color=\"#82796a\"/></linearGradient></defs>"
|
||||
"<path d=\"M0 7A7 7 0 0 1 7 0H9A7 7 0 0 1 16 7V22H0Z\" fill=\"url(#e)\"/><rect x=\"0\" y=\"22\" width=\"16\" height=\"18\" fill=\"url(#m)\"/><path d=\"M0 26H16M0 31H16M0 36H16\" stroke=\"#2e2b25\" stroke-opacity=\".25\"/>"
|
||||
"<rect x=\"0\" y=\"40\" width=\"3.5\" height=\"360\" fill=\"#56633f\"/><rect x=\"3.5\" y=\"40\" width=\"6.4\" height=\"360\" fill=\"#8fa073\"/><rect x=\"9.9\" y=\"40\" width=\"6.1\" height=\"360\" fill=\"#728157\"/>"
|
||||
"<path d=\"M0 400H16L8 430Z\" fill=\"#ffe1d0\"/><path d=\"M5.3 420H10.7L8 430Z\" fill=\"#2e2b25\"/>", 900) + "</div><div class=\"nb-loop\"></div>";
|
||||
// the whistle beside the book kicks off
|
||||
const std::string whistle =
|
||||
"<defs><linearGradient id=\"t\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#f6a06b\"/><stop offset=\".45\" stop-color=\"#d67f48\"/><stop offset=\"1\" stop-color=\"#8c491a\"/></linearGradient>"
|
||||
"<radialGradient id=\"b\" cx=\".36\" cy=\".3\" r=\".8\"><stop offset=\"0\" stop-color=\"#ffc6a5\"/><stop offset=\".38\" stop-color=\"#d67f48\"/><stop offset=\"1\" stop-color=\"#8c491a\"/></radialGradient>"
|
||||
"<radialGradient id=\"d\" cx=\".7\" cy=\".75\" r=\".6\"><stop offset=\"0\" stop-color=\"#402310\" stop-opacity=\".5\"/><stop offset=\"1\" stop-color=\"#402310\" stop-opacity=\"0\"/></radialGradient></defs>"
|
||||
"<circle cx=\"335\" cy=\"147\" r=\"115\" fill=\"none\" stroke=\"#2e2b25\" stroke-opacity=\".3\" stroke-width=\"9\"/><circle cx=\"330\" cy=\"140\" r=\"115\" fill=\"none\" stroke=\"#56633f\" stroke-width=\"7\"/>"
|
||||
"<g transform=\"translate(5 9)\" fill=\"#2e2b25\" fill-opacity=\".32\"><path d=\"M8 41L140 34V84L8 77Z\"/><circle cx=\"158\" cy=\"82\" r=\"62\"/></g>"
|
||||
"<path d=\"M8 41L140 34V84L8 77Z\" fill=\"url(#t)\"/><circle cx=\"158\" cy=\"82\" r=\"62\" fill=\"url(#b)\"/><circle cx=\"158\" cy=\"82\" r=\"62\" fill=\"url(#d)\"/>"
|
||||
"<rect x=\"90\" y=\"30\" width=\"32\" height=\"16\" rx=\"5\" fill=\"#2e2b25\"/><circle cx=\"158\" cy=\"82\" r=\"28\" fill=\"none\" stroke=\"#643312\" stroke-opacity=\".45\" stroke-width=\"3\"/>"
|
||||
"<ellipse cx=\"142\" cy=\"47\" rx=\"18\" ry=\"7\" fill=\"#f9f4ed\" fill-opacity=\".5\" transform=\"rotate(-28 142 47)\"/><circle cx=\"226\" cy=\"84\" r=\"18\" fill=\"none\" stroke=\"#82796a\" stroke-width=\"7\"/><circle cx=\"226\" cy=\"84\" r=\"18\" fill=\"none\" stroke=\"#c0b6a5\" stroke-width=\"4\"/>";
|
||||
out += btn(engine_mode_ ? std::string("engine-open") : std::string("open:kickoff"),
|
||||
"<span class=\"nb-whistle-art\">" + picture(renderer_.diagram("nb-whistle", "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 450 262\">" + whistle + "</svg>", 1300), 810, 471) + "</span>", "nb-whistle",
|
||||
"id=\"object-app-kickoff\" data-id=\"kickoff\" aria-label=\"Anstoß\"" + std::string(enabled("kickoff") ? "" : " disabled=\"disabled\""));
|
||||
return out + "</div>";
|
||||
}
|
||||
|
||||
// The picture of the open page's subject (see window_art), for the whole sheet.
|
||||
Picture App::notebook_art() {
|
||||
static const std::map<std::string, std::string> motifs{
|
||||
{"stadium", "seats"}, {"advertising", "boards"}, {"calendar", "bench"}, {"postpone", "bench"}, {"friendlies", "bench"}, {"camp", "training"},
|
||||
{"almanac", "trophies"}, {"achievements", "trophies"}, {"highscore", "trophies"}, {"news", "press"}, {"newplayer", "press"}, {"settings", "press"}, {"environment", "fans"}, {"training", "training"},
|
||||
{"lineup", "bench"}, {"tactics", "bench"}, {"contracts", "locker"}, {"transfer", "press"},
|
||||
{"tables", "stand"}, {"league", "stand"}, {"other", "stand"}, {"strengths", "stand"}, {"statistics", "kickoff"},
|
||||
{"scorers", "kickoff"}, {"fairplay", "kickoff"}};
|
||||
const auto found = motifs.find(menu_.empty() ? std::string("statistics") : menu_);
|
||||
for (const std::string motif : {found == motifs.end() ? std::string("ball") : found->second, std::string("ball")}) {
|
||||
const auto art = renderer_.image("art.paper-" + motif + ".png", false, 2048);
|
||||
if (!art.token.empty() && art.width > 0 && art.height > 0) return art;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
Reference in new issue
Block a user