diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 0190308..78a6532 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -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) | diff --git a/assets/modern/fonts/CabinSketch-Bold.ttf b/assets/modern/fonts/CabinSketch-Bold.ttf new file mode 100644 index 0000000..4fb6f10 Binary files /dev/null and b/assets/modern/fonts/CabinSketch-Bold.ttf differ diff --git a/assets/modern/fonts/CabinSketch-OFL.txt b/assets/modern/fonts/CabinSketch-OFL.txt new file mode 100644 index 0000000..9c21121 --- /dev/null +++ b/assets/modern/fonts/CabinSketch-OFL.txt @@ -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. diff --git a/assets/modern/fonts/CabinSketch-Regular.ttf b/assets/modern/fonts/CabinSketch-Regular.ttf new file mode 100644 index 0000000..93fd6c0 Binary files /dev/null and b/assets/modern/fonts/CabinSketch-Regular.ttf differ diff --git a/assets/modern/fonts/SourceSerif4-LICENSE.md b/assets/modern/fonts/SourceSerif4-LICENSE.md new file mode 100644 index 0000000..5871e1f --- /dev/null +++ b/assets/modern/fonts/SourceSerif4-LICENSE.md @@ -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. diff --git a/assets/modern/fonts/SourceSerif4-Regular.ttf b/assets/modern/fonts/SourceSerif4-Regular.ttf new file mode 100644 index 0000000..964a2bf Binary files /dev/null and b/assets/modern/fonts/SourceSerif4-Regular.ttf differ diff --git a/assets/modern/fonts/SourceSerif4-Semibold.ttf b/assets/modern/fonts/SourceSerif4-Semibold.ttf new file mode 100644 index 0000000..151e9a9 Binary files /dev/null and b/assets/modern/fonts/SourceSerif4-Semibold.ttf differ diff --git a/assets/modern/live.rcss b/assets/modern/live.rcss index b76d95e..d24a1f1 100644 --- a/assets/modern/live.rcss +++ b/assets/modern/live.rcss @@ -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;} diff --git a/assets/modern/sports.rcss b/assets/modern/sports.rcss index 8fb79cd..c953721 100644 --- a/assets/modern/sports.rcss +++ b/assets/modern/sports.rcss @@ -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;} diff --git a/assets/modern/theme.rcss b/assets/modern/theme.rcss index d57d5e1..72f578f 100644 --- a/assets/modern/theme.rcss +++ b/assets/modern/theme.rcss @@ -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;} diff --git a/docs/licenses/CabinSketch.txt b/docs/licenses/CabinSketch.txt new file mode 100644 index 0000000..9c21121 --- /dev/null +++ b/docs/licenses/CabinSketch.txt @@ -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. diff --git a/docs/licenses/SourceSerif4.txt b/docs/licenses/SourceSerif4.txt new file mode 100644 index 0000000..5871e1f --- /dev/null +++ b/docs/licenses/SourceSerif4.txt @@ -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. diff --git a/src/modern/ui/CMakeLists.txt b/src/modern/ui/CMakeLists.txt index 9cae906..ce93e4a 100644 --- a/src/modern/ui/CMakeLists.txt +++ b/src/modern/ui/CMakeLists.txt @@ -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) diff --git a/src/modern/ui/controls.inc b/src/modern/ui/controls.inc index e603c13..b78f78f 100644 --- a/src/modern/ui/controls.inc +++ b/src/modern/ui/controls.inc @@ -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())); else if (type == "checkpoint") { diff --git a/src/modern/ui/demo_sports.cpp b/src/modern/ui/demo_sports.cpp index a31602c..63e8f00 100644 --- a/src/modern/ui/demo_sports.cpp +++ b/src/modern/ui/demo_sports.cpp @@ -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 << ""; - // frame and slate; the wiped patches of an often used board - out << "" - "" - ""; - for (int i = 0; i < 9; ++i) { - const double cx = 40 + i * 27 + wobble(12), cy = 30 + (i % 3) * 45 + wobble(14); - out << ""; + out << "" + "" + ""; + for (int i = 0; i < 10; ++i) { + const double cx = 34 + i * 28 + wobble(12), cy = 34 + (i % 3) * 52 + wobble(14); + out << ""; } - // chalk tray with two pieces of chalk - out << "" - "" - ""; + out << "" + "" + ""; + // 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, 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{-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{-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{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> 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> 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 << ""; return out.str(); diff --git a/src/modern/ui/engine_sports.inc b/src/modern/ui/engine_sports.inc index 3b9cc6e..831f458 100644 --- a/src/modern/ui/engine_sports.inc +++ b/src/modern/ui/engine_sports.inc @@ -13,9 +13,9 @@ bool App::engine_sports_dirty() const { std::string App::engine_sports_footer() { const bool training = menu_ == "training"; return "

" + (training ? rect(0, 1580, 1060, 112) : rect(0, 1688, 2616, 60) + "text-align:center;") + "\">

" "
" + + (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;\"") + "
"; } diff --git a/src/modern/ui/live_controls.inc b/src/modern/ui/live_controls.inc index 37103a9..f00b4bd 100644 --- a/src/modern/ui/live_controls.inc +++ b/src/modern/ui/live_controls.inc @@ -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()) || 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() : score[1].get()) < (home ? score[1].get() : score[0].get())) 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(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(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; } diff --git a/src/modern/ui/live_screens.inc b/src/modern/ui/live_screens.inc index efd6b86..bd15c9c 100644 --- a/src/modern/ui/live_screens.inc +++ b/src/modern/ui/live_screens.inc @@ -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 += "
()) + "\">" + live_text(std::to_string(event.at("minute").get()) + "′", "live-event-time") + (kind == "kickoff" || kind == "interval" || kind == "fulltime" ? "
" : live_badge(match.at(event.at("side").get()), 54)) + - "
" + (fixture.at("source") == "engine-recording" && fixture.at("matches").size() == 1 ? std::string() : live_text(match.at("home").at("name").get() + " · " + match.at("away").at("name").get(), "live-event-owners")) + "

" + live_text(event.at("headline")) + "

" + live_text(event.at("body")) + "

" + live_text(live_score_text(event.at("score")), "live-event-score") + "
"; + const bool whistle = kind == "kickoff" || kind == "interval" || kind == "fulltime"; + const auto side = event.at("side").get(); + // one line per report: minute, what happened (a mark by kind), the club, the wording, the score + std::string row = "
()) + "\""; + 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()) + "′", "live-event-time") + + "
" + + (whistle ? "
" : live_badge(match.at(side), 54)) + + "
" + + (several || !recorded ? live_text(match.at("home").at("name").get() + " – " + match.at("away").at("name").get(), "live-event-owners") : std::string()) + + "

" + live_text(event.at("headline")) + "

" + live_text(event.at("body")) + "

" + + live_text(live_score_text(event.at("score")), "live-event-score") + "
"; + 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 += "

" + live_text(fixture.at("source") == "engine-recording" ? "Noch keine Meldungen." : "Für diesen Filter liegt noch keine Demomeldung vor.") + "

"; + if (!shown) out += "

" + live_text(recorded ? "Noch keine Meldungen." : "Für diesen Filter liegt noch keine Demomeldung vor.") + "

"; return out; } +std::array 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 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(); + 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 = ""; + + // 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 += ""; + 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(); + 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 += "" + ""; + else if (kind == "yellow" || kind == "red" || kind == "second_yellow") + marks += ""; + else if (kind == "injury") + marks += ""; + } + const double now = std::clamp(minute * W / duration, 0.0, W); + const std::string timeline = "" + bands + + "" + "" + "" + marks + + (live_.finished() ? std::string() : "") + ""; + + const int total = press[0] + press[1]; + const double share = total ? 100.0 * press[0] / total : 50; + const auto phase = frame.at("phase").get(); + 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 out = ""; +} 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(); 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", "", 72), 36, 36); }; - std::string out = "
()) + "\">
" + (recorded ? std::string() : live_text("SPIELTAG · LIVE-TICKER", "live-eyebrow")) + - "

" + 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")) + "

" + live_text(recorded ? ui_long_date(fixture.value("date", std::string())) : std::string("UI-Demo · vorgegebene Ergebnisse"), "live-demo-tag") + "
"; - const auto scoreline = [&](const Json &match) { - const auto &value = live_score_by_id(frame, match.at("id")); - return "
" + 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") + "
"; - }; - out += "
"; - 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(); } - out += ""; - } - out += "

" + live_text(recorded ? "Ticker" : "Gemeinsamer Live-Ticker") + "

" + (recorded && fixture.at("owners").size() == 1 ? std::string() : live_text(live_coverage_ == "single" ? "Gewählte Partie" : "Alle Manager", "live-small")) + "
"; size_t shown = 0; out += live_ticker_events(frame, shown); - out += "
" "" + esc(recorded && !shown ? std::string() : std::to_string(shown) + (live_.fixture().at("source") == "engine-recording" ? (shown == 1 ? " Meldung" : " Meldungen") : " Meldungen · feste Aufzeichnung")) + "" + "" + esc(recorded ? std::string() : std::string(phase_text)) + "
"; - out += "
" + live_text("+") + "" + esc(live_.finished() ? "Ende" : live_.speed() ? std::to_string(live_.speed()) + "×" : "Pause") + "
"; - out += "
" + 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" : "")) + "
" + esc(live_feedback_.empty() ? (recorded ? std::string() : std::string(phase_text) + " · " + std::to_string(minute) + "′ · keine Spielwertänderung") : live_feedback_) + "" + - 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") + "\"") + "
"; + out += "
" + esc(recorded && !shown ? std::string() : std::to_string(shown) + (recorded ? (shown == 1 ? " Meldung" : " Meldungen") : " Meldungen · feste Aufzeichnung")) + "" + esc(phase_text) + "
"; + out += ""; + out += "
" + 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" : "")) + "
"; + out += "
" + live_text("Tempo") + "" + esc(live_.finished() ? "Ende" : live_.speed() ? std::to_string(live_.speed()) + "×" : "Pause") + "
"; + if (live_.running()) + out += "
" + 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") + "\"") + "
"; + out += "" + esc(live_feedback_.empty() ? (recorded ? std::string() : std::string(phase_text) + " · " + std::to_string(minute) + "′ · keine Spielwertänderung") : live_feedback_) + "" + + 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") + "\"") + "
"; return out + live_dialog_markup(owner) + ""; } void App::live_after_render() { diff --git a/src/modern/ui/live_state.inc b/src/modern/ui/live_state.inc index 9994958..ce2339a 100644 --- a/src/modern/ui/live_state.inc +++ b/src/modern/ui/live_state.inc @@ -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 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; diff --git a/src/modern/ui/sports_screens.inc b/src/modern/ui/sports_screens.inc index 2c03869..92eb3d0 100644 --- a/src/modern/ui/sports_screens.inc +++ b/src/modern/ui/sports_screens.inc @@ -149,31 +149,22 @@ std::string App::render_tactics() { "Flache / hohe Bälle", "Flügelbild links", "Flügelbild rechts", "Einsatz"}; const std::array limits = engine_mode_ ? t.at("limits").get>() : std::array{3, 3, 3, 3, 1, 1, 1, 11}; - const std::array, 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{168 + int((i - 1) % 3) * 46, i <= 3 ? 30 : 80}; }; std::string body = - "
" + - 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() : 18, engine_mode_ ? t.at("board").at("lane_max").get() : 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 += "
() ? "" : " 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) + "\">" + - (k ? "PRESSING" : "ABSEITSFALLE") + "
"; + "
" + + 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() : 18, engine_mode_ ? t.at("board").at("lane_max").get() : 8)), 2560, 1600); + static const std::array 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 a = i ? std::array{tile(i)[0], tile(i)[1], 40, 46} : std::array{20, 30, 132, 96}; + const bool off = i >= 5 && t["values"][i].get() == 0; + body += "
" + chalk_names[i] + "
"; 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(); body += @@ -184,7 +175,7 @@ std::string App::render_tactics() { "
() : 0) + "\" max=\"" + std::to_string(limits[7]) + "\" step=\"1\" value=\"" + std::to_string(effort) + - "\"/>

" + + "\"/>

LOCKERVOLLGAS

" + (engine_mode_ ? "" + esc(names[size_t(last_tactic_)] + ": " + tactic_value_text(size_t(last_tactic_), t["values"][size_t(last_tactic_)].get(), limits[size_t(last_tactic_)])) + "" + esc(tactic_effect_text(size_t(last_tactic_))) + "" : esc(names[size_t(last_tactic_)]) + ": " + diff --git a/src/modern/ui/view.cpp b/src/modern/ui/view.cpp index 4e1b0a4..b838e25 100644 --- a/src/modern/ui/view.cpp +++ b/src/modern/ui/view.cpp @@ -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 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 "

" + + // 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 "
" + (close ? btn("close", "×", "close", "id=\"window-close\" aria-label=\"" + std::string(menu_ == "bank" && bank_view_ != "entrance" ? "Zurück zur Bankhalle" : "Fenster schließen") + "\"") : "") + "

" + esc(heading) + "

" + @@ -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 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 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,