Title screen: «Грати» tied to the server status, status icon, «Сервери», icon row, gap under the logo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1dcefc772c
commit
3876cb39a5
+90
-6
@@ -188,8 +188,15 @@ def fit(im: Image.Image, max_w: int, max_h: int) -> Image.Image:
|
||||
return im.resize((im.width * k, im.height * k), Image.NEAREST)
|
||||
|
||||
|
||||
# The quit button of the title screen: a door frame with an arrow going out — the library's "sign-out" icon redrawn
|
||||
# on the 13 px grid of Minecraft's own button icons. '#' is white, '+' the light grey Minecraft shades them with.
|
||||
# Icons of the title screen, drawn on the 13 px grid of Minecraft's own button icons. Each one redraws an icon of the
|
||||
# FD Icons library (named in the comment). '.' is empty; the other letters are colours from ICON_COLOURS.
|
||||
ICON_COLOURS = {
|
||||
'#': (255, 255, 255), '+': (208, 208, 208), # white and the light grey Minecraft shades its icons with
|
||||
'G': (58, 200, 18), 'g': (0, 150, 0), # server is online
|
||||
'R': (224, 64, 58), 'r': (160, 38, 32), # server is offline
|
||||
'A': (249, 168, 37), 'a': (190, 110, 20), # maintenance
|
||||
}
|
||||
|
||||
QUIT_ICON = '''
|
||||
#######......
|
||||
#++++++......
|
||||
@@ -204,16 +211,90 @@ QUIT_ICON = '''
|
||||
#+...........
|
||||
#######......
|
||||
+++++++......
|
||||
'''
|
||||
''' # sign-out: a door frame with an arrow going out
|
||||
|
||||
SETTINGS_ICON = '''
|
||||
.....###.....
|
||||
..#..###..#..
|
||||
.###########.
|
||||
..#########..
|
||||
..###+++###..
|
||||
#####...#####
|
||||
#####...#####
|
||||
#####...#####
|
||||
++###...###++
|
||||
..#########..
|
||||
.###########.
|
||||
.+#++###++#+.
|
||||
.....+++.....
|
||||
''' # settings: a gear
|
||||
|
||||
ONLINE_ICON = '''
|
||||
....GGGGG....
|
||||
..GGGGGGGGG..
|
||||
.GGGGGGGGGGG.
|
||||
.GGGGGGGG##G.
|
||||
GGGGGGGG###GG
|
||||
GGGGGGG###GGG
|
||||
GG##GG###GGGG
|
||||
GG######GGGGG
|
||||
GGg####GGGGGg
|
||||
.Ggg##GGGGGg.
|
||||
.gGGGGGGGGgg.
|
||||
..ggGGGGGgg..
|
||||
....ggggg....
|
||||
''' # check-circle
|
||||
|
||||
OFFLINE_ICON = '''
|
||||
....RRRRR....
|
||||
..RRRRRRRRR..
|
||||
.RRRRRRRRRRR.
|
||||
.RR##RRR##RR.
|
||||
RRR###R###RRR
|
||||
RRRR#####RRRR
|
||||
RRRRR###RRRRR
|
||||
RRRR#####RRRR
|
||||
RRr###R###RRr
|
||||
.Rr##RRR##Rr.
|
||||
.rRRRRRRRRrr.
|
||||
..rrRRRRRrr..
|
||||
....rrrrr....
|
||||
''' # close-circle
|
||||
|
||||
MAINTENANCE_ICON = '''
|
||||
........AAA..
|
||||
.......AAA...
|
||||
......AAA....
|
||||
......AAA...A
|
||||
......AAAA.AA
|
||||
......AAAAAAa
|
||||
.....AAAAAAa.
|
||||
....AAAAaaa..
|
||||
...AAAAa.....
|
||||
..AAAAa......
|
||||
.AAAAa.......
|
||||
AAAAa........
|
||||
AAAa.........
|
||||
''' # wrench
|
||||
|
||||
|
||||
def button_icon(rows: str) -> Image.Image:
|
||||
"""A 20x20 picture for a 20x20 button; the drawing starts at (4, 4), where Minecraft puts its own icons."""
|
||||
def button_icon(rows: str, outline: bool = False) -> Image.Image:
|
||||
"""A 20x20 picture for a 20x20 button; the drawing starts at (4, 4), where Minecraft puts its own icons.
|
||||
An icon shown without a button behind it gets a dark outline, so it reads on any background."""
|
||||
im = Image.new('RGBA', (20, 20), (0, 0, 0, 0))
|
||||
for y, row in enumerate(rows.split()):
|
||||
for x, c in enumerate(row):
|
||||
if c != '.':
|
||||
im.putpixel((4 + x, 4 + y), (255, 255, 255, 255) if c == '#' else (208, 208, 208, 255))
|
||||
im.putpixel((4 + x, 4 + y), ICON_COLOURS[c] + (255,))
|
||||
if outline:
|
||||
solid = np.asarray(im)[..., 3] > 0
|
||||
near = np.zeros_like(solid)
|
||||
for dy in (-1, 0, 1):
|
||||
for dx in (-1, 0, 1):
|
||||
near |= shift(solid, dy, dx)
|
||||
edge = Image.new('RGBA', im.size, INK + (255,))
|
||||
edge.putalpha(Image.fromarray(((near & ~solid) * 255).astype(np.uint8)))
|
||||
im = Image.alpha_composite(edge, im)
|
||||
return im
|
||||
|
||||
|
||||
@@ -280,6 +361,9 @@ def main() -> None:
|
||||
shade(cover(art, 1920, 1080), *((0.95, 1.0) if night else (0.80, 0.92))).convert('RGB').save(OUT / 'menu' / 'background.png')
|
||||
stack([wordmark(8), motto(3)], gap=12).save(OUT / 'menu' / 'logo.png')
|
||||
button_icon(QUIT_ICON).save(OUT / 'menu' / 'quit.png')
|
||||
button_icon(SETTINGS_ICON).save(OUT / 'menu' / 'settings.png')
|
||||
for name, rows in (('online', ONLINE_ICON), ('offline', OFFLINE_ICON), ('maintenance', MAINTENANCE_ICON)):
|
||||
button_icon(rows, outline=True).save(OUT / 'menu' / f'status-{name}.png')
|
||||
print('done:', ', '.join(sorted(str(p.relative_to(OUT)).replace('\\', '/') for p in OUT.rglob('*.png'))))
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
<config dir> is the client pack's config/ or a profile's config/. The version is read from pack.toml next to the
|
||||
config dir when it is not given.
|
||||
|
||||
Layout: the key art as the background, our logo instead of Minecraft's, one wide button that joins the server,
|
||||
single player and multiplayer, then language, options and an icon-only quit button in one row. Minecraft's own
|
||||
lines in the bottom left corner are replaced with the pack version. The layout file itself is
|
||||
Layout: the key art as the background, our logo instead of Minecraft's, a wide "Грати" button that joins the server
|
||||
(active only while the server is online) with a status icon beside it, single player and the server list, then a
|
||||
row of icon buttons: language, options, quit. Minecraft's own lines in the bottom left corner are replaced with
|
||||
the pack version. The layout file itself is
|
||||
branding/menu/title_screen_layout.txt; this script copies it with the pictures, draws the version label and
|
||||
switches the window title, the window icon and the title-screen customisation on.
|
||||
"""
|
||||
@@ -58,9 +59,8 @@ def main() -> None:
|
||||
version_label = label(Font(jar), f'{WINDOW_TITLE} {version}')
|
||||
(fm / 'assets').mkdir(parents=True, exist_ok=True)
|
||||
(fm / 'customization').mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(MENU / 'logo.png', fm / 'assets' / 'logo.png')
|
||||
shutil.copyfile(MENU / 'background.png', fm / 'assets' / 'background.png')
|
||||
shutil.copyfile(MENU / 'quit.png', fm / 'assets' / 'quit.png')
|
||||
for picture in MENU.glob('*.png'): # background, logo, button and status icons
|
||||
shutil.copyfile(picture, fm / 'assets' / picture.name)
|
||||
version_label.save(fm / 'assets' / 'version.png')
|
||||
for icon in ('favicon-16x16.png', 'favicon-32x32.png'):
|
||||
shutil.copyfile(ICONS / icon, fm / 'assets' / icon)
|
||||
|
||||
Reference in New Issue
Block a user