From 1dcefc772cea293babdf9e97c2f456337f4ed5a4 Mon Sep 17 00:00:00 2001 From: Fulldroper <40297614+Fulldroper@users.noreply.github.com> Date: Wed, 14 Oct 2026 05:58:03 +0300 Subject: [PATCH] Title screen: icon-only quit, no Create/accessibility/Mods buttons, pack version instead of the Minecraft lines Co-Authored-By: Claude Opus 5.5 --- branding/README.md | 15 ++- branding/menu/quit.png | Bin 0 -> 173 bytes branding/menu/title_screen_layout.txt | 162 ++++++++++++++++++++++++-- tools/branding/build.py | 30 +++++ tools/branding/fancymenu.py | 47 +++++++- 5 files changed, 235 insertions(+), 19 deletions(-) create mode 100644 branding/menu/quit.png diff --git a/branding/README.md b/branding/README.md index 57c07d4..3bdfffc 100644 --- a/branding/README.md +++ b/branding/README.md @@ -39,7 +39,7 @@ | `banners/launch.png` | анонс відкриття, 1280×720 | | `banners/invite.png` | картинка-запрошення, 1200×630 | | `banners/wiki-cover.png` | обкладинка вікі й README, 1280×320 | -| `menu/` | головне меню гри для FancyMenu: тло, лого, макет | +| `menu/` | головне меню гри для FancyMenu: тло, лого, іконка кнопки виходу, макет | | `art/keyart.png` | головний кадр: нічна вулиця з ліхтарями й вежею ратуші; з нього зроблено банери й тло меню | | `art/street-lamps.png`, `art/street-tower.png`, `art/night-aerial.png`, `art/factory-hall.png` | інші нічні кадри столиці — запасні | | `art/keyart-dawn.png`, `art/keyart-sunset.png` | міст і завод на світанку й на заході сонця | @@ -49,12 +49,21 @@ ``` python tools/branding/build.py <1.21.1.jar> branding/art/keyart.png [emblem_raw.png] -python tools/branding/fancymenu.py <тека config гри або збірки> +python tools/branding/fancymenu.py <тека config гри або збірки> <1.21.1.jar> [версія збірки] ``` Перший скрипт малює лого, іконки й банери: шрифт і текстури бере з jar-ів Minecraft і Create (у репозиторії їх немає), тло — з `art/keyart.png`. Заміниш ілюстрацію на свій кадр із гри — перезапусти, і всі банери й тло меню -оновляться. Другий ставить головне меню в теку `config/fancymenu`. +оновляться. Другий ставить головне меню в теку `config/fancymenu` і малює напис із версією збірки в лівому +нижньому куті; версію бере з `pack.toml` поруч із текою `config`, якщо її не вказано. Після кожної зміни версії +збірки його треба запустити знову. + +## Головне меню + +Три ряди кнопок: «Увійти на сервер»; «Гра наодинці» й «Гра в мережі»; мова, «Налаштування» й вихід іконкою. +Сховано: кнопку Create, кнопку спеціальних можливостей (вона є в налаштуваннях), кнопку «Моди» та рядки +Minecraft / NeoForge в лівому нижньому куті — замість них версія збірки. Іконка виходу — `sign-out` із +бібліотеки FD Icons, перемальована на піксельну сітку іконок Minecraft. ## Прапор держави diff --git a/branding/menu/quit.png b/branding/menu/quit.png new file mode 100644 index 0000000000000000000000000000000000000000..49ac1a6c7e5305c9f35fe30bb125db46e04b88ac GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;AiKmNWNX4ADldbs}6ggbj57j>T zw|s)|#*H@*@vBL!z8ijsVKK{t=OV9|-@WrTytv@~L`9|pXC}CYafaUAHS^%iMK7W) zE*oTNspm!Y?Q&fzyN>PDx`b^XgHFx9eD~9>BT=i=r>mdKI;Vst09pq{IsgCw literal 0 HcmV?d00001 diff --git a/branding/menu/title_screen_layout.txt b/branding/menu/title_screen_layout.txt index 6d98999..7d47292 100644 --- a/branding/menu/title_screen_layout.txt +++ b/branding/menu/title_screen_layout.txt @@ -482,6 +482,148 @@ element { nine_slice_slider_handle_border_y = 5 } +element { + iconnormal = [source:local]/config/fancymenu/assets/quit.png + iconhovered = [source:local]/config/fancymenu/assets/quit.png + description = Вийти з гри + button_element_executable_block_identifier = c0ffee00-0000-4000-8000-000000000000-1791950000000 + [executable_action_instance:c0ffee00-0000-4000-8000-0000000000ff-1791950000000][action_type:quitgame] = + [executable_block:c0ffee00-0000-4000-8000-000000000000-1791950000000][type:generic] = [executables:c0ffee00-0000-4000-8000-0000000000ff-1791950000000;] + underline_label_on_hover = false + transparent_background = false + restartbackgroundanimations = true + nine_slice_custom_background = false + navigatable = true + widget_active_state_requirement_container_identifier = c0ffee00-0000-4000-8000-000000000002-1791950000000 + [loading_requirement_container_meta:c0ffee00-0000-4000-8000-000000000002-1791950000000] = [groups:][instances:] + is_template = false + template_apply_width = false + template_apply_height = false + template_apply_posx = false + template_apply_posy = false + template_apply_opacity = false + template_apply_visibility = false + template_apply_label = false + template_share_with = buttons + nine_slice_slider_handle = false + element_type = custom_button + instance_identifier = c0ffee00-0000-4000-8000-000000000003-1791950000000 + appearance_delay = no_delay + disappearance_delay = no_delay + fade_in_v2 = no_fading + fade_out = no_fading + auto_sizing = false + auto_sizing_base_screen_width = 2560 + auto_sizing_base_screen_height = 1355 + sticky_anchor = false + anchor_point = mid-centered + x = 80 + y = 12 + width = 20 + height = 20 + stay_on_screen = true + element_loading_requirement_container_identifier = c0ffee00-0000-4000-8000-000000000004-1791950000000 + [loading_requirement_container_meta:c0ffee00-0000-4000-8000-000000000004-1791950000000] = [groups:][instances:] + enable_parallax = false + invert_parallax = false + animated_offset_x = 0 + animated_offset_y = 0 + load_once_per_session = false + layer_hidden_in_editor = false + advanced_rotation_mode = false + advanced_vertical_tilt_mode = false + advanced_horizontal_tilt_mode = false + should_be_affected_by_decoration_overlays = true + in_editor_color = #FFC800FF + advanced_posx = -2147483648 + advanced_posy = -2147483648 + advanced_width = -2147483648 + advanced_height = -2147483648 + stretch_x = false + stretch_y = false + appearance_delay_seconds = 1.0 + disappearance_delay_seconds = 1.0 + fade_in_speed = 1.0 + fade_out_speed = 1.0 + base_opacity = 1.0 + parallax_intensity_x = 0.5 + parallax_intensity_y = 0.5 + rotation_degrees = 0.0 + advanced_rotation_degrees = 0.0 + vertical_tilt_degrees = 0.0 + advanced_vertical_tilt_degrees = 0.0 + horizontal_tilt_degrees = 0.0 + advanced_horizontal_tilt_degrees = 0.0 + label_scale = 1.0 + label_shadow = true + nine_slice_border_x = 5 + nine_slice_border_y = 5 + nine_slice_slider_handle_border_x = 5 + nine_slice_slider_handle_border_y = 5 +} + +element { + element_type = image + instance_identifier = c0ffee01-0000-4000-8000-000000000000-1791950000000 + appearance_delay = no_delay + disappearance_delay = no_delay + fade_in_v2 = no_fading + fade_out = no_fading + auto_sizing = false + auto_sizing_base_screen_width = 2560 + auto_sizing_base_screen_height = 1355 + sticky_anchor = false + anchor_point = bottom-left + x = 2 + y = -2 + width = {version_width} + height = {version_height} + stay_on_screen = true + element_loading_requirement_container_identifier = c0ffee01-0000-4000-8000-000000000001-1791950000000 + [loading_requirement_container_meta:c0ffee01-0000-4000-8000-000000000001-1791950000000] = [groups:][instances:] + enable_parallax = false + invert_parallax = false + animated_offset_x = 0 + animated_offset_y = 0 + load_once_per_session = false + layer_hidden_in_editor = false + advanced_rotation_mode = false + advanced_vertical_tilt_mode = false + advanced_horizontal_tilt_mode = false + should_be_affected_by_decoration_overlays = false + in_editor_color = #FFC800FF + advanced_posx = -2147483648 + advanced_posy = -2147483648 + advanced_width = -2147483648 + advanced_height = -2147483648 + stretch_x = false + stretch_y = false + appearance_delay_seconds = 1.0 + disappearance_delay_seconds = 1.0 + fade_in_speed = 1.0 + fade_out_speed = 1.0 + base_opacity = 1.0 + parallax_intensity_x = 0.5 + parallax_intensity_y = 0.5 + rotation_degrees = 0.0 + advanced_rotation_degrees = 0.0 + vertical_tilt_degrees = 0.0 + advanced_vertical_tilt_degrees = 0.0 + horizontal_tilt_degrees = 0.0 + advanced_horizontal_tilt_degrees = 0.0 + source = [source:local]/config/fancymenu/assets/version.png + repeat_texture = false + nine_slice_texture = false + nine_slice_texture_border_x = 5 + nine_slice_texture_border_y = 5 + restart_animated_on_menu_load = false + image_tint = #FFFFFF + rounding_radius_top_left = 0.0 + rounding_radius_top_right = 0.0 + rounding_radius_bottom_right = 0.0 + rounding_radius_bottom_left = 0.0 +} + vanilla_button { button_element_executable_block_identifier = 16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602 [executable_block:16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602][type:generic] = [executables:] @@ -557,7 +699,7 @@ vanilla_button { nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_y = 5 automated_button_clicks = 0 - is_hidden = false + is_hidden = true } vanilla_button { @@ -713,7 +855,7 @@ vanilla_button { nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_y = 5 automated_button_clicks = 0 - is_hidden = false + is_hidden = true } vanilla_button { @@ -747,8 +889,8 @@ vanilla_button { auto_sizing_base_screen_height = 1355 sticky_anchor = false anchor_point = mid-centered - x = -124 - y = 36 + x = -100 + y = 12 width = 20 height = 20 stay_on_screen = true @@ -947,7 +1089,7 @@ vanilla_button { nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_y = 5 automated_button_clicks = 0 - is_hidden = false + is_hidden = true } vanilla_button { @@ -981,9 +1123,9 @@ vanilla_button { auto_sizing_base_screen_height = 1355 sticky_anchor = false anchor_point = mid-centered - x = -100 - y = 36 - width = 98 + x = -76 + y = 12 + width = 152 height = 20 stay_on_screen = true element_loading_requirement_container_identifier = 5c271f02-4570-4fc1-99ab-19ea32d7804f-1778341927602 @@ -1337,7 +1479,7 @@ vanilla_button { nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_y = 5 automated_button_clicks = 0 - is_hidden = false + is_hidden = true } vanilla_button { @@ -1493,7 +1635,7 @@ vanilla_button { nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_y = 5 automated_button_clicks = 0 - is_hidden = false + is_hidden = true } vanilla_button { diff --git a/tools/branding/build.py b/tools/branding/build.py index 9998f0a..c2cd101 100644 --- a/tools/branding/build.py +++ b/tools/branding/build.py @@ -188,6 +188,35 @@ 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. +QUIT_ICON = ''' +#######...... +#++++++...... +#+........... +#+.......#... +#+.......##.. +#+..########. +#+..######### +#+..+++++##+. +#+.......#+.. +#+.......+... +#+........... +#######...... ++++++++...... +''' + + +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.""" + 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)) + return im + + def main() -> None: mc_jar, create_jar, key_art = sys.argv[1], sys.argv[2], Path(sys.argv[3]) emblem_raw = Path(sys.argv[4]) if len(sys.argv) > 4 else None @@ -250,6 +279,7 @@ def main() -> None: # --- FancyMenu: title screen background, the logo it shows, window icons ------------------------- 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') print('done:', ', '.join(sorted(str(p.relative_to(OUT)).replace('\\', '/') for p in OUT.rglob('*.png')))) diff --git a/tools/branding/fancymenu.py b/tools/branding/fancymenu.py index aceb463..1836d65 100644 --- a/tools/branding/fancymenu.py +++ b/tools/branding/fancymenu.py @@ -1,17 +1,29 @@ """Writes the FancyMenu configuration of the Create RP title screen into a game's config folder. - python tools/branding/fancymenu.py e.g. the client pack's config/ or a profile's config/ + python tools/branding/fancymenu.py <1.21.1.jar> [pack version] + + 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, -then the usual buttons. The layout file itself is branding/menu/title_screen_layout.txt; this script only copies it -with the pictures and switches the window title, the window icon and the title-screen customisation on. +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 +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. """ import re import shutil import sys +import zipfile from pathlib import Path +import numpy as np +from PIL import Image + ROOT = Path(__file__).resolve().parent.parent.parent +sys.path.insert(0, str(ROOT / 'tools' / 'signs')) +from render import Font # noqa: E402 (the pixel font reader made for the building signs) + MENU, ICONS = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons' WINDOW_TITLE = 'Create RP' @@ -23,15 +35,38 @@ def option(text: str, key: str, value: str) -> str: return pattern.sub(lambda m: m.group(1) + value + m.group(2), text) +def label(font: Font, text: str) -> Image.Image: + """A line of text exactly as the game draws it: white, with the dark shadow one pixel down and right.""" + mask = font.line(text) + rows = np.nonzero(mask.any(axis=1))[0] + mask = mask[rows.min():rows.max() + 1] + h, w = mask.shape + px = np.zeros((h + 1, w + 1, 4), np.uint8) + px[1:, 1:][mask] = (63, 63, 63, 255) + px[:-1, :-1][mask] = (255, 255, 255, 255) + return Image.fromarray(px, 'RGBA') + + def main() -> None: - fm = Path(sys.argv[1]) / 'fancymenu' + config = Path(sys.argv[1]) + fm = config / 'fancymenu' + if len(sys.argv) > 3: + version = sys.argv[3] + else: + version = re.search(r'^version = "([^"]+)"', (config.parent / 'pack.toml').read_text(encoding='utf-8'), re.M).group(1) + with zipfile.ZipFile(sys.argv[2]) as jar: + 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') + version_label.save(fm / 'assets' / 'version.png') for icon in ('favicon-16x16.png', 'favicon-32x32.png'): shutil.copyfile(ICONS / icon, fm / 'assets' / icon) - shutil.copyfile(MENU / 'title_screen_layout.txt', fm / 'customization' / 'title_screen_layout.txt') + layout = (MENU / 'title_screen_layout.txt').read_text(encoding='utf-8') + layout = layout.replace('{version_width}', str(version_label.width)).replace('{version_height}', str(version_label.height)) + (fm / 'customization' / 'title_screen_layout.txt').write_text(layout, encoding='utf-8', newline='\n') (fm / 'customizablemenus.txt').write_text( 'type = customizablemenus\n\nnet.minecraft.client.gui.screens.TitleScreen {\n}\n\n', encoding='utf-8') @@ -43,7 +78,7 @@ def main() -> None: options = option(options, 'custom_window_icon_macos', '') options = option(options, 'global_background_panorama', '') (fm / 'options.txt').write_text(options, encoding='utf-8') - print('title screen installed into', fm) + print('title screen installed into', fm, '| version label:', version, version_label.size) if __name__ == '__main__':