diff --git a/branding/resources/createrp/font/tab.json b/branding/resources/createrp/font/tab.json new file mode 100644 index 0000000..9c27fdb --- /dev/null +++ b/branding/resources/createrp/font/tab.json @@ -0,0 +1,31 @@ +{ + "providers": [ + { + "type": "bitmap", + "file": "createrp:font/tab_header.png", + "height": 48, + "ascent": 46, + "chars": [ + "\ue000" + ] + }, + { + "type": "bitmap", + "file": "createrp:font/tab_sun.png", + "height": 8, + "ascent": 7, + "chars": [ + "\ue001" + ] + }, + { + "type": "bitmap", + "file": "createrp:font/tab_moon.png", + "height": 8, + "ascent": 7, + "chars": [ + "\ue002" + ] + } + ] +} \ No newline at end of file diff --git a/branding/resources/createrp/textures/font/tab_header.png b/branding/resources/createrp/textures/font/tab_header.png new file mode 100644 index 0000000..9aec34f Binary files /dev/null and b/branding/resources/createrp/textures/font/tab_header.png differ diff --git a/branding/resources/createrp/textures/font/tab_moon.png b/branding/resources/createrp/textures/font/tab_moon.png new file mode 100644 index 0000000..3e5dada Binary files /dev/null and b/branding/resources/createrp/textures/font/tab_moon.png differ diff --git a/branding/resources/createrp/textures/font/tab_sun.png b/branding/resources/createrp/textures/font/tab_sun.png new file mode 100644 index 0000000..5135e0f Binary files /dev/null and b/branding/resources/createrp/textures/font/tab_sun.png differ diff --git a/tools/branding/build.py b/tools/branding/build.py index ac96791..e8c5c8b 100644 --- a/tools/branding/build.py +++ b/tools/branding/build.py @@ -7,6 +7,7 @@ stored here), the key art illustration (branding/art/keyart.png) and, if given, snapped to a coarse pixel grid. Output goes to branding/ next to this repo's images. """ import io +import json import math import sys import zipfile @@ -195,8 +196,29 @@ ICON_COLOURS = { '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 + 'Y': (255, 216, 61), 'M': (214, 222, 240), # sun and moon in the player list } +SUN_ICON = ''' +Y..Y..Y +.Y.Y.Y. +..YYY.. +YYYYYYY +..YYY.. +.Y.Y.Y. +Y..Y..Y +''' + +MOON_ICON = ''' +..MMM.. +.MM.... +MM..... +MM..... +MM..... +.MM.... +..MMM.. +''' + QUIT_ICON = ''' #######....... #............. @@ -609,6 +631,32 @@ def main() -> None: if path in meta: target.with_name(target.name + '.mcmeta').write_text(meta[path], encoding='utf-8', newline='\n') + # --- the player list (Tab): pictures shown as characters of a font of ours, createrp:tab ------------------------- + # Drawn three texels per GUI pixel, so they are pixel for pixel at GUI scale 3. The bridge mod sends the characters. + tab_logo = stack([wordmark(6), motto(3)], gap=9) + line = Image.new('RGBA', (tab_logo.width, 21)) + for x in range(tab_logo.width // 10, tab_logo.width - tab_logo.width // 10): + for y in range(9, 12): + line.putpixel((x, y), BRASS[2] + (255,)) + for y in range(12, 15): + line.putpixel((x, y), BRASS[0] + (255,)) + cog = gear(7).resize((21, 21), Image.NEAREST) + line.alpha_composite(cog, ((line.width - 21) // 2, 0)) + header = stack([tab_logo, line], gap=9) + header = stack([header, Image.new('RGBA', (1, -header.height % 3))], gap=0) + font_dir = OUT / 'resources' / 'createrp' + (font_dir / 'textures' / 'font').mkdir(parents=True, exist_ok=True) + (font_dir / 'font').mkdir(parents=True, exist_ok=True) + header.save(font_dir / 'textures' / 'font' / 'tab_header.png') + providers = [{'type': 'bitmap', 'file': 'createrp:font/tab_header.png', 'height': header.height // 3, + 'ascent': header.height // 3 - 2, 'chars': ['\ue000']}] + for char, name, rows in (('\ue001', 'sun', SUN_ICON), ('\ue002', 'moon', MOON_ICON)): + icon = button_icon(rows, canvas=8, at=0).resize((24, 24), Image.NEAREST) + icon.save(font_dir / 'textures' / 'font' / f'tab_{name}.png') + providers.append({'type': 'bitmap', 'file': f'createrp:font/tab_{name}.png', 'height': 8, 'ascent': 7, 'chars': [char]}) + (font_dir / 'font' / 'tab.json').write_text(json.dumps({'providers': providers}, indent=2), encoding='utf-8', newline='\n') + print('player list header:', header.size, '-> GUI', header.width // 3, 'x', header.height // 3) + button_icon(QUIT_ICON, canvas=24).save(OUT / 'menu' / 'quit.png') # the corner buttons are 24 x 24 on_canvas(gear_icon(14), 24).save(OUT / 'menu' / 'settings.png') for name, rows in (('online', ONLINE_ICON), ('offline', OFFLINE_ICON), ('maintenance', MAINTENANCE_ICON)):