Commit 97ca02f
authored
Spray an optional edition tag across the MegaMek logo on the splash screen (#8711)
## Summary
MegaMek can now say which edition a build is, right on the artwork: a
short tag sprayed straight
across the MegaMek logo in red spray-paint lettering, outlined in black
so it stays readable over the
pale wordmark underneath.
It follows the `notes=` entry added in #8710, and is driven the same
way. Put this in
`megamek/resources/Version.properties`:
```properties
splashTag=Core Rules Edition
```
and "Core Rules Edition" appears sprayed across the logo, tilted
slightly off level. Leave the entry
out and the artwork is exactly as it is today.
It is deliberately a **separate** entry from `notes=`, so the artwork
and the menu can say different
things - this build says "Core Rules Release" in the menu and "Core
Rules Edition" on the logo - or a
build can have one without the other.
**This PR ships the tag switched on**, labelling the build as the Core
Rules Edition.
## The font
The lettering uses the **Rubik Spray Paint** font, under the SIL Open
Font License 1.1. It is already
on `MegaMek/mm-data` main at `data/fonts/Rubik_Spray_Paint/`, holding
`RubikSprayPaint-Regular.ttf` and
`OFL.txt`, laid out the same way as `Anta/` and `Jura/`. MegaMek
registers everything under
`data/fonts` automatically, so there is no loader change here.
If the font is ever missing - an un-staged or stale data directory - the
tag is still drawn, in the
default font, and a warning naming the missing font goes to
`megamek.log`. It degrades rather than
breaks.
## Changes
1. **A new optional `splashTag` entry in `Version.properties`**,
documented in the file next to
`notes`.
2. **`Version` reads it**, alongside the other optional entries, reusing
the same
"absent or blank means nothing configured" handling. Everything added is
`static`, so nothing
changes about how a `Version` travels in a packet or a save game.
3. **`MegaMekGUI` paints it** onto the splash artwork: it loads the font
once when the menu is built,
then sizes and places the tag against the logo each time the artwork is
drawn.
4. **`drawLogo` now returns the rectangle it drew into**, which is what
the tag is positioned against.
Its drawing behaviour is unchanged.
### Two things worth knowing for review
**The tag is placed against the wordmark plate, not the middle of the
logo image.** The obvious
approach - centre the tag on the logo - puts it up on the 'Mek's legs,
because `mm-logo.png` is a tall
composite: a 'Mek standing above the wordmark plate, with the plate
filling only the bottom quarter or
so. Profiling the image's transparency, the plate is the full-width band
running from about
three-quarters of the way down to the bottom edge, so the tag is placed
against that band instead.
**The tag is capped by height as well as width.** Sizing it purely to
span the logo's width means a
short tag gets a huge font - "BETA" would come out taller than the plate
it is supposed to be sprayed
across. The size is therefore the smaller of "fits the width" and "fits
the plate's height".
Everything is derived from the logo's own rectangle, which is itself
derived from the window size, so
the placement holds at any launcher size rather than being tuned to one
screen.
## Files Changed
- `megamek/resources/Version.properties` - the new entry, documented,
with the Core Rules Edition tag
set
- `megamek/src/megamek/Version.java` - reads it; `getSplashTag()` and
`hasSplashTag()`
- `megamek/src/megamek/client/ui/clientGUI/MegaMekGUI.java` - loads the
font, sizes and sprays the tag,
and `drawLogo` now reports where it drew
## Testing
- `compileJava`, `compileTestJava`, `VersionTest` (31/31) and checkstyle
all clean.
- Run in-game repeatedly while settling the look. The final version was
checked against a clean
`megamek.log`: no ERROR, FATAL or null-pointer entries, and the expected
`[SplashTag] Spraying 'Core Rules Edition' onto the splash artwork in
Rubik Spray Paint` line.
- The placement was worked out by measuring the logo image's
transparency per row to find where the
wordmark plate actually sits, rather than by eye.
- The sizing and placement were then checked numerically across launcher
widths of 800, 1024, 1280,
1600, 1920, 2560 and 3200 pixels, and across tags from 4 to 35
characters ("BETA" through "The
Twenty Fifth Anniversary Edition"). In every combination the tag lands
on the plate and stays inside
the artwork, with between 7 and 46 pixels to spare at the bottom.
## What is NOT proven yet
- **No automated test covers the tag.** The checks above were done with
a throwaway harness, not a
committed test. Making the sizing testable would mean pulling it out of
the painting code; I am happy
to do that if reviewers would rather have it guarded.
- **Only run at the default GUI scale and the default window size** for
the visual check. The numeric
check above covers other sizes, but I have only *looked* at one.
- **Only run with one skin.** The tag is painted onto the splash artwork
rather than onto a skinned
component, so a skin should not affect it - but that is reasoning, not
something I have tried.
- **The font has not been through a release build.** It works from a
staged data directory, and it is
on mm-data main; I have not confirmed it survives packaging into a
distributed build.3 files changed
Lines changed: 360 additions & 2 deletions
File tree
- megamek
- resources
- src/megamek
- client/ui/clientGUI
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
91 | 111 | | |
92 | 112 | | |
93 | 113 | | |
| |||
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
117 | 140 | | |
118 | 141 | | |
119 | 142 | | |
| |||
318 | 341 | | |
319 | 342 | | |
320 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
321 | 374 | | |
322 | 375 | | |
323 | 376 | | |
| |||
398 | 451 | | |
399 | 452 | | |
400 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
401 | 499 | | |
402 | 500 | | |
403 | 501 | | |
| |||
0 commit comments