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'))))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user