Paper windows, a display serif and chalk hand, a symmetric tactics board, the match day as a stage

- Material: menu windows are sheets of paper (warm surface, edge, two sheets beneath,
  serif headings) that slide in once when their menu opens; the desk stays glass.
  Source Serif 4 and Cabin Sketch ship in assets/modern/fonts (SIL OFL, see
  THIRD_PARTY_NOTICES.md); system fonts remain the fallback.
- Tactics board: 320 x 200 units mirrored about its middle - the pitch of the
  attitude on the left, six equal tiles for the play settings on the right with
  their names in chalk, the commitment with a scale across the foot.
- Live match: a 4:3 sheet like the menus (same window zoom) on the darkened stadium.
  One score board per match of a human manager - a full-width card for one match,
  two side by side, a 2 x 2 grid for three or four - with crests, a score plate in
  the clubs' colours (read from the crests), a clock ring, a pressure bar, and a
  time line of goals, cards and injuries. Compact ticker rows with a mark per kind,
  a goal banner on the card, a horizontal speed control, and optional halts at half
  time and when falling behind.
- QA: script command demo-start begins a demo career with 1-4 managers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 16:15:11 +01:00
1 parent 54fef90a5b
commit 9b5d448fb6
21 files changed
+887 -125

No files matched your search

+2
View File
@@ -13,6 +13,8 @@ OpenBMH's own code and documentation use GPL-3.0-only. This does not replace the
| [RmlUi](https://github.com/mikke89/RmlUi/tree/6.3) | 6.3, Core and SDL2/OpenGL backend | MIT | [RmlUi.txt](docs/licenses/RmlUi.txt), [containers](docs/licenses/RmlUi-containers.txt), [Khronos notice](docs/licenses/RmlUi-Khronos.txt) |
| [FreeType](https://github.com/freetype/freetype/tree/VER-2-13-3) | 2.13.3 | FreeType License (FTL) | [license choices](docs/licenses/FreeType.txt), [FTL](docs/licenses/FreeType-FTL.txt), [BDF](docs/licenses/FreeType-BDF.txt), [PCF](docs/licenses/FreeType-PCF.txt), [internal gzip/zlib](docs/licenses/FreeType-zlib.txt) |
| LatoLatin Regular and Bold | Unmodified fonts included with RmlUi 6.3 | SIL Open Font License 1.1 | [font notices](docs/licenses/RmlUi-fonts.txt) |
| [Source Serif 4](https://github.com/adobe-fonts/source-serif) Regular and Semibold | Unmodified static TrueType files of the `release` branch, in `assets/modern/fonts` | SIL Open Font License 1.1 | [license](docs/licenses/SourceSerif4.txt) |
| [Cabin Sketch](https://github.com/google/fonts/tree/main/ofl/cabinsketch) Regular and Bold | Unmodified files, in `assets/modern/fonts` | SIL Open Font License 1.1 | [license](docs/licenses/CabinSketch.txt) |
| nlohmann/json (optional editor) | 3.12.0 | MIT | [notice](docs/licenses/nlohmann-json.txt) |
| cpp-httplib (optional editor) | 0.63.0, local HTTP without TLS | MIT | [notice](docs/licenses/cpp-httplib.txt) |
| SDL2_image (optional editor) | 2.8.8, selected static codecs | zlib | [notice](docs/licenses/SDL2_image.txt) |
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2011 The Cabin Project Authors (impallari@gmail.com), with Reserved Font Name "Cabin", "Cabin Sketch".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
@@ -0,0 +1,93 @@
Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
+108
View File
@@ -127,3 +127,111 @@ body.matchday {--live-bg:#242426;--live-surface:#302f34ec;--live-wash:#efc7ce0a;
.live-lineup-side h3 {display:block;font-size:34dp;font-weight:normal;color:var(--live-accent);margin-bottom:14dp;}
.live-lineup-side p {display:block;font-size:30dp;color:var(--live-muted);}
.live-lineup-row {height:62dp;display:flex;gap:16dp;align-items:center;border-bottom:2dp var(--live-line);font-size:32dp;}
/* --- The match day as a sheet in the menus' 4:3 format: a stage of score boards on top
(one card per match of a human manager: 1, 2, or a 2 x 2 grid for 3-4), the ticker and
the manager's squad below, the controls at the foot. --- */
.live-backdrop {position:absolute;left:0;top:0;width:3840dp;height:2160dp;background-color:#05090dc4;}
.live-stage {left:560dp;top:60dp;width:2720dp;height:2040dp;overflow:hidden;border:2dp var(--paper-edge);border-radius:10dp;background-color:transparent;decorator:linear-gradient(175deg,var(--paper-top),var(--paper-bottom));box-shadow:0dp 18dp 54dp var(--paper-shadow);font-size:36dp;}
.live-header {left:48dp;right:48dp;top:0;height:104dp;border-bottom:2dp var(--rule);}
.live-header h1 {font-family:Display;font-size:54dp;flex:1;min-width:0;}
.live-demo-tag {border-radius:10dp;padding:10dp 22dp;}
.live-body {left:48dp;right:48dp;top:128dp;bottom:150dp;height:auto;flex-direction:column;gap:28dp;}
.live-cards {padding:0;display:flex;flex-wrap:wrap;gap:16dp;flex-shrink:0;}
.live-stage .live-game {position:relative;display:block;width:100%;height:600dp;flex-grow:0;flex-shrink:0;padding:18dp 40dp;border:2dp #00000090;border-radius:16dp;background-color:transparent;decorator:linear-gradient(180deg,#1d2832,#0f161d);color:#f1f4f6;overflow:hidden;}
.live-stage .live-game:hover,.live-stage .live-game:focus-visible {background-color:transparent;border-color:#ffffff66;}
.live-stage .live-game.duo {width:1296dp;}
.live-stage .live-game.quad {width:1296dp;height:292dp;padding:10dp 28dp;}
.live-stage .live-game.active {border-color:#00000090;}
.live-stage .live-game.duo.active,.live-stage .live-game.quad.active {border-color:#f2c230;}
.live-card-top {height:48dp;display:flex;align-items:center;justify-content:space-between;gap:24dp;}
.live-game.quad .live-card-top {height:38dp;}
.live-card-competition {display:block;font-size:30dp;letter-spacing:2dp;color:#c8d2da;white-space:nowrap;}
.live-game .live-match-info {display:block;margin:0;font-size:28dp;color:#aab6c0;text-align:right;}
.live-card-main {height:348dp;display:flex;align-items:center;gap:24dp;}
.live-game.quad .live-card-main {height:146dp;}
.live-side {flex:1;min-width:0;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14dp;}
.live-game.quad .live-side {flex-direction:row;gap:20dp;}
.live-game.quad .live-side.home {justify-content:flex-end;}
.live-game.quad .live-side.away {flex-direction:row-reverse;justify-content:flex-end;}
.live-game .live-team-name {display:block;flex:0 0 auto;width:100%;max-height:none;font-family:Display;font-size:46dp;line-height:1.15;text-align:center;color:#f4f6f8;white-space:nowrap;overflow:hidden;}
.live-game.duo .live-team-name {font-size:36dp;}
.live-game.quad .live-team-name {font-size:32dp;width:auto;min-width:0;flex:1;white-space:normal;}
.live-game.quad .live-side.home .live-team-name {text-align:right;}
.live-game.quad .live-side.away .live-team-name {text-align:left;}
.live-centre {width:520dp;flex-shrink:0;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16dp;}
.live-game.duo .live-centre {width:360dp;}
.live-game.quad .live-centre {width:300dp;gap:4dp;}
.live-clock {display:flex;align-items:center;justify-content:center;gap:22dp;width:100%;height:96dp;}
.live-clock-text {display:block;font-family:Display;font-size:52dp;color:#f4f6f8;}
.live-clock-inline {display:block;font-size:28dp;color:#c8d2da;}
.live-plate {display:flex;width:420dp;height:150dp;border:3dp #ffffff30;border-radius:14dp;overflow:hidden;box-shadow:0dp 6dp 18dp #00000080;}
.live-game.duo .live-plate {width:330dp;height:130dp;}
.live-game.quad .live-plate {width:240dp;height:92dp;}
.live-plate-half {flex:1;display:flex;align-items:center;justify-content:center;}
.live-plate-half+.live-plate-half {border-left:3dp #ffffff40;}
.live-plate-half span {display:block;font-size:112dp;font-weight:bold;color:#ffffff;}
.live-game.duo .live-plate-half span {font-size:96dp;}
.live-game.quad .live-plate-half span {font-size:66dp;}
.live-press {display:flex;width:420dp;height:14dp;border-radius:7dp;overflow:hidden;background-color:#ffffff22;}
.live-game.duo .live-press {width:330dp;}
.live-press-home {height:100%;}
.live-press-away {flex:1;height:100%;}
.live-timeline {display:flex;justify-content:center;height:124dp;}
.live-game.quad .live-timeline {height:84dp;}
@keyframes live-moment-in {from {opacity:0;transform:translateX(-220dp);} to {opacity:1;transform:translateX(0dp);}}
.live-moment {position:absolute;left:0;right:0;top:120dp;height:260dp;display:flex;align-items:center;justify-content:center;gap:48dp;border-top:4dp #ffffffb0;border-bottom:4dp #ffffffb0;box-shadow:0dp 10dp 40dp #000000a0;color:#ffffff;pointer-events:none;}
.live-game.quad .live-moment {top:44dp;height:150dp;gap:28dp;}
.live-moment.fresh {animation:0.45s cubic-out live-moment-in;}
body.calm .live-moment.fresh {animation:none;}
.live-moment>div {display:block;min-width:0;}
.live-moment strong {display:block;font-family:Display;font-size:96dp;letter-spacing:6dp;}
.live-game.quad .live-moment strong {font-size:56dp;}
.live-moment-text {display:block;font-size:36dp;margin-top:6dp;}
.live-game.quad .live-moment-text {font-size:28dp;}
.live-moment-score {display:block;font-size:120dp;font-weight:bold;}
.live-game.quad .live-moment-score {font-size:70dp;}
.live-columns {flex:1;min-height:0;display:flex;gap:28dp;}
.live-panel {border-radius:12dp;}
.live-columns .live-ticker {flex:1.5;min-width:0;height:100%;}
.live-columns .live-detail {flex:1;min-width:0;height:100%;}
.live-panel-heading {height:96dp;padding:16dp 30dp;}
.live-panel-heading h2 {font-family:Display;font-size:42dp;flex:0 0 auto;}
.live-panel-heading .live-filters {flex:1;justify-content:flex-end;padding:0;border-bottom-width:0;}
.live-filters button {height:60dp;padding:0 20dp;font-size:28dp;}
.live-detail>.live-panel-heading {height:112dp;padding:14dp 30dp;}
.live-detail-heading h2 {font-size:38dp;}
.live-tabs {padding:16dp 20dp;gap:10dp;}
.live-tabs button {height:62dp;font-size:28dp;padding:0 8dp;}
.live-event {align-items:center;gap:18dp;padding:16dp 28dp;border-left:8dp transparent;}
.live-event-time {width:78dp;font-size:30dp;text-align:right;}
.live-event-mark {width:36dp;height:44dp;flex-shrink:0;display:flex;align-items:center;justify-content:center;}
.live-event-mark .mark {width:16dp;height:16dp;border-radius:8dp;background-color:var(--live-muted);opacity:0.5;}
.kind-goal .live-event-mark .mark {width:30dp;height:30dp;border-radius:15dp;background-color:var(--live-text);opacity:1;border:5dp var(--live-accent);}
.kind-yellow .live-event-mark .mark,.kind-second_yellow .live-event-mark .mark {width:20dp;height:28dp;border-radius:3dp;background-color:#f2c230;opacity:1;}
.kind-red .live-event-mark .mark {width:20dp;height:28dp;border-radius:3dp;background-color:#d6453d;opacity:1;}
.kind-injury .live-event-mark .mark {width:26dp;height:26dp;border-radius:5dp;background-color:#d6453d;opacity:1;}
.kind-chance .live-event-mark .mark,.kind-miss .live-event-mark .mark {width:20dp;height:20dp;border-radius:10dp;background-color:transparent;border:4dp var(--live-muted);opacity:1;}
.is-whistle .live-event-mark .mark {width:28dp;height:6dp;border-radius:3dp;opacity:0.8;}
.live-event-copy h3 {font-size:32dp;}
.live-event-copy p {font-size:28dp;margin-top:4dp;line-height:1.3;}
.live-event.is-whistle .live-event-copy h3 {font-family:Display;color:var(--live-muted);}
.live-event-score {font-size:32dp;min-width:90dp;color:var(--live-text);}
.live-ticker-footer {height:64dp;padding:10dp 30dp;}
.live-detail-footer {height:96dp;padding:14dp 24dp;}
.live-roster {padding:8dp 24dp;}
.live-roster-row {height:58dp;font-size:30dp;}
.live-lineups {padding:20dp 30dp;gap:40dp;}
.live-lineup-side h3 {font-family:Display;font-size:34dp;}
.live-lineup-row {height:54dp;font-size:30dp;}
.live-bottom {left:48dp;right:48dp;height:150dp;gap:24dp;border-top:2dp var(--rule);}
.live-bottom button {height:92dp;padding:0 34dp;font-size:32dp;}
.live-speed {position:static;left:auto;top:auto;width:auto;flex-direction:row;align-items:center;gap:16dp;font-size:28dp;flex-shrink:0;}
#live-speed {width:300dp;height:60dp;}
#live-speed slidertrack {width:auto;height:8dp;margin:26dp 0;}
#live-speed sliderbar {width:32dp;height:32dp;margin-top:14dp;border-radius:16dp;}
.live-speed-value {font-size:28dp;min-width:90dp;text-align:left;}
.live-halts {display:flex;gap:12dp;flex-shrink:0;}
.live-halts button {height:70dp;padding:0 20dp;font-size:28dp;}
.live-bottom-note {text-align:right;}
.live-dialog-layer {border-radius:10dp;}
.live-dialog {width:1900dp;border-radius:12dp;}
+7 -5
View File
@@ -27,24 +27,26 @@
.training-roster select {display:block;width:310dp;height:62dp;padding:10dp 12dp;border:2dp var(--border);border-radius:8dp;font-size:32dp;}
.training-roster select selectbox {width:310dp;max-height:480dp;margin-top:8dp;padding:10dp;border-radius:16dp;}
.training-roster select option {min-height:72dp;padding:10dp 14dp;line-height:52dp;}
.tactics-board {position:absolute;left:76dp;top:0;width:2300dp;height:100%;}
.tactics-board {position:absolute;left:28dp;top:0;width:2560dp;height:100%;}
.tactics-surface {position:absolute;left:0;right:0;top:0;bottom:100dp;}
.tactic-hotspot {padding:0;border:0dp;background-color:transparent;}
.tactic-hotspot:hover,.tactic-hotspot:active {background-color:transparent;}
.tactic-hotspot:focus-visible {border:3dp var(--accent);}
.tactic-effort {position:absolute;left:1021.188dp;top:1000dp;width:1012dp;height:316.875dp;color:#f1efe2;}
.tactic-effort-label {display:flex;align-items:baseline;gap:18dp;font-family:Chalk;font-size:60dp;line-height:1.2;letter-spacing:4dp;}
.tactic-chalk-name {display:flex;align-items:center;justify-content:center;font-family:Chalk;font-size:44dp;letter-spacing:3dp;color:#f1efe2;pointer-events:none;}
.tactic-effort {position:absolute;left:160dp;top:1112dp;width:2240dp;height:300dp;color:#f1efe2;}
.tactic-effort-label {display:flex;align-items:baseline;gap:18dp;font-family:Chalk;font-weight:bold;font-size:56dp;line-height:1.2;letter-spacing:4dp;}
.tactic-chalk-name {display:flex;align-items:center;justify-content:center;font-family:Chalk;font-weight:bold;font-size:38dp;letter-spacing:2dp;color:#f1efe2;pointer-events:none;white-space:nowrap;}
.tactic-chalk-name.off {color:#f1efe2b0;}
.tactic-chalk-name span {display:block;}
.tactic-effort-ends {position:absolute;left:0;right:90dp;top:216dp;display:flex;justify-content:space-between;font-family:Chalk;font-size:34dp;letter-spacing:2dp;color:#f1efe2c0;}
.tactic-effort-ends span {display:block;}
.tactic-effort-marks {font-size:52dp;letter-spacing:1dp;line-height:1.2;}
.tactic-effort input {position:absolute;left:2dp;top:96dp;width:96%;height:20dp;}
.tactic-effort input slidertrack {margin:8dp 0;height:4dp;}
.tactic-effort input slidertrack {background-color:#f1efe240;}
.tactic-effort input sliderprogress {height:6dp;background-color:#f1efe2;border-radius:3dp;}
.tactic-effort input sliderbar {width:30dp;height:30dp;margin-top:-5dp;border:0dp;border-radius:15dp;background-color:#f3d977;}
.tactic-hint {position:absolute;left:0;right:0;bottom:20dp;height:92dp;text-align:center;font-size:34dp;color:var(--text);}
.tactic-hint {position:absolute;left:0;right:0;top:1584dp;height:96dp;text-align:center;font-size:34dp;color:var(--text);}
.tactic-hint strong {display:block;font-weight:normal;}
.tactic-hint span {display:block;font-size:28dp;line-height:1.4;color:var(--muted);}
body.midnight .training-skill {color:#c6d6df;}
+25
View File
@@ -162,3 +162,28 @@ label,input[type=checkbox],input[type=radio],input[type=range] {cursor:arrow;}
/* Native SDL names: game controls use arrow, editing retains the I-beam. */
input[type=text],input[type=search],input[type=number],input[type=password],textarea {cursor:text;}
a[href] {cursor:pointer;}
/* --- Material: paper. Menu windows are sheets of paper lying on the desk: a warm surface,
an edge, two more sheets underneath, headings set in the display serif. The desk itself
stays glass. Spacing follows steps of 8dp: 8 16 24 32 48 64. --- */
body {--paper-top:#2b3644;--paper-bottom:#1f2935;--paper-edge:#0a1018a0;--paper-under:#253040;--paper-shadow:#000000a0;--rule:#dfeaf52e;
--win:#8fd3ad;--draw:#c9cfd6;--loss:#f0a6a7;--club:#a5e2cf;--club-ink:#152a3a;}
body.silver {--paper-top:#fbfaf6;--paper-bottom:#f1eee6;--paper-edge:#7b725f55;--paper-under:#e9e5db;--paper-shadow:#2a231680;--rule:#4a433438;
--win:#3f7d63;--draw:#6c7780;--loss:#a23f45;--club:#25617a;--club-ink:#f7fcff;}
body.matchday {--paper-top:#333237;--paper-bottom:#252428;--paper-edge:#00000090;--paper-under:#2c2b30;--paper-shadow:#000000a8;--rule:#f0e2e42a;
--win:#9fd0a8;--draw:#c8c4c8;--loss:#f0a6a7;--club:#efb2aa;--club-ink:#2a2022;}
body.silver .window {--text:#262b31;--muted:#666d74;--border:#7d76664d;--soft:#5c513a0d;--panel:#ffffff70;--input:#ffffffd0;--hover:#8ea9bd30;--selected:#9fbfd655;--strong:#f6f3ecfc;}
.window {border:2dp var(--paper-edge);border-radius:10dp;decorator:linear-gradient(175deg,var(--paper-top),var(--paper-bottom));backdrop-filter:none;box-shadow:0dp 18dp 54dp var(--paper-shadow);}
.sheet-under {position:absolute;left:560dp;top:60dp;width:2720dp;height:2040dp;border:2dp var(--paper-edge);border-radius:10dp;background-color:var(--paper-under);box-shadow:0dp 10dp 30dp var(--paper-shadow);}
.sheet-under.first {transform:rotate(-0.7deg) translate(-14dp,10dp);}
.sheet-under.second {transform:rotate(0.55deg) translate(16dp,14dp);}
.titlebar {height:108dp;padding:0 28dp 0 20dp;border-bottom:2dp var(--rule);background-color:transparent;}
.titlebar h1 {flex:1;text-align:left;margin:0 0 0 20dp;font-family:Display;font-size:54dp;font-weight:normal;}
.window h2 {font-family:Display;}
body.silver .titlebar {border-bottom-color:#4a433438;}
@keyframes window-in {from {opacity:0;transform:translateY(28dp) scale(0.985);} to {opacity:1;transform:translateY(0dp) scale(1);}}
@keyframes sheet-in {from {opacity:0;} to {opacity:1;}}
.window.window-in {animation:0.18s cubic-out window-in;}
.sheet-under.window-in {animation:0.3s cubic-out sheet-in;}
body.calm .window.window-in,body.calm .sheet-under.window-in {animation:none;}
button {transition:background-color border-color 0.12s cubic-out;}
.desktop-button img,.desktop-card {transition:transform 0.14s cubic-out;}
+93
View File
@@ -0,0 +1,93 @@
Copyright 2011 The Cabin Project Authors (impallari@gmail.com), with Reserved Font Name "Cabin", "Cabin Sketch".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+7
View File
@@ -69,6 +69,13 @@ foreach(icon ${modern_icons})
get_filename_component(icon_name "${icon}" NAME)
configure_file("${icon}" "${modern_assets}/icons/${icon_name}" COPYONLY)
endforeach()
# the display serif and the chalk hand (SIL Open Font License, THIRD_PARTY_NOTICES.md)
file(GLOB modern_fonts CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/assets/modern/fonts/*")
file(MAKE_DIRECTORY "${modern_assets}/fonts")
foreach(font ${modern_fonts})
get_filename_component(font_name "${font}" NAME)
configure_file("${font}" "${modern_assets}/fonts/${font_name}" COPYONLY)
endforeach()
foreach(weight Regular Bold Italic BoldItalic)
configure_file("${rmlui_SOURCE_DIR}/Samples/assets/LatoLatin-${weight}.ttf"
"${modern_assets}/LatoLatin-${weight}.ttf" COPYONLY)
+19
View File
@@ -983,6 +983,25 @@ void App::script() {
frame();
SDL_Delay(5);
}
} else if (type == "demo-start") {
// QA: begin a demo career with `managers` human managers (1-4), each at a club of
// its own, so the match day can be looked at with several matches at once
if (engine_mode_ || !source_) throw editor::Error("demo-start braucht die UI-Demo.");
const int wanted = std::clamp(command.value("managers", 1), 1, 4);
Json managers = Json::array();
const int step = std::max(1, command.value("step", 2));
int skip = 0;
for (const auto *club : world_->clubs()) {
if (int(managers.size()) >= wanted) break;
const auto id = club->value("id", std::string());
if (!world_->manageable(id) || skip++ % step) continue;
managers.push_back({{"name", "Manager " + std::to_string(managers.size() + 1)}, {"club", id}, {"portrait", int(managers.size())},
{"portrait_style", "photo"}, {"strength_choice", 1}});
}
const auto result = source_->apply({source_->snapshot().revision, "start",
{{"setup", {{"duration", 5}, {"difficulty", 3}, {"players", managers.size()}, {"mode", 3}, {"league", true}, {"world", true}}}, {"managers", managers}}});
if (!result.ok) throw editor::Error("demo-start: " + result.error);
scene_ = "desktop"; menu_.clear(); refresh();
} else if (type == "screenshot")
screenshot(editor::path(command.at("path").get<std::string>()));
else if (type == "checkpoint") {
+81 -59
View File
@@ -272,26 +272,33 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
ring(x + w / 2, y + h / 2, h * .14, chalk, .7);
};
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 295 206'>";
// frame and slate; the wiped patches of an often used board
out << "<rect x='4' y='1' width='272' height='159' rx='3' fill='#6b4a2e'/>"
"<rect x='4.8' y='1.8' width='270.4' height='157.4' rx='2.5' fill='none' stroke='#8a6540' stroke-width='.6'/>"
"<rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='"
<< slate << "'/><rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='none' stroke='#16261f' stroke-opacity='.55' stroke-width='1'/>";
for (int i = 0; i < 9; ++i) {
const double cx = 40 + i * 27 + wobble(12), cy = 30 + (i % 3) * 45 + wobble(14);
out << "<ellipse cx='" << cx << "' cy='" << cy << "' rx='" << 26 + wobble(9) << "' ry='" << 9 + wobble(4)
// The board, 320 x 200 units (the screen draws it at 8dp a unit), mirrored about its
// middle: the pitch of the attitude on the left, six tiles for the play settings on the
// right, the commitment across the foot. The screen writes the names in chalk under them.
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 200'>";
out << "<rect x='0' y='0' width='320' height='192' rx='3' fill='#6b4a2e'/>"
"<rect x='1' y='1' width='318' height='190' rx='2.5' fill='none' stroke='#8a6540' stroke-width='.7'/>"
"<rect x='5' y='5' width='310' height='182' rx='1.2' fill='"
<< slate << "'/><rect x='5' y='5' width='310' height='182' rx='1.2' fill='none' stroke='#16261f' stroke-opacity='.55' stroke-width='1'/>";
for (int i = 0; i < 10; ++i) {
const double cx = 34 + i * 28 + wobble(12), cy = 34 + (i % 3) * 52 + wobble(14);
out << "<ellipse cx='" << cx << "' cy='" << cy << "' rx='" << 28 + wobble(9) << "' ry='" << 10 + wobble(4)
<< "' fill='#ffffff' fill-opacity='" << .022 + (i % 2) * .012 << "' transform='rotate(" << -14 + wobble(10) << ' ' << cx << ' ' << cy << ")'/>";
}
// chalk tray with two pieces of chalk
out << "<rect x='96' y='160' width='88' height='3.2' rx='.8' fill='#58391f'/>"
"<rect x='112' y='158.3' width='9' height='1.7' rx='.5' fill='#f1efe2'/>"
"<rect x='127' y='158.5' width='6' height='1.6' rx='.5' fill='#f3d977' transform='rotate(-6 130 159)'/>";
out << "<rect x='116' y='192' width='88' height='3.4' rx='.8' fill='#58391f'/>"
"<rect x='134' y='190.2' width='9' height='1.8' rx='.5' fill='#f1efe2'/>"
"<rect x='150' y='190.4' width='6' height='1.7' rx='.5' fill='#f3d977' transform='rotate(-6 153 191)'/>";
// the line between the halves and the one above the commitment
line(160, 22, 160, 124, chalk, .5, true);
line(20, 134, 300, 134, chalk, .5, true);
// the scale under the commitment slider: one tick a step, longer at the ends and the middle
for (int i = 0; i <= 11; ++i) {
const double x = 22.2 + i * 24.03;
line(x, 157, x, i == 0 || i == 11 ? 164 : i % 5 == 0 ? 162.5 : 160.5, chalk, .7);
}
field(19, 9, 104, 62);
field(19, 82, 104, 62);
field(137, 10, 58, 37);
field(205, 10, 58, 37);
// attitude: the eleven with the way they lean
field(20, 30, 132, 84);
std::array<std::pair<int, int>, 10> formation = {{{5, 1}, {5, 3}, {5, 5}, {5, 7}, {10, 1}, {10, 3}, {10, 5}, {10, 7}, {16, 3}, {16, 5}}};
if (!lineup_points.is_null()) {
if (!lineup_points.is_array() || lineup_points.size() != 11)
@@ -308,52 +315,67 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
}
}
for (const auto &[x, y] : formation) {
const double px = 25 + x / double(depth_max) * 82, py = 16 + y / double(lane_max) * 49;
arrow(px, py, std::array<int, 4>{-16, -7, 7, 16}[size_t(values[0])], 0);
const double px = 30 + x / double(depth_max) * 104, py = 39 + y / double(lane_max) * 66;
arrow(px, py, std::array<int, 4>{-18, -8, 8, 18}[size_t(values[0])], 0);
dot(px, py);
}
for (int k = 0; k < 2; ++k) {
const int x = 137 + k * 68;
dot(x + 12, 27);
dot(x + 25, 20);
dot(x + 25, 37);
dot(x + 43, 28, true);
if (values[size_t(5 + k)] == 0) {
line(x + 3, 12, x + 55, 44, chalk, 1.7);
line(x + 55, 12, x + 3, 44, chalk, 1.7);
// switched off: the name written under the field (set by the screen) is struck out
line(x + 2, 52.6, x + 56, 51.4, chalk, 1.3);
// the six tiles, 40 x 34 each: 1 wing play, 2 through balls, 3 goal kicks / 4 flat or
// high, 5 offside trap, 6 pressing
const auto tile = [](int index) { return std::pair<double, double>{168 + ((index - 1) % 3) * 46.0, index <= 3 ? 30.0 : 80.0}; };
for (int index = 1; index <= 6; ++index) {
const auto [x, y] = tile(index);
if (index != 4) field(x, y, 40, 34);
const int v = values[size_t(index)];
if (index == 1) { // from the middle out to the wing
dot(x + 12, y + 17);
arrow(x + 12, y + 17, 15, -v * 4.2, true);
dot(x + 31, y + 17 - 3.4 * 3, true);
} else if (index == 2) { // a short pass or a ball into the depth
dot(x + 8, y + 22);
dot(x + 15 + v * 4, y + 12);
arrow(x + 8, y + 22, 7 + v * 6.5, -2 - v * 2.2);
} else if (index == 3) { // the goalkeeper's kick
dot(x + 3.5, y + 17);
arrow(x + 3.5, y + 17, 7 + v * 8.5, -v * 2.4, true);
dot(x + 13, y + 26);
} else if (index == 4) { // two players, the ball along the ground or lobbed
for (double px : {x + 7.0, x + 33.0}) {
ring(px, y + 12, 2, chalk, .8);
line(px, y + 14, px - 1.5, y + 21, chalk, .8);
line(px - 1.5, y + 21, px + 3, y + 26, chalk, .8);
line(px - 1.5, y + 21, px - 5, y + 26, chalk, .8);
line(px - .8, y + 17, px - 5, y + 19, chalk, .8);
line(px - .8, y + 17, px + 4, y + 19, chalk, .8);
}
std::vector<std::pair<double, double>> path;
const double x1 = x + 12, x2 = x + 28, base = y + 22, peak = v ? y - 2 : base;
for (int i = 0; i <= 10; ++i) {
const double t = i / 10.0;
path.emplace_back(x1 + (x2 - x1) * t + wobble(.2), (1 - t) * (1 - t) * base + 2 * (1 - t) * t * peak + t * t * base + wobble(.25));
}
stroke(path, chalk, .9, true);
line(x2, base, x2 - 3.2, base - 2.4 - (v ? 2 : 0), chalk, .9);
line(x2, base, x2 - 2.6 + (v ? 2.6 : 0), base + 2.4 - (v ? 5 : 0), chalk, .9);
} else if (index == 5) { // the back line steps up together
for (double py : {y + 8.0, y + 17.0, y + 26.0}) dot(x + 13, py);
line(x + 17.5, y + 3, x + 17.5, y + 31, chalk, .6, true);
dot(x + 24, y + 14, true);
} else { // three close in on the ball
dot(x + 26, y + 17, true);
arrow(x + 12, y + 8, 9, 6);
arrow(x + 10, y + 26, 11, -6);
arrow(x + 36, y + 27, -6, -6.5);
dot(x + 12, y + 8);
dot(x + 10, y + 26);
dot(x + 36, y + 27);
}
}
dot(29, 111);
dot(76, 94);
dot(76, 119);
dot(101, 118);
dot(111, 120, true);
arrow(29, 111, 10 + values[3] * 10, -values[3] * 5, true);
arrow(76, 94, 10 + values[2] * 8, 12 - values[2] * 5);
arrow(76, 119, 10 + values[1] * 8, -8 + values[1] * 4, true);
for (int x : {181, 222}) {
ring(x, 65, 2, chalk, .8);
line(x, 67, x - 2, 74, chalk, .8);
line(x - 2, 74, x + 3, 78, chalk, .8);
line(x - 2, 74, x - 6, 78, chalk, .8);
line(x - 1, 70, x - 6, 72, chalk, .8);
line(x - 1, 70, x + 4, 72, chalk, .8);
}
{
// the ball's way from one to the other: along the ground or lobbed
std::vector<std::pair<double, double>> path;
const double peak = values[4] ? 45 : 72;
for (int i = 0; i <= 10; ++i) {
const double t = i / 10.0;
path.emplace_back((1 - t) * (1 - t) * 188 + 2 * (1 - t) * t * 201 + t * t * 215 + wobble(.2),
(1 - t) * (1 - t) * 72 + 2 * (1 - t) * t * peak + t * t * 72 + wobble(.25));
if (index >= 5 && v == 0) {
// switched off: crossed out, and the name underneath struck through
line(x + 2, y + 2, x + 38, y + 32, chalk, 1.7);
line(x + 38, y + 2, x + 2, y + 32, chalk, 1.7);
line(x - 1, y + 40.4, x + 41, y + 39.4, chalk, 1.2);
}
stroke(path, chalk, .9, true);
const double dy = values[4] ? 2.6 : 0;
line(215, 72, 211.4, 72 - 2.1 - dy, chalk, .9);
line(215, 72, 212.2 + dy, 72 + 2.3 - dy * 1.6, chalk, .9);
}
out << "</svg>";
return out.str();
+2 -2
View File
@@ -13,9 +13,9 @@ bool App::engine_sports_dirty() const {
std::string App::engine_sports_footer() {
const bool training = menu_ == "training";
return "<p id=\"sports-note\" class=\"small muted\" style=\"position:absolute;" +
(training ? rect(0, 1580, 1060, 112) : rect(0, 1514, 2300, 112)) + "\"></p>"
(training ? rect(0, 1580, 1060, 112) : rect(0, 1688, 2616, 60) + "text-align:center;") + "\"></p>"
"<div class=\"row\" style=\"position:absolute;" +
(training ? rect(0, 1720, 1060, 94) : rect(0, 1650, 2300, 94)) + "\">" +
(training ? rect(0, 1720, 1060, 94) : rect(856, 1764, 904, 94)) + "\">" +
btn("sports-reset", "Zurücksetzen", "", "id=\"sports-reset\" style=\"width:440dp;height:94dp;\"") +
btn("sports-apply", "Anwenden", "primary", "id=\"sports-apply\" style=\"width:440dp;height:94dp;\"") + "</div>";
}
+25 -4
View File
@@ -182,6 +182,26 @@ void App::engine_live_poll() {
focus_after_render_ = "live-dialog-apply";
}
} catch (const std::exception &) {}
// the halts the manager asked for: at half time, and when his side falls behind
try {
const auto owner = live_owner();
const auto &match = live_match_by_id(live_.fixture().at("matches"), owner.at("match_id"));
const bool home = match.at("home").at("id") == owner.at("team").at("id");
std::string reason;
for (const auto &e : live_.fixture().at("frames").back().at("events")) {
if (seen.contains(e.at("id").get<std::string>()) || e.at("match_id") != match.at("id")) continue;
const std::string what = e.value("kind", std::string());
if (live_halt_interval_ && what == "interval") reason = "Halbzeit.";
if (live_halt_behind_ && what == "goal" && (e.at("side") == "home") != home) {
const auto &score = e.at("score");
if ((home ? score[0].get<int>() : score[1].get<int>()) < (home ? score[1].get<int>() : score[0].get<int>())) reason = "Rückstand.";
}
}
if (!reason.empty() && live_dialog_.empty() && live_.speed()) {
live_.speed(0);
live_feedback_ = "Angehalten: " + reason;
}
} catch (const std::exception &) {}
}
} else {
live_.speed(0);
@@ -255,9 +275,7 @@ void App::live_set_speed(int value) {
live_feedback_.clear();
live_last_tick_ = SDL_GetTicks64();
if (auto *node = dynamic_cast<Rml::ElementFormControl *>(element("live-speed"))) {
// Native vertical sliders increase downward; the user's logical speed is
// deliberately inverted so the bottom position always means zero/pause.
node->SetValue(std::to_string(4 - value)); node->SetAttribute("aria-valuenow", value);
node->SetValue(std::to_string(value)); node->SetAttribute("aria-valuenow", value);
node->SetAttribute("aria-valuetext", value ? "Wiedergabe Stufe " + std::to_string(value) : "Pause");
}
if (auto *node = element("live-speed-value")) node->SetInnerRML(esc(value ? std::to_string(value) + "×" : "Pause"));
@@ -360,6 +378,9 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
} else if (action == "live-next") {
if (engine_live_running_) { engine_live_elapsed_ = 0; engine_live_send("live.step", {{"minutes", 1}}); return true; }
live_.next(); live_last_tick_ = SDL_GetTicks64();
} else if (action == "live-halt") {
(id == "interval" ? live_halt_interval_ : live_halt_behind_) ^= true;
focus_after_render_ = target->GetId();
} else if (action == "live-pause") {
live_set_speed(live_.speed() ? 0 : 1); return true;
} else if (action == "live-review" && live_.finished()) {
@@ -425,7 +446,7 @@ bool App::live_event(Rml::Event &event) {
if ((type == "change" || type == "input") && speed_control) {
if (setting_menu_markup_) return true;
if (auto *input = dynamic_cast<Rml::ElementFormControl *>(element("live-speed"))) {
try { live_set_speed(4 - std::stoi(input->GetValue())); } catch (const std::exception &) {}
try { live_set_speed(std::stoi(input->GetValue())); } catch (const std::exception &) {}
}
return true;
}
+155 -32
View File
@@ -180,6 +180,8 @@ std::string App::live_dialog_markup(const Json &owner) {
}
std::string App::live_ticker_events(const Json &frame, size_t &shown) {
const auto &fixture = live_.fixture();
const bool recorded = fixture.at("source") == "engine-recording";
const bool several = fixture.at("matches").size() > 1;
shown = 0;
std::string out;
for (auto i = frame.at("events").rbegin(); i != frame.at("events").rend(); ++i) {
@@ -189,11 +191,23 @@ std::string App::live_ticker_events(const Json &frame, size_t &shown) {
if (live_filter_ == "yellow" && kind != "yellow" && kind != "red" && kind != "second_yellow") continue;
if (live_filter_ == "highlights" && kind != "goal" && kind != "chance" && kind != "miss" && kind != "red" && kind != "second_yellow") continue;
const auto &match = live_match_by_id(fixture.at("matches"), event.at("match_id"));
out += "<article class=\"live-event " + std::string(kind == "goal" ? "is-goal" : "") + "\" data-live-event=\"" + esc(event.at("id").get<std::string>()) + "\">" + live_text(std::to_string(event.at("minute").get<int>()) + "′", "live-event-time") + (kind == "kickoff" || kind == "interval" || kind == "fulltime" ? "<div class=\"live-badge\" style=\"width:54dp;height:54dp;\"></div>" : live_badge(match.at(event.at("side").get<std::string>()), 54)) +
"<div class=\"live-event-copy\">" + (fixture.at("source") == "engine-recording" && fixture.at("matches").size() == 1 ? std::string() : live_text(match.at("home").at("name").get<std::string>() + " · " + match.at("away").at("name").get<std::string>(), "live-event-owners")) + "<h3>" + live_text(event.at("headline")) + "</h3><p>" + live_text(event.at("body")) + "</p></div>" + live_text(live_score_text(event.at("score")), "live-event-score") + "</article>";
const bool whistle = kind == "kickoff" || kind == "interval" || kind == "fulltime";
const auto side = event.at("side").get<std::string>();
// one line per report: minute, what happened (a mark by kind), the club, the wording, the score
std::string row = "<article class=\"live-event kind-" + esc(kind) + (kind == "goal" ? " is-goal" : "") + (whistle ? " is-whistle" : "") +
"\" data-live-event=\"" + esc(event.at("id").get<std::string>()) + "\"";
if (kind == "goal") row += " style=\"border-left-color:" + live_colours(match)[side == "away" ? 1 : 0] + ";\"";
row += ">" + live_text(std::to_string(event.at("minute").get<int>()) + "′", "live-event-time") +
"<div class=\"live-event-mark\"><div class=\"mark\"></div></div>" +
(whistle ? "<div class=\"live-badge\" style=\"width:54dp;height:54dp;\"></div>" : live_badge(match.at(side), 54)) +
"<div class=\"live-event-copy\">" +
(several || !recorded ? live_text(match.at("home").at("name").get<std::string>() + " – " + match.at("away").at("name").get<std::string>(), "live-event-owners") : std::string()) +
"<h3>" + live_text(event.at("headline")) + "</h3><p>" + live_text(event.at("body")) + "</p></div>" +
live_text(live_score_text(event.at("score")), "live-event-score") + "</article>";
out += row;
++shown;
}
if (!shown && fixture.at("source") == "engine-recording" && live_filter_ == "all" && frame.at("events").empty()) {
if (!shown && recorded && live_filter_ == "all" && frame.at("events").empty()) {
// before the first report: who starts
for (const auto &match : fixture.at("matches")) {
if (live_coverage_ == "single" && match.at("id") != live_selected_match_) continue;
@@ -212,9 +226,116 @@ std::string App::live_ticker_events(const Json &frame, size_t &shown) {
}
if (!out.empty()) return out;
}
if (!shown) out += "<p class=\"live-note\">" + live_text(fixture.at("source") == "engine-recording" ? "Noch keine Meldungen." : "Für diesen Filter liegt noch keine Demomeldung vor.") + "</p>";
if (!shown) out += "<p class=\"live-note\">" + live_text(recorded ? "Noch keine Meldungen." : "Für diesen Filter liegt noch keine Demomeldung vor.") + "</p>";
return out;
}
std::array<std::string, 2> App::live_colours(const Json &match) {
// from the crests; a club without one, or a national side, plays in slate. Two sides in
// nearly the same colour: the guests change into a dark neutral.
const auto colour = [&](const Json &team) {
std::string value;
if (team.value("role", "club") != "national" && live_world_)
if (const auto *club = live_world_->find("clubs", team.value("id", "")); club && !club->value("crest", "").empty())
value = renderer_.crest_colour(club->value("crest", ""));
return value;
};
std::array<std::string, 2> out{colour(match.at("home")), colour(match.at("away"))};
const auto channel = [](const std::string &c, size_t at) { return std::stoi(c.substr(at, 2), nullptr, 16); };
if (out[0].empty()) out[0] = "#3d5a73";
if (out[1].empty()) out[1] = "#7a4a3a";
int distance = 0;
for (size_t at : {1u, 3u, 5u}) distance += std::abs(channel(out[0], at) - channel(out[1], at));
if (distance < 110) out[1] = "#3a4148";
return out;
}
// One match on the stage: crests, the score plate in the clubs' colours, the clock, who is
// pressing, and the time line with every goal, card and injury so far. `layout` is solo
// (one match), duo (two) or quad (three or four).
std::string App::live_card(const Json &match, const Json &frame, const std::string &layout, size_t index) {
const auto &fixture = live_.fixture();
const bool recorded = fixture.at("source") == "engine-recording";
const auto &value = live_score_by_id(frame, match.at("id"));
const int minute = frame.at("minute"), duration = std::max(1, fixture.value("duration", 90));
const auto colours = live_colours(match);
const bool quad = layout == "quad";
const double crest = layout == "solo" ? 250 : layout == "duo" ? 190 : 110;
const auto id = match.at("id").get<std::string>();
const double tw = layout == "solo" ? 2480 : 1180, th = quad ? 84 : 124, W = tw / th * 100;
// the clock: a ring that fills with the minutes
const double turn = std::clamp(double(minute) / duration, 0.0, 1.0) * 289.03;
const auto ink = "#eef2f5";
const std::string ring = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='46' fill='none' stroke='" + std::string(ink) +
"' stroke-opacity='.16' stroke-width='7'/><circle cx='50' cy='50' r='46' fill='none' stroke='" + (live_.finished() ? std::string(ink) : colours[0]) +
"' stroke-width='7' stroke-linecap='round' stroke-dasharray='" + scalar(turn) + " 400' transform='rotate(-90 50 50)'/></svg>";
// who is pressing: goals and chances of the last ten minutes
int press[2] = {0, 0};
// the time line: grass in bands of fifteen minutes, the home side's marks above, the guests' below
std::string marks, bands;
for (int from = 0; from < duration; from += 15)
bands += "<rect x='" + scalar(from * W / duration) + "' y='30' width='" + scalar(std::min(15, duration - from) * W / duration) +
"' height='40' fill='" + ((from / 15) % 2 ? "#3f7d4e" : "#4a8a58") + "'/>";
for (const auto &event : frame.at("events")) {
if (event.at("match_id") != match.at("id")) continue;
const auto kind = event.value("kind", std::string());
const size_t side = event.value("side", std::string("home")) == "away" ? 1 : 0;
const int at = event.at("minute").get<int>();
if ((kind == "goal" || kind == "chance" || kind == "miss") && at > minute - 10) ++press[side];
const double x = std::clamp(at * W / duration, 12.0, W - 12), y = side ? 86 : 14;
if (kind == "goal")
marks += "<line x1='" + scalar(x) + "' y1='" + scalar(side ? 70 : 30) + "' x2='" + scalar(x) + "' y2='" + scalar(y) + "' stroke='" + colours[side] + "' stroke-width='3'/>"
"<circle cx='" + scalar(x) + "' cy='" + scalar(y) + "' r='11' fill='" + colours[side] + "' stroke='#ffffff' stroke-width='3'/>";
else if (kind == "yellow" || kind == "red" || kind == "second_yellow")
marks += "<rect x='" + scalar(x - 6) + "' y='" + scalar(y - 9) + "' width='12' height='18' rx='2' fill='" + (kind == "yellow" ? "#f2c230" : "#d6453d") + "' stroke='#00000040' stroke-width='1'/>";
else if (kind == "injury")
marks += "<path d='M" + scalar(x - 8) + " " + scalar(y) + "h16M" + scalar(x) + " " + scalar(y - 8) + "v16' stroke='#d6453d' stroke-width='5' stroke-linecap='round'/>";
}
const double now = std::clamp(minute * W / duration, 0.0, W);
const std::string timeline = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 " + scalar(W) + " 100'><rect x='0' y='30' width='" + scalar(W) + "' height='40' rx='6' fill='#4a8a58'/>" + bands +
"<rect x='" + scalar(now) + "' y='30' width='" + scalar(W - now) + "' height='40' fill='#10161c' fill-opacity='.5'/>"
"<path d='M" + scalar(W / 2) + " 30v40' stroke='#ffffff' stroke-opacity='.75' stroke-width='3'/><circle cx='" + scalar(W / 2) + "' cy='50' r='12' fill='none' stroke='#ffffff' stroke-opacity='.6' stroke-width='2.5'/>"
"<rect x='1.5' y='31.5' width='" + scalar(W - 3) + "' height='37' rx='6' fill='none' stroke='#ffffff' stroke-opacity='.55' stroke-width='3'/>" + marks +
(live_.finished() ? std::string() : "<path d='M" + scalar(now) + " 24v52' stroke='#ffffff' stroke-width='4' stroke-linecap='round'/>") + "</svg>";
const int total = press[0] + press[1];
const double share = total ? 100.0 * press[0] / total : 50;
const auto phase = frame.at("phase").get<std::string>();
const std::string status = live_.finished() ? "Abpfiff" : phase == "interval" ? "Halbzeit" : minute < 1 ? "Anpfiff" : std::to_string(minute) + "′";
std::string names;
for (const auto &owner_id : match.at("owners")) for (const auto &person : fixture.at("owners")) if (person.at("id") == owner_id) { if (!names.empty()) names += " · "; names += person.at("name").get<std::string>(); }
std::string out = "<button data-action=\"live-match\" class=\"live-game " + layout + (match.at("id") == live_selected_match_ ? " active" : "") + "\" data-live-match=\"" + esc(id) + "\" data-id=\"" + esc(id) + "\">";
out += "<div class=\"live-card-top\">" + live_text(recorded ? match.value("competition", std::string("Spieltag")) : std::string("Demospiel"), "live-card-competition") +
live_text(fixture.at("owners").size() > 1 ? names : live_match_info_text(match, fixture.at("surface") == "indoor"), "live-match-info") + "</div>";
out += "<div class=\"live-card-main\"><div class=\"live-side home\">" + live_badge(match.at("home"), crest) + live_text(match.at("home").at("name"), "live-team-name") + "</div>"
"<div class=\"live-centre\">";
if (!quad)
out += "<div class=\"live-clock\">" + picture(renderer_.diagram("live-clock-" + std::to_string(index), ring, 256), 84, 84) + live_text(status, "live-clock-text") + "</div>";
out += "<div class=\"live-plate\"><div class=\"live-plate-half\" style=\"background-color:" + colours[0] + ";\"><span>" + std::to_string(value.at("score")[0].get<int>()) +
"</span></div><div class=\"live-plate-half\" style=\"background-color:" + colours[1] + ";\"><span>" + std::to_string(value.at("score")[1].get<int>()) + "</span></div></div>";
if (quad) out += live_text(status, "live-clock-inline");
else
out += "<div class=\"live-press\" aria-label=\"Druck der letzten zehn Minuten\"><div class=\"live-press-home\" style=\"width:" + scalar(share) + "%;background-color:" + colours[0] +
";\"></div><div class=\"live-press-away\" style=\"background-color:" + colours[1] + ";\"></div></div>";
out += "</div><div class=\"live-side away\">" + live_badge(match.at("away"), crest) + live_text(match.at("away").at("name"), "live-team-name") + "</div></div>";
out += "<div class=\"live-timeline\">" + picture(renderer_.diagram("live-line-" + std::to_string(index), timeline, 2048), tw, th) + "</div>";
// a goal that has just fallen: a banner across this card, once
if (!frame.at("events").empty()) {
const auto &last = frame.at("events").back();
if (last.at("match_id") == match.at("id") && last.value("kind", std::string()) == "goal" && !live_.finished() &&
last.at("minute").get<int>() >= minute - 1) {
// it stays while the minute lasts and slides in only the first time it is drawn
const bool fresh = live_moment_ != last.at("id").get<std::string>();
live_moment_ = last.at("id").get<std::string>();
const size_t side = last.value("side", std::string("home")) == "away" ? 1 : 0;
out += "<div class=\"live-moment" + std::string(fresh ? " fresh" : "") + "\" style=\"background-color:" + colours[side] + ";\">" + live_badge(match.at(side ? "away" : "home"), quad ? 120 : 200) +
"<div><strong>TOR!</strong>" + live_text(last.value("body", std::string()), "live-moment-text") + "</div>" + live_text(live_score_text(last.at("score")), "live-moment-score") + "</div>";
}
}
return out + "</button>";
}
std::string App::render_live() {
if(live_review_) return render_postmatch();
if (!live_.available()) return "";
@@ -225,39 +346,41 @@ std::string App::render_live() {
const auto &fixture = live_.fixture(); const auto frame = live_.frame(); const auto owner = live_owner();
const int minute = frame.at("minute"); const auto phase = frame.at("phase").get<std::string>();
const bool recorded = fixture.at("source") == "engine-recording";
const size_t count = fixture.at("matches").size();
const std::string layout = count == 1 ? "solo" : count == 2 ? "duo" : "quad";
const auto phase_text = live_.finished() ? "Beendet" : phase == "interval" ? "Halbzeit" : live_.speed() ? (recorded ? (phase == "extra_time" ? "Verlängerung" : phase == "shootout" ? "Elfmeterschießen" : "Spiel läuft") : "Aufzeichnung läuft") : (recorded ? "Pausiert" : "Gemeinsam pausiert");
const auto arrow = [&](bool right) { const auto color = theme_ == "silver" ? "#376b84" : theme_ == "matchday" ? "#efb2aa" : "#b5dbd2"; return picture(renderer_.diagram(right ? "live-arrow-right" : "live-arrow-left", "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path d=\"" + std::string(right ? "M7 4l6 6-6 6" : "M13 4l-6 6 6 6") + "\" fill=\"none\" stroke=\"" + color + "\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", 72), 36, 36); };
std::string out = "<section id=\"live-stage\" class=\"live-stage\" data-source=\"" + std::string(recorded ? "engine-recording" : "ui-demo-fixture") + "\" data-fixture-id=\"" + esc(fixture.at("fixture_id").get<std::string>()) + "\"><header class=\"live-header\"><div>" + (recorded ? std::string() : live_text("SPIELTAG · LIVE-TICKER", "live-eyebrow")) +
"<h1>" + live_text(live_review_ ? "Ergebnisse & Bericht" : fixture.at("role") == "national" ? "Deutschland · Demo-Länderspiel" : fixture.at("surface") == "indoor" ? "Hallenpartien · 40 Minuten" : recorded ? fixture.at("matches").front().value("competition", std::string("Spieltag")) : std::string("Gemeinsamer Spieltag")) + "</h1></div>" + live_text(recorded ? ui_long_date(fixture.value("date", std::string())) : std::string("UI-Demo · vorgegebene Ergebnisse"), "live-demo-tag") + "</header>";
const auto scoreline = [&](const Json &match) {
const auto &value = live_score_by_id(frame, match.at("id"));
return "<div class=\"live-scoreline\">" + live_text(match.at("home").at("name"), "live-team-name home") + live_badge(match.at("home"), 58) + live_text(live_score_text(value.at("score")), "live-score") + live_badge(match.at("away"), 58) + live_text(match.at("away").at("name"), "live-team-name away") + "</div>";
};
out += "<div id=\"live-underlay\" class=\"live-body\"><div class=\"live-left\"><section class=\"live-panel live-overview\"><nav class=\"live-coverage" + std::string(recorded && fixture.at("matches").size() == 1 ? " solo" : "") + "\">";
if (!(recorded && fixture.at("matches").size() == 1))
for (const auto &[id, text] : std::array<std::pair<const char *, const char *>, 3>{{{"all", "Alle Spiele"}, {"single", "Einzelspiel"}, {"conference", "Konferenz"}}})
out += btn("live-coverage", text, live_coverage_ == id ? "selected" : "", "id=\"live-coverage-" + std::string(id) + "\" data-id=\"" + id + "\"");
if (live_coverage_ == "single" && fixture.at("matches").size() > 1) out += btn("live-match-prev", arrow(false), "live-match-arrow", "id=\"live-match-prev\" aria-label=\"Vorherige Tickerpartie\"") + btn("live-match-next", arrow(true), "live-match-arrow", "id=\"live-match-next\" aria-label=\"Nächste Tickerpartie\"");
if (!(recorded && fixture.at("matches").size() == 1)) out += live_text(std::to_string(minute) + ":00", "live-clock");
out += "</nav><div class=\"live-cards " + std::string(fixture.at("matches").size() == 1 || live_coverage_ == "single" ? "single" : "") + "\">";
for (const auto &match : fixture.at("matches")) {
if (live_coverage_ == "single" && match.at("id") != live_selected_match_) continue;
std::string names;
for (const auto &id : match.at("owners")) for (const auto &person : fixture.at("owners")) if (person.at("id") == id) { if (!names.empty()) names += " · "; names += person.at("name").get<std::string>(); }
out += "<button data-action=\"live-match\" class=\"live-game " + std::string(match.at("id") == live_selected_match_ ? "active" : "") + "\" data-live-match=\"" + esc(match.at("id").get<std::string>()) + "\" data-id=\"" + esc(match.at("id").get<std::string>()) + "\">" + (recorded && fixture.at("owners").size() == 1 ? std::string() : live_text(names, "live-owners")) + scoreline(match) + live_text(recorded && fixture.at("matches").size() == 1 ? std::string(phase_text) + (live_.finished() || minute < 1 ? "" : " · " + std::to_string(minute) + ". Minute") : std::to_string(minute) + "′ · " + (match.at("owners").size() > 1 ? std::string("Zwei menschliche Manager") : recorded ? match.value("competition", std::string("Eine menschliche Mannschaft")) : std::string("Eine menschliche Mannschaft")), "live-card-caption") + live_text(live_match_info_text(match, fixture.at("surface") == "indoor"), "live-match-info") + "</button>";
}
out += "</div></section><section class=\"live-panel live-ticker\"><header class=\"live-panel-heading\"><h2>" + live_text(recorded ? "Ticker" : "Gemeinsamer Live-Ticker") + "</h2>" + (recorded && fixture.at("owners").size() == 1 ? std::string() : live_text(live_coverage_ == "single" ? "Gewählte Partie" : "Alle Manager", "live-small")) + "</header><nav class=\"live-filters\">";
// a sheet in the menus' 4:3 format on the darkened stadium: the stage with one card per
// match of a human manager on top, the ticker and the manager's squad below, the controls at the foot
std::string out = "<div class=\"live-backdrop\"></div><section id=\"live-stage\" class=\"live-stage " + layout + "\" data-source=\"" + std::string(recorded ? "engine-recording" : "ui-demo-fixture") + "\" data-fixture-id=\"" + esc(fixture.at("fixture_id").get<std::string>()) + "\">";
out += "<header class=\"live-header\"><h1>" + live_text(fixture.at("role") == "national" ? "Länderspiel" : fixture.at("surface") == "indoor" ? "Hallenturnier" : recorded && count == 1 ? fixture.at("matches").front().value("competition", std::string("Spieltag")) : std::string("Spieltag")) + "</h1>" +
live_text(recorded ? ui_long_date(fixture.value("date", std::string())) : std::string("Demo · vorgegebene Ergebnisse"), "live-demo-tag") + "</header>";
out += "<div id=\"live-underlay\" class=\"live-body\"><div class=\"live-cards " + layout + "\">";
size_t index = 0;
for (const auto &match : fixture.at("matches")) out += live_card(match, frame, layout, index++);
out += "</div><div class=\"live-columns\"><section class=\"live-panel live-ticker\"><header class=\"live-panel-heading\"><h2>" + live_text("Ticker") + "</h2><nav class=\"live-filters\">";
if (count > 1)
for (const auto &[id, text] : std::array<std::pair<const char *, const char *>, 2>{{{"all", "Alle Spiele"}, {"single", "Gewähltes Spiel"}}})
out += btn("live-coverage", text, live_coverage_ == id ? "selected" : "", "id=\"live-coverage-" + std::string(id) + "\" data-id=\"" + id + "\"");
for (const auto &[id, label] : std::array<std::pair<const char *, const char *>, 4>{{{"all", "Alles"}, {"highlights", "Highlights"}, {"goal", "Tore"}, {"yellow", "Karten"}}}) out += btn("live-filter", label, live_filter_ == id ? "selected" : "", "id=\"live-filter-" + std::string(id) + "\" data-id=\"" + id + "\"");
out += "</nav><div id=\"live-ticker\" class=\"live-event-list\" tabindex=\"0\" aria-label=\"Gemeinsamer Ereignisverlauf\">";
out += "</nav></header><div id=\"live-ticker\" class=\"live-event-list\" tabindex=\"0\" aria-label=\"Ereignisverlauf\">";
size_t shown = 0;
out += live_ticker_events(frame, shown);
out += "</div><footer class=\"live-ticker-footer\">" "<span id=\"live-event-count\" class=\"live-small\">" + esc(recorded && !shown ? std::string() : std::to_string(shown) + (live_.fixture().at("source") == "engine-recording" ? (shown == 1 ? " Meldung" : " Meldungen") : " Meldungen · feste Aufzeichnung")) + "</span>" + "<span id=\"live-phase-status\" class=\"live-small\">" + esc(recorded ? std::string() : std::string(phase_text)) + "</span></footer></section></div><aside id=\"live-detail\" class=\"live-detail live-panel\"><header class=\"live-panel-heading\"><div class=\"live-detail-heading\"><h2>" + "<span id=\"live-owner-team\">" + esc(owner.at("team").at("name").get<std::string>()) + "</span></h2><p><span id=\"live-owner-name\">" + esc(owner.at("name").get<std::string>()) + "</span>" + "</p></div><nav class=\"live-team-switch\" aria-label=\"Managerdetails wechseln\">" +
btn("live-owner-prev", arrow(false), "", "id=\"live-owner-prev\" aria-label=\"Vorheriger Manager\" " + std::string(fixture.at("owners").size() == 1 ? "disabled" : "")) + btn("live-owner-next", arrow(true), "", "id=\"live-owner-next\" aria-label=\"Nächster Manager\" " + std::string(fixture.at("owners").size() == 1 ? "disabled" : "")) + "</nav></header><nav class=\"live-tabs\">";
for (const auto &[id, label] : std::array<std::pair<const char *, const char *>, 5>{{{"team", "Team"}, {"tactics", "Taktik"}, {"opponent", recorded ? "Ergebnisse" : "Gegner"}, {"table", "Live-Tabelle"}, {"stats", "Statistik"}}}) out += btn("live-tab", label, live_tab_ == id ? "selected" : "", "id=\"live-tab-" + std::string(id) + "\" data-id=\"" + id + "\" aria-pressed=\"" + (live_tab_ == id ? "true" : "false") + "\"");
out += "</nav><div id=\"live-detail-body\" class=\"live-detail-body\" tabindex=\"0\">" + live_detail(owner, frame) + "</div><footer class=\"live-detail-footer\">" + btn("live-intervene-lineup", "Aufstellung & Wechsel", "", "id=\"live-lineup-edit\" " + std::string(live_.finished() || (recorded && !live_.running()) ? "disabled" : "")) + "</footer></aside></div>";
out += "<div class=\"live-speed\">" + live_text("+") + "<input id=\"live-speed\" type=\"range\" orientation=\"vertical\" min=\"0\" max=\"4\" step=\"1\" value=\"" + std::to_string(4 - live_.speed()) + "\" aria-label=\"Wiedergabegeschwindigkeit; unten Pause\" aria-valuenow=\"" + std::to_string(live_.speed()) + "\" " + (live_.finished() ? "disabled" : "") + "/><span id=\"live-speed-value\" class=\"live-speed-value\">" + esc(live_.finished() ? "Ende" : live_.speed() ? std::to_string(live_.speed()) + "×" : "Pause") + "</span></div>";
out += "<footer class=\"live-bottom\"><div class=\"live-bottom-actions\">" + btn("live-back", live_.running() ? "Zu Ende spielen" : recorded ? "Zum Schreibtisch" : "Zum Desktop", "", "id=\"live-back\"") + btn("live-pause", live_.speed() ? "Pause" : "Abspielen", "", "id=\"live-pause\" " + std::string(live_.finished() ? "disabled" : "")) + "</div><span id=\"live-playback-status\" class=\"live-bottom-note\">" + esc(live_feedback_.empty() ? (recorded ? std::string() : std::string(phase_text) + " · " + std::to_string(minute) + "′ · keine Spielwertänderung") : live_feedback_) + "</span>" +
btn(live_.finished() ? "live-review" : "live-next", live_.finished() ? "Zur Auswertung" : live_.running() ? "Nächste Minute" : "Nächste Meldung", "", "id=\"" + std::string(live_.finished() ? "live-review" : "live-next") + "\"") + "</footer>";
out += "</div><footer class=\"live-ticker-footer\"><span id=\"live-event-count\" class=\"live-small\">" + esc(recorded && !shown ? std::string() : std::to_string(shown) + (recorded ? (shown == 1 ? " Meldung" : " Meldungen") : " Meldungen · feste Aufzeichnung")) + "</span><span id=\"live-phase-status\" class=\"live-small\">" + esc(phase_text) + "</span></footer></section>";
out += "<aside id=\"live-detail\" class=\"live-detail live-panel\"><header class=\"live-panel-heading\"><div class=\"live-detail-heading\"><h2><span id=\"live-owner-team\">" + esc(owner.at("team").at("name").get<std::string>()) + "</span></h2><p><span id=\"live-owner-name\">" + esc(owner.at("name").get<std::string>()) + "</span></p></div>";
if (fixture.at("owners").size() > 1)
out += "<nav class=\"live-team-switch\" aria-label=\"Manager wechseln\">" + btn("live-owner-prev", arrow(false), "", "id=\"live-owner-prev\" aria-label=\"Vorheriger Manager\"") + btn("live-owner-next", arrow(true), "", "id=\"live-owner-next\" aria-label=\"Nächster Manager\"") + "</nav>";
out += "</header><nav class=\"live-tabs\">";
for (const auto &[id, label] : std::array<std::pair<const char *, const char *>, 5>{{{"team", "Team"}, {"tactics", "Taktik"}, {"opponent", recorded ? "Ergebnisse" : "Gegner"}, {"table", "Tabelle"}, {"stats", "Statistik"}}}) out += btn("live-tab", label, live_tab_ == id ? "selected" : "", "id=\"live-tab-" + std::string(id) + "\" data-id=\"" + id + "\" aria-pressed=\"" + (live_tab_ == id ? "true" : "false") + "\"");
out += "</nav><div id=\"live-detail-body\" class=\"live-detail-body\" tabindex=\"0\">" + live_detail(owner, frame) + "</div><footer class=\"live-detail-footer\">" + btn("live-intervene-lineup", "Aufstellung & Wechsel", "", "id=\"live-lineup-edit\" " + std::string(live_.finished() || (recorded && !live_.running()) ? "disabled" : "")) + "</footer></aside></div></div>";
out += "<footer class=\"live-bottom\"><div class=\"live-bottom-actions\">" + btn("live-back", live_.running() ? "Zu Ende spielen" : recorded ? "Zum Schreibtisch" : "Zum Desktop", "", "id=\"live-back\"") + btn("live-pause", live_.speed() ? "Pause" : "Abspielen", "", "id=\"live-pause\" " + std::string(live_.finished() ? "disabled" : "")) + "</div>";
out += "<div class=\"live-speed\">" + live_text("Tempo") + "<input id=\"live-speed\" type=\"range\" min=\"0\" max=\"4\" step=\"1\" value=\"" + std::to_string(live_.speed()) + "\" aria-label=\"Wiedergabegeschwindigkeit; links Pause\" aria-valuenow=\"" + std::to_string(live_.speed()) + "\" " + (live_.finished() ? "disabled" : "") + "/><span id=\"live-speed-value\" class=\"live-speed-value\">" + esc(live_.finished() ? "Ende" : live_.speed() ? std::to_string(live_.speed()) + "×" : "Pause") + "</span></div>";
if (live_.running())
out += "<div class=\"live-halts\">" + btn("live-halt", "Zur Halbzeit anhalten", live_halt_interval_ ? "selected" : "", "id=\"live-halt-interval\" data-id=\"interval\" aria-pressed=\"" + std::string(live_halt_interval_ ? "true" : "false") + "\"") +
btn("live-halt", "Bei Rückstand anhalten", live_halt_behind_ ? "selected" : "", "id=\"live-halt-behind\" data-id=\"behind\" aria-pressed=\"" + std::string(live_halt_behind_ ? "true" : "false") + "\"") + "</div>";
out += "<span id=\"live-playback-status\" class=\"live-bottom-note\">" + esc(live_feedback_.empty() ? (recorded ? std::string() : std::string(phase_text) + " · " + std::to_string(minute) + "′ · keine Spielwertänderung") : live_feedback_) + "</span>" +
btn(live_.finished() ? "live-review" : "live-next", live_.finished() ? "Zur Auswertung" : live_.running() ? "Nächste Minute" : "Nächste Meldung", "primary", "id=\"" + std::string(live_.finished() ? "live-review" : "live-next") + "\"") + "</footer>";
return out + live_dialog_markup(owner) + "</section>";
}
void App::live_after_render() {
+6
View File
@@ -20,6 +20,12 @@
std::string live_detail(const Json &owner, const Json &frame);
std::string live_dialog_markup(const Json &owner);
std::string live_badge(const Json &, double);
// the two club colours of a match (home, away), far enough apart to tell the sides
std::array<std::string, 2> live_colours(const Json &match);
std::string live_card(const Json &match, const Json &frame, const std::string &layout, size_t index);
std::string live_moment_; // the event whose banner was shown last
bool live_halt_interval_ = false, live_halt_behind_ = false;
std::string live_halted_; // the reason of the last automatic halt, cleared when play resumes
Json live_owner() const;
Json live_owner_rows(const Json &) const;
Json live_owner_state(const Json &) const;
+12 -21
View File
@@ -149,31 +149,22 @@ std::string App::render_tactics() {
"Flache / hohe Bälle", "Flügelbild links",
"Flügelbild rechts", "Einsatz"};
const std::array<int, 8> limits = engine_mode_ ? t.at("limits").get<std::array<int, 8>>() : std::array<int, 8>{3, 3, 3, 3, 1, 1, 1, 11};
const std::array<std::array<int, 4>, 7> areas = {{{19, 9, 104, 62},
{61, 108, 50, 34},
{63, 84, 54, 30},
{26, 95, 24, 24},
{168, 53, 71, 34},
{137, 10, 58, 47},
{205, 10, 58, 47}}};
// the board is drawn at 8dp a unit (tactics_diagram: 320 x 200 units); the pitch of the
// attitude and the six tiles are its click areas, each with its name underneath
const auto tile = [](size_t i) { return std::array<int, 2>{168 + int((i - 1) % 3) * 46, i <= 3 ? 30 : 80}; };
std::string body =
"<div class=\"tactics-board\"><div class=\"tactics-surface\"></div>" +
picture(renderer_.diagram("tactics", tactics_diagram(t, theme_, engine_mode_ ? t.at("board").at("points") : snap().state.value("lineup", Json::object()).value("points", Json()), engine_mode_ ? t.at("board").at("depth_max").get<int>() : 18, engine_mode_ ? t.at("board").at("lane_max").get<int>() : 8)), 2300,
1864);
// the two switches by name, in chalk under their fields; the board strikes out one that is off
for (size_t k = 0; k < 2; ++k)
body += "<div class=\"tactic-chalk-name" + std::string(t["values"][5 + k].get<int>() ? "" : " off") + "\" style=\"position:absolute;" +
rect((137 + k * 68) / 295.0 * 2300, 47.5 / 206.0 * 1864 + 67, 58 / 295.0 * 2300, 9 / 206.0 * 1864) + "\"><span>" +
(k ? "PRESSING" : "ABSEITSFALLE") + "</span></div>";
"<div class=\"tactics-board\">" +
picture(renderer_.diagram("tactics", tactics_diagram(t, theme_, engine_mode_ ? t.at("board").at("points") : snap().state.value("lineup", Json::object()).value("points", Json()), engine_mode_ ? t.at("board").at("depth_max").get<int>() : 18, engine_mode_ ? t.at("board").at("lane_max").get<int>() : 8)), 2560, 1600);
static const std::array<const char *, 7> chalk_names{"GRUNDAUSRICHTUNG", "FLÜGELSPIEL", "STEILPÄSSE", "ABSCHLAG", "FLACH / HOCH", "ABSEITSFALLE", "PRESSING"};
for (size_t i = 0; i < 7; ++i) {
const auto a = areas[i];
const std::array<int, 4> a = i ? std::array<int, 4>{tile(i)[0], tile(i)[1], 40, 46} : std::array<int, 4>{20, 30, 132, 96};
const bool off = i >= 5 && t["values"][i].get<int>() == 0;
body += "<div class=\"tactic-chalk-name" + std::string(off ? " off" : "") + "\" style=\"position:absolute;" +
rect((a[0] - 6) * 8, (a[1] + a[3] - 11) * 8, (a[2] + 12) * 8, 80) + "\"><span>" + chalk_names[i] + "</span></div>";
body += btn("tactic-cycle", "", "tactic-hotspot",
"id=\"tactic-cycle-" + std::to_string(i) + "\" data-id=\"" +
std::to_string(i) + "\" aria-label=\"" + esc(names[i]) +
"\" style=\"position:absolute;" +
rect(a[0] / 295.0 * 2300, a[1] / 206.0 * 1864,
a[2] / 295.0 * 2300, a[3] / 206.0 * 1864) +
"z-index:" + std::to_string(8 - i) + ";\"");
"\" style=\"position:absolute;" + rect(a[0] * 8, a[1] * 8, a[2] * 8, a[3] * 8) + "\"");
}
const int effort = t["values"][7].get<int>();
body +=
@@ -184,7 +175,7 @@ std::string App::render_tactics() {
"</span></div><input type=\"range\" id=\"tactic-effort\" "
"data-input=\"tactic-effort\" min=\"" + std::to_string(engine_mode_ ? t.at("minima")[7].get<int>() : 0) + "\" max=\"" + std::to_string(limits[7]) + "\" step=\"1\" value=\"" +
std::to_string(effort) +
"\"/></div><p id=\"tactic-hint\" class=\"tactic-hint\">" +
"\"/><div class=\"tactic-effort-ends\"><span>LOCKER</span><span>VOLLGAS</span></div></div><p id=\"tactic-hint\" class=\"tactic-hint\">" +
(engine_mode_
? "<strong>" + esc(names[size_t(last_tactic_)] + ": " + tactic_value_text(size_t(last_tactic_), t["values"][size_t(last_tactic_)].get<int>(), limits[size_t(last_tactic_)])) + "</strong><span>" + esc(tactic_effect_text(size_t(last_tactic_))) + "</span>"
: esc(names[size_t(last_tactic_)]) + ": " +
+66 -2
View File
@@ -309,6 +309,40 @@ public:
const auto &r = entries_.at(found->second).raster;
return {found->second, r.width, r.height};
}
// A club's colour, read from its crest: the strongest hue among its opaque pixels, dark
// enough to carry white type. Empty when the crest has no colour to speak of.
std::string crest_colour(const std::string &key) {
const auto identity = "crest-colour:" + key;
if (const auto found = keys_.find(identity); found != keys_.end()) return found->second;
std::string colour;
const auto source = image(key, true);
if (!source.token.empty()) {
const auto &raster = entries_.at(source.token).raster;
std::array<double, 12> weight{}, red{}, green{}, blue{};
for (size_t i = 0; i + 3 < raster.pixels.size(); i += 4) {
const int r = raster.pixels[i], g = raster.pixels[i + 1], b = raster.pixels[i + 2], a = raster.pixels[i + 3];
const int high = std::max({r, g, b}), low = std::min({r, g, b});
if (a < 200 || high - low < 60 || high < 70) continue;
double hue = high == r ? double(g - b) / (high - low) : high == g ? 2 + double(b - r) / (high - low) : 4 + double(r - g) / (high - low);
if (hue < 0) hue += 6;
const size_t bucket = size_t(hue * 2) % 12;
const double w = double(high - low) / 255;
weight[bucket] += w; red[bucket] += r * w; green[bucket] += g * w; blue[bucket] += b * w;
}
const size_t best = size_t(std::max_element(weight.begin(), weight.end()) - weight.begin());
if (weight[best] > 40) {
double r = red[best] / weight[best], g = green[best] / weight[best], b = blue[best] / weight[best];
// white type needs a dark ground
const double light = (.299 * r + .587 * g + .114 * b) / 255;
if (light > .46) { const double f = .46 / light; r *= f; g *= f; b *= f; }
char text[8];
std::snprintf(text, sizeof text, "#%02x%02x%02x", int(r), int(g), int(b));
colour = text;
}
}
keys_[identity] = colour;
return colour;
}
Picture crest(const std::string &key, bool light_surface) {
const auto source = image(key, true);
if (!light_surface || source.token.empty()) return source;
@@ -486,6 +520,7 @@ class App final : public Rml::EventListener {
uint64_t opening_due_ = 0;
bool opening_io_blocked_ = false;
int last_tactic_ = 0;
std::string window_shown_ = "\x01"; // the menu whose window is on screen (window())
#include "modern/ui/engine_state.inc"
#include "modern/ui/settings_state.inc"
@@ -573,7 +608,10 @@ class App final : public Rml::EventListener {
}
std::string window(const std::string &heading, const std::string &content,
bool close = true) {
return "<div class=\"window\"><div class=\"titlebar\">" +
// a sheet of paper on two more; it slides in once when its menu opens, not on every redraw
const std::string arriving = window_shown_ == menu_ ? "" : " window-in";
window_shown_ = menu_;
return "<div class=\"sheet-under first" + arriving + "\"></div><div class=\"sheet-under second" + arriving + "\"></div><div class=\"window" + arriving + "\"><div class=\"titlebar\">" +
(close ? btn("close", "<span>×</span>", "close", "id=\"window-close\" aria-label=\"" + std::string(menu_ == "bank" && bank_view_ != "entrance" ? "Zurück zur Bankhalle" : "Fenster schließen") + "\"")
: "<span style=\"width:76dp;\"></span>") +
"<h1>" + esc(heading) + "</h1></div><div class=\"content\">" +
@@ -882,7 +920,8 @@ class App final : public Rml::EventListener {
}
// Called after the stage was rebuilt: zoom in when it now shows a menu window.
void sync_window_zoom() {
const bool wanted = doc_->QuerySelector(".window") != nullptr;
const bool wanted = doc_->QuerySelector(".window") != nullptr || doc_->QuerySelector(".live-stage") != nullptr;
if (!wanted) window_shown_ = "\x01";
if (wanted == window_zoom_) return;
window_zoom_ = wanted;
resize();
@@ -1280,6 +1319,30 @@ class App final : public Rml::EventListener {
bold_italic = Rml::LoadFontFace(
rml::asset_path(assets_ / "LatoLatin-BoldItalic.ttf"), "Modern",
Rml::Style::FontStyle::Italic, Rml::Style::FontWeight::Bold);
// The display serif for headings and names, and the chalk hand of the tactics board;
// both ship with the game. Without the files the text falls back to the system fonts below.
const auto own = assets_ / "fonts";
bool display = fs::exists(own / "SourceSerif4-Regular.ttf") &&
Rml::LoadFontFace(rml::asset_path(own / "SourceSerif4-Regular.ttf"), "Display", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Normal);
if (display && fs::exists(own / "SourceSerif4-Semibold.ttf"))
Rml::LoadFontFace(rml::asset_path(own / "SourceSerif4-Semibold.ttf"), "Display", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Bold);
bool chalk = fs::exists(own / "CabinSketch-Regular.ttf") &&
Rml::LoadFontFace(rml::asset_path(own / "CabinSketch-Regular.ttf"), "Chalk", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Normal);
if (chalk && fs::exists(own / "CabinSketch-Bold.ttf"))
Rml::LoadFontFace(rml::asset_path(own / "CabinSketch-Bold.ttf"), "Chalk", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Bold);
if (!display) {
std::vector<fs::path> serif;
#ifdef _WIN32
if (const char *windir = std::getenv("WINDIR")) serif = {fs::path(windir) / "Fonts" / "georgia.ttf", fs::path(windir) / "Fonts" / "times.ttf"};
#elif defined(__APPLE__)
serif = {"/System/Library/Fonts/Supplemental/Georgia.ttf", "/System/Library/Fonts/NewYork.ttf", "/System/Library/Fonts/Times.ttc"};
#else
serif = {"/usr/share/fonts/truetype/liberation2/LiberationSerif-Regular.ttf", "/usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf"};
#endif
serif.push_back(assets_ / "LatoLatin-Regular.ttf");
for (const auto &font : serif)
if (fs::exists(font) && Rml::LoadFontFace(rml::asset_path(font), "Display", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Normal)) break;
}
std::vector<fs::path> chalk_fonts;
#ifdef _WIN32
if (const char *windir = std::getenv("WINDIR")) {
@@ -1296,6 +1359,7 @@ class App final : public Rml::EventListener {
"/usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf"};
#endif
chalk_fonts.push_back(assets_ / "LatoLatin-Regular.ttf");
if (!chalk)
for (const auto &font : chalk_fonts)
if (fs::exists(font) && Rml::LoadFontFace(rml::asset_path(font), "Chalk",
Rml::Style::FontStyle::Normal,